商城模块-通用系统模块
This commit is contained in:
parent
d78d569d78
commit
cf8a3d3f84
@ -0,0 +1,43 @@
|
||||
package com.cpop.core.abstracts;
|
||||
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.base.table.SysUser;
|
||||
import com.cpop.core.gateway.sys.SysLoginInfoBuild;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 11:26
|
||||
* @description
|
||||
*/
|
||||
public abstract class AbstractLoginInfoBuild {
|
||||
|
||||
/**
|
||||
* @descriptions 构建用户信息
|
||||
* @author DB
|
||||
* @date 2023/10/19 12:50
|
||||
* @param userType 用户类型
|
||||
* @return: com.cpop.core.abstracts.AbstractLoginInfoBuild
|
||||
*/
|
||||
public static AbstractLoginInfoBuild getInstance(UserType userType){
|
||||
switch (userType){
|
||||
//系统用户
|
||||
case OAM_USER:
|
||||
case MALL_USER:
|
||||
return new SysLoginInfoBuild();
|
||||
//小程序用户
|
||||
case MINI_USER:
|
||||
return new SysLoginInfoBuild();
|
||||
default:
|
||||
return new SysLoginInfoBuild();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建用户
|
||||
*/
|
||||
public abstract LoginUser buildLoginUser(SysUser user);
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.cpop.core.base.entity;
|
||||
|
||||
/**
|
||||
* 权限组
|
||||
*/
|
||||
public class Permission {
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
public String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.cpop.core.base.entity.loginInfo;
|
||||
|
||||
import com.cpop.core.base.table.SysUser;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 13:10
|
||||
* @description 商城管理员工登陆信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MallStaffLoginInfo extends SysUser {
|
||||
|
||||
/**
|
||||
* 员工id(mallStaffId)
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private String roleId;
|
||||
}
|
||||
@ -16,7 +16,11 @@ public enum UserType {
|
||||
/**
|
||||
* 小程序用户
|
||||
*/
|
||||
MINI_USER(1, "mini:loginUser:");
|
||||
MINI_USER(1, "mini:loginUser:"),
|
||||
/**
|
||||
* 商城用户
|
||||
*/
|
||||
MALL_USER(2, "mall:loginUser:");
|
||||
|
||||
/**
|
||||
* code
|
||||
|
||||
@ -7,6 +7,8 @@ import com.cpop.core.filter.RepeatableFilter;
|
||||
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationFilter;
|
||||
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationProvider;
|
||||
import com.cpop.core.gateway.oam.OamUsernamePasswordAuthenticationFilter;
|
||||
import com.cpop.core.gateway.sys.SysAuthenticationFilter;
|
||||
import com.cpop.core.gateway.sys.SysAuthenticationProvider;
|
||||
import com.cpop.core.handler.*;
|
||||
import com.cpop.core.service.impl.OamStaffDetailsServiceImpl;
|
||||
import com.cpop.core.utils.JwtUtils;
|
||||
@ -101,8 +103,7 @@ public class SecurityConfig implements WebMvcConfigurer {
|
||||
})
|
||||
//异常处理器
|
||||
.exceptionHandling(exceptionHandling -> {
|
||||
exceptionHandling.authenticationEntryPoint(jwtAuthenticationEntryPoint)
|
||||
.accessDeniedHandler(jwtAccessDeniedHandler);
|
||||
exceptionHandling.authenticationEntryPoint(jwtAuthenticationEntryPoint).accessDeniedHandler(jwtAccessDeniedHandler);
|
||||
})
|
||||
//自定义认证管理器
|
||||
.authenticationManager(authenticationManager())
|
||||
@ -110,7 +111,9 @@ public class SecurityConfig implements WebMvcConfigurer {
|
||||
.addFilterBefore(repeatableFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加 JWT 过滤器,JWT 过滤器在退出认证过滤器之前
|
||||
.addFilterBefore(authFilter(), LogoutFilter.class)
|
||||
.addFilterAt(oamLoginFilter(http.getSharedObject(AuthenticationManager.class)), UsernamePasswordAuthenticationFilter.class)
|
||||
//.addFilterAt(oamLoginFilter(http.getSharedObject(AuthenticationManager.class)), UsernamePasswordAuthenticationFilter.class)
|
||||
//系统登陆
|
||||
.addFilterAt(sysAuthenticationFilter(http.getSharedObject(AuthenticationManager.class)), UsernamePasswordAuthenticationFilter.class)
|
||||
//小程序认证
|
||||
.addFilterAt(miniProgramAuthenticationFilter(http.getSharedObject(AuthenticationManager.class)), UsernamePasswordAuthenticationFilter.class);
|
||||
return http.build();
|
||||
@ -146,6 +149,27 @@ public class SecurityConfig implements WebMvcConfigurer {
|
||||
return authProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 小程序登陆认证方式(可自定义其他模式)
|
||||
* @param authenticationManager 认证管理器
|
||||
* @return MiniProgramAuthenticationFilter
|
||||
* @author DB
|
||||
* @Date: 2023/8/24 0024 10:43
|
||||
*/
|
||||
@Bean
|
||||
public SysAuthenticationFilter sysAuthenticationFilter(AuthenticationManager authenticationManager) {
|
||||
SysAuthenticationFilter filter = new SysAuthenticationFilter();
|
||||
filter.setAuthenticationManager(authenticationManager);
|
||||
filter.setAuthenticationSuccessHandler(loginSuccessHandler);
|
||||
filter.setAuthenticationFailureHandler(loginFailureHandler);
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SysAuthenticationProvider sysAuthenticationProvider() {
|
||||
return new SysAuthenticationProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 小程序登陆认证方式(可自定义其他模式)
|
||||
* @param authenticationManager 认证管理器
|
||||
@ -173,7 +197,7 @@ public class SecurityConfig implements WebMvcConfigurer {
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager() {
|
||||
return new ProviderManager(Arrays.asList(authenticationProvider(), miniProgramAuthenticationProvider()));
|
||||
return new ProviderManager(Arrays.asList(authenticationProvider(), miniProgramAuthenticationProvider(), sysAuthenticationProvider()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -7,6 +7,8 @@ import com.cpop.common.utils.ip.IpUtils;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken;
|
||||
import com.cpop.core.gateway.sys.SysAuthenticationToken;
|
||||
import com.cpop.core.service.CoreService;
|
||||
import com.cpop.core.service.RedisService;
|
||||
import com.cpop.core.service.impl.OamStaffDetailsServiceImpl;
|
||||
import com.cpop.core.utils.JwtUtils;
|
||||
@ -39,6 +41,9 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
@Autowired
|
||||
private OamStaffDetailsServiceImpl oamStaffDetailsService;
|
||||
|
||||
@Autowired
|
||||
private CoreService coreService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@ -95,6 +100,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
break;
|
||||
case MINI_USER:
|
||||
break;
|
||||
case MALL_USER:
|
||||
loginUser = coreService.loadUser(username, userType);
|
||||
default:
|
||||
}
|
||||
return loginUser;
|
||||
@ -118,6 +125,10 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
MiniProgramAuthenticationToken miniProgramAuthenticationToken = new MiniProgramAuthenticationToken(username, loginUser);
|
||||
SecurityContextHolder.getContext().setAuthentication(miniProgramAuthenticationToken);
|
||||
break;
|
||||
case MALL_USER:
|
||||
//构建通用系统用户登陆
|
||||
SysAuthenticationToken sysAuthenticationToken = new SysAuthenticationToken(username, loginUser,null);
|
||||
SecurityContextHolder.getContext().setAuthentication(sysAuthenticationToken);
|
||||
default:
|
||||
}
|
||||
|
||||
|
||||
@ -22,8 +22,7 @@ public class MiniProgramAuthenticationProvider implements AuthenticationProvider
|
||||
//TODO:此处添加小程序认证失败返回 throw new RockBladeAuthenticationException("测试抛异常", UserType.MINI_USER);
|
||||
//设置用户详情
|
||||
LoginUser loginUser = new LoginUser();
|
||||
loginUser.setUserName(username)
|
||||
.setUserType(UserType.MINI_USER);
|
||||
loginUser.setUserName(username).setUserType(UserType.MINI_USER);
|
||||
MiniProgramAuthenticationToken result = new MiniProgramAuthenticationToken(username, loginUser);
|
||||
result.setDetails(loginUser);
|
||||
return result;
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
package com.cpop.core.gateway.sys;
|
||||
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
import org.springframework.security.authentication.AuthenticationServiceException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 9:27
|
||||
* @description
|
||||
*/
|
||||
public class SysAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
|
||||
|
||||
public SysAuthenticationFilter() {
|
||||
super(new AntPathRequestMatcher("/login", "POST"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
|
||||
if (!"POST".equals(request.getMethod())) {
|
||||
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
|
||||
}
|
||||
//读取表单
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
InputStream inputStream;
|
||||
Map authenticationBean;
|
||||
try {
|
||||
inputStream = request.getInputStream();
|
||||
authenticationBean = mapper.readValue(inputStream, Map.class);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String principal = (String) authenticationBean.get("username");
|
||||
String password = (String) authenticationBean.get("password");
|
||||
UserType userType = UserType.valueOf(authenticationBean.get("userType").toString());
|
||||
principal = principal.trim();
|
||||
//传递信息
|
||||
HashMap<String, Object> credentials = new HashMap<>(2);
|
||||
credentials.put("password", password);
|
||||
credentials.put("userType", userType);
|
||||
SysAuthenticationToken authRequest = new SysAuthenticationToken(principal, credentials);
|
||||
this.setDetails(request, authRequest);
|
||||
return this.getAuthenticationManager().authenticate(authRequest);
|
||||
}
|
||||
|
||||
protected void setDetails(HttpServletRequest request, AbstractAuthenticationToken authRequest) {
|
||||
authRequest.setDetails(this.authenticationDetailsSource.buildDetails(request));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.cpop.core.gateway.sys;
|
||||
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken;
|
||||
import com.cpop.core.service.CoreService;
|
||||
import com.cpop.core.utils.PasswordEncoder;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 9:36
|
||||
* @description
|
||||
*/
|
||||
public class SysAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
// 这个获取表单输入中返回的用户名;
|
||||
String principal = (String) authentication.getPrincipal();
|
||||
// 这个是表单中输入的密码与用户类型
|
||||
Map<String,Object> credentials = (Map<String, Object>) authentication.getCredentials();
|
||||
UserType userType = (UserType) credentials.get("userType");
|
||||
//认证用户名密码
|
||||
LoginUser loginUser = SpringUtils.getBean(CoreService.class).loadUser(principal, userType);
|
||||
//账号密码校验
|
||||
SpringUtils.getBean(PasswordEncoder.class).matches((String) credentials.get("password"), loginUser.getUser().getPassword());
|
||||
SysAuthenticationToken result = new SysAuthenticationToken(principal, loginUser);
|
||||
result.setDetails(loginUser);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> authentication) {
|
||||
//providerManager会遍历所有;securityConfig中注册的provider集合;根据此方法返回true或false来决定由哪个provider;去校验请求过来的authentication
|
||||
return (SysAuthenticationToken.class.isAssignableFrom(authentication));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.cpop.core.gateway.sys;
|
||||
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 9:35
|
||||
* @description
|
||||
*/
|
||||
public class SysAuthenticationToken extends AbstractAuthenticationToken {
|
||||
|
||||
private final Object principal;
|
||||
private Object credentials;
|
||||
|
||||
/**
|
||||
* This constructor can be safely used by any code that wishes to create a
|
||||
* <code>UsernamePasswordAuthenticationToken</code>, as the {@link #isAuthenticated()}
|
||||
* will return <code>false</code>.
|
||||
*
|
||||
*/
|
||||
public SysAuthenticationToken(Object principal, Object credentials) {
|
||||
super(null);
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
setAuthenticated(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor should only be used by <code>AuthenticationManager</code> or
|
||||
* <code>AuthenticationProvider</code> implementations that are satisfied with
|
||||
* producing a trusted (i.e. {@link #isAuthenticated()} = <code>true</code>)
|
||||
* authentication token.
|
||||
*
|
||||
* @param principal 第一个参数
|
||||
* @param credentials 第二个参数
|
||||
* @param authorities 认证
|
||||
*/
|
||||
public SysAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) {
|
||||
super(authorities);
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
// must use super, as we override
|
||||
super.setAuthenticated(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return this.credentials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
|
||||
if (isAuthenticated) {
|
||||
throw new IllegalArgumentException("Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead");
|
||||
}
|
||||
super.setAuthenticated(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseCredentials() {
|
||||
super.eraseCredentials();
|
||||
credentials = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package com.cpop.core.gateway.sys;
|
||||
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.abstracts.AbstractLoginInfoBuild;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.Permission;
|
||||
import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo;
|
||||
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
|
||||
import com.cpop.core.base.exception.CpopAuthenticationException;
|
||||
import com.cpop.core.base.table.SysUser;
|
||||
import com.mybatisflex.core.row.DbChain;
|
||||
import com.mybatisflex.core.row.Row;
|
||||
import com.mybatisflex.core.row.RowUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 11:30
|
||||
* @description
|
||||
*/
|
||||
public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
|
||||
|
||||
@Override
|
||||
public LoginUser buildLoginUser(SysUser sysUser) {
|
||||
switch (sysUser.getUserType()) {
|
||||
case OAM_USER:
|
||||
return getOamStaffLoginInfo(sysUser);
|
||||
case MALL_USER:
|
||||
return getMallStaffLoginInfo(sysUser);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions Oam员工信息
|
||||
* @author DB
|
||||
* @date 2023/10/19 13:21
|
||||
* @param sysUser 系统用户
|
||||
* @return: com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo
|
||||
*/
|
||||
private LoginUser getOamStaffLoginInfo(SysUser sysUser) {
|
||||
//构建登陆员工信息
|
||||
OamStaffLoginInfo staffLoginInfo = BeanUtils.mapToClass(sysUser, OamStaffLoginInfo.class);
|
||||
staffLoginInfo.setUserId(sysUser.getId());
|
||||
//员工
|
||||
if (!staffLoginInfo.getUserName().equals(Constants.SUPER_ADMIN)) {
|
||||
Row row = DbChain.table("cp_oam_staff")
|
||||
.select()
|
||||
.where("user_id = ?", staffLoginInfo.getUserId())
|
||||
.one();
|
||||
staffLoginInfo.setDeptId(row.getString("deptId"));
|
||||
staffLoginInfo.setRoleId(row.getString("roleId"));
|
||||
staffLoginInfo.setName(row.getString("name"));
|
||||
staffLoginInfo.setStaffType(row.getInt("staffType"));
|
||||
staffLoginInfo.setId(row.getString("id"));
|
||||
}else {
|
||||
staffLoginInfo.setName(Constants.SUPER_ADMIN);
|
||||
}
|
||||
return new LoginUser(staffLoginInfo, getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions Mall员工信息
|
||||
* @author DB
|
||||
* @date 2023/10/19 13:21
|
||||
* @param sysUser 系统用户
|
||||
* @return: com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo
|
||||
*/
|
||||
private LoginUser getMallStaffLoginInfo(SysUser sysUser) {
|
||||
//构建登陆员工信息
|
||||
MallStaffLoginInfo staffLoginInfo = BeanUtils.mapToClass(sysUser, MallStaffLoginInfo.class);
|
||||
staffLoginInfo.setUserId(sysUser.getId());
|
||||
//构建员工
|
||||
if (!staffLoginInfo.getUserName().equals(Constants.SUPER_ADMIN)) {
|
||||
Row row = DbChain.table("cp_mall_staff")
|
||||
.select("cms.id", "cms.name", "cms.user_id")
|
||||
.select("cmrb.role_id")
|
||||
.from("cp_mall_staff").as("cms")
|
||||
.leftJoin("cp_mall_role_brand").as("cmrb").on("cmrb.id = cms.role_brand_id")
|
||||
.where("cms.user_id = ?", staffLoginInfo.getUserId())
|
||||
.and("cms.is_delete = 0")
|
||||
.one();
|
||||
if (row == null) {
|
||||
throw new CpopAuthenticationException("获取登陆用户信息失败,请核实!");
|
||||
}
|
||||
staffLoginInfo.setRoleId(row.getString("roleId"));
|
||||
staffLoginInfo.setName(row.getString("name"));
|
||||
staffLoginInfo.setId(row.getString("id"));
|
||||
} else {
|
||||
staffLoginInfo.setName(Constants.SUPER_ADMIN);
|
||||
}
|
||||
return new LoginUser(staffLoginInfo, getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId()));
|
||||
}
|
||||
|
||||
private Set<String> getPermissionSet(String username, String roleId) {
|
||||
//获取权限
|
||||
Set<String> permissionSet = new HashSet<>();
|
||||
if (Constants.SUPER_ADMIN.equals(username)) {
|
||||
permissionSet.add(Constants.ALL_PERMISSION);
|
||||
}
|
||||
else {
|
||||
//查询员工信息
|
||||
List<Row> list = DbChain.table("cp_sys_menu")
|
||||
.select("pom.permission")
|
||||
.from("cp_sys_menu").as("pom")
|
||||
.leftJoin("cp_sys_role_menu").as("porm").on("porm.menu_id = pom.id")
|
||||
.where("pom.type in (1,2)")
|
||||
.and("porm.role_id = ?", roleId)
|
||||
.and("pom.permission is not null")
|
||||
.list();
|
||||
if (list.isEmpty()) {
|
||||
permissionSet = new HashSet<>();
|
||||
} else {
|
||||
List<Permission> permissions = RowUtil.toEntityList(list, Permission.class);
|
||||
permissionSet = permissions.stream().map(Permission::getPermission).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
return permissionSet;
|
||||
}
|
||||
}
|
||||
@ -42,8 +42,7 @@ public class LoginFailureHandler implements AuthenticationFailureHandler {
|
||||
LoginForm loginFormBo = JSONObject.parseObject(jsonString, LoginForm.class);
|
||||
//构建用户信息
|
||||
LoginUser loginUser = new LoginUser();
|
||||
loginUser.setUserName(loginFormBo.getUsername())
|
||||
.setIpAddr(IpUtils.getIpAddr(httpServletRequest));
|
||||
loginUser.setUserName(loginFormBo.getUsername()).setIpAddr(IpUtils.getIpAddr(httpServletRequest));
|
||||
String errorMessage = "用户名或密码错误";
|
||||
R<String> result;
|
||||
//自定义认证异常,可以从这里获取到想要的参数
|
||||
@ -52,7 +51,7 @@ public class LoginFailureHandler implements AuthenticationFailureHandler {
|
||||
errorMessage = e.getMessage();
|
||||
}
|
||||
result = R.fail(errorMessage);
|
||||
if (loginUser.getUserType() == UserType.OAM_USER) {
|
||||
if (loginUser.getUserType() == UserType.OAM_USER || loginUser.getUserType() == UserType.MINI_USER) {
|
||||
//添加登录失败日志
|
||||
coreService.insertOperationLog(Constants.FAIL, OperationLogEnum.SYSTEM_LOGIN, loginUser, errorMessage);
|
||||
}
|
||||
|
||||
@ -45,8 +45,8 @@ public class LoginSuccessHandler implements AuthenticationSuccessHandler {
|
||||
ServletOutputStream outputStream = httpServletResponse.getOutputStream();
|
||||
LoginSuccess loginSuccessVo = new LoginSuccess();
|
||||
LoginUser loginUser;
|
||||
if (null != authentication.getPrincipal()) {
|
||||
loginUser = (LoginUser) authentication.getPrincipal();
|
||||
if (null != authentication.getCredentials()) {
|
||||
loginUser = (LoginUser) authentication.getCredentials();
|
||||
} else {
|
||||
loginUser = (LoginUser) authentication.getDetails();
|
||||
}
|
||||
@ -72,8 +72,9 @@ public class LoginSuccessHandler implements AuthenticationSuccessHandler {
|
||||
private void multipleLogin(LoginUser loginUser){
|
||||
switch (loginUser.getUserType()) {
|
||||
case OAM_USER:
|
||||
case MALL_USER:
|
||||
//更新登录地址
|
||||
coreService.updateSysUserLoginIp(loginUser.getIpAddr(), loginUser.getUsername());
|
||||
coreService.updateSysUserLoginIp(loginUser.getIpAddr(), loginUser.getUsername(), loginUser.getUserType());
|
||||
//添加登录成功日志
|
||||
coreService.insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGIN, loginUser, MessageUtils.message("i18n_login_success"));
|
||||
//将登录成功用户存入缓存
|
||||
|
||||
@ -42,7 +42,7 @@ public interface CoreMapper {
|
||||
* @author DB
|
||||
* @Date: 2023/8/28 0028 13:49
|
||||
*/
|
||||
void updateSysUserLoginIp(String ipAddr, String username);
|
||||
void updateSysUserLoginIp(String ipAddr, String username, UserType userType);
|
||||
|
||||
/**
|
||||
* @Description: 加载参数缓存数据
|
||||
|
||||
@ -6,6 +6,7 @@ import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.base.table.SysConfig;
|
||||
import com.cpop.core.base.table.SysOperationLog;
|
||||
import com.cpop.core.base.table.SysUser;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
@ -50,7 +51,7 @@ public interface CoreService {
|
||||
* @author DB
|
||||
* @Date: 2023/8/28 0028 13:48
|
||||
*/
|
||||
void updateSysUserLoginIp(String ipAddr, String username);
|
||||
void updateSysUserLoginIp(String ipAddr, String username, UserType userType);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
@ -108,4 +109,14 @@ public interface CoreService {
|
||||
* @return void
|
||||
*/
|
||||
void removeSysUserById(String id);
|
||||
|
||||
/**
|
||||
* @descriptions 根据用户名与用户类型获取用户信息
|
||||
* @author DB
|
||||
* @date 2023/10/19 9:57
|
||||
* @param userName 用户名
|
||||
* @param userType 用户类型
|
||||
* @return 登陆用户
|
||||
*/
|
||||
LoginUser loadUser(String userName, UserType userType);
|
||||
}
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
package com.cpop.core.service.impl;
|
||||
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.abstracts.AbstractLoginInfoBuild;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
|
||||
import com.cpop.core.base.enums.OperationLogEnum;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.base.exception.ServiceException;
|
||||
@ -12,12 +16,19 @@ import com.cpop.core.service.CoreService;
|
||||
import com.cpop.core.utils.MessageUtils;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.uuid.IdUtils;
|
||||
import com.mybatisflex.core.row.DbChain;
|
||||
import com.mybatisflex.core.row.Row;
|
||||
import com.mybatisflex.core.row.RowUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
@ -102,8 +113,8 @@ public class CoreServiceImpl implements CoreService {
|
||||
* @Date: 2023/8/28 0028 13:48
|
||||
*/
|
||||
@Override
|
||||
public void updateSysUserLoginIp(String ipAddr, String username) {
|
||||
coreMapper.updateSysUserLoginIp(ipAddr, username);
|
||||
public void updateSysUserLoginIp(String ipAddr, String username, UserType userType) {
|
||||
coreMapper.updateSysUserLoginIp(ipAddr, username, userType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,4 +204,30 @@ public class CoreServiceImpl implements CoreService {
|
||||
public void removeSysUserById(String id) {
|
||||
coreMapper.removeSysUserById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 根据用户名与用户类型获取用户信息
|
||||
* @author DB
|
||||
* @date 2023/10/19 9:57
|
||||
* @param username 用户名
|
||||
* @param userType 用户类型
|
||||
* @return 登陆用户
|
||||
*/
|
||||
@Override
|
||||
public LoginUser loadUser(String username, UserType userType) {
|
||||
//统一获取系统用户信息
|
||||
SysUser sysUser = this.getSysUser(username, userType);
|
||||
if (sysUser == null) {
|
||||
throw new UsernameNotFoundException(MessageUtils.message("i18n_alert_accountOrPwdError"));
|
||||
}
|
||||
//构建登陆用户信息
|
||||
AbstractLoginInfoBuild instance = AbstractLoginInfoBuild.getInstance(userType);
|
||||
LoginUser loginUser = instance.buildLoginUser(sysUser);
|
||||
loginUser.setUserId(sysUser.getId())
|
||||
.setUserType(userType)
|
||||
.setUserName(username)
|
||||
.setLoginTime(System.currentTimeMillis())
|
||||
.setStatus(sysUser.getStatus());
|
||||
return loginUser;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.cpop.core.service.impl;
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.Permission;
|
||||
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.base.table.SysUser;
|
||||
@ -92,22 +93,4 @@ public class OamStaffDetailsServiceImpl implements UserDetailsService {
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部自用类
|
||||
*/
|
||||
public class Permission {
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
public String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
package com.cpop.core.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.service.RedisService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
@ -37,11 +42,25 @@ public class SecurityUtils {
|
||||
if (authentication == null) {
|
||||
return null;
|
||||
}
|
||||
if (null != authentication.getPrincipal()) {
|
||||
return (LoginUser) authentication.getPrincipal();
|
||||
if (null != authentication.getCredentials()) {
|
||||
return (LoginUser) authentication.getCredentials();
|
||||
} else {
|
||||
return (LoginUser) authentication.getDetails();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 获取登陆员工信息
|
||||
* @author DB
|
||||
* @date 2023/09/21 16:00
|
||||
* @return com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo
|
||||
*/
|
||||
public JSONObject getLoginStaffInfo() {
|
||||
//获取当前登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
|
||||
//获取缓存信息
|
||||
JSONObject jsonObject = SpringUtils.getBean(RedisService.class).getCacheObject(loginUser.getUserType().getKey() + loginUser.getUsername());
|
||||
return jsonObject.getJSONObject("user");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -22,6 +22,9 @@
|
||||
login_ip = #{ipAddr}
|
||||
WHERE
|
||||
user_name = #{username}
|
||||
<if test="username != 'Cpop'">
|
||||
AND user_type = #{userType}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<!--根据用户名获取用户信息-->
|
||||
@ -49,8 +52,9 @@
|
||||
is_delete = 0
|
||||
AND
|
||||
user_name = #{username}
|
||||
AND
|
||||
user_type = #{userType}
|
||||
<if test="username != 'Cpop'">
|
||||
AND user_type = #{userType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--加载参数缓存数据-->
|
||||
@ -103,7 +107,7 @@
|
||||
<if test="configName != null and configName != ''">
|
||||
config_name = #{configName},
|
||||
</if>
|
||||
<if test="config_value != null and config_value != ''">
|
||||
<if test="configValue != null and configValue != ''">
|
||||
config_value = #{config_value},
|
||||
</if>
|
||||
<if test="configType != null and configType != ''">
|
||||
|
||||
@ -25,7 +25,7 @@ public class CpopGenerator {
|
||||
/**
|
||||
* 数据库 URL
|
||||
*/
|
||||
private static final String URL = "jdbc:mysql://localhost:3306/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||
private static final String URL = "jdbc:mysql://localhost:3306/cpop-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||
|
||||
/**
|
||||
* 数据库用户名
|
||||
@ -39,17 +39,17 @@ public class CpopGenerator {
|
||||
/**
|
||||
* 输出路径
|
||||
*/
|
||||
private static final String EXPORT_URL = "/Cpop-Oam";
|
||||
private static final String EXPORT_URL = "/Cpop-Mall";
|
||||
|
||||
/**
|
||||
* 模块
|
||||
*/
|
||||
private static final String EXPORT_ITEM = "oam";
|
||||
private static final String EXPORT_ITEM = "mall";
|
||||
|
||||
/**
|
||||
* 表前缀
|
||||
*/
|
||||
private static final String TABLE_PREFIX = "cp_oam_";
|
||||
private static final String TABLE_PREFIX = "cp_mall_";
|
||||
|
||||
/**
|
||||
* 主入口
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!--核心宝-->
|
||||
<!--核心包-->
|
||||
<dependency>
|
||||
<groupId>com.cpop</groupId>
|
||||
<artifactId>Cpop-Mall</artifactId>
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
package com.cpop.mall.web;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = {"com.cpop.**"})
|
||||
@MapperScan("com.cpop.**.mapper")
|
||||
@EnableAsync
|
||||
public class CpopMallWebApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -17,7 +17,7 @@ spring:
|
||||
application:
|
||||
name: Cpop-Mall-Dev
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/cpop-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
#redis配置
|
||||
@ -49,7 +49,7 @@ spring:
|
||||
database: cpop-union
|
||||
|
||||
server:
|
||||
port: 9420
|
||||
port: 9430
|
||||
servlet:
|
||||
context-path: /Cpop-Mall
|
||||
|
||||
@ -72,9 +72,15 @@ knife4j:
|
||||
license-url: https://stackoverflow.com/
|
||||
terms-of-service-url: https://api.jamboxsys.com
|
||||
group:
|
||||
#系统
|
||||
system:
|
||||
#商城
|
||||
Mall:
|
||||
group-name: Mall
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- com.cpop.mall
|
||||
#系统
|
||||
System:
|
||||
group-name: System
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- com.cpop.system
|
||||
@ -31,7 +31,7 @@ spring:
|
||||
max-file-size: 1024MB
|
||||
max-request-size: 300MB
|
||||
profiles:
|
||||
active: dev,mall
|
||||
active: dev,mall,system
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
@ -19,6 +19,10 @@
|
||||
<groupId>com.cpop</groupId>
|
||||
<artifactId>Cpop-Core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cpop</groupId>
|
||||
<artifactId>Cpop-System</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -0,0 +1,133 @@
|
||||
package com.cpop.mall.business.controller;
|
||||
|
||||
import com.cpop.core.annontation.OperationLog;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.core.base.enums.OperationLogEnum;
|
||||
import com.cpop.mall.business.service.RoleBrandService;
|
||||
import com.cpop.mall.business.vo.MallRolePageVo;
|
||||
import com.cpop.system.business.bo.MenuListBo;
|
||||
import com.cpop.system.business.bo.RoleBo;
|
||||
import com.cpop.system.business.bo.RolePageBo;
|
||||
import com.cpop.system.business.bo.RoleStatusBo;
|
||||
import com.cpop.system.business.service.MenuService;
|
||||
import com.cpop.system.business.service.RoleService;
|
||||
import com.cpop.system.business.vo.MenuVo;
|
||||
import com.cpop.system.business.vo.RolePageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 18:14
|
||||
* @description
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "商城角色定制模块")
|
||||
@RequestMapping("/mallRole")
|
||||
public class MallRoleController {
|
||||
|
||||
@Autowired
|
||||
private RoleBrandService roleBrandService;
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* @descriptions 查询商城角色分页列表
|
||||
* @author DB
|
||||
* @date 2023/09/10 16:51
|
||||
* @param bo 请求参数
|
||||
* @return R<PageVo<SysRolePageVo>>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:list')")
|
||||
@ApiOperation("查询商城角色分页列表")
|
||||
@GetMapping("/getMallRolePageList")
|
||||
public R<Page<MallRolePageVo>> getMallRolePageList(RolePageBo bo) {
|
||||
Page<MallRolePageVo> pageVo = roleBrandService.getMallRolePageList(bo);
|
||||
return R.ok(pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 新增角色
|
||||
* @author DB
|
||||
* @date 2023/10/12 10:48
|
||||
* @param bo 请求参数
|
||||
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:insert')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.INSERT_OAM_ROLE)
|
||||
@ApiOperation("新增商城角色")
|
||||
@PostMapping("/insertSysRole")
|
||||
public R<Void> insertSysRole(@RequestBody @Validated RoleBo bo) {
|
||||
roleService.insertSysRole(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 获取系统菜单树列表
|
||||
* @return: R<List<SysMenuVo>>
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 14:39
|
||||
**/
|
||||
@ApiOperation("获取菜单树列表")
|
||||
@GetMapping("/getSysMenuTreeList")
|
||||
public R<List<MenuVo>> getSysMenuTreeList() {
|
||||
List<MenuVo> list = menuService.getSysMenuTreeList(new MenuListBo());
|
||||
//过滤掉没有权限的数据
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 修改角色
|
||||
* @author DB
|
||||
* @date 2023/09/10 17:45
|
||||
* @param bo 请求参数
|
||||
* @return com.jambox.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:update')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE)
|
||||
@ApiOperation("修改商城角色")
|
||||
@PutMapping("/updateSysRole")
|
||||
public R<Void> updateSysRole(@RequestBody @Validated RoleBo bo) {
|
||||
roleService.updateSysRole(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统角色表
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:remove')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.REMOVE_OAM_ROLE)
|
||||
@ApiOperation("删除商城角色表")
|
||||
@DeleteMapping("/removeSysRole/{id}")
|
||||
public R<Void> removeSysRole(@PathVariable String id) {
|
||||
roleService.removeSysRole(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 设置角色状态
|
||||
* @param bo 请求参数
|
||||
* @return: R<Void>
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/9 14:13
|
||||
**/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:update')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE)
|
||||
@ApiOperation("设置商城角色状态")
|
||||
@PutMapping("/setSysRoleStatus")
|
||||
public R<Void> setSysRoleStatus(@RequestBody @Validated RoleStatusBo bo) {
|
||||
roleService.setSysRoleStatus(bo);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package com.cpop.mall.business.controller;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.cpop.mall.business.entity.Staff;
|
||||
import com.cpop.mall.business.service.StaffService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工表 控制层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "商城员工管理接口")
|
||||
@RequestMapping("/staff")
|
||||
public class StaffController {
|
||||
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
|
||||
/**
|
||||
* 添加员工表。
|
||||
*
|
||||
* @param staff 员工表
|
||||
* @return {@code true} 添加成功,{@code false} 添加失败
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("保存员工表")
|
||||
public boolean save(@RequestBody @ApiParam("员工表") Staff staff) {
|
||||
return staffService.save(staff);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键删除员工表。
|
||||
*
|
||||
* @param id 主键
|
||||
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||
*/
|
||||
@DeleteMapping("/remove/{id}")
|
||||
@ApiOperation("根据主键员工表")
|
||||
public boolean remove(@PathVariable @ApiParam("员工表主键") Serializable id) {
|
||||
return staffService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键更新员工表。
|
||||
*
|
||||
* @param staff 员工表
|
||||
* @return {@code true} 更新成功,{@code false} 更新失败
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("根据主键更新员工表")
|
||||
public boolean update(@RequestBody @ApiParam("员工表主键") Staff staff) {
|
||||
return staffService.updateById(staff);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有员工表。
|
||||
*
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询所有员工表")
|
||||
public List<Staff> list() {
|
||||
return staffService.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据员工表主键获取详细信息。
|
||||
*
|
||||
* @param id 员工表主键
|
||||
* @return 员工表详情
|
||||
*/
|
||||
@GetMapping("/getInfo/{id}")
|
||||
@ApiOperation("根据主键获取员工表")
|
||||
public Staff getInfo(@PathVariable @ApiParam("员工表主键") Serializable id) {
|
||||
return staffService.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询员工表。
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页查询员工表")
|
||||
public Page<Staff> page(@ApiParam("分页信息") Page<Staff> page) {
|
||||
return staffService.page(page);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.cpop.mall.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 商城-角色-品牌id 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_mall_role_brand", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class RoleBrand extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 校区id
|
||||
*/
|
||||
private String brandId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.cpop.mall.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 员工表 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_mall_staff", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class Staff extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 角色-品牌-id
|
||||
*/
|
||||
private String roleBrandId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 逻辑删除(0否1是)
|
||||
*/
|
||||
@Column(isLogicDelete = true)
|
||||
private Boolean isDelete;
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.mall.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.mall.business.entity.RoleBrand;
|
||||
|
||||
/**
|
||||
* 商城-角色-品牌id 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface RoleBrandMapper extends BaseMapper<RoleBrand> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.mall.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.mall.business.entity.Staff;
|
||||
|
||||
/**
|
||||
* 员工表 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface StaffMapper extends BaseMapper<Staff> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.cpop.mall.business.service;
|
||||
|
||||
import com.cpop.mall.business.vo.MallRolePageVo;
|
||||
import com.cpop.system.business.bo.RolePageBo;
|
||||
import com.cpop.system.business.vo.RolePageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.mall.business.entity.RoleBrand;
|
||||
|
||||
/**
|
||||
* 商城-角色-品牌id 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface RoleBrandService extends IService<RoleBrand> {
|
||||
|
||||
/**
|
||||
* @descriptions 查询商城角色分页列表
|
||||
* @author DB
|
||||
* @date 2023/09/10 16:51
|
||||
* @param bo 请求参数
|
||||
* @return R<PageVo<MallRolePageVo>>
|
||||
*/
|
||||
Page<MallRolePageVo> getMallRolePageList(RolePageBo bo);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.mall.business.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.mall.business.entity.Staff;
|
||||
|
||||
/**
|
||||
* 员工表 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface StaffService extends IService<Staff> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.cpop.mall.business.service.impl;
|
||||
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.mall.business.vo.MallRolePageVo;
|
||||
import com.cpop.system.business.bo.RolePageBo;
|
||||
import com.cpop.system.business.vo.RolePageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.mall.business.entity.RoleBrand;
|
||||
import com.cpop.mall.business.mapper.RoleBrandMapper;
|
||||
import com.cpop.mall.business.service.RoleBrandService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.cpop.mall.business.entity.table.RoleBrandTableDef.ROLE_BRAND;
|
||||
|
||||
/**
|
||||
* 商城-角色-品牌id 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Service("roleBrandService")
|
||||
public class RoleBrandServiceImpl extends ServiceImpl<RoleBrandMapper, RoleBrand> implements RoleBrandService {
|
||||
|
||||
/**
|
||||
* @descriptions 查询商城角色分页列表
|
||||
* @author DB
|
||||
* @date 2023/09/10 16:51
|
||||
* @param bo 请求参数
|
||||
* @return R<PageVo<SysRolePageVo>>
|
||||
*/
|
||||
@Override
|
||||
public Page<MallRolePageVo> getMallRolePageList(RolePageBo bo) {
|
||||
//获取分页参数
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
|
||||
QueryWrapper.create()
|
||||
.select(ROLE_BRAND.ALL_COLUMNS)
|
||||
|
||||
,RolePageVo.class);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.cpop.mall.business.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.mall.business.entity.Staff;
|
||||
import com.cpop.mall.business.mapper.StaffMapper;
|
||||
import com.cpop.mall.business.service.StaffService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 员工表 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Service("staffService")
|
||||
public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements StaffService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.cpop.mall.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/19 18:28
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "Role分页返回对象")
|
||||
public class MallRolePageVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
@ApiModelProperty("角色id")
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色值
|
||||
*/
|
||||
@ApiModelProperty("角色值")
|
||||
private String roleValue;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty("状态")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty("排序")
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ApiModelProperty("更新时间")
|
||||
private Timestamp updateTime;
|
||||
|
||||
/**
|
||||
* 角色所属菜单id集合
|
||||
*/
|
||||
@ApiModelProperty("角色所属菜单id集合")
|
||||
@Column(ignore = true)
|
||||
private List<String> menuIds;
|
||||
}
|
||||
7
Cpop-Mall/src/main/resources/mapper/RoleBrandMapper.xml
Normal file
7
Cpop-Mall/src/main/resources/mapper/RoleBrandMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.mall.business.mapper.RoleBrandMapper">
|
||||
|
||||
</mapper>
|
||||
7
Cpop-Mall/src/main/resources/mapper/StaffMapper.xml
Normal file
7
Cpop-Mall/src/main/resources/mapper/StaffMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.mall.business.mapper.StaffMapper">
|
||||
|
||||
</mapper>
|
||||
23
Cpop-System/pom.xml
Normal file
23
Cpop-System/pom.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.cpop</groupId>
|
||||
<artifactId>Cpop-Union</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<artifactId>Cpop-System</artifactId>
|
||||
<name>Cpop-System</name>
|
||||
<description>Cpop-System</description>
|
||||
|
||||
<dependencies>
|
||||
<!--核心包-->
|
||||
<dependency>
|
||||
<groupId>com.cpop</groupId>
|
||||
<artifactId>Cpop-Core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,109 @@
|
||||
package com.cpop.system.business.bo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 系统菜单表Bo
|
||||
*
|
||||
* @author DB.lost
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "SysMenu对象", description = "系统菜单表")
|
||||
public class MenuBo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
@ApiModelProperty("菜单ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父级菜单ID
|
||||
*/
|
||||
@ApiModelProperty("父级菜单ID")
|
||||
private String parentMenu;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 菜单路由,父菜单为空
|
||||
*/
|
||||
@ApiModelProperty("菜单路由,父菜单为空")
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 标记菜单的状态 0:禁用 1:启用(根据权限正常显示)
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@ApiModelProperty(value = "标记菜单的状态 0:禁用 1:启用(根据权限正常显示)", required = true)
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 菜单类型,0:目录,1:菜单,2:按钮
|
||||
*/
|
||||
@NotNull(message = "菜单类型不能为空")
|
||||
@ApiModelProperty(value = "菜单类型,0:目录,1:菜单,2:按钮", required = true)
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@ApiModelProperty("权限")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 重定向路径,一级菜单有值
|
||||
*/
|
||||
@ApiModelProperty("重定向路径,一级菜单有值")
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 排序,值越小越靠前,一级菜单有值
|
||||
*/
|
||||
@NotNull(message = "排序不能为空")
|
||||
@ApiModelProperty(value = "排序,值越小越靠前,一级菜单有值", required = true)
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
@ApiModelProperty(value = "路由地址")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotBlank(message = "标题不能为空")
|
||||
@ApiModelProperty(value = "标题", required = true)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 隐藏菜单
|
||||
*/
|
||||
@ApiModelProperty("隐藏菜单")
|
||||
private Boolean hideMenu;
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.cpop.system.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* date: 2023/4/25 18:01
|
||||
* @author ST
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(description = "菜单传入对象")
|
||||
public class MenuListBo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 标记菜单的状态 0:禁用 1:启用(根据权限正常显示)
|
||||
*/
|
||||
@ApiModelProperty(value = "标记菜单的状态 0:禁用 1:启用(根据权限正常显示)")
|
||||
private Boolean status;
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.cpop.system.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统角色表Bo
|
||||
*
|
||||
* @author DB.lost
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "SysRole对象", description = "系统角色表")
|
||||
public class RoleBo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色值
|
||||
*/
|
||||
@NotBlank(message = "角色值不能为空")
|
||||
@ApiModelProperty("角色值")
|
||||
private String roleValue;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@ApiModelProperty("状态")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不能为空")
|
||||
@ApiModelProperty("排序")
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 菜单集合
|
||||
*/
|
||||
@ApiModelProperty("菜单集合")
|
||||
private List<String> menuIds;
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.cpop.system.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* date: 2023/5/9 13:58
|
||||
*
|
||||
* @Author DB
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "SysRole分页对象")
|
||||
public class RolePageBo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty("状态")
|
||||
private Boolean status;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.cpop.system.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* date: 2023/5/9 14:12
|
||||
*
|
||||
* @Author DB
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "SysRole状态对象", description = "修改角色状态")
|
||||
public class RoleStatusBo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotBlank(message = "id不能为空")
|
||||
@ApiModelProperty(value = "主键",required = true)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@ApiModelProperty(value = "状态", required = true)
|
||||
private Boolean status;
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.cpop.system.business.controller;
|
||||
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.system.business.service.LoginService;
|
||||
import com.cpop.system.business.vo.LoginUserInfoVo;
|
||||
import com.cpop.system.business.vo.MenuRouteVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/09/10 11:13
|
||||
* @description 系统登陆
|
||||
*/
|
||||
@Api(tags = "系统登录模块")
|
||||
@RestController
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
|
||||
/**
|
||||
* @author LOST.yuan
|
||||
* @Description 获取登录用户详情
|
||||
* @date 14:52 2022/9/7
|
||||
* @return {@link R<LoginUserInfoVo>}
|
||||
**/
|
||||
@GetMapping("/getUserInfo")
|
||||
@ApiOperation("获取登录用户详情")
|
||||
public R<LoginUserInfoVo> getUserInfo() {
|
||||
return R.ok(loginService.getUserInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* @author LOST.yuan
|
||||
* @Description 获取权限码
|
||||
* @date 14:52 2022/9/7
|
||||
* @return {@link List<String>}
|
||||
**/
|
||||
@ApiOperation("获取权限码")
|
||||
@GetMapping("/getPermCode")
|
||||
public R<List<String>> getPermCode(){
|
||||
List<String> list = loginService.getPermCode();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author LOST.yuan
|
||||
* @Description 获取菜单列表
|
||||
* @date 14:52 2022/9/7
|
||||
* @return {@link R<List<MenuRouteVo>>}
|
||||
**/
|
||||
@ApiOperation("获取菜单列表")
|
||||
@GetMapping("/getMenuList")
|
||||
public R<List<MenuRouteVo>> getMenuList(){
|
||||
List<MenuRouteVo> list = loginService.getSysMenuList();
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package com.cpop.system.business.controller;
|
||||
|
||||
import com.cpop.core.annontation.OperationLog;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.core.base.enums.OperationLogEnum;
|
||||
import com.cpop.system.business.bo.MenuBo;
|
||||
import com.cpop.system.business.bo.MenuListBo;
|
||||
import com.cpop.system.business.vo.MenuVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.cpop.system.business.entity.Menu;
|
||||
import com.cpop.system.business.service.MenuService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统菜单表 控制层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "系统菜单表接口")
|
||||
@RequestMapping("/menu")
|
||||
public class MenuController {
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* @descriptions 获取系统菜单树列表
|
||||
* @author DB
|
||||
* @date 2023/09/07 15:48
|
||||
* @param bo 请求参数
|
||||
* @return com.jambox.core.base.R<java.util.List<OamMenuVo>>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:menu:list')")
|
||||
@ApiOperation("获取系统菜单树列表")
|
||||
@GetMapping("/getSysMenuTreeList")
|
||||
public R<List<MenuVo>> getSysMenuTreeList(MenuListBo bo) {
|
||||
List<MenuVo> list = menuService.getSysMenuTreeList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 获取目录与菜单树
|
||||
* @author DB
|
||||
* @date 2023/09/07 17:41
|
||||
* @return com.jambox.core.base.R<java.util.List<com.jambox.oam.business.vo.OamMenuVo>>
|
||||
*/
|
||||
@ApiOperation("获取目录与菜单树")
|
||||
@GetMapping("/getDirectoryAndMenuTreeList")
|
||||
public R<List<MenuVo>> getDirectoryAndMenuTreeList() {
|
||||
List<MenuVo> list = menuService.getDirectoryAndMenuTreeList();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 新增系统菜单
|
||||
* @author DB
|
||||
* @date 2023/09/07 17:45
|
||||
* @param bo 请求参数
|
||||
* @return com.jambox.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:menu:insert')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.INSERT_OAM_MENU)
|
||||
@ApiOperation("新增系统菜单")
|
||||
@PostMapping("/insertSysMenu")
|
||||
public R<Void> insertSysMenu(@RequestBody @Validated MenuBo bo) {
|
||||
menuService.insertSysMenu(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 修改系统菜单表
|
||||
* @param bo 请求参数
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 16:01
|
||||
**/
|
||||
@PreAuthorize("@aps.hasPermission('system:menu:update')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_MENU)
|
||||
@ApiOperation("修改系统菜单")
|
||||
@PutMapping("/updateSysMenu")
|
||||
public R<Void> updateSysMenu(@RequestBody @Validated MenuBo bo) {
|
||||
menuService.updateSysMenu(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 删除系统菜单表
|
||||
* @param id 主键id
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 16:01
|
||||
**/
|
||||
@PreAuthorize("@aps.hasPermission('system:menu:remove')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.REMOVE_OAM_MENU)
|
||||
@ApiOperation("删除系统菜单")
|
||||
@DeleteMapping("/removeSysMenu/{id}")
|
||||
public R<Void> removeSysMenu(@PathVariable String id) {
|
||||
menuService.removeSysMenu(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,139 @@
|
||||
package com.cpop.system.business.controller;
|
||||
|
||||
import com.cpop.core.annontation.OperationLog;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.core.base.enums.OperationLogEnum;
|
||||
import com.cpop.system.business.bo.MenuListBo;
|
||||
import com.cpop.system.business.bo.RoleBo;
|
||||
import com.cpop.system.business.bo.RolePageBo;
|
||||
import com.cpop.system.business.bo.RoleStatusBo;
|
||||
import com.cpop.system.business.service.MenuService;
|
||||
import com.cpop.system.business.vo.MenuVo;
|
||||
import com.cpop.system.business.vo.RolePageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.cpop.system.business.entity.Role;
|
||||
import com.cpop.system.business.service.RoleService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统角色表 控制层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "系统角色表接口")
|
||||
@RequestMapping("/role")
|
||||
public class RoleController {
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* @descriptions 查询系统角色分页列表
|
||||
* @author DB
|
||||
* @date 2023/09/10 16:51
|
||||
* @param bo 请求参数
|
||||
* @return R<PageVo<SysRolePageVo>>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:list')")
|
||||
@ApiOperation("查询系统角色分页列表")
|
||||
@GetMapping("/getSysRolePageList")
|
||||
public R<Page<RolePageVo>> getSysRolePageList(RolePageBo bo) {
|
||||
Page<RolePageVo> pageVo = roleService.getSysRolePageList(bo);
|
||||
return R.ok(pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 新增角色
|
||||
* @author DB
|
||||
* @date 2023/10/12 10:48
|
||||
* @param bo 请求参数
|
||||
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:insert')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.INSERT_OAM_ROLE)
|
||||
@ApiOperation("新增角色")
|
||||
@PostMapping("/insertSysRole")
|
||||
public R<Void> insertSysRole(@RequestBody @Validated RoleBo bo) {
|
||||
roleService.insertSysRole(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 获取系统菜单树列表
|
||||
* @return: R<List<SysMenuVo>>
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 14:39
|
||||
**/
|
||||
@ApiOperation("获取菜单树列表")
|
||||
@GetMapping("/getSysMenuTreeList")
|
||||
public R<List<MenuVo>> getSysMenuTreeList() {
|
||||
List<MenuVo> list = menuService.getSysMenuTreeList(new MenuListBo());
|
||||
//过滤掉没有权限的数据
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 修改角色
|
||||
* @author DB
|
||||
* @date 2023/09/10 17:45
|
||||
* @param bo 请求参数
|
||||
* @return com.jambox.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:update')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE)
|
||||
@ApiOperation("修改角色")
|
||||
@PutMapping("/updateSysRole")
|
||||
public R<Void> updateSysRole(@RequestBody @Validated RoleBo bo) {
|
||||
roleService.updateSysRole(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统角色表
|
||||
*/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:remove')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.REMOVE_OAM_ROLE)
|
||||
@ApiOperation("删除系统角色表")
|
||||
@DeleteMapping("/removeSysRole/{id}")
|
||||
public R<Void> removeSysRole(@PathVariable String id) {
|
||||
roleService.removeSysRole(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 设置角色状态
|
||||
* @param bo 请求参数
|
||||
* @return: R<Void>
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/9 14:13
|
||||
**/
|
||||
@PreAuthorize("@aps.hasPermission('system:role:update')")
|
||||
@OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE)
|
||||
@ApiOperation("设置角色状态")
|
||||
@PutMapping("/setSysRoleStatus")
|
||||
public R<Void> setSysRoleStatus(@RequestBody @Validated RoleStatusBo bo) {
|
||||
roleService.setSysRoleStatus(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package com.cpop.system.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 系统菜单表 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_sys_menu", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class Menu extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父级菜单ID
|
||||
*/
|
||||
private String parentMenu;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 菜单路由,父菜单为空
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 标记菜单的状态 0:禁用 1:正常(根据权限正常显示)
|
||||
*/
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 菜单类型,0:目录,1:菜单,2:按钮
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 重定向路径,一级菜单有值
|
||||
*/
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 排序,值越小越靠前,一级菜单有值
|
||||
*/
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 隐藏菜单
|
||||
*/
|
||||
private Boolean hideMenu;
|
||||
|
||||
/**
|
||||
* 菜单模块
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.cpop.system.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 系统角色表 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_sys_role", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class Role extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色值
|
||||
*/
|
||||
private String roleValue;
|
||||
|
||||
/**
|
||||
* 状态(1启用;0停用)
|
||||
*/
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private UserType userType;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.cpop.system.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 系统-角色-菜单表 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_sys_role_menu", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class RoleMenu extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 菜单id
|
||||
*/
|
||||
private String menuId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.system.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.system.business.entity.Menu;
|
||||
|
||||
/**
|
||||
* 系统菜单表 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface MenuMapper extends BaseMapper<Menu> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.system.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.system.business.entity.Role;
|
||||
|
||||
/**
|
||||
* 系统角色表 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.system.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.system.business.entity.RoleMenu;
|
||||
|
||||
/**
|
||||
* 系统-角色-菜单表 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface RoleMenuMapper extends BaseMapper<RoleMenu> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.cpop.system.business.service;
|
||||
|
||||
import com.cpop.system.business.vo.LoginUserInfoVo;
|
||||
import com.cpop.system.business.vo.MenuRouteVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统登陆
|
||||
*/
|
||||
public interface LoginService {
|
||||
|
||||
/**
|
||||
* 获取登录用户详情
|
||||
*
|
||||
* @return 系统用户登陆信息
|
||||
*/
|
||||
LoginUserInfoVo getUserInfo();
|
||||
|
||||
/**
|
||||
* 获取权限码
|
||||
*/
|
||||
List<String> getPermCode();
|
||||
|
||||
/**
|
||||
* @Description: 获取菜单列表
|
||||
* @return: List<SysMenuRouteVo>
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/11 9:16
|
||||
**/
|
||||
List<MenuRouteVo> getSysMenuList();
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.cpop.system.business.service;
|
||||
|
||||
import com.cpop.system.business.bo.MenuBo;
|
||||
import com.cpop.system.business.bo.MenuListBo;
|
||||
import com.cpop.system.business.vo.MenuRouteVo;
|
||||
import com.cpop.system.business.vo.MenuVo;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.system.business.entity.Menu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统菜单表 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface MenuService extends IService<Menu> {
|
||||
|
||||
|
||||
/**
|
||||
* @descriptions 获取菜单路由
|
||||
* @author DB
|
||||
* @date 2023/10/19 16:32
|
||||
* @return: java.util.List<com.cpop.system.business.vo.MenuRouteVo>
|
||||
*/
|
||||
List<MenuRouteVo> getSysMenuList();
|
||||
|
||||
/**
|
||||
* @descriptions 获取系统菜单树列表
|
||||
* @author DB
|
||||
* @date 2023/09/07 15:53
|
||||
* @param bo 请求参数
|
||||
* @return java.util.List<com.jambox.oam.business.vo.OamMenuVo>
|
||||
*/
|
||||
List<MenuVo> getSysMenuTreeList(MenuListBo bo);
|
||||
|
||||
/**
|
||||
* @descriptions 获取目录与菜单树
|
||||
* @author DB
|
||||
* @date 2023/09/07 17:42
|
||||
* @return java.util.List<com.jambox.system.business.vo.SysMenuVo>
|
||||
*/
|
||||
List<MenuVo> getDirectoryAndMenuTreeList();
|
||||
|
||||
/**
|
||||
* @descriptions 新增系统菜单
|
||||
* @author DB
|
||||
* @date 2023/09/07 17:50
|
||||
* @param bo 请求参数
|
||||
*/
|
||||
void insertSysMenu(MenuBo bo);
|
||||
|
||||
/**
|
||||
* @Description: 修改系统菜单表
|
||||
* @param bo 请求参数
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 16:01
|
||||
**/
|
||||
void updateSysMenu(MenuBo bo);
|
||||
|
||||
/**
|
||||
* @Description: 删除系统菜单表
|
||||
* @param id 主键id
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 16:01
|
||||
**/
|
||||
void removeSysMenu(String id);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.system.business.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.system.business.entity.RoleMenu;
|
||||
|
||||
/**
|
||||
* 系统-角色-菜单表 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface RoleMenuService extends IService<RoleMenu> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.cpop.system.business.service;
|
||||
|
||||
import com.cpop.system.business.bo.RoleBo;
|
||||
import com.cpop.system.business.bo.RolePageBo;
|
||||
import com.cpop.system.business.bo.RoleStatusBo;
|
||||
import com.cpop.system.business.vo.RolePageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.system.business.entity.Role;
|
||||
|
||||
/**
|
||||
* 系统角色表 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
public interface RoleService extends IService<Role> {
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:13
|
||||
* @param bo 请求参数
|
||||
* @return: com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.RolePageVo>
|
||||
*/
|
||||
Page<RolePageVo> getSysRolePageList(RolePageBo bo);
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:13
|
||||
* @param bo 请求参数
|
||||
* @return: void
|
||||
*/
|
||||
void insertSysRole(RoleBo bo);
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:14
|
||||
* @param bo 请求参数
|
||||
* @return: void
|
||||
*/
|
||||
void updateSysRole(RoleBo bo);
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:14
|
||||
* @param id 主键
|
||||
* @return: void
|
||||
*/
|
||||
void removeSysRole(String id);
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:14
|
||||
* @param bo 请求参数
|
||||
* @return: void
|
||||
*/
|
||||
void setSysRoleStatus(RoleStatusBo bo);
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.cpop.system.business.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.service.RedisService;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.system.business.entity.Menu;
|
||||
import com.cpop.system.business.service.LoginService;
|
||||
import com.cpop.system.business.service.MenuService;
|
||||
import com.cpop.system.business.vo.LoginUserInfoVo;
|
||||
import com.cpop.system.business.vo.MenuRouteVo;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cpop.system.business.entity.table.MenuTableDef.MENU;
|
||||
import static com.cpop.system.business.entity.table.RoleMenuTableDef.ROLE_MENU;
|
||||
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/09/10 11:19
|
||||
* @description
|
||||
*/
|
||||
@Service("oamLoginService")
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* @author LOST.yuan
|
||||
* @Description 获取用户信息
|
||||
* @date 23:01 2022/9/26
|
||||
* @return {@link String}
|
||||
**/
|
||||
@Override
|
||||
public LoginUserInfoVo getUserInfo() {
|
||||
//获取当前登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
|
||||
//获取申请员工信息
|
||||
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo();
|
||||
return new LoginUserInfoVo()
|
||||
.setUserId(loginUser.getUserId())
|
||||
.setUsername(loginUser.getUsername())
|
||||
.setRealName(loginStaffInfo.getString("name"))
|
||||
.setAvatar(loginStaffInfo.getString("avatar"))
|
||||
.setPermissions(loginUser.getPermissions())
|
||||
.setRoles(Collections.singleton("Cpop"))
|
||||
//TODO:不同用户根页面不一样,可能后面调整
|
||||
.setHomePath("");
|
||||
}
|
||||
|
||||
/**
|
||||
* @author LOST.yuan
|
||||
* @Description 获取权限码
|
||||
* @date 17:30 2022/10/19
|
||||
* @return {@link List<String>}
|
||||
**/
|
||||
@Override
|
||||
public List<String> getPermCode() {
|
||||
//获取当前用户所属角色以及菜单信息
|
||||
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
|
||||
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo();
|
||||
if (Constants.SUPER_ADMIN.equals(loginUser.getUsername())){
|
||||
return new ArrayList<String>(Collections.singleton(Constants.ALL_PERMISSION));
|
||||
}
|
||||
List<Menu> list = menuService.list(QueryWrapper.create()
|
||||
.leftJoin(ROLE_MENU).on(ROLE_MENU.MENU_ID.eq(MENU.ID))
|
||||
.leftJoin(ROLE).on(ROLE.ID.eq(ROLE_MENU.ROLE_ID))
|
||||
.where(MENU.TYPE.in(1, 2))
|
||||
.and(MENU.PERMISSION.ne(""))
|
||||
.and(ROLE.ID.eq(loginStaffInfo.getString("roleId"))));
|
||||
return list.stream().map(Menu::getPermission).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<MenuRouteVo> getSysMenuList() {
|
||||
return menuService.getSysMenuList();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,266 @@
|
||||
package com.cpop.system.business.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.system.business.bo.MenuBo;
|
||||
import com.cpop.system.business.bo.MenuListBo;
|
||||
import com.cpop.system.business.vo.MenuRouteVo;
|
||||
import com.cpop.system.business.vo.MenuVo;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.system.business.entity.Menu;
|
||||
import com.cpop.system.business.mapper.MenuMapper;
|
||||
import com.cpop.system.business.service.MenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cpop.system.business.entity.table.MenuTableDef.MENU;
|
||||
import static com.cpop.system.business.entity.table.RoleMenuTableDef.ROLE_MENU;
|
||||
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
|
||||
|
||||
/**
|
||||
* 系统菜单表 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Service("menuService")
|
||||
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {
|
||||
|
||||
/**
|
||||
* @descriptions 获取系统菜单树列表
|
||||
* @author DB
|
||||
* @date 2023/10/19 14:39
|
||||
* @return: java.util.List<com.cpop.system.business.vo.MenuRouteVo>
|
||||
*/
|
||||
@Override
|
||||
public List<MenuRouteVo> getSysMenuList() {
|
||||
//获取用户信息
|
||||
LoginUser user = SecurityUtils.getInstance().getLoginUser();
|
||||
//获取申请员工信息
|
||||
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo();
|
||||
//超级管理员
|
||||
if (Constants.SUPER_ADMIN.equals(user.getUsername())) {
|
||||
//获取菜单
|
||||
List<MenuRouteVo> list = this.listAs(QueryWrapper.create()
|
||||
.where(MENU.TYPE.in(0, 1))
|
||||
//构建公共菜单与特有菜单
|
||||
.and(MENU.USER_TYPE.in("COMMON", user.getUserType()))
|
||||
.orderBy(MENU.ORDER_NO.asc()),
|
||||
MenuRouteVo.class);
|
||||
return buildMenuRouteTree(list);
|
||||
} else {
|
||||
return buildMenuRouteTree(this.listAs(QueryWrapper.create()
|
||||
.select(MENU.ALL_COLUMNS)
|
||||
.leftJoin(ROLE_MENU).on(ROLE_MENU.MENU_ID.eq(MENU.ID))
|
||||
.leftJoin(ROLE).on(ROLE.ID.eq(ROLE_MENU.ROLE_ID))
|
||||
.where(MENU.STATUS.eq(1))
|
||||
.and(MENU.TYPE.in(0, 1))
|
||||
.and(MENU.NAME.ne(Constants.HIDE_MENU))
|
||||
.and(ROLE_MENU.ROLE_ID.eq(loginStaffInfo.getString("roleId")))
|
||||
//构建公共菜单与特有菜单
|
||||
.and(MENU.USER_TYPE.in("COMMON", user.getUserType()))
|
||||
.orderBy(MENU.ORDER_NO.asc()),
|
||||
MenuRouteVo.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVo> getSysMenuTreeList(MenuListBo bo) {
|
||||
//获取用户信息
|
||||
LoginUser user = SecurityUtils.getInstance().getLoginUser();
|
||||
return buildMenuTree(this.listAs(QueryWrapper.create()
|
||||
//状态不为空
|
||||
.and(MENU.STATUS.eq(bo.getStatus()))
|
||||
//标题不为空
|
||||
.and(MENU.TITLE.like(bo.getTitle()))
|
||||
//构建公共菜单与特有菜单
|
||||
.and(MENU.USER_TYPE.in("COMMON", user.getUserType()))
|
||||
.orderBy(MENU.ORDER_NO.asc()), MenuVo.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVo> getDirectoryAndMenuTreeList() {
|
||||
//只读取启用的菜单
|
||||
return buildMenuTree(this.listAs(QueryWrapper.create()
|
||||
.where(MENU.TYPE.in(0, 1))
|
||||
.orderBy(MENU.ORDER_NO.asc())
|
||||
, MenuVo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 构建菜单树
|
||||
* @author DB
|
||||
* @date 2023/09/07 16:36
|
||||
* @param menus 菜单集合
|
||||
* @return java.util.List<com.jambox.OAMtem.business.vo.OAMMenuVo>
|
||||
*/
|
||||
private List<MenuVo> buildMenuTree(List<MenuVo> menus) {
|
||||
List<MenuVo> returnList = new ArrayList<MenuVo>();
|
||||
if (menus.isEmpty()) {
|
||||
return menus;
|
||||
}
|
||||
//构建根节点
|
||||
List<MenuVo> tempList = menus.stream()
|
||||
.filter(s -> StringUtils.isBlank(s.getParentMenu())).collect(Collectors.toList());
|
||||
for (MenuVo menu : tempList) {
|
||||
MenuVo menuVo = recursionFn(menus, menu);
|
||||
returnList.add(menuVo);
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 递归列表
|
||||
* @author DB
|
||||
* @date 2023/09/07 16:36
|
||||
* @param list 递归集合
|
||||
* @param menu 菜单
|
||||
* @return com.jambox.OAMtem.business.vo.OAMMenuVo
|
||||
*/
|
||||
private MenuVo recursionFn(List<MenuVo> list, MenuVo menu) {
|
||||
// 得到子节点列表
|
||||
List<MenuVo> childList = new ArrayList<MenuVo>();
|
||||
for (MenuVo menuNode : list) {
|
||||
if (null != menuNode.getParentMenu() && menuNode.getParentMenu().equals(menu.getId())) {
|
||||
childList.add(recursionFn(list, menuNode));
|
||||
}
|
||||
}
|
||||
if (!childList.isEmpty()){
|
||||
menu.setChildren(childList);
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertSysMenu(MenuBo bo) {
|
||||
Menu entity = new Menu();
|
||||
BeanUtils.copyBeanProp(entity, bo);
|
||||
//设置菜单名
|
||||
if (StringUtils.isNotBlank(bo.getPath())){
|
||||
String[] split = bo.getPath().split("/");
|
||||
String name = StringUtils.getMethodName(split[split.length - 1].replace("/", ""));
|
||||
entity.setName(name);
|
||||
}
|
||||
//设置组件
|
||||
if (StringUtils.isBlank(bo.getComponent())){
|
||||
entity.setComponent("LAYOUT");
|
||||
}
|
||||
//获取当前用户
|
||||
entity.setUserType(SecurityUtils.getInstance().getLoginUser().getUserType().toString());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSysMenu(MenuBo bo) {
|
||||
Menu entity = new Menu();
|
||||
BeanUtils.copyBeanProp(entity, bo);
|
||||
//设置菜单名
|
||||
if (StringUtils.isNotBlank(bo.getPath())){
|
||||
String[] split = bo.getPath().split("/");
|
||||
String toUpperCaseString = split[split.length - 1];
|
||||
if (toUpperCaseString.contains(":")) {
|
||||
toUpperCaseString = split[split.length - 2];
|
||||
}
|
||||
String name = StringUtils.getMethodName(toUpperCaseString.replace("/", ""));
|
||||
entity.setName(name);
|
||||
}
|
||||
//设置组件
|
||||
if (StringUtils.isBlank(bo.getComponent())){
|
||||
entity.setComponent("LAYOUT");
|
||||
}
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSysMenu(String id) {
|
||||
//查询所有
|
||||
List<Menu> list = this.list();
|
||||
//递归获取当前菜单及其下属子菜单
|
||||
List<String> removeIds = new ArrayList<>();
|
||||
recursionRemove(list, id, removeIds);
|
||||
removeIds.add(id);
|
||||
this.removeByIds(removeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 递归要删除的菜单集合
|
||||
* @param list 菜单集合
|
||||
* @param id id
|
||||
* @param removeIds 删除id集合
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 15:27
|
||||
**/
|
||||
private void recursionRemove(List<Menu> list, String id, List<String> removeIds) {
|
||||
//过滤出删除根菜单
|
||||
List<Menu> sonMenu = list.stream().filter(s -> null != s.getParentMenu()&& s.getParentMenu().equals(id)).collect(Collectors.toList());
|
||||
if (!sonMenu.isEmpty()) {
|
||||
sonMenu.forEach(item -> {
|
||||
recursionRemove(list, item.getId(), removeIds);
|
||||
removeIds.add(item.getId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 构建菜单路由树
|
||||
* @param menus 菜单集合
|
||||
* @return: List<MenuRouteVo>
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/11 9:21
|
||||
**/
|
||||
private List<MenuRouteVo> buildMenuRouteTree(List<MenuRouteVo> menus) {
|
||||
if (menus.isEmpty()){
|
||||
return menus;
|
||||
}
|
||||
//构建内部类
|
||||
menus.forEach(item->{
|
||||
MenuRouteVo.Meta meta = item.new Meta();
|
||||
meta.setIcon(item.getIcon());
|
||||
meta.setOrderNo(item.getOrderNo());
|
||||
meta.setTitle(item.getTitle());
|
||||
meta.setHideMenu(item.getHideMenu());
|
||||
item.setMeta(meta);
|
||||
});
|
||||
//构建根节点
|
||||
List<MenuRouteVo> tempList = menus.stream()
|
||||
.filter(s -> StringUtils.isBlank(s.getParentMenu())).collect(Collectors.toList());
|
||||
List<MenuRouteVo> menuRoutes = new ArrayList<>();
|
||||
for (MenuRouteVo menu : tempList) {
|
||||
MenuRouteVo menuVo = recursionMenuRoute(menus, menu);
|
||||
//设置是否需要隐藏子内部菜单
|
||||
menuVo.getMeta().setHideChildrenInMenu(null != menuVo.getChildren() && menuVo.getChildren().size() == 1 && menuVo.getChildren().get(0).getHideMenu());
|
||||
menuRoutes.add(menuVo);
|
||||
}
|
||||
return BeanUtils.mapToList(menuRoutes, MenuRouteVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 递归列表
|
||||
* @param list 菜单集合
|
||||
* @param menu 菜单
|
||||
* @return: MenuRouteVo
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/11 9:22
|
||||
**/
|
||||
private MenuRouteVo recursionMenuRoute(List<MenuRouteVo> list, MenuRouteVo menu) {
|
||||
// 得到子节点列表
|
||||
List<MenuRouteVo> childList = new ArrayList<MenuRouteVo>();
|
||||
for (MenuRouteVo menuNode : list) {
|
||||
if (StringUtils.isNotBlank(menuNode.getParentMenu()) && menuNode.getParentMenu().equals(menu.getId())) {
|
||||
childList.add(recursionMenuRoute(list, menuNode));
|
||||
}
|
||||
}
|
||||
menu.setChildren(childList);
|
||||
return menu;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.cpop.system.business.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.system.business.entity.RoleMenu;
|
||||
import com.cpop.system.business.mapper.RoleMenuMapper;
|
||||
import com.cpop.system.business.service.RoleMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 系统-角色-菜单表 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Service("roleMenuService")
|
||||
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,157 @@
|
||||
package com.cpop.system.business.service.impl;
|
||||
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.system.business.bo.RoleBo;
|
||||
import com.cpop.system.business.bo.RolePageBo;
|
||||
import com.cpop.system.business.bo.RoleStatusBo;
|
||||
import com.cpop.system.business.entity.RoleMenu;
|
||||
import com.cpop.system.business.service.RoleMenuService;
|
||||
import com.cpop.system.business.vo.RolePageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.system.business.entity.Role;
|
||||
import com.cpop.system.business.mapper.RoleMapper;
|
||||
import com.cpop.system.business.service.RoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cpop.system.business.entity.table.RoleMenuTableDef.ROLE_MENU;
|
||||
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
|
||||
|
||||
/**
|
||||
* 系统角色表 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2023-10-19
|
||||
*/
|
||||
@Service("roleService")
|
||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:13
|
||||
* @param bo 请求参数
|
||||
* @return: com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.RolePageVo>
|
||||
*/
|
||||
@Override
|
||||
public Page<RolePageVo> getSysRolePageList(RolePageBo bo) {
|
||||
//获取当前用户
|
||||
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
Page<RolePageVo> page = this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
|
||||
QueryWrapper.create()
|
||||
.select(ROLE.ALL_COLUMNS)
|
||||
.where(ROLE.ROLE_VALUE.ne(Constants.SUPER_ADMIN_VALUE))
|
||||
.and(ROLE.ROLE_NAME.like(bo.getRoleName()))
|
||||
.and(ROLE.STATUS.eq(bo.getStatus()))
|
||||
.and(ROLE.USER_TYPE.eq(loginUser.getUserType()))
|
||||
.orderBy(ROLE.ORDER_NO.asc())
|
||||
, RolePageVo.class);
|
||||
if (!page.getRecords().isEmpty()) {
|
||||
//根据角色查询中间表
|
||||
List<RoleMenu> roleMenuList = SpringUtils.getBean(RoleMenuService.class).list(QueryWrapper.create()
|
||||
.where(ROLE_MENU.ROLE_ID.in(page.getRecords().stream().map(RolePageVo::getId).collect(Collectors.toSet()))));
|
||||
page.getRecords().forEach(item -> {
|
||||
List<String> filterMenuIds = roleMenuList.stream()
|
||||
.filter(s -> StringUtils.equals(s.getRoleId(), item.getId()))
|
||||
.map(RoleMenu::getMenuId).collect(Collectors.toList());
|
||||
item.setMenuIds(filterMenuIds);
|
||||
});
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:13
|
||||
* @param bo 请求参数
|
||||
* @return: void
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertSysRole(RoleBo bo) {
|
||||
Role role = BeanUtils.mapToClass(bo, Role.class);
|
||||
this.save(role);
|
||||
//将菜单信息录入中间表
|
||||
if (!bo.getMenuIds().isEmpty()) {
|
||||
List<RoleMenu> roleMenus = new ArrayList<>();
|
||||
bo.getMenuIds().forEach(item -> {
|
||||
RoleMenu roleMenu = new RoleMenu();
|
||||
roleMenu.setMenuId(item);
|
||||
roleMenu.setRoleId(role.getId());
|
||||
roleMenus.add(roleMenu);
|
||||
});
|
||||
SpringUtils.getBean(RoleMenuService.class).saveBatch(roleMenus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:14
|
||||
* @param bo 请求参数
|
||||
* @return: void
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateSysRole(RoleBo bo) {
|
||||
Role entity = new Role();
|
||||
BeanUtils.copyBeanProp(entity, bo);
|
||||
this.updateById(entity);
|
||||
//将菜单信息录入中间表
|
||||
if (!bo.getMenuIds().isEmpty()) {
|
||||
//先删后存
|
||||
RoleMenuService sysRoleMenuService = SpringUtils.getBean(RoleMenuService.class);
|
||||
sysRoleMenuService.remove(QueryWrapper.create()
|
||||
.where(ROLE_MENU.ROLE_ID.eq(entity.getId())));
|
||||
List<RoleMenu> roleMenus = new ArrayList<>();
|
||||
bo.getMenuIds().forEach(item -> {
|
||||
RoleMenu roleMenu = new RoleMenu();
|
||||
roleMenu.setMenuId(item);
|
||||
roleMenu.setRoleId(entity.getId());
|
||||
roleMenus.add(roleMenu);
|
||||
});
|
||||
sysRoleMenuService.saveBatch(roleMenus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:14
|
||||
* @param id 主键
|
||||
* @return: void
|
||||
*/
|
||||
@Override
|
||||
public void removeSysRole(String id) {
|
||||
this.removeById(id);
|
||||
//删除相关联菜单
|
||||
SpringUtils.getBean(RoleMenuService.class).remove(QueryWrapper.create().where(ROLE_MENU.ROLE_ID.eq(id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions
|
||||
* @author DB
|
||||
* @date 2023/10/19 17:14
|
||||
* @param bo 请求参数
|
||||
* @return: void
|
||||
*/
|
||||
@Override
|
||||
public void setSysRoleStatus(RoleStatusBo bo) {
|
||||
this.updateById(BeanUtils.mapToClass(bo, Role.class));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.cpop.system.business.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 登录用户的基本信息
|
||||
* 用于记录到token的信息使用
|
||||
* @author Gewj
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
public class LoginUserInfoVo {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@ApiModelProperty("头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 登录用户名
|
||||
*/
|
||||
@ApiModelProperty("登录用户名")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* 介绍
|
||||
*/
|
||||
@ApiModelProperty("介绍")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 用户首页路由
|
||||
*/
|
||||
@ApiModelProperty("用户首页路由")
|
||||
private String homePath;
|
||||
|
||||
/**
|
||||
* 权限信息
|
||||
*/
|
||||
@ApiModelProperty("权限信息")
|
||||
private Set<String> permissions;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
@ApiModelProperty("角色")
|
||||
private Set<String> roles;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,145 @@
|
||||
package com.cpop.system.business.vo;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* date: 2023/5/11 9:14
|
||||
*
|
||||
* @author DB
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "Menu对象", description = "")
|
||||
public class MenuRouteVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
@ApiModelProperty("菜单ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父级菜单ID
|
||||
*/
|
||||
@ApiModelProperty("父级菜单ID")
|
||||
private String parentMenu;
|
||||
|
||||
/**
|
||||
* 菜单名
|
||||
*/
|
||||
@ApiModelProperty("菜单名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
@ApiModelProperty("菜单图标")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 菜单路由,父菜单为空
|
||||
*/
|
||||
@ApiModelProperty("菜单路由,父菜单为空")
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 标记菜单的状态 0:禁用 1:正常(根据权限正常显示)
|
||||
*/
|
||||
@ApiModelProperty("标记菜单的状态 0:禁用 1:正常(根据权限正常显示)")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 用户类型,1管理员,2审计管理员,3安全管理员,4普通用户
|
||||
*/
|
||||
@ApiModelProperty("用户类型,1管理员,2审计管理员,3安全管理员,4普通用户")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@ApiModelProperty("权限")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 重定向路径,一级菜单有值
|
||||
*/
|
||||
@ApiModelProperty("重定向路径,一级菜单有值")
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 排序,值越小越靠前,一级菜单有值
|
||||
*/
|
||||
@ApiModelProperty("排序,值越小越靠前,一级菜单有值")
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 子菜单集
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
@ApiModelProperty("子菜单集")
|
||||
private List<MenuRouteVo> children;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
@ApiModelProperty("路由地址")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ApiModelProperty("标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 隐藏菜单
|
||||
*/
|
||||
@ApiModelProperty("隐藏菜单")
|
||||
private Boolean hideMenu;
|
||||
|
||||
/**
|
||||
* 内部定义类
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
@ApiModelProperty("内部定义类")
|
||||
private Meta meta;
|
||||
|
||||
/**
|
||||
* 内部类
|
||||
*/
|
||||
@Data
|
||||
public class Meta {
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderNo;
|
||||
/**
|
||||
* 隐藏菜单
|
||||
*/
|
||||
private Boolean hideMenu;
|
||||
|
||||
/**
|
||||
* 隐藏子类菜单
|
||||
*/
|
||||
private Boolean hideChildrenInMenu;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package com.cpop.system.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统菜单表Vo输出
|
||||
*
|
||||
* @author DB.lost
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(description = "菜单返回对象")
|
||||
public class MenuVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父级菜单ID
|
||||
*/
|
||||
@ApiModelProperty(value = "父级菜单ID")
|
||||
private String parentMenu;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 菜单路由,父菜单为空
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单路由,父菜单为空")
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 标记菜单的状态 0:禁用 1:启用(根据权限正常显示)
|
||||
*/
|
||||
@ApiModelProperty(value = "标记菜单的状态 0:禁用 1:启用(根据权限正常显示)")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@ApiModelProperty(value = "权限")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 重定向路径,一级菜单有值
|
||||
*/
|
||||
@ApiModelProperty(value = "重定向路径,一级菜单有值")
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 排序,值越小越靠前,一级菜单有值
|
||||
*/
|
||||
@ApiModelProperty(value = "排序,值越小越靠前,一级菜单有值")
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
@ApiModelProperty(value = "路由地址")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 子菜单集
|
||||
*/
|
||||
@ApiModelProperty(value = "子菜单集")
|
||||
private List<MenuVo> children;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 菜单类型,0:目录,1:菜单,2:按钮
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单类型,0:目录,1:菜单,2:按钮")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 隐藏菜单
|
||||
*/
|
||||
@ApiModelProperty(value = "隐藏菜单")
|
||||
private Boolean hideMenu;
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.cpop.system.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* date: 2023/5/9 14:21
|
||||
*
|
||||
* @Author DB
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "Role分页返回对象")
|
||||
public class RolePageVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色值
|
||||
*/
|
||||
@ApiModelProperty("角色值")
|
||||
private String roleValue;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty("状态")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty("排序")
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ApiModelProperty("更新时间")
|
||||
private Timestamp updateTime;
|
||||
|
||||
/**
|
||||
* 角色所属菜单id集合
|
||||
*/
|
||||
@ApiModelProperty("角色所属菜单id集合")
|
||||
@Column(ignore = true)
|
||||
private List<String> menuIds;
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.cpop.system.business.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 系统角色表Vo输出
|
||||
*
|
||||
* @author DB.lost
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "SysRole对象", description = "角色信息")
|
||||
public class RoleVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色值
|
||||
*/
|
||||
@ApiModelProperty("角色值")
|
||||
private String roleValue;
|
||||
|
||||
/**
|
||||
* 状态 0:禁用 1:正常
|
||||
*/
|
||||
@ApiModelProperty("状态 0:禁用 1:正常")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty("排序")
|
||||
private Integer orderNo;
|
||||
|
||||
}
|
||||
1
Cpop-System/src/main/resources/application-system.yml
Normal file
1
Cpop-System/src/main/resources/application-system.yml
Normal file
@ -0,0 +1 @@
|
||||
|
||||
7
Cpop-System/src/main/resources/mapper/MenuMapper.xml
Normal file
7
Cpop-System/src/main/resources/mapper/MenuMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.system.business.mapper.MenuMapper">
|
||||
|
||||
</mapper>
|
||||
7
Cpop-System/src/main/resources/mapper/RoleMapper.xml
Normal file
7
Cpop-System/src/main/resources/mapper/RoleMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.system.business.mapper.RoleMapper">
|
||||
|
||||
</mapper>
|
||||
7
Cpop-System/src/main/resources/mapper/RoleMenuMapper.xml
Normal file
7
Cpop-System/src/main/resources/mapper/RoleMenuMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.system.business.mapper.RoleMenuMapper">
|
||||
|
||||
</mapper>
|
||||
6
pom.xml
6
pom.xml
@ -27,6 +27,7 @@
|
||||
<module>Cpop-Jambox/Cpop-Jambox-Web</module>
|
||||
<module>Cpop-Mall</module>
|
||||
<module>Cpop-Mall/Cpop-Mall-Web</module>
|
||||
<module>Cpop-System</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
@ -117,6 +118,11 @@
|
||||
<artifactId>Cpop-Mall</artifactId>
|
||||
<version>${cpop.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cpop</groupId>
|
||||
<artifactId>Cpop-System</artifactId>
|
||||
<version>${cpop.version}</version>
|
||||
</dependency>
|
||||
<!--HikariCP-->
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user