Bonus-Cloud-JYY-Canteen/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccInfoMapper.xml

539 lines
33 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.bonus.canteen.core.account.mapper.AccInfoMapper">
<resultMap type="com.bonus.canteen.core.account.domain.AccInfo" id="AccInfoResult">
<result property="accId" column="acc_id" />
<result property="accName" column="acc_name" />
<result property="userId" column="user_id" />
<result property="walletBal" column="wallet_bal" />
<result property="subsidyBal" column="subsidy_bal" />
<result property="redEnvelope" column="red_envelope" />
<result property="subsidyFreezeBal" column="subsidy_freeze_bal" />
<result property="accBal" column="acc_bal" />
<result property="balance2" column="balance2" />
<result property="waterWalletBal" column="water_wallet_bal" />
<result property="waterSubsidyBal" column="water_subsidy_bal" />
<result property="freezeWalletBal" column="freeze_wallet_bal" />
<result property="freezeSubsidyBal" column="freeze_subsidy_bal" />
<result property="freezeRedEnvelope" column="freeze_red_envelope" />
<result property="walletOverBal" column="wallet_over_bal" />
<result property="subOverBal" column="sub_over_bal" />
<result property="scope" column="scope" />
<result property="endDate" column="end_date" />
<result property="redValidityDate" column="red_validity_date" />
<result property="accStatus" column="acc_status" />
<result property="payPwd" column="pay_pwd" />
<result property="subDateFlag" column="sub_date_flag" />
<result property="subMonthFlag" column="sub_month_flag" />
<result property="accPayCount" column="acc_pay_count" />
<result property="lastCreditTime" column="last_credit_time" />
<result property="intervalId" column="interval_id" />
<result property="currCreditCount" column="curr_credit_count" />
<result property="currBrushCount" column="curr_brush_count" />
<result property="currUseReserveCount1" column="curr_use_reserve_count1" />
<result property="currUseReserveCount2" column="curr_use_reserve_count2" />
<result property="sameDayCount" column="same_day_count" />
<result property="sameMonthCount" column="same_month_count" />
<result property="currCumuAmount" column="curr_cumu_amount" />
<result property="dayCumuAmount" column="day_cumu_amount" />
<result property="monthSumuAmount" column="month_sumu_amount" />
<result property="minWalletBalLimit" column="min_wallet_bal_limit" />
<result property="minRedBalLimit" column="min_red_bal_limit" />
<result property="minSubBalLimit" column="min_sub_bal_limit" />
<result property="monthFullReduceAmount" column="month_full_reduce_amount" />
<result property="lastFullReduceTime" column="last_full_reduce_time" />
<result property="lastSubTime" column="last_sub_time" />
<result property="subValidityDate" column="sub_validity_date" />
<result property="lastSubAmount" column="last_sub_amount" />
<result property="lastWalTime" column="last_wal_time" />
<result property="lastWalAmount" column="last_wal_amount" />
<result property="revision" column="revision" />
<result property="reserved1" column="reserved1" />
<result property="reserved2" column="reserved2" />
<result property="reserved3" column="reserved3" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectAccInfoVo">
select acc_id, acc_name, user_id, wallet_bal, subsidy_bal, red_envelope, subsidy_freeze_bal,
acc_bal, balance2, water_wallet_bal, water_subsidy_bal, freeze_wallet_bal, freeze_subsidy_bal,
freeze_red_envelope, wallet_over_bal, sub_over_bal, scope, end_date, red_validity_date,
acc_status, pay_pwd, sub_date_flag, sub_month_flag, acc_pay_count, last_credit_time,
interval_id, curr_credit_count, curr_brush_count, curr_use_reserve_count1, curr_use_reserve_count2,
same_day_count, same_month_count, curr_cumu_amount, day_cumu_amount, month_sumu_amount,
min_wallet_bal_limit, min_red_bal_limit, min_sub_bal_limit, month_full_reduce_amount,
last_full_reduce_time, last_sub_time, sub_validity_date, last_sub_amount, last_wal_time, last_wal_amount,
revision, reserved1, reserved2, reserved3, create_by, create_time, update_by, update_time, del_flag
from acc_info
</sql>
<select id="selectAccInfoList" parameterType="com.bonus.canteen.core.account.domain.AccInfo" resultMap="AccInfoResult">
<include refid="selectAccInfoVo"/>
<where>
<if test="accId != null "> and acc_id = #{accId}</if>
<if test="accName != null and accName != ''"> and acc_name like concat('%', #{accName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="walletBal != null "> and wallet_bal = #{walletBal}</if>
<if test="subsidyBal != null "> and subsidy_bal = #{subsidyBal}</if>
<if test="redEnvelope != null "> and red_envelope = #{redEnvelope}</if>
<if test="subsidyFreezeBal != null "> and subsidy_freeze_bal = #{subsidyFreezeBal}</if>
<if test="accBal != null "> and acc_bal = #{accBal}</if>
<if test="balance2 != null "> and balance2 = #{balance2}</if>
<if test="waterWalletBal != null "> and water_wallet_bal = #{waterWalletBal}</if>
<if test="waterSubsidyBal != null "> and water_subsidy_bal = #{waterSubsidyBal}</if>
<if test="freezeWalletBal != null "> and freeze_wallet_bal = #{freezeWalletBal}</if>
<if test="freezeSubsidyBal != null "> and freeze_subsidy_bal = #{freezeSubsidyBal}</if>
<if test="freezeRedEnvelope != null "> and freeze_red_envelope = #{freezeRedEnvelope}</if>
<if test="walletOverBal != null "> and wallet_over_bal = #{walletOverBal}</if>
<if test="subOverBal != null "> and sub_over_bal = #{subOverBal}</if>
<if test="scope != null "> and scope = #{scope}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="redValidityDate != null "> and red_validity_date = #{redValidityDate}</if>
<if test="accStatus != null "> and acc_status = #{accStatus}</if>
<if test="payPwd != null and payPwd != ''"> and pay_pwd = #{payPwd}</if>
<if test="subDateFlag != null "> and sub_date_flag = #{subDateFlag}</if>
<if test="subMonthFlag != null "> and sub_month_flag = #{subMonthFlag}</if>
<if test="accPayCount != null "> and acc_pay_count = #{accPayCount}</if>
<if test="lastCreditTime != null "> and last_credit_time = #{lastCreditTime}</if>
<if test="intervalId != null "> and interval_id = #{intervalId}</if>
<if test="currCreditCount != null "> and curr_credit_count = #{currCreditCount}</if>
<if test="currBrushCount != null "> and curr_brush_count = #{currBrushCount}</if>
<if test="currUseReserveCount1 != null "> and curr_use_reserve_count1 = #{currUseReserveCount1}</if>
<if test="currUseReserveCount2 != null "> and curr_use_reserve_count2 = #{currUseReserveCount2}</if>
<if test="sameDayCount != null "> and same_day_count = #{sameDayCount}</if>
<if test="sameMonthCount != null "> and same_month_count = #{sameMonthCount}</if>
<if test="currCumuAmount != null "> and curr_cumu_amount = #{currCumuAmount}</if>
<if test="dayCumuAmount != null "> and day_cumu_amount = #{dayCumuAmount}</if>
<if test="monthSumuAmount != null "> and month_sumu_amount = #{monthSumuAmount}</if>
<if test="minWalletBalLimit != null "> and min_wallet_bal_limit = #{minWalletBalLimit}</if>
<if test="minRedBalLimit != null "> and min_red_bal_limit = #{minRedBalLimit}</if>
<if test="minSubBalLimit != null "> and min_sub_bal_limit = #{minSubBalLimit}</if>
<if test="monthFullReduceAmount != null "> and month_full_reduce_amount = #{monthFullReduceAmount}</if>
<if test="lastFullReduceTime != null "> and last_full_reduce_time = #{lastFullReduceTime}</if>
<if test="lastSubTime != null "> and last_sub_time = #{lastSubTime}</if>
<if test="subValidityDate != null "> and sub_validity_date = #{subValidityDate}</if>
<if test="lastSubAmount != null "> and last_sub_amount = #{lastSubAmount}</if>
<if test="lastWalTime != null "> and last_wal_time = #{lastWalTime}</if>
<if test="lastWalAmount != null "> and last_wal_amount = #{lastWalAmount}</if>
<if test="revision != null "> and revision = #{revision}</if>
<if test="reserved1 != null and reserved1 != ''"> and reserved1 = #{reserved1}</if>
<if test="reserved2 != null and reserved2 != ''"> and reserved2 = #{reserved2}</if>
<if test="reserved3 != null and reserved3 != ''"> and reserved3 = #{reserved3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
</where>
</select>
<select id="selectAccInfoVo" parameterType="com.bonus.canteen.core.account.domain.AccInfo" resultType="com.bonus.canteen.core.account.domain.AccInfoVo">
<include refid="selectAccInfoVo"/>
<where>
<if test="accId != null "> and acc_id = #{accId}</if>
<if test="accName != null and accName != ''"> and acc_name like concat('%', #{accName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="walletBal != null "> and wallet_bal = #{walletBal}</if>
<if test="subsidyBal != null "> and subsidy_bal = #{subsidyBal}</if>
<if test="redEnvelope != null "> and red_envelope = #{redEnvelope}</if>
<if test="subsidyFreezeBal != null "> and subsidy_freeze_bal = #{subsidyFreezeBal}</if>
<if test="accBal != null "> and acc_bal = #{accBal}</if>
<if test="balance2 != null "> and balance2 = #{balance2}</if>
<if test="waterWalletBal != null "> and water_wallet_bal = #{waterWalletBal}</if>
<if test="waterSubsidyBal != null "> and water_subsidy_bal = #{waterSubsidyBal}</if>
<if test="freezeWalletBal != null "> and freeze_wallet_bal = #{freezeWalletBal}</if>
<if test="freezeSubsidyBal != null "> and freeze_subsidy_bal = #{freezeSubsidyBal}</if>
<if test="freezeRedEnvelope != null "> and freeze_red_envelope = #{freezeRedEnvelope}</if>
<if test="walletOverBal != null "> and wallet_over_bal = #{walletOverBal}</if>
<if test="subOverBal != null "> and sub_over_bal = #{subOverBal}</if>
<if test="scope != null "> and scope = #{scope}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="redValidityDate != null "> and red_validity_date = #{redValidityDate}</if>
<if test="accStatus != null "> and acc_status = #{accStatus}</if>
<if test="payPwd != null and payPwd != ''"> and pay_pwd = #{payPwd}</if>
<if test="subDateFlag != null "> and sub_date_flag = #{subDateFlag}</if>
<if test="subMonthFlag != null "> and sub_month_flag = #{subMonthFlag}</if>
<if test="accPayCount != null "> and acc_pay_count = #{accPayCount}</if>
<if test="lastCreditTime != null "> and last_credit_time = #{lastCreditTime}</if>
<if test="intervalId != null "> and interval_id = #{intervalId}</if>
<if test="currCreditCount != null "> and curr_credit_count = #{currCreditCount}</if>
<if test="currBrushCount != null "> and curr_brush_count = #{currBrushCount}</if>
<if test="currUseReserveCount1 != null "> and curr_use_reserve_count1 = #{currUseReserveCount1}</if>
<if test="currUseReserveCount2 != null "> and curr_use_reserve_count2 = #{currUseReserveCount2}</if>
<if test="sameDayCount != null "> and same_day_count = #{sameDayCount}</if>
<if test="sameMonthCount != null "> and same_month_count = #{sameMonthCount}</if>
<if test="currCumuAmount != null "> and curr_cumu_amount = #{currCumuAmount}</if>
<if test="dayCumuAmount != null "> and day_cumu_amount = #{dayCumuAmount}</if>
<if test="monthSumuAmount != null "> and month_sumu_amount = #{monthSumuAmount}</if>
<if test="minWalletBalLimit != null "> and min_wallet_bal_limit = #{minWalletBalLimit}</if>
<if test="minRedBalLimit != null "> and min_red_bal_limit = #{minRedBalLimit}</if>
<if test="minSubBalLimit != null "> and min_sub_bal_limit = #{minSubBalLimit}</if>
<if test="monthFullReduceAmount != null "> and month_full_reduce_amount = #{monthFullReduceAmount}</if>
<if test="lastFullReduceTime != null "> and last_full_reduce_time = #{lastFullReduceTime}</if>
<if test="lastSubTime != null "> and last_sub_time = #{lastSubTime}</if>
<if test="subValidityDate != null "> and sub_validity_date = #{subValidityDate}</if>
<if test="lastSubAmount != null "> and last_sub_amount = #{lastSubAmount}</if>
<if test="lastWalTime != null "> and last_wal_time = #{lastWalTime}</if>
<if test="lastWalAmount != null "> and last_wal_amount = #{lastWalAmount}</if>
<if test="revision != null "> and revision = #{revision}</if>
<if test="reserved1 != null and reserved1 != ''"> and reserved1 = #{reserved1}</if>
<if test="reserved2 != null and reserved2 != ''"> and reserved2 = #{reserved2}</if>
<if test="reserved3 != null and reserved3 != ''"> and reserved3 = #{reserved3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
</where>
</select>
<select id="selectAccInfoById" parameterType="Long" resultMap="AccInfoResult">
<include refid="selectAccInfoVo"/>
where acc_id = #{accId}
</select>
<insert id="insertAccInfo" parameterType="com.bonus.canteen.core.account.domain.AccInfo" useGeneratedKeys="true" keyProperty="accId">
insert into acc_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="accName != null and accName != ''">acc_name,</if>
<if test="userId != null">user_id,</if>
<if test="walletBal != null">wallet_bal,</if>
<if test="subsidyBal != null">subsidy_bal,</if>
<if test="redEnvelope != null">red_envelope,</if>
<if test="subsidyFreezeBal != null">subsidy_freeze_bal,</if>
<if test="accBal != null">acc_bal,</if>
<if test="balance2 != null">balance2,</if>
<if test="waterWalletBal != null">water_wallet_bal,</if>
<if test="waterSubsidyBal != null">water_subsidy_bal,</if>
<if test="freezeWalletBal != null">freeze_wallet_bal,</if>
<if test="freezeSubsidyBal != null">freeze_subsidy_bal,</if>
<if test="freezeRedEnvelope != null">freeze_red_envelope,</if>
<if test="walletOverBal != null">wallet_over_bal,</if>
<if test="subOverBal != null">sub_over_bal,</if>
<if test="scope != null">scope,</if>
<if test="endDate != null">end_date,</if>
<if test="redValidityDate != null">red_validity_date,</if>
<if test="accStatus != null">acc_status,</if>
<if test="payPwd != null and payPwd != ''">pay_pwd,</if>
<if test="subDateFlag != null">sub_date_flag,</if>
<if test="subMonthFlag != null">sub_month_flag,</if>
<if test="accPayCount != null">acc_pay_count,</if>
<if test="lastCreditTime != null">last_credit_time,</if>
<if test="intervalId != null">interval_id,</if>
<if test="currCreditCount != null">curr_credit_count,</if>
<if test="currBrushCount != null">curr_brush_count,</if>
<if test="currUseReserveCount1 != null">curr_use_reserve_count1,</if>
<if test="currUseReserveCount2 != null">curr_use_reserve_count2,</if>
<if test="sameDayCount != null">same_day_count,</if>
<if test="sameMonthCount != null">same_month_count,</if>
<if test="currCumuAmount != null">curr_cumu_amount,</if>
<if test="dayCumuAmount != null">day_cumu_amount,</if>
<if test="monthSumuAmount != null">month_sumu_amount,</if>
<if test="minWalletBalLimit != null">min_wallet_bal_limit,</if>
<if test="minRedBalLimit != null">min_red_bal_limit,</if>
<if test="minSubBalLimit != null">min_sub_bal_limit,</if>
<if test="monthFullReduceAmount != null">month_full_reduce_amount,</if>
<if test="lastFullReduceTime != null">last_full_reduce_time,</if>
<if test="lastSubTime != null">last_sub_time,</if>
<if test="subValidityDate != null">sub_validity_date,</if>
<if test="lastSubAmount != null">last_sub_amount,</if>
<if test="lastWalTime != null">last_wal_time,</if>
<if test="lastWalAmount != null">last_wal_amount,</if>
<if test="revision != null">revision,</if>
<if test="reserved1 != null">reserved1,</if>
<if test="reserved2 != null">reserved2,</if>
<if test="reserved3 != null">reserved3,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="accName != null and accName != ''">#{accName},</if>
<if test="userId != null">#{userId},</if>
<if test="walletBal != null">#{walletBal},</if>
<if test="subsidyBal != null">#{subsidyBal},</if>
<if test="redEnvelope != null">#{redEnvelope},</if>
<if test="subsidyFreezeBal != null">#{subsidyFreezeBal},</if>
<if test="accBal != null">#{accBal},</if>
<if test="balance2 != null">#{balance2},</if>
<if test="waterWalletBal != null">#{waterWalletBal},</if>
<if test="waterSubsidyBal != null">#{waterSubsidyBal},</if>
<if test="freezeWalletBal != null">#{freezeWalletBal},</if>
<if test="freezeSubsidyBal != null">#{freezeSubsidyBal},</if>
<if test="freezeRedEnvelope != null">#{freezeRedEnvelope},</if>
<if test="walletOverBal != null">#{walletOverBal},</if>
<if test="subOverBal != null">#{subOverBal},</if>
<if test="scope != null">#{scope},</if>
<if test="endDate != null">#{endDate},</if>
<if test="redValidityDate != null">#{redValidityDate},</if>
<if test="accStatus != null">#{accStatus},</if>
<if test="payPwd != null and payPwd != ''">#{payPwd},</if>
<if test="subDateFlag != null">#{subDateFlag},</if>
<if test="subMonthFlag != null">#{subMonthFlag},</if>
<if test="accPayCount != null">#{accPayCount},</if>
<if test="lastCreditTime != null">#{lastCreditTime},</if>
<if test="intervalId != null">#{intervalId},</if>
<if test="currCreditCount != null">#{currCreditCount},</if>
<if test="currBrushCount != null">#{currBrushCount},</if>
<if test="currUseReserveCount1 != null">#{currUseReserveCount1},</if>
<if test="currUseReserveCount2 != null">#{currUseReserveCount2},</if>
<if test="sameDayCount != null">#{sameDayCount},</if>
<if test="sameMonthCount != null">#{sameMonthCount},</if>
<if test="currCumuAmount != null">#{currCumuAmount},</if>
<if test="dayCumuAmount != null">#{dayCumuAmount},</if>
<if test="monthSumuAmount != null">#{monthSumuAmount},</if>
<if test="minWalletBalLimit != null">#{minWalletBalLimit},</if>
<if test="minRedBalLimit != null">#{minRedBalLimit},</if>
<if test="minSubBalLimit != null">#{minSubBalLimit},</if>
<if test="monthFullReduceAmount != null">#{monthFullReduceAmount},</if>
<if test="lastFullReduceTime != null">#{lastFullReduceTime},</if>
<if test="lastSubTime != null">#{lastSubTime},</if>
<if test="subValidityDate != null">#{subValidityDate},</if>
<if test="lastSubAmount != null">#{lastSubAmount},</if>
<if test="lastWalTime != null">#{lastWalTime},</if>
<if test="lastWalAmount != null">#{lastWalAmount},</if>
<if test="revision != null">#{revision},</if>
<if test="reserved1 != null">#{reserved1},</if>
<if test="reserved2 != null">#{reserved2},</if>
<if test="reserved3 != null">#{reserved3},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateAccInfo" parameterType="com.bonus.canteen.core.account.domain.AccInfo">
update acc_info
<trim prefix="SET" suffixOverrides=",">
<if test="accId != null">acc_id = #{accId},</if>
<if test="accName != null and accName != ''">acc_name = #{accName},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="walletBal != null">wallet_bal = #{walletBal},</if>
<if test="subsidyBal != null">subsidy_bal = #{subsidyBal},</if>
<if test="redEnvelope != null">red_envelope = #{redEnvelope},</if>
<if test="subsidyFreezeBal != null">subsidy_freeze_bal = #{subsidyFreezeBal},</if>
<if test="accBal != null">acc_bal = #{accBal},</if>
<if test="balance2 != null">balance2 = #{balance2},</if>
<if test="waterWalletBal != null">water_wallet_bal = #{waterWalletBal},</if>
<if test="waterSubsidyBal != null">water_subsidy_bal = #{waterSubsidyBal},</if>
<if test="freezeWalletBal != null">freeze_wallet_bal = #{freezeWalletBal},</if>
<if test="freezeSubsidyBal != null">freeze_subsidy_bal = #{freezeSubsidyBal},</if>
<if test="freezeRedEnvelope != null">freeze_red_envelope = #{freezeRedEnvelope},</if>
<if test="walletOverBal != null">wallet_over_bal = #{walletOverBal},</if>
<if test="subOverBal != null">sub_over_bal = #{subOverBal},</if>
<if test="scope != null">scope = #{scope},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="redValidityDate != null">red_validity_date = #{redValidityDate},</if>
<if test="accStatus != null">acc_status = #{accStatus},</if>
<if test="payPwd != null and payPwd != ''">pay_pwd = #{payPwd},</if>
<if test="subDateFlag != null">sub_date_flag = #{subDateFlag},</if>
<if test="subMonthFlag != null">sub_month_flag = #{subMonthFlag},</if>
<if test="accPayCount != null">acc_pay_count = #{accPayCount},</if>
<if test="lastCreditTime != null">last_credit_time = #{lastCreditTime},</if>
<if test="intervalId != null">interval_id = #{intervalId},</if>
<if test="currCreditCount != null">curr_credit_count = #{currCreditCount},</if>
<if test="currBrushCount != null">curr_brush_count = #{currBrushCount},</if>
<if test="currUseReserveCount1 != null">curr_use_reserve_count1 = #{currUseReserveCount1},</if>
<if test="currUseReserveCount2 != null">curr_use_reserve_count2 = #{currUseReserveCount2},</if>
<if test="sameDayCount != null">same_day_count = #{sameDayCount},</if>
<if test="sameMonthCount != null">same_month_count = #{sameMonthCount},</if>
<if test="currCumuAmount != null">curr_cumu_amount = #{currCumuAmount},</if>
<if test="dayCumuAmount != null">day_cumu_amount = #{dayCumuAmount},</if>
<if test="monthSumuAmount != null">month_sumu_amount = #{monthSumuAmount},</if>
<if test="minWalletBalLimit != null">min_wallet_bal_limit = #{minWalletBalLimit},</if>
<if test="minRedBalLimit != null">min_red_bal_limit = #{minRedBalLimit},</if>
<if test="minSubBalLimit != null">min_sub_bal_limit = #{minSubBalLimit},</if>
<if test="monthFullReduceAmount != null">month_full_reduce_amount = #{monthFullReduceAmount},</if>
<if test="lastFullReduceTime != null">last_full_reduce_time = #{lastFullReduceTime},</if>
<if test="lastSubTime != null">last_sub_time = #{lastSubTime},</if>
<if test="subValidityDate != null">sub_validity_date = #{subValidityDate},</if>
<if test="lastSubAmount != null">last_sub_amount = #{lastSubAmount},</if>
<if test="lastWalTime != null">last_wal_time = #{lastWalTime},</if>
<if test="lastWalAmount != null">last_wal_amount = #{lastWalAmount},</if>
<if test="revision != null">revision = #{revision},</if>
<if test="reserved1 != null">reserved1 = #{reserved1},</if>
<if test="reserved2 != null">reserved2 = #{reserved2},</if>
<if test="reserved3 != null">reserved3 = #{reserved3},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where acc_id = #{accId}
</update>
<delete id="deleteAccInfoByUserId" parameterType="Long">
update acc_info set del_flag = '2' where user_id = #{userId}
</delete>
<delete id="deleteAccInfoByIds" parameterType="String">
update acc_info set del_flag = '2' where acc_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{accId}
</foreach>
</delete>
<select id="queryAccInfoInvalidSum" resultType="java.lang.Integer">
SELECT count( a.acc_id ) FROM acc_info a
WHERE a.acc_status = #{accStatus} AND a.update_time BETWEEN #{startDateTime} and #{endDateTime}
</select>
<select id="queryAccInfoDetails" resultType="com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO">
SELECT
t1.update_time,
t1.acc_id,
t2.user_id,
t2.nick_name,
t2.phonenumber as phoneNumber,
t6.dept_name,
t6.dept_full_name,
t2.user_type as userType,
t1.scope,
t1.acc_status,
t1.end_date,
ac.serial_num
FROM acc_info t1
INNER JOIN sys_user t2 ON t1.user_id = t2.user_id
LEFT JOIN acc_card ac on t2.user_id = ac.user_id
LEFT JOIN sys_dept t6 on t6.dept_id = t2.dept_id
<include refid="queryAccountInfo_ref"/>
order by t1.acc_id desc
</select>
<select id="queryAccInfoBalanceSum" resultType="com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO">
SELECT
SUM( t4.accBalTotal ) AS accBalTotal,
SUM( t4.walletBal ) AS walletBal,
SUM( t4.subsidyBal ) AS subsidyBal,
SUM( t4.accFreezeBalTotal ) AS accFreezeBalTotal
FROM acc_info t1
INNER JOIN sys_user t2 ON t1.user_id = t2.user_id
LEFT JOIN
(
SELECT
user_id,
SUM( CASE WHEN wallet_id = 1 THEN wallet_bal ELSE 0 END ) AS walletBal,
SUM( CASE WHEN wallet_id = 2 THEN wallet_bal ELSE 0 END ) AS subsidyBal,
SUM( a.wallet_bal ) AS accAvailableBal,
SUM( a.frozen_balance ) AS accFreezeBalTotal,
SUM( a.wallet_bal ) + SUM( a.frozen_balance ) AS accBalTotal
FROM acc_wallet_info a
GROUP BY user_id
) AS t4 ON t4.user_id = t1.user_id
<include refid="queryAccountInfo_ref"/>
</select>
<sql id="queryAccountInfo_ref">
<where>
t1.del_flag = 0
and t1.acc_status in
<foreach collection="accountInfoQueryParam.accStatusList" item="accStatus" separator="," open="(" close=")">
#{accStatus}
</foreach>
<if test="accountInfoQueryParam.searchValue != null and accountInfoQueryParam.searchValue != ''">
and (t2.nick_name = #{accountInfoQueryParam.searchValue}
or t2.phonenumber = #{encryptedSearchValue}
)
</if>
<if test="accountInfoQueryParam.deptIdList != null and accountInfoQueryParam.deptIdList.size() > 0">
and t2.dept_id in
<foreach collection="accountInfoQueryParam.deptIdList" item="deptId" separator="," open="(" close=")">
#{deptId}
</foreach>
</if>
<if test="accountInfoQueryParam.startDateTime != null">
and t1.update_time <![CDATA[ >= ]]> #{accountInfoQueryParam.startDateTime}
</if>
<if test="accountInfoQueryParam.endDateTime != null">
and t1.update_time <![CDATA[ <= ]]> #{accountInfoQueryParam.endDateTime}
</if>
<if test="accountInfoQueryParam.walletType != null">
AND EXISTS(
SELECT null FROM
(
SELECT
user_id,
SUM( CASE WHEN wallet_id = 1 THEN wallet_bal ELSE 0 END ) AS walletBal,
SUM( CASE WHEN wallet_id = 2 THEN wallet_bal ELSE 0 END ) AS subsidyBal,
SUM( a.wallet_bal ) + SUM( a.frozen_balance ) accBalTotal
FROM
acc_wallet_info a
GROUP BY
user_id
) AS t4
<where>
t4.user_id = t1.user_id
<!--
<if test="accountInfoQueryParam.walletMinAmount != null">
<if test="accountInfoQueryParam.walletType == 0">
and t4.accBalTotal <![CDATA[ >= ]]> #{accountInfoQueryParam.walletMinAmount}
</if>
<if test="accountInfoQueryParam.walletType == 1">
and t4.walletBal <![CDATA[ >= ]]> #{accountInfoQueryParam.walletMinAmount}
</if>
<if test="accountInfoQueryParam.walletType == 2">
and t4.subsidyBal <![CDATA[ >= ]]> #{accountInfoQueryParam.walletMinAmount}
</if>
</if>
<if test="accountInfoQueryParam.walletMaxAmount != null">
<if test="accountInfoQueryParam.walletType == 0">
and t4.accBalTotal <![CDATA[ <= ]]> #{accountInfoQueryParam.walletMaxAmount}
</if>
<if test="accountInfoQueryParam.walletType == 1">
and t4.walletBal <![CDATA[ <= ]]> #{accountInfoQueryParam.walletMaxAmount}
</if>
<if test="accountInfoQueryParam.walletType == 2">
and t4.subsidyBal <![CDATA[ <= ]]> #{accountInfoQueryParam.walletMaxAmount}
</if>
</if>
-->
</where>
)
</if>
</where>
</sql>
<update id="updateAccInfoEndDateByUserId">
update acc_info
set end_date = #{endDate},
update_by = #{updateBy},
update_time = now()
where user_id in
<foreach item="userId" collection="userIds" open="(" separator="," close=")">
#{userId}
</foreach>
</update>
<select id="queryAccInfoByUserIds" resultType="com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO">
SELECT ai.acc_id,
ai.user_id,
ai.end_date,
ai.acc_status,
su.nick_name,
su.phonenumber,
su.dept_id
FROM acc_info ai
LEFT JOIN sys_user su ON su.user_id = ai.user_id
LEFT JOIN sys_dept co ON co.dept_id = su.dept_id
WHERE ai.user_id in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</select>
<select id="queryAccInfoByUserId" resultType="com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO">
SELECT ai.acc_id,
ai.user_id,
ai.end_date,
ai.acc_status,
su.nick_name,
su.phonenumber,
su.dept_id
FROM acc_info ai
LEFT JOIN sys_user su ON su.user_id = ai.user_id
LEFT JOIN sys_dept co ON co.dept_id = su.dept_id
WHERE ai.user_id = #{userId}
</select>
</mapper>