SysJobfuncSMapper.xml
6.97 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?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.zteits.sys.mapper.smapper.SysJobfuncSMapper">
<resultMap id="BaseResultMap" type="com.zteits.sys.domain.SysJobfunc" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="jobfunc_code" property="jobfuncCode" jdbcType="VARCHAR" />
<result column="jobfunc_name" property="jobfuncName" jdbcType="VARCHAR" />
<result column="jobfunc_desc" property="jobfuncDesc" jdbcType="VARCHAR" />
<result column="sys_code" property="sysCode" jdbcType="VARCHAR" />
<result column="data_state" property="dataState" jdbcType="INTEGER" />
<result column="create_empid" property="createEmpid" jdbcType="VARCHAR" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
<result column="modfiy_empid" property="modfiyEmpid" jdbcType="VARCHAR" />
<result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP" />
<result column="org_id" property="orgId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List" >
id, jobfunc_code, jobfunc_name, jobfunc_desc, sys_code, data_state, create_empid,
create_date, modfiy_empid, modfiy_date, org_id
</sql>
<!-- 通过主键批量删除职能 逻辑删除 -->
<update id="deleteBatchForLogicByPrimaryKey">
update sys_jobfunc set data_state = 0
where id IN
<foreach collection="ids" item="id" separator="," open="(" close=")" index="index">
#{id,jdbcType=BIGINT}
</foreach>
</update>
<!--通过职能ID查询角色信息-->
<select id="queryRolesByJobId" parameterType="com.zteits.clouds.api.dto.sys.param.QueryRolesByJobIdRequest"
resultType="com.zteits.sys.domain.SysRole">
SELECT
b.id as id,
b.role_name as roleName,
b.org_id as orgId
FROM
sys_role_jobfunc a,
sys_role b
WHERE
a.sys_role_id = b.id
AND b.sys_code =#{sysCode}
AND a.sys_jobfunc_id =#{funcJobId}
<choose>
<when test="dataState != null">
and b.data_state = #{dataState,jdbcType=INTEGER}
</when>
<otherwise>
and b.data_state = 1
</otherwise>
</choose>
</select>
<!-- 职能查询 -->
<select id="querySysJobfuncForList" resultMap="BaseResultMap" parameterType="com.zteits.sys.domain.SysJobfunc">
select
<include refid="Base_Column_List"/>
from sys_jobfunc
where 1=1
<if test="jobfuncCode != null and jobfuncCode != ''">
and jobfunc_code = #{jobfuncCode,jdbcType=VARCHAR}
</if>
<if test="jobfuncName != null and jobfuncName != ''">
and jobfunc_name = #{jobfuncName,jdbcType=VARCHAR}
</if>
<if test="sysCode != null">
and sys_code = #{sysCode,jdbcType=VARCHAR}
</if>
<choose>
<when test="dataState != null">
and data_state = #{dataState,jdbcType=INTEGER}
</when>
<otherwise>
and data_state = 1
</otherwise>
</choose>
</select>
<select id="querySysJobfunConditionForList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sys_jobfunc
<where>
1=1
<if test="sysJobfunc.id != null ">
and id = #{sysJobfunc.id}
</if>
<if test="sysJobfunc.jobfuncCode != null and sysJobfunc.jobfuncCode != ''">
and jobfunc_code = #{sysJobfunc.jobfuncCode,jdbcType=VARCHAR}
</if>
<if test="sysJobfunc.jobfuncName != null and sysJobfunc.jobfuncName != ''">
and jobfunc_name LIKE CONCAT('%',#{sysJobfunc.jobfuncName,jdbcType=VARCHAR},'%')
</if>
<if test="sysJobfunc.sysCode != null">
and sys_code = #{sysJobfunc.sysCode,jdbcType=VARCHAR}
</if>
<if test = "startDate !=null ">
AND create_date >= #{startDate,jdbcType=TIMESTAMP}
</if>
<if test = "endDate !=null ">
AND create_date <= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="sysJobfunc.orgId != null">
AND org_id = #{sysJobfunc.orgId,jdbcType=BIGINT}
</if>
</where>
order by id desc
</select>
<insert id="saveSysJobFunc" useGeneratedKeys="true" keyProperty="id" parameterType="com.zteits.sys.domain.SysJobfunc">
insert into sys_jobfunc
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="jobfuncCode != null" >
jobfunc_code,
</if>
<if test="jobfuncName != null" >
jobfunc_name,
</if>
<if test="jobfuncDesc != null" >
jobfunc_desc,
</if>
<if test="sysCode != null" >
sys_code,
</if>
<if test="dataState != null" >
data_state,
</if>
<if test="createEmpid != null" >
create_empid,
</if>
<if test="createDate != null" >
create_date,
</if>
<if test="modfiyEmpid != null" >
modfiy_empid,
</if>
<if test="modfiyDate != null" >
modfiy_date,
</if>
<if test="orgId != null" >
org_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="jobfuncCode != null" >
#{jobfuncCode,jdbcType=VARCHAR},
</if>
<if test="jobfuncName != null" >
#{jobfuncName,jdbcType=VARCHAR},
</if>
<if test="jobfuncDesc != null" >
#{jobfuncDesc,jdbcType=VARCHAR},
</if>
<if test="sysCode != null" >
#{sysCode,jdbcType=VARCHAR},
</if>
<if test="dataState != null" >
#{dataState,jdbcType=INTEGER},
</if>
<if test="createEmpid != null" >
#{createEmpid,jdbcType=VARCHAR},
</if>
<if test="createDate != null" >
#{createDate,jdbcType=TIMESTAMP},
</if>
<if test="modfiyEmpid != null" >
#{modfiyEmpid,jdbcType=VARCHAR},
</if>
<if test="modfiyDate != null" >
#{modfiyDate,jdbcType=TIMESTAMP},
</if>
<if test="orgId != null" >
#{orgId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<!-- 通过角色orgId更新职能orgId -->
<update id="updateJobFunOrgIdByRoleOrgIgs">
update sys_jobfunc set org_id = #{orgId}
where id IN
<foreach collection="ids" item="id" separator="," open="(" close=")" index="index">
#{id,jdbcType=BIGINT}
</foreach>
</update>
</mapper>