TdClSpecialCarSMapper.xml
3.65 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
<?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="com.zteits.bill.mapper.smapper.TdClSpecialCarSMapper">
<resultMap id="BaseResultMap" type="com.zteits.bill.domain.TdClSpecialCar">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="scope_type" jdbcType="CHAR" property="scopeType" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="car_number" jdbcType="VARCHAR" property="carNumber" />
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="data_state" jdbcType="CHAR" property="dataState" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="create_name" jdbcType="VARCHAR" property="createName" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="modfiy_name" jdbcType="VARCHAR" property="modfiyName" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="type" jdbcType="INTEGER" property="type" />
</resultMap>
<sql id="Base_Column_List">
id, scope_type, pl_no, car_number, remarks, data_state, create_date, create_name,
modfiy_date, modfiy_name, org_id, type
</sql>
<select id="querySpecialCar" parameterType="com.zteits.clouds.api.dto.bill.closecarpark.param.QuerySpecialCarRequest"
resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.SpecialCarInfoDTO">
SELECT
c.id,
c.car_number carNumber,
c.data_state dataState,
c.remarks remarks,
c.plNo,
c.type
FROM
(
SELECT
s.id,
s.car_number,
GROUP_CONCAT( s.pl_no SEPARATOR ',' ) plNo,
s.remarks,
s.data_state,
s.type
FROM
td_cl_special_car s
where s.data_state = '1'
and s.org_id = ${orgId}
<if test="carNumber != null and carNumber !=''">
and s.car_number like CONCAT('%',#{carNumber},'%')
</if>
<if test="type != null and type !='' ">
and s.type = #{type,jdbcType=INTEGER}
</if>
<if test="plNo != null and plNo !=''">
and (s.pl_no = #{plNo,jdbcType=VARCHAR} or scope_type = -1 )
</if>
<if test="plNos != null and plNos.size > 0 ">
and s.pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
GROUP BY
s.car_number
) c
</select>
<select id="viewSpecialCar" parameterType="com.zteits.clouds.api.dto.bill.closecarpark.param.ViewSpecialCarRequest"
resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.SpecialCarInfoDTO">
SELECT
c.id,
c.car_number carNumber,
c.data_state dataState,
c.remarks remarks,
c.plNo,
c.type,
c.scope_type scopeType
FROM
(
SELECT
GROUP_CONCAT(s.id) id,
s.car_number,
GROUP_CONCAT( s.pl_no SEPARATOR ',' ) plNo,
s.remarks,
s.data_state,
s.type,
s.scope_type
FROM
td_cl_special_car s
where
s.data_state = '1'
and s.org_id = ${orgId}
<if test="carNumber != null and carNumber !=''">
and s.car_number = #{carNumber}
</if>
GROUP BY
s.car_number
) c
WHERE
c.data_state = '1'
</select>
</mapper>