OrderHeaderMapper.xml
3.47 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
<?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.huaheng.pc.config.order.mapper.OrderHeaderMapper">
<resultMap id="BaseResultMap" type="com.huaheng.pc.config.order.domain.OrderHeader">
<!--@Table order_header-->
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="created" column="created" jdbcType="TIMESTAMP"/>
<result property="createdby" column="createdBy" jdbcType="VARCHAR"/>
<result property="lasted" column="lasted" jdbcType="TIMESTAMP"/>
<result property="lastedby" column="lastedBy" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="BaseResultMap">
select
id, code, name, created, createdBy, lasted, lastedBy
from jxwms.order_header
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="BaseResultMap">
select
id, code, name, created, createdBy, lasted, lastedBy
from jxwms.order_header
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="BaseResultMap">
select
id, code, name, created, createdBy, lasted, lastedBy
from jxwms.order_header
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="code != null and code != ''">
and code = #{code}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="created != null">
and created = #{created}
</if>
<if test="createdby != null and createdby != ''">
and createdBy = #{createdby}
</if>
<if test="lasted != null">
and lasted = #{lasted}
</if>
<if test="lastedby != null and lastedby != ''">
and lastedBy = #{lastedby}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into jxwms.order_header(code, name, created, createdBy, lasted, lastedBy)
values (#{code}, #{name}, #{created}, #{createdby}, #{lasted}, #{lastedby})
</insert>
<!--通过主键修改数据-->
<update id="update">
update jxwms.order_header
<set>
<if test="code != null and code != ''">
code = #{code},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="created != null">
created = #{created},
</if>
<if test="createdby != null and createdby != ''">
createdBy = #{createdby},
</if>
<if test="lasted != null">
lasted = #{lasted},
</if>
<if test="lastedby != null and lastedby != ''">
lastedBy = #{lastedby},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from jxwms.order_header where id = #{id}
</delete>
</mapper>