cqdevicemgt/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaMachineLabelMapper.xml

49 lines
2.3 KiB
XML
Raw Normal View History

2024-08-08 14:57:05 +08:00
<?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.sgzb.base.mapper.MaMachineLabelMapper">
<resultMap type="com.bonus.sgzb.base.api.domain.MaMachineLabel" id="MaMachineLabelResult">
<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" />
</resultMap>
<sql id="selectMaMachineLabelVo">
select label_id, label_code, ma_id, is_bind, label_type, company_id
from ma_machine_label
</sql>
<select id="selectMaMachineLabelList" parameterType="com.bonus.sgzb.base.api.domain.MaMachineLabel" resultMap="MaMachineLabelResult">
select label_id, label_code, ma_id, is_bind, label_type, company_id
from ma_machine_label
where is_bind ='0'
</select>
<select id="selectLableNumByMonth" resultType="java.lang.Integer">
select count(*)
from ma_machine_label
where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{nowDate},'%y%m')
</select>
<insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.api.domain.MaMachineLabel" 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>
create_time
</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>
now()
</trim>
</insert>
</mapper>