2024-09-27 15:38:58 +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.material.purchase.mapper.PurchaseMacodeInfoMapper">
|
|
|
|
|
<resultMap type="com.bonus.material.purchase.domain.PurchaseMacodeInfo" id="PurchaseMacodeInfoResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="taskId" column="task_id" />
|
|
|
|
|
<result property="typeId" column="type_id" />
|
|
|
|
|
<result property="maCode" column="ma_code" />
|
|
|
|
|
<result property="qrCode" column="qr_code" />
|
|
|
|
|
<result property="fixCode" column="fix_code" />
|
|
|
|
|
<result property="codeType" column="code_type" />
|
|
|
|
|
<result property="status" column="status" />
|
|
|
|
|
<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="remark" column="remark" />
|
|
|
|
|
<result property="companyId" column="company_id" />
|
2024-11-15 16:41:54 +08:00
|
|
|
<result property="outFacCode" column="out_fac_code" />
|
2024-11-15 16:21:59 +08:00
|
|
|
<result property="unitName" column="unit_name" />
|
|
|
|
|
<result property="typeName" column="type_name" />
|
|
|
|
|
<result property="maTypeName" column="ma_type_name" />
|
|
|
|
|
<result property="productionTime" column="production_time" />
|
2024-09-27 15:38:58 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectPurchaseMacodeInfoVo">
|
2024-11-15 16:21:59 +08:00
|
|
|
select pmi.id, pmi.task_id, pmi.type_id, pmi.ma_code, pmi.qr_code, pmi.fix_code, pmi.code_type, pmi.status,
|
2024-11-15 16:41:54 +08:00
|
|
|
pmi.create_by, pmi.create_time, pmi.update_by, pmi.update_time, pmi.remark, pmi.company_id, pmi.out_fac_code,
|
|
|
|
|
mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, pcd.production_time
|
2024-11-15 16:21:59 +08:00
|
|
|
from purchase_macode_info pmi
|
|
|
|
|
left join ma_type mt on pmi.type_id = mt.type_id
|
|
|
|
|
left join ma_type mtp on mt.parent_id = mtp.type_id
|
2024-11-15 16:41:54 +08:00
|
|
|
left join purchase_check_details pcd on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
|
2024-09-27 15:38:58 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectPurchaseMacodeInfoList" parameterType="com.bonus.material.purchase.domain.PurchaseMacodeInfo" resultMap="PurchaseMacodeInfoResult">
|
|
|
|
|
<include refid="selectPurchaseMacodeInfoVo"/>
|
|
|
|
|
<where>
|
2024-11-15 16:21:59 +08:00
|
|
|
<if test="taskId != null "> and pmi.task_id = #{taskId}</if>
|
|
|
|
|
<if test="typeId != null "> and pmi.type_id = #{typeId}</if>
|
|
|
|
|
<if test="maCode != null and maCode != ''"> and pmi.ma_code = #{maCode}</if>
|
2024-11-15 16:41:54 +08:00
|
|
|
<if test="outFacCode != null and outFacCode != ''"> and pmi.out_fac_code = #{outFacCode}</if>
|
2024-11-15 16:21:59 +08:00
|
|
|
<if test="qrCode != null and qrCode != ''"> and pmi.qr_code = #{qrCode}</if>
|
|
|
|
|
<if test="fixCode != null and fixCode != ''"> and pmi.fix_code = #{fixCode}</if>
|
|
|
|
|
<if test="codeType != null and codeType != ''"> and pmi.code_type = #{codeType}</if>
|
|
|
|
|
<if test="status != null and status != ''"> and pmi.status = #{status}</if>
|
|
|
|
|
<if test="companyId != null "> and pmi.company_id = #{companyId}</if>
|
2024-09-27 15:38:58 +08:00
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectPurchaseMacodeInfoById" parameterType="Long" resultMap="PurchaseMacodeInfoResult">
|
|
|
|
|
<include refid="selectPurchaseMacodeInfoVo"/>
|
2024-11-15 16:21:59 +08:00
|
|
|
where pmi.id = #{id}
|
2024-09-27 15:38:58 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertPurchaseMacodeInfo" parameterType="com.bonus.material.purchase.domain.PurchaseMacodeInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into purchase_macode_info
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="taskId != null">task_id,</if>
|
|
|
|
|
<if test="typeId != null">type_id,</if>
|
|
|
|
|
<if test="maCode != null">ma_code,</if>
|
2024-11-15 16:41:54 +08:00
|
|
|
<if test="outFacCode != null">out_fac_code,</if>
|
2024-09-27 15:38:58 +08:00
|
|
|
<if test="qrCode != null">qr_code,</if>
|
|
|
|
|
<if test="fixCode != null">fix_code,</if>
|
|
|
|
|
<if test="codeType != null">code_type,</if>
|
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
|
<if test="companyId != null">company_id,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="taskId != null">#{taskId},</if>
|
|
|
|
|
<if test="typeId != null">#{typeId},</if>
|
|
|
|
|
<if test="maCode != null">#{maCode},</if>
|
2024-11-15 16:41:54 +08:00
|
|
|
<if test="outFacCode != null">#{outFacCode},</if>
|
2024-09-27 15:38:58 +08:00
|
|
|
<if test="qrCode != null">#{qrCode},</if>
|
|
|
|
|
<if test="fixCode != null">#{fixCode},</if>
|
|
|
|
|
<if test="codeType != null">#{codeType},</if>
|
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
|
<if test="companyId != null">#{companyId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updatePurchaseMacodeInfo" parameterType="com.bonus.material.purchase.domain.PurchaseMacodeInfo">
|
|
|
|
|
update purchase_macode_info
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="taskId != null">task_id = #{taskId},</if>
|
|
|
|
|
<if test="typeId != null">type_id = #{typeId},</if>
|
|
|
|
|
<if test="maCode != null">ma_code = #{maCode},</if>
|
2024-11-15 16:41:54 +08:00
|
|
|
<if test="outFacCode != null">out_fac_code = #{outFacCode},</if>
|
2024-09-27 15:38:58 +08:00
|
|
|
<if test="qrCode != null">qr_code = #{qrCode},</if>
|
|
|
|
|
<if test="fixCode != null">fix_code = #{fixCode},</if>
|
|
|
|
|
<if test="codeType != null">code_type = #{codeType},</if>
|
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
<if test="companyId != null">company_id = #{companyId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deletePurchaseMacodeInfoById" parameterType="Long">
|
|
|
|
|
delete from purchase_macode_info where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deletePurchaseMacodeInfoByIds" parameterType="String">
|
|
|
|
|
delete from purchase_macode_info where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2024-11-18 11:24:36 +08:00
|
|
|
|
|
|
|
|
<select id="getPurchaseMaCodeCount" resultType="Integer">
|
|
|
|
|
select count(1) from purchase_macode_info where task_id = #{taskId} and type_id = #{typeId}
|
|
|
|
|
</select>
|
2024-09-27 15:38:58 +08:00
|
|
|
</mapper>
|