1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Added search in GroupManagement. Optimized RoleController.

This commit is contained in:
2023-06-02 21:43:31 +08:00
parent 1c55e161c5
commit 51cd40c162
8 changed files with 167 additions and 71 deletions

View File

@@ -2,6 +2,28 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cfive.pinnacle.mapper.permission.GroupMapper">
<select id="filterGroupByRoleId" resultType="long">
select distinct t_group.id as group_id
from (select * from t_group where deleted = 0) as t_group
left join (select * from t_role_group where deleted = 0) as trg on t_group.id = trg.group_id
left join (select * from t_role where deleted = 0) as tr on tr.id = trg.role_id
<where>
<if test="roleId != null">
tr.id = #{roleId}
</if>
<foreach collection="groupList" item="item" index="index" open="and t_group.id in (" separator="," close=")"
nullable="true">
#{item}
</foreach>
<if test="searchName != null and searchName != ''">
and instr(t_group.name, #{searchName}) > 0
</if>
<if test="searchEnable != null and searchEnable != -1">
and t_group.enable = #{searchEnable}
</if>
</where>
</select>
<select id="getAll" resultMap="groupMap">
select distinct t_group.id as group_id,
t_group.name as group_name,
@@ -42,12 +64,15 @@
and t_group.id = #{id}
</select>
<resultMap id="groupMap" type="group">
<resultMap id="groupBase" type="role">
<id property="id" column="group_id"/>
<result property="name" column="group_name"/>
<result property="enable" column="group_enable"/>
<result property="deleted" column="group_deleted"/>
<result property="version" column="group_version"/>
</resultMap>
<resultMap id="groupMap" type="group" extends="groupBase">
<collection property="roles" ofType="role">
<id property="id" column="role_id"/>
<result property="name" column="role_name"/>