107 lines
5.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ics.admin.mapper.RepairDeviceMapper">
<resultMap type="com.ics.admin.domain.RepairDevice" id="RepairDeviceResult">
<result property="id" column="id" />
<result property="typeId" column="type_id" />
<result property="name" column="name" />
<result property="brand" column="brand" />
<result property="specification" column="specification" />
<result property="remark" column="remark" />
<result property="deleteFlag" column="delete_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="tenantId" column="tenant_id" />
<result property="parkId" column="park_id" />
</resultMap>
<sql id="selectRepairDeviceVo">
SELECT id, type_id, name, brand, specification, remark, delete_flag, create_by, create_time, update_by, update_time, tenant_id, park_id FROM ics_repair_device
</sql>
<select id="selectRepairDeviceList" parameterType="RepairDevice" resultMap="RepairDeviceResult">
<include refid="selectRepairDeviceVo"/>
<where>
<if test="name != null and name != ''"> AND name LIKE CONCAT('%', #{name}, '%')</if>
</where>
</select>
<select id="getRepairDeviceTypeList" parameterType="Long" resultMap="RepairDeviceResult">
<include refid="selectRepairDeviceVo"/>
where delete_flag=0 and type_id= #{typeId} order by id
</select>
<select id="selectRepairDeviceById" parameterType="Long" resultMap="RepairDeviceResult">
<include refid="selectRepairDeviceVo"/>
WHERE id = #{id}
</select>
<insert id="insertRepairDevice" parameterType="RepairDevice" useGeneratedKeys="true" keyProperty="id">
INSERT INTO ics_repair_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null ">type_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="brand != null and brand != ''">brand,</if>
<if test="specification != null and specification != ''">specification,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null ">update_time,</if>
<if test="tenantId != null ">tenant_id,</if>
<if test="parkId != null ">park_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null ">#{typeId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="brand != null and brand != ''">#{brand},</if>
<if test="specification != null and specification != ''">#{specification},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="tenantId != null ">#{tenantId},</if>
<if test="parkId != null ">#{parkId},</if>
</trim>
</insert>
<update id="updateRepairDevice" parameterType="RepairDevice">
UPDATE ics_repair_device
<trim prefix="SET" suffixOverrides=",">
<if test="typeId != null ">type_id = #{typeId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="brand != null and brand != ''">brand = #{brand},</if>
<if test="specification != null and specification != ''">specification = #{specification},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="tenantId != null ">tenant_id = #{tenantId},</if>
<if test="parkId != null ">park_id = #{parkId},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteRepairDeviceById" parameterType="Long">
DELETE FROM ics_repair_device WHERE id = #{id}
</delete>
<delete id="deleteRepairDeviceByIds" parameterType="String">
DELETE FROM ics_repair_device where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>