You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.6 KiB

<?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.qniao.dam.infrastructure.persistent.dao.view.WalletAccountViewDao">
<select id="pageWalletAccountRecord"
resultType="com.qniao.dam.api.query.walletaccount.user.response.UserGetWalletAccountRecordVo">
SELECT
dwar.id,
dwar.create_time,
dwar.wallet_account_id,
dwar.trade_type,
dwar.trade_amount,
dwar.is_income,
dwar.remark
FROM da_wallet_account_record as dwar
INNER JOIN da_wallet_account as dwa on dwa.id=dwar.wallet_account_id
where dwa.is_delete=0
<if test="queryParam.queryUserId != null">
and dwa.user_id = #{queryParam.queryUserId}
</if>
<if test="queryParam.queryOrgId != null">
and dwa.org_id = #{queryParam.queryOrgId}
</if>
<if test="queryParam.tradeType != null">
and dwar.trade_type = #{queryParam.tradeType}
</if>
<if test="queryParam.recordTimeFrom != null and queryParam.recordTimeTo != null">
and dwar.create_time BETWEEN #{queryParam.recordTimeFrom} and #{queryParam.recordTimeTo}
</if>
order by dwar.create_time desc
</select>
<select id="pageWalletAccountRecordByOperator"
resultType="com.qniao.dam.api.query.walletaccount.user.response.UsePageWalletAccountRecordByOperatorVo">
select
dawar.associate_id,
dawar.trade_type,
dawar.is_income,
dawar.create_time,
dam.user_id as matchmakerUserId,
dam.`name`,
dam.phone,
dam.type as matchmakerType,
dawar.trade_amount,
dawar.original_balance,
dawar.current_balance
from da_wallet_account_record as dawar
INNER JOIN da_wallet_account as dawa on dawar.wallet_account_id=dawa.id
LEFT JOIN da_matchmaker as dam on dam.is_delete=0 and dam.user_id=dawa.user_id
where dawa.is_delete=0 and dawa.identity_type=1
<if test="queryParams.name != null and queryParams.name != '' ">
AND dam.`name` LIKE CONCAT('%', TRIM(#{queryParams.name}), '%')
</if>
<if test="queryParams.phone != null and queryParams.phone != '' ">
AND dam.phone LIKE CONCAT('%', TRIM(#{queryParams.phone}), '%')
</if>
<if test="queryParams.createTimeFrom != null and queryParams.createTimeTo != null">
and dawar.create_time BETWEEN #{queryParams.createTimeFrom} and #{queryParams.createTimeTo}
</if>
order by dawar.create_time desc
</select>
</mapper>