emis-service/emis-biz/src/main/resources/mapper/EmisSiteAccountMapper.xml
2025-03-18 11:03:03 +08:00

247 lines
15 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.EmisSiteAccountMapper">
<resultMap type="EmisSiteAccount" id="EmisSiteAccountResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="accCode" column="acc_code" />
<result property="siteCode" column="site_code" />
<result property="centerCode" column="center_code" />
<result property="curMoney" column="cur_money" />
<result property="frozenMoney" column="frozen_money" />
<result property="confirmMoney" column="confirm_money" />
<result property="watchMoney" column="watch_money" />
<result property="closeMoney" column="close_money" />
<result property="earnestMoney" column="earnest_money" />
<result property="currency" column="currency" />
<result property="startDate" column="start_date" />
<result property="blOpen" column="bl_open" />
<result property="blLock" column="bl_lock" />
<result property="blClear" column="bl_clear" />
<result property="clearSiteCode" column="clear_site_code" />
<result property="clearDate" column="clear_date" />
<result property="clearManCode" column="clear_man_code" />
<association property="siteName" column="site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="centerName" column="center_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="clearSiteName" column="clear_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
</resultMap>
<sql id="selectEmisSiteAccountVo">
select id, acc_code, site_code, center_code, cur_money, frozen_money, confirm_money, watch_money, close_money, earnest_money, currency, start_date, bl_open, bl_lock, bl_clear, clear_site_code, clear_date, clear_man_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_site_account
</sql>
<select id="selectEmisSiteAccountList" parameterType="EmisSiteAccount" resultMap="EmisSiteAccountResult">
<include refid="selectEmisSiteAccountVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="accCode != null and accCode != ''"> and acc_code=#{accCode}</if>
<if test="siteCode != null and siteCode != ''"> and site_code= #{siteCode}</if>
<if test="centerCode != null and centerCode != ''"> and center_code=#{centerCode}</if>
<if test="curMoney != null "> and cur_money = #{curMoney}</if>
<if test="frozenMoney != null "> and frozen_money = #{frozenMoney}</if>
<if test="confirmMoney != null "> and confirm_money = #{confirmMoney}</if>
<if test="watchMoney != null "> and watch_money = #{watchMoney}</if>
<if test="closeMoney != null "> and close_money = #{closeMoney}</if>
<if test="earnestMoney != null "> and earnest_money = #{earnestMoney}</if>
<if test="currency != null and currency != ''"> and currency=#{currency}</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="blOpen != null and blOpen != ''"> and bl_open=#{blOpen}</if>
<if test="blLock != null and blLock != ''"> and bl_lock=#{blLock}</if>
<if test="blClear != null and blClear != ''"> and bl_clear=#{blClear}</if>
<if test="clearSiteCode != null and clearSiteCode != ''"> and clear_site_code= #{clearSiteCode}</if>
<if test="clearDate != null "> and clear_date = #{clearDate}</if>
<if test="clearManCode != null and clearManCode != ''"> and clear_man_code=#{clearManCode}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</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>
<if test="params.balanceStatus != null and params.balanceStatus == '1'">
and cur_money <![CDATA[ > ]]> watch_money
</if>
<if test="params.balanceStatus != null and params.balanceStatus == '2'">
and cur_money <![CDATA[ < ]]> watch_money
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
site_code=#{params.privSiteCode}
)
</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisSiteAccount" resultType="int">
select count(1) from emis_site_account
where del_flag='0'
and id = #{id}
and acc_code = #{accCode}
and site_code = #{siteCode}
and center_code = #{centerCode}
and cur_money = #{curMoney}
and frozen_money = #{frozenMoney}
and confirm_money = #{confirmMoney}
and watch_money = #{watchMoney}
and close_money = #{closeMoney}
and earnest_money = #{earnestMoney}
and currency = #{currency}
and start_date = #{startDate}
and bl_open = #{blOpen}
and bl_lock = #{blLock}
and bl_clear = #{blClear}
and clear_site_code = #{clearSiteCode}
and clear_date = #{clearDate}
and clear_man_code = #{clearManCode}
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="selectEmisSiteAccountById" parameterType="Long" resultMap="EmisSiteAccountResult">
select id, acc_code, site_code, center_code, cur_money, frozen_money, confirm_money, watch_money, close_money, earnest_money, currency, start_date, bl_open, bl_lock, bl_clear, clear_site_code, clear_date, clear_man_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_site_account a
where a.id = #{id}
</select>
<select id="getAccountBySiteCode" parameterType="String" resultMap="EmisSiteAccountResult">
select id, acc_code, site_code, center_code, cur_money, frozen_money, confirm_money, watch_money, close_money, earnest_money, currency, start_date, bl_open, bl_lock, bl_clear, clear_site_code, clear_date, clear_man_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_site_account a
where a.del_flag='0' and a.site_code = #{siteCode}
</select>
<select id="getHasAddSite" resultType="String">
select GROUP_CONCAT(distinct site_code) as site_code
from emis_site_account a
where del_flag='0'
</select>
<insert id="insertEmisSiteAccount" parameterType="EmisSiteAccount" useGeneratedKeys="true" keyProperty="id">
insert into emis_site_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="accCode != null and accCode != ''">acc_code,</if>
<if test="siteCode != null and siteCode != ''">site_code,</if>
<if test="centerCode != null and centerCode != ''">center_code,</if>
<if test="curMoney != null">cur_money,</if>
<if test="frozenMoney != null">frozen_money,</if>
<if test="confirmMoney != null">confirm_money,</if>
<if test="watchMoney != null">watch_money,</if>
<if test="closeMoney != null">close_money,</if>
<if test="earnestMoney != null">earnest_money,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="startDate != null">start_date,</if>
<if test="blOpen != null and blOpen != ''">bl_open,</if>
<if test="blLock != null and blLock != ''">bl_lock,</if>
<if test="blClear != null and blClear != ''">bl_clear,</if>
<if test="clearSiteCode != null and clearSiteCode != ''">clear_site_code,</if>
<if test="clearDate != null">clear_date,</if>
<if test="clearManCode != null and clearManCode != ''">clear_man_code,</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="accCode != null and accCode != ''">#{accCode},</if>
<if test="siteCode != null and siteCode != ''">#{siteCode},</if>
<if test="centerCode != null and centerCode != ''">#{centerCode},</if>
<if test="curMoney != null">#{curMoney},</if>
<if test="frozenMoney != null">#{frozenMoney},</if>
<if test="confirmMoney != null">#{confirmMoney},</if>
<if test="watchMoney != null">#{watchMoney},</if>
<if test="closeMoney != null">#{closeMoney},</if>
<if test="earnestMoney != null">#{earnestMoney},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="startDate != null">#{startDate},</if>
<if test="blOpen != null and blOpen != ''">#{blOpen},</if>
<if test="blLock != null and blLock != ''">#{blLock},</if>
<if test="blClear != null and blClear != ''">#{blClear},</if>
<if test="clearSiteCode != null and clearSiteCode != ''">#{clearSiteCode},</if>
<if test="clearDate != null">#{clearDate},</if>
<if test="clearManCode != null and clearManCode != ''">#{clearManCode},</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="updateEmisSiteAccount" parameterType="EmisSiteAccount">
update emis_site_account
<trim prefix="SET" suffixOverrides=",">
<if test="accCode != null and accCode != ''">acc_code = #{accCode},</if>
<if test="siteCode != null and siteCode != ''">site_code = #{siteCode},</if>
<if test="centerCode != null and centerCode != ''">center_code = #{centerCode},</if>
<if test="curMoney != null">cur_money = #{curMoney},</if>
<if test="frozenMoney != null">frozen_money = #{frozenMoney},</if>
<if test="confirmMoney != null">confirm_money = #{confirmMoney},</if>
<if test="watchMoney != null">watch_money = #{watchMoney},</if>
<if test="closeMoney != null">close_money = #{closeMoney},</if>
<if test="earnestMoney != null">earnest_money = #{earnestMoney},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="blOpen != null and blOpen != ''">bl_open = #{blOpen},</if>
<if test="blLock != null and blLock != ''">bl_lock = #{blLock},</if>
<if test="blClear != null and blClear != ''">bl_clear = #{blClear},</if>
<if test="clearSiteCode != null and clearSiteCode != ''">clear_site_code = #{clearSiteCode},</if>
<if test="clearDate != null">clear_date = #{clearDate},</if>
<if test="clearManCode != null and clearManCode != ''">clear_man_code = #{clearManCode},</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>
<update id="updateSiteAccountBalance" parameterType="EmisSiteAccount">
update emis_site_account set cur_money = #{curMoney},confirm_money = #{confirmMoney} where id = #{id}
</update>
<delete id="deleteEmisSiteAccountById" parameterType="Long">
update emis_site_account set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisSiteAccountByIds" parameterType="String">
update emis_site_account set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>