11 changed files with 306 additions and 210 deletions
@ -0,0 +1,20 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysuser; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/6/21 8:47 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class UserQuery implements Query { |
||||
|
|
||||
|
private static final long serialVersionUID = -3979717077029562761L; |
||||
|
@ApiModelProperty(value = "角色sid必传项") |
||||
|
private String roleSid; |
||||
|
@ApiModelProperty(value = "用户部门sid路径是必传项") |
||||
|
private String orgSidPath; |
||||
|
} |
@ -1,50 +1,71 @@ |
|||||
<?xml version="1.0" encoding="UTF-8" ?> |
<?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"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.yxt.anrui.portal.biz.sysrole.SysRoleMapper"> |
<mapper namespace="com.yxt.anrui.portal.biz.sysrole.SysRoleMapper"> |
||||
<!-- <where> ${ew.sqlSegment} </where>--> |
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
<!-- ${ew.customSqlSegment} --> |
<!-- ${ew.customSqlSegment} --> |
||||
<select id="selectPageVo" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
<select id="selectPageVo" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
||||
SELECT sr.*,sp.sid as postSid,sp.name as postName FROM sys_role sr |
SELECT sr.*, sp.sid as postSid, sp.name as postName |
||||
LEFT JOIN sys_post sp ON sr.postSid=sp.sid |
FROM sys_role sr |
||||
<where>${ew.sqlSegment} </where> |
LEFT JOIN sys_post sp ON sr.postSid = sp.sid |
||||
ORDER BY sr.sort |
<where> |
||||
</select> |
${ew.sqlSegment} |
||||
|
</where> |
||||
<select id="selectListAllVo" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
ORDER BY sr.sort |
||||
SELECT * FROM sys_role <where> ${ew.sqlSegment} </where> |
</select> |
||||
</select> |
|
||||
<select id="listAllByUserSid" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
|
||||
SELECT role.name,role.sid, ISNULL(userRole.sid) AS checked FROM sys_role role |
|
||||
LEFT JOIN sys_user_role userRole ON role.sid=userRole.`roleSid` |
|
||||
AND userRole.userSid=#{param1} |
|
||||
</select> |
|
||||
|
|
||||
<select id="fetchByUserSid" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
<select id="selectListAllVo" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
||||
SELECT role.name,role.remarks,role.sid FROM sys_role role |
SELECT * |
||||
left join sys_user_role userrole on userrole.roleSid= role.sid |
FROM sys_role |
||||
where userrole.userSid=#{param1} |
<where> |
||||
</select> |
${ew.sqlSegment} |
||||
<select id="fetchByName" resultType="com.yxt.anrui.portal.api.sysrole.SysRole"> |
</where> |
||||
SELECT * FROM sys_role role where role.name=#{param1} |
</select> |
||||
</select> |
<select id="listAllByUserSid" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
||||
<select id="fetchBySid" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
SELECT role.name, role.sid, ISNULL(userRole.sid) AS checked |
||||
SELECT role.*,post.sid as postSid,post.name as postName FROM sys_role role |
FROM sys_role role |
||||
LEFT JOIN sys_post post ON role.postSid=post.sid |
LEFT JOIN sys_user_role userRole ON role.sid = userRole.`roleSid` |
||||
WHERE role.sid=#{param1} |
AND userRole.userSid = #{param1} |
||||
</select> |
</select> |
||||
<delete id="deleteBatchSids" parameterType="String"> |
|
||||
DELETE FROM sys_role WHERE sid IN |
|
||||
<foreach collection="list" item="sid" open="(" separator="," close=")"> |
|
||||
#{sid} |
|
||||
</foreach> |
|
||||
</delete> |
|
||||
<delete id="deleteBySid"> |
|
||||
DELETE FROM sys_role WHERE sid =#{sid} |
|
||||
</delete> |
|
||||
|
|
||||
<update id="updateIsEnable"> |
<select id="fetchByUserSid" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
||||
UPDATE sys_role |
SELECT role.name, role.remarks, role.sid |
||||
SET isEnable = #{isEnable} |
FROM sys_role role |
||||
WHERE sid = #{sid} |
left join sys_user_role userrole on userrole.roleSid = role.sid |
||||
</update> |
where userrole.userSid = #{param1} |
||||
|
</select> |
||||
|
<select id="fetchByName" resultType="com.yxt.anrui.portal.api.sysrole.SysRole"> |
||||
|
SELECT * |
||||
|
FROM sys_role role |
||||
|
where role.name = #{param1} |
||||
|
</select> |
||||
|
<select id="fetchBySid" resultType="com.yxt.anrui.portal.api.sysrole.SysRoleVo"> |
||||
|
SELECT role.*, post.sid as postSid, post.name as postName |
||||
|
FROM sys_role role |
||||
|
LEFT JOIN sys_post post ON role.postSid = post.sid |
||||
|
WHERE role.sid = #{param1} |
||||
|
</select> |
||||
|
<delete id="deleteBatchSids" parameterType="String"> |
||||
|
DELETE |
||||
|
FROM sys_role WHERE sid IN |
||||
|
<foreach collection="list" item="sid" open="(" separator="," close=")"> |
||||
|
#{sid} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
<delete id="deleteBySid"> |
||||
|
DELETE |
||||
|
FROM sys_role |
||||
|
WHERE sid = #{sid} |
||||
|
</delete> |
||||
|
|
||||
|
<update id="updateIsEnable"> |
||||
|
UPDATE sys_role |
||||
|
SET isEnable = #{isEnable} |
||||
|
WHERE sid = #{sid} |
||||
|
</update> |
||||
|
|
||||
|
<select id="getLevelType" resultType="java.lang.String"> |
||||
|
select roleType |
||||
|
from sys_role |
||||
|
where sid = #{roleSid} |
||||
|
</select> |
||||
</mapper> |
</mapper> |
Loading…
Reference in new issue