emis-service/emis-biz/src/main/resources/mapper/EmisSiteBillControlMapper.xml
2024-06-16 13:27:05 +08:00

152 lines
8.2 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.EmisSiteBillControlMapper">
<resultMap type="EmisSiteBillControl" id="EmisSiteBillControlResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="sendSiteCode" column="send_site_code" />
<result property="destSiteCode" column="dest_site_code" />
<result property="controlDate" column="control_date" />
<result property="blOpen" column="bl_open" />
<result property="sendSiteName" column="send_site_name" />
<result property="destSiteName" column="dest_site_name" />
</resultMap>
<sql id="selectEmisSiteBillControlVo">
select
a.id, a.send_site_code, a.dest_site_code, a.control_date, a.bl_open,
a.remark, a.del_flag, a.create_by, a.create_time, a.update_by,
a.update_time, a.create_site, a.update_site,
b.site_name as send_site_name,
c.site_name as dest_site_name
from emis_site_bill_control a
left join emis_site b on a.send_site_code = b.site_code
left join emis_site c on a.dest_site_code = c.site_code
</sql>
<select id="selectEmisSiteBillControlList" parameterType="EmisSiteBillControl" resultMap="EmisSiteBillControlResult">
<include refid="selectEmisSiteBillControlVo"/>
<where>
a.del_flag='0'
<if test="id != null "> and a.id = #{id}</if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and a.send_site_code like concat('%', #{sendSiteCode}, '%')</if>
<if test="destSiteCode != null and destSiteCode != ''"> and a.dest_site_code like concat('%', #{destSiteCode}, '%')</if>
<if test="controlDate != null "> and a.control_date = #{controlDate}</if>
<if test="blOpen != null and blOpen != ''"> and a.bl_open=#{blOpen}</if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and a.del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and a.create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and a.update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and a.create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisSiteBillControl" resultType="int">
select count(1) from emis_site_bill_control
where del_flag='0'
and id = #{id}
and send_site_code = #{sendSiteCode}
and dest_site_code = #{destSiteCode}
and control_date = #{controlDate}
and bl_open = #{blOpen}
and remark = #{remark}
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="checkBillIsLock" parameterType="EmisSiteBillControl" resultType="int">
select count(1) from emis_site_bill_control
where del_flag='0'
and send_site_code = #{sendSiteCode}
and dest_site_code = #{destSiteCode}
and #{params.sendDate} <![CDATA[ <= ]]> control_date
and bl_open = '1'
limit 1
</select>
<select id="selectEmisSiteBillControlById" parameterType="Long" resultMap="EmisSiteBillControlResult">
select id, send_site_code, dest_site_code, control_date, bl_open, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_site_bill_control a
where a.id = #{id}
</select>
<insert id="insertEmisSiteBillControl" parameterType="EmisSiteBillControl" useGeneratedKeys="true" keyProperty="id">
insert into emis_site_bill_control
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code,</if>
<if test="destSiteCode != null and destSiteCode != ''">dest_site_code,</if>
<if test="controlDate != null">control_date,</if>
<if test="blOpen != null and blOpen != ''">bl_open,</if>
<if test="remark != null and remark != ''">remark,</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="sendSiteCode != null and sendSiteCode != ''">#{sendSiteCode},</if>
<if test="destSiteCode != null and destSiteCode != ''">#{destSiteCode},</if>
<if test="controlDate != null">#{controlDate},</if>
<if test="blOpen != null and blOpen != ''">#{blOpen},</if>
<if test="remark != null and remark != ''">#{remark},</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="updateEmisSiteBillControl" parameterType="EmisSiteBillControl">
update emis_site_bill_control
<trim prefix="SET" suffixOverrides=",">
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code = #{sendSiteCode},</if>
<if test="destSiteCode != null and destSiteCode != ''">dest_site_code = #{destSiteCode},</if>
<if test="controlDate != null">control_date = #{controlDate},</if>
<if test="blOpen != null and blOpen != ''">bl_open = #{blOpen},</if>
<if test="remark != null and remark != ''">remark = #{remark},</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="deleteEmisSiteBillControlById" parameterType="Long">
update emis_site_bill_control set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisSiteBillControlByIds" parameterType="String">
update emis_site_bill_control set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>