用户管理接口
This commit is contained in:
parent
ab19206c29
commit
be2e373919
|
@ -12,7 +12,8 @@ public class GlobalExceptionHandler {
|
|||
// 全局异常处理
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseBody
|
||||
public Result error() {
|
||||
public Result error(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return Result.build(null, ResultCodeEnum.SYSTEM_ERROR);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package cn.bunny;
|
||||
|
||||
import cn.bunny.properties.MinioProperties;
|
||||
import cn.bunny.properties.UserProperties;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties(value = {UserProperties.class})
|
||||
@EnableConfigurationProperties(value = {UserProperties.class, MinioProperties.class})
|
||||
// @ComponentScan(basePackages = "cn.bunny")
|
||||
public class MangerApplication {
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package cn.bunny.controller;
|
||||
|
||||
|
||||
import cn.bunny.common.spzx.model.vo.common.Result;
|
||||
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
|
||||
import cn.bunny.common.spzx.model.vo.file.UploadFileVo;
|
||||
import cn.bunny.service.FIleUploadService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
@Tag(name = "上传文件")
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("admin/system")
|
||||
public class FileUploadController {
|
||||
|
||||
@Autowired
|
||||
private FIleUploadService fIleUploadService;
|
||||
|
||||
@Operation(summary = "上传文件", description = "上传文件返回路径名称")
|
||||
@PostMapping("fileUpload")
|
||||
public Result fileUpload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
log.info("post 文件上传 --- " + file.getOriginalFilename());
|
||||
|
||||
String fileUrl = fIleUploadService.uploadFile(file);
|
||||
|
||||
UploadFileVo uploadFileVo = new UploadFileVo();
|
||||
uploadFileVo.setFilename(file.getOriginalFilename());
|
||||
uploadFileVo.setFilesize(file.getSize());
|
||||
uploadFileVo.setFilepath(fileUrl);
|
||||
|
||||
return Result.build(uploadFileVo, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package cn.bunny.controller;
|
||||
|
||||
import cn.bunny.common.spzx.model.entity.system.SysMenu;
|
||||
import cn.bunny.common.spzx.model.vo.common.Result;
|
||||
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
|
||||
import cn.bunny.service.SysMenuService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/system.sysMenu")
|
||||
public class SysMenuController {
|
||||
@Autowired
|
||||
private SysMenuService sysMenuService;
|
||||
|
||||
@Operation(summary = "查询所有子节点", description = "返回list集合")
|
||||
@GetMapping("findNodes")
|
||||
public Result findNodes() {
|
||||
List<SysMenu> sysMenuList = sysMenuService.findNodes();
|
||||
return Result.build((sysMenuList), ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ import lombok.extern.log4j.Log4j2;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "用户角色查询")
|
||||
@Log4j2
|
||||
@RestController
|
||||
|
@ -20,6 +22,13 @@ public class SysRoleController {
|
|||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Operation(summary = "查询所有角色", description = "查询所有角色信息")
|
||||
@GetMapping("/findAllRoles/{userId}")
|
||||
public Result findAllRoles(@PathVariable("userId") Long userId) {
|
||||
Map<String, Object> map = sysRoleService.findAll(userId);
|
||||
return Result.build(map, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "彻底删除角色", description = "使用id彻底删除角色信息")
|
||||
@DeleteMapping("deleteSysRoleByRoleId")
|
||||
public Result deleteSysRoleByRoleId(@RequestParam("roleId") Long roleId) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.bunny.controller;
|
||||
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.system.AssginRoleDto;
|
||||
import cn.bunny.common.spzx.model.dto.system.SysUserDto;
|
||||
import cn.bunny.common.spzx.model.entity.system.SysUser;
|
||||
import cn.bunny.common.spzx.model.vo.common.Result;
|
||||
|
@ -46,4 +47,11 @@ public class SysUserController {
|
|||
sysUserService.deleteUserById(userId);
|
||||
return Result.build(null, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "保存分配数据", description = "用户分配角色")
|
||||
@PostMapping("/doAssign")
|
||||
public Result doAssign(@RequestBody AssginRoleDto assginRoleDto) {
|
||||
sysUserService.doAssign(assginRoleDto);
|
||||
return Result.build(null, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package cn.bunny.mapper;
|
||||
|
||||
import cn.bunny.common.spzx.model.entity.system.SysMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysMenuMapper {
|
||||
// 查询所有子节点
|
||||
List<SysMenu> findAll();
|
||||
}
|
|
@ -22,4 +22,7 @@ public interface SysRoleMapper {
|
|||
|
||||
// 彻底删除角色
|
||||
void deleteSysRoleByRoleId(Long roleId);
|
||||
|
||||
// 查询所有角色
|
||||
List<SysRole> findAll();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package cn.bunny.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysRoleUserMapper {
|
||||
// 根据userId删除用户之前分配角色数据
|
||||
void deleteByUserId(Long userId);
|
||||
|
||||
// 重新分配新数据
|
||||
void doAssign(Long userId, Long roleId);
|
||||
|
||||
// 根据userId查询用户分配过角色id列表
|
||||
List<Long> selectRoleByUserId(Long userId);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package cn.bunny.properties;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ConfigurationProperties(prefix = "spzx.minio")
|
||||
public class MinioProperties {
|
||||
private String endpointUrl;
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
private String bucketName;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public interface FIleUploadService {
|
||||
// 上传文件
|
||||
String uploadFile(MultipartFile multipartFile);
|
||||
|
||||
// 保存文件到本地
|
||||
void saveFile(MultipartFile multipartFile) throws IOException;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import cn.bunny.common.spzx.model.entity.system.SysMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysMenuService {
|
||||
// 查询所有子节点
|
||||
List<SysMenu> findNodes();
|
||||
}
|
|
@ -4,6 +4,8 @@ import cn.bunny.common.spzx.model.dto.system.SysRoleDto;
|
|||
import cn.bunny.common.spzx.model.entity.system.SysRole;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface SysRoleService {
|
||||
// 角色列表查询
|
||||
PageInfo<SysRole> findByPage(SysRoleDto sysRoleDto, Integer current, Integer limit);
|
||||
|
@ -19,4 +21,7 @@ public interface SysRoleService {
|
|||
|
||||
// 彻底删除角色
|
||||
void deleteSysRoleByRoleId(Long roleId);
|
||||
|
||||
// 查询所有角色信息
|
||||
Map<String, Object> findAll(Long userId);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.system.AssginRoleDto;
|
||||
import cn.bunny.common.spzx.model.dto.system.LoginDto;
|
||||
import cn.bunny.common.spzx.model.dto.system.SysUserDto;
|
||||
import cn.bunny.common.spzx.model.entity.system.SysUser;
|
||||
|
@ -27,4 +28,7 @@ public interface SysUserService {
|
|||
|
||||
// 删除用户
|
||||
void deleteUserById(Integer userId);
|
||||
|
||||
// 保存分配数据
|
||||
void doAssign(AssginRoleDto assginRoleDto);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
package cn.bunny.service.impl;
|
||||
|
||||
import cn.bunny.common.exception.BunnyException;
|
||||
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
|
||||
import cn.bunny.properties.MinioProperties;
|
||||
import cn.bunny.service.FIleUploadService;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import io.minio.BucketExistsArgs;
|
||||
import io.minio.MakeBucketArgs;
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.PutObjectArgs;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
public class FileUploadServiceImpl implements FIleUploadService {
|
||||
@Autowired
|
||||
private MinioProperties minioProperties;
|
||||
|
||||
@Override
|
||||
public String uploadFile(MultipartFile multipartFile) {
|
||||
|
||||
try {
|
||||
// 创建一个Minio的客户端对象
|
||||
MinioClient minioClient = MinioClient.builder()
|
||||
.endpoint(minioProperties.getEndpointUrl())
|
||||
.credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
|
||||
.build();
|
||||
|
||||
// 判断桶是否存在
|
||||
boolean found = minioClient.bucketExists(BucketExistsArgs
|
||||
.builder()
|
||||
.bucket(minioProperties.getBucketName())
|
||||
.build());
|
||||
|
||||
if (!found) { // 如果不存在,那么此时就创建一个新的桶
|
||||
minioClient.makeBucket(MakeBucketArgs
|
||||
.builder()
|
||||
.bucket(minioProperties.getBucketName())
|
||||
.build());
|
||||
}
|
||||
|
||||
// 设置存储对象名称
|
||||
String dateDir = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||
String fileName = dateDir + "/" + uuid + multipartFile.getOriginalFilename();
|
||||
|
||||
// 存储文件
|
||||
PutObjectArgs putObjectArgs = PutObjectArgs.builder()
|
||||
.bucket(minioProperties.getBucketName())
|
||||
.stream(multipartFile.getInputStream(), multipartFile.getSize(), -1)
|
||||
.object(fileName)
|
||||
.build();
|
||||
minioClient.putObject(putObjectArgs);
|
||||
|
||||
// 返回访问地址
|
||||
return minioProperties.getEndpointUrl() + "/" + minioProperties.getBucketName() + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BunnyException(ResultCodeEnum.SYSTEM_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 保存文件
|
||||
@Override
|
||||
public void saveFile(MultipartFile multipartFile) throws IOException {
|
||||
// 生成唯一的文件名
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
// 创建上传目录(如果不存在)
|
||||
Path uploadDir = Paths.get("F:\\File\\");
|
||||
Files.createDirectories(uploadDir);
|
||||
// 保存文件到本地文件系统
|
||||
Path filePath = uploadDir.resolve(fileName);
|
||||
Files.write(filePath, multipartFile.getBytes());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package cn.bunny.service.impl;
|
||||
|
||||
import cn.bunny.common.spzx.model.entity.system.SysMenu;
|
||||
import cn.bunny.mapper.SysMenuMapper;
|
||||
import cn.bunny.service.SysMenuService;
|
||||
import cn.bunny.utils.MenuHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysMenuServiceImpl implements SysMenuService {
|
||||
@Autowired
|
||||
private SysMenuMapper sysMenuMapper;
|
||||
|
||||
// 查询所有子节点
|
||||
@Override
|
||||
public List<SysMenu> findNodes() {
|
||||
List<SysMenu> sysMenuList = sysMenuMapper.findAll();
|
||||
if (CollectionUtils.isEmpty(sysMenuList)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return MenuHelper.buildTree(sysMenuList);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package cn.bunny.service.impl;
|
|||
import cn.bunny.common.spzx.model.dto.system.SysRoleDto;
|
||||
import cn.bunny.common.spzx.model.entity.system.SysRole;
|
||||
import cn.bunny.mapper.SysRoleMapper;
|
||||
import cn.bunny.mapper.SysRoleUserMapper;
|
||||
import cn.bunny.service.SysRoleService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
@ -10,7 +11,9 @@ import lombok.extern.log4j.Log4j2;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
|
@ -18,6 +21,9 @@ public class SysRoleServiceImpl implements SysRoleService {
|
|||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleUserMapper sysRoleUserMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<SysRole> findByPage(SysRoleDto sysRoleDto, Integer current, Integer limit) {
|
||||
// 设置分页器参数
|
||||
|
@ -52,4 +58,19 @@ public class SysRoleServiceImpl implements SysRoleService {
|
|||
public void deleteSysRoleByRoleId(Long roleId) {
|
||||
sysRoleMapper.deleteSysRoleByRoleId(roleId);
|
||||
}
|
||||
|
||||
// 查询所有角色信息
|
||||
@Override
|
||||
public Map<String, Object> findAll(Long userId) {
|
||||
// 查询所有角色
|
||||
List<SysRole> roleList = sysRoleMapper.findAll();
|
||||
|
||||
// 分配过的角色
|
||||
List<Long> roleIds = sysRoleUserMapper.selectRoleByUserId(userId);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("allRoleList", roleList);
|
||||
map.put("sysUserRoles", roleIds);
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,13 @@ package cn.bunny.service.impl;
|
|||
|
||||
|
||||
import cn.bunny.common.exception.BunnyException;
|
||||
import cn.bunny.common.spzx.model.dto.system.AssginRoleDto;
|
||||
import cn.bunny.common.spzx.model.dto.system.LoginDto;
|
||||
import cn.bunny.common.spzx.model.dto.system.SysUserDto;
|
||||
import cn.bunny.common.spzx.model.entity.system.SysUser;
|
||||
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
|
||||
import cn.bunny.common.spzx.model.vo.system.LoginVo;
|
||||
import cn.bunny.mapper.SysRoleUserMapper;
|
||||
import cn.bunny.mapper.SysUserMapper;
|
||||
import cn.bunny.service.SysUserService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
@ -32,6 +34,9 @@ public class SysUserServiceImpl implements SysUserService {
|
|||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private SysRoleUserMapper sysRoleUserMapper;
|
||||
|
||||
// 用户登录
|
||||
@Override
|
||||
public LoginVo login(LoginDto loginDto) {
|
||||
|
@ -109,6 +114,9 @@ public class SysUserServiceImpl implements SysUserService {
|
|||
String md5_password = DigestUtils.md5DigestAsHex(sysUser.getPassword().getBytes());
|
||||
sysUser.setPassword(md5_password);
|
||||
|
||||
// 设置status值为 1
|
||||
sysUser.setStatus(0);
|
||||
|
||||
sysUserMapper.saveSysuser(sysUser);
|
||||
}
|
||||
|
||||
|
@ -123,4 +131,18 @@ public class SysUserServiceImpl implements SysUserService {
|
|||
public void deleteUserById(Integer userId) {
|
||||
sysUserMapper.deleteUserById(userId);
|
||||
}
|
||||
|
||||
// 保存分配数据
|
||||
@Override
|
||||
public void doAssign(AssginRoleDto assginRoleDto) {
|
||||
// 根据userId删除用户之前分配角色数据
|
||||
sysRoleUserMapper.deleteByUserId(assginRoleDto.getUserId());
|
||||
|
||||
// 重新分配新数据
|
||||
List<Long> roleIdList = assginRoleDto.getRoleIdList();
|
||||
|
||||
for (Long roleId : roleIdList) {
|
||||
sysRoleUserMapper.doAssign(assginRoleDto.getUserId(), roleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package cn.bunny.utils;
|
||||
|
||||
import cn.bunny.common.spzx.model.entity.system.SysMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MenuHelper {
|
||||
public static List<SysMenu> buildTree(List<SysMenu> sysMenuList) {
|
||||
List<SysMenu> trees = new ArrayList<>();
|
||||
|
||||
for (SysMenu sysMenu : sysMenuList) {
|
||||
if (sysMenu.getParentId().longValue() == 0) {
|
||||
trees.add(findChildren(sysMenu, sysMenuList));
|
||||
}
|
||||
}
|
||||
|
||||
return trees;
|
||||
}
|
||||
|
||||
// 递归查找下层菜单
|
||||
private static SysMenu findChildren(SysMenu sysMenu, List<SysMenu> sysMenuList) {
|
||||
sysMenu.setChildren(new ArrayList<>());
|
||||
for (SysMenu item : sysMenuList) {
|
||||
if (sysMenu.getId().longValue() == item.getParentId().longValue()) {
|
||||
sysMenu.getChildren().add(findChildren(item, sysMenuList));
|
||||
}
|
||||
}
|
||||
|
||||
return sysMenu;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,10 @@ spring:
|
|||
name: server-manager
|
||||
profiles:
|
||||
active: dev
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
|
||||
|
||||
server:
|
||||
|
@ -14,3 +18,8 @@ spzx:
|
|||
noAuthUrls:
|
||||
- /admin/system/index/login
|
||||
- /admin/system/index/generateValidateCode
|
||||
minio:
|
||||
endpointUrl: "http://129.211.31.58:9000"
|
||||
accessKey: "bunny"
|
||||
secretKey: "02120212"
|
||||
bucketName: "spzx-bucket"
|
|
@ -0,0 +1,21 @@
|
|||
<?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="cn.bunny.mapper.SysMenuMapper">
|
||||
|
||||
<!-- 映射查询到的字段 -->
|
||||
<resultMap id="sysRoleMap" type="cn.bunny.common.spzx.model.entity.system.SysRole" autoMapping="true"/>
|
||||
<!-- 用于select查询公用抽取列 -->
|
||||
<sql id="columns">
|
||||
id,username userName ,password,name,phone,avatar,description,status,create_time,update_time,is_deleted
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- 查询所有子节点,返回list集合 -->
|
||||
<select id="findAll" resultMap="sysRoleMap">
|
||||
select
|
||||
<include refid="columns"/>
|
||||
from sys_menu
|
||||
where is_deleted=0
|
||||
order by sort_value
|
||||
</select>
|
||||
</mapper>
|
|
@ -67,4 +67,11 @@
|
|||
</where>
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<!-- 查询所有角色 -->
|
||||
<select id="findAll" resultMap="sysRoleMap">
|
||||
select
|
||||
<include refid="columns"/>
|
||||
from sys_role where is_deleted=0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?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="cn.bunny.mapper.SysRoleUserMapper">
|
||||
|
||||
<!-- 重新分配新数据 -->
|
||||
<insert id="doAssign">
|
||||
insert into sys_user_role (user_id, role_id, create_time, update_time, is_deleted)
|
||||
values (#{userId}, #{roleId}, NOW(), NOW(), 0);
|
||||
</insert>
|
||||
|
||||
<!-- 根据userId删除用户之前分配角色数据 -->
|
||||
<delete id="deleteByUserId">
|
||||
delete
|
||||
from sys_user_role
|
||||
where user_id = #{user_id}
|
||||
</delete>
|
||||
|
||||
<!-- 根据userId查询用户分配过角色id列表 -->
|
||||
<select id="selectRoleByUserId" resultType="java.lang.Long">
|
||||
select role_id
|
||||
from sys_user_role
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,21 @@
|
|||
package cn.bunny.common.spzx.model.vo.file;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Schema(description = "上传文件返回信息")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UploadFileVo {
|
||||
@Schema(description = "文件访问路径")
|
||||
private String filepath;
|
||||
|
||||
@Schema(description = "文件大小")
|
||||
private Long filesize;
|
||||
|
||||
@Schema(description = "上传文件名")
|
||||
private String filename;
|
||||
}
|
Loading…
Reference in New Issue