角色,权限,关系,Mybatis-plus
This commit is contained in:
parent
18c72d0d08
commit
3ec5a7d993
|
|
@ -0,0 +1,23 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class EdMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "gmtCreate", LocalDateTime.class, LocalDateTime.now());
|
||||
this.strictInsertFill(metaObject, "gmtModified", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.strictUpdateFill(metaObject, "gmtModified", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/permission")
|
||||
public class PermissionController {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/role")
|
||||
public class RoleController {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.Permission;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface PermissionMapper extends BaseMapper<Permission> {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.Role;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.RolePermission;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RolePermissionMapper extends BaseMapper<RolePermission> {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.UserRole;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserRoleMapper extends BaseMapper<UserRole> {
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("ed_permission")
|
||||
public class Permission {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 权限描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("ed_role") // 指定表名
|
||||
public class Role {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
*/
|
||||
private String roleDesc;
|
||||
|
||||
/**
|
||||
* 角色状态
|
||||
*/
|
||||
private String roleStatus;
|
||||
|
||||
/**
|
||||
* 创建者用户编码
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
/**
|
||||
* 编辑者用户编码
|
||||
*/
|
||||
private String modifier;
|
||||
|
||||
/**
|
||||
* 编辑者姓名
|
||||
*/
|
||||
private String modifierName;
|
||||
|
||||
/**
|
||||
* 编辑时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime gmtModified;
|
||||
|
||||
/**
|
||||
* 是否有效:0-无效 1-有效
|
||||
*/
|
||||
private Integer effectFlag;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("ed_role_permission")
|
||||
public class RolePermission {
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 文件编码
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 权限编码
|
||||
*/
|
||||
private String permissionId;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("ed_user_role")
|
||||
public class UserRole {
|
||||
|
||||
/**
|
||||
* 用户编码
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleId;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.Permission;
|
||||
|
||||
public interface PermissionService extends IService<Permission> {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.Role;
|
||||
|
||||
public interface RoleService extends IService<Role> {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.electromagnetic.industry.software.manage.mapper.PermissionMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.Permission;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.electromagnetic.industry.software.manage.mapper.RoleMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.Role;
|
||||
import com.electromagnetic.industry.software.manage.service.RoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue