EvalShopPoolDao.xml
3.92 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?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.fw.morax.dao.eval.EvalShopPoolDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.fw.morax.domain.db.eval.EvalShopPool">
<result column="id" property="id"/>
<result column="eval_group_rank_id" property="evalGroupRankId"/>
<result column="eval_group_rank_stage_id" property="evalGroupRankStageId"/>
<result column="egc" property="egc"/>
<result column="eval_group_id" property="evalGroupId"/>
<result column="shop_id" property="shopId"/>
<result column="shop_name" property="shopName"/>
<result column="reward" property="reward"/>
<result column="status" property="status"/>
<result column="score" property="score"/>
<result column="score_ratio" property="scoreRatio"/>
<result column="rank" property="rank"/>
<result column="data_date" property="dataDate"/>
<result column="monthly" property="monthly"/>
<result column="group_id" property="groupId"/>
<result column="yn" property="yn"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="all_columns">
id,eval_group_rank_id,eval_group_rank_stage_id
,egc,eval_group_id,shop_id,shop_name,reward
,status,score,score_ratio,rank,data_date
,monthly,group_id,yn,create_time,update_time
</sql>
<select id="getLastPool" resultType="cn.fw.morax.domain.db.eval.EvalShopPool">
SELECT
<include refid="all_columns"/>
FROM
eval_shop_pool t1,
(
SELECT CONVERT( SUBSTRING_INDEX( group_concat( id ORDER BY `create_time` DESC ), ',', 1 ), SIGNED ) pk
FROM
eval_shop_pool
WHERE
DATE_FORMAT( create_time, '%Y-%m' ) >= #{monthly}
AND group_id = #{groupId}
AND yn = 1
GROUP BY
shop_id
) t2
WHERE
t1.id = t2.pk
</select>
<select id="queryPagePool" resultType="cn.fw.morax.domain.vo.eval.EvalShopPoolVO">
SELECT
id
,eval_group_rank_id
,eval_group_rank_stage_id
,egc
,eval_group_id
,shop_id
,shop_name
,reward
,status
,score
,score_ratio
,rank
,data_date
,monthly
,group_id
,yn
,create_time
,update_time
from eval_shop_pool
where yn = 1
and group_id = #{condition.groupId}
<if test="condition.monthly !=null">
and monthly = #{condition.monthly}
</if>
<if test="condition.managerShopIds !=null and condition.managerShopIds.size() > 0">
and shop_id in
<foreach collection="condition.managerShopIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="condition.orderString != null and condition.orderString !='' ">
${condition.orderString}
</if>
limit #{startIndex},#{pageSize};
</select>
<select id="queryPagePoolTotal" resultType="java.lang.Long">
SELECT
IFNULL(count(1),0)
from eval_shop_pool
where yn = 1
and group_id = #{condition.groupId}
<if test="condition.monthly !=null">
and monthly = #{condition.monthly}
</if>
<if test="condition.managerShopIds !=null and condition.managerShopIds.size() > 0">
and shop_id in
<foreach collection="condition.managerShopIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</select>
</mapper>