Przeglądaj źródła

增加货权管理后台和数据库

YL2767 2 miesięcy temu
rodzic
commit
e1abb70a39

+ 17
- 0
src/main/java/com/th/demo/mapping/maint/CargoMapper.java Wyświetl plik

@@ -0,0 +1,17 @@
1
+package com.th.demo.mapping.maint;
2
+
3
+import com.th.demo.model.maint.Cargo;
4
+
5
+import java.util.List;
6
+
7
+public interface CargoMapper {
8
+    Cargo selectByPrimaryKey(String id);
9
+
10
+    List<Cargo> selectByWareId(String wareId, String belongId);
11
+
12
+    int updateByPrimaryKey(Cargo cargo);
13
+
14
+    int deleteByPrimaryKey(String id);
15
+
16
+    int insert(Cargo cargo);
17
+}

+ 41
- 0
src/main/java/com/th/demo/model/maint/Cargo.java Wyświetl plik

@@ -0,0 +1,41 @@
1
+package com.th.demo.model.maint;
2
+
3
+public class Cargo {
4
+    private String id;
5
+
6
+    private Customer uperCustomer;
7
+    private Customer Customer;
8
+    private double sumWeight;
9
+
10
+    public String getId() {
11
+        return id;
12
+    }
13
+
14
+    public void setId(String id) {
15
+        this.id = id;
16
+    }
17
+
18
+    public com.th.demo.model.maint.Customer getUperCustomer() {
19
+        return uperCustomer;
20
+    }
21
+
22
+    public void setUperCustomer(com.th.demo.model.maint.Customer uperCustomer) {
23
+        this.uperCustomer = uperCustomer;
24
+    }
25
+
26
+    public com.th.demo.model.maint.Customer getCustomer() {
27
+        return Customer;
28
+    }
29
+
30
+    public void setCustomer(com.th.demo.model.maint.Customer customer) {
31
+        Customer = customer;
32
+    }
33
+
34
+    public double getSumWeight() {
35
+        return sumWeight;
36
+    }
37
+
38
+    public void setSumWeight(double sumWeight) {
39
+        this.sumWeight = sumWeight;
40
+    }
41
+}

+ 126
- 0
src/main/resource/mapper/maint/CargoMapper.xml Wyświetl plik

@@ -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>

Ładowanie…
Anuluj
Zapisz