2024-07-21 13:34:34 +00: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.xdadan.erp.emis.mapper.EmisSettleInvoiceRelMapper">
|
|
|
|
|
|
2024-07-24 23:29:26 +00:00
|
|
|
<resultMap type="EmisSettleInvoiceRel" id="EmisSettleInvoiceRelResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
2024-07-21 13:34:34 +00:00
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="applySeqNo" column="apply_seq_no" />
|
|
|
|
|
<result property="payId" column="pay_id" />
|
|
|
|
|
<result property="billNo" column="bill_no" />
|
|
|
|
|
<result property="money" column="money" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2024-09-01 23:34:41 +00:00
|
|
|
<resultMap id="EmisSettleInvoiceRelWithSubBillResult" type="EmisSettleInvoiceRel" extends="EmisSettleInvoiceRelResult" >
|
|
|
|
|
<association property="waybillDetail"
|
|
|
|
|
column="bill_no"
|
|
|
|
|
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
|
|
|
|
|
fetchType="lazy"
|
|
|
|
|
/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2024-07-21 13:34:34 +00:00
|
|
|
<sql id="selectEmisSettleInvoiceRelVo">
|
|
|
|
|
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_invoice_rel
|
|
|
|
|
</sql>
|
|
|
|
|
|
2024-09-01 23:34:41 +00:00
|
|
|
<select id="selectEmisSettleInvoiceRelList" parameterType="EmisSettleInvoiceRel" resultMap="EmisSettleInvoiceRelWithSubBillResult">
|
2024-07-21 13:34:34 +00:00
|
|
|
<include refid="selectEmisSettleInvoiceRelVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
del_flag='0'
|
|
|
|
|
<if test="id != null "> and id = #{id}</if>
|
2024-09-01 23:34:41 +00:00
|
|
|
<if test="applySeqNo != null and applySeqNo != ''"> and apply_seq_no=#{applySeqNo}</if>
|
2024-07-21 13:34:34 +00:00
|
|
|
<if test="payId != null and payId != ''"> and pay_id like concat('%', #{payId}, '%')</if>
|
|
|
|
|
<if test="billNo != null and billNo != ''"> and bill_no like concat('%', #{billNo}, '%')</if>
|
|
|
|
|
<if test="money != null "> and money = #{money}</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
|
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
|
|
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
|
|
|
|
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
|
|
|
|
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
|
|
|
|
</where>
|
|
|
|
|
order by create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="checkUnique" parameterType="EmisSettleInvoiceRel" resultType="int">
|
|
|
|
|
select count(1) from emis_settle_invoice_rel
|
|
|
|
|
where del_flag='0'
|
|
|
|
|
and id = #{id}
|
|
|
|
|
and apply_seq_no = #{applySeqNo}
|
|
|
|
|
and pay_id = #{payId}
|
|
|
|
|
and bill_no = #{billNo}
|
|
|
|
|
and money = #{money}
|
|
|
|
|
and del_flag = #{delFlag}
|
|
|
|
|
and create_by = #{createBy}
|
|
|
|
|
and create_time = #{createTime}
|
|
|
|
|
and update_by = #{updateBy}
|
|
|
|
|
and update_time = #{updateTime}
|
|
|
|
|
and create_site = #{createSite}
|
|
|
|
|
and update_site = #{updateSite}
|
|
|
|
|
limit 1
|
|
|
|
|
</select>
|
2024-08-20 11:15:10 +00:00
|
|
|
|
|
|
|
|
|
2024-07-21 13:34:34 +00:00
|
|
|
<select id="selectEmisSettleInvoiceRelById" parameterType="Long" resultMap="EmisSettleInvoiceRelResult">
|
2024-08-20 11:15:10 +00:00
|
|
|
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
2024-07-21 13:34:34 +00:00
|
|
|
from emis_settle_invoice_rel a
|
|
|
|
|
where a.id = #{id}
|
|
|
|
|
</select>
|
2024-08-20 11:15:10 +00:00
|
|
|
|
2024-09-01 23:34:41 +00:00
|
|
|
<select id="selectListByApplySeqNo" parameterType="String" resultMap="EmisSettleInvoiceRelWithSubBillResult">
|
2024-08-20 11:15:10 +00:00
|
|
|
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
|
|
|
from emis_settle_invoice_rel a
|
|
|
|
|
where a.apply_seq_no = #{applySeqNo} and del_flag='0'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectHasOpenListBySettleBillNo" parameterType="String" resultMap="EmisSettleInvoiceRelResult">
|
|
|
|
|
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
|
|
|
from emis_settle_invoice_rel a
|
|
|
|
|
where del_flag='0'
|
|
|
|
|
AND apply_seq_no IN (
|
|
|
|
|
SELECT x1.apply_seq_no FROM
|
|
|
|
|
emis_settle_invoice_record x1,
|
|
|
|
|
emis_settle_bill x2
|
|
|
|
|
WHERE
|
|
|
|
|
x1.del_flag = '0' and x1.bl_audit!='2'
|
|
|
|
|
AND x2.del_flag = '0'
|
|
|
|
|
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
|
|
|
|
AND FIND_IN_SET( x2.settle_bill_no, #{settleBillNo})
|
|
|
|
|
)
|
2024-09-23 09:53:08 +00:00
|
|
|
AND a.bill_no IN (
|
|
|
|
|
select essb.bill_no from emis_settle_sub_bill essb where essb.del_flag='0' and FIND_IN_SET( essb.settle_bill_no, #{settleBillNo})
|
2024-09-11 09:26:22 +00:00
|
|
|
)
|
2024-08-20 11:15:10 +00:00
|
|
|
</select>
|
|
|
|
|
|
2024-08-21 00:42:22 +00:00
|
|
|
<select id="selectHasOpenInvoiceMapList" parameterType="String" resultType="map">
|
2024-08-21 00:46:04 +00:00
|
|
|
select bill_no as billNo, sum(money) sumMoney
|
2024-08-21 00:18:05 +00:00
|
|
|
from emis_settle_invoice_rel a
|
|
|
|
|
where del_flag='0'
|
|
|
|
|
AND apply_seq_no IN (
|
|
|
|
|
SELECT x1.apply_seq_no FROM
|
|
|
|
|
emis_settle_invoice_record x1,
|
|
|
|
|
emis_settle_bill x2
|
|
|
|
|
WHERE
|
|
|
|
|
x1.del_flag = '0' and x1.bl_audit!='2'
|
|
|
|
|
AND x2.del_flag = '0'
|
|
|
|
|
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
|
|
|
|
AND FIND_IN_SET( x2.settle_bill_no, #{settleBillNo})
|
|
|
|
|
)
|
2024-09-23 09:53:08 +00:00
|
|
|
AND a.bill_no IN (
|
|
|
|
|
select essb.bill_no from emis_settle_sub_bill essb where essb.del_flag='0' and FIND_IN_SET( essb.settle_bill_no, #{settleBillNo})
|
2024-09-11 09:26:22 +00:00
|
|
|
)
|
2024-08-21 00:18:05 +00:00
|
|
|
group by bill_no
|
|
|
|
|
</select>
|
|
|
|
|
|
2024-08-20 11:15:10 +00:00
|
|
|
|
2024-07-21 13:34:34 +00:00
|
|
|
<insert id="insertEmisSettleInvoiceRel" parameterType="EmisSettleInvoiceRel" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into emis_settle_invoice_rel
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="applySeqNo != null and applySeqNo != ''">apply_seq_no,</if>
|
|
|
|
|
<if test="payId != null and payId != ''">pay_id,</if>
|
|
|
|
|
<if test="billNo != null and billNo != ''">bill_no,</if>
|
|
|
|
|
<if test="money != null">money,</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="createSite != null and createSite != ''">create_site,</if>
|
|
|
|
|
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="applySeqNo != null and applySeqNo != ''">#{applySeqNo},</if>
|
|
|
|
|
<if test="payId != null and payId != ''">#{payId},</if>
|
|
|
|
|
<if test="billNo != null and billNo != ''">#{billNo},</if>
|
|
|
|
|
<if test="money != null">#{money},</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
|
|
|
|
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateEmisSettleInvoiceRel" parameterType="EmisSettleInvoiceRel">
|
|
|
|
|
update emis_settle_invoice_rel
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="applySeqNo != null and applySeqNo != ''">apply_seq_no = #{applySeqNo},</if>
|
|
|
|
|
<if test="payId != null and payId != ''">pay_id = #{payId},</if>
|
|
|
|
|
<if test="billNo != null and billNo != ''">bill_no = #{billNo},</if>
|
|
|
|
|
<if test="money != null">money = #{money},</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
|
|
|
|
|
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmisSettleInvoiceRelById" parameterType="Long">
|
|
|
|
|
delete from emis_settle_invoice_rel where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmisSettleInvoiceRelByIds" parameterType="String">
|
|
|
|
|
delete from emis_settle_invoice_rel where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|