OrgDeptMapper.xml
2.02 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
<?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.lhcredit.project.business.orgDept.mapper.OrgDeptMapper">
<resultMap type="OrgDept" id="OrgDeptResult">
<result property="orgId" column="org_id" />
<result property="deptId" column="dept_id" />
</resultMap>
<sql id="selectOrgDeptVo">
select org_id, dept_id from org_dept
</sql>
<select id="selectOrgDeptList" parameterType="OrgDept" resultMap="OrgDeptResult">
<include refid="selectOrgDeptVo"/>
<where>
<if test="orgId != null "> and org_id = #{orgId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
</where>
</select>
<select id="selectOrgDeptById" parameterType="Long" resultMap="OrgDeptResult">
<include refid="selectOrgDeptVo"/>
where org_id = #{orgId}
</select>
<insert id="insertOrgDept" parameterType="OrgDept">
insert into org_dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orgId != null ">org_id,</if>
<if test="deptId != null ">dept_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orgId != null ">#{orgId},</if>
<if test="deptId != null ">#{deptId},</if>
</trim>
</insert>
<update id="updateOrgDept" parameterType="OrgDept">
update org_dept
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null ">dept_id = #{deptId},</if>
</trim>
where org_id = #{orgId}
</update>
<delete id="deleteOrgDeptById" parameterType="Long">
delete from org_dept where org_id = #{orgId}
</delete>
<delete id="deleteOrgDeptByIds" parameterType="String">
delete from org_dept where org_id in
<foreach item="orgId" collection="array" open="(" separator="," close=")">
#{orgId}
</foreach>
</delete>
</mapper>