<?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.ComActIntegralUserTradeMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActIntegralUserTradeDO">
|
<id column="id" property="id" />
|
<result column="user_id" property="userId" />
|
<result column="integral_id" property="integralId" />
|
<result column="community_id" property="communityId" />
|
<result column="service_id" property="serviceId" />
|
<result column="service_type" property="serviceType" />
|
<result column="amount" property="amount" />
|
<result column="change_type" property="changeType" />
|
<result column="remark" property="remark" />
|
<result column="identity_type" property="identityType" />
|
<result column="create_at" property="createAt" />
|
<result column="create_by" property="createBy" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, user_id, integral_id, community_id, service_id, service_type, amount, change_type, remark, identity_type, create_at, create_by
|
</sql>
|
|
<select id="getIntegralCount" resultType="Integer" parameterType="com.panzhihua.common.model.dtos.community.integral.ComActIntegralCountDTO">
|
select count(id) from com_act_integral_user_trade where community_id = ${integralCountDTO.communityId} and service_type = #{integralCountDTO.serviceType} and user_id = #{integralCountDTO.userId} and change_type = #{integralCountDTO.type} and create_at between #{integralCountDTO.startTime} and #{integralCountDTO.endTime}
|
</select>
|
|
<select id="getIntegralCommunityTradeApplets" parameterType="com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO"
|
resultType="com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityTradeVO">
|
SELECT
|
caiut.id,
|
caiut.amount,
|
caiut.service_type,
|
caiut.remark,
|
caiut.create_at,
|
caiut.change_type,
|
caiut.identity_type,
|
ca.`name` AS communityName
|
FROM
|
com_act_integral_user_trade AS caiut
|
LEFT JOIN com_act AS ca ON ca.community_id = caiut.community_id
|
<where>
|
1=1
|
<if test="communityTradeDTO.changeType != null">
|
AND caiut.change_type = #{communityTradeDTO.changeType}
|
</if>
|
<if test="communityTradeDTO.communityId != null">
|
and caiut.community_id = ${communityTradeDTO.communityId}
|
</if>
|
|
<if test="communityTradeDTO.userId != null">
|
and caiut.user_id = #{communityTradeDTO.userId}
|
</if>
|
|
<if test="communityTradeDTO.identityType != null">
|
and caiut.identity_type = #{communityTradeDTO.identityType}
|
</if>
|
</where>
|
order by caiut.create_at desc
|
</select>
|
|
<select id="getIntegralTradeListAdmin" parameterType="com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO"
|
resultType="com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserTradeAdminVO">
|
SELECT
|
caiut.id,
|
su.nick_name,
|
su.phone,
|
su.`name`,
|
su.is_volunteer,
|
su.is_partymember,
|
caiut.amount,
|
caiut.identity_type,
|
caiut.remark,
|
caiut.create_at
|
FROM
|
com_act_integral_user_trade AS caiut
|
LEFT JOIN sys_user AS su ON su.user_id = caiut.user_id
|
<where>
|
<if test="integralRuleDTO.communityId != null">
|
and caiut.community_id = ${integralRuleDTO.communityId}
|
</if>
|
<if test="integralRuleDTO.identityType != null">
|
and caiut.identity_type = #{integralRuleDTO.identityType}
|
</if>
|
<if test="integralRuleDTO.name != null and integralRuleDTO.name != """>
|
and (su.nick_name like concat (#{integralRuleDTO.name},'%') or su.name like concat (#{integralRuleDTO.name},'%'))
|
</if>
|
<if test="integralRuleDTO.phone != null and integralRuleDTO.phone != """>
|
and su.phone = #{integralRuleDTO.phone}
|
</if>
|
<if test="integralRuleDTO.userIdentity != null and integralRuleDTO.userIdentity == 2">
|
and su.is_partymember = 1
|
</if>
|
<if test="integralRuleDTO.userIdentity != null and integralRuleDTO.userIdentity == 3">
|
and su.is_volunteer = 1
|
</if>
|
</where>
|
order by caiut.create_at desc
|
</select>
|
|
<select id="getUserInfo" resultType="com.panzhihua.common.model.vos.community.integral.admin.IntegralUserVO">
|
select user_id,phone,nick_name,id_card,`name`,`status`,is_volunteer,is_partymember,create_at from sys_user where user_id = #{userId}
|
</select>
|
<select id="getUserIntegralDetail"
|
resultType="com.panzhihua.common.model.vos.community.integral.IntegralTradeVO">
|
SELECT
|
caiut.id,
|
caiut.amount,
|
caiut.service_type,
|
caiut.service_id,
|
caiut.remark,
|
caiut.create_at,
|
caiut.change_type,
|
caiut.identity_type,
|
ca.`name` AS communityName
|
FROM
|
com_act_integral_user_trade AS caiut
|
LEFT JOIN com_act AS ca ON ca.community_id = caiut.community_id
|
WHERE caiut.id = #{id}
|
</select>
|
</mapper>
|