VehicleDocMapper.xml
3.34 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
<?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.VehicleDocMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.VehicleDoc">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="vehicle_id" jdbcType="INTEGER" property="vehicleId" />
<result column="type" jdbcType="TINYINT" property="docType" />
<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" />
<result column="url" jdbcType="VARCHAR" property="docUrl" />
<result column="name" jdbcType="VARCHAR" property="docName" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, vehicle_id,doc_name, type, del_flag, created_date, created_by, updated_date, updated_by,
doc_url
</sql>
<select id="findByCondition" resultMap="BaseResultMap">
select * from t_vehicle_doc
<where>
<if test="vehicleId !=null and vehicleId != ''">
and vehicle_id=#{vehicleId}
</if>
<if test="docType !=null and docType != ''">
and type=#{docType}
</if>
</where>
</select>
<select id="search" resultType="cn.com.glsx.admin.modules.model.VehicleApproDto">
SELECT
t6.username AS shopName,
t6.account AS shopCode,
t4.shop_level AS shopLevel,
t1.created_by as createdBy,
t1.vin,
t1.inner_color AS innerColor,
t1.color AS color,
t1.model_name AS modelName,
t1.vehicle_type AS vehicleType,
t1.id as vehicleId,
t1.config_desc AS configDesc,
t5.status as status,
(select dict_label from t_dict_data where dict_value=t5.status and dict_type = 'approval_status') AS approvalStatus,
max(t5.created_date) as created_date,
t5.id,
t5.remark as remark
FROM
t_vehicle t1
LEFT JOIN (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) t5 ON (t1.ID = t5.biz_id AND t5.biz_type=2)
LEFT JOIN t_trial_drive_shop t4 ON t1.created_by = t4.created_by
LEFT JOIN t_user t6 ON t6.id = t1.created_by
left join t_electric_fence t7 on t4.fence_id=t7.id
WHERE
t1.del_flag = 0
and t6.username is not null
and t6.del_flag = 0
<if test="search.approvalStatus !=null and search.approvalStatus != ''">
and t5.status=#{search.approvalStatus}
</if>
<if test="search.submitStatus ==1">
and t5.id is not null
</if>
<if test="search.submitStatus ==0">
and t5.id is null
</if>
<if test="search.keywords !=null and search.keywords != ''">
and (t6.username like concat('%',#{search.keywords},'%')
or t6.account like concat('%',#{search.keywords},'%')
or t7.fence_name like concat('%',#{search.keywords},'%')
)
</if>
GROUP BY
t1.id
order by t1.created_date desc
</select>
</mapper>