|
@@ -0,0 +1,126 @@
|
|
1
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
3
|
+<mapper namespace="com.th.demo.mapping.maint.CargoMapper" >
|
|
4
|
+ <resultMap id="BaseResultMap" type="com.th.demo.model.maint.Cargo" >
|
|
5
|
+ <id column="id" property="id" jdbcType="VARCHAR" />
|
|
6
|
+ <result column="sum_weight" property="sumWeight" jdbcType="DOUBLE" />
|
|
7
|
+
|
|
8
|
+ <association column="uper_customer_id" property="uperCustomer" select="com.th.demo.mapping.maint.CustomerMapper.selectByPrimaryKey" />
|
|
9
|
+ <association column="customer_id" property="Customer" select="com.th.demo.mapping.maint.CustomerMapper.selectByPrimaryKey" />
|
|
10
|
+ </resultMap>
|
|
11
|
+
|
|
12
|
+ <sql id="Base_Column_List" >
|
|
13
|
+ id, ware_id, name, code, add_id, add_time, modify_id, modify_time, cancel_id, cancel_time,
|
|
14
|
+ cancel_flag, belong_id
|
|
15
|
+ </sql>
|
|
16
|
+
|
|
17
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
|
18
|
+ select
|
|
19
|
+ <include refid="Base_Column_List" />
|
|
20
|
+ from t_maint_area
|
|
21
|
+ where id = #{param1,jdbcType=VARCHAR}
|
|
22
|
+ </select>
|
|
23
|
+
|
|
24
|
+ <select id="selectByWareId" resultMap="BaseResultMap" >
|
|
25
|
+ select t.*
|
|
26
|
+ from t_maint_area t
|
|
27
|
+ where t.ware_id = #{param1,jdbcType=VARCHAR}
|
|
28
|
+ and t.belong_id = #{param2,jdbcType=VARCHAR}
|
|
29
|
+ and ifnull(t.cancel_flag,'0') = '0'
|
|
30
|
+ order by t.code
|
|
31
|
+ </select>
|
|
32
|
+
|
|
33
|
+ <update id="updateByPrimaryKey" parameterType="com.th.demo.model.maint.Cargo" >
|
|
34
|
+ update t_maint_area
|
|
35
|
+ set ware_id = #{ware.id,jdbcType=VARCHAR},
|
|
36
|
+ name = #{name,jdbcType=VARCHAR},
|
|
37
|
+ code = #{code,jdbcType=VARCHAR},
|
|
38
|
+ add_id = #{addId,jdbcType=VARCHAR},
|
|
39
|
+ add_time = #{addTime,jdbcType=TIMESTAMP},
|
|
40
|
+ modify_id = #{modifyId,jdbcType=VARCHAR},
|
|
41
|
+ modify_time = #{modifyTime,jdbcType=TIMESTAMP},
|
|
42
|
+ cancel_id = #{cancelId,jdbcType=VARCHAR},
|
|
43
|
+ cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
|
|
44
|
+ cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
|
|
45
|
+ belong_id = #{belongId,jdbcType=VARCHAR}
|
|
46
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
47
|
+ </update>
|
|
48
|
+
|
|
49
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
|
|
50
|
+ delete from t_maint_area
|
|
51
|
+ where id = #{param1,jdbcType=VARCHAR}
|
|
52
|
+ </delete>
|
|
53
|
+
|
|
54
|
+ <insert id="insert" parameterType="com.th.demo.model.maint.Cargo" >
|
|
55
|
+ <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
|
|
56
|
+ SELECT REPLACE(UUID(),'-','') as id from dual
|
|
57
|
+ </selectKey>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+ insert into t_maint_area (id, ware_id, name,
|
|
61
|
+ code, add_id, add_time,
|
|
62
|
+ modify_id, modify_time, cancel_id,
|
|
63
|
+ cancel_time, cancel_flag, belong_id)
|
|
64
|
+ values (#{id,jdbcType=VARCHAR}, #{ware.id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
|
65
|
+ #{code,jdbcType=VARCHAR}, #{addId,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP},
|
|
66
|
+ #{modifyId,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, #{cancelId,jdbcType=VARCHAR},
|
|
67
|
+ #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR}, #{belongId,jdbcType=VARCHAR})
|
|
68
|
+ </insert>
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.th.demo.model.maint.Cargo" >
|
|
72
|
+ update t_maint_stack
|
|
73
|
+ <set >
|
|
74
|
+ <if test="wareId != null" >
|
|
75
|
+ ware_id = #{wareId,jdbcType=VARCHAR},
|
|
76
|
+ </if>
|
|
77
|
+ <if test="name != null" >
|
|
78
|
+ name = #{name,jdbcType=VARCHAR},
|
|
79
|
+ </if>
|
|
80
|
+ <if test="code != null" >
|
|
81
|
+ code = #{code,jdbcType=VARCHAR},
|
|
82
|
+ </if>
|
|
83
|
+ <if test="addId != null" >
|
|
84
|
+ add_id = #{addId,jdbcType=VARCHAR},
|
|
85
|
+ </if>
|
|
86
|
+ <if test="addTime != null" >
|
|
87
|
+ add_time = #{addTime,jdbcType=TIMESTAMP},
|
|
88
|
+ </if>
|
|
89
|
+ <if test="modifyId != null" >
|
|
90
|
+ modify_id = #{modifyId,jdbcType=VARCHAR},
|
|
91
|
+ </if>
|
|
92
|
+ <if test="modifyTime != null" >
|
|
93
|
+ modify_time = #{modifyTime,jdbcType=TIMESTAMP},
|
|
94
|
+ </if>
|
|
95
|
+ <if test="cancelId != null" >
|
|
96
|
+ cancel_id = #{cancelId,jdbcType=VARCHAR},
|
|
97
|
+ </if>
|
|
98
|
+ <if test="cancelTime != null" >
|
|
99
|
+ cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
|
|
100
|
+ </if>
|
|
101
|
+ <if test="cancelFlag != null" >
|
|
102
|
+ cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
|
|
103
|
+ </if>
|
|
104
|
+ <if test="belongId != null" >
|
|
105
|
+ belong_id = #{belongId,jdbcType=VARCHAR},
|
|
106
|
+ </if>
|
|
107
|
+ </set>
|
|
108
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
109
|
+ </update>
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+ <select id="selectByWareNameStackName" resultMap="BaseResultMap" >
|
|
114
|
+ select t.*
|
|
115
|
+ from t_maint_stack t ,t_maint_ware d
|
|
116
|
+ where t.ware_id = d.id
|
|
117
|
+ and d.id in (
|
|
118
|
+ select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
|
|
119
|
+ ) and d.name = #{param1,jdbcType=VARCHAR}
|
|
120
|
+ and t.name = #{param2,jdbcType=VARCHAR}
|
|
121
|
+ and t.belong_id = #{param4,jdbcType=VARCHAR}
|
|
122
|
+ and ifnull(t.cancel_flag,'0') = '0'
|
|
123
|
+ order by t.code
|
|
124
|
+ </select>
|
|
125
|
+
|
|
126
|
+</mapper>
|