yaowanxin
昨天 4c001e8b7efc1383d1cdfc8219538eeaec49c51b
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="inventory.mapper.StockManagementMapper">
 
    <resultMap id="BaseResultMap" type="inventory.domain.StockManagement">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="productId" column="product_id" jdbcType="INTEGER"/>
            <result property="stockQuantity" column="stock_quantity" jdbcType="INTEGER"/>
            <result property="taxInclusivePrice" column="tax_inclusive_price" jdbcType="DECIMAL"/>
            <result property="taxInclusiveTotal" column="tax_inclusive_total" jdbcType="DECIMAL"/>
            <result property="taxRate" column="tax_rate" jdbcType="DECIMAL"/>
            <result property="taxExclusiveTotal" column="tax_exclusive_total" jdbcType="DECIMAL"/>
            <result property="inboundPerson" column="inbound_person" jdbcType="VARCHAR"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        id,product_id,stock_quantity,
        tax_inclusive_price,tax_inclusive_total,tax_rate,
        tax_exclusive_total,inbound_person
    </sql>
 
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from stock_management
        where  id = #{id,jdbcType=INTEGER} 
    </select>
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from stock_management
        where  id = #{id,jdbcType=INTEGER} 
    </delete>
    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="inventory.domain.StockManagement" useGeneratedKeys="true">
        insert into stock_management
        ( id,product_id,stock_quantity
        ,tax_inclusive_price,tax_inclusive_total,tax_rate
        ,tax_exclusive_total,inbound_person)
        values (#{id,jdbcType=INTEGER},#{productId,jdbcType=INTEGER},#{stockQuantity,jdbcType=INTEGER}
        ,#{taxInclusivePrice,jdbcType=DECIMAL},#{taxInclusiveTotal,jdbcType=DECIMAL},#{taxRate,jdbcType=DECIMAL}
        ,#{taxExclusiveTotal,jdbcType=DECIMAL},#{inboundPerson,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="inventory.domain.StockManagement" useGeneratedKeys="true">
        insert into stock_management
        <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="id != null">id,</if>
                <if test="productId != null">product_id,</if>
                <if test="stockQuantity != null">stock_quantity,</if>
                <if test="taxInclusivePrice != null">tax_inclusive_price,</if>
                <if test="taxInclusiveTotal != null">tax_inclusive_total,</if>
                <if test="taxRate != null">tax_rate,</if>
                <if test="taxExclusiveTotal != null">tax_exclusive_total,</if>
                <if test="inboundPerson != null">inbound_person,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                <if test="id != null">#{id,jdbcType=INTEGER},</if>
                <if test="productId != null">#{productId,jdbcType=INTEGER},</if>
                <if test="stockQuantity != null">#{stockQuantity,jdbcType=INTEGER},</if>
                <if test="taxInclusivePrice != null">#{taxInclusivePrice,jdbcType=DECIMAL},</if>
                <if test="taxInclusiveTotal != null">#{taxInclusiveTotal,jdbcType=DECIMAL},</if>
                <if test="taxRate != null">#{taxRate,jdbcType=DECIMAL},</if>
                <if test="taxExclusiveTotal != null">#{taxExclusiveTotal,jdbcType=DECIMAL},</if>
                <if test="inboundPerson != null">#{inboundPerson,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="inventory.domain.StockManagement">
        update stock_management
        <set>
                <if test="productId != null">
                    product_id = #{productId,jdbcType=INTEGER},
                </if>
                <if test="stockQuantity != null">
                    stock_quantity = #{stockQuantity,jdbcType=INTEGER},
                </if>
                <if test="taxInclusivePrice != null">
                    tax_inclusive_price = #{taxInclusivePrice,jdbcType=DECIMAL},
                </if>
                <if test="taxInclusiveTotal != null">
                    tax_inclusive_total = #{taxInclusiveTotal,jdbcType=DECIMAL},
                </if>
                <if test="taxRate != null">
                    tax_rate = #{taxRate,jdbcType=DECIMAL},
                </if>
                <if test="taxExclusiveTotal != null">
                    tax_exclusive_total = #{taxExclusiveTotal,jdbcType=DECIMAL},
                </if>
                <if test="inboundPerson != null">
                    inbound_person = #{inboundPerson,jdbcType=VARCHAR},
                </if>
        </set>
        where   id = #{id,jdbcType=INTEGER} 
    </update>
    <update id="updateByPrimaryKey" parameterType="inventory.domain.StockManagement">
        update stock_management
        set 
            product_id =  #{productId,jdbcType=INTEGER},
            stock_quantity =  #{stockQuantity,jdbcType=INTEGER},
            tax_inclusive_price =  #{taxInclusivePrice,jdbcType=DECIMAL},
            tax_inclusive_total =  #{taxInclusiveTotal,jdbcType=DECIMAL},
            tax_rate =  #{taxRate,jdbcType=DECIMAL},
            tax_exclusive_total =  #{taxExclusiveTotal,jdbcType=DECIMAL},
            inbound_person =  #{inboundPerson,jdbcType=VARCHAR}
        where   id = #{id,jdbcType=INTEGER} 
    </update>
</mapper>