DracImCustomerCollectionMapper.xml
5.07 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
<?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.DracImCustomerCollectionMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.DracImCustomerCollection">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="im_id" jdbcType="VARCHAR" property="imId"/>
<result column="customer_id" jdbcType="INTEGER" property="customerId"/>
<result column="phone" jdbcType="INTEGER" property="phone"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
<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"/>
</resultMap>
<resultMap id="resultMap" type="cn.com.glsx.entmicro.model.response.DracImCustomerCollectionResponse">
<!--
WARNING - @mbg.generated
-->
<result column="im_id" jdbcType="VARCHAR" property="imId"/>
<result column="customer_id" jdbcType="INTEGER" property="customerId"/>
<result column="customer_name" jdbcType="INTEGER" property="customerName"/>
<result column="phone" jdbcType="INTEGER" property="phone"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
<result column="del_flag" jdbcType="INTEGER" property="status"/>
<result column="updated_time" jdbcType="INTEGER" property="sendTime"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, im_id, customer_id, phone, del_flag, created_by, created_time, updated_by, updated_time
</sql>
<update id="updateStatus">
update drac_im_customer_collection
set del_flag=1,
updated_time=now()
where im_id=#{imId}
</update>
<select id="findByUuid" resultMap="resultMap">
select t2.*,t3.content from drac_im_info t1
left join drac_im_customer_collection t2 on t1.id=t2.im_id
left join drac_im_message_config t3 on t1.id=t3.im_id
where
t1.im_uid=#{uuid}
</select>
<select id="findByDracId"
resultMap="resultMap">
select t2.*,t3.content from drac_im_info t1
left join drac_im_customer_collection t2 on t1.id=t2.im_id
left join drac_im_message_config t3 on t1.id=t3.im_id
where
t1.id=#{id}
</select>
<select id="findAllByPage"
resultMap="resultMap">
select t1.*,t3.content from drac_im_customer_collection t1
left join drac_im_info t2 on t1.im_id=t2.id
left join drac_im_message_config t3 on t2.id=t3.im_id
where 1=1 and t2.merchant_id=#{condition.merchantId}
<if test="condition.phone != null">
and t1.phone like concat('%',#{condition.phone},'%')
</if>
<if test="condition.status != null">
and t1.del_flag=#{condition.status}
</if>
order by t1.created_time desc
</select>
<select id="findByIdAndPhone"
resultType="cn.com.glsx.entmicro.model.response.DracImCustomerCollectionResponse">
select id as id,code_id as codeId,phone as phone from drac_im_customer_collection where im_id=#{imId}
and phone=#{phone}
</select>
<select id="findMessageStatic" resultType="java.lang.Integer">
select count(1) from drac_im_customer_collection t1
left join drac_im_info t2 on t1.im_id=t2.id
left join drac_im_message_config t3 on t2.id=t3.im_id
where 1=1 and t2.merchant_id=#{merchantId}
<if test="status != null">
and t1.del_flag=#{status}
</if>
</select>
<select id="findPhoneByState" resultType="java.lang.String">
select phone from drac_im_customer_collection t1
left join drac_channel_code t2 on t1.code_id=t2.id
where t2.code_state=#{state}
</select>
<select id="dracCustomerConditionPageSearch" resultMap="resultMap" parameterType="cn.com.glsx.entmicro.model.request.drainage.DracImCustomerSearchPagelRequest">
SELECT c.id,c.`im_id`,c.`customer_id`,c.`phone`,c.`code_id`,c.`del_flag`,c.`created_by`,
c.`created_time`,c.`updated_by`,c.`updated_time`,c.`customer_name`,m.`content`
FROM `drac_im_customer_collection` c
LEFT JOIN `drac_im_message_config` m ON m.`im_id`=c.`im_id`
where c.`im_id`=#{condition.id}
<if test="condition.phone!=null and condition.phone!=''">
and c.`phone` like CONCAT('%',#{condition.phone},'%')
</if>
<if test="condition.status!=null">
and c.`del_flag` = #{condition.status}
</if>
<if test="condition.customerName!=null and condition.customerName!=''">
and c.`customer_name` like CONCAT('%',#{condition.customerName},'%')
</if>
</select>
</mapper>