devicesmgt/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml

101 lines
5.5 KiB
XML
Raw Normal View History

2023-12-10 17:30:51 +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.material.mapper.PurchaseCheckDetailsMapper">
<resultMap type="com.bonus.sgzb.material.domain.PurchaseCheckDetails" id="PurchaseCheckDetailsResult">
<result property="taskId" column="task_id" />
<result property="typeId" column="type_id" />
<result property="purchasePrice" column="purchase_price" />
<result property="purchaseNum" column="purchase_num" />
<result property="supplierId" column="supplier_id" />
<result property="createBy" column="create_by" />
<result property="productionTime" column="production_time" />
<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" />
</resultMap>
<sql id="selectPurchaseCheckDetailsVo">
select task_id, type_id, purchase_price, purchase_num, supplier_id, create_by, production_time, create_time, update_by, update_time, remark, company_id from purchase_check_details
</sql>
<select id="selectPurchaseCheckDetailsList" parameterType="com.bonus.sgzb.material.domain.PurchaseCheckDetails" resultMap="PurchaseCheckDetailsResult">
<include refid="selectPurchaseCheckDetailsVo"/>
<where>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="purchasePrice != null and purchasePrice != ''"> and purchase_price = #{purchasePrice}</if>
<if test="purchaseNum != null "> and purchase_num = #{purchaseNum}</if>
<if test="supplierId != null "> and supplier_id = #{supplierId}</if>
<if test="productionTime != null "> and production_time = #{productionTime}</if>
<if test="companyId != null "> and company_id = #{companyId}</if>
</where>
</select>
<select id="selectPurchaseCheckDetailsByTaskId" parameterType="Long" resultMap="PurchaseCheckDetailsResult">
<include refid="selectPurchaseCheckDetailsVo"/>
where task_id = #{taskId}
</select>
<insert id="insertPurchaseCheckDetails" parameterType="com.bonus.sgzb.material.domain.PurchaseCheckDetails" useGeneratedKeys="true" keyProperty="taskId">
insert into purchase_check_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null">type_id,</if>
<if test="purchasePrice != null">purchase_price,</if>
<if test="purchaseNum != null">purchase_num,</if>
<if test="supplierId != null">supplier_id,</if>
<if test="createBy != null">create_by,</if>
<if test="productionTime != null">production_time,</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="typeId != null">#{typeId},</if>
<if test="purchasePrice != null">#{purchasePrice},</if>
<if test="purchaseNum != null">#{purchaseNum},</if>
<if test="supplierId != null">#{supplierId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="productionTime != null">#{productionTime},</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="updatePurchaseCheckDetails" parameterType="com.bonus.sgzb.material.domain.PurchaseCheckDetails">
update purchase_check_details
<trim prefix="SET" suffixOverrides=",">
<if test="typeId != null">type_id = #{typeId},</if>
<if test="purchasePrice != null">purchase_price = #{purchasePrice},</if>
<if test="purchaseNum != null">purchase_num = #{purchaseNum},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="productionTime != null">production_time = #{productionTime},</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 task_id = #{taskId}
</update>
<delete id="deletePurchaseCheckDetailsByTaskId" parameterType="Long">
delete from purchase_check_details where task_id = #{taskId}
</delete>
<delete id="deletePurchaseCheckDetailsByTaskIds" parameterType="String">
delete from purchase_check_details where task_id in
<foreach item="taskId" collection="array" open="(" separator="," close=")">
#{taskId}
</foreach>
</delete>
</mapper>