新增角色与用户文件关联表增删查改业务类接口
This commit is contained in:
parent
1e1ad28fc1
commit
127ab9eefa
@ -0,0 +1,9 @@
|
|||||||
|
package com.ruoyi.file.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysRoleUserFile {
|
||||||
|
private Long roleId;
|
||||||
|
private String userFileId;
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.ruoyi.file.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.file.domain.SysRoleUserFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色与用户文件关联表 数据层
|
||||||
|
*
|
||||||
|
* @author liangwen
|
||||||
|
*/
|
||||||
|
public interface SysRoleUserFileMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 通过角色ID删除角色和用户文件关联
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRoleUserFileByRoleId(Long roleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除角色用户文件关联信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRoleUserFile(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户文件使用数量
|
||||||
|
*
|
||||||
|
* @param userFileId 用户文件ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectCountRoleUserFileByUserFileId(Long userFileId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增角色用户文件信息
|
||||||
|
*
|
||||||
|
* @param roleUserFileList 角色用户文件列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int batchRoleUserFile(List<SysRoleUserFile> roleUserFileList);
|
||||||
|
|
||||||
|
List<String> selectUserFileIdListByRoleId(Long roleId);
|
||||||
|
|
||||||
|
}
|
||||||
40
hb-file/src/main/resources/mapper/SysRoleUserFileMapper.xml
Normal file
40
hb-file/src/main/resources/mapper/SysRoleUserFileMapper.xml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?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.ruoyi.file.mapper.SysRoleUserFileMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysRoleUserFile" id="SysRoleUserFileResult">
|
||||||
|
<result property="roleId" column="role_id" />
|
||||||
|
<result property="userFileId" column="userFileId" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<delete id="deleteRoleUserFileByRoleId" parameterType="Long">
|
||||||
|
delete from sys_role_userfile where role_id=#{roleId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectCountRoleUserFileByUserFileId" resultType="Integer">
|
||||||
|
select count(1) from sys_role_userfile where userFileId=#{userFileId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteRoleUserFile" parameterType="Long">
|
||||||
|
delete from sys_role_userfile where role_id in
|
||||||
|
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||||
|
#{roleId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="batchRoleUserFile">
|
||||||
|
insert into sys_role_userfile(role_id, userFileId) values
|
||||||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
(#{item.roleId},#{item.userFileId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectUserFileIdListByRoleId" resultType="java.lang.String" parameterType="java.lang.Long">
|
||||||
|
SELECT f.userFileId FROM userfile f
|
||||||
|
LEFT JOIN sys_role_userfile rf ON f.userFileId = rf.userFileId
|
||||||
|
WHERE role_id = #{roleId} AND deleteFlag = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user