157 lines
8.0 KiB
XML
157 lines
8.0 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.xdadan.erp.emis.mapper.EmisSettlePayRelMapper">
|
|
|
|
<resultMap type="EmisSettlePayRel" id="EmisSettlePayRelResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id" />
|
|
<result property="payId" column="pay_id" />
|
|
<result property="billNo" column="bill_no" />
|
|
<result property="payMoney" column="pay_money" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisSettlePayRelVo">
|
|
select id, pay_id, bill_no, pay_money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_pay_rel
|
|
</sql>
|
|
|
|
<select id="selectEmisSettlePayRelList" parameterType="EmisSettlePayRel" resultMap="EmisSettlePayRelResult">
|
|
<include refid="selectEmisSettlePayRelVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="payId != null and payId != ''"> and pay_id = #{payId}</if>
|
|
<if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
|
|
<if test="payMoney != null "> and pay_money = #{payMoney}</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="selectHasPayListBySettleBillNo" parameterType="String" resultMap="EmisSettlePayRelResult">
|
|
select id, pay_id, bill_no, pay_money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_settle_pay_rel a
|
|
where del_flag='0'
|
|
AND pay_id IN (
|
|
SELECT x1.pay_id FROM
|
|
emis_settle_pay_record x1,
|
|
emis_settle_bill x2
|
|
WHERE
|
|
x1.del_flag = '0'
|
|
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})
|
|
)
|
|
AND EXISTS (
|
|
select 1 from emis_settle_sub_bill essb where a.bill_no=essb.bill_no and essb.del_flag='0' and FIND_IN_SET( essb.settle_bill_no, #{settleBillNo})
|
|
)
|
|
</select>
|
|
|
|
|
|
<select id="selectHasPayMapList" parameterType="String" resultType="map">
|
|
select bill_no as billNo, sum(pay_money) sumMoney
|
|
from emis_settle_pay_rel a
|
|
where del_flag='0'
|
|
AND pay_id IN (
|
|
SELECT x1.pay_id FROM
|
|
emis_settle_pay_record x1,
|
|
emis_settle_bill x2
|
|
WHERE
|
|
x1.del_flag = '0'
|
|
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})
|
|
)
|
|
AND EXISTS (
|
|
select 1 from emis_settle_sub_bill essb where a.bill_no=essb.bill_no and essb.del_flag='0' and FIND_IN_SET( essb.settle_bill_no, #{settleBillNo})
|
|
)
|
|
group by bill_no
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisSettlePayRel" resultType="int">
|
|
select count(1) from emis_settle_pay_rel
|
|
where del_flag='0'
|
|
and id = #{id}
|
|
and pay_id = #{payId}
|
|
and bill_no = #{billNo}
|
|
and pay_money = #{payMoney}
|
|
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>
|
|
|
|
<select id="selectEmisSettlePayRelById" parameterType="Long" resultMap="EmisSettlePayRelResult">
|
|
select id, pay_id, bill_no, pay_money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_settle_pay_rel a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmisSettlePayRel" parameterType="EmisSettlePayRel" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_settle_pay_rel
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="payId != null and payId != ''">pay_id,</if>
|
|
<if test="billNo != null and billNo != ''">bill_no,</if>
|
|
<if test="payMoney != null">pay_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="id != null">#{id},</if>
|
|
<if test="payId != null and payId != ''">#{payId},</if>
|
|
<if test="billNo != null and billNo != ''">#{billNo},</if>
|
|
<if test="payMoney != null">#{payMoney},</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="updateEmisSettlePayRel" parameterType="EmisSettlePayRel">
|
|
update emis_settle_pay_rel
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="payId != null and payId != ''">pay_id = #{payId},</if>
|
|
<if test="billNo != null and billNo != ''">bill_no = #{billNo},</if>
|
|
<if test="payMoney != null">pay_money = #{payMoney},</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="deleteEmisSettlePayRelById" parameterType="Long">
|
|
delete from emis_settle_pay_rel where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisSettlePayRelByIds" parameterType="String">
|
|
delete from emis_settle_pay_rel where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |