WorkOrderMapper.xml
7 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
<?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.WorkOrderMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.WorkOrder">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
<result column="partner_order_no" jdbcType="VARCHAR" property="partnerOrderNo"/>
<result column="order_source" jdbcType="VARCHAR" property="orderSource"/>
<result column="ref_order_id" jdbcType="INTEGER" property="refOrderId"/>
<result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
<result column="shop_contactor" jdbcType="VARCHAR" property="shopContactor"/>
<result column="shop_telephone" jdbcType="VARCHAR" property="shopTelephone"/>
<result column="service_type" jdbcType="VARCHAR" property="serviceType"/>
<result column="service_time" jdbcType="TIMESTAMP" property="serviceTime"/>
<result column="service_apm" jdbcType="VARCHAR" property="serviceApm"/>
<result column="service_period" jdbcType="TINYINT" property="servicePeriod"/>
<result column="service_expire_time" jdbcType="TIMESTAMP" property="serviceExpireTime"/>
<result column="service_address" jdbcType="VARCHAR" property="serviceAddress"/>
<result column="service_linker" jdbcType="VARCHAR" property="serviceLinker"/>
<result column="service_linker_phone" jdbcType="VARCHAR" property="serviceLinkerPhone"/>
<result column="service_explain" jdbcType="VARCHAR" property="serviceExplain"/>
<result column="need_install" jdbcType="VARCHAR" property="needInstall"/>
<result column="need_insure" jdbcType="VARCHAR" property="needInsure"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="service_provider" jdbcType="VARCHAR" property="serviceProvider"/>
<result column="service_provider_phone" jdbcType="VARCHAR" property="serviceProviderPhone"/>
<result column="mechanic_name" jdbcType="VARCHAR" property="mechanicName"/>
<result column="mechanic_phone" jdbcType="VARCHAR" property="mechanicPhone"/>
<result column="finished_remark" jdbcType="VARCHAR" property="finishedRemark"/>
<result column="notify_target" jdbcType="VARCHAR" property="notifyTarget"/>
<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, order_no, partner_order_no, order_source, ref_order_id, shop_name,
shop_contactor, shop_telephone, service_type, service_time, service_apm, service_period, service_expire_time,
service_address, service_linker, service_linker_phone, service_explain, need_install, need_insure,
remark, `status`, service_provider, service_provider_phone, mechanic_name, mechanic_phone,
finished_remark, notify_target, del_flag, created_date, created_by, updated_date, updated_by
</sql>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_workorder
where del_flag = 0
and id = #{id}
</select>
<select id="selectByOrderNo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_workorder
where del_flag = 0
and order_no = #{orderNo}
</select>
<select id="selectByPartnerOrderNo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_workorder
where del_flag = 0
and partner_order_no = #{partnerOrderNo}
</select>
<select id="search" resultType="cn.com.glsx.admin.modules.model.WorkOrderDTO">
select tw.id,
tw.order_no orderNo,
tw.partner_order_no bizOrderNo,
tw.service_type serviceType,
concat(DATE_FORMAT(tw.service_time, '%Y-%m-%d'), '/', ifnull(tw.service_apm, '')) serviceTime,
twv.lessee_name ownerName,
twv.vin,
twv.device_compose deviceCompose,
tt.tenant_name tenantName,
tw.status,
tw.service_provider serviceProvider,
tw.mechanic_name mechanicName,
tu.username createdBy,
tw.created_date createdDate
from t_workorder tw
left join t_workorder_vehicle twv on twv.workorder_id = tw.id
left join t_user tu on tu.id = tw.created_by
left join t_tenant tt on tt.id = tu.tenant_id
where tw.del_flag = 0
order by tw.created_date desc
</select>
<select id="export" resultType="cn.com.glsx.admin.modules.model.export.WorkOrderExport">
select tw.id,
tw.order_no orderNo,
tw.partner_order_no bizOrderNo,
tw.service_type serviceType,
tw.service_time serviceTime,
tw.service_apm serviceApm,
twv.lessee_name ownerName,
twv.vin,
twv.device_compose deviceCompose,
tt.tenant_name tenantName,
tw.status,
tw.service_provider serviceProvider,
tw.mechanic_name mechanicName,
tu.username createdBy,
tw.created_date createdDate
from t_workorder tw
left join t_workorder_vehicle twv on twv.workorder_id = tw.id
left join t_user tu on tu.id = tw.created_by
left join t_tenant tt on tt.id = tu.tenant_id
where tw.del_flag = 0
order by tw.created_date desc
</select>
<update id="logicDeleteById">
update t_workorder
set del_flag = -1
where id = #{id}
</update>
</mapper>