Files
nanguangszwlback/mhd_finance/src/main/resources/mapper/accountManage/AccountCashWalletMapper.xml
T
2025-12-05 10:47:46 +08:00

95 lines
5.3 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.accountManage.repository.mapper.AccountCashWalletMapper">
<sql id="selectAccountCashWalletVo">
select
a.*
from account_cash_wallet a
where a.del_flag = 1
</sql>
<!--<update id="updateCreditLimit">
UPDATE account_cash_wallet SET credit_limit =
CASE
WHEN credit_limit - #{creditLimit} >= 0 THEN credit_limit - #{creditLimit}
ELSE credit_limit
END
WHERE user_id = #{userId}
</update>-->
<select id="selectAccountCashWalletList" parameterType="com.linke.finance.domain.accountManage.repository.todo.AccountCashWalletDo" resultType="com.linke.finance.domain.accountManage.repository.po.AccountCashWalletPo">
<include refid="selectAccountCashWalletVo"/>
<include refid="common_where"></include>
ORDER BY a.create_time DESC
</select>
<sql id="common_where">
<if test="accountCashWalletDo.userName != null and accountCashWalletDo.userName != ''">
AND a.user_name like concat('%', #{accountCashWalletDo.userName}, '%')
</if>
<if test="accountCashWalletDo.userAccount != null and accountCashWalletDo.userAccount != ''">
AND a.user_account like concat('%', #{accountCashWalletDo.userAccount}, '%')
</if>
<if test="accountCashWalletDo.enterpriseName != null and accountCashWalletDo.enterpriseName != ''">
AND a.enterprise_name like concat('%', #{accountCashWalletDo.enterpriseName}, '%')
</if>
<if test="accountCashWalletDo.updateTimeStart != null and accountCashWalletDo.updateTimeStart != ''">
AND date_format(a.update_time,'%Y-%m-%d') >= #{accountCashWalletDo.updateTimeStart}
</if>
<if test="accountCashWalletDo.updateTimeEnd != null and accountCashWalletDo.updateTimeEnd != ''">
AND date_format(a.update_time,'%Y-%m-%d') <![CDATA[<=]]> #{accountCashWalletDo.updateTimeEnd}
</if>
<if test="accountCashWalletDo.accountWalletStatus != null"> and a.account_wallet_status = #{accountCashWalletDo.accountWalletStatus}</if>
<if test="accountCashWalletDo.userIdcardNumber != null and accountCashWalletDo.userIdcardNumber != ''">
AND a.user_idcard_number like concat('%', #{accountCashWalletDo.userIdcardNumber}, '%')
</if>
<if test="accountCashWalletDo.userPhone != null and accountCashWalletDo.userPhone != ''">
AND a.user_phone like concat('%', #{accountCashWalletDo.userPhone}, '%')
</if>
<if test="accountCashWalletDo.accountWalletId != null and accountCashWalletDo.accountWalletId != ''">
AND a.account_wallet_id like concat('%', #{accountCashWalletDo.accountWalletId}, '%')
</if>
<if test="accountCashWalletDo.walletBalanceBegin != null and accountCashWalletDo.walletBalanceEnd != null">
AND a.wallet_balance between #{accountCashWalletDo.walletBalanceBegin} and #{accountCashWalletDo.walletBalanceEnd}
</if>
<if test="accountCashWalletDo.walletAvailableBalanceBegin != null and accountCashWalletDo.walletAvailableBalanceEnd != null">
AND a.wallet_available_balance between #{accountCashWalletDo.walletAvailableBalanceBegin} and #{accountCashWalletDo.walletAvailableBalanceEnd}
</if>
<if test="accountCashWalletDo.walletFreezeBalanceBegin != null and accountCashWalletDo.walletFreezeBalanceEnd != null">
AND a.wallet_freeze_balance between #{accountCashWalletDo.walletFreezeBalanceBegin} and #{accountCashWalletDo.walletFreezeBalanceEnd}
</if>
<if test="accountCashWalletDo.createBy != null and accountCashWalletDo.organizationIdList == null"> and a.create_by = #{accountCashWalletDo.createBy}</if>
<if test="accountCashWalletDo.organizationIdList != null and accountCashWalletDo.createBy == null">
AND a.organization_id in
<foreach item="id" collection="accountCashWalletDo.organizationIdList" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="accountCashWalletDo.organizationIdList != null and accountCashWalletDo.createBy != null">
AND (a.organization_id in
<foreach item="id" collection="accountCashWalletDo.organizationIdList" open="(" separator="," close=")">
#{id}
</foreach>
OR a.create_by = #{accountCashWalletDo.createBy})
</if>
<if test="accountCashWalletDo.accountType != null">
AND a.account_type = #{accountCashWalletDo.accountType}
</if>
</sql>
<select id="selectAccountCashWalletByAccountCashWalletId" parameterType="java.lang.Long" resultType="com.linke.finance.domain.accountManage.repository.po.AccountCashWalletPo">
<include refid="selectAccountCashWalletVo"/>
and a.account_cash_wallet_id = #{accountCashWalletId}
</select>
<select id="selectUserWalletInfo" resultType="com.linke.finance.domain.accountManage.repository.po.AccountCashWalletAppPo" parameterType="java.lang.Long">
<include refid="selectAccountCashWalletVo"/>
and a.user_id = #{userId}
</select>
</mapper>