<?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.ComActUserWalletMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActUserWalletDO">
|
<id column="id" property="id" />
|
<result column="user_id" property="userId" />
|
<result column="community_id" property="communityId" />
|
<result column="income_amount" property="incomeAmount" />
|
<result column="available_amount" property="availableAmount" />
|
<result column="settlement_amount" property="settlementAmount" />
|
<result column="easy_count" property="easyCount" />
|
<result column="create_at" property="createAt" />
|
<result column="update_at" property="updateAt" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, user_id, community_id, income_amount, available_amount, settlement_amount, easy_count, create_at, update_at
|
</sql>
|
|
<select id="getCommunityName" resultType="Map">
|
SELECT
|
ca.`name`,
|
sua.content
|
FROM
|
com_act AS ca
|
LEFT JOIN sys_user_agreement AS sua ON sua.community_id = ca.community_id
|
WHERE
|
ca.community_id = ${communityId} and sua.type = #{type}
|
</select>
|
|
<select id="getAgreementContent" resultType="Map">
|
SELECT
|
ca.`name`,
|
sua.content
|
FROM
|
sys_user_agreement AS sua
|
LEFT JOIN com_act AS ca ON sua.community_id = ca.community_id
|
WHERE
|
sua.community_id = ${communityId} and sua.type = #{type}
|
</select>
|
|
<select id="getWalletRanking" resultType="com.panzhihua.common.model.vos.community.wallet.ComActWalletRankingVO">
|
SELECT
|
su.`name` as userName,
|
su.nick_name,
|
su.image_url,
|
cauw.income_amount,
|
(select count(id) from com_act_easy_photo where sponsor_id = cauw.user_id and community_id = ${walletTradeDTO.communityId}) as easyCount
|
FROM
|
com_act_user_wallet AS cauw
|
LEFT JOIN sys_user AS su ON su.user_id = cauw.user_id
|
where cauw.community_id = ${walletTradeDTO.communityId}
|
ORDER BY
|
cauw.income_amount DESC
|
</select>
|
|
<select id="getUserWalletList" parameterType="com.panzhihua.common.model.dtos.community.wallet.PageComActWalletAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.wallet.ComActWalletAdminVO">
|
SELECT
|
cauw.id,
|
su.user_id,
|
su.`name` AS userName,
|
su.nick_name,
|
su.phone,
|
cauw.income_amount,
|
cauw.available_amount,
|
cauw.settlement_amount
|
FROM
|
com_act_user_wallet AS cauw
|
LEFT JOIN sys_user AS su ON su.user_id = cauw.user_id
|
<where>
|
<if test="pageWalletAdminDTO.communityId != null">
|
AND cauw.community_id = ${pageWalletAdminDTO.communityId}
|
</if>
|
<if test="pageWalletAdminDTO.name != null and pageWalletAdminDTO.name != """>
|
AND (su.nick_name like concat (#{pageWalletAdminDTO.name},'%') or su.name like concat (#{pageWalletAdminDTO.name},'%'))
|
</if>
|
<if test="pageWalletAdminDTO.phone != null and pageWalletAdminDTO.phone != """>
|
AND su.phone = #{pageWalletAdminDTO.phone}
|
</if>
|
</where>
|
order by cauw.create_at desc
|
</select>
|
|
<insert id="insertSysAgreement">
|
insert into sys_user_agreement(`type`,content,create_at,`name`,community_id) values (#{type},#{content},now(),#{name},#{communityId})
|
</insert>
|
|
</mapper>
|