Commit c4e21bbb by Suvalue

数据库切换到mysql后的优化

parent a46126c8
<?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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.bsoft</groupId>
<artifactId>bsoft-admin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bsoft-admin</name>
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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.bsoft</groupId>
<artifactId>bsoft-admin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bsoft-admin</name>
<packaging>war</packaging>
<description>Demo project for Spring Boot</description>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -77,15 +77,20 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
......@@ -139,10 +144,9 @@
<!--endregion-->
</dependencies>
</plugin>
</plugins>
</build>
</plugins>
</build>
</project>
......@@ -11,7 +11,7 @@ import org.springframework.context.annotation.ComponentScan;
public class BsoftAdminApplication {
public static void main(String[] args) {
SpringApplication.run(BsoftAdminApplication.class, args);
SpringApplication.run(BsoftAdminApplication.class,args);
}
}
......@@ -15,7 +15,7 @@ public class Result<T> {
@ApiModelProperty(value = "返回的数据")
private T data;
private Result(int code, String msg, T data) {
private Result(int code,String msg,T data) {
this.code = code;
this.msg = msg;
this.data = data;
......@@ -54,37 +54,37 @@ public class Result<T> {
this.data = data;
}
public static <T> Result<T> success(T data){
return new Result(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getEnMessage(), data);
public static <T> Result<T> success(T data) {
return new Result(ErrorCode.SUCCESS.getCode(),ErrorCode.SUCCESS.getEnMessage(),data);
}
public static Result error(int code, String msg){
return new Result(code, msg, null);
public static Result error(int code,String msg) {
return new Result(code,msg,null);
}
public static Result error(){
return new Result(ErrorCode.ERROR.getCode(), ErrorCode.ERROR.getEnMessage(), null);
public static Result error() {
return new Result(ErrorCode.ERROR.getCode(),ErrorCode.ERROR.getEnMessage(),null);
}
public static Result error(String msg){
return new Result(ErrorCode.ERROR.getCode(), msg, null);
public static Result error(String msg) {
return new Result(ErrorCode.ERROR.getCode(),msg,null);
}
public static Result error(ErrorCode errorCode){
return new Result(errorCode.getCode(), errorCode.getEnMessage(), null);
public static Result error(ErrorCode errorCode) {
return new Result(errorCode.getCode(),errorCode.getEnMessage(),null);
}
public static enum ErrorCode{
SUCCESS(1, "成功", "success"),
INVALID_TOKEN(401, "无效的TOKEN", "invalid token"),
ERROR(400, "错误", "error"),
public static enum ErrorCode {
SUCCESS(1,"成功","success"),
INVALID_TOKEN(401,"无效的TOKEN","invalid token"),
ERROR(400,"错误","error"),
USERERROR(2,"账号或密码错误","wrong account or password");
private int code;
private String cnMessage;
private String enMessage;
ErrorCode(int code, String cnMessage, String enMessage) {
ErrorCode(int code,String cnMessage,String enMessage) {
this.code = code;
this.cnMessage = cnMessage;
this.enMessage = enMessage;
......
......@@ -22,9 +22,12 @@ import java.util.List;
@Profile({"test","prod"})
public class RequestMappingAspect {
@Pointcut("@annotation(org.springframework.web.bind.annotation.GetMapping)")
public void getMappingAspect(){}
public void getMappingAspect() {
}
@Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)")
public void postMappingAspect(){}
public void postMappingAspect() {
}
@Around("getMappingAspect()")
public Object get(ProceedingJoinPoint joinPoint) throws Throwable {
......@@ -38,16 +41,16 @@ public class RequestMappingAspect {
private Object request(ProceedingJoinPoint joinPoint) throws Throwable {
Date beginDate = new Date();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
Logger logger = org.slf4j.LoggerFactory.getLogger(joinPoint.getTarget().getClass());
Object result = joinPoint.proceed();
String uri = request.getRequestURI();
Object[] params = joinPoint.getArgs();
List<Object> paramsList = Arrays.asList(params);
Date endDate = new Date();
logger.debug("执行时间:"+
(endDate.getTime()-beginDate.getTime())
+",URL:" + uri + "入参参数:" + paramsList+"返回结果:"+result);
logger.debug("执行时间:" +
(endDate.getTime() - beginDate.getTime())
+ ",URL:" + uri + "入参参数:" + paramsList + "返回结果:" + result);
return result;
}
}
......@@ -3,9 +3,6 @@ package com.bsoft.admin.common.aspect;
import com.bsoft.admin.common.Constants;
import com.bsoft.admin.common.exceptions.InvalidTokenException;
import com.bsoft.admin.common.utils.TokenUtil;
import com.bsoft.admin.common.Constants;
import com.bsoft.admin.common.exceptions.InvalidTokenException;
import com.bsoft.admin.common.utils.TokenUtil;
import com.bsoft.common.utils.StringUtil;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
......@@ -26,11 +23,12 @@ import javax.servlet.http.HttpServletRequest;
@Profile({"dev","test","prod"})
public class TokenAspect {
@Pointcut("@annotation(com.bsoft.admin.common.annotations.Token)")
public void tokenAspect(){}
public void tokenAspect() {
}
@Around("tokenAspect()")
public Object verifierToken(ProceedingJoinPoint joinPoint) throws Throwable {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader(Constants.TOKEN_KEY);
if(!StringUtil.isNullOrEmpty(token) && TokenUtil.checkToken(token)){
......
......@@ -29,7 +29,7 @@ public class RequestResult {
this.data = data;
}
public RequestResult(Integer code, String msg, Object data) {
public RequestResult(Integer code,String msg,Object data) {
this.code = code;
this.msg = msg;
this.data = data;
......
package com.bsoft.admin.common.configurations;
import com.bsoft.admin.common.resolvers.CurrentUserMethodArgumentResolver;
import com.bsoft.admin.common.resolvers.CurrentUserMethodArgumentResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
......@@ -12,12 +11,12 @@ import java.util.List;
@Configuration
public class CurrentUserConfigure implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers){
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(currentUserMethodArgumentResolver());
}
@Bean
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver(){
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
return new CurrentUserMethodArgumentResolver();
}
}
package com.bsoft.admin.common.configurations;
import com.bsoft.admin.common.intercepters.LoginInterceptor;
import com.bsoft.admin.common.intercepters.LoginInterceptor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -39,7 +38,7 @@ public class LoginConfigure implements WebMvcConfigurer {
}
@Bean
public LoginInterceptor loginIntercepter(){
public LoginInterceptor loginIntercepter() {
return new LoginInterceptor();
}
}
package com.bsoft.admin.common.enums;
public enum RequestResultType {
SUCCESS(1, "成功"),FAILURE(0, "失败"),;
SUCCESS(1,"成功"),
FAILURE(0,"失败");
private int value;
private String desc;
RequestResultType(int value, String desc){
RequestResultType(int value,String desc) {
this.value = value;
this.desc = desc;
}
......
package com.bsoft.admin.common.enums;
public enum StateType {
ON(1, "启用"),OFF(0, "禁用"),;
ON(1,"启用"),
OFF(0,"禁用");
private int value;
private String desc;
StateType(int value, String desc){
StateType(int value,String desc) {
this.value = value;
this.desc = desc;
}
......
package com.bsoft.admin.common.exceptions;
public class DBConfigurationError extends ExceptionBase {
public DBConfigurationError(String message){
public DBConfigurationError(String message) {
super(message);
}
}
package com.bsoft.admin.common.exceptions;
public class ExceptionBase extends RuntimeException {
public ExceptionBase(){
super();
}
public ExceptionBase() {
super();
}
public ExceptionBase(String message){
super(message);
}
public ExceptionBase(String message) {
super(message);
}
}
package com.bsoft.admin.common.exceptions;
public class InvalidTokenException extends ExceptionBase {
public InvalidTokenException(){
public InvalidTokenException() {
super();
}
public InvalidTokenException(String message){
public InvalidTokenException(String message) {
super(message);
}
}
......@@ -4,10 +4,6 @@ import com.bsoft.admin.common.Result;
import com.bsoft.admin.common.exceptions.DBConfigurationError;
import com.bsoft.admin.common.exceptions.ExceptionBase;
import com.bsoft.admin.common.exceptions.InvalidTokenException;
import com.bsoft.admin.common.Result;
import com.bsoft.admin.common.exceptions.DBConfigurationError;
import com.bsoft.admin.common.exceptions.ExceptionBase;
import com.bsoft.admin.common.exceptions.InvalidTokenException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult;
......@@ -30,71 +26,74 @@ public class GlobalExceptionHandler {
/**
* 其他异常处理
*
* @param request
* @param e
* @return
*/
@ExceptionHandler(Exception.class)
@ResponseBody
public Object defaultErrorHandler(HttpServletRequest request, Exception e){
public Object defaultErrorHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error();
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
public Object MethodArgumentNotValidErrorHandler(HttpServletRequest request, MethodArgumentNotValidException e){
public Object MethodArgumentNotValidErrorHandler(HttpServletRequest request,MethodArgumentNotValidException e) {
String url = request.getRequestURI();
BindingResult bindingResult = e.getBindingResult();
List<ObjectError> allErrors = bindingResult.getAllErrors();
StringBuilder errorStrBu = new StringBuilder();
allErrors.forEach(objectError -> {
FieldError fieldError = (FieldError) objectError;
FieldError fieldError = (FieldError)objectError;
errorStrBu.append(fieldError.getDefaultMessage());
errorStrBu.append(",");
});
});
String errorStr = errorStrBu.toString();
log.error(url + "请求未知异常:" + e.getMessage(), e);
return Result.error(errorStr.substring(0,errorStr.length()-1));
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error(errorStr.substring(0,errorStr.length() - 1));
}
/**
* 其他内部异常
*
* @param request
* @param e
* @return
*/
@ExceptionHandler(ExceptionBase.class)
@ResponseBody
public Object BaseErrorHandler(HttpServletRequest request, Exception e){
public Object BaseErrorHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error();
}
@ExceptionHandler(DBConfigurationError.class)
@ResponseBody
public Object DBConfigurationErrorHandler(HttpServletRequest request, Exception e){
public Object DBConfigurationErrorHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
return Result.error(400, e.getMessage());
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error(400,e.getMessage());
}
/**
* 无效token
*
* @param request
* @param e
* @return
*/
@ExceptionHandler(InvalidTokenException.class)
@ResponseBody
public Object InvalidTokenExceptionHandler(HttpServletRequest request, Exception e){
public Object InvalidTokenExceptionHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error(Result.ErrorCode.INVALID_TOKEN);
}
}
......@@ -3,9 +3,6 @@ package com.bsoft.admin.common.intercepters;
import com.bsoft.admin.common.Constants;
import com.bsoft.admin.common.Result;
import com.bsoft.admin.common.utils.TokenUtil;
import com.bsoft.admin.common.Constants;
import com.bsoft.admin.common.Result;
import com.bsoft.admin.common.utils.TokenUtil;
import org.slf4j.Logger;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
......@@ -17,8 +14,9 @@ import java.io.PrintWriter;
public class LoginInterceptor implements HandlerInterceptor {
Logger logger = org.slf4j.LoggerFactory.getLogger(LoginInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
public boolean preHandle(HttpServletRequest request,HttpServletResponse response,Object handler) throws Exception {
System.out.println("LoginInterceptor----------->preHandle");
String token = request.getHeader(Constants.TOKEN_KEY);
......@@ -26,16 +24,16 @@ public class LoginInterceptor implements HandlerInterceptor {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter writer = null;
try {
try{
String remoteHost = request.getRemoteHost();
String uri = request.getRequestURI();
logger.info(remoteHost + " 访问 " + uri + ", token无效, token:[" + token + "]");
writer = response.getWriter();
writer.print(Result.error(Result.ErrorCode.INVALID_TOKEN));
}catch (IOException e){
}catch(IOException e){
logger.error(e.getMessage());
}finally {
}finally{
if(writer != null){
writer.close();
}
......@@ -43,24 +41,23 @@ public class LoginInterceptor implements HandlerInterceptor {
return false;
}
return HandlerInterceptor.super.preHandle(request, response, handler);
return HandlerInterceptor.super.preHandle(request,response,handler);
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
public void postHandle(HttpServletRequest request,HttpServletResponse response,Object handler,ModelAndView modelAndView) throws Exception {
System.out.println("LoginInterceptor----------->postHandle");
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
HandlerInterceptor.super.postHandle(request,response,handler,modelAndView);
}
@Override
public void afterCompletion(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex) throws Exception {
HttpServletResponse response,Object handler,Exception ex) throws Exception {
System.out.println("LoginInterceptor------->afterCompletion");
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
HandlerInterceptor.super.afterCompletion(request,response,handler,ex);
}
}
......@@ -3,9 +3,6 @@ package com.bsoft.admin.common.resolvers;
import com.bsoft.admin.common.Constants;
import com.bsoft.admin.common.annotations.CurrentUser;
import com.bsoft.admin.common.utils.TokenUtil;
import com.bsoft.admin.common.Constants;
import com.bsoft.admin.common.annotations.CurrentUser;
import com.bsoft.admin.common.utils.TokenUtil;
import com.bsoft.admin.model.SysUser;
import com.bsoft.common.utils.RedisUtil;
import org.springframework.core.MethodParameter;
......@@ -21,11 +18,11 @@ public class CurrentUserMethodArgumentResolver implements HandlerMethodArgumentR
}
@Override
public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer modelAndViewContainer,
NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory) {
public Object resolveArgument(MethodParameter methodParameter,ModelAndViewContainer modelAndViewContainer,
NativeWebRequest nativeWebRequest,WebDataBinderFactory webDataBinderFactory) {
String token = nativeWebRequest.getHeader(Constants.TOKEN_KEY);
if(TokenUtil.checkToken(token)){
SysUser user = (SysUser) RedisUtil.get(token);
SysUser user = (SysUser)RedisUtil.get(token);
return user.getId();
}
return null;
......
package com.bsoft.admin.common.utils;
public class SqlUtil {
public static String TransactSQLInjection(String str)
{
return str.replaceAll(".*([';]+|(--)+).*", " ");
public static String TransactSQLInjection(String str) {
return str.replaceAll(".*([';]+|(--)+).*"," ");
}
}
......@@ -10,40 +10,43 @@ public class TokenUtil {
/**
* 获取token,并将token存入redis
*
* @param secret 密码
* @param user 用户信息
* @return token
*/
public static String getToken(String secret, SysUser user){
public static String getToken(String secret,SysUser user) {
String time = String.valueOf(System.currentTimeMillis());
String token = JWTUtil.create(secret, time, String.valueOf(user.getId()));
RedisUtil.set(token, user, TOKEN_TIME_OUT);
String token = JWTUtil.create(secret,time,String.valueOf(user.getId()));
RedisUtil.set(token,user,TOKEN_TIME_OUT);
return token;
}
/**
* 刷新token,并将旧token设置过期时间为5分钟
*
* @param oldToken 旧的token
* @return 新的token
*/
public static String refresh(String oldToken){
public static String refresh(String oldToken) {
String token = null;
SysUser user = (SysUser) RedisUtil.get(oldToken);
SysUser user = (SysUser)RedisUtil.get(oldToken);
if(checkToken(oldToken)){
RedisUtil.expire(oldToken, OLD_TOKEN_DURATION);
token = getToken(user.getPassword(), user);
RedisUtil.expire(oldToken,OLD_TOKEN_DURATION);
token = getToken(user.getPassword(),user);
}
return token;
}
/**
* 校验token
*
* @param token token
* @return 返回校验结果
*/
public static boolean checkToken(String token){
SysUser user = (SysUser) RedisUtil.get(token);
boolean result = user != null && JWTUtil.verifier(token, user.getPassword());
public static boolean checkToken(String token) {
SysUser user = (SysUser)RedisUtil.get(token);
boolean result = user != null && JWTUtil.verifier(token,user.getPassword());
if(result){
RedisUtil.expire(token,TOKEN_TIME_OUT);
}
......
......@@ -25,12 +25,12 @@ public class LoginController {
private LoginService loginServiceImpl;
@PostMapping("login")
@ApiOperation(value="Result«LoginService.LoginInfo»登录")
public Result<LoginService.LoginInfo> login(@Valid @RequestBody CodeAndPwd codeAndPwd, HttpServletRequest request){
@ApiOperation(value = "Result«LoginService.LoginInfo»登录")
public Result<LoginService.LoginInfo> login(@Valid @RequestBody CodeAndPwd codeAndPwd,HttpServletRequest request) {
String ip = HttpUtil.getIP(request);
LoginService.LoginInfo loginInfo = loginServiceImpl.login(
codeAndPwd.getLoginName(),codeAndPwd.getPassword(),ip);
if(loginInfo.getUser()==null){
if(loginInfo.getUser() == null){
return Result.error(Result.ErrorCode.USERERROR);
}
return Result.success(loginInfo);
......@@ -38,7 +38,7 @@ public class LoginController {
@PostMapping("token")
@ApiOperation("刷新TOKEN")
public Result<String> refresh(@ApiIgnore HttpServletRequest request){
public Result<String> refresh(@ApiIgnore HttpServletRequest request) {
String oldToken = request.getHeader("Authorization");
String token = loginServiceImpl.refreshToken(oldToken);
return Result.success(token);
......
......@@ -21,7 +21,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
@Api(tags = "菜单API",produces="produces",consumes="consumes",protocols="protocols")
@Api(tags = "菜单API", produces = "produces", consumes = "consumes", protocols = "protocols")
@RequestMapping("/menu")
@RestController
public class MenuController {
......@@ -31,7 +31,7 @@ public class MenuController {
@PostMapping("parentall")
@Token
@ApiOperation("查询菜单列表及其子级列表")
public Object getParentAll(@RequestBody MenuReq.GetMenuReq menu)throws Exception{
public Object getParentAll(@RequestBody MenuReq.GetMenuReq menu) throws Exception {
List<SysMenuList> list = sysMenuService.getParentAll(menu);
return Result.success(list);
}
......@@ -39,7 +39,7 @@ public class MenuController {
@PostMapping("all")
@Token
@ApiOperation("查询菜单列表")
public Object getAll()throws Exception{
public Object getAll() throws Exception {
List<SysMenu> list = sysMenuService.getAll();
return Result.success(list);
}
......@@ -47,7 +47,7 @@ public class MenuController {
@PostMapping("info")
@Token
@ApiOperation("查询菜单详细信息")
public Object getById(@RequestBody MenuReq.InfoMenuReq menu)throws Exception{
public Object getById(@RequestBody MenuReq.InfoMenuReq menu) throws Exception {
SysMenu info = sysMenuService.info(menu);
return Result.success(info);
}
......@@ -55,7 +55,7 @@ public class MenuController {
@PostMapping("add")
@Token
@ApiOperation("添加菜单")
public Object addUser(@ApiIgnore @CurrentUser Long userId,@Valid @RequestBody MenuReq.AddMenuReq menu)throws Exception{
public Object addUser(@ApiIgnore @CurrentUser Long userId,@Valid @RequestBody MenuReq.AddMenuReq menu) throws Exception {
boolean result = sysMenuService.addMenu(userId,menu);
if(result)
return Result.success(null);
......@@ -66,7 +66,7 @@ public class MenuController {
@PostMapping("delete")
@Token
@ApiOperation("删除菜单")
public Object addUser(@RequestBody MenuReq.DeleteMenuReq menu)throws Exception{
public Object addUser(@RequestBody MenuReq.DeleteMenuReq menu) throws Exception {
boolean result = sysMenuService.deleteMenu(menu);
if(result)
return Result.success(null);
......@@ -77,7 +77,7 @@ public class MenuController {
@PostMapping("update")
@Token
@ApiOperation("修改菜单")
public Object addUser(@Valid@RequestBody MenuReq.UpdateMenuReq menu)throws Exception{
public Object addUser(@Valid @RequestBody MenuReq.UpdateMenuReq menu) throws Exception {
boolean result = sysMenuService.updateMenu(menu);
if(result)
return Result.success(null);
......@@ -88,7 +88,7 @@ public class MenuController {
@PostMapping("usermenu")
@Token
@ApiOperation("查询用户菜单")
public Object getUserMenu(@RequestBody MenuReq.GetUserMenuReq menu)throws Exception{
public Object getUserMenu(@RequestBody MenuReq.GetUserMenuReq menu) throws Exception {
List<SysUserMenuRsList> list = sysMenuService.getUserMenu(menu.getUserId());
return Result.success(list);
}
......@@ -96,7 +96,7 @@ public class MenuController {
@PostMapping("saveusermenu")
@Token
@ApiOperation("保存用户菜单")
public Object saveUserMenu(@ApiIgnore @CurrentUser Long userId,@RequestBody MenuReq.SaveUserMenuReq menu)throws Exception{
public Object saveUserMenu(@ApiIgnore @CurrentUser Long userId,@RequestBody MenuReq.SaveUserMenuReq menu) throws Exception {
boolean result = sysMenuService.saveUserMenu(userId,menu);
if(result)
return Result.success(null);
......@@ -107,7 +107,7 @@ public class MenuController {
@PostMapping("rolemenu")
@Token
@ApiOperation("查询角色菜单")
public Object getRoleMenu(@RequestBody MenuReq.GetRoleMenuReq menu)throws Exception{
public Object getRoleMenu(@RequestBody MenuReq.GetRoleMenuReq menu) throws Exception {
List<SysRoleMenuRsList> list = sysMenuService.getRoleMenu(menu.getRoleId());
return Result.success(list);
}
......@@ -115,7 +115,7 @@ public class MenuController {
@PostMapping("saverolemenu")
@Token
@ApiOperation("保存角色菜单")
public Object saveRoleMenu(@ApiIgnore @CurrentUser Long userId,@RequestBody MenuReq.SaveRoleMenuReq menu)throws Exception{
public Object saveRoleMenu(@ApiIgnore @CurrentUser Long userId,@RequestBody MenuReq.SaveRoleMenuReq menu) throws Exception {
boolean result = sysMenuService.saveRoleMenu(userId,menu);
if(result)
return Result.success(null);
......@@ -126,7 +126,7 @@ public class MenuController {
@PostMapping("updateSort")
@Token
@ApiOperation("修改排序")
public Object updateSort(@ApiIgnore @CurrentUser Long userId,@RequestBody MenuReq.UpdateSortReq menu)throws Exception{
public Object updateSort(@ApiIgnore @CurrentUser Long userId,@RequestBody MenuReq.UpdateSortReq menu) throws Exception {
boolean result = sysMenuService.updateSort(userId,menu);
if(result)
return Result.success(null);
......
......@@ -57,13 +57,13 @@ public class OrgController {
@PostMapping("add")
@Token
@ApiOperation("添加机构")
public Object addOrg(@ApiIgnore @CurrentUser Long userId, @Valid @RequestBody OrgReq.AddOrgReq org) throws Exception {
public Object addOrg(@ApiIgnore @CurrentUser Integer userId,@Valid @RequestBody OrgReq.AddOrgReq org) throws Exception {
DicOrg sysRole = dicOrgService.getByName(org.getOrgName());
if (sysRole != null) {
if(sysRole != null){
return Result.error("该机构已存在!");
}
boolean result = dicOrgService.addOrg(userId, org);
if (result)
boolean result = dicOrgService.addOrg(userId,org);
if(result)
return Result.success(null);
else
return Result.error();
......@@ -74,7 +74,7 @@ public class OrgController {
@ApiOperation("删除机构")
public Object deleteOrg(@RequestBody OrgReq.DeleteOrgReq org) throws Exception {
boolean result = dicOrgService.deleteOrg(org);
if (result)
if(result)
return Result.success(null);
else
return Result.error();
......@@ -86,13 +86,13 @@ public class OrgController {
public Object updateOrg(@Valid @RequestBody OrgReq.UpdateOrgReq org) throws Exception {
DicOrg reqDic = dicOrgService.info(org.getOrgId());
DicOrg nameRole = dicOrgService.getByName(org.getOrgName());
if (reqDic != null) {
if (nameRole != null && !nameRole.getOrgName().equals(reqDic.getOrgName())) {
if(reqDic != null){
if(nameRole != null && !nameRole.getOrgName().equals(reqDic.getOrgName())){
return Result.error("该机构已存在");
}
}
boolean result = dicOrgService.updateOrg(org);
if (result)
if(result)
return Result.success(null);
else
return Result.error();
......@@ -109,9 +109,9 @@ public class OrgController {
@PostMapping("saveuserorg")
@Token
@ApiOperation("保存用户机构")
public Object saveUserOrg(@ApiIgnore @CurrentUser Long userId, @RequestBody OrgReq.SaveUserOrgReq org) throws Exception {
boolean result = dicOrgService.saveUserOrg(userId, org);
if (result)
public Object saveUserOrg(@ApiIgnore @CurrentUser Long userId,@RequestBody OrgReq.SaveUserOrgReq org) throws Exception {
boolean result = dicOrgService.saveUserOrg(userId,org);
if(result)
return Result.success(null);
else
return Result.error();
......
......@@ -18,7 +18,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
@Api(tags = "角色API",produces="produces",consumes="consumes",protocols="protocols")
@Api(tags = "角色API", produces = "produces", consumes = "consumes", protocols = "protocols")
@RequestMapping("/role")
@RestController
public class RoleController {
......@@ -28,7 +28,7 @@ public class RoleController {
@PostMapping("all")
@Token
@ApiOperation("查询角色列表")
public Object getAll(@Valid @RequestBody RoleReq.GetRoleReq role)throws Exception{
public Object getAll(@Valid @RequestBody RoleReq.GetRoleReq role) throws Exception {
List<SysRole> list = sysRoleService.getAll(role);
return Result.success(list);
}
......@@ -36,7 +36,7 @@ public class RoleController {
@PostMapping("info")
@Token
@ApiOperation("查询角色详细信息")
public Object getById(@RequestBody RoleReq.InfoRoleReq role)throws Exception{
public Object getById(@RequestBody RoleReq.InfoRoleReq role) throws Exception {
SysRole info = sysRoleService.info(role.getRoleId());
return Result.success(info);
}
......@@ -44,9 +44,9 @@ public class RoleController {
@PostMapping("add")
@Token
@ApiOperation("添加角色")
public Object addUser(@ApiIgnore @CurrentUser Long userId,@Valid @RequestBody RoleReq.AddRoleReq role)throws Exception{
public Object addUser(@ApiIgnore @CurrentUser Long userId,@Valid @RequestBody RoleReq.AddRoleReq role) throws Exception {
SysRole sysRole = sysRoleService.findByCode(role.getRoleCode());
if(sysRole!=null){
if(sysRole != null){
return Result.error("该角色已存在!");
}
boolean result = sysRoleService.addRole(userId,role);
......@@ -59,7 +59,7 @@ public class RoleController {
@PostMapping("delete")
@Token
@ApiOperation("删除角色")
public Object addUser(@RequestBody RoleReq.DeleteRoleReq role)throws Exception{
public Object addUser(@RequestBody RoleReq.DeleteRoleReq role) throws Exception {
boolean result = sysRoleService.deleteRole(role);
if(result)
return Result.success(null);
......@@ -70,11 +70,11 @@ public class RoleController {
@PostMapping("update")
@Token
@ApiOperation("修改角色")
public Object addUser(@Valid @RequestBody RoleReq.UpdateRoleReq role)throws Exception{
public Object addUser(@Valid @RequestBody RoleReq.UpdateRoleReq role) throws Exception {
SysRole reqRole = sysRoleService.info(role.getRoleId());
SysRole codeRole = sysRoleService.findByCode(role.getRoleCode());
if(reqRole!=null){
if(codeRole!=null&&!codeRole.getRoleCode().equals(reqRole.getRoleCode())){
if(reqRole != null){
if(codeRole != null && !codeRole.getRoleCode().equals(reqRole.getRoleCode())){
return Result.error("该角色已存在");
}
}
......@@ -88,7 +88,7 @@ public class RoleController {
@PostMapping("saveuserole")
@Token
@ApiOperation("保存用户角色")
public Object saveUserOrg(@ApiIgnore @CurrentUser Long userId,@RequestBody RoleReq.SavaUserRoleReq role)throws Exception{
public Object saveUserOrg(@ApiIgnore @CurrentUser Long userId,@RequestBody RoleReq.SavaUserRoleReq role) throws Exception {
boolean result = sysRoleService.saveUserRole(userId,role);
if(result)
return Result.success(null);
......
......@@ -22,7 +22,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
@Api(tags = "用户API",produces="produces",consumes="consumes",protocols="protocols")
@Api(tags = "用户API", produces = "produces", consumes = "consumes", protocols = "protocols")
@RequestMapping("/user")
@RestController
public class UserController {
......@@ -36,7 +36,7 @@ public class UserController {
@PostMapping("all")
@Token
@ApiOperation("查询用户列表")
public Object getAll(@RequestBody UserReq.GetUserReq user)throws Exception{
public Object getAll(@RequestBody UserReq.GetUserReq user) throws Exception {
List<SysUser> list = userService.getAll(user);
return Result.success(list);
}
......@@ -44,7 +44,7 @@ public class UserController {
@PostMapping("info")
@Token
@ApiOperation("查询用户详细信息")
public Object getById(@RequestBody UserReq.InfoUserReq user)throws Exception{
public Object getById(@RequestBody UserReq.InfoUserReq user) throws Exception {
SysUser info = userService.info(user.getUserId());
return Result.success(info);
}
......@@ -52,12 +52,12 @@ public class UserController {
@PostMapping("add")
@Token
@ApiOperation("添加用户")
public Object addUser(@ApiIgnore@CurrentUser Long userId,@Valid @RequestBody UserReq.AddUserReq user)throws Exception{
public Object addUser(@ApiIgnore @CurrentUser Long userId,@Valid @RequestBody UserReq.AddUserReq user) throws Exception {
SysUser sysUser = userService.findByLoginName(user.getUserCode());
if(sysUser!=null){
if(sysUser != null){
return Result.error("该账号已存在!");
}
boolean result =userService.addUser(userId,user);
boolean result = userService.addUser(userId,user);
if(result)
return Result.success(null);
else
......@@ -67,8 +67,8 @@ public class UserController {
@PostMapping("delete")
@Token
@ApiOperation("删除用户")
public Object deleteUser(@RequestBody UserReq.DeleteUserReq user)throws Exception{
boolean result =userService.deleteUser(user);
public Object deleteUser(@RequestBody UserReq.DeleteUserReq user) throws Exception {
boolean result = userService.deleteUser(user);
if(result)
return Result.success(null);
else
......@@ -78,15 +78,15 @@ public class UserController {
@PostMapping("update")
@Token
@ApiOperation("修改用户")
public Object updateUser(@Valid @RequestBody UserReq.UpdateUserReq user)throws Exception{
public Object updateUser(@Valid @RequestBody UserReq.UpdateUserReq user) throws Exception {
SysUser reqUser = userService.info(user.getUserId());
SysUser codeUser = userService.findByLoginName(user.getUserCode());
if(reqUser!=null){
if(codeUser!=null&&!codeUser.getUserCode().equals(reqUser.getUserCode())){
if(reqUser != null){
if(codeUser != null && !codeUser.getUserCode().equals(reqUser.getUserCode())){
return Result.error("该用户已存在");
}
}
boolean result =userService.updateUser(user);
boolean result = userService.updateUser(user);
if(result)
return Result.success(null);
else
......@@ -96,7 +96,7 @@ public class UserController {
@PostMapping("roles")
@Token
@ApiOperation("查询用户角色")
public Object getRoleListByUser(@RequestBody UserReq.InfoUserReq user)throws Exception{
public Object getRoleListByUser(@RequestBody UserReq.InfoUserReq user) throws Exception {
List<SysRole> sysRoleList = sysUserRoleRsService.getRoleListByUser(user.getUserId());
return Result.success(sysRoleList);
}
......@@ -104,7 +104,7 @@ public class UserController {
@PostMapping("menus")
@Token
@ApiOperation("查询用户菜单")
public Object getMenuByUser(@RequestBody UserReq.InfoUserReq user)throws Exception{
public Object getMenuByUser(@RequestBody UserReq.InfoUserReq user) throws Exception {
List<SysMenuList> sysMenuList = sysMenuService.getMenu(user.getUserId());
return Result.success(sysMenuList);
}
......
......@@ -7,19 +7,19 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DicOrgMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(DicOrg record);
DicOrg selectByPrimaryKey(Long id);
DicOrg selectByPrimaryKey(Integer id);
List<DicOrg> selectAll();
List<DicOrgList> selectParentAll();
int updateByPrimaryKey(DicOrg record);
List<DicOrg> selectByUser(@Param("userId") Long userId);
List<DicOrgList> selectParentAll();
List<DicOrg> selectByUser(@Param("userId") Integer userId);
DicOrg selectByName(@Param("orgName") String orgName);
}
\ No newline at end of file
......@@ -7,19 +7,19 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysMenuMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(SysMenu record);
SysMenu selectByPrimaryKey(Long id);
SysMenu selectByPrimaryKey(Integer id);
List<SysMenu> selectAll();
int updateByPrimaryKey(SysMenu record);
List<SysMenuList> selectMenuAllByUser(Long userId);
List<SysMenuList> selectMenuAllByUser(Integer userId);
List<SysMenuList> selectMenuByRole(Long userId);
List<SysMenuList> selectMenuByRole(Integer userId);
List<SysMenuList> selectParentAll();
......
......@@ -6,17 +6,17 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysRoleMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(SysRole record);
SysRole selectByPrimaryKey(Long id);
SysRole selectByPrimaryKey(Integer id);
List<SysRole> selectAll();
int updateByPrimaryKey(SysRole record);
List<SysRole> selectRoleByUser(Long userId);
List<SysRole> selectRoleByUser(Integer userId);
SysRole selectByCode(@Param("roleCode") Long roleCode);
}
\ No newline at end of file
......@@ -7,17 +7,17 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysRoleMenuRsMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(SysRoleMenuRs record);
SysRoleMenuRs selectByPrimaryKey(Long id);
SysRoleMenuRs selectByPrimaryKey(Integer id);
List<SysRoleMenuRs> selectAll();
int updateByPrimaryKey(SysRoleMenuRs record);
List<SysRoleMenuRsList> selectByRole(@Param("roleId") Long roleId);
List<SysRoleMenuRsList> selectByRole(@Param("roleId") Integer roleId);
int deleteAllByRole(@Param("roleId") Long roleId);
......
......@@ -6,11 +6,11 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysUserMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(SysUser record);
SysUser selectByPrimaryKey(Long id);
SysUser selectByPrimaryKey(Integer id);
List<SysUser> selectAll();
......
......@@ -7,17 +7,17 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysUserMenuRsMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(SysUserMenuRs record);
SysUserMenuRs selectByPrimaryKey(Long id);
SysUserMenuRs selectByPrimaryKey(Integer id);
List<SysUserMenuRs> selectAll();
int updateByPrimaryKey(SysUserMenuRs record);
List<SysUserMenuRsList> selectByUser(@Param("userId") Long userId);
List<SysUserMenuRsList> selectByUser(@Param("userId") Integer userId);
int deleteAllByUser(@Param("userId") Long userId);
......
......@@ -7,17 +7,17 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysUserOrgRsMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(SysUserOrgRs record);
SysUserOrgRs selectByPrimaryKey(Long id);
SysUserOrgRs selectByPrimaryKey(Integer id);
List<SysUserOrgRs> selectAll();
int updateByPrimaryKey(SysUserOrgRs record);
List<SysUserOrgRsList> selectByUser(@Param("userId") Long userId);
List<SysUserOrgRsList> selectByUser(@Param("userId") Integer userId);
SysUserOrgRs selectByUserWithOrg(@Param("userId") Long userId,@Param("orgId") Long orgId);
......
package com.bsoft.admin.mapper;
import com.bsoft.admin.model.SysUserRoleRs;
import com.bsoft.admin.model.SysRole;
import org.apache.ibatis.annotations.Param;
import javax.annotation.security.PermitAll;
import java.util.List;
public interface SysUserRoleRsMapper {
int deleteByPrimaryKey(Long id);
int deleteByPrimaryKey(Integer id);
int insert(SysUserRoleRs record);
SysUserRoleRs selectByPrimaryKey(Long id);
SysUserRoleRs selectByPrimaryKey(Integer id);
List<SysUserRoleRs> selectAll();
......
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class DicOrg {
private Long id;
private Integer id;
private Date createDate;
......@@ -25,13 +25,13 @@ public class DicOrg {
private String orgAddress;
private Long parentId;
private Integer parentId;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -115,29 +115,11 @@ public class DicOrg {
this.orgAddress = orgAddress;
}
public Long getParentId() {
public Integer getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
@Override
public String toString() {
return "DicOrg{" +
"id=" + id +
", createDate=" + createDate +
", createUserid=" + createUserid +
", state=" + state +
", orgCode='" + orgCode + '\'' +
", orgName='" + orgName + '\'' +
", orgNo='" + orgNo + '\'' +
", orgShortName='" + orgShortName + '\'' +
", orgGroup='" + orgGroup + '\'' +
", orgType='" + orgType + '\'' +
", orgAddress='" + orgAddress + '\'' +
", parentId=" + parentId +
'}';
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class SysMenu {
private Long id;
private Integer id;
private Date createData;
......@@ -23,11 +23,11 @@ public class SysMenu {
private Long sort;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -102,20 +102,4 @@ public class SysMenu {
public void setSort(Long sort) {
this.sort = sort;
}
@Override
public String toString() {
return "SysMenu{" +
"id=" + id +
", createData=" + createData +
", createUserid=" + createUserid +
", state=" + state +
", menuName='" + menuName + '\'' +
", menuUrl='" + menuUrl + '\'' +
", menuImage='" + menuImage + '\'' +
", parentId=" + parentId +
", pageCode='" + pageCode + '\'' +
", sort=" + sort +
'}';
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class SysRole {
private Long id;
private Integer id;
private Date createDate;
......@@ -15,11 +15,11 @@ public class SysRole {
private Long roleCode;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -62,16 +62,4 @@ public class SysRole {
public void setRoleCode(Long roleCode) {
this.roleCode = roleCode;
}
@Override
public String toString() {
return "SysRole{" +
"id=" + id +
", createDate=" + createDate +
", createUserid=" + createUserid +
", state=" + state +
", roleName='" + roleName + '\'' +
", roleCode=" + roleCode +
'}';
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class SysRoleMenuRs {
private Long id;
private Integer id;
private Date createDate;
......@@ -15,11 +15,11 @@ public class SysRoleMenuRs {
private Long roleId;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -62,16 +62,4 @@ public class SysRoleMenuRs {
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return "SysRoleMenuRs{" +
"id=" + id +
", createDate=" + createDate +
", createUserid=" + createUserid +
", state=" + state +
", menuId=" + menuId +
", roleId=" + roleId +
'}';
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class SysUser {
private Long id;
private Integer id;
private Date createDate;
......@@ -33,11 +33,11 @@ public class SysUser {
private String lastIp;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -152,25 +152,4 @@ public class SysUser {
public void setLastIp(String lastIp) {
this.lastIp = lastIp;
}
@Override
public String toString() {
return "SysUser{" +
"id=" + id +
", createDate=" + createDate +
", createUserid=" + createUserid +
", state=" + state +
", userCode='" + userCode + '\'' +
", userName='" + userName + '\'' +
", password='" + password + '\'' +
", idcard='" + idcard + '\'' +
", sex='" + sex + '\'' +
", mobile='" + mobile + '\'' +
", pageCount=" + pageCount +
", errorCount=" + errorCount +
", errorTime=" + errorTime +
", lastTime=" + lastTime +
", lastIp='" + lastIp + '\'' +
'}';
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class SysUserMenuRs {
private Long id;
private Integer id;
private Date createDate;
......@@ -15,11 +15,11 @@ public class SysUserMenuRs {
private Long menuId;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -62,16 +62,4 @@ public class SysUserMenuRs {
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
@Override
public String toString() {
return "SysUserMenuRs{" +
"id=" + id +
", createDate=" + createDate +
", createUserid=" + createUserid +
", state=" + state +
", userId=" + userId +
", menuId=" + menuId +
'}';
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class SysUserOrgRs {
private Long id;
private Integer id;
private Date createDate;
......@@ -15,11 +15,11 @@ public class SysUserOrgRs {
private Long orgId;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -62,16 +62,4 @@ public class SysUserOrgRs {
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
@Override
public String toString() {
return "SysUserOrgRs{" +
"id=" + id +
", createDate=" + createDate +
", createUserid=" + createUserid +
", state=" + state +
", userId=" + userId +
", orgId=" + orgId +
'}';
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.bsoft.admin.model;
import java.util.Date;
public class SysUserRoleRs {
private Long id;
private Integer id;
private Date createDate;
......@@ -15,11 +15,11 @@ public class SysUserRoleRs {
private Long roleId;
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -62,16 +62,4 @@ public class SysUserRoleRs {
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return "SysUserRoleRs{" +
"id=" + id +
", createDate=" + createDate +
", createUserid=" + createUserid +
", state=" + state +
", userId=" + userId +
", roleId=" + roleId +
'}';
}
}
\ No newline at end of file
......@@ -2,40 +2,17 @@ package com.bsoft.admin.model.reqmodel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ApiModel("账号密码")
@Data
public class CodeAndPwd {
@ApiModelProperty(value="账号",required = true)
@ApiModelProperty(value = "账号", required = true)
@NotBlank(message = "账号 参数必传")
String loginName;
@NotBlank(message = "密码 参数必传")
@ApiModelProperty(value="密码",required = true)
@ApiModelProperty(value = "密码", required = true)
String password;
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "CodeAndPwd{" +
"loginName='" + loginName + '\'' +
", password='" + password + '\'' +
'}';
}
}
......@@ -8,8 +8,8 @@ import javax.validation.constraints.NotNull;
import java.util.List;
public class MenuReq {
public static class GetMenuReq{
@ApiModelProperty(value="菜单名称")
public static class GetMenuReq {
@ApiModelProperty(value = "菜单名称")
private String menuName;
public String getMenuName() {
......@@ -28,16 +28,16 @@ public class MenuReq {
}
}
public static class InfoMenuReq{
@ApiModelProperty(value="菜单ID",required = true)
public static class InfoMenuReq {
@ApiModelProperty(value = "菜单ID", required = true)
@NotNull(message = "菜单ID 参数必传")
private Long menuId;
private Integer menuId;
public Long getMenuId() {
public Integer getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
public void setMenuId(Integer menuId) {
this.menuId = menuId;
}
......@@ -49,22 +49,22 @@ public class MenuReq {
}
}
public static class AddMenuReq{
@ApiModelProperty(value="菜单名称",required = true)
public static class AddMenuReq {
@ApiModelProperty(value = "菜单名称", required = true)
@NotBlank(message = "菜单名称 参数必传")
private String menuName;
@ApiModelProperty(value="菜单路径",required = true)
@ApiModelProperty(value = "菜单路径", required = true)
private String menuUrl;
@ApiModelProperty(value="菜单图片",required = true)
@ApiModelProperty(value = "菜单图片", required = true)
private String menuImage;
@ApiModelProperty(value="父级关系",required = true)
@ApiModelProperty(value = "父级关系", required = true)
@NotNull(message = "父级关系 参数必传")
private Long parentId;
@ApiModelProperty(value="页面编码",required = true)
@ApiModelProperty(value = "页面编码", required = true)
private String pageCode;
public String getMenuName() {
......@@ -119,16 +119,16 @@ public class MenuReq {
}
}
public static class DeleteMenuReq{
@ApiModelProperty(value="菜单ID",required = true)
public static class DeleteMenuReq {
@ApiModelProperty(value = "菜单ID", required = true)
@NotNull(message = "菜单ID 参数必传")
private Long menuId;
private Integer menuId;
public Long getMenuId() {
public Integer getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
public void setMenuId(Integer menuId) {
this.menuId = menuId;
}
......@@ -140,33 +140,33 @@ public class MenuReq {
}
}
public static class UpdateMenuReq{
@ApiModelProperty(value="菜单ID",required = true)
public static class UpdateMenuReq {
@ApiModelProperty(value = "菜单ID", required = true)
@NotNull(message = "菜单ID 参数必传")
private Long menuId;
private Integer menuId;
@ApiModelProperty(value="菜单名称",required = true)
@ApiModelProperty(value = "菜单名称", required = true)
@NotBlank(message = "菜单名称 参数必传")
private String menuName;
@ApiModelProperty(value="菜单路径",required = true)
@ApiModelProperty(value = "菜单路径", required = true)
private String menuUrl;
@ApiModelProperty(value="菜单图片",required = true)
@ApiModelProperty(value = "菜单图片", required = true)
private String menuImage;
@ApiModelProperty(value="父级关系",required = true)
@ApiModelProperty(value = "父级关系", required = true)
@NotNull(message = "父级关系 参数必传")
private Long parentId;
@ApiModelProperty(value="页面编码",required = true)
@ApiModelProperty(value = "页面编码", required = true)
private String pageCode;
public Long getMenuId() {
public Integer getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
public void setMenuId(Integer menuId) {
this.menuId = menuId;
}
......@@ -226,12 +226,12 @@ public class MenuReq {
/**
* 保存用户菜单入参
*/
public static class SaveUserMenuReq{
@ApiModelProperty(value="用户ID",required = true)
public static class SaveUserMenuReq {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID 参数必传")
private Long userId;
@ApiModelProperty(value="菜单ID集合",required = true)
@ApiModelProperty(value = "菜单ID集合", required = true)
@NotNull(message = "菜单ID集合 参数必传")
private List<Long> menus;
......@@ -263,16 +263,16 @@ public class MenuReq {
/**
* 查询用户菜单入参
*/
public static class GetUserMenuReq{
@ApiModelProperty(value="用户ID",required = true)
public static class GetUserMenuReq {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID 参数必传")
private Long userId;
private Integer userId;
public Long getUserId() {
public Integer getUserId() {
return userId;
}
public void setUserId(Long userId) {
public void setUserId(Integer userId) {
this.userId = userId;
}
......@@ -287,12 +287,12 @@ public class MenuReq {
/**
* 保存角色菜单入参
*/
public static class SaveRoleMenuReq{
@ApiModelProperty(value="角色ID",required = true)
public static class SaveRoleMenuReq {
@ApiModelProperty(value = "角色ID", required = true)
@NotNull(message = "角色ID 参数必传")
private Long roleId;
@ApiModelProperty(value="菜单ID集合",required = true)
@ApiModelProperty(value = "菜单ID集合", required = true)
@NotNull(message = "菜单ID集合 参数必传")
private List<Long> menus;
......@@ -316,16 +316,16 @@ public class MenuReq {
/**
* 查询角色菜单入参
*/
public static class GetRoleMenuReq{
@ApiModelProperty(value="角色ID",required = true)
public static class GetRoleMenuReq {
@ApiModelProperty(value = "角色ID", required = true)
@NotNull(message = "角色ID 参数必传")
private Long roleId;
private Integer roleId;
public Long getRoleId() {
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
}
......@@ -333,8 +333,8 @@ public class MenuReq {
/**
* 修改菜单排序入参
*/
public static class UpdateSortReq{
@ApiModelProperty(value="菜单列表",required = true)
public static class UpdateSortReq {
@ApiModelProperty(value = "菜单列表", required = true)
@NotNull(message = "菜单列表 参数必传")
private List<SysMenu> menus;
......
......@@ -30,13 +30,13 @@ public class OrgReq {
public static class InfoOrgReq {
@ApiModelProperty(value = "机构ID", required = true)
@NotNull(message = "机构ID 参数必传")
private Long orgId;
private Integer orgId;
public Long getOrgId() {
public Integer getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
public void setOrgId(Integer orgId) {
this.orgId = orgId;
}
......@@ -75,7 +75,7 @@ public class OrgReq {
@ApiModelProperty(value = "父级关系", required = true)
@NotNull(message = "父级关系 参数必传")
private Long parentId;
private Integer parentId;
public String getOrgCode() {
return orgCode;
......@@ -133,11 +133,11 @@ public class OrgReq {
this.orgAddress = orgAddress;
}
public Long getParentId() {
public Integer getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
......@@ -159,13 +159,13 @@ public class OrgReq {
public static class DeleteOrgReq {
@ApiModelProperty(value = "机构ID", required = true)
@NotNull(message = "机构ID 参数必传")
private Long orgId;
private Integer orgId;
public Long getOrgId() {
public Integer getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
public void setOrgId(Integer orgId) {
this.orgId = orgId;
}
......@@ -180,7 +180,7 @@ public class OrgReq {
public static class UpdateOrgReq {
@ApiModelProperty(value = "机构ID", required = true)
@NotNull(message = "机构ID 参数必传")
private Long orgId;
private Integer orgId;
@ApiModelProperty(value = "组织机构代码", required = true)
@NotBlank(message = "组织机构代码 参数必传")
......@@ -208,13 +208,13 @@ public class OrgReq {
@ApiModelProperty(value = "父级关系", required = true)
@NotNull(message = "父级关系 参数必传")
private Long parentId;
private Integer parentId;
public Long getOrgId() {
public Integer getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
public void setOrgId(Integer orgId) {
this.orgId = orgId;
}
......@@ -274,11 +274,11 @@ public class OrgReq {
this.orgAddress = orgAddress;
}
public Long getParentId() {
public Integer getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
......@@ -304,13 +304,13 @@ public class OrgReq {
public static class GetUserOrgReq {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID 参数必传")
private Long userId;
private Integer userId;
public Long getUserId() {
public Integer getUserId() {
return userId;
}
public void setUserId(Long userId) {
public void setUserId(Integer userId) {
this.userId = userId;
}
......
......@@ -6,8 +6,8 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
public class RoleReq {
public static class GetRoleReq{
@ApiModelProperty(value="角色名称",required = true)
public static class GetRoleReq {
@ApiModelProperty(value = "角色名称", required = true)
private String roleName;
public String getRoleName() {
......@@ -26,16 +26,16 @@ public class RoleReq {
}
}
public static class InfoRoleReq{
@ApiModelProperty(value="角色ID",required = true)
public static class InfoRoleReq {
@ApiModelProperty(value = "角色ID", required = true)
@NotNull(message = "角色ID 参数必传")
private Long roleId;
private Integer roleId;
public Long getRoleId() {
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
......@@ -47,12 +47,12 @@ public class RoleReq {
}
}
public static class AddRoleReq{
@ApiModelProperty(value="角色编码",required = true)
public static class AddRoleReq {
@ApiModelProperty(value = "角色编码", required = true)
@NotNull(message = "角色编码 参数必传")
private Long roleCode;
@ApiModelProperty(value="角色名称",required = true)
@ApiModelProperty(value = "角色名称", required = true)
@NotBlank(message = "角色名称 参数必传")
private String roleName;
......@@ -81,16 +81,16 @@ public class RoleReq {
}
}
public static class DeleteRoleReq{
@ApiModelProperty(value="角色ID",required = true)
public static class DeleteRoleReq {
@ApiModelProperty(value = "角色ID", required = true)
@NotNull(message = "角色ID 参数必传")
private Long roleId;
private Integer roleId;
public Long getRoleId() {
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
......@@ -102,24 +102,24 @@ public class RoleReq {
}
}
public static class UpdateRoleReq{
@ApiModelProperty(value="角色ID",required = true)
public static class UpdateRoleReq {
@ApiModelProperty(value = "角色ID", required = true)
@NotNull(message = "角色ID 参数必传")
private Long roleId;
private Integer roleId;
@ApiModelProperty(value="角色编码",required = true)
@ApiModelProperty(value = "角色编码", required = true)
@NotNull(message = "角色编码 参数必传")
private Long roleCode;
@ApiModelProperty(value="角色名称",required = true)
@ApiModelProperty(value = "角色名称", required = true)
@NotBlank(message = "角色名称 参数必传")
private String roleName;
public Long getRoleId() {
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
......@@ -149,12 +149,12 @@ public class RoleReq {
}
}
public static class SavaUserRoleReq{
@ApiModelProperty(value="用户ID",required = true)
public static class SavaUserRoleReq {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID 参数必传")
private Long userId;
@ApiModelProperty(value="角色ID",required = true)
@ApiModelProperty(value = "角色ID", required = true)
@NotNull(message = "角色ID 参数必传")
private Long roleId;
......
......@@ -7,8 +7,8 @@ import javax.validation.constraints.NotNull;
public class UserReq {
public static class GetUserReq{
@ApiModelProperty(value="用户名称",required = true)
public static class GetUserReq {
@ApiModelProperty(value = "用户名称", required = true)
private String userName;
public String getUserName() {
......@@ -27,16 +27,16 @@ public class UserReq {
}
}
public static class InfoUserReq{
@ApiModelProperty(value="用户ID",required = true)
public static class InfoUserReq {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID 参数必传")
private Long userId;
private Integer userId;
public Long getUserId() {
public Integer getUserId() {
return userId;
}
public void setUserId(Long userId) {
public void setUserId(Integer userId) {
this.userId = userId;
}
......@@ -48,26 +48,26 @@ public class UserReq {
}
}
public static class AddUserReq{
@ApiModelProperty(value="账号",required = true)
public static class AddUserReq {
@ApiModelProperty(value = "账号", required = true)
@NotBlank(message = "账号 参数必传")
private String userCode;
@ApiModelProperty(value="名称",required = true)
@ApiModelProperty(value = "名称", required = true)
@NotBlank(message = "名称 参数必传")
private String userName;
@ApiModelProperty(value="密码",required = true)
@ApiModelProperty(value = "密码", required = true)
@NotBlank(message = "密码 参数必传")
private String password;
@ApiModelProperty(value="身份证",required = true)
@ApiModelProperty(value = "身份证", required = true)
private String idcard;
@ApiModelProperty(value="性别",required = true)
@ApiModelProperty(value = "性别", required = true)
private String sex;
@ApiModelProperty(value="手机号码",required = true)
@ApiModelProperty(value = "手机号码", required = true)
private String mobile;
public String getUserCode() {
......@@ -132,16 +132,16 @@ public class UserReq {
}
public static class DeleteUserReq{
@ApiModelProperty(value="用户ID",required = true)
public static class DeleteUserReq {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID 参数必传")
private Long userId;
private Integer userId;
public Long getUserId() {
public Integer getUserId() {
return userId;
}
public void setUserId(Long userId) {
public void setUserId(Integer userId) {
this.userId = userId;
}
......@@ -153,37 +153,37 @@ public class UserReq {
}
}
public static class UpdateUserReq{
@ApiModelProperty(value="用户ID",required = true)
public static class UpdateUserReq {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID 参数必传")
private Long userId;
private Integer userId;
@ApiModelProperty(value="账号",required = true)
@ApiModelProperty(value = "账号", required = true)
@NotBlank(message = "账号 参数必传")
private String userCode;
@ApiModelProperty(value="名称",required = true)
@ApiModelProperty(value = "名称", required = true)
@NotBlank(message = "名称 参数必传")
private String userName;
@ApiModelProperty(value="密码",required = true)
@ApiModelProperty(value = "密码", required = true)
@NotBlank(message = "密码 参数必传")
private String password;
@ApiModelProperty(value="身份证",required = true)
@ApiModelProperty(value = "身份证", required = true)
private String idcard;
@ApiModelProperty(value="性别",required = true)
@ApiModelProperty(value = "性别", required = true)
private String sex;
@ApiModelProperty(value="手机号码",required = true)
@ApiModelProperty(value = "手机号码", required = true)
private String mobile;
public Long getUserId() {
public Integer getUserId() {
return userId;
}
public void setUserId(Long userId) {
public void setUserId(Integer userId) {
this.userId = userId;
}
......
package com.bsoft.admin.model.respmodel;
import com.bsoft.admin.model.DicOrg;
import lombok.Data;
import java.util.List;
@Data
public class DicOrgList extends DicOrg {
private List<DicOrgList> dicOrgList;
public List<DicOrgList> getDicOrgList() {
return dicOrgList;
}
public void setDicOrgList(List<DicOrgList> dicOrgList) {
this.dicOrgList = dicOrgList;
}
@Override
public String toString() {
return "DicOrgList{" +
"dicOrgList=" + dicOrgList +
'}';
}
}
......@@ -2,27 +2,14 @@ package com.bsoft.admin.model.respmodel;
import com.bsoft.admin.model.SysMenu;
import lombok.Data;
import java.util.List;
@Data
public class SysMenuList extends SysMenu {
private List<SysMenuList> sysMenuList;
public void setSysMenuList(List<SysMenuList> sysMenuList) {
this.sysMenuList = sysMenuList;
}
public List<SysMenuList> getSysMenuList() {
return this.sysMenuList;
}
@Override
public String toString() {
return "SysMenuList{" +
"sysMenuList=" + sysMenuList +
'}';
}
}
package com.bsoft.admin.model.respmodel;
import com.bsoft.admin.model.SysRoleMenuRs;
import lombok.Data;
@Data
public class SysRoleMenuRsList extends SysRoleMenuRs {
private Long parentId;
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
@Override
public String toString() {
return "SysUserOrgRsList{" +
"parentId=" + parentId +
'}';
}
}
package com.bsoft.admin.model.respmodel;
import com.bsoft.admin.model.SysUserMenuRs;
import lombok.Data;
@Data
public class SysUserMenuRsList extends SysUserMenuRs {
private Long parentId;
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
@Override
public String toString() {
return "SysUserOrgRsList{" +
"parentId=" + parentId +
'}';
}
}
package com.bsoft.admin.model.respmodel;
import com.bsoft.admin.model.SysUserOrgRs;
import lombok.Data;
@Data
public class SysUserOrgRsList extends SysUserOrgRs {
private Long parentId;
......
......@@ -15,9 +15,9 @@ public interface DicOrgService {
List<DicOrg> getAll();
DicOrg info(Long orgId);
DicOrg info(Integer orgId);
boolean addOrg(Long userId,OrgReq.AddOrgReq org);
boolean addOrg(Integer userId,OrgReq.AddOrgReq org);
boolean deleteOrg(OrgReq.DeleteOrgReq org);
......@@ -25,7 +25,7 @@ public interface DicOrgService {
DicOrg getByName(String orgName);
List<SysUserOrgRsList> getUserOrg(Long userId);
List<SysUserOrgRsList> getUserOrg(Integer userId);
boolean saveUserOrg(Long userId,OrgReq.SaveUserOrgReq org);
}
......@@ -10,7 +10,7 @@ import java.util.List;
public interface LoginService {
LoginInfo login(String loginName, String password, String ip);
LoginInfo login(String loginName,String password,String ip);
String refreshToken(String oldToken);
......@@ -26,10 +26,10 @@ public interface LoginService {
public LoginInfo() {
}
public LoginInfo(String token, SysUser user,List<DicOrg> org) {
public LoginInfo(String token,SysUser user,List<DicOrg> org) {
this.token = token;
this.user = user;
this.org=org;
this.org = org;
}
public String getToken() {
......
......@@ -5,40 +5,46 @@ import java.util.List;
public interface ServiceBase<T> {
/**
* 新增
*
* @param t
* @return
*/
int add(T t) ;
int add(T t);
/**
* 查询所有
*
* @return
*/
List<T> findAll();
/**
* 根据id查询
*
* @param id
* @return
*/
T find(Long id);
T find(Integer id);
/**
* 物理删除
*
* @param id
* @return
*/
int delete(Long id);
int delete(Integer id);
/**
* 逻辑删除
*
* @param id
* @return
*/
int logicDelete(Long id);
int logicDelete(Integer id);
/**
* 更新
*
* @param t
* @return
*/
......
package com.bsoft.admin.service;
import com.bsoft.admin.model.SysMenu;
import com.bsoft.admin.model.SysRoleMenuRs;
import com.bsoft.admin.model.SysUserMenuRs;
import com.bsoft.admin.model.reqmodel.MenuReq;
import com.bsoft.admin.model.respmodel.SysMenuList;
import com.bsoft.admin.model.respmodel.SysRoleMenuRsList;
......@@ -13,18 +11,29 @@ import java.util.List;
public interface SysMenuService {
//顶级菜单的父级id
final static Integer MENU_TOP_PARENT_ID =0;
List<SysMenuList> getMenu(Long userId) throws Exception;
final static Integer MENU_TOP_PARENT_ID = 0;
List<SysMenuList> getMenu(Integer userId) throws Exception;
List<SysMenuList> getParentAll(MenuReq.GetMenuReq menu);
List<SysMenu> getAll();
SysMenu info(MenuReq.InfoMenuReq menu);
boolean addMenu(Long userId,MenuReq.AddMenuReq menu);
boolean deleteMenu(MenuReq.DeleteMenuReq menu);
boolean updateMenu(MenuReq.UpdateMenuReq menu);
List<SysUserMenuRsList> getUserMenu(Long userId);
List<SysUserMenuRsList> getUserMenu(Integer userId);
boolean saveUserMenu(Long userId,MenuReq.SaveUserMenuReq menu);
List<SysRoleMenuRsList> getRoleMenu(Long roleId);
List<SysRoleMenuRsList> getRoleMenu(Integer roleId);
boolean saveRoleMenu(Long userId,MenuReq.SaveRoleMenuReq menu);
boolean updateSort(Long userId,MenuReq.UpdateSortReq menu);
}
......@@ -5,12 +5,18 @@ import com.bsoft.admin.model.reqmodel.RoleReq;
import java.util.List;
public interface SysRoleService {
public interface SysRoleService {
SysRole findByCode(Long roleCode);
boolean addRole(Long userId, RoleReq.AddRoleReq role);
boolean addRole(Long userId,RoleReq.AddRoleReq role);
boolean deleteRole(RoleReq.DeleteRoleReq role);
boolean updateRole(RoleReq.UpdateRoleReq role);
List<SysRole> getAll(RoleReq.GetRoleReq role);
SysRole info(Long roleId);
SysRole info(Integer roleId);
boolean saveUserRole(Long userId,RoleReq.SavaUserRoleReq role);
}
......@@ -6,5 +6,5 @@ import com.bsoft.admin.model.SysUserRoleRs;
import java.util.List;
public interface SysUserRoleRsService extends ServiceBase<SysUserRoleRs> {
List<SysRole> getRoleListByUser(Long userId) throws Exception;
List<SysRole> getRoleListByUser(Integer userId) throws Exception;
}
......@@ -7,9 +7,14 @@ import java.util.List;
public interface UserService {
SysUser findByLoginName(String loginName);
boolean addUser(Long userId, UserReq.AddUserReq user);
boolean addUser(Long userId,UserReq.AddUserReq user);
boolean deleteUser(UserReq.DeleteUserReq user);
boolean updateUser(UserReq.UpdateUserReq user);
List<SysUser> getAll(UserReq.GetUserReq user);
SysUser info(Long userId);
SysUser info(Integer userId);
}
......@@ -25,10 +25,10 @@ public class DicOrgServiceImpl implements DicOrgService {
@Resource
private SysUserOrgRsMapper sysUserOrgRsMapper;
private List<DicOrgList> getLevelData(List<DicOrgList> list, Long parentcode) {
private List<DicOrgList> getLevelData(List<DicOrgList> list,Integer parentcode) {
List<DicOrgList> resultList = new ArrayList<>();
for (DicOrgList data : list) {
if (data.getParentId() == parentcode){
for(DicOrgList data : list){
if(data.getParentId() == parentcode){
List<DicOrgList> childList = getLevelData(list,data.getId());
data.setDicOrgList(childList);
resultList.add(data);
......@@ -38,33 +38,33 @@ public class DicOrgServiceImpl implements DicOrgService {
}
public List<DicOrgList> getParentAll(OrgReq.GetOrgReq org){
public List<DicOrgList> getParentAll(OrgReq.GetOrgReq org) {
List<DicOrgList> list = dicOrgMapper.selectParentAll();
if(org.getOrgName()!=null){
if(org.getOrgName() != null){
list = list.stream().filter(
o->(o.getOrgName()!=null && o.getOrgName().toLowerCase().contains(org.getOrgName().toLowerCase())))
o -> (o.getOrgName() != null && o.getOrgName().toLowerCase().contains(org.getOrgName().toLowerCase())))
.collect(Collectors.toList());
}
List<DicOrgList> resultList = getLevelData(list, Long.valueOf(ORG_TOP_PARENT_ID));
List<DicOrgList> resultList = getLevelData(list,ORG_TOP_PARENT_ID);
return resultList;
}
public List<DicOrg> getAll(){
public List<DicOrg> getAll() {
List<DicOrg> list = dicOrgMapper.selectAll();
return list;
}
public DicOrg info(Long orgId){
public DicOrg info(Integer orgId) {
DicOrg dicOrg = dicOrgMapper.selectByPrimaryKey(orgId);
return dicOrg;
}
public boolean addOrg(Long userId,OrgReq.AddOrgReq org){
if(org!=null){
public boolean addOrg(Integer userId,OrgReq.AddOrgReq org) {
if(org != null){
DicOrg dicOrg = new DicOrg();
dicOrg.setCreateDate(new Date());
dicOrg.setCreateUserid(userId);
dicOrg.setState((short) StateType.ON.getValue());
dicOrg.setCreateUserid(Long.valueOf(userId));
dicOrg.setState((short)StateType.ON.getValue());
dicOrg.setOrgCode(org.getOrgCode());
dicOrg.setOrgName(org.getOrgName());
dicOrg.setOrgShortName(org.getOrgShortName());
......@@ -78,11 +78,11 @@ public class DicOrgServiceImpl implements DicOrgService {
return false;
}
public boolean deleteOrg(OrgReq.DeleteOrgReq org){
if(org!=null){
public boolean deleteOrg(OrgReq.DeleteOrgReq org) {
if(org != null){
DicOrg dicOrg = dicOrgMapper.selectByPrimaryKey(org.getOrgId());
if(dicOrg!=null){
dicOrg.setState((short) StateType.OFF.getValue());
if(dicOrg != null){
dicOrg.setState((short)StateType.OFF.getValue());
dicOrgMapper.updateByPrimaryKey(dicOrg);
return true;
}
......@@ -90,10 +90,10 @@ public class DicOrgServiceImpl implements DicOrgService {
return false;
}
public boolean updateOrg(OrgReq.UpdateOrgReq org){
if(org!=null) {
public boolean updateOrg(OrgReq.UpdateOrgReq org) {
if(org != null){
DicOrg dicOrg = dicOrgMapper.selectByPrimaryKey(org.getOrgId());
if(dicOrg!=null){
if(dicOrg != null){
dicOrg.setOrgCode(org.getOrgCode());
dicOrg.setOrgName(org.getOrgName());
dicOrg.setOrgShortName(org.getOrgShortName());
......@@ -108,31 +108,32 @@ public class DicOrgServiceImpl implements DicOrgService {
return false;
}
public DicOrg getByName(String orgName){
public DicOrg getByName(String orgName) {
return dicOrgMapper.selectByName(orgName);
}
/**
* 查询用户机构
*
* @param userId 操作人ID
* @return
*/
@Override
public List<SysUserOrgRsList> getUserOrg(Long userId){
public List<SysUserOrgRsList> getUserOrg(Integer userId) {
List<SysUserOrgRsList> sysUserOrgRs = sysUserOrgRsMapper.selectByUser(userId);
return sysUserOrgRs;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveUserOrg(Long userId,OrgReq.SaveUserOrgReq org){
public boolean saveUserOrg(Long userId,OrgReq.SaveUserOrgReq org) {
int result = 0;
if(org!=null&&org.getOrg()!=null&&org.getOrg().size()>0&&org.getUserId()!=null){
if(org != null && org.getOrg() != null && org.getOrg().size() > 0 && org.getUserId() != null){
sysUserOrgRsMapper.deleteByUser(org.getUserId());
for (Long orgId:org.getOrg()) {
for(Long orgId : org.getOrg()){
//判断是否存在关系数据
SysUserOrgRs sysUserOrgRs = sysUserOrgRsMapper.selectByUserWithOrg(org.getUserId(),orgId);
if(sysUserOrgRs!=null){
if(sysUserOrgRs != null){
//开启状态
sysUserOrgRs.setState((short)StateType.ON.getValue());
result += sysUserOrgRsMapper.updateByPrimaryKey(sysUserOrgRs);
......@@ -144,14 +145,13 @@ public class DicOrgServiceImpl implements DicOrgService {
sysUserOrgRs.setUserId(org.getUserId());
sysUserOrgRs.setCreateDate(new Date());
sysUserOrgRs.setCreateUserid(userId);
sysUserOrgRs.setState((short) StateType.ON.getValue());
sysUserOrgRs.setState((short)StateType.ON.getValue());
result += sysUserOrgRsMapper.insert(sysUserOrgRs);
}
}
}
return result>0;
return result > 0;
}
}
......@@ -26,13 +26,13 @@ public class LoginServiceImpl implements LoginService {
private DicOrgMapper dicOrgMapper;
@Override
public LoginInfo login(String logName, String password,String ip) {
public LoginInfo login(String logName,String password,String ip) {
LoginInfo loginInfo = new LoginInfo();
SysUser user = userServiceImpl.findByLoginName(logName);
if(user != null && user.getPassword().equals(password)){
String token = TokenUtil.getToken(password, user);
String token = TokenUtil.getToken(password,user);
//修改ip以及最后登录时间
user.setLastIp(ip);
user.setLastTime(new Date());
......@@ -42,13 +42,13 @@ public class LoginServiceImpl implements LoginService {
loginInfo.setToken(token);
loginInfo.setUser(user);
//查询用户机构
List<DicOrg> orgList =dicOrgMapper.selectByUser(user.getId());
List<DicOrg> orgList = dicOrgMapper.selectByUser(user.getId());
loginInfo.setOrg(orgList);
}
return loginInfo;
}
public String refreshToken(String oldToken){
public String refreshToken(String oldToken) {
return TokenUtil.refresh(oldToken);
}
}
......@@ -28,12 +28,12 @@ public class SysRoleServiceImpl implements SysRoleService {
}
@Override
public boolean addRole(Long userId, RoleReq.AddRoleReq role) {
if (role != null) {
public boolean addRole(Long userId,RoleReq.AddRoleReq role) {
if(role != null){
SysRole sysRole = new SysRole();
sysRole.setCreateDate(new Date());
sysRole.setCreateUserid(userId);
sysRole.setState((short) StateType.ON.getValue());
sysRole.setState((short)StateType.ON.getValue());
sysRole.setRoleCode(role.getRoleCode());
sysRole.setRoleName(role.getRoleName());
sysRoleMapper.insert(sysRole);
......@@ -44,10 +44,10 @@ public class SysRoleServiceImpl implements SysRoleService {
@Override
public boolean deleteRole(RoleReq.DeleteRoleReq role) {
if (role != null) {
if(role != null){
SysRole sysRole = sysRoleMapper.selectByPrimaryKey(role.getRoleId());
if (sysRole != null) {
sysRole.setState((short) StateType.OFF.getValue());
if(sysRole != null){
sysRole.setState((short)StateType.OFF.getValue());
sysRoleMapper.updateByPrimaryKey(sysRole);
return true;
}
......@@ -57,9 +57,9 @@ public class SysRoleServiceImpl implements SysRoleService {
@Override
public boolean updateRole(RoleReq.UpdateRoleReq role) {
if (role != null) {
if(role != null){
SysRole sysRole = sysRoleMapper.selectByPrimaryKey(role.getRoleId());
if (sysRole != null) {
if(sysRole != null){
sysRole.setRoleCode(role.getRoleCode());
sysRole.setRoleName(role.getRoleName());
sysRoleMapper.updateByPrimaryKey(sysRole);
......@@ -72,7 +72,7 @@ public class SysRoleServiceImpl implements SysRoleService {
@Override
public List<SysRole> getAll(RoleReq.GetRoleReq role) {
List<SysRole> list = sysRoleMapper.selectAll();
if (role.getRoleName() != null) {
if(role.getRoleName() != null){
list = list.stream().filter(
o -> (o.getRoleName() != null && o.getRoleName().toLowerCase().contains(role.getRoleName().toLowerCase())))
.collect(Collectors.toList());
......@@ -81,27 +81,27 @@ public class SysRoleServiceImpl implements SysRoleService {
}
@Override
public SysRole info(Long roleId) {
public SysRole info(Integer roleId) {
SysRole sysRole = sysRoleMapper.selectByPrimaryKey(roleId);
return sysRole;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveUserRole(Long userId, RoleReq.SavaUserRoleReq role) {
public boolean saveUserRole(Long userId,RoleReq.SavaUserRoleReq role) {
int result = 0;
if (role != null && role.getRoleId() != null && role.getUserId() != null) {
if(role != null && role.getRoleId() != null && role.getUserId() != null){
//先删除用户关联数据
sysUserRoleRsMapper.deleteByUser(role.getUserId());
SysUserRoleRs info = sysUserRoleRsMapper.selectByUser(role.getUserId(), role.getRoleId());
if (info != null) {
info.setState((short) StateType.ON.getValue());
SysUserRoleRs info = sysUserRoleRsMapper.selectByUser(role.getUserId(),role.getRoleId());
if(info != null){
info.setState((short)StateType.ON.getValue());
result = sysUserRoleRsMapper.updateByPrimaryKey(info);
} else {
}else{
info = new SysUserRoleRs();
info.setCreateDate(new Date());
info.setCreateUserid(userId);
info.setState((short) StateType.ON.getValue());
info.setState((short)StateType.ON.getValue());
info.setUserId(role.getUserId());
info.setRoleId(role.getRoleId());
result = sysUserRoleRsMapper.insert(info);
......
......@@ -19,7 +19,7 @@ public class SysUserRoleServiceImpl implements SysUserRoleRsService {
private SysRoleMapper sysRoleMapper;
@Override
public List<SysRole> getRoleListByUser(Long userId) throws Exception {
public List<SysRole> getRoleListByUser(Integer userId) throws Exception {
return sysRoleMapper.selectRoleByUser(userId);
}
......@@ -34,17 +34,17 @@ public class SysUserRoleServiceImpl implements SysUserRoleRsService {
}
@Override
public SysUserRoleRs find(Long id) {
public SysUserRoleRs find(Integer id) {
return sysUserRoleRsMapper.selectByPrimaryKey(id);
}
@Override
public int delete(Long id) {
public int delete(Integer id) {
return sysUserRoleRsMapper.deleteByPrimaryKey(id);
}
@Override
public int logicDelete(Long id) {
public int logicDelete(Integer id) {
return 0;
}
......
......@@ -24,8 +24,8 @@ public class UserServiceImpl implements UserService {
}
@Override
public boolean addUser(Long userId, UserReq.AddUserReq user){
if(user!=null) {
public boolean addUser(Long userId,UserReq.AddUserReq user) {
if(user != null){
SysUser sysUser = new SysUser();
sysUser.setUserCode(user.getUserCode());
sysUser.setUserName(user.getUserName());
......@@ -35,7 +35,7 @@ public class UserServiceImpl implements UserService {
sysUser.setSex(user.getSex());
sysUser.setCreateDate(new Date());
sysUser.setCreateUserid(userId);
sysUser.setState((short) StateType.ON.getValue());
sysUser.setState((short)StateType.ON.getValue());
sysUserMapper.insert(sysUser);
return true;
}
......@@ -44,9 +44,9 @@ public class UserServiceImpl implements UserService {
@Override
public boolean deleteUser(UserReq.DeleteUserReq user) {
if(user!=null){
if(user != null){
SysUser sysUser = sysUserMapper.selectByPrimaryKey(user.getUserId());
if(sysUser!=null){
if(sysUser != null){
sysUser.setState((short)StateType.OFF.getValue());
sysUserMapper.updateByPrimaryKey(sysUser);
return true;
......@@ -57,9 +57,9 @@ public class UserServiceImpl implements UserService {
@Override
public boolean updateUser(UserReq.UpdateUserReq user) {
if(user!=null){
if(user != null){
SysUser sysUser = sysUserMapper.selectByPrimaryKey(user.getUserId());
if(sysUser!=null){
if(sysUser != null){
sysUser.setUserCode(user.getUserCode());
sysUser.setUserName(user.getUserName());
sysUser.setPassword(user.getPassword());
......@@ -76,17 +76,17 @@ public class UserServiceImpl implements UserService {
@Override
public List<SysUser> getAll(UserReq.GetUserReq user) {
List<SysUser> list = sysUserMapper.selectAll();
if(user.getUserName()!=null){
if(user.getUserName() != null){
list = list.stream().filter(
o->(o.getUserName()!=null && o.getUserName().toLowerCase().contains(user.getUserName().toLowerCase())))
o -> (o.getUserName() != null && o.getUserName().toLowerCase().contains(user.getUserName().toLowerCase())))
.collect(Collectors.toList());
}
return list;
}
@Override
public SysUser info(Long userId) {
SysUser sysUser=sysUserMapper.selectByPrimaryKey(userId);
public SysUser info(Integer userId) {
SysUser sysUser = sysUserMapper.selectByPrimaryKey(userId);
return sysUser;
}
}
#### \u5F00\u53D1\u73AF\u5883 ###################################################
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.username=CH
spring.datasource.password=123456
spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his
spring.datasource.url=jdbc:mysql://192.168.18.176:3306/scml_zp_cs?useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true&rewriteBatchedStatements=TRUE&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=Suvalue2016
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA40\uFF09
spring.redis.database=0
......
#### \u5F00\u53D1\u73AF\u5883 ###################################################
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.username=scml_zp_cs
spring.datasource.password=123
spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his
#### \u6D4B\u8BD5\u73AF\u5883 ###################################################
spring.datasource.url=jdbc:mysql://192.168.18.176:3306/scml_zp_cs?useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true&rewriteBatchedStatements=TRUE&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=Suvalue2016
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA40\uFF09
spring.redis.database=0
......
<?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.bsoft.admin.mapper.DicOrgMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.DicOrg">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="ORG_CODE" jdbcType="VARCHAR" property="orgCode" />
<result column="ORG_NAME" jdbcType="VARCHAR" property="orgName" />
<result column="ORG_NO" jdbcType="VARCHAR" property="orgNo" />
<result column="ORG_SHORT_NAME" jdbcType="VARCHAR" property="orgShortName" />
<result column="ORG_GROUP" jdbcType="VARCHAR" property="orgGroup" />
<result column="ORG_TYPE" jdbcType="VARCHAR" property="orgType" />
<result column="ORG_ADDRESS" jdbcType="VARCHAR" property="orgAddress" />
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
</resultMap>
<resultMap id="DicOrgResultMap" extends="BaseResultMap" type="com.bsoft.admin.model.respmodel.DicOrgList" />
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from DIC_ORG
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.DicOrg">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_DIC_ORG_ID.nextval from dual
</selectKey>
insert into DIC_ORG (ID,CREATE_DATE, CREATE_USERID, "STATE",
ORG_CODE, ORG_NAME, ORG_NO,
ORG_SHORT_NAME, ORG_GROUP, ORG_TYPE,
ORG_ADDRESS, PARENT_ID)
values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR},
#{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR},
#{orgAddress,jdbcType=VARCHAR}, #{parentId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.DicOrg">
update DIC_ORG
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
ORG_CODE = #{orgCode,jdbcType=VARCHAR},
ORG_NAME = #{orgName,jdbcType=VARCHAR},
ORG_NO = #{orgNo,jdbcType=VARCHAR},
ORG_SHORT_NAME = #{orgShortName,jdbcType=VARCHAR},
ORG_GROUP = #{orgGroup,jdbcType=VARCHAR},
ORG_TYPE = #{orgType,jdbcType=VARCHAR},
ORG_ADDRESS = #{orgAddress,jdbcType=VARCHAR},
PARENT_ID = #{parentId,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from DIC_ORG
where ID = #{id,jdbcType=DECIMAL} and "STATE"=1
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from DIC_ORG
where "STATE"=1
</select>
<select id="selectParentAll" resultMap="DicOrgResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from DIC_ORG
where "STATE"=1
</select>
<select id="selectByUser" resultMap="BaseResultMap">
SELECT o.*
FROM SYS_USER_ORG_RS uor,DIC_ORG o
where uor.ORG_ID=o.ID and uor.USER_ID= #{userId,jdbcType=DECIMAL}
and o."STATE"=1 and uor."STATE"=1
</select>
<select id="selectByName" resultMap="BaseResultMap">
select * from DIC_ORG where ORG_NAME=#{orgName,jdbcType=VARCHAR} and "STATE"=1
</select>
</mapper>
\ No newline at end of file
<?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.bsoft.admin.mapper.SysMenuMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.SysMenu">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATA" jdbcType="TIMESTAMP" property="createData" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="MENU_NAME" jdbcType="VARCHAR" property="menuName" />
<result column="MENU_URL" jdbcType="VARCHAR" property="menuUrl" />
<result column="MENU_IMAGE" jdbcType="VARCHAR" property="menuImage" />
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
<result column="PAGE_CODE" jdbcType="VARCHAR" property="pageCode" />
<result column="SORT" jdbcType="DECIMAL" property="sort" />
</resultMap>
<resultMap id="sysMenuResultMap" type="com.bsoft.admin.model.respmodel.SysMenuList" extends="BaseResultMap"/>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from SYS_MENU
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.SysMenu">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_SYS_MENU_ID.nextval from dual
</selectKey>
insert into SYS_MENU (ID,CREATE_DATA, CREATE_USERID, "STATE",
MENU_NAME, MENU_URL, MENU_IMAGE,
PARENT_ID, PAGE_CODE, SORT
)
values (#{id,jdbcType=DECIMAL},#{createData,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, #{menuImage,jdbcType=VARCHAR},
#{parentId,jdbcType=DECIMAL}, #{pageCode,jdbcType=VARCHAR}, #{sort,jdbcType=DECIMAL}
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.SysMenu">
update SYS_MENU
set CREATE_DATA = #{createData,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
MENU_NAME = #{menuName,jdbcType=VARCHAR},
MENU_URL = #{menuUrl,jdbcType=VARCHAR},
MENU_IMAGE = #{menuImage,jdbcType=VARCHAR},
PARENT_ID = #{parentId,jdbcType=DECIMAL},
PAGE_CODE = #{pageCode,jdbcType=VARCHAR},
SORT = #{sort,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATA, CREATE_USERID, "STATE", MENU_NAME, MENU_URL, MENU_IMAGE,
PARENT_ID, PAGE_CODE, SORT
from SYS_MENU
where ID = #{id,jdbcType=DECIMAL} and "STATE"=1
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATA, CREATE_USERID, "STATE", MENU_NAME, MENU_URL, MENU_IMAGE,
PARENT_ID, PAGE_CODE, SORT
from SYS_MENU
where "STATE"=1
</select>
<select id="selectParentAll" resultMap="sysMenuResultMap">
select ID, CREATE_DATA, CREATE_USERID, "STATE", MENU_NAME, MENU_URL, MENU_IMAGE,
PARENT_ID, PAGE_CODE, SORT
from SYS_MENU
where "STATE"=1
</select>
<select id="selectMenuAllByUser" resultMap="sysMenuResultMap">
select DISTINCT m.ID,m.MENU_NAME,m.MENU_URL,m.MENU_IMAGE,m.PARENT_ID,m.PAGE_CODE,m.SORT,umr.STATE
from
SYS_USER_MENU_RS umr
LEFT JOIN
SYS_MENU m on umr.MENU_ID = m.ID
where m.STATE=1 and umr.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<select id="selectMenuByRole" resultMap="sysMenuResultMap">
select DISTINCT m.ID,m.MENU_NAME,m.MENU_URL,m.MENU_IMAGE,m.PARENT_ID,m.PAGE_CODE,m.SORT,rmr.STATE
from
SYS_ROLE_MENU_RS rmr
LEFT JOIN
SYS_MENU m on rmr.MENU_ID = m.ID
LEFT JOIN
SYS_USER_ROLE_RS urr on rmr.ROLE_ID = urr.Role_ID
where rmr.STATE=1 and m.STATE=1 and urr.STATE=1 and urr.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<select id="selectMaxSort" resultType="java.lang.Integer">
select nvl(MAX(SORT),0) AS SORT
from SYS_MENU
where PARENT_ID=#{parentId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
<?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.bsoft.admin.mapper.SysRoleMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.SysRole">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName" />
<result column="ROLE_CODE" jdbcType="DECIMAL" property="roleCode" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from SYS_ROLE
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.SysRole">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_SYS_ROLE_ID.nextval from dual
</selectKey>
insert into SYS_ROLE (ID,CREATE_DATE, CREATE_USERID, "STATE",
ROLE_NAME, ROLE_CODE)
values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL},
#{state,jdbcType=DECIMAL}, #{roleName,jdbcType=VARCHAR}, #{roleCode,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.SysRole">
update SYS_ROLE
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
ROLE_NAME = #{roleName,jdbcType=VARCHAR},
ROLE_CODE = #{roleCode,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", ROLE_NAME, ROLE_CODE
from SYS_ROLE
where ID = #{id,jdbcType=DECIMAL} and "STATE"!=0
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", ROLE_NAME, ROLE_CODE
from SYS_ROLE
where "STATE"!=0
</select>
<select id="selectRoleByUser" resultMap="BaseResultMap">
select r.*
from SYS_USER_ROLE_RS rs,SYS_ROLE r
where USER_ID=#{userId,jdbcType=DECIMAL} and rs.ROLE_ID=r.ID
and rs.STATE!=0 and r.STATE!=0
</select>
<select id="selectByCode" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", ROLE_NAME, ROLE_CODE
from SYS_ROLE
where ROLE_CODE = #{roleCode,jdbcType=DECIMAL} and "STATE"!=0
</select>
</mapper>
\ No newline at end of file
<?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.bsoft.admin.mapper.SysRoleMenuRsMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.SysRoleMenuRs">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="MENU_ID" jdbcType="DECIMAL" property="menuId" />
<result column="ROLE_ID" jdbcType="DECIMAL" property="roleId" />
</resultMap>
<resultMap id="SysRoleMenuRsList" extends="BaseResultMap" type="com.bsoft.admin.model.respmodel.SysRoleMenuRsList">
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from SYS_ROLE_MENU_RS
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.SysRoleMenuRs">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_SYS_ROLE_MENU_RSR_ID.nextval from dual
</selectKey>
insert into SYS_ROLE_MENU_RS (ID,CREATE_DATE, CREATE_USERID, "STATE",
MENU_ID, ROLE_ID)
values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{menuId,jdbcType=DECIMAL}, #{roleId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.SysRoleMenuRs">
update SYS_ROLE_MENU_RS
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
MENU_ID = #{menuId,jdbcType=DECIMAL},
ROLE_ID = #{roleId,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", MENU_ID, ROLE_ID
from SYS_ROLE_MENU_RS
where ID = #{id,jdbcType=DECIMAL} and "STATE"=1
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", MENU_ID, ROLE_ID
from SYS_ROLE_MENU_RS
where "STATE"=1
</select>
<select id="selectByRole" resultMap="SysRoleMenuRsList">
select MAP.*,m.PARENT_ID
from SYS_ROLE_MENU_RS MAP
join SYS_MENU m on m.ID=MAP.MENU_ID
where MAP."STATE"=1 and MAP.ROLE_ID = #{roleId,jdbcType=DECIMAL}
</select>
<update id="deleteAllByRole">
update SYS_ROLE_MENU_RS set "STATE"=0 where ROLE_ID = #{roleId,jdbcType=DECIMAL}
</update>
<select id="selectByUserWithRole" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", MENU_ID, ROLE_ID
from SYS_ROLE_MENU_RS
where ROLE_ID = #{roleId,jdbcType=DECIMAL}
and MENU_ID=#{menuId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
<?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.bsoft.admin.mapper.SysUserMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.SysUser">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="USER_CODE" jdbcType="VARCHAR" property="userCode" />
<result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
<result column="PASSWORD" jdbcType="VARCHAR" property="password" />
<result column="IDCARD" jdbcType="VARCHAR" property="idcard" />
<result column="SEX" jdbcType="VARCHAR" property="sex" />
<result column="MOBILE" jdbcType="VARCHAR" property="mobile" />
<result column="PAGE_COUNT" jdbcType="DECIMAL" property="pageCount" />
<result column="ERROR_COUNT" jdbcType="DECIMAL" property="errorCount" />
<result column="ERROR_TIME" jdbcType="TIMESTAMP" property="errorTime" />
<result column="LAST_TIME" jdbcType="TIMESTAMP" property="lastTime" />
<result column="LAST_IP" jdbcType="VARCHAR" property="lastIp" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from SYS_USER
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.SysUser">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_SYS_USER_ID.nextval from dual
</selectKey>
insert into SYS_USER (ID,CREATE_DATE, CREATE_USERID, "STATE",
USER_CODE, USER_NAME, "PASSWORD",
IDCARD, SEX, MOBILE,
PAGE_COUNT, ERROR_COUNT, ERROR_TIME,
LAST_TIME, LAST_IP)
values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL},
#{state,jdbcType=DECIMAL},#{userCode,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{idcard,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{pageCount,jdbcType=DECIMAL}, #{errorCount,jdbcType=DECIMAL}, #{errorTime,jdbcType=TIMESTAMP},
#{lastTime,jdbcType=TIMESTAMP}, #{lastIp,jdbcType=VARCHAR})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.SysUser">
update SYS_USER
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
USER_CODE = #{userCode,jdbcType=VARCHAR},
USER_NAME = #{userName,jdbcType=VARCHAR},
"PASSWORD" = #{password,jdbcType=VARCHAR},
IDCARD = #{idcard,jdbcType=VARCHAR},
SEX = #{sex,jdbcType=VARCHAR},
MOBILE = #{mobile,jdbcType=VARCHAR},
PAGE_COUNT = #{pageCount,jdbcType=DECIMAL},
ERROR_COUNT = #{errorCount,jdbcType=DECIMAL},
ERROR_TIME = #{errorTime,jdbcType=TIMESTAMP},
LAST_TIME = #{lastTime,jdbcType=TIMESTAMP},
LAST_IP = #{lastIp,jdbcType=VARCHAR}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_CODE, USER_NAME, "PASSWORD",
IDCARD, SEX, MOBILE, PAGE_COUNT, ERROR_COUNT, ERROR_TIME, LAST_TIME, LAST_IP
from SYS_USER
where ID = #{id,jdbcType=DECIMAL} and "STATE"!=0
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_CODE, USER_NAME, "PASSWORD",
IDCARD, SEX, MOBILE, PAGE_COUNT, ERROR_COUNT, ERROR_TIME, LAST_TIME, LAST_IP
from SYS_USER
where "STATE"!=0
</select>
<select id="selectByCode" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_CODE, USER_NAME, PASSWORD, IDCARD,
SEX, MOBILE, PAGE_COUNT, ERROR_COUNT, ERROR_TIME, LAST_TIME, LAST_IP
from SYS_USER
where USER_CODE=#{userCode,jdbcType=VARCHAR}
and "STATE" != 0
</select>
</mapper>
\ No newline at end of file
<?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.bsoft.admin.mapper.SysUserMenuRsMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.SysUserMenuRs">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="USER_ID" jdbcType="DECIMAL" property="userId" />
<result column="MENU_ID" jdbcType="DECIMAL" property="menuId" />
</resultMap>
<resultMap id="SysUserMenuRsList" extends="BaseResultMap" type="com.bsoft.admin.model.respmodel.SysUserMenuRsList">
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from SYS_USER_MENU_RS
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.SysUserMenuRs">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_SYS_USER_MENU_RS_ID.nextval from dual
</selectKey>
insert into SYS_USER_MENU_RS (ID,CREATE_DATE, CREATE_USERID, "STATE",
USER_ID, MENU_ID)
values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{userId,jdbcType=DECIMAL}, #{menuId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.SysUserMenuRs">
update SYS_USER_MENU_RS
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
USER_ID = #{userId,jdbcType=DECIMAL},
MENU_ID = #{menuId,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, MENU_ID
from SYS_USER_MENU_RS
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, MENU_ID
from SYS_USER_MENU_RS
</select>
<select id="selectByUser" resultMap="SysUserMenuRsList">
select MAP.*,m.PARENT_ID
from SYS_USER_MENU_RS MAP
join SYS_MENU m on m.ID=MAP.MENU_ID
where MAP."STATE"=1 and MAP.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<update id="deleteAllByUser">
update SYS_USER_MENU_RS set "STATE"=0 where USER_ID = #{userId,jdbcType=DECIMAL}
</update>
<select id="selectByUserWithMenu" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, MENU_ID
from SYS_USER_MENU_RS
where USER_ID = #{userId,jdbcType=DECIMAL}
and MENU_ID=#{menuId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
<?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.bsoft.admin.mapper.SysUserOrgRsMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.SysUserOrgRs">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="USER_ID" jdbcType="DECIMAL" property="userId" />
<result column="ORG_ID" jdbcType="DECIMAL" property="orgId" />
</resultMap>
<resultMap id="SysUserOrgRsList" extends="BaseResultMap" type="com.bsoft.admin.model.respmodel.SysUserOrgRsList">
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from SYS_USER_ORG_RS
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.SysUserOrgRs">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_SYS_USER_ORG_RS_ID.nextval from dual
</selectKey>
insert into SYS_USER_ORG_RS (ID,CREATE_DATE, CREATE_USERID, "STATE",
USER_ID, ORG_ID)
values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{userId,jdbcType=DECIMAL}, #{orgId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.SysUserOrgRs">
update SYS_USER_ORG_RS
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
USER_ID = #{userId,jdbcType=DECIMAL},
ORG_ID = #{orgId,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ORG_ID
from SYS_USER_ORG_RS
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ORG_ID
from SYS_USER_ORG_RS
where "STATE" = 1
</select>
<select id="selectByUser" resultMap="SysUserOrgRsList">
select map.*,o.PARENT_ID
from SYS_USER_ORG_RS MAP
join DIC_ORG o on o.ID=map.ORG_ID
where MAP."STATE" = 1 and MAP.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<select id="selectByUserWithOrg" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ORG_ID
from SYS_USER_ORG_RS
where USER_ID = #{userId,jdbcType=DECIMAL} and ORG_ID=#{orgId,jdbcType=DECIMAL}
</select>
<update id="deleteByUser">
update SYS_USER_ORG_RS
set "STATE" = 0
where USER_ID = #{userId,jdbcType=DECIMAL}
</update>
</mapper>
\ No newline at end of file
<?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.bsoft.admin.mapper.SysUserRoleRsMapper">
<resultMap id="BaseResultMap" type="com.bsoft.admin.model.SysUserRoleRs">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="USER_ID" jdbcType="DECIMAL" property="userId" />
<result column="ROLE_ID" jdbcType="DECIMAL" property="roleId" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from SYS_USER_ROLE_RS
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" parameterType="com.bsoft.admin.model.SysUserRoleRs">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
select SEQ_SYS_USER_ROLE_RS_ID.nextval from dual
</selectKey>
insert into SYS_USER_ROLE_RS (ID,CREATE_DATE, CREATE_USERID, "STATE",
USER_ID, ROLE_ID)
values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{userId,jdbcType=DECIMAL}, #{roleId,jdbcType=DECIMAL})
</insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.admin.model.SysUserRoleRs">
update SYS_USER_ROLE_RS
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL},
USER_ID = #{userId,jdbcType=DECIMAL},
ROLE_ID = #{roleId,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ROLE_ID
from SYS_USER_ROLE_RS
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ROLE_ID
from SYS_USER_ROLE_RS
where "STATE"=1
</select>
<update id="deleteByUser">
update SYS_USER_ROLE_RS
set "STATE" = 0
where USER_ID = #{userId,jdbcType=DECIMAL}
</update>
<select id="selectByUser" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ROLE_ID
from SYS_USER_ROLE_RS
where USER_ID = #{userId,jdbcType=DECIMAL}
and ROLE_ID = #{roleId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
......@@ -6,12 +6,12 @@
<!-- 引入配置文件 -->
<properties resource="./application-dev.properties"/>
<context id="Oracle" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<context id="MySql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<!-- 生成的文件编码 -->
<property name="javaFileEncoding" value="utf-8"/>
<property name="autoDelimitKeywords" value="true"/>
<property name="beginningDelimiter" value="&quot;"/>
<property name="endingDelimiter" value="&quot;"/>
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!-- 通过自定义插件类生成自定义注解和接口 -->
<!--<plugin type="com.suvalue.common.GenPlugin">-->
......@@ -44,105 +44,26 @@
<!-- &lt;!&ndash; 主键生成方式 &ndash;&gt;-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<table tableName="SYS_USER" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ID.nextval from dual" identity="true" />
<table tableName="sys_menu">
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="SYS_ROLE" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_SYS_ROLE_ID.nextval from dual" identity="true" />
<table tableName="sys_role">
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="SYS_MENU" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_SYS_MENU_ID.nextval from dual" identity="true" />
<table tableName="sys_role_menu_rs">
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="DIC_ORG" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_DIC_ORG_ID.nextval from dual" identity="true" />
<table tableName="sys_user_org_rs">
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="SYS_ROLE_MENU_RS" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_SYS_ROLE_MENU_RS_ID.nextval from dual" identity="true" />
<table tableName="sys_user">
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="SYS_USER_MENU_RS" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_SYS_USER_MENU_RS _ID.nextval from dual" identity="true" />
<table tableName="sys_user_role_rs">
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="SYS_USER_ORG_RS" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ORG_RS_ID.nextval from dual" identity="true" />
<table tableName="sys_user_menu_rs">
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="SYS_USER_ROLE_RS" schema="ll">
<generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ROLE_RS_ID.nextval from dual" identity="true" />
</table>
<!-- <table tableName="DIC_IND" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_DIC_IND_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="DIC_ORG" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_DIC_ORG_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SER_BLOCK_IND_RS" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SER_ BLOCK_IND_RS_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SER_BLOCK" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SER_BLOCK_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SER_PAGE" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SER_PAGE_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SER_PAGE_BLOCK_RS" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SER_PAGE_BLOCK_RS_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SER_PAGE_DIM_RS" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SER_PAGE_DIM_RS_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_MENU" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_MENU_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_ORG" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_ORG_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_PROJECT" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_PROJECT_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_ROLE" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_ROLE_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_ROLE_MENU_RS" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_ROLE_MENU_RS_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_USER_MENU_RS" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_USER_MENU_RS_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_USER_ORG_RS" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ORG_RS_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
<!-- <table tableName="SYS_USER_ROLE_RS" schema="ll" >-->
<!-- <generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ROLE_RS_ID.nextval from dual" identity="true" />-->
<!-- </table>-->
</context>
<!--<context id="sqlserver" targetRuntime="MyBatis3Simple" defaultModelType="flat">-->
<!--<property enName="beginningDelimiter" value="["/>-->
<!--<property enName="endingDelimiter" value="]"/>-->
<!--&lt;!&ndash; 生成的文件编码 &ndash;&gt;-->
<!--<property enName="javaFileEncoding" value="utf-8"/>-->
<!--&lt;!&ndash; 通过自定义插件类生成自定义注解和接口 &ndash;&gt;-->
<!--&lt;!&ndash;<plugin type="com.suvalue.common.GenPlugin">&ndash;&gt;-->
<!--&lt;!&ndash;<property enName="mappers" value="com.suvalue.demo.mapper.BaseMapper"/>&ndash;&gt;-->
<!--&lt;!&ndash;</plugin>&ndash;&gt;-->
<!--<commentGenerator>-->
<!--&lt;!&ndash; 取消生成注释 &ndash;&gt;-->
<!--<property enName="suppressAllComments" value="false"/>-->
<!--</commentGenerator>-->
<!--&lt;!&ndash; 数据库连接属性 &ndash;&gt;-->
<!--<jdbcConnection driverClass="${jdbc.sqlserver.driver}"-->
<!--connectionURL="${jdbc.sqlserver.url}"-->
<!--userId="${jdbc.sqlserver.username}"-->
<!--password="${jdbc.sqlserver.password}">-->
<!--</jdbcConnection>-->
<!--&lt;!&ndash; 生成实体类配置 &ndash;&gt;-->
<!--<javaModelGenerator targetPackage="com.suvalue.verctrl.model" targetProject="src/main/java"/>-->
<!--&lt;!&ndash; 生成映射文件配置 &ndash;&gt;-->
<!--<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"/>-->
<!--&lt;!&ndash; 生成映射接口配置 &ndash;&gt;-->
<!--&lt;!&ndash;<javaClientGenerator targetPackage="com.suvalue.verctrl.mapper" targetProject="src/main/java" type="XMLMAPPER"/>&ndash;&gt;-->
<!--<table tableName="data_version" schema="dbo">-->
<!--&lt;!&ndash;mysql 配置 &ndash;&gt;-->
<!--<generatedKey column="id" sqlStatement="SqlServer" identity="true"/>-->
<!--</table>-->
<!--</context>-->
</generatorConfiguration>
jdbc.url=jdbc:mysql://192.168.18.55:3306/db_appointment?useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true&rewriteBatchedStatements=TRUE
jdbc.username=ll
jdbc.password=123456
jdbc.url=jdbc:mysql://192.168.18.176:3306/scml_zp_cs?useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true&rewriteBatchedStatements=TRUE
jdbc.username=root
jdbc.password=Suvalue2016
jdbc.driverClass=com.mysql.jdbc.Driver
\ No newline at end of file
......@@ -15,7 +15,7 @@ public class Result<T> {
@ApiModelProperty(value = "返回的数据")
private T data;
private Result(int code, String msg, T data) {
private Result(int code,String msg,T data) {
this.code = code;
this.msg = msg;
this.data = data;
......@@ -54,37 +54,37 @@ public class Result<T> {
this.data = data;
}
public static <T> Result<T> success(T data){
return new Result(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getEnMessage(), data);
public static <T> Result<T> success(T data) {
return new Result(ErrorCode.SUCCESS.getCode(),ErrorCode.SUCCESS.getEnMessage(),data);
}
public static Result error(int code, String msg){
return new Result(code, msg, null);
public static Result error(int code,String msg) {
return new Result(code,msg,null);
}
public static Result error(){
return new Result(ErrorCode.ERROR.getCode(), ErrorCode.ERROR.getEnMessage(), null);
public static Result error() {
return new Result(ErrorCode.ERROR.getCode(),ErrorCode.ERROR.getEnMessage(),null);
}
public static Result error(String msg){
return new Result(ErrorCode.ERROR.getCode(), msg, null);
public static Result error(String msg) {
return new Result(ErrorCode.ERROR.getCode(),msg,null);
}
public static Result error(ErrorCode errorCode){
return new Result(errorCode.getCode(), errorCode.getEnMessage(), null);
public static Result error(ErrorCode errorCode) {
return new Result(errorCode.getCode(),errorCode.getEnMessage(),null);
}
public static enum ErrorCode{
SUCCESS(1, "成功", "success"),
INVALID_TOKEN(401, "无效的TOKEN", "invalid token"),
ERROR(400, "错误", "error"),
public static enum ErrorCode {
SUCCESS(1,"成功","success"),
INVALID_TOKEN(401,"无效的TOKEN","invalid token"),
ERROR(400,"错误","error"),
USERERROR(2,"账号或密码错误","wrong account or password");
private int code;
private String cnMessage;
private String enMessage;
ErrorCode(int code, String cnMessage, String enMessage) {
ErrorCode(int code,String cnMessage,String enMessage) {
this.code = code;
this.cnMessage = cnMessage;
this.enMessage = enMessage;
......
......@@ -23,9 +23,12 @@ import java.util.List;
@Profile({"test","prod"})
public class RequestMappingAspect {
@Pointcut("@annotation(org.springframework.web.bind.annotation.GetMapping)")
public void getMappingAspect(){}
public void getMappingAspect() {
}
@Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)")
public void postMappingAspect(){}
public void postMappingAspect() {
}
@Around("getMappingAspect()")
public Object get(ProceedingJoinPoint joinPoint) throws Throwable {
......@@ -39,16 +42,16 @@ public class RequestMappingAspect {
private Object request(ProceedingJoinPoint joinPoint) throws Throwable {
Date beginDate = new Date();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
Logger logger = org.slf4j.LoggerFactory.getLogger(joinPoint.getTarget().getClass());
Object result = joinPoint.proceed();
String uri = request.getRequestURI();
Object[] params = joinPoint.getArgs();
List<Object> paramsList = Arrays.asList(params);
Date endDate = new Date();
logger.debug("执行时间:"+
(endDate.getTime()-beginDate.getTime())
+",URL:" + uri + "入参参数:" + paramsList+"返回结果:"+result);
logger.debug("执行时间:" +
(endDate.getTime() - beginDate.getTime())
+ ",URL:" + uri + "入参参数:" + paramsList + "返回结果:" + result);
return result;
}
}
......@@ -23,11 +23,12 @@ import javax.servlet.http.HttpServletRequest;
@Profile({"test","prod"})
public class TokenAspect {
@Pointcut("@annotation(com.bsoft.api.common.annotations.Token)")
public void tokenAspect(){}
public void tokenAspect() {
}
@Around("tokenAspect()")
public Object verifierToken(ProceedingJoinPoint joinPoint) throws Throwable {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader(Constants.TOKEN_KEY);
if(!StringUtil.isNullOrEmpty(token) && TokenUtil.checkToken(token)){
......
......@@ -29,7 +29,7 @@ public class RequestResult {
this.data = data;
}
public RequestResult(Integer code, String msg, Object data) {
public RequestResult(Integer code,String msg,Object data) {
this.code = code;
this.msg = msg;
this.data = data;
......
......@@ -11,12 +11,12 @@ import java.util.List;
@Configuration
public class CurrentUserConfigure implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers){
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(currentUserMethodArgumentResolver());
}
@Bean
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver(){
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
return new CurrentUserMethodArgumentResolver();
}
}
......@@ -38,7 +38,7 @@ public class LoginConfigure implements WebMvcConfigurer {
}
@Bean
public LoginInterceptor loginIntercepter(){
public LoginInterceptor loginIntercepter() {
return new LoginInterceptor();
}
}
package com.bsoft.api.common.enums;
public enum RequestResultType {
SUCCESS(1, "成功"),FAILURE(0, "失败"),;
SUCCESS(1,"成功"),
FAILURE(0,"失败");
private int value;
private String desc;
RequestResultType(int value, String desc){
RequestResultType(int value,String desc) {
this.value = value;
this.desc = desc;
}
......
package com.bsoft.api.common.enums;
public enum StateType {
ON(1, "启用"),OFF(0, "禁用"),;
ON(1,"启用"),
OFF(0,"禁用");
private int value;
private String desc;
StateType(int value,String desc){
StateType(int value,String desc) {
this.value = value;
this.desc = desc;
}
......
package com.bsoft.api.common.exceptions;
public class DBConfigurationError extends ExceptionBase {
public DBConfigurationError(String message){
public DBConfigurationError(String message) {
super(message);
}
}
package com.bsoft.api.common.exceptions;
public class ExceptionBase extends RuntimeException {
public ExceptionBase(){
super();
}
public ExceptionBase() {
super();
}
public ExceptionBase(String message){
super(message);
}
public ExceptionBase(String message) {
super(message);
}
}
package com.bsoft.api.common.exceptions;
public class InvalidTokenException extends ExceptionBase {
public InvalidTokenException(){
public InvalidTokenException() {
super();
}
public InvalidTokenException(String message){
public InvalidTokenException(String message) {
super(message);
}
}
......@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -27,71 +26,74 @@ public class GlobalExceptionHandler {
/**
* 其他异常处理
*
* @param request
* @param e
* @return
*/
@ExceptionHandler(Exception.class)
@ResponseBody
public Object defaultErrorHandler(HttpServletRequest request, Exception e){
public Object defaultErrorHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error();
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
public Object MethodArgumentNotValidErrorHandler(HttpServletRequest request, MethodArgumentNotValidException e){
public Object MethodArgumentNotValidErrorHandler(HttpServletRequest request,MethodArgumentNotValidException e) {
String url = request.getRequestURI();
BindingResult bindingResult = e.getBindingResult();
List<ObjectError> allErrors = bindingResult.getAllErrors();
StringBuilder errorStrBu = new StringBuilder();
allErrors.forEach(objectError -> {
FieldError fieldError = (FieldError) objectError;
FieldError fieldError = (FieldError)objectError;
errorStrBu.append(fieldError.getDefaultMessage());
errorStrBu.append(",");
});
});
String errorStr = errorStrBu.toString();
log.error(url + "请求未知异常:" + e.getMessage(), e);
return Result.error(errorStr.substring(0,errorStr.length()-1));
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error(errorStr.substring(0,errorStr.length() - 1));
}
/**
* 其他内部异常
*
* @param request
* @param e
* @return
*/
@ExceptionHandler(ExceptionBase.class)
@ResponseBody
public Object BaseErrorHandler(HttpServletRequest request, Exception e){
public Object BaseErrorHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error();
}
@ExceptionHandler(DBConfigurationError.class)
@ResponseBody
public Object DBConfigurationErrorHandler(HttpServletRequest request, Exception e){
public Object DBConfigurationErrorHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
return Result.error(400, e.getMessage());
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error(400,e.getMessage());
}
/**
* 无效token
*
* @param request
* @param e
* @return
*/
@ExceptionHandler(InvalidTokenException.class)
@ResponseBody
public Object InvalidTokenExceptionHandler(HttpServletRequest request, Exception e){
public Object InvalidTokenExceptionHandler(HttpServletRequest request,Exception e) {
String url = request.getRequestURI();
log.error(url + "请求未知异常:" + e.getMessage(), e);
log.error(url + "请求未知异常:" + e.getMessage(),e);
return Result.error(Result.ErrorCode.INVALID_TOKEN);
}
}
......@@ -14,8 +14,9 @@ import java.io.PrintWriter;
public class LoginInterceptor implements HandlerInterceptor {
Logger logger = org.slf4j.LoggerFactory.getLogger(LoginInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
public boolean preHandle(HttpServletRequest request,HttpServletResponse response,Object handler) throws Exception {
System.out.println("LoginInterceptor----------->preHandle");
String token = request.getHeader(Constants.TOKEN_KEY);
......@@ -23,16 +24,16 @@ public class LoginInterceptor implements HandlerInterceptor {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter writer = null;
try {
try{
String remoteHost = request.getRemoteHost();
String uri = request.getRequestURI();
logger.info(remoteHost + " 访问 " + uri + ", token无效, token:[" + token + "]");
writer = response.getWriter();
writer.print(Result.error(Result.ErrorCode.INVALID_TOKEN));
}catch (IOException e){
}catch(IOException e){
logger.error(e.getMessage());
}finally {
}finally{
if(writer != null){
writer.close();
}
......@@ -40,24 +41,23 @@ public class LoginInterceptor implements HandlerInterceptor {
return false;
}
return HandlerInterceptor.super.preHandle(request, response, handler);
return HandlerInterceptor.super.preHandle(request,response,handler);
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
public void postHandle(HttpServletRequest request,HttpServletResponse response,Object handler,ModelAndView modelAndView) throws Exception {
System.out.println("LoginInterceptor----------->postHandle");
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
HandlerInterceptor.super.postHandle(request,response,handler,modelAndView);
}
@Override
public void afterCompletion(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex) throws Exception {
HttpServletResponse response,Object handler,Exception ex) throws Exception {
System.out.println("LoginInterceptor------->afterCompletion");
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
HandlerInterceptor.super.afterCompletion(request,response,handler,ex);
}
}
package com.bsoft.api.common.utils;
public class SqlUtil {
public static String TransactSQLInjection(String str)
{
return str.replaceAll(".*([';]+|(--)+).*", " ");
public static String TransactSQLInjection(String str) {
return str.replaceAll(".*([';]+|(--)+).*"," ");
}
}
......@@ -10,7 +10,6 @@ import com.bsoft.api.service.BlockValuesService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
......
......@@ -23,14 +23,15 @@ public class DimController {
/**
* 根据pageCode查询维度数值
*
* @return
* @throws Exception
*/
@PostMapping("dimValue")
@Token
@ApiOperation("根据pageCode查询维度数值")
public Object getdimValueByPageCode(@RequestBody@Valid ReqDimValue reqDimValue) {
List<DimValue> dimValueList = dicDimService.getByPageCode(reqDimValue.getPageCode(), reqDimValue.getOrgId(), reqDimValue.getDate());
public Object getdimValueByPageCode(@RequestBody @Valid ReqDimValue reqDimValue) {
List<DimValue> dimValueList = dicDimService.getByPageCode(reqDimValue.getPageCode(),reqDimValue.getOrgId(),reqDimValue.getDate());
return Result.success(dimValueList);
}
}
......@@ -28,11 +28,11 @@ public class ExcelController {
@PostMapping("export")
@Token
@ApiOperation("将Table转换为Xls")
public Object tableToXls(HttpServletRequest request,@RequestBody ExportReq info){
String tableStr =StringEscapeUtils.unescapeHtml4(info.getTableStr());
log.info("table参数:"+tableStr);
public Object tableToXls(HttpServletRequest request,@RequestBody ExportReq info) {
String tableStr = StringEscapeUtils.unescapeHtml4(info.getTableStr());
log.info("table参数:" + tableStr);
String realPath = request.getSession().getServletContext().getRealPath("/");
String fileUrl =excelService.tableToXls(realPath,tableStr);
String fileUrl = excelService.tableToXls(realPath,tableStr);
return Result.success(fileUrl);
}
}
......@@ -20,16 +20,16 @@ public class IndController {
private DicIndService dicIndService;
@GetMapping
public ModelAndView index(Model model, String filter){
model.addAttribute("title", "指标搜索");
model.addAttribute("indList", dicIndService.selectAll(filter));
model.addAttribute("filter", filter==null?"":filter);
ModelAndView mav = new ModelAndView("ind", "indModel", model);
public ModelAndView index(Model model,String filter) {
model.addAttribute("title","指标搜索");
model.addAttribute("indList",dicIndService.selectAll(filter));
model.addAttribute("filter",filter == null ? "" : filter);
ModelAndView mav = new ModelAndView("ind","indModel",model);
return mav;
}
@PostMapping("search")
public ModelAndView search(String filter){
public ModelAndView search(String filter) {
return new ModelAndView("redirect:/ind?filter=" + filter);
}
......
......@@ -4,9 +4,13 @@ import com.bsoft.api.common.Result;
import com.bsoft.api.model.reqmodel.CodeAndPwd;
import com.bsoft.api.service.LoginService;
import com.bsoft.common.utils.HttpUtil;
import io.swagger.annotations.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
......@@ -20,18 +24,17 @@ public class LoginController {
private LoginService loginServiceImpl;
/**
*
* @param codeAndPwd
* @param request
* @return
*/
@PostMapping("login")
@ApiOperation(value="Result«LoginService.LoginInfo»登录")
public Result<LoginService.LoginInfo> login(@RequestBody CodeAndPwd codeAndPwd,HttpServletRequest request){
@ApiOperation(value = "Result«LoginService.LoginInfo»登录")
public Result<LoginService.LoginInfo> login(@RequestBody CodeAndPwd codeAndPwd,HttpServletRequest request) {
String ip = HttpUtil.getIP(request);
LoginService.LoginInfo loginInfo = loginServiceImpl.login(
codeAndPwd.getLoginName(),codeAndPwd.getPassword(),ip);
if(loginInfo==null){
if(loginInfo == null){
return Result.error(Result.ErrorCode.USERERROR);
}
return Result.success(loginInfo);
......@@ -39,7 +42,7 @@ public class LoginController {
@PostMapping("token")
@ApiOperation("刷新TOKEN")
public Result<String> refresh(@ApiIgnore HttpServletRequest request){
public Result<String> refresh(@ApiIgnore HttpServletRequest request) {
String oldToken = request.getHeader("Authorization");
String token = loginServiceImpl.refreshToken(oldToken);
return Result.success(token);
......
package com.bsoft.api.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface BlockValuesMapper {
List<Map<String,Object>> selectByWhere(String tableName,String whereSql);
List<Map<String,Object>> selectByWhereNew(Map<String, String> map);
List<Map<String,Object>> selectByWhereNew(Map<String,String> map);
}
package com.bsoft.api.mapper;
import com.bsoft.api.model.SerBlock;
import java.util.List;
public interface SerBlockMapper {
......
package com.bsoft.api.mapper;
import com.bsoft.api.model.SerDeptDocRs;
import java.math.BigDecimal;
import java.util.List;
......
package com.bsoft.api.mapper;
import com.bsoft.api.model.SerPageField;
import java.util.List;
public interface SerPageFieldMapper {
......
package com.bsoft.api.mapper;
import com.bsoft.api.model.SerPageProjFieldRs;
import java.util.List;
public interface SerPageProjFieldRsMapper {
......
package com.bsoft.api.mapper;
import com.bsoft.api.model.SerPageProj;
import java.util.List;
public interface SerPageProjMapper {
......
package com.bsoft.api.mapper;
import com.bsoft.api.model.SysProject;
import java.util.List;
public interface SysProjectMapper {
int deleteByPrimaryKey(Long id);
int insert(SysProject record);
SysProject selectByPrimaryKey(Long id);
List<SysProject> selectAll();
int updateByPrimaryKey(SysProject record);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment