ApprovalMapper.xml
5.52 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
<?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="deleteById">
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
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 and td.dict_type='approval_bustype'
where app.del_flag = 0 and app.status in (1,2,3)
<if test="approvalSearch.status !=null and approvalSearch.status != ''">
and app.status=#{approvalSearch.status}
</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
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,
t1.inner_color AS innerColor,
t1.color AS color,
t1.model_name AS modelName,
t1.vehicle_type AS vehicleType,
t1.config_desc AS configDesc,
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_dict_data t6 ON t5.biz_type = t6.dict_value
AND t6.dict_type = 'approval_status'
WHERE
t1.del_flag = 0
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 t4.shop_code like concat('%',#{search.keywords},'%')
)
</if>
</select>
<select id="searchFenceApp" resultType="cn.com.glsx.admin.modules.model.FenceApproDto">
select
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,
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 and td.dict_type='approval_status'
where app.del_flag = 0 and app.status in (1,2,3)
AND APP.biz_type=1
<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 t4.shop_code like concat('%',#{search.keywords},'%')
)
</if>
</select>
</mapper>