Bonus-Cloud-Material/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineLabelMapper.xml

83 lines
4.1 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.bonus.material.ma.mapper.MachineLabelMapper">
<resultMap type="com.bonus.material.ma.domain.MachineLabel" id="MachineLabelResult">
<result property="labelId" column="label_id" />
<result property="labelCode" column="label_code" />
<result property="maId" column="ma_id" />
<result property="isBind" column="is_bind" />
<result property="labelType" column="label_type" />
<result property="companyId" column="company_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectMachineLabelVo">
select label_id, label_code, ma_id, is_bind, label_type, company_id, create_time, update_time from ma_machine_label
</sql>
<select id="selectMachineLabelList" parameterType="com.bonus.material.ma.domain.MachineLabel" resultMap="MachineLabelResult">
<include refid="selectMachineLabelVo"/>
<where>
<if test="labelCode != null and labelCode != ''"> and label_code = #{labelCode}</if>
<if test="maId != null and maId != ''"> and ma_id = #{maId}</if>
<if test="isBind != null and isBind != ''"> and is_bind = #{isBind}</if>
<if test="labelType != null "> and label_type = #{labelType}</if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
</where>
</select>
<select id="selectMachineLabelByLabelId" parameterType="Long" resultMap="MachineLabelResult">
<include refid="selectMachineLabelVo"/>
where label_id = #{labelId}
</select>
<insert id="insertMachineLabel" parameterType="com.bonus.material.ma.domain.MachineLabel" useGeneratedKeys="true" keyProperty="labelId">
insert into ma_machine_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="labelCode != null">label_code,</if>
<if test="maId != null">ma_id,</if>
<if test="isBind != null">is_bind,</if>
<if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="labelCode != null">#{labelCode},</if>
<if test="maId != null">#{maId},</if>
<if test="isBind != null">#{isBind},</if>
<if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMachineLabel" parameterType="com.bonus.material.ma.domain.MachineLabel">
update ma_machine_label
<trim prefix="SET" suffixOverrides=",">
<if test="labelCode != null">label_code = #{labelCode},</if>
<if test="maId != null">ma_id = #{maId},</if>
<if test="isBind != null">is_bind = #{isBind},</if>
<if test="labelType != null">label_type = #{labelType},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where label_id = #{labelId}
</update>
<delete id="deleteMachineLabelByLabelId" parameterType="Long">
delete from ma_machine_label where label_id = #{labelId}
</delete>
<delete id="deleteMachineLabelByLabelIds" parameterType="String">
delete from ma_machine_label where label_id in
<foreach item="labelId" collection="array" open="(" separator="," close=")">
#{labelId}
</foreach>
</delete>
</mapper>