<?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.panzhihua.service_community.dao.ComActUserWalletTradeMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActUserWalletTradeDO">
|
<id column="id" property="id" />
|
<result column="user_id" property="userId" />
|
<result column="community_id" property="communityId" />
|
<result column="service_id" property="serviceId" />
|
<result column="amount" property="amount" />
|
<result column="type" property="type" />
|
<result column="remark" property="remark" />
|
<result column="create_at" property="createAt" />
|
<result column="create_by" property="createBy" />
|
<result column="wallet_id" property="walletId" />
|
<result column="change_type" property="changeType" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, user_id, community_id, service_id, amount, type, remark, create_at, create_by, wallet_id, change_type
|
</sql>
|
|
<select id="getUserWalletTradeList" resultType="com.panzhihua.common.model.vos.community.wallet.ComActWalletTradeVO"
|
parameterType="com.panzhihua.common.model.dtos.community.wallet.PageComActWalletTradeDTO">
|
SELECT
|
cauwt.id,
|
ca.`name` AS communityName,
|
cauwt.type,
|
cauwt.remark,
|
cauwt.change_type,
|
cauwt.amount,
|
cauwt.create_at
|
FROM
|
com_act_user_wallet_trade AS cauwt
|
LEFT JOIN com_act AS ca ON ca.community_id = cauwt.community_id
|
where cauwt.community_id = #{walletTradeDTO.communityId}
|
and cauwt.user_id = #{walletTradeDTO.userId}
|
|
order by cauwt.create_at desc
|
</select>
|
|
<select id="getUserWalletTradeAdmin" parameterType="com.panzhihua.common.model.dtos.community.wallet.PageComActWalletTradeAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.wallet.ComActWalletTradeAdminVO">
|
SELECT
|
cauwt.id,
|
su.user_id,
|
cauwt.amount,
|
cauwt.type,
|
su.`name` AS userName,
|
su.nick_name,
|
cauwt.change_type,
|
su.phone,
|
cauwt.create_at,
|
su1.`name` AS operationUserName
|
FROM
|
com_act_user_wallet_trade AS cauwt
|
LEFT JOIN sys_user AS su ON su.user_id = cauwt.user_id
|
LEFT JOIN sys_user AS su1 ON su1.user_id = cauwt.create_by
|
<where>
|
<if test="walletTradeDTO.communityId != null">
|
and cauwt.community_id = #{walletTradeDTO.communityId}
|
</if>
|
<if test="walletTradeDTO.type != null">
|
and cauwt.type = #{walletTradeDTO.type}
|
</if>
|
<if test="walletTradeDTO.name != null and walletTradeDTO.name != """>
|
AND (su.nick_name like concat (#{walletTradeDTO.name},'%') or su.name like concat (#{walletTradeDTO.name},'%'))
|
</if>
|
<if test="walletTradeDTO.phone != null and walletTradeDTO.phone != """>
|
AND su.phone like concat (#{walletTradeDTO.phone},'%')
|
</if>
|
<if test="walletTradeDTO.startTime != null and walletTradeDTO.startTime != """>
|
AND cauwt.create_at <![CDATA[>=]]> #{walletTradeDTO.startTime}
|
</if>
|
<if test="walletTradeDTO.endTime != null and walletTradeDTO.endTime != """>
|
AND cauwt.create_at <![CDATA[<=]]> #{walletTradeDTO.endTime}
|
</if>
|
</where>
|
<if test="walletTradeDTO.sort == null">
|
order by cauwt.create_at desc
|
</if>
|
<if test="walletTradeDTO.sort != null and walletTradeDTO.sort == 1">
|
order by cauwt.amount asc
|
</if>
|
<if test="walletTradeDTO.sort != null and walletTradeDTO.sort == 2">
|
order by cauwt.amount desc
|
</if>
|
|
</select>
|
|
</mapper>
|