OperationConfigMapper.xml
5.01 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
<?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.OperationConfigMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.OperationConfig">
<!--
WARNING - @mbg.generated
-->
<result column="id" jdbcType="INTEGER" property="id"/>
<result column="merchant_id" jdbcType="INTEGER" property="merchantId"/>
<result column="staff_id" jdbcType="INTEGER" property="staffId"/>
<result column="business_type" jdbcType="VARCHAR" property="businessType"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="updated_time" jdbcType="VARCHAR" property="updatedTime"/>
<result column="updated_by" jdbcType="TIMESTAMP" property="updatedBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
</resultMap>
<resultMap id="operationListMap" type="cn.com.glsx.entmicro.model.response.operation.OperationListRpcResponse">
<result column="id" jdbcType="INTEGER" property="id"/>
<result column="state_id" jdbcType="VARCHAR" property="stateId"/>
<result column="staff_name" jdbcType="INTEGER" property="staffName"/>
<result column="business_type" jdbcType="VARCHAR" property="businessType"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="department_name" jdbcType="VARCHAR" property="departmentName"/>
<result column="business_uuid" jdbcType="VARCHAR" property="businessUuid"/>
<result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
<result column="config_id" jdbcType="VARCHAR" property="configId"/>
<result column="expert_type" jdbcType="INTEGER" property="expertType"/>
<result column="merchant_id" jdbcType="INTEGER" property="merchantId"/>
</resultMap>
<resultMap id="operationDetailMap" type="cn.com.glsx.entmicro.model.response.operation.OperationDetailRpcResponse">
<result column="id" jdbcType="INTEGER" property="id"/>
<result column="state_id" jdbcType="VARCHAR" property="stateId"/>
<result column="staff_name" jdbcType="INTEGER" property="staffName"/>
<result column="business_type" jdbcType="VARCHAR" property="businessType"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="department_name" jdbcType="VARCHAR" property="departmentName"/>
</resultMap>
<!--删除运营配置-->
<update id="deleteOperationConfig">
update scrm_operation_config
set del_flag = -1,
updated_time = now()
where id = #{id}
</update>
<!--轻改运营配置详情-->
<select id="getDetail" resultType="cn.com.glsx.entmicro.model.response.operation.OperationDetailRpcResponse">
select soc.id,
soc.state_id stateId,
soc.status status,
soc.business_type businessType,
soc.staff_id staffId,
soc.business_uuid businessUuid,
GROUP_CONCAT(DISTINCT ed.department_name) departmentName,
es.staff_name staffName,
soc.qr_code qrCode,
soc.config_id configId,
soc.expert_type expertType,
soc.merchant_id merchantId
from scrm_operation_config soc
left join entmicro_staff es on soc.staff_id = es.id
LEFT JOIN `entmicro_staff_depart_relation` esdr ON es.id = esdr.staff_id
LEFT JOIN entmicro_department ed ON esdr.department_id = ed.id
where soc.id = #{id}
group by soc.id
</select>
<!--分页列表-->
<select id="getPageList" resultMap="operationListMap">
SELECT soc.id,
soc.state_id,
soc.status,
soc.business_type,
es.staff_name,
soc.business_uuid,
GROUP_CONCAT(DISTINCT ed.department_name) department_name,
-1 isWelcomeWord,
soc.qr_code,
soc.config_id,
soc.expert_type,
soc.merchant_id
FROM `scrm_operation_config` soc
LEFT JOIN entmicro_staff es ON soc.staff_id = es.id
LEFT JOIN `entmicro_staff_depart_relation` esdr ON es.id = esdr.staff_id
LEFT JOIN entmicro_department ed ON esdr.department_id = ed.id
WHERE
soc.del_flag = 0
<if test="departmentId != null and departmentId != ''">
and ed.id = #{departmentId}
</if>
<if test="staffName != null and staffName != ''">
AND es.staff_name LIKE concat('%',#{staffName},'%')
</if>
<if test="businessType != null">
AND soc.business_type = #{businessType}
</if>
<if test="merchant != null">
and soc.merchant_id = #{merchant}
</if>
<if test="staffId != null">
and soc.staff_id = #{staffId}
</if>
and soc.created_by = #{merchantId}
GROUP BY soc.id
ORDER BY soc.created_time DESC
</select>
</mapper>