GarOrderCarMapper.xml
3.85 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
<?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.trash.garbage.mapper.GarOrderCarMapper">
<resultMap id="BaseResultMap" type="com.trash.garbage.pojo.domain.GarOrderCar">
<id property="garId" column="gar_id" jdbcType="VARCHAR"/>
<result property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/>
<result property="garOrderCarType" column="gar_order_car_type" jdbcType="VARCHAR"/>
<result property="garOrderCarUserType" column="gar_order_car_user_type" jdbcType="TINYINT"/>
<result property="garCreateTime" column="gar_create_time" jdbcType="TIMESTAMP"/>
<result property="garUpdateTime" column="gar_update_time" jdbcType="TIMESTAMP"/>
<result property="garCreateBy" column="gar_create_by" jdbcType="VARCHAR"/>
<result property="garUpdateBy" column="gar_update_by" jdbcType="VARCHAR"/>
<result property="garRemark" column="gar_remark" jdbcType="VARCHAR"/>
<result property="carId" column="car_id" jdbcType="VARCHAR"/>
<result property="containerVolume" column="container_volume" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
gar_id,gar_order_id,gar_order_car_type,
gar_order_car_user_type,gar_create_time,gar_update_time,
gar_create_by,gar_update_by,gar_remark
</sql>
<select id="selectByGarOrderId" parameterType="string" resultMap="BaseResultMap">
SELECT gar_id,gar_order_id,gar_order_car_type,
gar_order_car_user_type,gar_create_time,gar_update_time,
gar_create_by,gar_update_by,gar_remark,car_id,container_volume
FROM gar_order_car
WHERE gar_order_id = #{garOrderId}
LIMIT 1
</select>
<insert id="insertSelective" parameterType="com.trash.garbage.pojo.domain.GarOrderCar">
INSERT INTO gar_order_car
<trim prefix="(" suffix=")" suffixOverrides=",">
gar_id,
gar_order_id,
gar_order_car_type,
gar_order_car_user_type,
gar_create_time,
gar_update_time,
gar_create_by,
gar_update_by,
gar_remark,
car_id,
container_volume
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{garId},
#{garOrderId},
#{garOrderCarType},
#{garOrderCarUserType},
#{garCreateTime},
#{garUpdateTime},
#{garCreateBy},
#{garUpdateBy},
#{garRemark},
#{carId},
#{containerVolume}
</trim>
</insert>
<insert id="insertRandomCopyByTypeAndOrderId">
INSERT INTO gar_order_car (
gar_id,
gar_order_id,
gar_order_car_type,
gar_order_car_user_type,
gar_remark,
car_id,
gar_create_by,
gar_update_by,
gar_create_time,
gar_update_time,
container_volume
)
SELECT
REPLACE(UUID(), '-', ''),
#{garOrderId},
#{garOrderCarType},
gar_order_car_user_type,
gar_remark,
car_id,
gar_create_by,
gar_update_by,
NOW(),
NOW(),
container_volume
FROM gar_order_car
WHERE gar_order_id = #{garOrderId}
AND gar_order_car_type = #{garOrderCarType}
ORDER BY RAND()
LIMIT 1
</insert>
<select id="selectGarOrderCar" resultType="com.trash.garbage.pojo.domain.GarOrderCar">
select gar_order_car_type, count(*) as count from gar_order_car where gar_order_id = #{garOrderNo} group by gar_order_car_type
</select>
</mapper>