VehicleMapper.xml
6.46 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.stdinterface.modules.mapper.VehicleMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.stdinterface.modules.entity.Vehicle">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="workorder_id" jdbcType="INTEGER" property="workOrderId"/>
<result column="owner_name" jdbcType="VARCHAR" property="ownerName"/>
<result column="vin" jdbcType="VARCHAR" property="vin"/>
<result column="owner_sex" jdbcType="VARCHAR" property="ownerSex"/>
<result column="owner_tel" jdbcType="VARCHAR" property="ownerTel"/>
<result column="brand_id" jdbcType="INTEGER" property="brandId"/>
<result column="brand_name" jdbcType="VARCHAR" property="brandName"/>
<result column="sub_brand_id" jdbcType="INTEGER" property="subBrandId"/>
<result column="sub_brand_name" jdbcType="VARCHAR" property="subBrandName"/>
<result column="series_id" jdbcType="INTEGER" property="seriesId"/>
<result column="series_name" jdbcType="VARCHAR" property="seriesName"/>
<result column="type_id" jdbcType="INTEGER" property="typeId"/>
<result column="type_name" jdbcType="VARCHAR" property="typeName"/>
<result column="model_id" jdbcType="INTEGER" property="modelId"/>
<result column="model_name" jdbcType="VARCHAR" property="modelName"/>
<result column="config_id" jdbcType="INTEGER" property="configId"/>
<result column="config_desc" jdbcType="VARCHAR" property="configDesc"/>
<result column="color" jdbcType="VARCHAR" property="color"/>
<result column="inner_color" jdbcType="VARCHAR" property="innerColor"/>
<result column="license_plate" jdbcType="VARCHAR" property="licensePlate"/>
<result column="vehicle_type" jdbcType="TINYINT" property="vehicleType"/>
<result column="engine" jdbcType="VARCHAR" property="engine"/>
<result column="displacement" jdbcType="VARCHAR" property="displacement"/>
<result column="mileage" jdbcType="VARCHAR" property="mileage"/>
<result column="buy_type" jdbcType="INTEGER" property="buyType"/>
<result column="buy_date" jdbcType="DATE" property="buyDate"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="serve_type" jdbcType="TINYINT" property="serveType"/>
<result column="sale_manager" jdbcType="VARCHAR" property="saleManager"/>
<result column="sale_manager_phone" jdbcType="VARCHAR" property="saleManagerPhone"/>
<result column="validate_status" jdbcType="TINYINT" property="validateStatus"/>
<result column="vehicle_usages" jdbcType="TINYINT" property="vehicleUsages"/>
<result column="validate_info" jdbcType="VARCHAR" property="validateInfo"/>
<result column="ref_vehicle_id" jdbcType="INTEGER" property="refVehicleId"/>
<result column="ref_order_id" jdbcType="INTEGER" property="refOrderId"/>
<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="registration_date" jdbcType="TIMESTAMP" property="registrationDate"/>
<result column="sale_manager" jdbcType="VARCHAR" property="saleManager"/>
<result column="sale_manager_phone" jdbcType="VARCHAR" property="saleManagerPhone"/>
<result column="buy_type" jdbcType="DATE" property="buyType"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, workorder_id, owner_name, vin, owner_sex, owner_tel, brand_id, brand_name, sub_brand_id,
sub_brand_name, series_id, series_name, type_id, type_name, model_id, model_name,
config_id, config_desc, color, inner_color, license_plate, vehicle_type, engine,
displacement, mileage, buy_type, buy_date, description, remark, serve_type, sale_manager,
sale_manager_phone, validate_status, vehicle_usages, validate_info, del_flag, created_date,
created_by, updated_date, updated_by, registration_date, ref_vehicle_id, ref_order_id
</sql>
<select id="selectByWorkOrderId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle
where del_flag = 0
and workorder_id = #{workOrderId}
</select>
<select id="selectAllByNotNullRefVehicleId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle
where del_flag = 0
and ref_vehicle_id is not null
</select>
<select id="selectByRefWorkOrderId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle
where del_flag = 0
and ref_order_id = #{refOrderId}
limit 1
</select>
<select id="selectByRefVehicleId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle
where del_flag = 0
and ref_vehicle_id = #{refVehicleId}
limit 1
</select>
<select id="selectByNullCreateBy" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle
where del_flag = 0
and ref_vehicle_id is not null
and created_by is null
</select>
<update id="updateCreateByByRefVehicleIds">
update t_vehicle
set created_by = #{userId}
where ref_vehicle_id is not null
and ref_vehicle_id in
<foreach collection="refVehicleIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
<select id="getVehicleBySn" resultMap="BaseResultMap">
select
tv.id,
tv.vin,
tv.created_by,
tv.created_date
from t_vehicle tv
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id
where tvd.sn = #{sn}
and tvd.del_flag = 0 and tv.del_flag = 0
and tvd.bind_status = 1;
</select>
</mapper>