CompanyMapper.xml
3.8 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
102
103
104
105
<?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.tianbo.warehouse.dao.CompanyMapper" >
<resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.Company" >
<id column="company_id" property="companyId" jdbcType="VARCHAR" />
<result column="company_name" property="companyName" jdbcType="VARCHAR" />
<result column="group_id" property="groupId" jdbcType="VARCHAR" />
<result column="creat_time" property="creatTime" jdbcType="TIMESTAMP" />
<result column="company_status" property="companyStatus" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
company_id, company_name, group_id, creat_time, company_status
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from company
where company_id = #{companyId,jdbcType=VARCHAR}
</select>
<select id="findAll" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from company
<if test="companyName != '' and companyName != null">
where company_name = #{companyName,jdbcType=VARCHAR}
</if>
ORDER BY company_id
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from company
where company_id = #{companyId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.tianbo.warehouse.model.Company" >
insert into company (company_id, company_name, group_id,
creat_time, company_status)
values (#{companyId,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{groupId,jdbcType=VARCHAR},
#{creatTime,jdbcType=TIMESTAMP}, #{companyStatus,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.tianbo.warehouse.model.Company" >
insert into company
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="companyId != null" >
company_id,
</if>
<if test="companyName != null" >
company_name,
</if>
<if test="groupId != null" >
group_id,
</if>
<if test="creatTime != null" >
creat_time,
</if>
<if test="companyStatus != null" >
company_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="companyId != null" >
#{companyId,jdbcType=VARCHAR},
</if>
<if test="companyName != null" >
#{companyName,jdbcType=VARCHAR},
</if>
<if test="groupId != null" >
#{groupId,jdbcType=VARCHAR},
</if>
<if test="creatTime != null" >
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="companyStatus != null" >
#{companyStatus,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.Company" >
update company
<set >
<if test="companyName != null" >
company_name = #{companyName,jdbcType=VARCHAR},
</if>
<if test="groupId != null" >
group_id = #{groupId,jdbcType=VARCHAR},
</if>
<if test="creatTime != null" >
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="companyStatus != null" >
company_status = #{companyStatus,jdbcType=VARCHAR},
</if>
</set>
where company_id = #{companyId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.Company" >
update company
set company_name = #{companyName,jdbcType=VARCHAR},
group_id = #{groupId,jdbcType=VARCHAR},
creat_time = #{creatTime,jdbcType=TIMESTAMP},
company_status = #{companyStatus,jdbcType=VARCHAR}
where company_id = #{companyId,jdbcType=VARCHAR}
</update>
</mapper>