devicesmgt/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaLabelBindMapper.xml

93 lines
4.5 KiB
XML
Raw Normal View History

2023-12-01 14:42:00 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2023-12-15 14:03:03 +08:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2023-12-08 09:51:56 +08:00
<mapper namespace="com.bonus.sgzb.base.mapper.MaLabelBindMapper">
2023-12-15 14:03:03 +08:00
<resultMap type="com.bonus.sgzb.base.vo.MaLabelBindVO" id="MaLabelBindVOResult">
<result property="labelId" column="label_id" />
<result property="labelType" column="label_type" />
<result property="labelCode" column="label_code" />
<result property="typeName" column="type_name" />
<result property="typeName" column="type_name" />
<result property="typeName" column="type_name" />
<result property="maCode" column="ma_code" />
<result property="isBind" column="is_bind" />
</resultMap>
2023-12-01 14:42:00 +08:00
2023-12-15 14:03:03 +08:00
<sql id="selectMaLabelBindVo">
select a.label_id,a.label_type,a.label_code,c.type_name,d.type_name,f.type_name,b.ma_code,a.is_bind
from ma_machine_label a
left JOIN ma_machine b on a.type_id=b.type_id
left Join ma_type c on a.type_id=c.type_id
left Join ma_type d on a.type_id=d.type_id
left Join ma_type f on a.type_id=f.type_id
left join ma_label_bind e on a.type_id=e.type_id
2023-12-01 14:42:00 +08:00
</sql>
2023-12-15 14:03:03 +08:00
<select id="selectMaLabelBindList" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" resultMap="MaLabelBindVOResult">
select a.label_id,a.label_type,a.label_code,c.type_name,d.type_name,f.type_name,b.ma_code,a.is_bind
from ma_machine_label a
left JOIN ma_machine b on a.type_id=b.type_id
left Join ma_type c on a.type_id=c.type_id
left Join ma_type d on a.type_id=d.type_id
left Join ma_type f on a.type_id=f.type_id
left join ma_label_bind e on a.type_id=e.type_id
2023-12-01 14:42:00 +08:00
<where>
2023-12-15 14:03:03 +08:00
<if test="labelCode != null and labelCode != ''"> and label_code = #{labelCode}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="bindTime != null and bindTime != ''"> and bind_time = #{bindTime}</if>
<if test="binder != null and binder != ''"> and binder = #{binder}</if>
<if test="labelType != null "> and label_type = #{labelType}</if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
2023-12-01 14:42:00 +08:00
</where>
</select>
2023-12-15 14:03:03 +08:00
<select id="selectMaLabelBindByMaId" parameterType="Long" resultMap="MaLabelBindVOResult">
<include refid="selectMaLabelBindVo"/>
where ma_id = #{maId}
2023-12-01 14:42:00 +08:00
</select>
2023-12-15 14:03:03 +08:00
<insert id="insertMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" useGeneratedKeys="true" keyProperty="maId">
insert into ma_label_bind
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="labelCode != null">label_code,</if>
<if test="typeId != null">type_id,</if>
<if test="bindTime != null">bind_time,</if>
<if test="binder != null">binder,</if>
<if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="labelCode != null">#{labelCode},</if>
<if test="typeId != null">#{typeId},</if>
<if test="bindTime != null">#{bindTime},</if>
<if test="binder != null">#{binder},</if>
<if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<update id="updateMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
update ma_label_bind
<trim prefix="SET" suffixOverrides=",">
<if test="labelCode != null">label_code = #{labelCode},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="bindTime != null">bind_time = #{bindTime},</if>
<if test="binder != null">binder = #{binder},</if>
<if test="labelType != null">label_type = #{labelType},</if>
<if test="companyId != null">company_id = #{companyId},</if>
</trim>
where ma_id = #{maId}
</update>
2023-12-01 14:42:00 +08:00
2023-12-15 14:03:03 +08:00
<delete id="deleteMaLabelBindByMaId" parameterType="Long">
delete from ma_label_bind where ma_id = #{maId}
</delete>
<delete id="deleteMaLabelBindByMaIds" parameterType="String">
delete from ma_label_bind where ma_id in
<foreach item="maId" collection="array" open="(" separator="," close=")">
#{maId}
</foreach>
</delete>
2023-12-01 14:42:00 +08:00
</mapper>