ResidentPointGrowthLevelManageMapper.xml
5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?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="cn.com.glsx.dj.mindworkplate.mapper.ResidentPointGrowthLevelManageMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.ResidentPointGrowthLevelManage">
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR"/>
<result column="level_config_id" property="levelConfigId" jdbcType="INTEGER"/>
<result column="level_type" property="levelType" jdbcType="TINYINT"/>
<result column="level_name" property="levelName" jdbcType="VARCHAR"/>
<result column="distribution_time" property="distributionTime" jdbcType="TIMESTAMP"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR"/>
<result column="statistics_date" property="statisticsDate" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="DTOResultMap" extends="BaseResultMap"
type="cn.com.glsx.dj.mindworkplate.dto.ResidentPointGrowthLevelManageDTO">
<result column="staff_name" property="staffName" jdbcType="VARCHAR"/>
<result column="points_category_name" property="pointsCategoryName" jdbcType="VARCHAR"/>
<result column="points_type_name" property="pointsTypeName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, staff_phone, level_type, level_name, distribution_time, created_by, created_date,
updated_by, updated_date, deleted_flag, statistics_date, level_config_id
</sql>
<select id="getLevelAndLadgeList" resultType="cn.com.glsx.dj.mindworkplate.dto.residentpoint.BadgeDTO">
SELECT t2.id,t1.staff_phone staffPhone, medal_type AS medalType,t2.level_name badgeName,
rplcr.coupon_name couponName,rplcr.coupon_count couponCount
FROM `resident_point_growth_level_config` t2
LEFT JOIN `resident_point_growth_level_manage` t1 ON t2.id = t1.level_config_id AND t1.deleted_flag = 'N'
and t1.staff_phone = #{staffPhone} AND DATE_FORMAT(t1.statistics_date, '%Y-%m') = DATE_FORMAT(#{countDate}, '%Y-%m')
LEFT JOIN resident_point_level_coupon_ref rplcr on t2.id = rplcr.level_config_id and rplcr.deleted_flag = 'N'
LEFT JOIN hw_product_info hpi on rplcr.coup_id = hpi.id and hpi.deleted_flag = 'N'
WHERE t2.level_type=2
AND t2.deleted_flag = 'N'
group by t2.id,rplcr.id
</select>
<select id="getLevelAndLadgeListByPhoneList"
resultType="cn.com.glsx.dj.mindworkplate.dto.residentpoint.BadgeDTO">
SELECT t1.id,t1.staff_phone staffPhone, medal_type AS medalType,t2.level_name badgeName
FROM `resident_point_growth_level_manage` t1
LEFT JOIN `resident_point_growth_level_config` t2 ON t2.id = t1.level_config_id
WHERE t1.staff_phone IN (
<foreach collection="staffPhoneList" item="staffPhone" separator=",">
#{staffPhone}
</foreach>
)
AND DATE_FORMAT(t1.statistics_date, '%Y-%m') = DATE_FORMAT(#{countDate}, '%Y-%m')
AND t2.level_type=2
AND t1.deleted_flag = 'N'
AND t2.deleted_flag = 'N'
</select>
<select id="page" resultMap="DTOResultMap">
select rpglm.*,sb.staff_name,spc.points_category_name,spt.points_type_name
from resident_point_growth_level_manage rpglm
left join `dj_car_life_staff_base_info` sb on rpglm.staff_phone = sb.staff_phone and sb.deleted_flag = 'N'
left join resident_point_growth_level_config rpglc on rpglm.level_config_id = rpglc.id
left join store_points_category spc on rpglc.point_classification = spc.category_code and spc.deleted_flag = 'N'
left join store_points_type spt on rpglc.point_type = spt.type_code and spt.deleted_flag = 'N'
where rpglm.deleted_flag = 'N'
<if test="staffName != null and staffName != ''">
and sb.staff_name like concat('%',#{staffName},'%')
</if>
<if test="staffPhone != null and staffPhone != ''">
and rpglm.staff_phone like concat('%',#{staffPhone},'%')
</if>
<if test="levelName != null and levelName != ''">
and rpglc.level_name = #{levelName}
</if>
<if test="levelType != null">
and rpglc.level_type = #{levelType}
</if>
<if test="grantTimeBegin != null">
and rpglm.distribution_time >= #{grantTimeBegin}
</if>
<if test="grantTimeEnd != null">
and rpglm.distribution_time <= #{grantTimeEnd}
</if>
group by rpglm.id order by rpglm.created_date desc,rpglm.id desc
</select>
</mapper>