ScrmSubscribeMerchantMapper.xml
8.32 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?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.entmicro.mapper.ScrmSubscribeMerchantMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.subscribe.ScrmSubscribeMerchantDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="merchant_id" jdbcType="INTEGER" property="merchantId"/>
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
<result column="service_type" jdbcType="INTEGER" property="serviceType"/>
<result column="open_state" jdbcType="VARCHAR" property="openState"/>
<result column="open_time" jdbcType="TIMESTAMP" property="openTime"/>
<result column="activity_id" jdbcType="INTEGER" property="activityId"/>
<result column="welfare_man_id" jdbcType="INTEGER" property="welfareManId"/>
<result column="entmicro_name" jdbcType="VARCHAR" property="entmicroName"/>
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="open_status" jdbcType="TINYINT" property="openStatus"/>
</resultMap>
<resultMap id="SubscriptionViewResponseMap"
type="cn.com.glsx.entmicro.model.response.subscribe.SubscriptionViewRpcResponse">
<id column="id" jdbcType="INTEGER" property="subId"/>
<result column="merchant_id" jdbcType="INTEGER" property="merchantId"/>
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
<result column="service_type" jdbcType="INTEGER" property="serviceType"/>
<result column="open_state" jdbcType="VARCHAR" property="openState"/>
<result column="open_time" jdbcType="TIMESTAMP" property="openTime"/>
<result column="activity_id" jdbcType="INTEGER" property="activityId"/>
<result column="welfare_man_id" jdbcType="INTEGER" property="welfareManId"/>
<result column="entmicro_name" jdbcType="VARCHAR" property="entmicroName"/>
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="open_status" jdbcType="INTEGER" property="openStatus"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, created_by, created_time, updated_by, updated_time, del_flag, merchant_id, merchant_name, service_type,
open_time, activity_id,welfare_man_id,entmicro_name, open_state,begin_time,end_time,open_status
</sql>
<update id="updateListOutOfDate">
<foreach collection="list" index="index" item="item" separator=";">
update scrm_subscribe_merchant set open_state = #{item.openState},open_status = #{item.openStatus}
where id = #{item.id}
</foreach>
</update>
<select id="selectSubscribeMerchantPage" resultMap="SubscriptionViewResponseMap">
select
<include refid="Base_Column_List"/>
from scrm_subscribe_merchant
where del_flag = 0
<if test="merchantId != null ">
and merchant_id = #{merchantId}
</if>
<if test="serviceType != null ">
and service_type = #{serviceType}
</if>
<if test="merchantName != null and merchantName != ''">
and merchant_name like concat("%",#{merchantName},"%")
</if>
<if test="openStatus != null ">
and open_status = #{openStatus}
</if>
group by id
order by open_time desc
</select>
<select id="selectMoveCarCodeCount"
resultType="cn.com.glsx.entmicro.model.response.subscribe.MoveCarCodeCountResponse">
select smccb.merchant_id merchantId,count(smccb.id) totalCount,count(smccb.owner_phone) bindCount
from scrm_move_car_code_bind smccb
where smccb.del_flag = 0
<if test="merchantIdList != null and merchantIdList.size>0">
and smccb.merchant_id IN
<foreach collection="merchantIdList" index="index" open="(" close=")" separator="," item="merchantId">
#{merchantId}
</foreach>
</if>
group by smccb.merchant_id
</select>
<select id="selectIsOpenMerchant" resultType="java.lang.Integer">
select ssm.merchant_id from scrm_subscribe_merchant ssm
where ssm.del_flag = 0 and service_type = #{serviceType}
<if test="merchantIdList != null and merchantIdList.size>0">
and ssm.merchant_id IN
<foreach collection="merchantIdList" index="index" open="(" close=")" separator="," item="merchantId">
#{merchantId}
</foreach>
</if>
group by ssm.merchant_id
</select>
<select id="findOutOfDateMerchant"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from scrm_subscribe_merchant
where del_flag = 0 and end_time < NOW()
</select>
<select id="findActivityIdList"
resultType="cn.com.glsx.entmicro.model.response.subscribe.SubscribeActRpcResponse">
SELECT t.service_type AS serviceType,
t.activity_id AS activityId,
t1.service_name AS serviceTypeName
FROM scrm_subscribe_merchant t
LEFT JOIN scrm_subscribe_service t1 ON t1.service_type = t.service_type
WHERE t.del_flag = 0
AND t.open_status = 1
AND t.merchant_id = #{condition.merchantId}
</select>
<select id="getOpenedInfo"
resultType="cn.com.glsx.entmicro.model.response.subscribe.MerchantSubServeRpcResponse">
SELECT merchant_id as merchantId , welfare_man_id as welfareManId,service_type as serviceType FROM
scrm_subscribe_merchant
WHERE del_flag = 0 AND open_status = 1
<if test="condition.serviceType != null">
AND service_type = #{condition.serviceType}
</if>
<if test="condition.merchantIds != null and condition.merchantIds.size > 0">
AND merchant_id in
<foreach collection="condition.merchantIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="findMerchantWelfareIdInfo"
resultType="cn.com.glsx.entmicro.model.response.subscribe.MerchantWelfareIdResponse">
select merchant_id as merchantId , welfare_man_id as welfareManId,merchant_name as merchantName
from scrm_subscribe_merchant where del_flag = 0 and service_type = 3 and merchant_id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectMerchantSubscribe"
resultMap="BaseResultMap">
select *
from scrm_subscribe_merchant
where del_flag = 0
and merchant_id = #{merchantId}
and service_type = #{serviceType}
</select>
<select id="getOpenMerchantPage"
resultType="cn.com.glsx.entmicro.model.response.subscribe.SubscribeServiceRpcResponse">
select merchant_id as merchantId,merchant_name as merchantName,service_type as serviceType
from scrm_subscribe_merchant where del_flag = 0 and open_status = 1
<if test="param.serviceType != null">
<if test="param.serviceType == 3">
and welfare_man_id is not null
</if>
and service_type = #{param.serviceType}
</if>
<if test="param.merchantId != null">
and merchant_id = #{param.merchantId}
</if>
<if test="param.merchantName != null and param.merchantName != ''">
and merchant_name LIKE CONCAT('%',#{param.merchantName},'%')
</if>
order by created_time desc
</select>
</mapper>