mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-22 20:54:25 +08:00
♻️ Refactoring code.调整部分字段,支持多数据源
This commit is contained in:
parent
dfe77b1f68
commit
1caf3134dc
@ -3,39 +3,165 @@ SET FOREIGN_KEY_CHECKS=0;
|
||||
-- 核心库
|
||||
USE `pig`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `dept_id` bigint NOT NULL FIRST;
|
||||
-- 修正老数据
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `parent_id` bigint NULL DEFAULT NULL COMMENT '父节点' AFTER `del_flag`;
|
||||
update `sys_dept` set create_by='' where create_by is null ;
|
||||
|
||||
ALTER TABLE `sys_dept_relation` MODIFY COLUMN `ancestor` bigint NOT NULL COMMENT '祖先节点' FIRST;
|
||||
update `sys_dept` set update_by='' where update_by is null ;
|
||||
|
||||
ALTER TABLE `sys_dept_relation` MODIFY COLUMN `descendant` bigint NOT NULL COMMENT '后代节点' AFTER `ancestor`;
|
||||
update `sys_dept` set create_time=NOW() where create_time is null ;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `id` bigint NOT NULL COMMENT '编号' FIRST;
|
||||
update `sys_dept` set update_time=NOW() where update_time is null ;
|
||||
|
||||
ALTER TABLE `sys_dict_item` MODIFY COLUMN `id` bigint NOT NULL COMMENT '编号' FIRST;
|
||||
update `sys_dict` set create_by='' where create_by is null ;
|
||||
|
||||
ALTER TABLE `sys_dict_item` MODIFY COLUMN `dict_id` bigint NOT NULL COMMENT '字典ID' AFTER `id`;
|
||||
update `sys_dict` set update_by='' where update_by is null ;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `id` bigint NOT NULL COMMENT '编号' FIRST;
|
||||
update `sys_dict` set create_time=NOW() where create_time is null ;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `id` bigint NOT NULL COMMENT '编号' FIRST;
|
||||
update `sys_dict` set update_time=NOW() where update_time is null ;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `menu_id` bigint NOT NULL COMMENT '菜单ID' FIRST;
|
||||
UPDATE `sys_dict` SET `type` = 'dict_type', `description` = '字典类型', `remarks` = '', `system` = '1', `del_flag` = '0', `create_time` = '2019-05-16 14:16:20', `create_by` = '', `update_by` = 'admin', `update_time` = '2021-12-29 12:29:18' WHERE `id` = 1;
|
||||
|
||||
ALTER TABLE `sys_role` MODIFY COLUMN `role_id` bigint NOT NULL FIRST;
|
||||
UPDATE `sys_dict` SET `type` = 'log_type', `description` = '日志类型', `remarks` = '', `system` = '1', `del_flag` = '0', `create_time` = '2020-03-13 14:21:01', `create_by` = '', `update_by` = 'admin', `update_time` = '2021-12-29 12:30:14' WHERE `id` = 2;
|
||||
|
||||
ALTER TABLE `sys_role_menu` MODIFY COLUMN `role_id` bigint NOT NULL COMMENT '角色ID' FIRST;
|
||||
UPDATE `sys_dict` SET `type` = 'ds_type', `description` = '驱动类型', `remarks` = '', `system` = '1', `del_flag` = '0', `create_time` = '2021-10-15 16:24:35', `create_by` = '', `update_by` = 'admin', `update_time` = '2021-12-29 12:30:18' WHERE `id` = 3;
|
||||
|
||||
ALTER TABLE `sys_role_menu` MODIFY COLUMN `menu_id` bigint NOT NULL COMMENT '菜单ID' AFTER `role_id`;
|
||||
update `sys_menu` set create_by='' where create_by is null ;
|
||||
|
||||
ALTER TABLE `sys_user` MODIFY COLUMN `user_id` bigint NOT NULL COMMENT '主键ID' FIRST;
|
||||
update `sys_menu` set update_by='' where update_by is null ;
|
||||
|
||||
ALTER TABLE `sys_user` MODIFY COLUMN `dept_id` bigint NULL DEFAULT NULL COMMENT '部门ID' AFTER `avatar`;
|
||||
update `sys_menu` set create_time=NOW() where create_time is null ;
|
||||
|
||||
ALTER TABLE `sys_user_role` MODIFY COLUMN `user_id` bigint NOT NULL COMMENT '用户ID' FIRST;
|
||||
update `sys_menu` set update_time=NOW() where update_time is null ;
|
||||
|
||||
ALTER TABLE `sys_user_role` MODIFY COLUMN `role_id` bigint NOT NULL COMMENT '角色ID' AFTER `user_id`;
|
||||
-- 变更表结构
|
||||
|
||||
ALTER TABLE `sys_dept` ADD COLUMN `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序' AFTER `name`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '部门名称' AFTER `dept_id`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否删除 -1:已删除 0:正常' AFTER `sort_order`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `parent_id` bigint NOT NULL COMMENT '父节点' AFTER `del_flag`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `create_time` datetime NOT NULL COMMENT '创建时间' AFTER `parent_id`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人' AFTER `create_time`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `update_time` datetime NOT NULL COMMENT '修改时间' AFTER `create_by`;
|
||||
|
||||
ALTER TABLE `sys_dept` MODIFY COLUMN `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '更新人' AFTER `update_time`;
|
||||
|
||||
ALTER TABLE `sys_dept` DROP COLUMN `sort`;
|
||||
|
||||
ALTER TABLE `sys_dict` ADD COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注' AFTER `description`;
|
||||
|
||||
ALTER TABLE `sys_dict` ADD COLUMN `system_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否是系统内置' AFTER `remark`;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类型' AFTER `id`;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述' AFTER `type`;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标记' AFTER `system_flag`;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `create_time` datetime NOT NULL COMMENT '创建时间' AFTER `del_flag`;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人' AFTER `create_time`;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人' AFTER `create_by`;
|
||||
|
||||
ALTER TABLE `sys_dict` MODIFY COLUMN `update_time` datetime NOT NULL COMMENT '更新时间' AFTER `update_by`;
|
||||
|
||||
ALTER TABLE `sys_dict` DROP COLUMN `remarks`;
|
||||
|
||||
ALTER TABLE `sys_dict` DROP COLUMN `system`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` ADD COLUMN `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序(升序)' AFTER `description`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` ADD COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注' AFTER `sort_order`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` MODIFY COLUMN `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '值' AFTER `dict_id`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` MODIFY COLUMN `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '标签' AFTER `value`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` MODIFY COLUMN `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典类型' AFTER `label`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` MODIFY COLUMN `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述' AFTER `type`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` DROP COLUMN `sort`;
|
||||
|
||||
ALTER TABLE `sys_dict_item` DROP COLUMN `remarks`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `file_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL AFTER `id`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `bucket_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL AFTER `file_name`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `original` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL AFTER `bucket_name`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL AFTER `original`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `file_size` bigint NOT NULL COMMENT '文件大小' AFTER `type`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除' AFTER `file_size`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `create_time` datetime NOT NULL COMMENT '创建时间' AFTER `del_flag`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `update_time` datetime NOT NULL COMMENT '修改时间' AFTER `create_time`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建者' AFTER `update_time`;
|
||||
|
||||
ALTER TABLE `sys_file` MODIFY COLUMN `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人' AFTER `create_by`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '日志类型' AFTER `id`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '日志标题' AFTER `type`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `service_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '服务ID' AFTER `title`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `remote_addr` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作IP地址' AFTER `service_id`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `user_agent` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户代理' AFTER `remote_addr`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `request_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '请求URI' AFTER `user_agent`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作方式' AFTER `request_uri`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作提交的数据' AFTER `method`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `time` bigint NOT NULL DEFAULT 0 COMMENT '执行时间' AFTER `params`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标记' AFTER `time`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `exception` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '异常信息' AFTER `del_flag`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `create_time` datetime NOT NULL COMMENT '创建时间' AFTER `exception`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `update_time` datetime NOT NULL COMMENT '更新时间' AFTER `create_time`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人' AFTER `update_time`;
|
||||
|
||||
ALTER TABLE `sys_log` MODIFY COLUMN `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '更新人' AFTER `create_by`;
|
||||
|
||||
ALTER TABLE `sys_menu` ADD COLUMN `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序值' AFTER `icon`;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `keep_alive` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '0-开启,1- 关闭' AFTER `sort`;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单类型 (0菜单 1按钮)' AFTER `keep_alive`;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '逻辑删除标记(0--正常 1--删除)' AFTER `type`;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '创建人' AFTER `del_flag`;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `create_time` datetime NOT NULL COMMENT '创建时间' AFTER `create_by`;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '修改人' AFTER `create_time`;
|
||||
|
||||
ALTER TABLE `sys_menu` MODIFY COLUMN `update_time` datetime NOT NULL COMMENT '更新时间' AFTER `update_by`;
|
||||
|
||||
ALTER TABLE `sys_menu` DROP COLUMN `sort`;
|
||||
|
||||
ALTER TABLE `sys_menu` DROP COLUMN `component`;
|
||||
|
||||
-- 代码生成器
|
||||
USE `pig_codegen`;
|
||||
|
@ -26,6 +26,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -50,14 +51,15 @@ public class SysDept extends BaseEntity {
|
||||
* 部门名称
|
||||
*/
|
||||
@NotBlank(message = "部门名称不能为空")
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
@ApiModelProperty(value = "部门名称", required = true)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty(value = "排序值")
|
||||
private Integer sort;
|
||||
@NotNull(message = "部门排序值不能为空")
|
||||
@ApiModelProperty(value = "排序值", required = true)
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 父级部门id
|
||||
|
@ -60,15 +60,14 @@ public class SysDict extends BaseEntity {
|
||||
/**
|
||||
* 是否是系统内置
|
||||
*/
|
||||
@TableField(value = "`system`")
|
||||
@ApiModelProperty(value = "是否系统内置")
|
||||
private String system;
|
||||
private String systemFlag;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@ApiModelProperty(value = "备注信息")
|
||||
private String remarks;
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
|
@ -78,13 +78,13 @@ public class SysDictItem extends BaseEntity {
|
||||
* 排序(升序)
|
||||
*/
|
||||
@ApiModelProperty(value = "排序值,默认升序")
|
||||
private Integer sort;
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@ApiModelProperty(value = "备注信息")
|
||||
private String remarks;
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
|
@ -84,7 +84,7 @@ public class SysMenu extends BaseEntity {
|
||||
* 排序值
|
||||
*/
|
||||
@ApiModelProperty(value = "排序值")
|
||||
private Integer sort;
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 菜单类型 (0菜单 1按钮)
|
||||
|
@ -92,7 +92,7 @@ public class DeptController {
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("删除部门")
|
||||
@DeleteMapping("/{id}")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_del')")
|
||||
public R removeById(@PathVariable Long id) {
|
||||
return R.ok(sysDeptService.removeDeptById(id));
|
||||
@ -127,7 +127,7 @@ public class DeptController {
|
||||
* @return 返回子级id列表
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping(value = "/child-id/{deptId}")
|
||||
@GetMapping(value = "/child-id/{deptId:\\d+}")
|
||||
public R<List<Long>> listChildDeptId(@PathVariable Long deptId) {
|
||||
return R.ok(sysDeptService.listChildDeptId(deptId));
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class DictController {
|
||||
* @param id ID
|
||||
* @return 字典信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@GetMapping("/{id:\\d+}")
|
||||
public R getById(@PathVariable Long id) {
|
||||
return R.ok(sysDictService.getById(id));
|
||||
}
|
||||
@ -102,7 +102,7 @@ public class DictController {
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("删除字典")
|
||||
@DeleteMapping("/{id}")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_dict_del')")
|
||||
public R removeById(@PathVariable Long id) {
|
||||
sysDictService.removeDict(id);
|
||||
@ -138,7 +138,7 @@ public class DictController {
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/item/{id}")
|
||||
@GetMapping("/item/{id:\\d+}")
|
||||
public R getDictItemById(@PathVariable("id") Long id) {
|
||||
return R.ok(sysDictItemService.getById(id));
|
||||
}
|
||||
@ -173,7 +173,7 @@ public class DictController {
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("删除字典项")
|
||||
@DeleteMapping("/item/{id}")
|
||||
@DeleteMapping("/item/{id:\\d+}")
|
||||
public R removeDictItemById(@PathVariable Long id) {
|
||||
sysDictItemService.removeDictItem(id);
|
||||
return R.ok();
|
||||
|
@ -69,7 +69,7 @@ public class FileController {
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除文件管理", notes = "通过id删除文件管理")
|
||||
@SysLog("删除文件管理")
|
||||
@DeleteMapping("/{id}")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_file_del')")
|
||||
public R removeById(@PathVariable Long id) {
|
||||
return R.ok(sysFileService.deleteFile(id));
|
||||
|
@ -62,7 +62,7 @@ public class LogController {
|
||||
* @param id ID
|
||||
* @return success/false
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_log_del')")
|
||||
public R removeById(@PathVariable Long id) {
|
||||
return R.ok(sysLogService.removeById(id));
|
||||
|
@ -50,7 +50,7 @@ public class RoleController {
|
||||
* @param id ID
|
||||
* @return 角色信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@GetMapping("/{id:\\d+}")
|
||||
public R getById(@PathVariable Long id) {
|
||||
return R.ok(sysRoleService.getById(id));
|
||||
}
|
||||
@ -85,7 +85,7 @@ public class RoleController {
|
||||
* @return
|
||||
*/
|
||||
@SysLog("删除角色")
|
||||
@DeleteMapping("/{id}")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_del')")
|
||||
public R removeById(@PathVariable Long id) {
|
||||
return R.ok(sysRoleService.removeRoleById(id));
|
||||
|
@ -102,7 +102,7 @@ public class UserController {
|
||||
* @param id ID
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@GetMapping("/{id:\\d+}")
|
||||
public R user(@PathVariable Long id) {
|
||||
return R.ok(userService.getUserVoById(id));
|
||||
}
|
||||
@ -125,7 +125,7 @@ public class UserController {
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("删除用户信息")
|
||||
@DeleteMapping("/{id}")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_user_del')")
|
||||
public R userDel(@PathVariable Long id) {
|
||||
SysUser sysUser = userService.getById(id);
|
||||
|
@ -146,12 +146,12 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
*/
|
||||
private List<Tree<Long>> getDeptTree(List<SysDept> depts) {
|
||||
List<TreeNode<Long>> collect = depts.stream().filter(dept -> dept.getDeptId().intValue() != dept.getParentId())
|
||||
.sorted(Comparator.comparingInt(SysDept::getSort)).map(dept -> {
|
||||
.sorted(Comparator.comparingInt(SysDept::getSortOrder)).map(dept -> {
|
||||
TreeNode<Long> treeNode = new TreeNode();
|
||||
treeNode.setId(dept.getDeptId());
|
||||
treeNode.setParentId(dept.getParentId());
|
||||
treeNode.setName(dept.getName());
|
||||
treeNode.setWeight(dept.getSort());
|
||||
treeNode.setWeight(dept.getSortOrder());
|
||||
// 扩展属性
|
||||
Map<String, Object> extra = new HashMap<>(4);
|
||||
extra.put("createTime", dept.getCreateTime());
|
||||
|
@ -52,7 +52,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
|
||||
SysDictItem dictItem = this.getById(id);
|
||||
SysDict dict = dictService.getById(dictItem.getDictId());
|
||||
// 系统内置
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystem()), "系统内置字典项目不能删除");
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystemFlag()), "系统内置字典项目不能删除");
|
||||
this.removeById(id);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
|
||||
// 查询字典
|
||||
SysDict dict = dictService.getById(item.getDictId());
|
||||
// 系统内置
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystem()), "系统内置字典项目不能修改");
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystemFlag()), "系统内置字典项目不能修改");
|
||||
this.updateById(item);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
public void removeDict(Long id) {
|
||||
SysDict dict = this.getById(id);
|
||||
// 系统内置
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystem()), "系统内置字典项目不能删除");
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystemFlag()), "系统内置字典项目不能删除");
|
||||
baseMapper.deleteById(id);
|
||||
dictItemMapper.delete(Wrappers.<SysDictItem>lambdaQuery().eq(SysDictItem::getDictId, id));
|
||||
}
|
||||
@ -67,7 +67,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
public void updateDict(SysDict dict) {
|
||||
SysDict sysDict = this.getById(dict.getId());
|
||||
// 系统内置
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(sysDict.getSystem()), "系统内置字典项目不能修改");
|
||||
Assert.state(!DictTypeEnum.SYSTEM.getType().equals(sysDict.getSystemFlag()), "系统内置字典项目不能修改");
|
||||
this.updateById(dict);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
public List<Tree<Long>> treeMenu(boolean lazy, Long parentId) {
|
||||
if (!lazy) {
|
||||
List<TreeNode<Long>> collect = baseMapper
|
||||
.selectList(Wrappers.<SysMenu>lambdaQuery().orderByAsc(SysMenu::getSort)).stream()
|
||||
.selectList(Wrappers.<SysMenu>lambdaQuery().orderByAsc(SysMenu::getSortOrder)).stream()
|
||||
.map(getNodeFunction()).collect(Collectors.toList());
|
||||
|
||||
return TreeUtil.build(collect, CommonConstants.MENU_TREE_ROOT_ID);
|
||||
@ -110,8 +110,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId;
|
||||
|
||||
List<TreeNode<Long>> collect = baseMapper
|
||||
.selectList(
|
||||
Wrappers.<SysMenu>lambdaQuery().eq(SysMenu::getParentId, parent).orderByAsc(SysMenu::getSort))
|
||||
.selectList(Wrappers.<SysMenu>lambdaQuery().eq(SysMenu::getParentId, parent)
|
||||
.orderByAsc(SysMenu::getSortOrder))
|
||||
.stream().map(getNodeFunction()).collect(Collectors.toList());
|
||||
|
||||
return TreeUtil.build(collect, parent);
|
||||
@ -139,7 +139,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
node.setId(menu.getMenuId());
|
||||
node.setName(menu.getName());
|
||||
node.setParentId(menu.getParentId());
|
||||
node.setWeight(menu.getSort());
|
||||
node.setWeight(menu.getSortOrder());
|
||||
// 扩展属性
|
||||
Map<String, Object> extra = new HashMap<>();
|
||||
extra.put("icon", menu.getIcon());
|
||||
@ -147,7 +147,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
extra.put("type", menu.getType());
|
||||
extra.put("permission", menu.getPermission());
|
||||
extra.put("label", menu.getName());
|
||||
extra.put("sort", menu.getSort());
|
||||
extra.put("sortOrder", menu.getSortOrder());
|
||||
extra.put("keepAlive", menu.getKeepAlive());
|
||||
node.setExtra(extra);
|
||||
return node;
|
||||
|
@ -17,28 +17,32 @@
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pig4cloud.pig.admin.mapper.SysDeptMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.pig4cloud.pig.admin.api.entity.SysDept">
|
||||
<id column="dept_id" property="deptId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="sort_order" property="sortOrder"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
dept_id AS deptId, parent_id AS parentId, name, sort, create_time AS createTime, update_time AS updateTime, del_flag AS delFlag
|
||||
</sql>
|
||||
|
||||
<!--关联查询部门列表-->
|
||||
<select id="listDepts" resultType="com.pig4cloud.pig.admin.api.entity.SysDept">
|
||||
SELECT
|
||||
t.*
|
||||
FROM
|
||||
sys_dept t
|
||||
LEFT JOIN sys_dept_relation dr ON t.dept_id = dr.descendant
|
||||
<select id="listDepts" resultMap="BaseResultMap">
|
||||
SELECT t.dept_id,
|
||||
t.name,
|
||||
t.sort_order,
|
||||
t.del_flag,
|
||||
t.parent_id,
|
||||
t.create_time,
|
||||
t.create_by,
|
||||
t.update_time,
|
||||
t.update_by
|
||||
FROM sys_dept t
|
||||
LEFT JOIN sys_dept_relation dr ON t.dept_id = dr.descendant
|
||||
WHERE dr.ancestor = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.pig4cloud.pig.admin.mapper.SysDictItemMapper">
|
||||
|
||||
<resultMap id="sysDictItemMap" type="com.pig4cloud.pig.admin.api.entity.SysDictItem">
|
||||
<id property="id" column="id"/>
|
||||
<result property="dictId" column="dict_id"/>
|
||||
<result property="value" column="value"/>
|
||||
<result property="label" column="label"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.pig4cloud.pig.admin.mapper.SysDictMapper">
|
||||
|
||||
<resultMap id="sysDictMap" type="com.pig4cloud.pig.admin.api.entity.SysDict">
|
||||
<id property="id" column="id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
~
|
||||
~ Redistribution and use in source and binary forms, with or without
|
||||
~ modification, are permitted provided that the following conditions are met:
|
||||
~
|
||||
~ Redistributions of source code must retain the above copyright notice,
|
||||
~ this list of conditions and the following disclaimer.
|
||||
~ Redistributions in binary form must reproduce the above copyright
|
||||
~ notice, this list of conditions and the following disclaimer in the
|
||||
~ documentation and/or other materials provided with the distribution.
|
||||
~ Neither the name of the pig4cloud.com developer nor the names of its
|
||||
~ contributors may be used to endorse or promote products derived from
|
||||
~ this software without specific prior written permission.
|
||||
~ Author: lengleng (wangiegie@gmail.com)
|
||||
~
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.pig4cloud.pig.admin.mapper.SysFileMapper">
|
||||
|
||||
</mapper>
|
@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.pig4cloud.pig.admin.mapper.SysLogMapper">
|
||||
|
||||
<resultMap id="sysLogMap" type="com.pig4cloud.pig.admin.api.entity.SysLog">
|
||||
<id property="id" column="id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="serviceId" column="service_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remoteAddr" column="remote_addr"/>
|
||||
<result property="userAgent" column="user_agent"/>
|
||||
<result property="requestUri" column="request_uri"/>
|
||||
<result property="method" column="method"/>
|
||||
<result property="params" column="params"/>
|
||||
<result property="time" column="time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="exception" column="exception"/>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -17,7 +17,6 @@
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pig4cloud.pig.admin.mapper.SysMenuMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.pig4cloud.pig.admin.api.entity.SysMenu">
|
||||
<id column="menu_id" property="menuId"/>
|
||||
@ -26,25 +25,36 @@
|
||||
<result column="path" property="path"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="icon" property="icon"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="sort_order" property="sortOrder"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="keep_alive" property="keepAlive"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<!--通过角色查询菜单信息-->
|
||||
<select id="listMenusByRoleId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
sys_menu.*
|
||||
FROM
|
||||
sys_menu
|
||||
LEFT JOIN sys_role_menu ON sys_menu.menu_id = sys_role_menu.menu_id
|
||||
WHERE
|
||||
sys_menu.del_flag = 0
|
||||
AND sys_role_menu.role_id = #{roleId}
|
||||
ORDER BY
|
||||
sys_menu.sort DESC
|
||||
SELECT sys_menu.menu_id,
|
||||
sys_menu.name,
|
||||
sys_menu.permission,
|
||||
sys_menu.path,
|
||||
sys_menu.parent_id,
|
||||
sys_menu.icon,
|
||||
sys_menu.sort_order,
|
||||
sys_menu.keep_alive,
|
||||
sys_menu.type,
|
||||
sys_menu.del_flag,
|
||||
sys_menu.create_by,
|
||||
sys_menu.create_time,
|
||||
sys_menu.update_by,
|
||||
sys_menu.update_time
|
||||
FROM sys_menu
|
||||
LEFT JOIN sys_role_menu ON sys_menu.menu_id = sys_role_menu.menu_id
|
||||
WHERE sys_menu.del_flag = 0
|
||||
AND sys_role_menu.role_id = #{roleId}
|
||||
ORDER BY sys_menu.sort DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.pig4cloud.pig.admin.mapper.SysOauthClientDetailsMapper">
|
||||
|
||||
<resultMap id="sysOauthClientDetailsMap" type="com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails">
|
||||
<id property="clientId" column="client_id"/>
|
||||
<result property="resourceIds" column="resource_ids"/>
|
||||
<result property="clientSecret" column="client_secret"/>
|
||||
<result property="scope" column="scope"/>
|
||||
<result property="authorizedGrantTypes" column="authorized_grant_types"/>
|
||||
<result property="webServerRedirectUri" column="web_server_redirect_uri"/>
|
||||
<result property="authorities" column="authorities"/>
|
||||
<result property="accessTokenValidity" column="access_token_validity"/>
|
||||
<result property="refreshTokenValidity" column="refresh_token_validity"/>
|
||||
<result property="additionalInformation" column="additional_information"/>
|
||||
<result property="autoapprove" column="autoapprove"/>
|
||||
</resultMap>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user