全部
This commit is contained in:
@ -1 +1 @@
|
||||
41b/ujShRZRf9Aa433FD3uyIZuxWSSqXWXlc2dyQfJ75ED0HNbadcdsPF5CaMuJ6K2c3U/eBcWiXXw090/O7M5mJze/MavZ4dhk4dZIukMik2Jrufq9vkpQW+3/LWMFurfFWnFDZIf7Ptuoj4BvuX9h/qJ3oYUDCj14JFAR6ge7ZUtqT1yBvSl/eVexWpCiXfpNSm79whbkkpQjgjWts5/bgQ9cOYdBaVOBJnQkRxNzb4fKh3jkuyEADR+VZg2sRnjLJChAg7DYvIou8Zy16Ag==
|
||||
41b/ujShRZRf9Aa433FD3uyIZuxWSSqXWXlc2dyQfJ75ED0HNbadcdsPF5CaMuJ624E+iLBfS14muki3Kp1qv3N0KPVdc0TjJDyrO+AVfwFoV1vsU7ttyFcYz2+yX4NkYcMHrSqrAypTaj5AfebZ3k5REN4ZYlZ5xc6tC4sbEIbwLryTr1ScTPGegLiv1C+rX1Pt+SSB5O9YehWlSuWw2JTA9+UoajQ1PHwDUdI7SfrD/jzSgRtVXcZ5k1UF3Fc8LypkZtybW+yeNEhnp/jeYw==
|
||||
@ -6,6 +6,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Base64;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -72,6 +75,20 @@ public class AuthGenerator {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(generateAuth("标准版", 1000, 365, "35A0DF1D05AEAE77E1E2715CC36A7368"));
|
||||
try {
|
||||
// 生成加密的授权字符串
|
||||
String authContent = generateAuth("标准版", 1000, 365, "3A446222D1FE537F6C9EEF5C2AB3F957");
|
||||
|
||||
// 定义授权文件路径(当前目录下的 yjearth.lic)
|
||||
Path licPath = Paths.get("yjearth.lic");
|
||||
|
||||
// 将授权字符串写入文件
|
||||
Files.write(licPath, authContent.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
System.out.println("授权文件生成成功:" + licPath.toAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
System.err.println("生成授权文件失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,15 +59,13 @@ public class MatterController {
|
||||
|
||||
@Operation(summary = "物资列表")
|
||||
@PostMapping("/list")
|
||||
public ApiResponse list(@Parameter(description = "分页数量") Integer pageNum,
|
||||
@Parameter(description = "分页大小") Integer pageSize,
|
||||
@Parameter(description = "物资名称") String name) {
|
||||
public ApiResponse list(@Parameter(description = "分页数量") @RequestParam(value = "pageNum") Integer pageNum,
|
||||
@Parameter(description = "分页大小") @RequestParam(value = "pageSize") Integer pageSize,
|
||||
@Parameter(description = "物资名称") @RequestParam(value = "name") String name) {
|
||||
LambdaQueryWrapper<Matter> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
queryWrapper.like(Matter::getName, name);
|
||||
}
|
||||
Page<Matter> page = new Page<>(pageNum, pageSize);
|
||||
List<Matter> matterList = matterService.list(page, queryWrapper);
|
||||
return ApiResponse.success(matterList);
|
||||
return ApiResponse.success(matterService.page(new Page<>(pageNum, pageSize), queryWrapper));
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,10 +69,7 @@ public class RoleController {
|
||||
|
||||
@Operation(summary = "角色列表")
|
||||
@GetMapping("/list")
|
||||
public ApiResponse list(@Parameter(description = "分页数量") Integer pageNum,
|
||||
@Parameter(description = "分页大小") Integer pageSize,
|
||||
@Parameter(description = "角色名称") String roleName,
|
||||
@Parameter(description = "角色状态") Integer status) {
|
||||
public ApiResponse list(@Parameter(description = "分页数量") Integer pageNum, @Parameter(description = "分页大小") Integer pageSize, @Parameter(description = "角色名称") String roleName, @Parameter(description = "角色状态") Integer status) {
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<Role> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(roleName)) {
|
||||
|
||||
@ -0,0 +1,100 @@
|
||||
package com.yj.earth.business.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yj.earth.business.domain.RoleMenu;
|
||||
import com.yj.earth.business.service.RoleMenuService;
|
||||
import com.yj.earth.common.util.ApiResponse;
|
||||
import com.yj.earth.dto.roleMenu.AddRoleMenuDto;
|
||||
import com.yj.earth.dto.roleMenu.UpdateMenuDto;
|
||||
import com.yj.earth.dto.roleOperate.UpdateRoleOperateDto;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Tag(name = "角色菜单权限")
|
||||
@RestController
|
||||
@RequestMapping("/roleMenu")
|
||||
public class RoleMenuController {
|
||||
@Resource
|
||||
private RoleMenuService roleMenuService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加角色菜单权限")
|
||||
public ApiResponse add(@RequestBody AddRoleMenuDto addRoleMenuDto) {
|
||||
String roleId = addRoleMenuDto.getRoleId();
|
||||
List<Map<String, List<String>>> permissionList = addRoleMenuDto.getPermissionList();
|
||||
|
||||
if (permissionList == null || permissionList.isEmpty()) {
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
// 遍历权限列表中的每一组配置
|
||||
for (Map<String, List<String>> permissionMap : permissionList) {
|
||||
if (permissionMap == null || permissionMap.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 遍历每个菜单的权限配置
|
||||
Set<Map.Entry<String, List<String>>> entries = permissionMap.entrySet();
|
||||
for (Map.Entry<String, List<String>> entry : entries) {
|
||||
String menu = entry.getKey();
|
||||
List<String> permissions = entry.getValue();
|
||||
|
||||
if (permissions == null || permissions.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 为每个权限创建一条角色-菜单-权限关联记录
|
||||
for (String permission : permissions) {
|
||||
RoleMenu roleMenu = new RoleMenu();
|
||||
roleMenu.setRoleId(roleId);
|
||||
roleMenu.setMenu(menu);
|
||||
roleMenu.setPermission(permission);
|
||||
roleMenuService.save(roleMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除角色菜单权限")
|
||||
@PostMapping("/delete")
|
||||
public ApiResponse delete(@Parameter(description = "角色菜单权限ID") @RequestParam(required = true) String id) {
|
||||
roleMenuService.removeById(id);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改角色菜单权限")
|
||||
@PostMapping("/update")
|
||||
public ApiResponse update(@RequestBody UpdateMenuDto updateMenuDto) {
|
||||
RoleMenu roleMenu = new RoleMenu();
|
||||
BeanUtils.copyProperties(updateMenuDto, roleMenu);
|
||||
roleMenuService.updateById(roleMenu);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询角色权限")
|
||||
@PostMapping("/query")
|
||||
public ApiResponse query(@Parameter(description = "角色权限ID") @RequestParam(required = true) String id) {
|
||||
RoleMenu roleMenu = roleMenuService.getById(id);
|
||||
return ApiResponse.success(roleMenu);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有方案")
|
||||
@PostMapping("/list")
|
||||
public ApiResponse list(@Parameter(description = "分页数量") @RequestParam(value = "pageNum") Integer pageNum,
|
||||
@Parameter(description = "分页大小") @RequestParam(value = "pageSize") Integer pageSize) {
|
||||
LambdaQueryWrapper<RoleMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<RoleMenu> page = roleMenuService.page(new Page<>(pageNum, pageSize), queryWrapper);
|
||||
return ApiResponse.success(page);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.yj.earth.business.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yj.earth.business.domain.RoleOperate;
|
||||
import com.yj.earth.business.service.RoleOperateService;
|
||||
import com.yj.earth.common.util.ApiResponse;
|
||||
import com.yj.earth.dto.roleOperate.AddRoleOperateDto;
|
||||
import com.yj.earth.dto.roleOperate.UpdateRoleOperateDto;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "角色操作权限")
|
||||
@RestController
|
||||
@RequestMapping("/roleOperate")
|
||||
public class RoleOperateController {
|
||||
@Resource
|
||||
private RoleOperateService roleOperateService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加角色操作权限")
|
||||
public ApiResponse add(@RequestBody AddRoleOperateDto addRoleOperateDto) {
|
||||
List<String> operateList = addRoleOperateDto.getOperateList();
|
||||
for (String operate : operateList) {
|
||||
RoleOperate roleOperate = new RoleOperate();
|
||||
roleOperate.setRoleId(addRoleOperateDto.getRoleId());
|
||||
roleOperate.setOperate(operate);
|
||||
roleOperateService.save(roleOperate);
|
||||
}
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除角色操作权限")
|
||||
@PostMapping("/delete")
|
||||
public ApiResponse delete(@Parameter(description = "角色操作权限ID") @RequestParam(required = true) String id) {
|
||||
roleOperateService.removeById(id);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改角色操作权限")
|
||||
@PostMapping("/update")
|
||||
public ApiResponse update(@RequestBody UpdateRoleOperateDto updateRoleOperateDto) {
|
||||
RoleOperate roleOperate = new RoleOperate();
|
||||
BeanUtils.copyProperties(updateRoleOperateDto, roleOperate);
|
||||
roleOperateService.updateById(roleOperate);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询角色权限")
|
||||
@PostMapping("/query")
|
||||
public ApiResponse query(@Parameter(description = "角色权限ID") @RequestParam(required = true) String id) {
|
||||
RoleOperate roleOperate = roleOperateService.getById(id);
|
||||
return ApiResponse.success(roleOperate);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有方案")
|
||||
@PostMapping("/list")
|
||||
public ApiResponse list(@Parameter(description = "分页数量") @RequestParam(value = "pageNum") Integer pageNum,
|
||||
@Parameter(description = "分页大小") @RequestParam(value = "pageSize") Integer pageSize) {
|
||||
LambdaQueryWrapper<RoleOperate> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<RoleOperate> page = roleOperateService.page(new Page<>(pageNum, pageSize), queryWrapper);
|
||||
return ApiResponse.success(page);
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,6 @@ public class SystemController {
|
||||
return sourceList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解压ZIP文件并获取SQLite文件
|
||||
*/
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.yj.earth.business.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yj.earth.business.domain.TsPlan;
|
||||
import com.yj.earth.business.domain.User;
|
||||
import com.yj.earth.business.service.TsPlanService;
|
||||
import com.yj.earth.business.service.UserService;
|
||||
import com.yj.earth.common.util.ApiResponse;
|
||||
import com.yj.earth.dto.tsPlan.AddTsPlanDto;
|
||||
import com.yj.earth.dto.tsPlan.UpdateTsPlanDto;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
|
||||
@Tag(name = "态势方案管理")
|
||||
@RestController
|
||||
@RequestMapping("/tsPlan")
|
||||
public class TsPlanController {
|
||||
@Resource
|
||||
private TsPlanService tsPlanService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加方案")
|
||||
public ApiResponse add(@RequestBody AddTsPlanDto addTsPlanDto) {
|
||||
TsPlan tsPlan = new TsPlan();
|
||||
BeanUtils.copyProperties(addTsPlanDto, tsPlan);
|
||||
// 获取当前登录用户ID
|
||||
tsPlan.setCreatedBy(StpUtil.getLoginIdAsString());
|
||||
tsPlanService.save(tsPlan);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除方案")
|
||||
@PostMapping("/delete")
|
||||
public ApiResponse delete(@Parameter(description = "态势方案ID") @RequestParam(required = true) String id) {
|
||||
tsPlanService.removeById(id);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改方案")
|
||||
@PostMapping("/update")
|
||||
public ApiResponse update(@RequestBody UpdateTsPlanDto updateTsPlanDto) {
|
||||
TsPlan tsPlan = new TsPlan();
|
||||
BeanUtils.copyProperties(updateTsPlanDto, tsPlan);
|
||||
tsPlanService.updateById(tsPlan);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询方案")
|
||||
@PostMapping("/query")
|
||||
public ApiResponse query(@Parameter(description = "态势方案ID") @RequestParam(required = true) String id) {
|
||||
TsPlan tsPlan = tsPlanService.getById(id);
|
||||
return ApiResponse.success(tsPlan);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有方案")
|
||||
@PostMapping("/list")
|
||||
public ApiResponse list(@Parameter(description = "分页数量") @RequestParam(value = "pageNum") Integer pageNum,
|
||||
@Parameter(description = "分页大小") @RequestParam(value = "pageSize") Integer pageSize,
|
||||
@Parameter(description = "方案名称") @RequestParam(value = "name", required = false) String name,
|
||||
@Parameter(description = "用户名称") @RequestParam(value = "username", required = false) String username,
|
||||
@Parameter(description = "开始时间") @RequestParam(value = "startTime", required = false) String startTime,
|
||||
@Parameter(description = "结束时间") @RequestParam(value = "endTime", required = false) String endTime) {
|
||||
LambdaQueryWrapper<TsPlan> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
queryWrapper.like(TsPlan::getName, name);
|
||||
}
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
// 根据用户名查询用户ID
|
||||
LambdaQueryWrapper<User> userQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userQueryWrapper.like(User::getUsername, username);
|
||||
User user = userService.getOne(userQueryWrapper);
|
||||
if (user != null) {
|
||||
queryWrapper.eq(TsPlan::getCreatedBy, user.getId());
|
||||
}
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
if (startTime != null && endTime != null) {
|
||||
// 把字符串的时间字符串 转换成 LocalDateTime
|
||||
LocalDateTime startTimeDate = LocalDateTime.parse(startTime, formatter);
|
||||
LocalDateTime endTimeDate = LocalDateTime.parse(endTime, formatter);
|
||||
queryWrapper.between(TsPlan::getCreatedAt, startTimeDate, endTimeDate);
|
||||
}
|
||||
Page<TsPlan> page = tsPlanService.page(new Page<>(pageNum, pageSize), queryWrapper);
|
||||
// 需要设置创建人名称
|
||||
page.getRecords().forEach(tsPlan -> {
|
||||
// 根据用户ID查询用户名
|
||||
User user = userService.getById(tsPlan.getCreatedBy());
|
||||
if (user != null) {
|
||||
tsPlan.setCreatedBy(user.getNickname());
|
||||
}
|
||||
});
|
||||
return ApiResponse.success(page);
|
||||
}
|
||||
}
|
||||
@ -6,17 +6,17 @@ import cn.hutool.crypto.digest.BCrypt;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yj.earth.annotation.CheckAuth;
|
||||
import com.yj.earth.annotation.EncryptResponse;
|
||||
import com.yj.earth.annotation.ExcludeField;
|
||||
import com.yj.earth.annotation.RoleAccess;
|
||||
import com.yj.earth.business.domain.Role;
|
||||
import com.yj.earth.business.domain.RoleMenu;
|
||||
import com.yj.earth.business.domain.RoleOperate;
|
||||
import com.yj.earth.business.domain.User;
|
||||
import com.yj.earth.business.service.RoleMenuService;
|
||||
import com.yj.earth.business.service.RoleOperateService;
|
||||
import com.yj.earth.business.service.RoleService;
|
||||
import com.yj.earth.dto.relation.UserBindOrUnBindRoleDto;
|
||||
import com.yj.earth.dto.user.*;
|
||||
import com.yj.earth.business.service.UserService;
|
||||
import com.yj.earth.common.util.ApiResponse;
|
||||
import com.yj.earth.dto.relation.UserBindOrUnBindRoleDto;
|
||||
import com.yj.earth.dto.user.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -24,6 +24,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -36,6 +37,11 @@ public class UserController {
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@Resource
|
||||
private RoleOperateService roleOperateService;
|
||||
@Resource
|
||||
private RoleMenuService roleMenuService;
|
||||
|
||||
@Operation(summary = "新增用户")
|
||||
@PostMapping("/add")
|
||||
@RoleAccess(roleNames = "管理员")
|
||||
@ -122,7 +128,23 @@ public class UserController {
|
||||
}
|
||||
StpUtil.login(user.getId());
|
||||
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
|
||||
return ApiResponse.success(Map.of("header", tokenInfo.getTokenName(), "token", tokenInfo.getTokenValue()));
|
||||
|
||||
// 获取该用户角色的操作权限
|
||||
LambdaQueryWrapper<RoleOperate> roleOperateWrapper = new LambdaQueryWrapper<>();
|
||||
roleOperateWrapper.eq(RoleOperate::getRoleId, user.getRoleId());
|
||||
List<RoleOperate> roleOperates = roleOperateService.list(roleOperateWrapper);
|
||||
|
||||
// 获取该用户角色的菜单权限
|
||||
LambdaQueryWrapper<RoleMenu> roleMenuWrapper = new LambdaQueryWrapper<>();
|
||||
roleMenuWrapper.eq(RoleMenu::getRoleId, user.getRoleId());
|
||||
List<RoleMenu> roleMenus = roleMenuService.list(roleMenuWrapper);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("header", tokenInfo.getTokenName());
|
||||
data.put("token", tokenInfo.getTokenValue());
|
||||
data.put("roleOperates", roleOperates);
|
||||
data.put("roleMenus", roleMenus);
|
||||
return ApiResponse.success(data);
|
||||
}
|
||||
|
||||
@Operation(summary = "用户登出")
|
||||
|
||||
41
src/main/java/com/yj/earth/business/domain/RoleMenu.java
Normal file
41
src/main/java/com/yj/earth/business/domain/RoleMenu.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.yj.earth.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
public class RoleMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键")
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
|
||||
@Schema(description = "菜单")
|
||||
private String menu;
|
||||
|
||||
@Schema(description = "权限")
|
||||
private String permission;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
39
src/main/java/com/yj/earth/business/domain/RoleOperate.java
Normal file
39
src/main/java/com/yj/earth/business/domain/RoleOperate.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.yj.earth.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
public class RoleOperate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键")
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
|
||||
@Schema(description = "操作")
|
||||
private String operate;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
42
src/main/java/com/yj/earth/business/domain/TsPlan.java
Normal file
42
src/main/java/com/yj/earth/business/domain/TsPlan.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.yj.earth.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
public class TsPlan implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "方案名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "方案描述")
|
||||
private String desc;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yj.earth.business.mapper;
|
||||
|
||||
import com.yj.earth.business.domain.RoleMenu;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleMenuMapper extends BaseMapper<RoleMenu> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yj.earth.business.mapper;
|
||||
|
||||
import com.yj.earth.business.domain.RoleOperate;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleOperateMapper extends BaseMapper<RoleOperate> {
|
||||
|
||||
}
|
||||
18
src/main/java/com/yj/earth/business/mapper/TsPlanMapper.java
Normal file
18
src/main/java/com/yj/earth/business/mapper/TsPlanMapper.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.yj.earth.business.mapper;
|
||||
|
||||
import com.yj.earth.business.domain.TsPlan;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
@Mapper
|
||||
public interface TsPlanMapper extends BaseMapper<TsPlan> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yj.earth.business.service;
|
||||
|
||||
import com.yj.earth.business.domain.RoleMenu;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
public interface RoleMenuService extends IService<RoleMenu> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yj.earth.business.service;
|
||||
|
||||
import com.yj.earth.business.domain.RoleOperate;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
public interface RoleOperateService extends IService<RoleOperate> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yj.earth.business.service;
|
||||
|
||||
import com.yj.earth.business.domain.TsPlan;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
public interface TsPlanService extends IService<TsPlan> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.yj.earth.business.service.impl;
|
||||
|
||||
import com.yj.earth.business.domain.RoleMenu;
|
||||
import com.yj.earth.business.mapper.RoleMenuMapper;
|
||||
import com.yj.earth.business.service.RoleMenuService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
@Service
|
||||
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.yj.earth.business.service.impl;
|
||||
|
||||
import com.yj.earth.business.domain.RoleOperate;
|
||||
import com.yj.earth.business.mapper.RoleOperateMapper;
|
||||
import com.yj.earth.business.service.RoleOperateService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
@Service
|
||||
public class RoleOperateServiceImpl extends ServiceImpl<RoleOperateMapper, RoleOperate> implements RoleOperateService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.yj.earth.business.service.impl;
|
||||
|
||||
import com.yj.earth.business.domain.TsPlan;
|
||||
import com.yj.earth.business.mapper.TsPlanMapper;
|
||||
import com.yj.earth.business.service.TsPlanService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-31
|
||||
*/
|
||||
@Service
|
||||
public class TsPlanServiceImpl extends ServiceImpl<TsPlanMapper, TsPlan> implements TsPlanService {
|
||||
|
||||
}
|
||||
@ -34,7 +34,7 @@ public class CodeUtil {
|
||||
}
|
||||
|
||||
// 传入需要生成代码的表名
|
||||
Generation("matter");
|
||||
Generation("role_menu");
|
||||
}
|
||||
|
||||
public static void Generation(String... tableName) {
|
||||
|
||||
@ -56,6 +56,9 @@ public class DatabaseManager {
|
||||
classes.add(Device.class);
|
||||
classes.add(PoiInfo.class);
|
||||
classes.add(Matter.class);
|
||||
classes.add(RoleOperate.class);
|
||||
classes.add(RoleMenu.class);
|
||||
classes.add(TsPlan.class);
|
||||
ENTITY_CLASSES = Collections.unmodifiableList(classes);
|
||||
}
|
||||
|
||||
|
||||
22
src/main/java/com/yj/earth/design/RoleMenu.java
Normal file
22
src/main/java/com/yj/earth/design/RoleMenu.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.yj.earth.design;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class RoleMenu {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
@Schema(description = "菜单")
|
||||
private String menu;
|
||||
@Schema(description = "权限")
|
||||
private String permission;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
20
src/main/java/com/yj/earth/design/RoleOperate.java
Normal file
20
src/main/java/com/yj/earth/design/RoleOperate.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.yj.earth.design;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class RoleOperate {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
@Schema(description = "操作")
|
||||
private String operate;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
22
src/main/java/com/yj/earth/design/TsPlan.java
Normal file
22
src/main/java/com/yj/earth/design/TsPlan.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.yj.earth.design;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class TsPlan {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "方案名称")
|
||||
private String name;
|
||||
@Schema(description = "方案描述")
|
||||
private String desc;
|
||||
@Schema(description = "创建人")
|
||||
private String createdBy;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
16
src/main/java/com/yj/earth/dto/roleMenu/AddRoleMenuDto.java
Normal file
16
src/main/java/com/yj/earth/dto/roleMenu/AddRoleMenuDto.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.yj.earth.dto.roleMenu;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class AddRoleMenuDto {
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
@Schema(description = "权限列表")
|
||||
// 键为菜单名、值为该菜单的权限集合
|
||||
private List<Map<String, List<String>>> permissionList;
|
||||
}
|
||||
16
src/main/java/com/yj/earth/dto/roleMenu/UpdateMenuDto.java
Normal file
16
src/main/java/com/yj/earth/dto/roleMenu/UpdateMenuDto.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.yj.earth.dto.roleMenu;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateMenuDto {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
@Schema(description = "菜单")
|
||||
private String menu;
|
||||
@Schema(description = "权限")
|
||||
private String permission;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.yj.earth.dto.roleOperate;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AddRoleOperateDto {
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
@Schema(description = "操作")
|
||||
private List<String> operateList;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.yj.earth.dto.roleOperate;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateRoleOperateDto {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "角色ID")
|
||||
private String roleId;
|
||||
@Schema(description = "操作")
|
||||
private String operate;
|
||||
}
|
||||
12
src/main/java/com/yj/earth/dto/tsPlan/AddTsPlanDto.java
Normal file
12
src/main/java/com/yj/earth/dto/tsPlan/AddTsPlanDto.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.yj.earth.dto.tsPlan;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AddTsPlanDto {
|
||||
@Schema(description = "方案名称")
|
||||
private String name;
|
||||
@Schema(description = "方案描述")
|
||||
private String desc;
|
||||
}
|
||||
14
src/main/java/com/yj/earth/dto/tsPlan/UpdateTsPlanDto.java
Normal file
14
src/main/java/com/yj/earth/dto/tsPlan/UpdateTsPlanDto.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.yj.earth.dto.tsPlan;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateTsPlanDto {
|
||||
@Schema(description = "方案Id")
|
||||
private String id;
|
||||
@Schema(description = "方案名称")
|
||||
private String name;
|
||||
@Schema(description = "方案描述")
|
||||
private String desc;
|
||||
}
|
||||
19
src/main/resources/mapper/RoleMenuMapper.xml
Normal file
19
src/main/resources/mapper/RoleMenuMapper.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?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.yj.earth.business.mapper.RoleMenuMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.yj.earth.business.domain.RoleMenu">
|
||||
<id column="id" property="id" />
|
||||
<result column="role_id" property="roleId" />
|
||||
<result column="menu" property="menu" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, role_id, menu, created_at, updated_at
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
19
src/main/resources/mapper/RoleOperateMapper.xml
Normal file
19
src/main/resources/mapper/RoleOperateMapper.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?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.yj.earth.business.mapper.RoleOperateMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.yj.earth.business.domain.RoleOperate">
|
||||
<id column="id" property="id" />
|
||||
<result column="role_id" property="roleId" />
|
||||
<result column="operate" property="operate" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, role_id, operate, created_at, updated_at
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
20
src/main/resources/mapper/TsPlanMapper.xml
Normal file
20
src/main/resources/mapper/TsPlanMapper.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?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.yj.earth.business.mapper.TsPlanMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.yj.earth.business.domain.TsPlan">
|
||||
<id column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="desc" property="desc" />
|
||||
<result column="created_by" property="createdBy" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, name, desc, created_by, created_at, updated_at
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user