优化注释
parent
4078efaf92
commit
2d64aa8eb5
|
@ -16,23 +16,10 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- <dependency>-->
|
||||||
<dependency>
|
<!-- <groupId>com.muyu</groupId>-->
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<!-- <artifactId>cloud-common-saas</artifactId>-->
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
<!-- </dependency>-->
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos Config -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Sentinel -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringBoot Web -->
|
<!-- SpringBoot Web -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -58,6 +45,48 @@
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.muyu.auth;
|
package com.muyu.auth;
|
||||||
|
|
||||||
|
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||||
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
@ -10,8 +13,15 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
@SpringBootApplication(
|
||||||
|
exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
|
DruidDataSourceAutoConfigure.class,
|
||||||
|
DynamicDataSourceAutoConfiguration.class
|
||||||
|
}
|
||||||
|
)
|
||||||
public class CloudAuthApplication {
|
public class CloudAuthApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(CloudAuthApplication.class, args);
|
SpringApplication.run(CloudAuthApplication.class, args);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.muyu.common.security.auth.AuthUtil;
|
||||||
import com.muyu.common.security.service.TokenService;
|
import com.muyu.common.security.service.TokenService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -25,10 +25,10 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class TokenController {
|
public class TokenController {
|
||||||
@Autowired
|
@Resource
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysLoginService sysLoginService;
|
private SysLoginService sysLoginService;
|
||||||
|
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
|
|
|
@ -13,12 +13,16 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.ip.IpUtils;
|
import com.muyu.common.core.utils.ip.IpUtils;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.remote.RemoteSaasService;
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录校验方法
|
* 登录校验方法
|
||||||
*
|
*
|
||||||
|
@ -26,18 +30,21 @@ import org.springframework.stereotype.Component;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SysLoginService {
|
public class SysLoginService {
|
||||||
@Autowired
|
@Resource
|
||||||
private RemoteUserService remoteUserService;
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysPasswordService passwordService;
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRecordLogService recordLogService;
|
private SysRecordLogService recordLogService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RemoteSaasService remoteSaasService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +76,7 @@ public class SysLoginService {
|
||||||
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
||||||
}
|
}
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(firmCode, username, SecurityConstants.INNER);
|
Result<SysUser> userResult = remoteSaasService.getUserInfo(firmCode, username, SecurityConstants.INNER);
|
||||||
|
|
||||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||||
|
@ -80,8 +87,7 @@ public class SysLoginService {
|
||||||
throw new ServiceException(userResult.getMsg());
|
throw new ServiceException(userResult.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginUser userInfo = userResult.getData();
|
SysUser user = userResult.getData();
|
||||||
SysUser user = userResult.getData().getSysUser();
|
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||||
|
@ -92,7 +98,16 @@ public class SysLoginService {
|
||||||
}
|
}
|
||||||
passwordService.validate(user, password);
|
passwordService.validate(user, password);
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
||||||
return userInfo;
|
|
||||||
|
// 角色集合
|
||||||
|
Set<String> roles = remoteUserService.getRolePermission(user);
|
||||||
|
// 权限集合
|
||||||
|
Set<String> permissions = remoteUserService.getMenuPermission(user);
|
||||||
|
LoginUser sysUserVo = new LoginUser();
|
||||||
|
sysUserVo.setSysUser(user);
|
||||||
|
sysUserVo.setRoles(roles);
|
||||||
|
sysUserVo.setPermissions(permissions);
|
||||||
|
return sysUserVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logout (String loginName) {
|
public void logout (String loginName) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.muyu.common.core.exception.ServiceException;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -18,14 +18,14 @@ import java.util.concurrent.TimeUnit;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SysPasswordService {
|
public class SysPasswordService {
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
|
private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
|
||||||
|
|
||||||
private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
|
private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRecordLogService recordLogService;
|
private SysRecordLogService recordLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.ip.IpUtils;
|
import com.muyu.common.core.utils.ip.IpUtils;
|
||||||
import com.muyu.common.system.remote.RemoteLogService;
|
import com.muyu.common.system.remote.RemoteLogService;
|
||||||
import com.muyu.common.system.domain.SysLogininfor;
|
import com.muyu.common.system.domain.SysLogininfor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SysRecordLogService {
|
public class SysRecordLogService {
|
||||||
@Autowired
|
@Resource
|
||||||
private RemoteLogService remoteLogService;
|
private RemoteLogService remoteLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,4 +27,6 @@ public class ServiceNameConstants {
|
||||||
public static final String SMART_SERVICE = "cloud-smart-car";
|
public static final String SMART_SERVICE = "cloud-smart-car";
|
||||||
|
|
||||||
public static final String ENT_SERVICE = "cloud-ent";
|
public static final String ENT_SERVICE = "cloud-ent";
|
||||||
|
|
||||||
|
public static final String SAAS_SERVICE = "cloud-system-saas";
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.core.NamedThreadLocal;
|
import org.springframework.core.NamedThreadLocal;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -48,7 +48,7 @@ public class LogAspect {
|
||||||
*/
|
*/
|
||||||
private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
|
private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private AsyncLogService asyncLogService;
|
private AsyncLogService asyncLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.muyu.common.log.service;
|
||||||
import com.muyu.common.core.constant.SecurityConstants;
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.system.remote.RemoteLogService;
|
import com.muyu.common.system.remote.RemoteLogService;
|
||||||
import com.muyu.common.system.domain.SysOperLog;
|
import com.muyu.common.system.domain.SysOperLog;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import org.springframework.stereotype.Service;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class AsyncLogService {
|
public class AsyncLogService {
|
||||||
@Autowired
|
@Resource
|
||||||
private RemoteLogService remoteLogService;
|
private RemoteLogService remoteLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.muyu.common.rabbit;
|
||||||
|
|
||||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
|
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
||||||
|
@ -16,7 +16,7 @@ public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit
|
||||||
}
|
}
|
||||||
|
|
||||||
//以下配置RabbitMQ消息服务
|
//以下配置RabbitMQ消息服务
|
||||||
@Autowired
|
@Resource
|
||||||
public ConnectionFactory connectionFactory;
|
public ConnectionFactory connectionFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.muyu.common.redis.service;
|
package com.muyu.common.redis.service;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.data.redis.core.BoundSetOperations;
|
import org.springframework.data.redis.core.BoundSetOperations;
|
||||||
import org.springframework.data.redis.core.HashOperations;
|
import org.springframework.data.redis.core.HashOperations;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||||
@Component
|
@Component
|
||||||
public class RedisService {
|
public class RedisService {
|
||||||
@Autowired
|
@Resource
|
||||||
public RedisTemplate redisTemplate;
|
public RedisTemplate redisTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package com.muyu.cloud.common.many.datasource;
|
package com.muyu.cloud.common.many.datasource;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||||
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
|
||||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||||
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
||||||
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
||||||
|
@ -12,30 +10,17 @@ import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.SpringUtils;
|
import com.muyu.common.core.utils.SpringUtils;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.system.domain.SysEnt;
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
import com.muyu.common.system.domain.SysFirmUser;
|
|
||||||
import com.muyu.common.system.domain.SysUser;
|
|
||||||
import com.muyu.common.system.remote.RemoteEntService;
|
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
|
||||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
|
||||||
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
|
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: DongZeLiang
|
* @Author: DongZeLiang
|
||||||
|
@ -83,7 +68,7 @@ public class ManyDataSource implements ApplicationRunner{
|
||||||
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
||||||
// 企业列表 企业CODE,端口,IP
|
// 企业列表 企业CODE,端口,IP
|
||||||
Map<Object, Object> dataSourceMap = new HashMap<>();
|
Map<Object, Object> dataSourceMap = new HashMap<>();
|
||||||
dataSourceInfoList()
|
Objects.requireNonNull(dataSourceInfoList())
|
||||||
.stream()
|
.stream()
|
||||||
.map(DataSourceInfo::hostAndPortBuild)
|
.map(DataSourceInfo::hostAndPortBuild)
|
||||||
.forEach(dataSourceInfo -> {
|
.forEach(dataSourceInfo -> {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -19,6 +20,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
|
@Slf4j
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class DynamicDataSource extends AbstractRoutingDataSource {
|
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||||
|
@ -42,8 +44,12 @@ public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||||
* @param value 数据源
|
* @param value 数据源
|
||||||
*/
|
*/
|
||||||
public void put(String key, DruidDataSource value) {
|
public void put(String key, DruidDataSource value) {
|
||||||
|
if (value!=null) {
|
||||||
defineTargetDataSources.put(key, value);
|
defineTargetDataSources.put(key, value);
|
||||||
this.afterPropertiesSet();
|
this.afterPropertiesSet();
|
||||||
|
}else{
|
||||||
|
log.warn("Key为 {} 的数据源为空!",key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class WebMvcSaaSConfig implements WebMvcConfigurer {
|
||||||
/**
|
/**
|
||||||
* 不需要拦截的地址
|
* 不需要拦截的地址
|
||||||
*/
|
*/
|
||||||
public static final String[] EXCLUDE_URLS = {"/dept/**", "/login", "/logout", "/refresh"};
|
public static final String[] EXCLUDE_URLS = {"/user/info", "/login", "/logout", "/refresh"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors (InterceptorRegistry registry) {
|
public void addInterceptors (InterceptorRegistry registry) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
@ -34,7 +34,7 @@ public class TokenService {
|
||||||
private final static long expireTime = CacheConstants.EXPIRATION;
|
private final static long expireTime = CacheConstants.EXPIRATION;
|
||||||
|
|
||||||
private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
|
private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.muyu.common.system.remote;
|
|
||||||
|
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.system.domain.SysEnt;
|
|
||||||
import com.muyu.common.system.remote.factory.RemoteEntFallbackFactory;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件服务
|
|
||||||
*
|
|
||||||
* @author muyu
|
|
||||||
*/
|
|
||||||
@FeignClient(contextId = "remoteEntService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteEntFallbackFactory.class)
|
|
||||||
public interface RemoteEntService {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.common.system.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.remote.factory.RemoteSaasFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件服务
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteSaasService", value = ServiceNameConstants.SAAS_SERVICE, fallbackFactory = RemoteSaasFallbackFactory.class)
|
||||||
|
public interface RemoteSaasService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名查询用户信息
|
||||||
|
*
|
||||||
|
* @param firmCode
|
||||||
|
* @param username 用户名
|
||||||
|
* @param source 请求来源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/user/info")
|
||||||
|
public Result<SysUser> getUserInfo (@RequestParam("firmCode") String firmCode, @RequestParam("userName") String userName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,7 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户服务
|
* 用户服务
|
||||||
|
@ -21,16 +22,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||||
public interface RemoteUserService {
|
public interface RemoteUserService {
|
||||||
/**
|
|
||||||
* 通过用户名查询用户信息
|
|
||||||
*
|
|
||||||
* @param username 用户名
|
|
||||||
* @param source 请求来源
|
|
||||||
*
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@GetMapping("/user/info")
|
|
||||||
public Result<LoginUser> getUserInfo (@RequestParam("firmCode") String firmCode,@RequestParam("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
|
@ -48,4 +39,24 @@ public interface RemoteUserService {
|
||||||
|
|
||||||
@PostMapping("/ent/list")
|
@PostMapping("/ent/list")
|
||||||
public Result<List<SysEnt>> list (@RequestBody SysEnt sysEnt);
|
public Result<List<SysEnt>> list (@RequestBody SysEnt sysEnt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色数据权限
|
||||||
|
*
|
||||||
|
* @param user 用户
|
||||||
|
*
|
||||||
|
* @return 角色权限信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/permission/getRole")
|
||||||
|
public Set<String> getRolePermission (@RequestBody SysUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单数据权限
|
||||||
|
*
|
||||||
|
* @param user 用户
|
||||||
|
*
|
||||||
|
* @return 菜单权限信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/permission/getMenu")
|
||||||
|
public Set<String> getMenuPermission (@RequestBody SysUser user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,11 @@ package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.system.domain.SysEnt;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.RemoteEntService;
|
import com.muyu.common.system.remote.RemoteSaasService;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 胡杨
|
* @Author: 胡杨
|
||||||
* @Name: RemoteEntFallbackFactory
|
* @Name: RemoteEntFallbackFactory
|
||||||
|
@ -24,11 +22,15 @@ import java.util.List;
|
||||||
* @FilePath: com.muyu.common.system.remote
|
* @FilePath: com.muyu.common.system.remote
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class RemoteEntFallbackFactory implements FallbackFactory<RemoteEntService> {
|
public class RemoteSaasFallbackFactory implements FallbackFactory<RemoteSaasService> {
|
||||||
@Override
|
@Override
|
||||||
public RemoteEntService create(Throwable cause) {
|
public RemoteSaasService create(Throwable cause) {
|
||||||
return new RemoteEntService() {
|
return new RemoteSaasService() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<SysUser> getUserInfo(String firmCode, String username, String source) {
|
||||||
|
return Result.error("获取用户失败:" + cause.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,6 +13,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户服务降级处理
|
* 用户服务降级处理
|
||||||
|
@ -28,11 +29,6 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||||
return new RemoteUserService() {
|
return new RemoteUserService() {
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<LoginUser> getUserInfo(String firmCode, String username, String source) {
|
|
||||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
|
@ -48,6 +44,16 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
return Result.error("获取企业列表失败:" + throwable.getMessage());
|
return Result.error("获取企业列表失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getRolePermission(SysUser user) {
|
||||||
|
return Set.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getMenuPermission(SysUser user) {
|
||||||
|
return Set.of();
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteEntFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteSaasFallbackFactory
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.muyu.gateway.config;
|
package com.muyu.gateway.config;
|
||||||
|
|
||||||
import com.muyu.gateway.handler.ValidateCodeHandler;
|
import com.muyu.gateway.handler.ValidateCodeHandler;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -16,7 +16,7 @@ import org.springframework.web.reactive.function.server.RouterFunctions;
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class RouterFunctionConfiguration {
|
public class RouterFunctionConfiguration {
|
||||||
@Autowired
|
@Resource
|
||||||
private ValidateCodeHandler validateCodeHandler;
|
private ValidateCodeHandler validateCodeHandler;
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.muyu.gateway.config.properties.IgnoreWhiteProperties;
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
|
@ -31,10 +31,10 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
||||||
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);
|
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);
|
||||||
|
|
||||||
// 排除过滤的 uri 地址,nacos自行添加
|
// 排除过滤的 uri 地址,nacos自行添加
|
||||||
@Autowired
|
@Resource
|
||||||
private IgnoreWhiteProperties ignoreWhite;
|
private IgnoreWhiteProperties ignoreWhite;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.muyu.common.core.utils.ServletUtils;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.gateway.config.properties.CaptchaProperties;
|
import com.muyu.gateway.config.properties.CaptchaProperties;
|
||||||
import com.muyu.gateway.service.ValidateCodeService;
|
import com.muyu.gateway.service.ValidateCodeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.cloud.gateway.filter.GatewayFilter;
|
import org.springframework.cloud.gateway.filter.GatewayFilter;
|
||||||
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
|
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
|
||||||
import org.springframework.core.io.buffer.DataBuffer;
|
import org.springframework.core.io.buffer.DataBuffer;
|
||||||
|
@ -29,9 +29,9 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object> {
|
||||||
private final static String[] VALIDATE_URL = new String[]{"/auth/login", "/auth/register"};
|
private final static String[] VALIDATE_URL = new String[]{"/auth/login", "/auth/register"};
|
||||||
private static final String CODE = "code";
|
private static final String CODE = "code";
|
||||||
private static final String UUID = "uuid";
|
private static final String UUID = "uuid";
|
||||||
@Autowired
|
@Resource
|
||||||
private ValidateCodeService validateCodeService;
|
private ValidateCodeService validateCodeService;
|
||||||
@Autowired
|
@Resource
|
||||||
private CaptchaProperties captchaProperties;
|
private CaptchaProperties captchaProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.html.EscapeUtil;
|
import com.muyu.common.core.utils.html.EscapeUtil;
|
||||||
import com.muyu.gateway.config.properties.XssProperties;
|
import com.muyu.gateway.config.properties.XssProperties;
|
||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||||
|
@ -31,7 +31,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
@ConditionalOnProperty(value = "security.xss.enabled", havingValue = "true")
|
@ConditionalOnProperty(value = "security.xss.enabled", havingValue = "true")
|
||||||
public class XssFilter implements GlobalFilter, Ordered {
|
public class XssFilter implements GlobalFilter, Ordered {
|
||||||
// 跨站脚本的 xss 配置,nacos自行添加
|
// 跨站脚本的 xss 配置,nacos自行添加
|
||||||
@Autowired
|
@Resource
|
||||||
private XssProperties xss;
|
private XssProperties xss;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.muyu.gateway.handler;
|
||||||
import com.muyu.common.core.exception.CaptchaException;
|
import com.muyu.common.core.exception.CaptchaException;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.gateway.service.ValidateCodeService;
|
import com.muyu.gateway.service.ValidateCodeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.reactive.function.BodyInserters;
|
import org.springframework.web.reactive.function.BodyInserters;
|
||||||
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ValidateCodeHandler implements HandlerFunction<ServerResponse> {
|
public class ValidateCodeHandler implements HandlerFunction<ServerResponse> {
|
||||||
@Autowired
|
@Resource
|
||||||
private ValidateCodeService validateCodeService;
|
private ValidateCodeService validateCodeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.gateway.config.properties.CaptchaProperties;
|
import com.muyu.gateway.config.properties.CaptchaProperties;
|
||||||
import com.muyu.gateway.model.resp.CaptchaCodeResp;
|
import com.muyu.gateway.model.resp.CaptchaCodeResp;
|
||||||
import com.muyu.gateway.service.ValidateCodeService;
|
import com.muyu.gateway.service.ValidateCodeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.FastByteArrayOutputStream;
|
import org.springframework.util.FastByteArrayOutputStream;
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
|
||||||
@Resource(name = "captchaProducerMath")
|
@Resource(name = "captchaProducerMath")
|
||||||
private Producer captchaProducerMath;
|
private Producer captchaProducerMath;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private CaptchaProperties captchaProperties;
|
private CaptchaProperties captchaProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.muyu.file.service.ISysFileService;
|
||||||
import com.muyu.common.system.domain.SysFile;
|
import com.muyu.common.system.domain.SysFile;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
@ -21,7 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
public class SysFileController {
|
public class SysFileController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private ISysFileService sysFileService;
|
private ISysFileService sysFileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.muyu.file.config.MinioConfig;
|
||||||
import com.muyu.file.utils.FileUploadUtils;
|
import com.muyu.file.utils.FileUploadUtils;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import io.minio.PutObjectArgs;
|
import io.minio.PutObjectArgs;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ import java.io.InputStream;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MinioSysFileServiceImpl implements ISysFileService {
|
public class MinioSysFileServiceImpl implements ISysFileService {
|
||||||
@Autowired
|
@Resource
|
||||||
private MinioConfig minioConfig;
|
private MinioConfig minioConfig;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private MinioClient client;
|
private MinioClient client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,12 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-saas</artifactId>
|
<artifactId>cloud-common-saas</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
@ -76,12 +82,6 @@
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- XllJob定时任务 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-common-xxl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.system.saas.controller;
|
||||||
|
|
||||||
|
import com.muyu.cloud.common.many.datasource.holder.DynamicDataSourceHolder;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.security.annotation.InnerAuth;
|
||||||
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.system.saas.service.SysUserService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: SysUser
|
||||||
|
* @Description:
|
||||||
|
* @CreatedDate: 2024/9/23 下午8:55
|
||||||
|
* @FilePath: com.muyu.system.saas.controller
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user")
|
||||||
|
public class SysUserController {
|
||||||
|
@Resource
|
||||||
|
private SysUserService userService;
|
||||||
|
|
||||||
|
@InnerAuth
|
||||||
|
@GetMapping("/info")
|
||||||
|
public Result<SysUser> info (
|
||||||
|
@RequestParam("firmCode") String firmCode,
|
||||||
|
@RequestParam("userName") String userName) {
|
||||||
|
DynamicDataSourceHolder.setDynamicDataSourceKey(firmCode);
|
||||||
|
SysUser sysUser = userService.selectUserByUserName(userName);
|
||||||
|
if (StringUtils.isNull(sysUser)) {
|
||||||
|
return Result.error("用户名或密码错误");
|
||||||
|
}
|
||||||
|
return Result.success(sysUser);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.system.saas.mapper;
|
||||||
|
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: SysUser
|
||||||
|
* @Description:
|
||||||
|
* @CreatedDate: 2024/9/23 下午8:53
|
||||||
|
* @FilePath: com.muyu.system.saas.mapper
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@Mapper
|
||||||
|
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
|
SysUser selectUserByUserName(@Param("userName") String userName);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.muyu.system.saas.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: SysUser
|
||||||
|
* @Description:
|
||||||
|
* @CreatedDate: 2024/9/23 下午8:55
|
||||||
|
* @FilePath: com.muyu.system.saas.service.impl
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface SysUserService extends IService<SysUser> {
|
||||||
|
SysUser selectUserByUserName(String userName);
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.system.saas.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.system.saas.mapper.SysUserMapper;
|
||||||
|
import com.muyu.system.saas.service.SysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: SysUser
|
||||||
|
* @Description:
|
||||||
|
* @CreatedDate: 2024/9/23 下午8:55
|
||||||
|
* @FilePath: com.muyu.system.saas.service.impl
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
||||||
|
implements SysUserService {
|
||||||
|
@Resource
|
||||||
|
private SysUserMapper userMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser selectUserByUserName(String userName) {
|
||||||
|
return userMapper.selectUserByUserName(userName);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,287 @@
|
||||||
|
<?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.muyu.system.saas.mapper.SysUserMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.common.system.domain.SysUser" id="SysUserResult">
|
||||||
|
<id property="userId" column="user_id"/>
|
||||||
|
<result property="isAdmin" column="is_admin"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
|
<result property="firmCode" column="firm_code"/>
|
||||||
|
<result property="userName" column="user_name"/>
|
||||||
|
<result property="nickName" column="nick_name"/>
|
||||||
|
<result property="email" column="email"/>
|
||||||
|
<result property="phonenumber" column="phonenumber"/>
|
||||||
|
<result property="sex" column="sex"/>
|
||||||
|
<result property="avatar" column="avatar"/>
|
||||||
|
<result property="password" column="password"/>
|
||||||
|
<result property="status" column="status"/>
|
||||||
|
<result property="delFlag" column="del_flag"/>
|
||||||
|
<result property="loginIp" column="login_ip"/>
|
||||||
|
<result property="loginDate" column="login_date"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<association property="dept" javaType="com.muyu.common.system.domain.SysDept" resultMap="deptResult"/>
|
||||||
|
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="deptResult" type="com.muyu.common.system.domain.SysDept">
|
||||||
|
<id property="deptId" column="dept_id"/>
|
||||||
|
<result property="parentId" column="parent_id"/>
|
||||||
|
<result property="deptName" column="dept_name"/>
|
||||||
|
<result property="ancestors" column="ancestors"/>
|
||||||
|
<result property="orderNum" column="order_num"/>
|
||||||
|
<result property="leader" column="leader"/>
|
||||||
|
<result property="status" column="dept_status"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="RoleResult" type="com.muyu.common.system.domain.SysRole">
|
||||||
|
<id property="roleId" column="role_id"/>
|
||||||
|
<result property="roleName" column="role_name"/>
|
||||||
|
<result property="roleKey" column="role_key"/>
|
||||||
|
<result property="roleSort" column="role_sort"/>
|
||||||
|
<result property="dataScope" column="data_scope"/>
|
||||||
|
<result property="status" column="role_status"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectUserVo">
|
||||||
|
select u.user_id,
|
||||||
|
u.is_admin,
|
||||||
|
u.dept_id,
|
||||||
|
u.firm_code,
|
||||||
|
u.user_name,
|
||||||
|
u.nick_name,
|
||||||
|
u.email,
|
||||||
|
u.avatar,
|
||||||
|
u.phonenumber,
|
||||||
|
u.password,
|
||||||
|
u.sex,
|
||||||
|
u.status,
|
||||||
|
u.del_flag,
|
||||||
|
u.login_ip,
|
||||||
|
u.login_date,
|
||||||
|
u.create_by,
|
||||||
|
u.create_time,
|
||||||
|
u.remark,
|
||||||
|
d.dept_id,
|
||||||
|
d.parent_id,
|
||||||
|
d.ancestors,
|
||||||
|
d.dept_name,
|
||||||
|
d.order_num,
|
||||||
|
d.leader,
|
||||||
|
d.status as dept_status,
|
||||||
|
r.role_id,
|
||||||
|
r.role_name,
|
||||||
|
r.role_key,
|
||||||
|
r.role_sort,
|
||||||
|
r.data_scope,
|
||||||
|
r.status as role_status
|
||||||
|
from sys_user u
|
||||||
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
|
left join sys_role r on r.role_id = ur.role_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectUserList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||||
|
select u.user_id, u.dept_id,u.is_admin, u.nick_name,u.firm_code, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||||
|
u.del_flag,u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
|
||||||
|
u
|
||||||
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
|
where u.del_flag = '0'
|
||||||
|
<if test="userId != null and userId != 0">
|
||||||
|
AND u.user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
<if test="firmCode != null and firmCode != '' and firmCode != 'FIRM'">
|
||||||
|
AND u.firm_code like concat('%', #{firmCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="userName != null and userName != ''">
|
||||||
|
AND u.user_name like concat('%', #{userName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND u.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="phonenumber != null and phonenumber != ''">
|
||||||
|
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
|
AND date_format(u.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
|
AND date_format(u.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null and deptId != 0">
|
||||||
|
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
|
||||||
|
ancestors) ))
|
||||||
|
</if>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAllocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||||
|
select distinct u.user_id,u.is_admin, u.dept_id,u.firm_code, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||||
|
from sys_user u
|
||||||
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
|
left join sys_role r on r.role_id = ur.role_id
|
||||||
|
where u.del_flag = '0' and r.role_id = #{roleId}
|
||||||
|
<if test="userName != null and userName != ''">
|
||||||
|
AND u.user_name like concat('%', #{userName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="phonenumber != null and phonenumber != ''">
|
||||||
|
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||||
|
</if>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUnallocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||||
|
select distinct u.user_id,u.is_admin, u.dept_id,u.firm_code, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||||
|
from sys_user u
|
||||||
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
|
left join sys_role r on r.role_id = ur.role_id
|
||||||
|
where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
|
||||||
|
and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and
|
||||||
|
ur.role_id = #{roleId})
|
||||||
|
<if test="userName != null and userName != ''">
|
||||||
|
AND u.user_name like concat('%', #{userName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="phonenumber != null and phonenumber != ''">
|
||||||
|
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||||
|
</if>
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
where u.user_name = #{userName} and u.del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
where u.user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
|
select user_id, user_name
|
||||||
|
from sys_user
|
||||||
|
where user_name = #{userName}
|
||||||
|
and del_flag = '0'
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
|
select user_id, phonenumber
|
||||||
|
from sys_user
|
||||||
|
where phonenumber = #{phonenumber}
|
||||||
|
and del_flag = '0'
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
|
select user_id, email
|
||||||
|
from sys_user
|
||||||
|
where email = #{email}
|
||||||
|
and del_flag = '0'
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCompanyList" resultType="com.muyu.common.system.domain.SysUser">
|
||||||
|
select * from sys_user
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertUser" parameterType="com.muyu.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
|
insert into sys_user(
|
||||||
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
|
<if test="isAdmin != null and isAdmin != 0">is_admin,</if>
|
||||||
|
<if test="userName != null and userName != ''">user_name,</if>
|
||||||
|
<if test="firmCode != null and firmCode != ''">firm_code,</if>
|
||||||
|
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||||
|
<if test="email != null and email != ''">email,</if>
|
||||||
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||||
|
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||||
|
<if test="sex != null and sex != ''">sex,</if>
|
||||||
|
<if test="password != null and password != ''">password,</if>
|
||||||
|
<if test="status != null and status != ''">status,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="userId != null and userId != ''">#{userId},</if>
|
||||||
|
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||||
|
<if test="isAdmin != null and isAdmin != ''">#{isAdmin},</if>
|
||||||
|
<if test="userName != null and userName != ''">#{userName},</if>
|
||||||
|
<if test="firmCode != null and firmCode != ''">#{firmCode},</if>
|
||||||
|
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||||
|
<if test="email != null and email != ''">#{email},</if>
|
||||||
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||||
|
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||||
|
<if test="sex != null and sex != ''">#{sex},</if>
|
||||||
|
<if test="password != null and password != ''">#{password},</if>
|
||||||
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateUser" parameterType="com.muyu.common.system.domain.SysUser">
|
||||||
|
update sys_user
|
||||||
|
<set>
|
||||||
|
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||||
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||||
|
<if test="firmCode != null and firmCode != ''">firm_code = #{firmCode},</if>
|
||||||
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||||
|
<if test="email != null ">email = #{email},</if>
|
||||||
|
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||||
|
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||||
|
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||||
|
<if test="password != null and password != ''">password = #{password},</if>
|
||||||
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
|
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||||
|
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateUserStatus" parameterType="com.muyu.common.system.domain.SysUser">
|
||||||
|
update sys_user
|
||||||
|
set status = #{status}
|
||||||
|
where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateUserAvatar" parameterType="com.muyu.common.system.domain.SysUser">
|
||||||
|
update sys_user
|
||||||
|
set avatar = #{avatar}
|
||||||
|
where user_name = #{userName}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="resetUserPwd" parameterType="com.muyu.common.system.domain.SysUser">
|
||||||
|
update sys_user
|
||||||
|
set password = #{password}
|
||||||
|
where user_name = #{userName}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteUserById" parameterType="Long">
|
||||||
|
update sys_user
|
||||||
|
set del_flag = '2'
|
||||||
|
where user_id = #{userId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteUserByIds" parameterType="Long">
|
||||||
|
update sys_user set del_flag = '2' where user_id in
|
||||||
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -13,7 +13,7 @@ import com.muyu.system.service.SysConfigService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||||
@Tag(name = "SysConfigController", description = "系统参数配置")
|
@Tag(name = "SysConfigController", description = "系统参数配置")
|
||||||
public class SysConfigController extends BaseController {
|
public class SysConfigController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysConfigService configService;
|
private SysConfigService configService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.SysDept;
|
import com.muyu.common.system.domain.SysDept;
|
||||||
import com.muyu.system.service.SysDeptService;
|
import com.muyu.system.service.SysDeptService;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||||
@RequestMapping("/dept")
|
@RequestMapping("/dept")
|
||||||
public class SysDeptController extends BaseController {
|
public class SysDeptController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDeptService deptService;
|
private SysDeptService deptService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.SysDictData;
|
import com.muyu.common.system.domain.SysDictData;
|
||||||
import com.muyu.system.service.SysDictDataService;
|
import com.muyu.system.service.SysDictDataService;
|
||||||
import com.muyu.system.service.SysDictTypeService;
|
import com.muyu.system.service.SysDictTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/dict/data")
|
@RequestMapping("/dict/data")
|
||||||
public class SysDictDataController extends BaseController {
|
public class SysDictDataController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDictDataService dictDataService;
|
private SysDictDataService dictDataService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDictTypeService dictTypeService;
|
private SysDictTypeService dictTypeService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.SysDictType;
|
import com.muyu.common.system.domain.SysDictType;
|
||||||
import com.muyu.system.service.SysDictTypeService;
|
import com.muyu.system.service.SysDictTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/dict/type")
|
@RequestMapping("/dict/type")
|
||||||
public class SysDictTypeController extends BaseController {
|
public class SysDictTypeController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDictTypeService dictTypeService;
|
private SysDictTypeService dictTypeService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.muyu.common.security.annotation.InnerAuth;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.system.domain.SysLogininfor;
|
import com.muyu.common.system.domain.SysLogininfor;
|
||||||
import com.muyu.system.service.SysLogininforService;
|
import com.muyu.system.service.SysLogininforService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
@ -26,10 +26,10 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/logininfor")
|
@RequestMapping("/logininfor")
|
||||||
public class SysLogininforController extends BaseController {
|
public class SysLogininforController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysLogininforService logininforService;
|
private SysLogininforService logininforService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
@RequiresPermissions("system:logininfor:list")
|
@RequiresPermissions("system:logininfor:list")
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.system.domain.SysMenu;
|
import com.muyu.system.domain.SysMenu;
|
||||||
import com.muyu.system.domain.resp.RoleMenuTreeResp;
|
import com.muyu.system.domain.resp.RoleMenuTreeResp;
|
||||||
import com.muyu.system.service.SysMenuService;
|
import com.muyu.system.service.SysMenuService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/menu")
|
@RequestMapping("/menu")
|
||||||
public class SysMenuController extends BaseController {
|
public class SysMenuController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysMenuService menuService;
|
private SysMenuService menuService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/notice")
|
@RequestMapping("/notice")
|
||||||
public class SysNoticeController extends BaseController {
|
public class SysNoticeController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysNoticeService noticeService;
|
private SysNoticeService noticeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.muyu.common.security.annotation.InnerAuth;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.system.domain.SysOperLog;
|
import com.muyu.common.system.domain.SysOperLog;
|
||||||
import com.muyu.system.service.SysOperLogService;
|
import com.muyu.system.service.SysOperLogService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/operlog")
|
@RequestMapping("/operlog")
|
||||||
public class SysOperlogController extends BaseController {
|
public class SysOperlogController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysOperLogService operLogService;
|
private SysOperLogService operLogService;
|
||||||
|
|
||||||
@RequiresPermissions("system:operlog:list")
|
@RequiresPermissions("system:operlog:list")
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.system.service.SysPermissionService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: SysPermission
|
||||||
|
* @Description:
|
||||||
|
* @CreatedDate: 2024/9/23 下午8:58
|
||||||
|
* @FilePath: com.muyu.system.controller
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/permission")
|
||||||
|
public class SysPermissionController {
|
||||||
|
@Resource
|
||||||
|
private SysPermissionService permissionService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色数据权限
|
||||||
|
*
|
||||||
|
* @param user 用户
|
||||||
|
*
|
||||||
|
* @return 角色权限信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/getRole")
|
||||||
|
public Set<String> getRolePermission (@RequestBody SysUser user) {
|
||||||
|
return permissionService.getRolePermission(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单数据权限
|
||||||
|
*
|
||||||
|
* @param user 用户
|
||||||
|
*
|
||||||
|
* @return 菜单权限信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/getMenu")
|
||||||
|
public Set<String> getMenuPermission (@RequestBody SysUser user) {
|
||||||
|
return permissionService.getMenuPermission(user);
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.system.domain.SysPost;
|
import com.muyu.system.domain.SysPost;
|
||||||
import com.muyu.system.service.SysPostService;
|
import com.muyu.system.service.SysPostService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/post")
|
@RequestMapping("/post")
|
||||||
public class SysPostController extends BaseController {
|
public class SysPostController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysPostService postService;
|
private SysPostService postService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@ import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.system.domain.resp.ProfileResp;
|
import com.muyu.system.domain.resp.ProfileResp;
|
||||||
import com.muyu.system.service.SysUserService;
|
import com.muyu.system.service.SysUserService;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@ -32,10 +32,10 @@ import java.util.Arrays;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user/profile")
|
@RequestMapping("/user/profile")
|
||||||
public class SysProfileController extends BaseController {
|
public class SysProfileController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysUserService userService;
|
private SysUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.muyu.system.domain.resp.DeptTreeResp;
|
||||||
import com.muyu.system.service.SysDeptService;
|
import com.muyu.system.service.SysDeptService;
|
||||||
import com.muyu.system.service.SysRoleService;
|
import com.muyu.system.service.SysRoleService;
|
||||||
import com.muyu.system.service.SysUserService;
|
import com.muyu.system.service.SysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -31,13 +31,13 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/role")
|
@RequestMapping("/role")
|
||||||
public class SysRoleController extends BaseController {
|
public class SysRoleController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRoleService roleService;
|
private SysRoleService roleService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysUserService userService;
|
private SysUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDeptService deptService;
|
private SysDeptService deptService;
|
||||||
|
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.muyu.system.domain.resp.UserInfoResp;
|
||||||
import com.muyu.system.service.*;
|
import com.muyu.system.service.*;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
@ -39,22 +39,22 @@ import java.util.stream.Collectors;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user")
|
@RequestMapping("/user")
|
||||||
public class SysUserController extends BaseController {
|
public class SysUserController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysUserService userService;
|
private SysUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRoleService roleService;
|
private SysRoleService roleService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDeptService deptService;
|
private SysDeptService deptService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysPostService postService;
|
private SysPostService postService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysPermissionService permissionService;
|
private SysPermissionService permissionService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysConfigService configService;
|
private SysConfigService configService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.system.domain.SysUserOnline;
|
import com.muyu.system.domain.SysUserOnline;
|
||||||
import com.muyu.system.service.SysUserOnlineService;
|
import com.muyu.system.service.SysUserOnlineService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -28,10 +28,10 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/online")
|
@RequestMapping("/online")
|
||||||
public class SysUserOnlineController extends BaseController {
|
public class SysUserOnlineController extends BaseController {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysUserOnlineService userOnlineService;
|
private SysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:online:list")
|
@RequiresPermissions("monitor:online:list")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
//import javax.annotation.Resource;
|
||||||
//import org.springframework.context.annotation.Bean;
|
//import org.springframework.context.annotation.Bean;
|
||||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
//import org.springframework.web.bind.annotation.RestController;
|
//import org.springframework.web.bind.annotation.RestController;
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
//@RequestMapping("/rabbit/test")
|
//@RequestMapping("/rabbit/test")
|
||||||
//public class RabbitTest {
|
//public class RabbitTest {
|
||||||
//
|
//
|
||||||
// @Autowired
|
// @Resource
|
||||||
// private RabbitTemplate rabbitTemplate;
|
// private RabbitTemplate rabbitTemplate;
|
||||||
//
|
//
|
||||||
// @Bean
|
// @Bean
|
||||||
|
|
|
@ -47,6 +47,7 @@ public interface SysUserService extends IService<SysUser> {
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserByUserName (String firmCode, String userName);
|
public SysUser selectUserByUserName (String firmCode, String userName);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
@ -227,5 +228,4 @@ public interface SysUserService extends IService<SysUser> {
|
||||||
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||||
|
|
||||||
List<SysUser> selectCompanyList();
|
List<SysUser> selectCompanyList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.system.domain.SysConfig;
|
import com.muyu.system.domain.SysConfig;
|
||||||
import com.muyu.system.mapper.SysConfigMapper;
|
import com.muyu.system.mapper.SysConfigMapper;
|
||||||
import com.muyu.system.service.SysConfigService;
|
import com.muyu.system.service.SysConfigService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import java.util.Objects;
|
||||||
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig>
|
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig>
|
||||||
implements SysConfigService {
|
implements SysConfigService {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.muyu.system.domain.vo.TreeSelect;
|
||||||
import com.muyu.system.mapper.SysDeptMapper;
|
import com.muyu.system.mapper.SysDeptMapper;
|
||||||
import com.muyu.system.mapper.SysRoleMapper;
|
import com.muyu.system.mapper.SysRoleMapper;
|
||||||
import com.muyu.system.service.SysDeptService;
|
import com.muyu.system.service.SysDeptService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
|
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRoleMapper roleMapper;
|
private SysRoleMapper roleMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.muyu.common.security.utils.DictUtils;
|
||||||
import com.muyu.common.system.domain.SysDictData;
|
import com.muyu.common.system.domain.SysDictData;
|
||||||
import com.muyu.system.mapper.SysDictDataMapper;
|
import com.muyu.system.mapper.SysDictDataMapper;
|
||||||
import com.muyu.system.service.SysDictDataService;
|
import com.muyu.system.service.SysDictDataService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {
|
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDictDataMapper dictDataMapper;
|
private SysDictDataMapper dictDataMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.muyu.common.system.domain.SysDictType;
|
||||||
import com.muyu.system.mapper.SysDictDataMapper;
|
import com.muyu.system.mapper.SysDictDataMapper;
|
||||||
import com.muyu.system.mapper.SysDictTypeMapper;
|
import com.muyu.system.mapper.SysDictTypeMapper;
|
||||||
import com.muyu.system.service.SysDictTypeService;
|
import com.muyu.system.service.SysDictTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements SysDictTypeService {
|
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements SysDictTypeService {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDictTypeMapper dictTypeMapper;
|
private SysDictTypeMapper dictTypeMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysDictDataMapper dictDataMapper;
|
private SysDictDataMapper dictDataMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.system.domain.SysLogininfor;
|
import com.muyu.common.system.domain.SysLogininfor;
|
||||||
import com.muyu.system.mapper.SysLogininforMapper;
|
import com.muyu.system.mapper.SysLogininforMapper;
|
||||||
import com.muyu.system.service.SysLogininforService;
|
import com.muyu.system.service.SysLogininforService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class SysLogininforServiceImpl extends ServiceImpl<SysLogininforMapper, SysLogininfor> implements SysLogininforService {
|
public class SysLogininforServiceImpl extends ServiceImpl<SysLogininforMapper, SysLogininfor> implements SysLogininforService {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysLogininforMapper logininforMapper;
|
private SysLogininforMapper logininforMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.muyu.system.mapper.SysMenuMapper;
|
||||||
import com.muyu.system.mapper.SysRoleMapper;
|
import com.muyu.system.mapper.SysRoleMapper;
|
||||||
import com.muyu.system.mapper.SysRoleMenuMapper;
|
import com.muyu.system.mapper.SysRoleMenuMapper;
|
||||||
import com.muyu.system.service.SysMenuService;
|
import com.muyu.system.service.SysMenuService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -30,13 +30,13 @@ import java.util.stream.Collectors;
|
||||||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {
|
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {
|
||||||
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
|
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysMenuMapper menuMapper;
|
private SysMenuMapper menuMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRoleMapper roleMapper;
|
private SysRoleMapper roleMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRoleMenuMapper roleMenuMapper;
|
private SysRoleMenuMapper roleMenuMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
import com.muyu.system.mapper.SysNoticeMapper;
|
import com.muyu.system.mapper.SysNoticeMapper;
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements SysNoticeService {
|
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements SysNoticeService {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysNoticeMapper noticeMapper;
|
private SysNoticeMapper noticeMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.system.domain.SysOperLog;
|
import com.muyu.common.system.domain.SysOperLog;
|
||||||
import com.muyu.system.mapper.SysOperLogMapper;
|
import com.muyu.system.mapper.SysOperLogMapper;
|
||||||
import com.muyu.system.service.SysOperLogService;
|
import com.muyu.system.service.SysOperLogService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements SysOperLogService {
|
public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements SysOperLogService {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysOperLogMapper operLogMapper;
|
private SysOperLogMapper operLogMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.system.service.SysMenuService;
|
import com.muyu.system.service.SysMenuService;
|
||||||
import com.muyu.system.service.SysPermissionService;
|
import com.muyu.system.service.SysPermissionService;
|
||||||
import com.muyu.system.service.SysRoleService;
|
import com.muyu.system.service.SysRoleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysPermissionServiceImpl implements SysPermissionService {
|
public class SysPermissionServiceImpl implements SysPermissionService {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysRoleService roleService;
|
private SysRoleService roleService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysMenuService menuService;
|
private SysMenuService menuService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.muyu.system.domain.SysPost;
|
||||||
import com.muyu.system.mapper.SysPostMapper;
|
import com.muyu.system.mapper.SysPostMapper;
|
||||||
import com.muyu.system.mapper.SysUserPostMapper;
|
import com.muyu.system.mapper.SysUserPostMapper;
|
||||||
import com.muyu.system.service.SysPostService;
|
import com.muyu.system.service.SysPostService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -20,10 +20,10 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> implements SysPostService {
|
public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> implements SysPostService {
|
||||||
@Autowired
|
@Resource
|
||||||
private SysPostMapper postMapper;
|
private SysPostMapper postMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private SysUserPostMapper userPostMapper;
|
private SysUserPostMapper userPostMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue