TrialDriveShopMapper.xml
5.14 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
<?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.admin.modules.mapper.TrialDriveShopMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.TrialDriveShop">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
<result column="shop_code" jdbcType="VARCHAR" property="shopCode"/>
<result column="shop_level" jdbcType="VARCHAR" property="shopLevel"/>
<result column="area" jdbcType="VARCHAR" property="area"/>
<result column="province" jdbcType="VARCHAR" property="province"/>
<result column="city" jdbcType="VARCHAR" property="city"/>
<result column="fence_id" jdbcType="INTEGER" property="fenceId"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, shop_name, shop_code, shop_level, area, province, city, fence_id,
del_flag, created_date, created_by, updated_date, updated_by
</sql>
<select id="search" resultType="cn.com.glsx.admin.modules.model.TrialDriveShopDTO">
select ttds.id shopId,
tu.username shopName,
tu.account shopCode,
ttds.shop_level shopLevel,
ttds.area,
ttds.province,
ttds.city,
tef.analysis_address address,
tef.id fenceId,
tef.fence_name fenceName,
ttds.created_by createdBy
from t_trial_drive_shop ttds
left join t_user tu on tu.id = ttds.created_by
left join t_electric_fence tef on tef.id = ttds.fence_id
where ttds.del_flag = 0
and tef.biz_fence_type = 13
<if test="term != null and term !=''">
and (
shop_name like CONCAT('%',#{term},'%')
or
shop_code like CONCAT('%',#{term},'%')
)
</if>
<if test="area != null and area !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{area})
</if>
<if test="province != null and province !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{province})
</if>
<if test="city != null and city !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{city})
</if>
order by ttds.id desc
</select>
<select id="export" resultType="cn.com.glsx.admin.modules.model.export.TrialDriveShopExport">
select ttds.id shopId,
tu.username shopName,
tu.account shopCode,
ttds.shop_level shopLevel,
ttds.area,
ttds.province,
ttds.city,
tef.analysis_address address,
tef.lnglat,
tef.radius,
tef.fence_name fenceName,
ttds.created_by createdBy
from t_trial_drive_shop ttds
left join t_user tu on tu.id = ttds.created_by
left join t_electric_fence tef on tef.id = ttds.fence_id
where ttds.del_flag = 0
and tef.biz_fence_type = 13
<if test="term != null and term !=''">
and (
ttds.shop_name like CONCAT('%',#{term},'%')
or
ttds.shop_code like CONCAT('%',#{term},'%')
)
</if>
<if test="area != null and area !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{area})
</if>
<if test="province != null and province !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{province})
</if>
<if test="city != null and city !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{city})
</if>
order by ttds.id desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_trial_drive_shop ttds
where ttds.del_flag = 0
and ttds.id = #{id}
</select>
<select id="selectByShopName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_trial_drive_shop ttds
where ttds.del_flag = 0
and ttds.id = #{id}
</select>
<select id="selectBySpecialShopId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_trial_drive_shop ttds
where ttds.del_flag = 0
and ttds.created_by = #{specialShopId}
limit 1
</select>
<update id="logicDeleteById">
update t_trial_drive_shop
set del_flag = -1
where id = #{id}
</update>
</mapper>