ApprovalMapper.xml
6.5 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
<?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.ApprovalMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.Approval">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="biz_id" jdbcType="INTEGER" property="bizId"/>
<result column="biz_type" jdbcType="TINYINT" property="bizType"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="node" jdbcType="INTEGER" property="node"/>
<result column="node_name" jdbcType="VARCHAR" property="nodeName"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<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, biz_id, biz_type, `status`, node, node_name, remark, version, del_flag, created_date,
created_by, updated_date, updated_by, `result`
</sql>
<delete id="logicDeleteById">
update t_approval set del_flag=1 where id=#{id}
</delete>
<select id="findAppByUser" resultMap="BaseResultMap">
select * from t_approval
and created_by in
<foreach collection="userlist" item="userId" index="index" open="(" close=")" separator=",">
#{userId}
</foreach>
</select>
<select id="search" resultType="cn.com.glsx.admin.modules.model.ApprovalDto">
select
app.id as approvalId,
td.dict_label as busType,
tu.username as username,
app.status as status,
app.created_date as createdDate
from t_approval app
left join t_vehicle tvd on app.biz_id = tvd.id and tvd.del_flag = 0
left join t_user tu on app.created_by = tu.id and tu.del_flag = 0
left join t_dict_data td on app.biz_type=td.dict_value
where app.del_flag = 0 and app.status in (1,2,3) and td.dict_type='approval_bustype'
<if test="approvalSearch.status == 1 ">
and app.status=1
</if>
<if test="approvalSearch.status ==2 ">
and app.status in (2,3)
</if>
<if test="approvalSearch.busType !=null and approvalSearch.busType != ''">
and app.biz_type=#{approvalSearch.busType}
</if>
</select>
<select id="searchVehiclelicApp" resultType="cn.com.glsx.admin.modules.model.VehicleApproDto">
SELECT
t5.id as approvalId,
t1.id as vehicleId,
t4.shop_name AS shopName,
t4.shop_code AS shopCode,
t4.shop_level AS shopLevel,
t4.area AS area,
t4.province AS province,
t4.city AS city,
t1.vin,
t4.created_by as createdBy,
t1.inner_color AS innerColor,
t1.color AS color,
t1.model_name AS modelName,
t1.vehicle_type AS vehicleType,
t1.config_desc AS configDesc,
t1.sale_manager as saleManager,
t1.sale_manager_phone as saleManagerPhone,
t1.remark as velRemark,
t6.dict_label AS approvalStatus,
if(t6.dict_label=null,"未提交","已提交") as submitStatus,
t5.remark as remark,
t5.created_date as submitTime
FROM
t_approval t5
LEFT JOIN t_vehicle t1 ON t1.ID = t5.biz_id
LEFT JOIN t_vehicle_device t2 ON t1.id = t2.vehicle_id
LEFT JOIN t_electric_fence_sns t3 ON t2.sn = t3.sn
LEFT JOIN t_trial_drive_shop t4 ON t3.fence_id = t4.fence_id
left join t_electric_fence t7 on t4.fence_id=t7.id
LEFT JOIN t_dict_data t6 ON t5.biz_type = t6.dict_value
WHERE
t1.del_flag = 0
AND t6.dict_type = 'approval_status'
AND t2.bind_status = 1
and t5.status in (1,2,3)
and t5.biz_type=2
GROUP BY
t1.id
<if test="search.approvalStatus !=null and search.approvalStatus != ''">
and t5.status=#{search.status}
</if>
<if test="search.keywords !=null and search.keywords != ''">
and (t4.shop_name like concat('%',#{search.keywords},'%')
or t4.shop_code like concat('%',#{search.keywords},'%')
or t7.fence_name like concat('%',#{search.keywords},'%')
)
</if>
</select>
<select id="searchFenceApp" resultType="cn.com.glsx.admin.modules.model.FenceApproDto">
select
app.id as approvalId,
shop.shop_name AS shopName,
shop.shop_code AS shopCode,
shop.shop_level AS shopLevel,
shop.area AS area,
shop.province AS province,
shop.city AS city,
shop.created_by as createdBy,
app.remark as remark,
tvd.fence_name as fenceName,
tvd.biz_fence_type as fenceType,
td.dict_label as approvalStatus
from t_approval app
left join t_electric_fence tvd on app.biz_id = tvd.id and tvd.del_flag = 0
left join t_trial_drive_shop shop on tvd.id=shop.fence_id
left join t_dict_data td on app.status=td.dict_value
where app.del_flag = 0 and app.status in (1,2,3) and td.dict_type='approval_status'
AND APP.biz_type=1 and shop_name is not null
<if test="search.keywords !=null and search.keywords != ''">
and (t4.shop_name like concat('%',#{search.keywords},'%')
or t4.shop_code like concat('%',#{search.keywords},'%')
or tvd.fence_name like concat('%',#{search.keywords},'%')
)
</if>
</select>
<select id="selectByTypeAndId" resultMap="BaseResultMap"
parameterType="cn.com.glsx.admin.modules.entity.Approval">
select * from t_approval
where
del_flag = 0 and status=1
and biz_type=#{approval.bizType}
and biz_id=#{approval.bizId}
</select>
<select id="selectbyId" resultMap="BaseResultMap"
parameterType="cn.com.glsx.admin.modules.entity.Approval">
select * from t_approval
where
del_flag = 0 and status=1 and id=#{approval.id}
</select>
</mapper>