Feat: 权限管理接口基本完成

This commit is contained in:
xinsin 2023-04-29 22:38:30 +08:00
parent 2a7642a050
commit 2b4b341117
25 changed files with 374 additions and 71 deletions

View File

@ -99,7 +99,7 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.5.1</version>
<version>3.5.3.1</version>
</dependency>
<!-- 模板引擎依赖-->
<dependency>

View File

@ -1,5 +1,6 @@
package top.xinsin.config;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
@ -97,17 +98,13 @@ public class SecurityConfiguration {
if (authority.startsWith("ROLE_id=")){
jsonObject.fluentPut("id",authority.replace("ROLE_id=", ""));
}
if (authority.startsWith("ROLE_role=")){
jsonObject.fluentPut("role",authority.replace("ROLE_role=",""));
}
});
jsonObject
.fluentPut("message","登陆成功");
jsonObject.fluentPut("message","登陆成功");
httpServletResponse.setStatus(HttpCodes.HTTP_CODES200.getCode());
httpServletResponse.getWriter().write(JSONObject.toJSONString(R.success(jsonObject)));
httpServletResponse.getWriter().write(JSON.toJSONString(R.success(jsonObject)));
} else if(httpServletRequest.getRequestURI().endsWith("/logout")) {
httpServletResponse.setStatus(HttpCodes.HTTP_CODES200.getCode());
httpServletResponse.getWriter().write(JSONObject.toJSONString(R.success("退出登录成功")));
httpServletResponse.getWriter().write(JSON.toJSONString(R.success("退出登录成功")));
}
}
private void onFailureLoginHandler(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse,AuthenticationException authentication) throws IOException {

View File

@ -2,6 +2,11 @@ package top.xinsin.controller;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -37,4 +42,17 @@ public class AccountController {
@RequestMapping(path = "/getUser", method = RequestMethod.GET)
public R<JSONObject> getUser(@RequestParam("page") Integer page, @RequestParam("num") Integer num) {return this.accountService.getUser(page, num);}
@RequestMapping(path = "/getUserInfo",method = RequestMethod.GET)
public R<JSONObject> getUserInfo(){
GrantedAuthority grantedAuthority = ((User) SecurityContextHolder
.getContext()
.getAuthentication()
.getPrincipal())
.getAuthorities()
.stream()
.filter(e -> e.getAuthority().startsWith("ROLE_id="))
.findFirst()
.get();
return accountService.getUserInfo(Integer.parseInt(grantedAuthority.getAuthority().replace("ROLE_id=","")));
}
}

View File

@ -0,0 +1,34 @@
package top.xinsin.controller;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.xinsin.pojo.AuthPermissions;
import top.xinsin.pojo.Commission;
import top.xinsin.service.AuthPermissionsService;
import top.xinsin.service.AuthRolesService;
import top.xinsin.util.R;
/**
* @author xinsin
* Created On 2023/4/24 21:07
* @version 1.0
*/
@RestController
@RequestMapping("/authPermissions")
public class AuthPermissionsController {
@Autowired
private AuthPermissionsService authPermissionsService;
@RequestMapping(path = "/addAuthPermissions",method = RequestMethod.POST)
public R<Boolean> addAuthPermissions(@RequestBody AuthPermissions authPermissions){return authPermissionsService.addAuthPermissions(authPermissions);}
@RequestMapping(path = "/changeAuthPermissions",method = RequestMethod.POST)
public R<Boolean> changeAuthPermissions(@RequestBody AuthPermissions authPermissions){return authPermissionsService.changeAuthPermissions(authPermissions);}
@RequestMapping(path = "/delAuthPermissions",method = RequestMethod.GET)
public R<Boolean> delAuthPermissions(@RequestParam("id")Integer id){return authPermissionsService.delAuthPermissions(id);}
@RequestMapping(path = "/getAuthPermissions",method = RequestMethod.GET)
public R<JSONObject> getAuthPermissions(@RequestParam("page")Integer page, @RequestParam("num")Integer num){return authPermissionsService.getAuthPermissions(page,num);}
@RequestMapping(path = "/changeAuthPermissionsStats", method = RequestMethod.GET)
public R<String> changeAuthPermissionsStats(@RequestParam("authPermissionId") Integer authPermissionId, @RequestParam("status") Boolean status) {return authPermissionsService.changeAuthPermissionsStats(authPermissionId, status);}
}

View File

@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestController;
* @version 1.0
*/
@RestController
@RequestMapping("/roles")
public class RolesController {
@RequestMapping("/authRoles")
public class AuthRolesController {
}

View File

@ -0,0 +1,20 @@
package top.xinsin.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.xinsin.service.AuthRolesPermissionsService;
/**
* @author xinsin
* Created On 2023/4/29 21:05
* @version 1.0
*/
@RestController
@RequestMapping("/authRolesPermission")
public class AuthRolesPermissionController {
@Autowired
private AuthRolesPermissionsService authRolesPermissionsService;
}

View File

@ -1,15 +0,0 @@
package top.xinsin.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author xinsin
* Created On 2023/4/24 21:07
* @version 1.0
*/
@RestController
@RequestMapping("/permissions")
public class PermissionsController {
}

View File

@ -10,5 +10,5 @@ import top.xinsin.pojo.AuthPermissions;
* @version 1.0
*/
@Mapper
public interface PermissionsMapper extends BaseMapper<AuthPermissions> {
public interface AuthPermissionsMapper extends BaseMapper<AuthPermissions> {
}

View File

@ -10,5 +10,5 @@ import top.xinsin.pojo.AuthRoles;
* @version 1.0
*/
@Mapper
public interface RolesMapper extends BaseMapper<AuthRoles> {
public interface AuthRolesMapper extends BaseMapper<AuthRoles> {
}

View File

@ -0,0 +1,14 @@
package top.xinsin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import top.xinsin.pojo.AuthRolesPermissions;
/**
* @author xinsin
* Created On 2023/4/29 20:28
* @version 1.0
*/
@Mapper
public interface AuthRolesPermissionsMapper extends BaseMapper<AuthRolesPermissions> {
}

View File

@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @author xinsin
@ -27,16 +28,16 @@ public class AuthPermissions implements Serializable {
private String permissionCode;
@TableField("description")
private String description;
@TableField("account_id")
private Integer accountId;
@TableField("create_id")
private Integer createId;
@TableField("create_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private Date createTime;
@TableField("update_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime updateTime;
private Date updateTime;
@TableField("status")
private Boolean status;
@TableField("del")

View File

@ -25,8 +25,8 @@ public class AuthRoles implements Serializable {
private String roleName;
@TableField("description")
private String description;
@TableField("account_id")
private Integer accountId;
@TableField("create_id")
private Integer createId;
@TableField("create_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

View File

@ -0,0 +1,37 @@
package top.xinsin.pojo;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* @author xinsin
* Created On 2023/4/29 14:41
* @version 1.0
*/
@Data
@TableName("auth_roles_permissions")
public class AuthRolesPermissions implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Integer roleId;
private Integer permissionId;
private Integer createId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
@TableLogic
private Integer del;
}

View File

@ -0,0 +1,56 @@
package top.xinsin.pojo.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import top.xinsin.pojo.AuthPermissions;
import java.util.Date;
/**
* @author xinsin
* Created On 2023/4/29 21:27
* @version 1.0
*/
@Data
public class AuthPermissionsAndUserVo {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("permission_name")
private String permissionName;
@TableField("permission_code")
private String permissionCode;
@TableField("description")
private String description;
@TableField(exist = false)
private String createName;
@TableField("create_id")
private Integer createId;
@TableField("create_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@TableField("update_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
@TableField("status")
private Boolean status;
public AuthPermissionsAndUserVo(AuthPermissions authPermissions) {
this.id = authPermissions.getId();
this.permissionName = authPermissions.getPermissionName();
this.permissionCode = authPermissions.getPermissionCode();
this.description = authPermissions.getDescription();
this.createId = authPermissions.getCreateId();
this.createTime = authPermissions.getCreateTime();
this.updateTime = authPermissions.getUpdateTime();
this.status = authPermissions.getStatus();
}
}

View File

@ -1,5 +1,6 @@
package top.xinsin.service;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -12,11 +13,18 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import top.xinsin.mapper.AccountMapper;
import top.xinsin.mapper.AuthPermissionsMapper;
import top.xinsin.mapper.AuthRolesMapper;
import top.xinsin.mapper.AuthRolesPermissionsMapper;
import top.xinsin.pojo.AuthAccount;
import top.xinsin.pojo.AuthPermissions;
import top.xinsin.pojo.AuthRoles;
import top.xinsin.pojo.AuthRolesPermissions;
import top.xinsin.util.HttpCodes;
import top.xinsin.util.R;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
@ -29,21 +37,32 @@ import java.util.List;
public class AccountService implements UserDetailsService {
@Autowired
private AccountMapper accountMapper;
@Autowired
private AuthRolesPermissionsMapper authRolesPermissionsMapper;
@Autowired
private AuthRolesMapper authRolesMapper;
@Autowired
private AuthPermissionsMapper authPermissionsMapper;
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
public AccountService() {
}
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
System.out.println(username);
if (username == null) {
throw new UsernameNotFoundException("用户名不能为空");
} else {
AuthAccount authAccount = this.accountMapper.selectOne(new LambdaQueryWrapper<AuthAccount>().eq(AuthAccount::getUsername, username).or().eq(AuthAccount::getEmail, username).eq(AuthAccount::getStatus, true));
AuthAccount authAccount = this.accountMapper.selectOne(new LambdaQueryWrapper<AuthAccount>()
.eq(AuthAccount::getUsername, username)
.or()
.eq(AuthAccount::getEmail, username)
.eq(AuthAccount::getStatus, true));
if (authAccount == null) {
throw new UsernameNotFoundException("用户名或密码错误");
} else {
return User.withUsername(authAccount.getUsername()).password(authAccount.getPassword()).roles(new String[]{"role=" + authAccount.getRoleId(), "id=" + authAccount.getId()}).build();
return User
.withUsername(authAccount.getUsername())
.password(authAccount.getPassword())
.roles("id=" + authAccount.getId())
.build();
}
}
}
@ -81,19 +100,21 @@ public class AccountService implements UserDetailsService {
AuthAccount authAccount = new AuthAccount();
authAccount.setPassword(this.encoder.encode(newPassword));
LambdaQueryWrapper<AuthAccount> accountLambdaQueryWrapper = new LambdaQueryWrapper<>();
accountLambdaQueryWrapper.eq(AuthAccount::getId, userId).eq(AuthAccount::getPassword, this.encoder.encode(oldPassword));
accountLambdaQueryWrapper
.eq(AuthAccount::getId, userId)
.eq(AuthAccount::getPassword, this.encoder.encode(oldPassword));
int update = this.accountMapper.update(authAccount, accountLambdaQueryWrapper);
return update == 1 ? R.success("修改密码成功") : R.failed(HttpCodes.HTTP_CODES555, "修改密码失败,请联系服务器管理员");
}
public R<JSONObject> getUser(Integer page, Integer num) {
Page<AuthAccount> accountPage = new Page<>((long)page, (long)num);
Page<AuthAccount> accountPage = new Page<>(page, num);
Page<AuthAccount> accountPage1 = this.accountMapper.selectPage(accountPage, null);
JSONObject jsonObject = new JSONObject();
List<AuthAccount> collect = accountPage1.getRecords().stream().peek((e) -> {
e.setPassword((String)null);
}).toList();
jsonObject.fluentPut("info", collect).fluentPut("total", accountPage1.getTotal());
List<AuthAccount> collect = accountPage1.getRecords().stream().peek((e) -> e.setPassword(null)).toList();
jsonObject
.fluentPut("info", collect)
.fluentPut("total", accountPage1.getTotal());
return R.success(jsonObject);
}
@ -101,4 +122,28 @@ public class AccountService implements UserDetailsService {
int delete = this.accountMapper.deleteById(id);
return delete == 1 ? R.success("删除用户成功") : R.failed(HttpCodes.HTTP_CODES555, "删除用户失败,请联系服务器管理员");
}
public R<JSONObject> getUserInfo(int rolesId) {
JSONObject globalReturnData = new JSONObject();
JSONArray globalReturnPermissionList = new JSONArray();
List<AuthRolesPermissions> authRolesPermissions = authRolesPermissionsMapper
.selectList(new LambdaQueryWrapper<AuthRolesPermissions>()
.eq(AuthRolesPermissions::getRoleId, rolesId));
List<Integer> permissionsList = authRolesPermissions.stream().map(AuthRolesPermissions::getPermissionId).toList();
List<AuthPermissions> authPermissions = authPermissionsMapper.selectList(new LambdaQueryWrapper<AuthPermissions>()
.in(AuthPermissions::getId, permissionsList));
authPermissions.forEach(e -> {
HashMap<String, String> returnPermissionJson = new HashMap<>();
returnPermissionJson.put("permissionName",e.getPermissionName());
returnPermissionJson.put("permissionCode",e.getPermissionCode());
globalReturnPermissionList.add(returnPermissionJson);
});
AuthRoles authRoles = authRolesMapper.selectOne(new LambdaQueryWrapper<AuthRoles>().eq(AuthRoles::getId, rolesId));
// 角色名
String roleName = authRoles.getRoleName();
globalReturnData
.fluentPut("info",globalReturnPermissionList)
.fluentPut("roleName",roleName);
return R.success(globalReturnData);
}
}

View File

@ -0,0 +1,67 @@
package top.xinsin.service;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.xinsin.mapper.AccountMapper;
import top.xinsin.mapper.AuthPermissionsMapper;
import top.xinsin.pojo.AuthAccount;
import top.xinsin.pojo.AuthPermissions;
import top.xinsin.pojo.vo.AuthPermissionsAndUserVo;
import top.xinsin.util.HttpCodes;
import top.xinsin.util.R;
import java.util.*;
import static org.springframework.data.util.Pair.toMap;
/**
* @author xinsin
* Created On 2023/4/24 21:13
* @version 1.0
*/
@Service
public class AuthPermissionsService {
@Autowired
private AuthPermissionsMapper authPermissionsMapper;
@Autowired
private AccountMapper accountMapper;
public R<Boolean> addAuthPermissions(AuthPermissions authPermissions) {
authPermissions.setCreateTime(new Date());
int insert = authPermissionsMapper.insert(authPermissions);
return insert == 1 ? R.success(true) : R.failed(HttpCodes.HTTP_CODES555, false);
}
public R<Boolean> changeAuthPermissions(AuthPermissions authPermissions) {
authPermissions.setUpdateTime(new Date());
int update = authPermissionsMapper.updateById(authPermissions);
return update == 1 ? R.success(true) : R.failed(HttpCodes.HTTP_CODES555, false);
}
public R<Boolean> delAuthPermissions(Integer id) {
int delete = authPermissionsMapper.deleteById(id);
return delete == 1 ? R.success(true) : R.failed(HttpCodes.HTTP_CODES555, false);
}
public R<JSONObject> getAuthPermissions(Integer page, Integer num) {
Page<AuthPermissions> authPermissionsPage = new Page<>(page, num);
Page<AuthPermissions> authPermissionsPage1 = authPermissionsMapper.selectPage(authPermissionsPage, null);
List<AuthPermissions> records = authPermissionsPage1.getRecords();
List<Integer> integers = records.stream().map(AuthPermissions::getCreateId).toList();
List<AuthAccount> authAccounts = accountMapper.selectList(new LambdaQueryWrapper<AuthAccount>()
.in(AuthAccount::getId, integers));
Map<Integer,String > map = new HashMap<>();
authAccounts.forEach(e -> map.put(e.getId(), e.getUsername()));
List<AuthPermissionsAndUserVo> authPermissionsAndUserVos = records.stream().map(AuthPermissionsAndUserVo::new).toList();
authPermissionsAndUserVos.forEach(e -> e.setCreateName(map.get(e.getCreateId())));
return R.success(new JSONObject().fluentPut("info",authPermissionsAndUserVos).fluentPut("total",authPermissionsPage.getTotal()));
}
public R<String> changeAuthPermissionsStats(Integer authPermissionId, Boolean status) {
return R.success("");
}
}

View File

@ -4,11 +4,10 @@ import org.springframework.stereotype.Service;
/**
* @author xinsin
* Created On 2023/4/24 21:13
* Created On 2023/4/29 20:28
* @version 1.0
*/
@Service
public class RolesService {
public RolesService() {
}
public class AuthRolesPermissionsService {
}

View File

@ -0,0 +1,16 @@
package top.xinsin.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.xinsin.mapper.AuthRolesMapper;
/**
* @author xinsin
* Created On 2023/4/24 21:13
* @version 1.0
*/
@Service
public class AuthRolesService {
@Autowired
private AuthRolesMapper authRolesMapper;
}

View File

@ -1,14 +0,0 @@
package top.xinsin.service;
import org.springframework.stereotype.Service;
/**
* @author xinsin
* Created On 2023/4/24 21:13
* @version 1.0
*/
@Service
public class PermissionsService {
public PermissionsService() {
}
}

View File

@ -0,0 +1,16 @@
package top.xinsin.util;
import org.springframework.beans.BeanUtils;
/**
* @author xinsin
* Created On 2023/4/29 21:17
* @version 1.0
*/
public class PojoToVoUtils {
public static <T> T pojoToVo(T filed,Object data){
// BeanUtils.copyProperties();
return (T) new Object();
}
}

View File

@ -2,9 +2,9 @@ server:
port: 8001
spring:
datasource:
username: commerce
password: Jix656dzD6St4YCn_
url: jdbc:mysql://localhost:3306/commerce_system?serverTimezone=UTC-8
username: commerce_system
password: Jix656dzD6St4YCn
url: jdbc:mysql://wzpmc.cn:3306/commerce_system?serverTimezone=UTC-8
driver-class-name: com.mysql.cj.jdbc.Driver
# druid配置
type: com.alibaba.druid.pool.DruidDataSource
@ -36,8 +36,8 @@ spring:
user:
password: 123456
mybatis-plus:
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-field: del # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2)

View File

@ -0,0 +1,12 @@
# LOG4J??
log4j.rootCategory=INFO,stdout,file
# ?????
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n
# ???????
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.file=logs/springboot.log
log4j.appender.file.DatePattern='.'yyyy-MM-dd
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n

View File

@ -1,6 +1,6 @@
<?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="top.xinsin.mapper.PermissionsMapper">
<mapper namespace="top.xinsin.mapper.AuthPermissionsMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="top.xinsin.pojo.AuthPermissions">

View File

@ -1,6 +1,6 @@
<?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="top.xinsin.mapper.RolesMapper">
<mapper namespace="top.xinsin.mapper.AuthRolesMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="top.xinsin.pojo.AuthRoles">

View File

@ -16,7 +16,7 @@ public class MainTest {
@Test
public void test01(){
System.out.println(new BCryptPasswordEncoder().encode(DigestUtils.md5Hex("12345678")));
System.out.println(new BCryptPasswordEncoder().encode(DigestUtils.md5Hex("xinsin")));
System.out.println(DigestUtils.md5Hex("xinsin"));
}