73 lines
2.3 KiB
XML
73 lines
2.3 KiB
XML
<?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.bonus.gzrn.rnbmw.manager.dao.RoleDao">
|
|
|
|
<sql id="where">
|
|
<where>
|
|
t.IS_ACTIVE = '1'
|
|
<if test="params.keyWord != null and params.keyWord != ''">
|
|
and (
|
|
t.name like concat('%', #{params.keyWord}, '%') or
|
|
pc.org_name like concat('%', #{params.keyWord}, '%') or
|
|
t.description like concat('%', #{params.keyWord}, '%')
|
|
)
|
|
</if>
|
|
<if test="params.companyId != null and params.companyId !='' ">
|
|
and t.company_id = #{params.companyId}
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="count" resultType="int">
|
|
select count(1) from sys_role t
|
|
left join pm_company pc on t.company_id = pc.ID
|
|
<include refid="where" />
|
|
</select>
|
|
|
|
<select id="list" resultType="com.bonus.gzrn.rnbmw.manager.model.Role">
|
|
select t.ID ,
|
|
t.name as name,
|
|
pc.org_name as companyName,
|
|
t.description ,
|
|
t.createTime ,
|
|
t.updateTime,
|
|
CONCAT(case when t.TYPE like '%1%' then '大屏 ' else '' end,case when t.TYPE like '%2%' then ' 后台' else '' end,case when t.TYPE like '%3%' then ' 施工' else '' end,case when t.TYPE like '%4%' then '监督' else '' end) as type,
|
|
if(t.`status`="1","已启用","未启用") as status
|
|
from sys_role t
|
|
left join pm_company pc on t.company_id = pc.ID
|
|
|
|
<include refid="where" />
|
|
${params.orderBy}
|
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
|
limit #{offset}, #{limit}
|
|
</if>
|
|
|
|
</select>
|
|
<select id="getById" resultType="com.bonus.gzrn.rnbmw.manager.model.Role">
|
|
select t.id ,
|
|
t.name as name,
|
|
pc.ID as companyId,
|
|
pc.org_name as companyName,
|
|
t.description ,
|
|
t.createTime ,
|
|
t.updateTime,
|
|
t.TYPE,
|
|
t.`status`
|
|
from sys_role t
|
|
left join pm_company pc on t.company_id = pc.ID
|
|
where t.id = #{id};
|
|
</select>
|
|
|
|
<insert id="saveRolePermission">
|
|
insert into sys_role_permission(roleId, permissionId) values
|
|
<foreach collection="permissionIds" item="permissionId"
|
|
separator=",">
|
|
<if test="permissionId != '121' and permissionId != '122' and permissionId != '140' and permissionId != '142' and permissionId != '143' and permissionId != '144' and permissionId != '145'">
|
|
(#{roleId}, #{permissionId})
|
|
</if>
|
|
|
|
</foreach>
|
|
</insert>
|
|
|
|
</mapper> |