ScrmBusinessCardActivityDOMapper.xml
4.97 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
<?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.ScrmBusinessCardActivityDOMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.ScrmBusinessCardActivityDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="merchant_id" jdbcType="INTEGER" property="merchantId" />
<result column="card_id" jdbcType="INTEGER" property="cardId" />
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
<result column="car_model" jdbcType="VARCHAR" property="carModel" />
<result column="contact_name" jdbcType="VARCHAR" property="contactName" />
<result column="contact_phone" jdbcType="VARCHAR" property="contactPhone" />
<result column="business_scenario" jdbcType="VARCHAR" property="businessScenario" />
<result column="product_items" jdbcType="VARCHAR" property="productItems" />
<result column="follow_type" jdbcType="INTEGER" property="followType" />
<result column="open_id" jdbcType="VARCHAR" property="openId" />
<result column="union_id" jdbcType="VARCHAR" property="unionId" />
<result column="del_flag" jdbcType="TINYINT" 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="BusinessCardActvityRpcResponseMap" type="cn.com.glsx.entmicro.model.response.businessCard.BusinessCardActvityRpcResponse">
<id column="id" jdbcType="INTEGER" property="activityId" />
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
<result column="car_model" jdbcType="VARCHAR" property="carModel" />
<result column="contact_name" jdbcType="VARCHAR" property="contactName" />
<result column="contact_phone" jdbcType="VARCHAR" property="contactPhone" />
<result column="card_name" jdbcType="VARCHAR" property="cardName" />
<result column="staff_name" jdbcType="VARCHAR" property="staffName" />
<result column="business_scenario" jdbcType="VARCHAR" property="businessScenario" />
<result column="product_items" jdbcType="VARCHAR" property="productItems" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="follow_type" jdbcType="INTEGER" property="followType" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, merchant_id, card_id, merchant_name, car_model, contact_name, contact_phone, followType,
open_id, union_id, del_flag, created_by, created_time, updated_by, updated_time
</sql>
<select id="selectBusinessActivityPageByCondition" resultMap="BusinessCardActvityRpcResponseMap">
select
sbca.id,
sbca.merchant_name,
sbca.car_model,
sbca.contact_name,
sbca.contact_phone,
sbca.business_scenario,
sbca.product_items,
sbc.card_name,
es.staff_name,
sbca.created_time,
sbca.follow_type
from scrm_business_card_activity sbca
left join scrm_business_card sbc on sbca.card_id = sbc.id and sbc.del_flag = 0
LEFT JOIN entmicro_staff es ON es.id = sbc.staff_id AND es.del_flag = 0
LEFT JOIN `entmicro_staff_depart_relation` esdr ON esdr.staff_id = es.id AND esdr.del_flag = 0
where sbca.del_flag = 0 and sbca.merchant_id = #{condition.merchantId}
and esdr.relevance_merchant = #{condition.merchantId}
<if test="condition.startApplyDate != null">
AND sbca.created_time <![CDATA[>=]]> #{condition.startApplyDate,jdbcType=DATE}
</if>
<if test="condition.endApplyDate != null">
AND sbca.created_time <![CDATA[<=]]> #{condition.endApplyDate,jdbcType=DATE}
</if>
<if test="condition.cardName != null and condition.cardName != ''">
AND sbc.card_name like concat('%',#{condition.cardName},'%')
</if>
<if test="condition.staffName != null and condition.staffName != ''">
AND es.staff_name like concat('%',#{condition.staffName},'%')
</if>
<if test="condition.followType != null">
AND sbca.follow_type = #{condition.followType}
</if>
<if test="condition.userType != null and condition.userType == 2">
and esdr.user_oneid=#{condition.uuid}
</if>
<if test="condition.staffPhone != null and condition.staffPhone != ''">
and es.staff_phone = #{condition.staffPhone}
</if>
<if test="condition.cardId != null">
and sbc.id = #{condition.cardId}
</if>
group by sbca.id
order by sbca.created_time DESC
</select>
<select id="findByOpenId"
resultMap="BusinessCardActvityRpcResponseMap">
select * from scrm_business_card_activity where open_id = #{openId} and del_flag = 0
</select>
</mapper>