249 lines
16 KiB
XML
249 lines
16 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.canteen.core.ims.mapper.PurchaseContractMapper">
|
|
<resultMap type="com.bonus.canteen.core.ims.domain.vo.PurchaseContractVO" id="PurchaseContractResult">
|
|
<result property="contractId" column="contract_id" />
|
|
<result property="contractCode" column="contract_code" />
|
|
<result property="supplierId" column="supplier_id" />
|
|
<result property="commitStatus" column="commit_status" />
|
|
<result property="contractStatus" column="contract_status" />
|
|
<result property="contractAmount" column="contract_amount" />
|
|
<result property="orderGoodsAmount" column="order_goods_amount" />
|
|
<result property="contractSigningTime" column="contract_signing_time" />
|
|
<result property="remark" column="remark" />
|
|
<result property="areaId" column="area_id" />
|
|
<result property="canteenId" column="canteen_id" />
|
|
<result property="contractTitle" column="contract_title" />
|
|
<result property="contractStartTime" column="contract_start_time" />
|
|
<result property="contractEndTime" column="contract_end_time" />
|
|
<result property="approveStatus" column="approve_status" />
|
|
<result property="processInstanceId" column="process_instance_id" />
|
|
<result property="approveBy" column="approve_by" />
|
|
<result property="approveTime" column="approve_time" />
|
|
<result property="approveRemark" column="approve_remark" />
|
|
<result property="totalNum" column="total_num" />
|
|
<result property="categoryNum" column="category_num" />
|
|
<result property="payMoneyStyle" column="pay_money_style" />
|
|
<result property="payMoneyDate" column="pay_money_date" />
|
|
<result property="collectMoneyBank" column="collect_money_bank" />
|
|
<result property="collectMoneyAccount" column="collect_money_account" />
|
|
<result property="collectMoneyAccountName" column="collect_money_account_name" />
|
|
<result property="payRemark" column="pay_remark" />
|
|
<result property="contractAttachment" column="contract_attachment" />
|
|
<result property="contractPerson" column="contract_person" />
|
|
<!-- <result property="delFlag" column="del_flag" />-->
|
|
<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="areaName" column="area_name" />
|
|
<result property="canteenName" column="canteen_name" />
|
|
<result property="supplierName" column="supplier_name" />
|
|
</resultMap>
|
|
|
|
<sql id="selectPurchaseContractVo">
|
|
select contract_id, contract_code, ipc.supplier_id, commit_status, contract_status,
|
|
contract_amount, order_goods_amount, contract_signing_time, ipc.remark, ipc.area_id,
|
|
ipc.canteen_id, contract_title, contract_start_time, contract_end_time,
|
|
approve_status, process_instance_id, approve_by, approve_time, approve_remark,
|
|
total_num, category_num, pay_money_style, pay_money_date, collect_money_bank,
|
|
collect_money_account, collect_money_account_name, pay_remark, contract_attachment,
|
|
contract_person, ipc.del_flag, ipc.create_by, ipc.create_time, ipc.update_by, ipc.update_time,
|
|
bc.canteen_name, isr.supplier_name, ba.area_name
|
|
from ims_purchase_contract ipc
|
|
left join basic_canteen bc on bc.canteen_id = ipc.canteen_id
|
|
left join basic_area ba on ba.area_id = ipc.area_id
|
|
left join ims_supplier isr on isr.supplier_id = ipc.supplier_id
|
|
</sql>
|
|
|
|
<select id="selectPurchaseContractList" parameterType="com.bonus.canteen.core.ims.domain.PurchaseContract" resultMap="PurchaseContractResult">
|
|
<include refid="selectPurchaseContractVo"/>
|
|
<where>
|
|
ipc.del_flag = '0'
|
|
<if test="supplierId != null "> and ipc.supplier_id = #{supplierId}</if>
|
|
<if test="commitStatus != null "> and ipc.commit_status = #{commitStatus}</if>
|
|
<if test="contractAmount != null "> and ipc.contract_amount = #{contractAmount}</if>
|
|
<if test="orderGoodsAmount != null "> and ipc.order_goods_amount = #{orderGoodsAmount}</if>
|
|
<if test="contractSigningTime != null "> and ipc.contract_signing_time = #{contractSigningTime}</if>
|
|
<if test="areaId != null "> and ipc.area_id = #{areaId}</if>
|
|
<if test="canteenId != null "> and ipc.canteen_id = #{canteenId}</if>
|
|
<if test="contractTitle != null and contractTitle != ''"> and ipc.contract_title = #{contractTitle}</if>
|
|
<if test="contractStartTime != null "> and ipc.contract_start_time = #{contractStartTime}</if>
|
|
<if test="contractEndTime != null "> and ipc.contract_end_time = #{contractEndTime}</if>
|
|
<if test="approveStatus != null "> and ipc.approve_status = #{approveStatus}</if>
|
|
<if test="processInstanceId != null "> and ipc.process_instance_id = #{processInstanceId}</if>
|
|
<if test="approveBy != null and approveBy != ''"> and ipc.approve_by = #{approveBy}</if>
|
|
<if test="approveTime != null "> and ipc.approve_time = #{approveTime}</if>
|
|
<if test="approveRemark != null and approveRemark != ''"> and ipc.approve_remark = #{approveRemark}</if>
|
|
<if test="totalNum != null "> and ipc.total_num = #{totalNum}</if>
|
|
<if test="categoryNum != null "> and ipc.category_num = #{categoryNum}</if>
|
|
<if test="payMoneyStyle != null "> and ipc.pay_money_style = #{payMoneyStyle}</if>
|
|
<if test="payMoneyDate != null "> and ipc.pay_money_date = #{payMoneyDate}</if>
|
|
<if test="collectMoneyBank != null and collectMoneyBank != ''"> and ipc.collect_money_bank = #{collectMoneyBank}</if>
|
|
<if test="collectMoneyAccount != null and collectMoneyAccount != ''"> and ipc.collect_money_account = #{collectMoneyAccount}</if>
|
|
<if test="collectMoneyAccountName != null and collectMoneyAccountName != ''"> and ipc.collect_money_account_name like concat('%', #{collectMoneyAccountName}, '%')</if>
|
|
<if test="payRemark != null and payRemark != ''"> and ipc.pay_remark = #{payRemark}</if>
|
|
<if test="contractAttachment != null and contractAttachment != ''"> and ipc.contract_attachment = #{contractAttachment}</if>
|
|
<if test="contractPerson != null and contractPerson != ''"> and ipc.contract_person = #{contractPerson}</if>
|
|
<if test="contractStatus != null ">
|
|
<if test="contractStatus == 1 ">
|
|
and NOW() <![CDATA[ < ]]> ipc.contract_start_time and contract_status != 4
|
|
</if>
|
|
<if test="contractStatus == 2 ">
|
|
and (NOW() BETWEEN ipc.contract_start_time and ipc.contract_end_time) and contract_status != 4
|
|
</if>
|
|
<if test="contractStatus == 3 ">
|
|
and NOW() <![CDATA[ > ]]> ipc.contract_end_time and contract_status != 4
|
|
</if>
|
|
<if test="contractStatus == 4 ">
|
|
and ipc.contract_status = 4
|
|
</if>
|
|
</if>
|
|
<if test="searchValue != null and searchValue != ''">
|
|
and (ipc.contract_code like CONCAT('%',#{searchValue},'%')
|
|
or ipc.contract_title like CONCAT('%',#{searchValue},'%')
|
|
or isr.supplier_name like CONCAT('%',#{searchValue},'%')
|
|
)
|
|
</if>
|
|
<if test="startDateTime != null">
|
|
and ipc.contract_start_time <![CDATA[ >= ]]> #{startDateTime}
|
|
</if>
|
|
<if test="endDateTime != null">
|
|
and ipc.contract_start_time <![CDATA[ <= ]]> #{endDateTime}
|
|
</if>
|
|
</where>
|
|
order by ipc.contract_id desc
|
|
</select>
|
|
|
|
<select id="selectPurchaseContractByContractId" parameterType="Long" resultMap="PurchaseContractResult">
|
|
<include refid="selectPurchaseContractVo"/>
|
|
where ipc.del_flag = '0' and contract_id = #{contractId}
|
|
</select>
|
|
|
|
<insert id="insertPurchaseContract" parameterType="com.bonus.canteen.core.ims.domain.PurchaseContract" useGeneratedKeys="true" keyProperty="contractId">
|
|
insert into ims_purchase_contract
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="contractCode != null">contract_code,</if>
|
|
<if test="supplierId != null">supplier_id,</if>
|
|
<if test="commitStatus != null">commit_status,</if>
|
|
<if test="contractStatus != null">contract_status,</if>
|
|
<if test="contractAmount != null">contract_amount,</if>
|
|
<if test="orderGoodsAmount != null">order_goods_amount,</if>
|
|
<if test="contractSigningTime != null">contract_signing_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="areaId != null">area_id,</if>
|
|
<if test="canteenId != null">canteen_id,</if>
|
|
<if test="contractTitle != null">contract_title,</if>
|
|
<if test="contractStartTime != null">contract_start_time,</if>
|
|
<if test="contractEndTime != null">contract_end_time,</if>
|
|
<if test="approveStatus != null">approve_status,</if>
|
|
<if test="processInstanceId != null">process_instance_id,</if>
|
|
<if test="approveBy != null">approve_by,</if>
|
|
<if test="approveTime != null">approve_time,</if>
|
|
<if test="approveRemark != null">approve_remark,</if>
|
|
<if test="totalNum != null">total_num,</if>
|
|
<if test="categoryNum != null">category_num,</if>
|
|
<if test="payMoneyStyle != null">pay_money_style,</if>
|
|
<if test="payMoneyDate != null">pay_money_date,</if>
|
|
<if test="collectMoneyBank != null">collect_money_bank,</if>
|
|
<if test="collectMoneyAccount != null">collect_money_account,</if>
|
|
<if test="collectMoneyAccountName != null">collect_money_account_name,</if>
|
|
<if test="payRemark != null">pay_remark,</if>
|
|
<if test="contractAttachment != null">contract_attachment,</if>
|
|
<if test="contractPerson != null">contract_person,</if>
|
|
<if test="delFlag != null">del_flag,</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="contractCode != null">#{contractCode},</if>
|
|
<if test="supplierId != null">#{supplierId},</if>
|
|
<if test="commitStatus != null">#{commitStatus},</if>
|
|
<if test="contractStatus != null">#{contractStatus},</if>
|
|
<if test="contractAmount != null">#{contractAmount},</if>
|
|
<if test="orderGoodsAmount != null">#{orderGoodsAmount},</if>
|
|
<if test="contractSigningTime != null">#{contractSigningTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="areaId != null">#{areaId},</if>
|
|
<if test="canteenId != null">#{canteenId},</if>
|
|
<if test="contractTitle != null">#{contractTitle},</if>
|
|
<if test="contractStartTime != null">#{contractStartTime},</if>
|
|
<if test="contractEndTime != null">#{contractEndTime},</if>
|
|
<if test="approveStatus != null">#{approveStatus},</if>
|
|
<if test="processInstanceId != null">#{processInstanceId},</if>
|
|
<if test="approveBy != null">#{approveBy},</if>
|
|
<if test="approveTime != null">#{approveTime},</if>
|
|
<if test="approveRemark != null">#{approveRemark},</if>
|
|
<if test="totalNum != null">#{totalNum},</if>
|
|
<if test="categoryNum != null">#{categoryNum},</if>
|
|
<if test="payMoneyStyle != null">#{payMoneyStyle},</if>
|
|
<if test="payMoneyDate != null">#{payMoneyDate},</if>
|
|
<if test="collectMoneyBank != null">#{collectMoneyBank},</if>
|
|
<if test="collectMoneyAccount != null">#{collectMoneyAccount},</if>
|
|
<if test="collectMoneyAccountName != null">#{collectMoneyAccountName},</if>
|
|
<if test="payRemark != null">#{payRemark},</if>
|
|
<if test="contractAttachment != null">#{contractAttachment},</if>
|
|
<if test="contractPerson != null">#{contractPerson},</if>
|
|
<if test="delFlag != null">#{delFlag},</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updatePurchaseContract" parameterType="com.bonus.canteen.core.ims.domain.PurchaseContract">
|
|
update ims_purchase_contract
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<!-- <if test="contractCode != null">contract_code = #{contractCode},</if>-->
|
|
<if test="supplierId != null">supplier_id = #{supplierId},</if>
|
|
<if test="commitStatus != null">commit_status = #{commitStatus},</if>
|
|
<if test="contractStatus != null">contract_status = #{contractStatus},</if>
|
|
<if test="contractAmount != null">contract_amount = #{contractAmount},</if>
|
|
<if test="orderGoodsAmount != null">order_goods_amount = #{orderGoodsAmount},</if>
|
|
<if test="contractSigningTime != null">contract_signing_time = #{contractSigningTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
|
<if test="canteenId != null">canteen_id = #{canteenId},</if>
|
|
<if test="contractTitle != null">contract_title = #{contractTitle},</if>
|
|
<if test="contractStartTime != null">contract_start_time = #{contractStartTime},</if>
|
|
<if test="contractEndTime != null">contract_end_time = #{contractEndTime},</if>
|
|
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
|
|
<if test="processInstanceId != null">process_instance_id = #{processInstanceId},</if>
|
|
<if test="approveBy != null">approve_by = #{approveBy},</if>
|
|
<if test="approveTime != null">approve_time = #{approveTime},</if>
|
|
<if test="approveRemark != null">approve_remark = #{approveRemark},</if>
|
|
<if test="totalNum != null">total_num = #{totalNum},</if>
|
|
<if test="categoryNum != null">category_num = #{categoryNum},</if>
|
|
<if test="payMoneyStyle != null">pay_money_style = #{payMoneyStyle},</if>
|
|
<if test="payMoneyDate != null">pay_money_date = #{payMoneyDate},</if>
|
|
<if test="collectMoneyBank != null">collect_money_bank = #{collectMoneyBank},</if>
|
|
<if test="collectMoneyAccount != null">collect_money_account = #{collectMoneyAccount},</if>
|
|
<if test="collectMoneyAccountName != null">collect_money_account_name = #{collectMoneyAccountName},</if>
|
|
<if test="payRemark != null">pay_remark = #{payRemark},</if>
|
|
<if test="contractAttachment != null">contract_attachment = #{contractAttachment},</if>
|
|
<if test="contractPerson != null">contract_person = #{contractPerson},</if>
|
|
<!-- <if test="delFlag != null">del_flag = #{delFlag},</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>
|
|
</trim>
|
|
where contract_id = #{contractId}
|
|
</update>
|
|
|
|
<delete id="deletePurchaseContractByContractId" parameterType="Long">
|
|
update ims_purchase_contract set del_flag = '2' where contract_id = #{contractId}
|
|
</delete>
|
|
|
|
<delete id="deletePurchaseContractByContractIds" parameterType="String">
|
|
update ims_purchase_contract set del_flag = '2' where contract_id in
|
|
<foreach item="contractId" collection="array" open="(" separator="," close=")">
|
|
#{contractId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |