DepartmentMapper.xml
3.6 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
<?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.DepartmentMapper" >
<resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.Department" >
<id column="department_id" property="departmentId" jdbcType="VARCHAR" />
<result column="department_name" property="departmentName" jdbcType="VARCHAR" />
<result column="creat_time" property="creatTime" jdbcType="DATE" />
<result column="company_id" property="companyId" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
department_id, department_name, creat_time, company_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from department
where department_id = #{departmentId,jdbcType=VARCHAR}
</select>
<select id="findAll" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from department
<if test="departmentName != '' and departmentName != null" >
where department_name = #{departmentName, jdbcType=VARCHAR}
</if>
ORDER BY department_id
</select>
<select id="count" parameterType="string" resultType="int">
select count(*) from department where department_id = #{value}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from department
where department_id = #{departmentId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.tianbo.warehouse.model.Department" >
insert into department (department_id, department_name, creat_time,
company_id)
values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{creatTime,jdbcType=DATE},
#{companyId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.tianbo.warehouse.model.Department" >
insert into department
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="departmentId != null" >
department_id,
</if>
<if test="departmentName != null" >
department_name,
</if>
<if test="creatTime != null" >
creat_time,
</if>
<if test="companyId != null" >
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="departmentId != null" >
#{departmentId,jdbcType=VARCHAR},
</if>
<if test="departmentName != null" >
#{departmentName,jdbcType=VARCHAR},
</if>
<if test="creatTime != null" >
#{creatTime,jdbcType=DATE},
</if>
<if test="companyId != null" >
#{companyId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.Department" >
update department
<set >
<if test="departmentName != null" >
department_name = #{departmentName,jdbcType=VARCHAR},
</if>
<if test="creatTime != null" >
creat_time = #{creatTime,jdbcType=DATE},
</if>
<if test="companyId != null" >
company_id = #{companyId,jdbcType=VARCHAR},
</if>
</set>
where department_id = #{departmentId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.Department" >
update department
set department_name = #{departmentName,jdbcType=VARCHAR},
creat_time = #{creatTime,jdbcType=DATE},
company_id = #{companyId,jdbcType=VARCHAR}
where department_id = #{departmentId,jdbcType=VARCHAR}
</update>
</mapper>