Files
nanguangszwlback/mhd_finance/src/main/resources/mapper/receivingAccount/ReceivingAccountMapper.xml
T
2025-12-15 17:15:42 +08:00

88 lines
3.7 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.linke.finance.domain.receivingAccount.repository.mapper.ReceivingAccountMapper">
<resultMap type="com.linke.finance.domain.receivingAccount.repository.po.ReceivingAccountPO" id="ReceivingAccountResult">
<result property="id" column="id" />
<result property="accountName" column="account_name" />
<result property="accountInformation" column="account_information" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectReceivingAccountPo">
select id, account_name, account_information, del_flag, create_time, update_time
from receiving_account
</sql>
<sql id="selectReceivingAccountWhere">
<where>
and del_flag = 1
<if test="id != null">
and id = #{id}
</if>
<if test="accountName != null and accountName != ''">
and account_name like concat('%', #{accountName}, '%')
</if>
<if test="accountInformation != null and accountInformation != ''">
and account_information like concat('%', #{accountInformation}, '%')
</if>
order by create_time desc
</where>
</sql>
<select id="queryList" parameterType="com.linke.finance.domain.receivingAccount.repository.todo.ReceivingAccountDO" resultMap="ReceivingAccountResult">
<include refid="selectReceivingAccountPo"/>
<include refid="selectReceivingAccountWhere"/>
</select>
<insert id="insert" parameterType="com.linke.finance.domain.receivingAccount.entity.ReceivingAccount">
insert into receiving_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="accountName != null and accountName != ''">account_name,</if>
<if test="accountInformation != null and accountInformation != ''">account_information,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="accountName != null and accountName != ''">#{accountName},</if>
<if test="accountInformation != null and accountInformation != ''">#{accountInformation},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<insert id="batchInsert" parameterType="java.util.List">
insert into receiving_account (account_name, account_information, del_flag, create_time, update_time,top_organization_id, organization_id)
values
<foreach collection="list" item="item" separator=",">
(
#{item.accountName},
#{item.accountInformation},
#{item.delFlag},
#{item.createTime},
#{item.updateTime},#{item.topOrganizationId},#{item.organizationId}
)
</foreach>
</insert>
<update id="deleteById" parameterType="Long">
update receiving_account
set del_flag = 2,
update_time = now()
where id = #{id}
</update>
<update id="deleteAll">
update receiving_account
set del_flag = 2,
update_time = now()
where del_flag = 1
</update>
</mapper>