代码重构一次
parent
3180012c6c
commit
5143ef67de
|
@ -16,11 +16,31 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.muyu</groupId>-->
|
||||
<!-- <artifactId>cloud-common-saas</artifactId>-->
|
||||
<!-- </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>
|
||||
|
||||
|
||||
<!-- SpringBoot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -45,6 +65,7 @@
|
|||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
@ -87,6 +108,7 @@
|
|||
<artifactId>cloud-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.muyu.auth;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -13,6 +16,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
*
|
||||
* @author muyu
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@EnableCustomConfig
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication(
|
||||
|
@ -26,5 +30,12 @@ public class CloudAuthApplication {
|
|||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudAuthApplication.class, args);
|
||||
System.out.println("CloudAuth 模块启动成功!");
|
||||
=======
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
public class CloudAuthApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudAuthApplication.class, args);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,11 @@ import com.muyu.common.security.auth.AuthUtil;
|
|||
import com.muyu.common.security.service.TokenService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -25,16 +29,27 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||
*/
|
||||
@RestController
|
||||
public class TokenController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private TokenService tokenService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysLoginService sysLoginService;
|
||||
|
||||
@PostMapping("login")
|
||||
public Result<?> login (@RequestBody LoginBody form) {
|
||||
// 用户登录
|
||||
<<<<<<< HEAD
|
||||
LoginUser userInfo = sysLoginService.login(form);
|
||||
=======
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||
>>>>>>> 813460c (1..)
|
||||
// 获取登录token
|
||||
return Result.success(tokenService.createToken(userInfo));
|
||||
}
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
package com.muyu.auth.form;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import lombok.Data;
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 用户登录对象
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Data
|
||||
public class LoginBody {
|
||||
|
||||
private String firmCode;
|
||||
=======
|
||||
public class LoginBody {
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
|
@ -20,4 +27,23 @@ public class LoginBody {
|
|||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
public String getUsername () {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername (String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword () {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword (String password) {
|
||||
this.password = password;
|
||||
}
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.muyu.auth.service;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.auth.form.LoginBody;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.common.core.constant.CacheConstants;
|
||||
import com.muyu.common.core.constant.Constants;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
|
@ -13,6 +16,7 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.core.utils.ip.IpUtils;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.remote.RemoteSaasService;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
|
@ -23,6 +27,14 @@ import org.springframework.stereotype.Component;
|
|||
import java.util.Set;
|
||||
|
||||
|
||||
=======
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
|
@ -30,6 +42,7 @@ import java.util.Set;
|
|||
*/
|
||||
@Component
|
||||
public class SysLoginService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
|
@ -54,6 +67,26 @@ public class SysLoginService {
|
|||
String password = form.getPassword();
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(firmCode, username, password)) {
|
||||
=======
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@Autowired
|
||||
private SysRecordLogService recordLogService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
public LoginUser login (String username, String password) {
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password)) {
|
||||
>>>>>>> 813460c (1..)
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
}
|
||||
|
@ -76,7 +109,12 @@ public class SysLoginService {
|
|||
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
||||
}
|
||||
// 查询用户信息
|
||||
<<<<<<< HEAD
|
||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(firmCode, username, SecurityConstants.INNER);
|
||||
=======
|
||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||
|
@ -86,8 +124,13 @@ public class SysLoginService {
|
|||
throw new ServiceException(userResult.getMsg());
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
LoginUser loginUser = userResult.getData();
|
||||
SysUser user = loginUser.getSysUser();
|
||||
=======
|
||||
LoginUser userInfo = userResult.getData();
|
||||
SysUser user = userResult.getData().getSysUser();
|
||||
>>>>>>> 813460c (1..)
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||
|
@ -98,8 +141,12 @@ public class SysLoginService {
|
|||
}
|
||||
passwordService.validate(user, password);
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
||||
<<<<<<< HEAD
|
||||
|
||||
return loginUser;
|
||||
=======
|
||||
return userInfo;
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
public void logout (String loginName) {
|
||||
|
|
|
@ -6,7 +6,11 @@ import com.muyu.common.core.exception.ServiceException;
|
|||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -18,14 +22,22 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
@Component
|
||||
public class SysPasswordService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private RedisService redisService;
|
||||
|
||||
private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
|
||||
|
||||
private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysRecordLogService recordLogService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,11 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.core.utils.ip.IpUtils;
|
||||
import com.muyu.common.system.remote.RemoteLogService;
|
||||
import com.muyu.common.system.domain.SysLogininfor;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
|
@ -16,7 +20,11 @@ import org.springframework.stereotype.Component;
|
|||
*/
|
||||
@Component
|
||||
public class SysRecordLogService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private RemoteLogService remoteLogService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,11 @@ nacos:
|
|||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
<<<<<<< HEAD
|
||||
namespace: one-saas
|
||||
=======
|
||||
namespace: one
|
||||
>>>>>>> 813460c (1..)
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
|
@ -40,8 +44,15 @@ spring:
|
|||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
<<<<<<< HEAD
|
||||
# 系统环境Config共享配置
|
||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
=======
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统环境Config共享配置
|
||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
|
@ -168,11 +169,13 @@
|
|||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -45,9 +45,12 @@ public class SecurityConstants {
|
|||
* 角色权限
|
||||
*/
|
||||
public static final String ROLE_PERMISSION = "role_permission";
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* SAAS请求头的key
|
||||
*/
|
||||
public static final String SAAS_KEY = "ent-code";
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public class ServiceNameConstants {
|
|||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "cloud-file";
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* 智能车联服务
|
||||
|
@ -29,4 +30,6 @@ public class ServiceNameConstants {
|
|||
public static final String ENT_SERVICE = "cloud-ent";
|
||||
|
||||
public static final String SAAS_SERVICE = "cloud-system-saas";
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class SecurityContextHolder {
|
|||
public static void remove () {
|
||||
THREAD_LOCAL.remove();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public static String getSaasKey() {
|
||||
return get(SecurityConstants.SAAS_KEY);
|
||||
|
@ -88,4 +89,6 @@ public class SecurityContextHolder {
|
|||
set(SecurityConstants.SAAS_KEY,saasKey);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ public class JwtUtils {
|
|||
public static String getValue (Claims claims, String key) {
|
||||
return Convert.toStr(claims.get(key), "");
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* 根据身份信息获取SAASKey
|
||||
|
@ -173,4 +174,6 @@ public class JwtUtils {
|
|||
public static String getSaasKey(Claims claims) {
|
||||
return getValue(claims, SecurityConstants.SAAS_KEY);
|
||||
}
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -58,7 +58,11 @@ public class IpUtils {
|
|||
ip = request.getRemoteAddr();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "106.54.193.225" : getMultistageReverseProxyIp(ip);
|
||||
=======
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,7 +74,11 @@ public class IpUtils {
|
|||
*/
|
||||
public static boolean internalIp (String ip) {
|
||||
byte[] addr = textToNumericFormatV4(ip);
|
||||
<<<<<<< HEAD
|
||||
return internalIp(addr) || "106.54.193.225".equals(ip);
|
||||
=======
|
||||
return internalIp(addr) || "127.0.0.1".equals(ip);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +205,11 @@ public class IpUtils {
|
|||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
return "106.54.193.225";
|
||||
=======
|
||||
return "127.0.0.1";
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,11 @@ import org.aspectj.lang.annotation.Aspect;
|
|||
import org.aspectj.lang.annotation.Before;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -48,7 +52,11 @@ public class LogAspect {
|
|||
*/
|
||||
private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private AsyncLogService asyncLogService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.constant.SecurityConstants;
|
|||
import com.muyu.common.system.remote.RemoteLogService;
|
||||
import com.muyu.common.system.domain.SysOperLog;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -14,7 +15,7 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
public class AsyncLogService {
|
||||
@Resource
|
||||
@Autowired
|
||||
private RemoteLogService remoteLogService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,4 +32,7 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.common.rabbit;
|
||||
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||
|
||||
@Configuration
|
||||
public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer {
|
||||
|
||||
static {
|
||||
System.setProperty("spring.amqp.deserialization.trust.all", "true");
|
||||
}
|
||||
|
||||
//以下配置RabbitMQ消息服务
|
||||
@Autowired
|
||||
public ConnectionFactory connectionFactory;
|
||||
|
||||
|
||||
/**
|
||||
* 处理器方法工厂
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public DefaultMessageHandlerMethodFactory handlerMethodFactory() {
|
||||
DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory();
|
||||
// 这里的转换器设置实现了 通过 @Payload 注解 自动反序列化message body
|
||||
factory.setMessageConverter(new MappingJackson2MessageConverter());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureRabbitListeners(RabbitListenerEndpointRegistrar rabbitListenerEndpointRegistrar) {
|
||||
rabbitListenerEndpointRegistrar.setMessageHandlerMethodFactory(handlerMethodFactory());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
<<<<<<< HEAD
|
||||
com.muyu.common.rabbit.config.RabbitListenerConfig
|
||||
com.muyu.common.rabbit.config.RabbitAdminConfig
|
||||
com.muyu.common.rabbit.config.RabbitMQMessageConverterConfig
|
||||
=======
|
||||
com.muyu.common.rabbit.RabbitListenerConfigurer
|
||||
>>>>>>> 813460c (1..)
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.muyu.common.redis.service;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.data.redis.core.BoundSetOperations;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
@ -18,7 +22,11 @@ import java.util.concurrent.TimeUnit;
|
|||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||
@Component
|
||||
public class RedisService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
public RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,10 @@ public class HeaderInterceptor implements AsyncHandlerInterceptor {
|
|||
}
|
||||
|
||||
SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID));
|
||||
<<<<<<< HEAD
|
||||
SecurityContextHolder.setSaasKey(ServletUtils.getHeader(request, SecurityConstants.SAAS_KEY));
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME));
|
||||
SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY));
|
||||
|
||||
|
|
|
@ -12,7 +12,11 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.common.system.domain.LoginUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
@ -34,7 +38,11 @@ public class TokenService {
|
|||
private final static long expireTime = CacheConstants.EXPIRATION;
|
||||
|
||||
private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
|
@ -55,11 +63,18 @@ public class TokenService {
|
|||
claimsMap.put(SecurityConstants.USER_KEY, token);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
|
||||
<<<<<<< HEAD
|
||||
claimsMap.put(SecurityConstants.SAAS_KEY,loginUser.getSysUser().getFirmCode());
|
||||
// 接口返回信息
|
||||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||
rspMap.put("ent_code", loginUser.getSysUser().getFirmCode());
|
||||
=======
|
||||
|
||||
// 接口返回信息
|
||||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||
>>>>>>> 813460c (1..)
|
||||
rspMap.put("expires_in", expireTime);
|
||||
return rspMap;
|
||||
}
|
||||
|
|
|
@ -30,10 +30,13 @@ public class SecurityUtils {
|
|||
return SecurityContextHolder.getUserName();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public static String getSaasKey () {
|
||||
return SecurityContextHolder.getSaasKey();
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 获取用户key
|
||||
*/
|
||||
|
|
|
@ -63,6 +63,9 @@ public class LoginUser implements Serializable {
|
|||
*/
|
||||
private SysUser sysUser;
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -34,8 +34,11 @@ public class SysDept extends BaseEntity {
|
|||
*/
|
||||
private Long parentId;
|
||||
|
||||
<<<<<<< HEAD
|
||||
private String firmCode;
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
|
|
|
@ -36,8 +36,11 @@ public class SysRole extends BaseEntity {
|
|||
@Excel(name = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
<<<<<<< HEAD
|
||||
private String firmCode;
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 角色权限
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.muyu.common.system.domain;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.annotation.Excel.ColumnType;
|
||||
import com.muyu.common.core.annotation.Excel.Type;
|
||||
|
@ -31,7 +34,10 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
<<<<<<< HEAD
|
||||
@TableName("sys_user")
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
public class SysUser extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -39,11 +45,16 @@ public class SysUser extends BaseEntity {
|
|||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
<<<<<<< HEAD
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long userId;
|
||||
|
||||
private Integer isAdmin;
|
||||
|
||||
=======
|
||||
private Long userId;
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
|
@ -56,9 +67,12 @@ public class SysUser extends BaseEntity {
|
|||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
private String firmCode;
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
|
@ -145,8 +159,11 @@ public class SysUser extends BaseEntity {
|
|||
*/
|
||||
private Long roleId;
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
public SysUser (Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
@ -155,9 +172,14 @@ public class SysUser extends BaseEntity {
|
|||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
public boolean isAdmin () {
|
||||
return isAdmin(this.userId) || (this.isAdmin != null && this.isAdmin == 1);
|
||||
=======
|
||||
public boolean isAdmin () {
|
||||
return isAdmin(this.userId);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
@Xss(message = "用户昵称不能包含脚本字符")
|
||||
|
|
|
@ -3,6 +3,7 @@ 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;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.domain.*;
|
||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
@ -11,6 +12,14 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
=======
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
|
@ -18,6 +27,19 @@ import java.util.Set;
|
|||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||
public interface RemoteUserService {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
/**
|
||||
* 通过用户名查询用户信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param source 请求来源
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/user/info/{username}")
|
||||
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
|
@ -29,6 +51,7 @@ public interface RemoteUserService {
|
|||
*/
|
||||
@PostMapping("/user/register")
|
||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
<<<<<<< HEAD
|
||||
|
||||
@GetMapping("/user/companyList")
|
||||
public Result<List<SysUser>> companyList ();
|
||||
|
@ -98,4 +121,6 @@ public interface RemoteUserService {
|
|||
*/
|
||||
@PostMapping("/user")
|
||||
public Result addUser (@RequestBody SysUser user);
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
package com.muyu.common.system.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.system.domain.*;
|
||||
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.LoginUser;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
|
@ -25,11 +34,19 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
public RemoteUserService create (Throwable throwable) {
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteUserService() {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
@Override
|
||||
public Result<LoginUser> getUserInfo (String username, String source) {
|
||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
@Override
|
||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
@Override
|
||||
public Result<List<SysUser>> companyList() {
|
||||
|
@ -76,6 +93,8 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
return Result.error(throwable);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
||||
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
||||
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
||||
<<<<<<< HEAD
|
||||
com.muyu.common.system.remote.factory.RemoteSaasFallbackFactory
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
|
|
|
@ -7,9 +7,15 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Log4j2
|
||||
<<<<<<< HEAD
|
||||
//@Component
|
||||
public class XXLJobConfig {
|
||||
// @Bean
|
||||
=======
|
||||
@Component
|
||||
public class XXLJobConfig {
|
||||
@Bean
|
||||
>>>>>>> 813460c (1..)
|
||||
public XxlJobSpringExecutor xxlJobExecutor(XxlJobProperties xxlJobProperties) {
|
||||
if (StringUtils.isEmpty(xxlJobProperties.getAdminAddresses())){
|
||||
throw new RuntimeException("请在bootstrap.yml当中配置shared-configs项,xxl-job共享配置[application-xxl-config]");
|
||||
|
|
|
@ -81,6 +81,8 @@
|
|||
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
|
||||
<version>4.5.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -13,6 +13,9 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
public class CloudGatewayApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudGatewayApplication.class, args);
|
||||
<<<<<<< HEAD
|
||||
System.out.println("CloudGateway 模块启动成功!");
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.muyu.gateway.config;
|
||||
|
||||
import com.muyu.gateway.handler.ValidateCodeHandler;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
|
@ -16,7 +20,11 @@ import org.springframework.web.reactive.function.server.RouterFunctions;
|
|||
*/
|
||||
@Configuration
|
||||
public class RouterFunctionConfiguration {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private ValidateCodeHandler validateCodeHandler;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
|
|
@ -12,7 +12,11 @@ import com.muyu.gateway.config.properties.IgnoreWhiteProperties;
|
|||
import io.jsonwebtoken.Claims;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||
import org.springframework.core.Ordered;
|
||||
|
@ -31,10 +35,17 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);
|
||||
|
||||
// 排除过滤的 uri 地址,nacos自行添加
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private IgnoreWhiteProperties ignoreWhite;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private IgnoreWhiteProperties ignoreWhite;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
|
@ -63,7 +74,10 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||
}
|
||||
String userid = JwtUtils.getUserId(claims);
|
||||
String username = JwtUtils.getUserName(claims);
|
||||
<<<<<<< HEAD
|
||||
String saasKey = JwtUtils.getSaasKey(claims);
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) {
|
||||
return unauthorizedResponse(exchange, "令牌验证失败");
|
||||
}
|
||||
|
@ -72,7 +86,10 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
|
||||
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
|
||||
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
|
||||
<<<<<<< HEAD
|
||||
addHeader(mutate,SecurityConstants.SAAS_KEY,saasKey);
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
// 内部请求来源参数清除
|
||||
removeHeader(mutate, SecurityConstants.FROM_SOURCE);
|
||||
return chain.filter(exchange.mutate().request(mutate.build()).build());
|
||||
|
|
|
@ -6,7 +6,11 @@ import com.muyu.common.core.utils.ServletUtils;
|
|||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.gateway.config.properties.CaptchaProperties;
|
||||
import com.muyu.gateway.service.ValidateCodeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilter;
|
||||
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
|
@ -29,9 +33,15 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object> {
|
|||
private final static String[] VALIDATE_URL = new String[]{"/auth/login", "/auth/register"};
|
||||
private static final String CODE = "code";
|
||||
private static final String UUID = "uuid";
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private ValidateCodeService validateCodeService;
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private ValidateCodeService validateCodeService;
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private CaptchaProperties captchaProperties;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,11 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.core.utils.html.EscapeUtil;
|
||||
import com.muyu.gateway.config.properties.XssProperties;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||
|
@ -31,7 +35,11 @@ import java.nio.charset.StandardCharsets;
|
|||
@ConditionalOnProperty(value = "security.xss.enabled", havingValue = "true")
|
||||
public class XssFilter implements GlobalFilter, Ordered {
|
||||
// 跨站脚本的 xss 配置,nacos自行添加
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private XssProperties xss;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,11 @@ package com.muyu.gateway.handler;
|
|||
import com.muyu.common.core.exception.CaptchaException;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.gateway.service.ValidateCodeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
|
@ -21,7 +25,11 @@ import java.io.IOException;
|
|||
*/
|
||||
@Component
|
||||
public class ValidateCodeHandler implements HandlerFunction<ServerResponse> {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private ValidateCodeService validateCodeService;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,11 @@ import com.muyu.common.redis.service.RedisService;
|
|||
import com.muyu.gateway.config.properties.CaptchaProperties;
|
||||
import com.muyu.gateway.model.resp.CaptchaCodeResp;
|
||||
import com.muyu.gateway.service.ValidateCodeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
|
||||
|
@ -35,10 +39,17 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
|
|||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private CaptchaProperties captchaProperties;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +61,11 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
|
|||
CaptchaCodeResp.CaptchaCodeRespBuilder respBuilder = CaptchaCodeResp.builder()
|
||||
.captchaEnabled(captchaEnabled);
|
||||
if (!captchaEnabled) {
|
||||
<<<<<<< HEAD
|
||||
return Result.success(respBuilder.build());
|
||||
=======
|
||||
return Result.success(respBuilder);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
// 保存验证码信息
|
||||
|
|
|
@ -4,6 +4,11 @@ import cn.hutool.core.net.NetUtil;
|
|||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.cloud.gateway.route.Route;
|
||||
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
|
||||
import org.springframework.core.io.buffer.DataBufferFactory;
|
||||
|
@ -16,6 +21,11 @@ import reactor.core.publisher.Mono;
|
|||
|
||||
/**
|
||||
* Web 工具类
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
*
|
||||
*
|
||||
>>>>>>> 813460c (1..)
|
||||
*/
|
||||
@Log4j2
|
||||
public class WebFrameworkUtils {
|
||||
|
@ -68,6 +78,11 @@ public class WebFrameworkUtils {
|
|||
|
||||
/**
|
||||
* 获得客户端 IP
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
*
|
||||
*
|
||||
>>>>>>> 813460c (1..)
|
||||
* @param exchange 请求
|
||||
* @param otherHeaderNames 其它 header 名字的数组
|
||||
* @return 客户端 IP
|
||||
|
@ -85,6 +100,10 @@ public class WebFrameworkUtils {
|
|||
return NetUtil.getMultistageReverseProxyIp(ip);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
// 方式二,通过 remoteAddress 获取
|
||||
if (exchange.getRequest().getRemoteAddress() == null) {
|
||||
return null;
|
||||
|
@ -95,6 +114,10 @@ public class WebFrameworkUtils {
|
|||
|
||||
/**
|
||||
* 获得请求匹配的 Route 路由
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
*
|
||||
>>>>>>> 813460c (1..)
|
||||
* @param exchange 请求
|
||||
* @return 路由
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,11 @@ nacos:
|
|||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
<<<<<<< HEAD
|
||||
namespace: one-saas
|
||||
=======
|
||||
namespace: one
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
@ -22,35 +26,60 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
<<<<<<< HEAD
|
||||
# # nacos用户名
|
||||
# username: ${nacos.user-name}
|
||||
# # nacos密码
|
||||
# password: ${nacos.password}
|
||||
=======
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
>>>>>>> 813460c (1..)
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
config:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
<<<<<<< HEAD
|
||||
# # nacos用户名
|
||||
# username: ${nacos.user-name}
|
||||
# # nacos密码
|
||||
# password: ${nacos.password}
|
||||
=======
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
>>>>>>> 813460c (1..)
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
<<<<<<< HEAD
|
||||
# 系统环境Config共享配置
|
||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
=======
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统环境Config共享配置
|
||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
>>>>>>> 813460c (1..)
|
||||
sentinel:
|
||||
# 取消控制台懒加载
|
||||
eager: true
|
||||
transport:
|
||||
# 控制台地址
|
||||
<<<<<<< HEAD
|
||||
dashboard: 106.54.193.225:8718
|
||||
=======
|
||||
dashboard: 127.0.0.1:8718
|
||||
>>>>>>> 813460c (1..)
|
||||
# nacos配置持久化
|
||||
datasource:
|
||||
ds1:
|
||||
|
|
|
@ -13,6 +13,9 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
public class CloudFileApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudFileApplication.class, args);
|
||||
<<<<<<< HEAD
|
||||
System.out.println("CloudFile 模块启动成功!");
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,11 @@ import com.muyu.file.service.ISysFileService;
|
|||
import com.muyu.common.system.domain.SysFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -21,7 +25,11 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
public class SysFileController {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private ISysFileService sysFileService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,11 @@ import com.muyu.file.config.MinioConfig;
|
|||
import com.muyu.file.utils.FileUploadUtils;
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.PutObjectArgs;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
@ -18,10 +22,17 @@ import java.io.InputStream;
|
|||
*/
|
||||
@Service
|
||||
public class MinioSysFileServiceImpl implements ISysFileService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private MinioConfig minioConfig;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private MinioConfig minioConfig;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private MinioClient client;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
# Tomcat
|
||||
server:
|
||||
<<<<<<< HEAD
|
||||
port: 9301
|
||||
=======
|
||||
port: 9300
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
<<<<<<< HEAD
|
||||
namespace: one-saas
|
||||
=======
|
||||
namespace: one
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -16,6 +16,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
public class CloudGenApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudGenApplication.class, args);
|
||||
<<<<<<< HEAD
|
||||
System.out.println("CloudGen 模块启动成功!");
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
package com.muyu.gen.controller;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
=======
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
import com.muyu.gen.domain.GenTableColumn;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
import com.muyu.gen.service.IGenTableColumnService;
|
||||
import com.muyu.gen.service.IGenTableService;
|
||||
|
@ -19,6 +26,16 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import com.muyu.gen.service.IGenTableColumnService;
|
||||
import com.muyu.gen.service.IGenTableService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
>>>>>>> 813460c (1..)
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -27,6 +44,7 @@ import java.util.Map;
|
|||
/**
|
||||
* 代码生成 操作处理
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RequestMapping("/gen")
|
||||
|
@ -40,6 +58,17 @@ public class GenController extends BaseController
|
|||
private HttpServletResponse response;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
* @author muyu
|
||||
*/
|
||||
@RequestMapping("/gen")
|
||||
@RestController
|
||||
public class GenController extends BaseController {
|
||||
@Autowired
|
||||
private IGenTableService genTableService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private IGenTableColumnService genTableColumnService;
|
||||
|
||||
/**
|
||||
|
@ -47,8 +76,12 @@ public class GenController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:list")
|
||||
@GetMapping("/list")
|
||||
<<<<<<< HEAD
|
||||
public Result genList(GenTable genTable)
|
||||
{
|
||||
=======
|
||||
public Result<TableDataInfo<GenTable>> genList (GenTable genTable) {
|
||||
>>>>>>> 813460c (1..)
|
||||
startPage();
|
||||
List<GenTable> list = genTableService.selectGenTableList(genTable);
|
||||
return getDataTable(list);
|
||||
|
@ -59,8 +92,12 @@ public class GenController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:query")
|
||||
@GetMapping(value = "/{tableId}")
|
||||
<<<<<<< HEAD
|
||||
public Result getInfo(@PathVariable("tableId") Long tableId)
|
||||
{
|
||||
=======
|
||||
public Result getInfo (@PathVariable("tableId") Long tableId) {
|
||||
>>>>>>> 813460c (1..)
|
||||
GenTable table = genTableService.selectGenTableById(tableId);
|
||||
List<GenTable> tables = genTableService.selectGenTableAll();
|
||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
||||
|
@ -71,14 +108,21 @@ public class GenController extends BaseController
|
|||
return success(map);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 查询数据库列表
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:list")
|
||||
@GetMapping("/db/list")
|
||||
<<<<<<< HEAD
|
||||
public Result dataList(GenTable genTable)
|
||||
{
|
||||
=======
|
||||
public Result<TableDataInfo<GenTable>> dataList (GenTable genTable) {
|
||||
>>>>>>> 813460c (1..)
|
||||
startPage();
|
||||
List<GenTable> list = genTableService.selectDbTableList(genTable);
|
||||
return getDataTable(list);
|
||||
|
@ -88,6 +132,7 @@ public class GenController extends BaseController
|
|||
* 查询数据表字段列表
|
||||
*/
|
||||
@GetMapping(value = "/column/{tableId}")
|
||||
<<<<<<< HEAD
|
||||
public Result columnList(@PathVariable("tableId") Long tableId)
|
||||
{
|
||||
TableDataInfo dataInfo = new TableDataInfo();
|
||||
|
@ -95,11 +140,22 @@ public class GenController extends BaseController
|
|||
dataInfo.setRows(list);
|
||||
dataInfo.setTotal(list.size());
|
||||
return success(dataInfo);
|
||||
=======
|
||||
public Result<TableDataInfo<GenTableColumn>> columnList (Long tableId) {
|
||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
||||
return Result.success(
|
||||
TableDataInfo.<GenTableColumn>builder()
|
||||
.total(list.size())
|
||||
.rows(list)
|
||||
.build()
|
||||
);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入表结构(保存)
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
// @RequiresPermissions("tool:gen:import")
|
||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importTable")
|
||||
|
@ -108,6 +164,15 @@ public class GenController extends BaseController
|
|||
String[] tableNames = Convert.toStrArray(tables);
|
||||
// 查询表信息
|
||||
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames,dbName);
|
||||
=======
|
||||
@RequiresPermissions("tool:gen:import")
|
||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importTable")
|
||||
public Result importTableSave (String tables) {
|
||||
String[] tableNames = Convert.toStrArray(tables);
|
||||
// 查询表信息
|
||||
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableService.importGenTable(tableList);
|
||||
return success();
|
||||
}
|
||||
|
@ -118,8 +183,12 @@ public class GenController extends BaseController
|
|||
@RequiresPermissions("tool:gen:edit")
|
||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
<<<<<<< HEAD
|
||||
public Result editSave(@Validated @RequestBody GenTable genTable)
|
||||
{
|
||||
=======
|
||||
public Result editSave (@Validated @RequestBody GenTable genTable) {
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableService.validateEdit(genTable);
|
||||
genTableService.updateGenTable(genTable);
|
||||
return success();
|
||||
|
@ -131,8 +200,12 @@ public class GenController extends BaseController
|
|||
@RequiresPermissions("tool:gen:remove")
|
||||
@Log(title = "代码生成", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{tableIds}")
|
||||
<<<<<<< HEAD
|
||||
public Result remove(@PathVariable("tableIds") Long[] tableIds)
|
||||
{
|
||||
=======
|
||||
public Result remove (@PathVariable("tableIds") Long[] tableIds) {
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableService.deleteGenTableByIds(tableIds);
|
||||
return success();
|
||||
}
|
||||
|
@ -142,8 +215,12 @@ public class GenController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:preview")
|
||||
@GetMapping("/preview/{tableId}")
|
||||
<<<<<<< HEAD
|
||||
public Result preview(@PathVariable("tableId") Long tableId) throws IOException
|
||||
{
|
||||
=======
|
||||
public Result preview (@PathVariable("tableId") Long tableId) throws IOException {
|
||||
>>>>>>> 813460c (1..)
|
||||
Map<String, String> dataMap = genTableService.previewCode(tableId);
|
||||
return success(dataMap);
|
||||
}
|
||||
|
@ -154,8 +231,12 @@ public class GenController extends BaseController
|
|||
@RequiresPermissions("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/download/{tableName}")
|
||||
<<<<<<< HEAD
|
||||
public void download(@PathVariable("tableName") String tableName) throws IOException
|
||||
{
|
||||
=======
|
||||
public void download (HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
||||
>>>>>>> 813460c (1..)
|
||||
byte[] data = genTableService.downloadCode(tableName);
|
||||
genCode(response, data);
|
||||
}
|
||||
|
@ -166,8 +247,12 @@ public class GenController extends BaseController
|
|||
@RequiresPermissions("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/genCode/{tableName}")
|
||||
<<<<<<< HEAD
|
||||
public Result genCode(@PathVariable("tableName") String tableName)
|
||||
{
|
||||
=======
|
||||
public Result genCode (@PathVariable("tableName") String tableName) {
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableService.generatorCode(tableName);
|
||||
return success();
|
||||
}
|
||||
|
@ -177,10 +262,16 @@ public class GenController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:edit")
|
||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||
<<<<<<< HEAD
|
||||
@GetMapping("/synchDb/{tableName}/{dbName}")
|
||||
public Result synchDb(@PathVariable("tableName") String tableName,@PathVariable("dbName") String dbName)
|
||||
{
|
||||
genTableService.synchDb(tableName,dbName);
|
||||
=======
|
||||
@GetMapping("/synchDb/{tableName}")
|
||||
public Result synchDb (@PathVariable("tableName") String tableName) {
|
||||
genTableService.synchDb(tableName);
|
||||
>>>>>>> 813460c (1..)
|
||||
return success();
|
||||
}
|
||||
|
||||
|
@ -190,8 +281,12 @@ public class GenController extends BaseController
|
|||
@RequiresPermissions("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/batchGenCode")
|
||||
<<<<<<< HEAD
|
||||
public void batchGenCode(@RequestParam("tables") String tables) throws IOException
|
||||
{
|
||||
=======
|
||||
public void batchGenCode (HttpServletResponse response, String tables) throws IOException {
|
||||
>>>>>>> 813460c (1..)
|
||||
String[] tableNames = Convert.toStrArray(tables);
|
||||
byte[] data = genTableService.downloadCode(tableNames);
|
||||
genCode(response, data);
|
||||
|
@ -200,6 +295,7 @@ public class GenController extends BaseController
|
|||
/**
|
||||
* 生成zip文件
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
private void genCode(HttpServletResponse response, byte[] data) throws IOException
|
||||
{
|
||||
response.reset();
|
||||
|
@ -233,4 +329,13 @@ public class GenController extends BaseController
|
|||
List<GenTableColumn> genTableColumns = genTableColumnService.selectDbTableColumnsByName(table, dbName);
|
||||
return Result.success(genTableColumns);
|
||||
}
|
||||
=======
|
||||
private void genCode (HttpServletResponse response, byte[] data) throws IOException {
|
||||
response.reset();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"muyu.zip\"");
|
||||
response.addHeader("Content-Length", String.valueOf(data.length));
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IOUtils.write(data, response.getOutputStream());
|
||||
}
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -35,8 +35,11 @@ public class GenTable extends BaseEntity {
|
|||
*/
|
||||
private Long tableId;
|
||||
|
||||
<<<<<<< HEAD
|
||||
private String dbName;
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 表名称
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.gen.mapper;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.gen.domain.GenTableColumn;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -13,52 +14,107 @@ import java.util.List;
|
|||
*/
|
||||
public interface GenTableColumnMapper
|
||||
{
|
||||
=======
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.gen.domain.GenTableColumn;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务字段 数据层
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
public interface GenTableColumnMapper extends BaseMapper<GenTableColumn> {
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 根据表名称查询列信息
|
||||
*
|
||||
* @param tableName 表名称
|
||||
<<<<<<< HEAD
|
||||
* @param dbName
|
||||
* @return 列信息
|
||||
*/
|
||||
public List<GenTableColumn> selectDbTableColumnsByName(@Param("tableName") String tableName, @Param("dbName") String dbName);
|
||||
=======
|
||||
*
|
||||
* @return 列信息
|
||||
*/
|
||||
List<GenTableColumn> selectDbTableColumnsByName (String tableName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询业务字段列表
|
||||
*
|
||||
* @param tableId 业务字段编号
|
||||
<<<<<<< HEAD
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
public List<GenTableColumn> selectGenTableColumnListByTableId(@Param("tableId") Long tableId);
|
||||
=======
|
||||
*
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
List<GenTableColumn> selectGenTableColumnListByTableId (Long tableId);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 新增业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGenTableColumn(GenTableColumn genTableColumn);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int insertGenTableColumn (GenTableColumn genTableColumn);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 修改业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGenTableColumn(GenTableColumn genTableColumn);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int updateGenTableColumn (GenTableColumn genTableColumn);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 删除业务字段
|
||||
*
|
||||
* @param genTableColumns 列数据
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGenTableColumns(@Param("genTableColumns") List<GenTableColumn> genTableColumns);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableColumns (List<GenTableColumn> genTableColumns);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 批量删除业务字段
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGenTableColumnByIds(@Param("ids") Long[] ids);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableColumnByIds (Long[] ids);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -1,86 +1,151 @@
|
|||
package com.muyu.gen.mapper;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
=======
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务 数据层
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface GenTableMapper
|
||||
{
|
||||
=======
|
||||
* @author muyu
|
||||
*/
|
||||
public interface GenTableMapper extends BaseMapper<GenTable> {
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 查询业务列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 业务集合
|
||||
*/
|
||||
public List<GenTable> selectGenTableList(GenTable genTable);
|
||||
=======
|
||||
*
|
||||
* @return 业务集合
|
||||
*/
|
||||
List<GenTable> selectGenTableList (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
public List<GenTable> selectDbTableList(GenTable genTable);
|
||||
=======
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableList (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param tableNames 表名称组
|
||||
<<<<<<< HEAD
|
||||
* @param dbName
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
public List<GenTable> selectDbTableListByNames(@Param("tableNames") String[] tableNames, @Param("dbName") String dbName);
|
||||
=======
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableListByNames (String[] tableNames);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询所有表信息
|
||||
*
|
||||
* @return 表信息集合
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public List<GenTable> selectGenTableAll();
|
||||
=======
|
||||
List<GenTable> selectGenTableAll ();
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询表ID业务信息
|
||||
*
|
||||
* @param id 业务ID
|
||||
<<<<<<< HEAD
|
||||
* @return 业务信息
|
||||
*/
|
||||
public GenTable selectGenTableById(@Param("id") Long id);
|
||||
=======
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
GenTable selectGenTableById (Long id);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询表名称业务信息
|
||||
*
|
||||
* @param tableName 表名称
|
||||
<<<<<<< HEAD
|
||||
* @return 业务信息
|
||||
*/
|
||||
public GenTable selectGenTableByName(@Param("tableName") String tableName);
|
||||
=======
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
GenTable selectGenTableByName (String tableName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 新增业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGenTable(GenTable genTable);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int insertGenTable (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 修改业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGenTable(GenTable genTable);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int updateGenTable (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 批量删除业务
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGenTableByIds(@Param("ids") Long[] ids);
|
||||
|
@ -88,4 +153,10 @@ public interface GenTableMapper
|
|||
List<String> selDbNameAll();
|
||||
|
||||
List<GenTableResp> selectDbTableListAll();
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableByIds (Long[] ids);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,11 @@ package com.muyu.gen.service;
|
|||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.gen.domain.GenTableColumn;
|
||||
import com.muyu.gen.mapper.GenTableColumnMapper;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -11,6 +15,7 @@ import java.util.List;
|
|||
/**
|
||||
* 业务字段 服务层实现
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
|
@ -30,11 +35,32 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
|||
{
|
||||
return genTableColumnMapper.selectGenTableColumnListByTableId(tableId);
|
||||
}
|
||||
=======
|
||||
* @author muyu
|
||||
*/
|
||||
@Service
|
||||
public class GenTableColumnServiceImpl implements IGenTableColumnService {
|
||||
@Autowired
|
||||
private GenTableColumnMapper genTableColumnMapper;
|
||||
|
||||
/**
|
||||
* 查询业务字段列表
|
||||
*
|
||||
* @param tableId 业务字段编号
|
||||
*
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTableColumn> selectGenTableColumnListByTableId (Long tableId) {
|
||||
return genTableColumnMapper.selectGenTableColumnListByTableId(tableId);
|
||||
}
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 新增业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
@ -70,5 +96,37 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
|||
@Override
|
||||
public List<GenTableColumn> selectDbTableColumnsByName(String table, String dbName) {
|
||||
return genTableColumnMapper.selectDbTableColumnsByName(table,dbName);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertGenTableColumn (GenTableColumn genTableColumn) {
|
||||
return genTableColumnMapper.insertGenTableColumn(genTableColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateGenTableColumn (GenTableColumn genTableColumn) {
|
||||
return genTableColumnMapper.updateGenTableColumn(genTableColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务字段对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGenTableColumnByIds (String ids) {
|
||||
return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,10 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
import com.muyu.gen.domain.GenTableColumn;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.gen.mapper.GenTableColumnMapper;
|
||||
import com.muyu.gen.mapper.GenTableMapper;
|
||||
import com.muyu.gen.util.GenUtils;
|
||||
|
@ -23,7 +26,11 @@ import org.apache.velocity.VelocityContext;
|
|||
import org.apache.velocity.app.Velocity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -42,6 +49,7 @@ import java.util.zip.ZipOutputStream;
|
|||
/**
|
||||
* 业务 服务层实现
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
|
@ -64,6 +72,45 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
@Override
|
||||
public GenTable selectGenTableById(Long id)
|
||||
{
|
||||
=======
|
||||
* @author muyu
|
||||
*/
|
||||
@Service
|
||||
public class GenTableServiceImpl implements IGenTableService {
|
||||
private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private GenTableMapper genTableMapper;
|
||||
|
||||
@Autowired
|
||||
private GenTableColumnMapper genTableColumnMapper;
|
||||
|
||||
/**
|
||||
* 获取代码生成地址
|
||||
*
|
||||
* @param table 业务表信息
|
||||
* @param template 模板文件路径
|
||||
*
|
||||
* @return 生成地址
|
||||
*/
|
||||
public static String getGenPath (GenTable table, String template) {
|
||||
String genPath = table.getGenPath();
|
||||
if (StringUtils.equals(genPath, "/")) {
|
||||
return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
|
||||
}
|
||||
return genPath + File.separator + VelocityUtils.getFileName(template, table);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询业务信息
|
||||
*
|
||||
* @param id 业务ID
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
@Override
|
||||
public GenTable selectGenTableById (Long id) {
|
||||
>>>>>>> 813460c (1..)
|
||||
GenTable genTable = genTableMapper.selectGenTableById(id);
|
||||
setTableFromOptions(genTable);
|
||||
return genTable;
|
||||
|
@ -73,11 +120,19 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 查询业务列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 业务集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectGenTableList(GenTable genTable)
|
||||
{
|
||||
=======
|
||||
*
|
||||
* @return 业务集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectGenTableList (GenTable genTable) {
|
||||
>>>>>>> 813460c (1..)
|
||||
return genTableMapper.selectGenTableList(genTable);
|
||||
}
|
||||
|
||||
|
@ -85,11 +140,19 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 查询据库列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectDbTableList(GenTable genTable)
|
||||
{
|
||||
=======
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectDbTableList (GenTable genTable) {
|
||||
>>>>>>> 813460c (1..)
|
||||
return genTableMapper.selectDbTableList(genTable);
|
||||
}
|
||||
|
||||
|
@ -97,6 +160,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 查询据库列表
|
||||
*
|
||||
* @param tableNames 表名称组
|
||||
<<<<<<< HEAD
|
||||
* @param dbName
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
|
@ -104,6 +168,14 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
public List<GenTable> selectDbTableListByNames(String[] tableNames, String dbName)
|
||||
{
|
||||
return genTableMapper.selectDbTableListByNames(tableNames,dbName);
|
||||
=======
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectDbTableListByNames (String[] tableNames) {
|
||||
return genTableMapper.selectDbTableListByNames(tableNames);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,8 +184,12 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* @return 表信息集合
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public List<GenTable> selectGenTableAll()
|
||||
{
|
||||
=======
|
||||
public List<GenTable> selectGenTableAll () {
|
||||
>>>>>>> 813460c (1..)
|
||||
return genTableMapper.selectGenTableAll();
|
||||
}
|
||||
|
||||
|
@ -121,10 +197,15 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 修改业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
*
|
||||
>>>>>>> 813460c (1..)
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
<<<<<<< HEAD
|
||||
public void updateGenTable(GenTable genTable)
|
||||
{
|
||||
String options = JSON.toJSONString(genTable.getParams());
|
||||
|
@ -134,6 +215,14 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
{
|
||||
for (GenTableColumn cenTableColumn : genTable.getColumns())
|
||||
{
|
||||
=======
|
||||
public void updateGenTable (GenTable genTable) {
|
||||
String options = JSON.toJSONString(genTable.getParams());
|
||||
genTable.setOptions(options);
|
||||
int row = genTableMapper.updateGenTable(genTable);
|
||||
if (row > 0) {
|
||||
for (GenTableColumn cenTableColumn : genTable.getColumns()) {
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableColumnMapper.updateGenTableColumn(cenTableColumn);
|
||||
}
|
||||
}
|
||||
|
@ -143,12 +232,20 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 删除业务对象
|
||||
*
|
||||
* @param tableIds 需要删除的数据ID
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
*
|
||||
>>>>>>> 813460c (1..)
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
<<<<<<< HEAD
|
||||
public void deleteGenTableByIds(Long[] tableIds)
|
||||
{
|
||||
=======
|
||||
public void deleteGenTableByIds (Long[] tableIds) {
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableMapper.deleteGenTableByIds(tableIds);
|
||||
genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
|
||||
}
|
||||
|
@ -160,6 +257,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
<<<<<<< HEAD
|
||||
public void importGenTable(List<GenTable> tableList)
|
||||
{
|
||||
String operName = SecurityUtils.getUsername();
|
||||
|
@ -177,14 +275,31 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName, dbName);
|
||||
for (GenTableColumn column : genTableColumns)
|
||||
{
|
||||
=======
|
||||
public void importGenTable (List<GenTable> tableList) {
|
||||
String operName = SecurityUtils.getUsername();
|
||||
try {
|
||||
for (GenTable table : tableList) {
|
||||
String tableName = table.getTableName();
|
||||
GenUtils.initTable(table, operName);
|
||||
int row = genTableMapper.insertGenTable(table);
|
||||
if (row > 0) {
|
||||
// 保存列信息
|
||||
List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
||||
for (GenTableColumn column : genTableColumns) {
|
||||
>>>>>>> 813460c (1..)
|
||||
GenUtils.initColumnField(column, table);
|
||||
genTableColumnMapper.insertGenTableColumn(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
=======
|
||||
} catch (Exception e) {
|
||||
>>>>>>> 813460c (1..)
|
||||
throw new ServiceException("导入失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -193,11 +308,19 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 预览代码
|
||||
*
|
||||
* @param tableId 表编号
|
||||
<<<<<<< HEAD
|
||||
* @return 预览数据列表
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> previewCode(Long tableId)
|
||||
{
|
||||
=======
|
||||
*
|
||||
* @return 预览数据列表
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> previewCode (Long tableId) {
|
||||
>>>>>>> 813460c (1..)
|
||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||
// 查询表信息
|
||||
GenTable table = genTableMapper.selectGenTableById(tableId);
|
||||
|
@ -211,8 +334,12 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
<<<<<<< HEAD
|
||||
for (String template : templates)
|
||||
{
|
||||
=======
|
||||
for (String template : templates) {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 渲染模板
|
||||
StringWriter sw = new StringWriter();
|
||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||
|
@ -226,11 +353,19 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 生成代码(下载方式)
|
||||
*
|
||||
* @param tableName 表名称
|
||||
<<<<<<< HEAD
|
||||
* @return 数据
|
||||
*/
|
||||
@Override
|
||||
public byte[] downloadCode(String tableName)
|
||||
{
|
||||
=======
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
@Override
|
||||
public byte[] downloadCode (String tableName) {
|
||||
>>>>>>> 813460c (1..)
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
generatorCode(tableName, zip);
|
||||
|
@ -244,8 +379,12 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* @param tableName 表名称
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public void generatorCode(String tableName)
|
||||
{
|
||||
=======
|
||||
public void generatorCode (String tableName) {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 查询表信息
|
||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||
// 设置主子表信息
|
||||
|
@ -259,14 +398,20 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
<<<<<<< HEAD
|
||||
for (String template : templates)
|
||||
{
|
||||
if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm"))
|
||||
{
|
||||
=======
|
||||
for (String template : templates) {
|
||||
if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 渲染模板
|
||||
StringWriter sw = new StringWriter();
|
||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||
tpl.merge(context, sw);
|
||||
<<<<<<< HEAD
|
||||
try
|
||||
{
|
||||
String path = getGenPath(table, template);
|
||||
|
@ -274,6 +419,12 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
=======
|
||||
try {
|
||||
String path = getGenPath(table, template);
|
||||
FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
|
||||
} catch (IOException e) {
|
||||
>>>>>>> 813460c (1..)
|
||||
throw new ServiceException("渲染模板失败,表名:" + table.getTableName());
|
||||
}
|
||||
}
|
||||
|
@ -284,54 +435,85 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 同步数据库
|
||||
*
|
||||
* @param tableName 表名称
|
||||
<<<<<<< HEAD
|
||||
* @param dbName
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void synchDb(String tableName, String dbName)
|
||||
{
|
||||
=======
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void synchDb (String tableName) {
|
||||
>>>>>>> 813460c (1..)
|
||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||
List<GenTableColumn> tableColumns = table.getColumns();
|
||||
Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity()));
|
||||
|
||||
<<<<<<< HEAD
|
||||
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName, dbName);
|
||||
if (StringUtils.isEmpty(dbTableColumns))
|
||||
{
|
||||
=======
|
||||
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
||||
if (StringUtils.isEmpty(dbTableColumns)) {
|
||||
>>>>>>> 813460c (1..)
|
||||
throw new ServiceException("同步数据失败,原表结构不存在");
|
||||
}
|
||||
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
||||
|
||||
dbTableColumns.forEach(column -> {
|
||||
GenUtils.initColumnField(column, table);
|
||||
<<<<<<< HEAD
|
||||
if (tableColumnMap.containsKey(column.getColumnName()))
|
||||
{
|
||||
GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName());
|
||||
column.setColumnId(prevColumn.getColumnId());
|
||||
if (column.isList())
|
||||
{
|
||||
=======
|
||||
if (tableColumnMap.containsKey(column.getColumnName())) {
|
||||
GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName());
|
||||
column.setColumnId(prevColumn.getColumnId());
|
||||
if (column.isList()) {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 如果是列表,继续保留查询方式/字典类型选项
|
||||
column.setDictType(prevColumn.getDictType());
|
||||
column.setQueryType(prevColumn.getQueryType());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk()
|
||||
&& (column.isInsert() || column.isEdit())
|
||||
<<<<<<< HEAD
|
||||
&& ((column.isUsableColumn()) || (!column.isSuperColumn())))
|
||||
{
|
||||
=======
|
||||
&& ((column.isUsableColumn()) || (!column.isSuperColumn()))) {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 如果是(新增/修改&非主键/非忽略及父属性),继续保留必填/显示类型选项
|
||||
column.setIsRequired(prevColumn.getIsRequired());
|
||||
column.setHtmlType(prevColumn.getHtmlType());
|
||||
}
|
||||
genTableColumnMapper.updateGenTableColumn(column);
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
else
|
||||
{
|
||||
=======
|
||||
} else {
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableColumnMapper.insertGenTableColumn(column);
|
||||
}
|
||||
});
|
||||
|
||||
List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
|
||||
<<<<<<< HEAD
|
||||
if (StringUtils.isNotEmpty(delColumns))
|
||||
{
|
||||
=======
|
||||
if (StringUtils.isNotEmpty(delColumns)) {
|
||||
>>>>>>> 813460c (1..)
|
||||
genTableColumnMapper.deleteGenTableColumns(delColumns);
|
||||
}
|
||||
}
|
||||
|
@ -340,6 +522,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* 批量生成代码(下载方式)
|
||||
*
|
||||
* @param tableNames 表数组
|
||||
<<<<<<< HEAD
|
||||
* @return 数据
|
||||
*/
|
||||
@Override
|
||||
|
@ -349,6 +532,16 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
for (String tableName : tableNames)
|
||||
{
|
||||
=======
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
@Override
|
||||
public byte[] downloadCode (String[] tableNames) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
for (String tableName : tableNames) {
|
||||
>>>>>>> 813460c (1..)
|
||||
generatorCode(tableName, zip);
|
||||
}
|
||||
IOUtils.closeQuietly(zip);
|
||||
|
@ -358,8 +551,12 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
/**
|
||||
* 查询表信息并生成代码
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
private void generatorCode(String tableName, ZipOutputStream zip)
|
||||
{
|
||||
=======
|
||||
private void generatorCode (String tableName, ZipOutputStream zip) {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 查询表信息
|
||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||
// 设置主子表信息
|
||||
|
@ -373,23 +570,35 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
<<<<<<< HEAD
|
||||
for (String template : templates)
|
||||
{
|
||||
=======
|
||||
for (String template : templates) {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 渲染模板
|
||||
StringWriter sw = new StringWriter();
|
||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||
tpl.merge(context, sw);
|
||||
<<<<<<< HEAD
|
||||
try
|
||||
{
|
||||
=======
|
||||
try {
|
||||
>>>>>>> 813460c (1..)
|
||||
// 添加到zip
|
||||
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
|
||||
IOUtils.write(sw.toString(), zip, Constants.UTF8);
|
||||
IOUtils.closeQuietly(sw);
|
||||
zip.flush();
|
||||
zip.closeEntry();
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
=======
|
||||
} catch (IOException e) {
|
||||
>>>>>>> 813460c (1..)
|
||||
log.error("渲染模板失败,表名:" + table.getTableName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -401,6 +610,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
* @param genTable 业务信息
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public void validateEdit(GenTable genTable)
|
||||
{
|
||||
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
|
||||
|
@ -427,12 +637,29 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
}
|
||||
else if (StringUtils.isEmpty(genTable.getSubTableFkName()))
|
||||
{
|
||||
=======
|
||||
public void validateEdit (GenTable genTable) {
|
||||
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
|
||||
String options = JSON.toJSONString(genTable.getParams());
|
||||
JSONObject paramsObj = JSON.parseObject(options);
|
||||
if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) {
|
||||
throw new ServiceException("树编码字段不能为空");
|
||||
} else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) {
|
||||
throw new ServiceException("树父编码字段不能为空");
|
||||
} else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) {
|
||||
throw new ServiceException("树名称字段不能为空");
|
||||
} else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) {
|
||||
if (StringUtils.isEmpty(genTable.getSubTableName())) {
|
||||
throw new ServiceException("关联子表的表名不能为空");
|
||||
} else if (StringUtils.isEmpty(genTable.getSubTableFkName())) {
|
||||
>>>>>>> 813460c (1..)
|
||||
throw new ServiceException("子表关联的外键名不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Override
|
||||
public List<String> selDbNameAll() {
|
||||
return genTableMapper.selDbNameAll();
|
||||
|
@ -444,21 +671,30 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
}
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 设置主键列信息
|
||||
*
|
||||
* @param table 业务表信息
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public void setPkColumn(GenTable table)
|
||||
{
|
||||
for (GenTableColumn column : table.getColumns())
|
||||
{
|
||||
if (column.isPk())
|
||||
{
|
||||
=======
|
||||
public void setPkColumn (GenTable table) {
|
||||
for (GenTableColumn column : table.getColumns()) {
|
||||
if (column.isPk()) {
|
||||
>>>>>>> 813460c (1..)
|
||||
table.setPkColumn(column);
|
||||
break;
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if (StringUtils.isNull(table.getPkColumn()))
|
||||
{
|
||||
table.setPkColumn(table.getColumns().get(0));
|
||||
|
@ -469,12 +705,24 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
{
|
||||
if (column.isPk())
|
||||
{
|
||||
=======
|
||||
if (StringUtils.isNull(table.getPkColumn())) {
|
||||
table.setPkColumn(table.getColumns().get(0));
|
||||
}
|
||||
if (GenConstants.TPL_SUB.equals(table.getTplCategory())) {
|
||||
for (GenTableColumn column : table.getSubTable().getColumns()) {
|
||||
if (column.isPk()) {
|
||||
>>>>>>> 813460c (1..)
|
||||
table.getSubTable().setPkColumn(column);
|
||||
break;
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if (StringUtils.isNull(table.getSubTable().getPkColumn()))
|
||||
{
|
||||
=======
|
||||
if (StringUtils.isNull(table.getSubTable().getPkColumn())) {
|
||||
>>>>>>> 813460c (1..)
|
||||
table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0));
|
||||
}
|
||||
}
|
||||
|
@ -485,11 +733,17 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
*
|
||||
* @param table 业务表信息
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public void setSubTable(GenTable table)
|
||||
{
|
||||
String subTableName = table.getSubTableName();
|
||||
if (StringUtils.isNotEmpty(subTableName))
|
||||
{
|
||||
=======
|
||||
public void setSubTable (GenTable table) {
|
||||
String subTableName = table.getSubTableName();
|
||||
if (StringUtils.isNotEmpty(subTableName)) {
|
||||
>>>>>>> 813460c (1..)
|
||||
table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
|
||||
}
|
||||
}
|
||||
|
@ -499,11 +753,17 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
*
|
||||
* @param genTable 设置后的生成对象
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public void setTableFromOptions(GenTable genTable)
|
||||
{
|
||||
JSONObject paramsObj = JSON.parseObject(genTable.getOptions());
|
||||
if (StringUtils.isNotNull(paramsObj))
|
||||
{
|
||||
=======
|
||||
public void setTableFromOptions (GenTable genTable) {
|
||||
JSONObject paramsObj = JSON.parseObject(genTable.getOptions());
|
||||
if (StringUtils.isNotNull(paramsObj)) {
|
||||
>>>>>>> 813460c (1..)
|
||||
String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
|
||||
String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
|
||||
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
||||
|
@ -517,6 +777,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
genTable.setParentMenuName(parentMenuName);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* 获取代码生成地址
|
||||
|
@ -534,4 +795,6 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
}
|
||||
return genPath + File.separator + VelocityUtils.getFileName(template, table);
|
||||
}
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -7,41 +7,75 @@ import java.util.List;
|
|||
/**
|
||||
* 业务字段 服务层
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IGenTableColumnService
|
||||
{
|
||||
=======
|
||||
* @author muyu
|
||||
*/
|
||||
public interface IGenTableColumnService {
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 查询业务字段列表
|
||||
*
|
||||
* @param tableId 业务字段编号
|
||||
<<<<<<< HEAD
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
|
||||
=======
|
||||
*
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
List<GenTableColumn> selectGenTableColumnListByTableId (Long tableId);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 新增业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGenTableColumn(GenTableColumn genTableColumn);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int insertGenTableColumn (GenTableColumn genTableColumn);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 修改业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGenTableColumn(GenTableColumn genTableColumn);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int updateGenTableColumn (GenTableColumn genTableColumn);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 删除业务字段信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGenTableColumnByIds(String ids);
|
||||
|
||||
List<GenTableColumn> selectDbTableColumnsByName(String table, String dbName);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableColumnByIds (String ids);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.muyu.gen.service;
|
||||
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -9,121 +12,214 @@ import java.util.Map;
|
|||
/**
|
||||
* 业务 服务层
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IGenTableService
|
||||
{
|
||||
=======
|
||||
* @author muyu
|
||||
*/
|
||||
public interface IGenTableService {
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 查询业务列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 业务集合
|
||||
*/
|
||||
public List<GenTable> selectGenTableList(GenTable genTable);
|
||||
=======
|
||||
*
|
||||
* @return 业务集合
|
||||
*/
|
||||
List<GenTable> selectGenTableList (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
public List<GenTable> selectDbTableList(GenTable genTable);
|
||||
=======
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableList (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param tableNames 表名称组
|
||||
<<<<<<< HEAD
|
||||
* @param dbName
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
public List<GenTable> selectDbTableListByNames(String[] tableNames, String dbName);
|
||||
=======
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableListByNames (String[] tableNames);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询所有表信息
|
||||
*
|
||||
* @return 表信息集合
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public List<GenTable> selectGenTableAll();
|
||||
=======
|
||||
List<GenTable> selectGenTableAll ();
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询业务信息
|
||||
*
|
||||
* @param id 业务ID
|
||||
<<<<<<< HEAD
|
||||
* @return 业务信息
|
||||
*/
|
||||
public GenTable selectGenTableById(Long id);
|
||||
=======
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
GenTable selectGenTableById (Long id);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 修改业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public void updateGenTable(GenTable genTable);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
void updateGenTable (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 删除业务信息
|
||||
*
|
||||
* @param tableIds 需要删除的表数据ID
|
||||
<<<<<<< HEAD
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteGenTableByIds(Long[] tableIds);
|
||||
=======
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
void deleteGenTableByIds (Long[] tableIds);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 导入表结构
|
||||
*
|
||||
* @param tableList 导入表列表
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public void importGenTable(List<GenTable> tableList);
|
||||
=======
|
||||
void importGenTable (List<GenTable> tableList);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 预览代码
|
||||
*
|
||||
* @param tableId 表编号
|
||||
<<<<<<< HEAD
|
||||
* @return 预览数据列表
|
||||
*/
|
||||
public Map<String, String> previewCode(Long tableId);
|
||||
=======
|
||||
*
|
||||
* @return 预览数据列表
|
||||
*/
|
||||
Map<String, String> previewCode (Long tableId);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 生成代码(下载方式)
|
||||
*
|
||||
* @param tableName 表名称
|
||||
<<<<<<< HEAD
|
||||
* @return 数据
|
||||
*/
|
||||
public byte[] downloadCode(String tableName);
|
||||
=======
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
byte[] downloadCode (String tableName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 生成代码(自定义路径)
|
||||
*
|
||||
* @param tableName 表名称
|
||||
<<<<<<< HEAD
|
||||
* @return 数据
|
||||
*/
|
||||
public void generatorCode(String tableName);
|
||||
=======
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
void generatorCode (String tableName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 同步数据库
|
||||
*
|
||||
* @param tableName 表名称
|
||||
<<<<<<< HEAD
|
||||
* @param dbName
|
||||
*/
|
||||
public void synchDb(String tableName, String dbName);
|
||||
=======
|
||||
*/
|
||||
void synchDb (String tableName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 批量生成代码(下载方式)
|
||||
*
|
||||
* @param tableNames 表数组
|
||||
<<<<<<< HEAD
|
||||
* @return 数据
|
||||
*/
|
||||
public byte[] downloadCode(String[] tableNames);
|
||||
=======
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
byte[] downloadCode (String[] tableNames);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 修改保存参数校验
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public void validateEdit(GenTable genTable);
|
||||
|
||||
List<String> selDbNameAll();
|
||||
|
||||
List<GenTableResp> selectDbTableListAll();
|
||||
=======
|
||||
void validateEdit (GenTable genTable);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
# Tomcat
|
||||
server:
|
||||
<<<<<<< HEAD
|
||||
port: 9709
|
||||
=======
|
||||
port: 9202
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
<<<<<<< HEAD
|
||||
namespace: one-saas
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
|
@ -15,6 +20,12 @@ spring:
|
|||
deserialization:
|
||||
trust:
|
||||
all: true
|
||||
=======
|
||||
namespace: one
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
>>>>>>> 813460c (1..)
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
|
@ -53,8 +64,11 @@ spring:
|
|||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# xxl-job 配置文件
|
||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
<<<<<<< HEAD
|
||||
# rabbit 配置文件
|
||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
<<<<<<< HEAD
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.gen.mapper.GenTableColumnMapper">
|
||||
|
@ -31,6 +32,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="selectGenTableColumnVo">
|
||||
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
|
||||
=======
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.gen.mapper.GenTableColumnMapper">
|
||||
|
||||
<resultMap type="com.muyu.gen.domain.GenTableColumn" id="GenTableColumnResult">
|
||||
<id property="columnId" column="column_id"/>
|
||||
<result property="tableId" column="table_id"/>
|
||||
<result property="columnName" column="column_name"/>
|
||||
<result property="columnComment" column="column_comment"/>
|
||||
<result property="columnType" column="column_type"/>
|
||||
<result property="javaType" column="java_type"/>
|
||||
<result property="javaField" column="java_field"/>
|
||||
<result property="isPk" column="is_pk"/>
|
||||
<result property="isIncrement" column="is_increment"/>
|
||||
<result property="isRequired" column="is_required"/>
|
||||
<result property="isInsert" column="is_insert"/>
|
||||
<result property="isEdit" column="is_edit"/>
|
||||
<result property="isList" column="is_list"/>
|
||||
<result property="isQuery" column="is_query"/>
|
||||
<result property="queryType" column="query_type"/>
|
||||
<result property="htmlType" column="html_type"/>
|
||||
<result property="dictType" column="dict_type"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGenTableColumnVo">
|
||||
select column_id,
|
||||
table_id,
|
||||
column_name,
|
||||
column_comment,
|
||||
column_type,
|
||||
java_type,
|
||||
java_field,
|
||||
is_pk,
|
||||
is_increment,
|
||||
is_required,
|
||||
is_insert,
|
||||
is_edit,
|
||||
is_list,
|
||||
is_query,
|
||||
query_type,
|
||||
html_type,
|
||||
dict_type,
|
||||
sort,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from gen_table_column
|
||||
>>>>>>> 813460c (1..)
|
||||
</sql>
|
||||
|
||||
<select id="selectGenTableColumnListByTableId" parameterType="com.muyu.gen.domain.GenTableColumn" resultMap="GenTableColumnResult">
|
||||
|
@ -40,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
|
||||
<<<<<<< HEAD
|
||||
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
|
||||
from information_schema.columns where
|
||||
<include refid="com.muyu.gen.mapper.GenTableMapper.select_dbName"/>
|
||||
|
@ -89,6 +146,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
=======
|
||||
select column_name,
|
||||
(case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required,
|
||||
(case when column_key = 'PRI' then '1' else '0' end) as is_pk,
|
||||
ordinal_position as sort,
|
||||
column_comment,
|
||||
(case when extra = 'auto_increment' then '1' else '0' end) as is_increment,
|
||||
column_type
|
||||
from information_schema.columns
|
||||
where table_schema = (select database())
|
||||
and table_name = (#{tableName})
|
||||
order by ordinal_position
|
||||
</select>
|
||||
|
||||
<insert id="insertGenTableColumn" parameterType="com.muyu.gen.domain.GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
|
||||
insert into gen_table_column (
|
||||
<if test="tableId != null and tableId != ''">table_id,</if>
|
||||
<if test="columnName != null and columnName != ''">column_name,</if>
|
||||
<if test="columnComment != null and columnComment != ''">column_comment,</if>
|
||||
<if test="columnType != null and columnType != ''">column_type,</if>
|
||||
<if test="javaType != null and javaType != ''">java_type,</if>
|
||||
<if test="javaField != null and javaField != ''">java_field,</if>
|
||||
<if test="isPk != null and isPk != ''">is_pk,</if>
|
||||
<if test="isIncrement != null and isIncrement != ''">is_increment,</if>
|
||||
<if test="isRequired != null and isRequired != ''">is_required,</if>
|
||||
<if test="isInsert != null and isInsert != ''">is_insert,</if>
|
||||
<if test="isEdit != null and isEdit != ''">is_edit,</if>
|
||||
<if test="isList != null and isList != ''">is_list,</if>
|
||||
<if test="isQuery != null and isQuery != ''">is_query,</if>
|
||||
<if test="queryType != null and queryType != ''">query_type,</if>
|
||||
<if test="htmlType != null and htmlType != ''">html_type,</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type,</if>
|
||||
<if test="sort != null">sort,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="tableId != null and tableId != ''">#{tableId},</if>
|
||||
<if test="columnName != null and columnName != ''">#{columnName},</if>
|
||||
<if test="columnComment != null and columnComment != ''">#{columnComment},</if>
|
||||
<if test="columnType != null and columnType != ''">#{columnType},</if>
|
||||
<if test="javaType != null and javaType != ''">#{javaType},</if>
|
||||
<if test="javaField != null and javaField != ''">#{javaField},</if>
|
||||
<if test="isPk != null and isPk != ''">#{isPk},</if>
|
||||
<if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
|
||||
<if test="isRequired != null and isRequired != ''">#{isRequired},</if>
|
||||
<if test="isInsert != null and isInsert != ''">#{isInsert},</if>
|
||||
<if test="isEdit != null and isEdit != ''">#{isEdit},</if>
|
||||
<if test="isList != null and isList != ''">#{isList},</if>
|
||||
<if test="isQuery != null and isQuery != ''">#{isQuery},</if>
|
||||
<if test="queryType != null and queryType != ''">#{queryType},</if>
|
||||
<if test="htmlType != null and htmlType != ''">#{htmlType},</if>
|
||||
<if test="dictType != null and dictType != ''">#{dictType},</if>
|
||||
<if test="sort != null">#{sort},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
>>>>>>> 813460c (1..)
|
||||
</insert>
|
||||
|
||||
<update id="updateGenTableColumn" parameterType="com.muyu.gen.domain.GenTableColumn">
|
||||
|
@ -113,6 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteGenTableColumnByIds" parameterType="Long">
|
||||
<<<<<<< HEAD
|
||||
delete from gen_table_column where table_id in (
|
||||
<foreach collection="ids" item="tableId" separator="," >
|
||||
#{tableId}
|
||||
|
@ -127,6 +242,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item.columnId}
|
||||
</foreach>
|
||||
)
|
||||
=======
|
||||
delete from gen_table_column where table_id in
|
||||
<foreach collection="array" item="tableId" open="(" separator="," close=")">
|
||||
#{tableId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteGenTableColumns">
|
||||
delete from gen_table_column where column_id in
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item.columnId}
|
||||
</foreach>
|
||||
>>>>>>> 813460c (1..)
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
<<<<<<< HEAD
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.gen.mapper.GenTableMapper">
|
||||
|
@ -197,12 +198,298 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
=======
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.gen.mapper.GenTableMapper">
|
||||
|
||||
<resultMap type="com.muyu.gen.domain.GenTable" id="GenTableResult">
|
||||
<id property="tableId" column="table_id"/>
|
||||
<result property="tableName" column="table_name"/>
|
||||
<result property="tableComment" column="table_comment"/>
|
||||
<result property="subTableName" column="sub_table_name"/>
|
||||
<result property="subTableFkName" column="sub_table_fk_name"/>
|
||||
<result property="className" column="class_name"/>
|
||||
<result property="tplCategory" column="tpl_category"/>
|
||||
<result property="packageName" column="package_name"/>
|
||||
<result property="moduleName" column="module_name"/>
|
||||
<result property="businessName" column="business_name"/>
|
||||
<result property="functionName" column="function_name"/>
|
||||
<result property="functionAuthor" column="function_author"/>
|
||||
<result property="genType" column="gen_type"/>
|
||||
<result property="genPath" column="gen_path"/>
|
||||
<result property="options" column="options"/>
|
||||
<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"/>
|
||||
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.muyu.gen.domain.GenTableColumn" id="GenTableColumnResult">
|
||||
<id property="columnId" column="column_id"/>
|
||||
<result property="tableId" column="table_id"/>
|
||||
<result property="columnName" column="column_name"/>
|
||||
<result property="columnComment" column="column_comment"/>
|
||||
<result property="columnType" column="column_type"/>
|
||||
<result property="javaType" column="java_type"/>
|
||||
<result property="javaField" column="java_field"/>
|
||||
<result property="isPk" column="is_pk"/>
|
||||
<result property="isIncrement" column="is_increment"/>
|
||||
<result property="isRequired" column="is_required"/>
|
||||
<result property="isInsert" column="is_insert"/>
|
||||
<result property="isEdit" column="is_edit"/>
|
||||
<result property="isList" column="is_list"/>
|
||||
<result property="isQuery" column="is_query"/>
|
||||
<result property="queryType" column="query_type"/>
|
||||
<result property="htmlType" column="html_type"/>
|
||||
<result property="dictType" column="dict_type"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGenTableVo">
|
||||
select table_id,
|
||||
table_name,
|
||||
table_comment,
|
||||
sub_table_name,
|
||||
sub_table_fk_name,
|
||||
class_name,
|
||||
tpl_category,
|
||||
package_name,
|
||||
module_name,
|
||||
business_name,
|
||||
function_name,
|
||||
function_author,
|
||||
gen_type,
|
||||
gen_path,
|
||||
options,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from gen_table
|
||||
</sql>
|
||||
|
||||
<select id="selectGenTableList" parameterType="com.muyu.gen.domain.GenTable" resultMap="GenTableResult">
|
||||
<include refid="selectGenTableVo"/>
|
||||
<where>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDbTableList" parameterType="com.muyu.gen.domain.GenTable" resultMap="GenTableResult">
|
||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
|
||||
AND table_name NOT IN (select table_name from gen_table)
|
||||
<if test="tableName != null and tableName != ''">
|
||||
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
||||
and table_name in
|
||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
||||
select table_name, table_comment, create_time, update_time
|
||||
from information_schema.tables
|
||||
where table_comment <![CDATA[ <> ]]> ''
|
||||
and table_schema = (select database())
|
||||
and table_name = #{tableName}
|
||||
</select>
|
||||
|
||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
||||
SELECT t.table_id,
|
||||
t.table_name,
|
||||
t.table_comment,
|
||||
t.sub_table_name,
|
||||
t.sub_table_fk_name,
|
||||
t.class_name,
|
||||
t.tpl_category,
|
||||
t.package_name,
|
||||
t.module_name,
|
||||
t.business_name,
|
||||
t.function_name,
|
||||
t.function_author,
|
||||
t.gen_type,
|
||||
t.gen_path,
|
||||
t.options,
|
||||
t.remark,
|
||||
c.column_id,
|
||||
c.column_name,
|
||||
c.column_comment,
|
||||
c.column_type,
|
||||
c.java_type,
|
||||
c.java_field,
|
||||
c.is_pk,
|
||||
c.is_increment,
|
||||
c.is_required,
|
||||
c.is_insert,
|
||||
c.is_edit,
|
||||
c.is_list,
|
||||
c.is_query,
|
||||
c.query_type,
|
||||
c.html_type,
|
||||
c.dict_type,
|
||||
c.sort
|
||||
FROM gen_table t
|
||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||
where t.table_id = #{tableId}
|
||||
order by c.sort
|
||||
</select>
|
||||
|
||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
||||
SELECT t.table_id,
|
||||
t.table_name,
|
||||
t.table_comment,
|
||||
t.sub_table_name,
|
||||
t.sub_table_fk_name,
|
||||
t.class_name,
|
||||
t.tpl_category,
|
||||
t.package_name,
|
||||
t.module_name,
|
||||
t.business_name,
|
||||
t.function_name,
|
||||
t.function_author,
|
||||
t.gen_type,
|
||||
t.gen_path,
|
||||
t.options,
|
||||
t.remark,
|
||||
c.column_id,
|
||||
c.column_name,
|
||||
c.column_comment,
|
||||
c.column_type,
|
||||
c.java_type,
|
||||
c.java_field,
|
||||
c.is_pk,
|
||||
c.is_increment,
|
||||
c.is_required,
|
||||
c.is_insert,
|
||||
c.is_edit,
|
||||
c.is_list,
|
||||
c.is_query,
|
||||
c.query_type,
|
||||
c.html_type,
|
||||
c.dict_type,
|
||||
c.sort
|
||||
FROM gen_table t
|
||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||
where t.table_name = #{tableName}
|
||||
order by c.sort
|
||||
</select>
|
||||
|
||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
||||
SELECT t.table_id,
|
||||
t.table_name,
|
||||
t.table_comment,
|
||||
t.sub_table_name,
|
||||
t.sub_table_fk_name,
|
||||
t.class_name,
|
||||
t.tpl_category,
|
||||
t.package_name,
|
||||
t.module_name,
|
||||
t.business_name,
|
||||
t.function_name,
|
||||
t.function_author,
|
||||
t.options,
|
||||
t.remark,
|
||||
c.column_id,
|
||||
c.column_name,
|
||||
c.column_comment,
|
||||
c.column_type,
|
||||
c.java_type,
|
||||
c.java_field,
|
||||
c.is_pk,
|
||||
c.is_increment,
|
||||
c.is_required,
|
||||
c.is_insert,
|
||||
c.is_edit,
|
||||
c.is_list,
|
||||
c.is_query,
|
||||
c.query_type,
|
||||
c.html_type,
|
||||
c.dict_type,
|
||||
c.sort
|
||||
FROM gen_table t
|
||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||
order by c.sort
|
||||
</select>
|
||||
|
||||
<insert id="insertGenTable" parameterType="com.muyu.gen.domain.GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||
insert into gen_table (
|
||||
<if test="tableName != null">table_name,</if>
|
||||
<if test="tableComment != null and tableComment != ''">table_comment,</if>
|
||||
<if test="className != null and className != ''">class_name,</if>
|
||||
<if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
|
||||
<if test="packageName != null and packageName != ''">package_name,</if>
|
||||
<if test="moduleName != null and moduleName != ''">module_name,</if>
|
||||
<if test="businessName != null and businessName != ''">business_name,</if>
|
||||
<if test="functionName != null and functionName != ''">function_name,</if>
|
||||
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
|
||||
<if test="genType != null and genType != ''">gen_type,</if>
|
||||
<if test="genPath != null and genPath != ''">gen_path,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="tableName != null">#{tableName},</if>
|
||||
<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
|
||||
<if test="className != null and className != ''">#{className},</if>
|
||||
<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
|
||||
<if test="packageName != null and packageName != ''">#{packageName},</if>
|
||||
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
|
||||
<if test="businessName != null and businessName != ''">#{businessName},</if>
|
||||
<if test="functionName != null and functionName != ''">#{functionName},</if>
|
||||
<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
|
||||
<if test="genType != null and genType != ''">#{genType},</if>
|
||||
<if test="genPath != null and genPath != ''">#{genPath},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
>>>>>>> 813460c (1..)
|
||||
</insert>
|
||||
|
||||
<update id="updateGenTable" parameterType="com.muyu.gen.domain.GenTable">
|
||||
update gen_table
|
||||
<set>
|
||||
<<<<<<< HEAD
|
||||
<if test="dbName != null">db_name = #{dbName},</if>
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
<if test="tableName != null">table_name = #{tableName},</if>
|
||||
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
|
||||
<if test="subTableName != null">sub_table_name = #{subTableName},</if>
|
||||
|
@ -211,7 +498,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
|
||||
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
|
||||
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
|
||||
<<<<<<< HEAD
|
||||
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if> <if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
|
||||
=======
|
||||
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
|
||||
<if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
|
||||
>>>>>>> 813460c (1..)
|
||||
<if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
|
||||
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
|
||||
<if test="functionName != null and functionName != ''">function_name = #{functionName},</if>
|
||||
|
@ -224,11 +516,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteGenTableByIds" parameterType="Long">
|
||||
<<<<<<< HEAD
|
||||
delete from gen_table where table_id in (
|
||||
<foreach collection="ids" item="tableId" separator="," >
|
||||
#{tableId}
|
||||
</foreach>
|
||||
)
|
||||
=======
|
||||
delete from gen_table where table_id in
|
||||
<foreach collection="array" item="tableId" open="(" separator="," close=")">
|
||||
#{tableId}
|
||||
</foreach>
|
||||
>>>>>>> 813460c (1..)
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
package ${packageName}.controller;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
|
@ -12,14 +19,22 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
#if($table.crud || $table.sub)
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
#elseif($table.tree)
|
||||
|
@ -35,7 +50,11 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
@RequestMapping("/${businessName}")
|
||||
public class ${ClassName}Controller extends BaseController
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private I${ClassName}Service ${className}Service;
|
||||
|
||||
/**
|
||||
|
@ -44,14 +63,22 @@ public class ${ClassName}Controller extends BaseController
|
|||
@RequiresPermissions("${permissionPrefix}:list")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
<<<<<<< HEAD
|
||||
public Result<TableDataInfo<${ClassName}>> list(${ClassName} ${className})
|
||||
=======
|
||||
public Result<TableDataInfo> list(${ClassName} ${className})
|
||||
>>>>>>> 813460c (1..)
|
||||
{
|
||||
startPage();
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
return getDataTable(list);
|
||||
}
|
||||
#elseif($table.tree)
|
||||
<<<<<<< HEAD
|
||||
public Result<${ClassName}> list(${ClassName} ${className})
|
||||
=======
|
||||
public Result list(${ClassName} ${className})
|
||||
>>>>>>> 813460c (1..)
|
||||
{
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
return success(list);
|
||||
|
@ -62,6 +89,10 @@ public class ${ClassName}Controller extends BaseController
|
|||
* 导出${functionName}列表
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:export")
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
>>>>>>> 813460c (1..)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ${ClassName} ${className})
|
||||
{
|
||||
|
@ -75,7 +106,11 @@ public class ${ClassName}Controller extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:query")
|
||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||
<<<<<<< HEAD
|
||||
public Result<List<${ClassName}>> getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
||||
=======
|
||||
public Result getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
||||
>>>>>>> 813460c (1..)
|
||||
{
|
||||
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
|
||||
}
|
||||
|
@ -84,6 +119,7 @@ public class ${ClassName}Controller extends BaseController
|
|||
* 新增${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:add")
|
||||
<<<<<<< HEAD
|
||||
@PostMapping
|
||||
public Result<Integer> add(
|
||||
@Validated @RequestBody ${ClassName} ${className})
|
||||
|
@ -93,12 +129,20 @@ public class ${ClassName}Controller extends BaseController
|
|||
}
|
||||
${className}.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(${className}Service.save(${className}));
|
||||
=======
|
||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody ${ClassName} ${className})
|
||||
{
|
||||
return toAjax(${className}Service.insert${ClassName}(${className}));
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:edit")
|
||||
<<<<<<< HEAD
|
||||
@PutMapping
|
||||
public Result<Integer> edit(
|
||||
@Validated @RequestBody ${ClassName} ${className})
|
||||
|
@ -108,16 +152,31 @@ public class ${ClassName}Controller extends BaseController
|
|||
}
|
||||
${className}.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(${className}Service.updateById(${className}));
|
||||
=======
|
||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody ${ClassName} ${className})
|
||||
{
|
||||
return toAjax(${className}Service.update${ClassName}(${className}));
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:remove")
|
||||
<<<<<<< HEAD
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
public Result<Integer> remove(@PathVariable("${pkColumn.javaField}s") ${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
{
|
||||
${className}Service.removeBatchByIds(Arrays.asList(${pkColumn.javaField}s));
|
||||
return success();
|
||||
=======
|
||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
public Result remove(@PathVariable("${pkColumn.javaField}s") ${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
{
|
||||
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
|||
#elseif($table.tree)
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
#end
|
||||
<<<<<<< HEAD
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
@ -16,6 +17,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* ${functionName}对象 ${tableName}
|
||||
|
@ -23,12 +26,16 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
#if($table.crud || $table.sub)
|
||||
#set($Entity="BaseEntity")
|
||||
#elseif($table.tree)
|
||||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
<<<<<<< HEAD
|
||||
@Data
|
||||
@Setter
|
||||
@Getter
|
||||
|
@ -37,6 +44,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
@AllArgsConstructor
|
||||
@TableName("${tableName}")
|
||||
public class ${ClassName} extends ${Entity}{
|
||||
=======
|
||||
public class ${ClassName} extends ${Entity}
|
||||
{
|
||||
>>>>>>> 813460c (1..)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
|
@ -58,19 +69,46 @@ public class ${ClassName} extends ${Entity}{
|
|||
@Excel(name = "${comment}")
|
||||
#end
|
||||
#end
|
||||
<<<<<<< HEAD
|
||||
#if($column.javaField == $pkColumn.javaField)
|
||||
@TableId( type = IdType.AUTO)
|
||||
#end
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
#end
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
#if($table.sub)
|
||||
/** $table.subTable.functionName信息 */
|
||||
private List<${subClassName}> ${subclassName}List;
|
||||
|
||||
#end
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
#foreach ($column in $columns)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||
#set($AttrName=$column.javaField)
|
||||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
public void set${AttrName}($column.javaType $column.javaField)
|
||||
{
|
||||
this.$column.javaField = $column.javaField;
|
||||
}
|
||||
|
||||
public $column.javaType get${AttrName}()
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
#end
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
#if($table.sub)
|
||||
public List<${subClassName}> get${subClassName}List()
|
||||
|
|
|
@ -5,6 +5,7 @@ import ${packageName}.domain.${ClassName};
|
|||
#if($table.sub)
|
||||
import ${packageName}.domain.${subClassName};
|
||||
#end
|
||||
<<<<<<< HEAD
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
@ -17,4 +18,89 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}>{
|
||||
|
||||
=======
|
||||
|
||||
/**
|
||||
* ${functionName}Mapper接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface ${ClassName}Mapper
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int update${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 删除${functionName}
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
#if($table.sub)
|
||||
|
||||
/**
|
||||
* 批量删除${subTable.functionName}
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
|
||||
/**
|
||||
* 批量新增${subTable.functionName}
|
||||
*
|
||||
* @param ${subclassName}List ${subTable.functionName}列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
||||
|
||||
|
||||
/**
|
||||
* 通过${functionName}主键删除${subTable.functionName}信息
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
#end
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ${packageName}.service;
|
|||
|
||||
import java.util.List;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
<<<<<<< HEAD
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +15,20 @@ public interface I${ClassName}Service extends IService<${ClassName}> {
|
|||
/**
|
||||
* 精确查询${functionName}
|
||||
*
|
||||
=======
|
||||
|
||||
/**
|
||||
* ${functionName}Service接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface I${ClassName}Service
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
*
|
||||
>>>>>>> 813460c (1..)
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
|
@ -21,17 +36,54 @@ public interface I${ClassName}Service extends IService<${ClassName}> {
|
|||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
<<<<<<< HEAD
|
||||
*
|
||||
=======
|
||||
*
|
||||
>>>>>>> 813460c (1..)
|
||||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* 判断 ${functionName} id是否唯一
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean checkIdUnique(${ClassName} ${className});
|
||||
|
||||
=======
|
||||
* 新增${functionName}
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int update${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
|
||||
/**
|
||||
* 删除${functionName}信息
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@ import com.muyu.common.core.utils.DateUtils;
|
|||
#break
|
||||
#end
|
||||
#end
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
#if($table.sub)
|
||||
import java.util.ArrayList;
|
||||
|
@ -17,10 +21,13 @@ import ${packageName}.domain.${subClassName};
|
|||
import ${packageName}.mapper.${ClassName}Mapper;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
<<<<<<< HEAD
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.util.Assert;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* ${functionName}Service业务层处理
|
||||
|
@ -29,12 +36,22 @@ import org.springframework.util.Assert;
|
|||
* @date ${datetime}
|
||||
*/
|
||||
@Service
|
||||
<<<<<<< HEAD
|
||||
public class ${ClassName}ServiceImpl
|
||||
extends ServiceImpl<${ClassName}Mapper, ${ClassName}>
|
||||
implements I${ClassName}Service {
|
||||
|
||||
/**
|
||||
* 精确查询${functionName}
|
||||
=======
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
{
|
||||
@Autowired
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
|
||||
/**
|
||||
* 查询${functionName}
|
||||
>>>>>>> 813460c (1..)
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
|
@ -42,6 +59,7 @@ public class ${ClassName}ServiceImpl
|
|||
@Override
|
||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
LambdaQueryWrapper<${ClassName}> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(${pkColumn.javaField}, "${pkColumn.javaField}不可为空");
|
||||
queryWrapper.eq(${ClassName}::get${pkColumn.capJavaField}, ${pkColumn.javaField});
|
||||
|
@ -49,6 +67,11 @@ public class ${ClassName}ServiceImpl
|
|||
}
|
||||
|
||||
|
||||
=======
|
||||
return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
||||
}
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*
|
||||
|
@ -58,6 +81,7 @@ public class ${ClassName}ServiceImpl
|
|||
@Override
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
LambdaQueryWrapper<${ClassName}> queryWrapper = new LambdaQueryWrapper<>();
|
||||
#foreach($column in $columns)
|
||||
#set($queryType=$column.queryType)
|
||||
|
@ -112,4 +136,120 @@ public class ${ClassName}ServiceImpl
|
|||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
=======
|
||||
return ${className}Mapper.select${ClassName}List(${className});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
@Override
|
||||
public int insert${ClassName}(${ClassName} ${className})
|
||||
{
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField == 'createTime')
|
||||
${className}.setCreateTime(DateUtils.getNowDate());
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
int rows = ${className}Mapper.insert${ClassName}(${className});
|
||||
insert${subClassName}(${className});
|
||||
return rows;
|
||||
#else
|
||||
return ${className}Mapper.insert${ClassName}(${className});
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
@Override
|
||||
public int update${ClassName}(${ClassName} ${className})
|
||||
{
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField == 'updateTime')
|
||||
${className}.setUpdateTime(DateUtils.getNowDate());
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
|
||||
insert${subClassName}(${className});
|
||||
#end
|
||||
return ${className}Mapper.update${ClassName}(${className});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
@Override
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
{
|
||||
#if($table.sub)
|
||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
|
||||
#end
|
||||
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除${functionName}信息
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
@Override
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
#if($table.sub)
|
||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
|
||||
#end
|
||||
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
||||
}
|
||||
#if($table.sub)
|
||||
|
||||
/**
|
||||
* 新增${subTable.functionName}信息
|
||||
*
|
||||
* @param ${className} ${functionName}对象
|
||||
*/
|
||||
public void insert${subClassName}(${ClassName} ${className})
|
||||
{
|
||||
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
|
||||
${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
|
||||
if (StringUtils.isNotNull(${subclassName}List))
|
||||
{
|
||||
List<${subClassName}> list = new ArrayList<${subClassName}>();
|
||||
for (${subClassName} ${subclassName} : ${subclassName}List)
|
||||
{
|
||||
${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
|
||||
list.add(${subclassName});
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
${className}Mapper.batch${subClassName}(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
#end
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,12 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
<<<<<<< HEAD
|
||||
public class ${subClassName} extends BaseEntity {
|
||||
=======
|
||||
public class ${subClassName} extends BaseEntity
|
||||
{
|
||||
>>>>>>> 813460c (1..)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $subTable.columns)
|
||||
|
|
|
@ -170,7 +170,11 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
|
@ -353,7 +357,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
<<<<<<< HEAD
|
||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "/src/api/${moduleName}/${businessName}";
|
||||
=======
|
||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
export default {
|
||||
name: "${BusinessName}",
|
||||
|
@ -448,8 +456,13 @@ export default {
|
|||
#end
|
||||
#end
|
||||
list${BusinessName}(this.queryParams).then(response => {
|
||||
<<<<<<< HEAD
|
||||
this.${businessName}List = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
=======
|
||||
this.${businessName}List = response.rows;
|
||||
this.total = response.total;
|
||||
>>>>>>> 813460c (1..)
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
|
|
@ -13,7 +13,11 @@ import com.muyu.system.service.SysConfigService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -30,7 +34,11 @@ import java.util.List;
|
|||
@Tag(name = "SysConfigController", description = "系统参数配置")
|
||||
public class SysConfigController extends BaseController {
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysConfigService configService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,11 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.service.SysDeptService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -26,7 +30,11 @@ import java.util.List;
|
|||
@RequestMapping("/dept")
|
||||
public class SysDeptController extends BaseController {
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysDeptService deptService;
|
||||
|
||||
/**
|
||||
|
@ -35,7 +43,10 @@ public class SysDeptController extends BaseController {
|
|||
@RequiresPermissions("system:dept:list")
|
||||
@GetMapping("/list")
|
||||
public Result list (SysDept dept) {
|
||||
<<<<<<< HEAD
|
||||
dept.setFirmCode(SecurityUtils.getSaasKey());
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return success(depts);
|
||||
}
|
||||
|
@ -72,8 +83,11 @@ public class SysDeptController extends BaseController {
|
|||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(SecurityUtils.getUsername());
|
||||
<<<<<<< HEAD
|
||||
SysDept sysDept = deptService.selectDeptById(dept.getParentId());
|
||||
dept.setFirmCode(sysDept.getFirmCode());
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,11 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.common.system.domain.SysDictData;
|
||||
import com.muyu.system.service.SysDictDataService;
|
||||
import com.muyu.system.service.SysDictTypeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -28,10 +32,17 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/dict/data")
|
||||
public class SysDictDataController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysDictDataService dictDataService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysDictTypeService dictTypeService;
|
||||
|
||||
@RequiresPermissions("system:dict:list")
|
||||
|
|
|
@ -10,7 +10,11 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysDictType;
|
||||
import com.muyu.system.service.SysDictTypeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -25,7 +29,11 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/dict/type")
|
||||
public class SysDictTypeController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysDictTypeService dictTypeService;
|
||||
|
||||
@RequiresPermissions("system:dict:list")
|
||||
|
|
|
@ -12,7 +12,11 @@ import com.muyu.common.security.annotation.InnerAuth;
|
|||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.system.domain.SysLogininfor;
|
||||
import com.muyu.system.service.SysLogininforService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
@ -26,10 +30,17 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/logininfor")
|
||||
public class SysLogininforController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysLogininforService logininforService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysLogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private RedisService redisService;
|
||||
|
||||
@RequiresPermissions("system:logininfor:list")
|
||||
|
|
|
@ -11,7 +11,11 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.system.domain.SysMenu;
|
||||
import com.muyu.system.domain.resp.RoleMenuTreeResp;
|
||||
import com.muyu.system.service.SysMenuService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -25,7 +29,11 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/menu")
|
||||
public class SysMenuController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysMenuService menuService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,11 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.service.SysNoticeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -23,7 +27,11 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/notice")
|
||||
public class SysNoticeController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysNoticeService noticeService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,11 @@ import com.muyu.common.security.annotation.InnerAuth;
|
|||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.system.domain.SysOperLog;
|
||||
import com.muyu.system.service.SysOperLogService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
@ -24,7 +28,11 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/operlog")
|
||||
public class SysOperlogController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysOperLogService operLogService;
|
||||
|
||||
@RequiresPermissions("system:operlog:list")
|
||||
|
|
|
@ -10,7 +10,11 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.system.domain.SysPost;
|
||||
import com.muyu.system.service.SysPostService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -25,7 +29,11 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/post")
|
||||
public class SysPostController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysPostService postService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.core.utils.ServletUtils;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.utils.file.FileTypeUtils;
|
||||
import com.muyu.common.core.utils.file.MimeTypeUtils;
|
||||
|
@ -16,12 +19,19 @@ import com.muyu.common.system.domain.SysUser;
|
|||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.system.domain.resp.ProfileResp;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
<<<<<<< HEAD
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
|
@ -32,6 +42,7 @@ import java.util.Arrays;
|
|||
@RestController
|
||||
@RequestMapping("/user/profile")
|
||||
public class SysProfileController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysUserService userService;
|
||||
|
||||
|
@ -42,14 +53,30 @@ public class SysProfileController extends BaseController {
|
|||
private RemoteFileService remoteFileService;
|
||||
|
||||
|
||||
=======
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public Result profile () {
|
||||
<<<<<<< HEAD
|
||||
String firmCode = SecurityUtils.getSaasKey();
|
||||
String username = SecurityUtils.getUsername();
|
||||
SysUser user = userService.selectUserByUserName(firmCode, username);
|
||||
=======
|
||||
String username = SecurityUtils.getUsername();
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
>>>>>>> 813460c (1..)
|
||||
return Result.success(
|
||||
ProfileResp.builder()
|
||||
.roleGroup( userService.selectUserRoleGroup(username) )
|
||||
|
@ -91,9 +118,14 @@ public class SysProfileController extends BaseController {
|
|||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public Result updatePwd (String oldPassword, String newPassword) {
|
||||
<<<<<<< HEAD
|
||||
String firmCode = SecurityUtils.getSaasKey();
|
||||
String username = SecurityUtils.getUsername();
|
||||
SysUser user = userService.selectUserByUserName(firmCode, username);
|
||||
=======
|
||||
String username = SecurityUtils.getUsername();
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
>>>>>>> 813460c (1..)
|
||||
String password = user.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
||||
return error("修改密码失败,旧密码错误");
|
||||
|
|
|
@ -11,12 +11,20 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.domain.SysUserRole;
|
||||
=======
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.system.domain.resp.DeptTreeResp;
|
||||
import com.muyu.system.service.SysDeptService;
|
||||
import com.muyu.system.service.SysRoleService;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -31,6 +39,7 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/role")
|
||||
public class SysRoleController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysRoleService roleService;
|
||||
|
||||
|
@ -38,13 +47,25 @@ public class SysRoleController extends BaseController {
|
|||
private SysUserService userService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysDeptService deptService;
|
||||
|
||||
@RequiresPermissions("system:role:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<SysRole>> list (SysRole role) {
|
||||
startPage();
|
||||
<<<<<<< HEAD
|
||||
role.setFirmCode(SecurityUtils.getSaasKey());
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
@ -75,7 +96,10 @@ public class SysRoleController extends BaseController {
|
|||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysRole role) {
|
||||
<<<<<<< HEAD
|
||||
role.setFirmCode(SecurityUtils.getSaasKey());
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
|
@ -145,9 +169,13 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:query")
|
||||
@GetMapping("/optionselect")
|
||||
public Result optionselect () {
|
||||
<<<<<<< HEAD
|
||||
SysRole role = new SysRole();
|
||||
role.setFirmCode(SecurityUtils.getSaasKey());
|
||||
return success(roleService.selectRoleAll(role));
|
||||
=======
|
||||
return success(roleService.selectRoleAll());
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,8 +19,12 @@ import com.muyu.system.domain.resp.UserDetailInfoResp;
|
|||
import com.muyu.system.domain.resp.UserInfoResp;
|
||||
import com.muyu.system.service.*;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
<<<<<<< HEAD
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -31,16 +35,24 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* sys用户控制器
|
||||
*
|
||||
* @author 胡杨
|
||||
* @date 2024/09/25
|
||||
=======
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author muyu
|
||||
>>>>>>> 813460c (1..)
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class SysUserController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysUserService userService;
|
||||
|
||||
|
@ -58,6 +70,24 @@ public class SysUserController extends BaseController {
|
|||
private SysPermissionService permissionService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private SysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private SysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysConfigService configService;
|
||||
|
||||
/**
|
||||
|
@ -67,11 +97,15 @@ public class SysUserController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<SysUser>> list (SysUser user) {
|
||||
startPage();
|
||||
<<<<<<< HEAD
|
||||
user.setFirmCode(SecurityUtils.getSaasKey());
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
/**
|
||||
* 公司集合
|
||||
*/
|
||||
|
@ -81,6 +115,8 @@ public class SysUserController extends BaseController {
|
|||
return Result.success(list);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:user:export")
|
||||
@PostMapping("/export")
|
||||
|
@ -111,9 +147,15 @@ public class SysUserController extends BaseController {
|
|||
* 获取当前用户信息
|
||||
*/
|
||||
@InnerAuth
|
||||
<<<<<<< HEAD
|
||||
@GetMapping("/info")
|
||||
public Result<LoginUser> info (@RequestParam("firmCode") String firmCode,@RequestParam("userName") String userName) {
|
||||
SysUser sysUser = userService.selectUserByUserName(firmCode, userName);
|
||||
=======
|
||||
@GetMapping("/info/{username}")
|
||||
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||
SysUser sysUser = userService.selectUserByUserName(username);
|
||||
>>>>>>> 813460c (1..)
|
||||
if (StringUtils.isNull(sysUser)) {
|
||||
return Result.error("用户名或密码错误");
|
||||
}
|
||||
|
@ -172,6 +214,7 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:query")
|
||||
@GetMapping(value = {"/", "/{userId}"})
|
||||
public Result getInfo (@PathVariable(value = "userId", required = false) Long userId) {
|
||||
<<<<<<< HEAD
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
UserDetailInfoResp.UserDetailInfoRespBuilder<?, ?> builder = UserDetailInfoResp.builder();
|
||||
SysRole role = new SysRole();
|
||||
|
@ -179,6 +222,11 @@ public class SysUserController extends BaseController {
|
|||
role.setFirmCode(user.getFirmCode());
|
||||
}
|
||||
List<SysRole> roles = roleService.selectRoleAll(role);
|
||||
=======
|
||||
userService.checkUserDataScope(userId);
|
||||
UserDetailInfoResp.UserDetailInfoRespBuilder<?, ?> builder = UserDetailInfoResp.builder();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
>>>>>>> 813460c (1..)
|
||||
builder.roles(
|
||||
SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())
|
||||
)
|
||||
|
@ -209,6 +257,7 @@ public class SysUserController extends BaseController {
|
|||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
<<<<<<< HEAD
|
||||
|
||||
String saasKey = SecurityUtils.getSaasKey();
|
||||
if ("FIRM".equals(saasKey)) {
|
||||
|
@ -217,10 +266,13 @@ public class SysUserController extends BaseController {
|
|||
}else {
|
||||
user.setFirmCode(saasKey);
|
||||
}
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* 新增用户角色信息
|
||||
*
|
||||
* @param user 用户对象
|
||||
|
@ -241,6 +293,8 @@ public class SysUserController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
* 修改用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:edit")
|
||||
|
@ -307,7 +361,11 @@ public class SysUserController extends BaseController {
|
|||
@GetMapping("/authRole/{userId}")
|
||||
public Result authRole (@PathVariable("userId") Long userId) {
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
<<<<<<< HEAD
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(user.getFirmCode(), userId);
|
||||
=======
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
>>>>>>> 813460c (1..)
|
||||
return Result.success(
|
||||
AuthRoleResp.builder()
|
||||
.roles(SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()))
|
||||
|
@ -322,7 +380,11 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
<<<<<<< HEAD
|
||||
public Result insertAuthRole (@RequestParam("userId") Long userId, @RequestParam("roleIds") Long[] roleIds) {
|
||||
=======
|
||||
public Result insertAuthRole (Long userId, Long[] roleIds) {
|
||||
>>>>>>> 813460c (1..)
|
||||
userService.checkUserDataScope(userId);
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
|
|
|
@ -12,7 +12,11 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
|||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.system.domain.SysUserOnline;
|
||||
import com.muyu.system.service.SysUserOnlineService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -28,10 +32,17 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/online")
|
||||
public class SysUserOnlineController extends BaseController {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysUserOnlineService userOnlineService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private RedisService redisService;
|
||||
|
||||
@RequiresPermissions("monitor:online:list")
|
||||
|
|
|
@ -128,6 +128,9 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById (Long deptId);
|
||||
<<<<<<< HEAD
|
||||
|
||||
int updateDeptFirmCode(@Param("deptId") Long deptId);
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@ package com.muyu.system.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
<<<<<<< HEAD
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,7 +31,11 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
|
|||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public List<SysRole> selectRolePermissionByUserId (@Param("firmCode") String firmCode, @Param("userId") Long userId);
|
||||
=======
|
||||
public List<SysRole> selectRolePermissionByUserId (Long userId);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
|
@ -71,7 +78,11 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
|
|||
*
|
||||
* @return 角色信息
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public SysRole checkRoleNameUnique (@Param("firmCode") String firmCode, @Param("roleName") String roleName);
|
||||
=======
|
||||
public SysRole checkRoleNameUnique (String roleName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
|
|
|
@ -46,7 +46,11 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public SysUser selectUserByUserName (@Param("firmCode") String firmCode, @Param("userName") String userName);
|
||||
=======
|
||||
public SysUser selectUserByUserName (String userName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
|
@ -139,7 +143,10 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique (String email);
|
||||
<<<<<<< HEAD
|
||||
|
||||
List<SysUser> selectCompanyList();
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.domain.SysUserPost;
|
||||
=======
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.domain.SysUserRole;
|
||||
=======
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
//package com.muyu.system.rabbit;
|
||||
//
|
||||
//import com.alibaba.fastjson2.JSONObject;
|
||||
|
@ -51,3 +52,58 @@
|
|||
// }
|
||||
//
|
||||
//}
|
||||
=======
|
||||
package com.muyu.system.rabbit;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.muyu.system.domain.SysConfig;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/rabbit/test")
|
||||
public class RabbitTest {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Bean
|
||||
public Queue initQueue(){
|
||||
return new Queue("rabbit.test.init");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = "rabbit.test.init")
|
||||
public void msg(SysConfig sysConfig){
|
||||
log.info("消息队列:[{}], 消息内容:[{}]", "rabbit.test.init", JSONObject.toJSONString(sysConfig));
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
SysConfig sysConfig = SysConfig.builder()
|
||||
.configId(1L)
|
||||
.configKey("ceshi-key")
|
||||
.configName("测试名称")
|
||||
.configType("测试类型")
|
||||
.configValue("测试值")
|
||||
.build();
|
||||
rabbitTemplate.convertAndSend("rabbit.test.init",sysConfig);
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
||||
>>>>>>> 813460c (1..)
|
||||
|
|
|
@ -6,10 +6,16 @@ import com.muyu.system.domain.SysConfig;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* 系统配置服务
|
||||
*
|
||||
* @author DongZl
|
||||
* @date 2024/09/25
|
||||
=======
|
||||
* @author DongZl
|
||||
* @description: 配置plus业务层
|
||||
* @Date 2023-11-13 上午 10:06
|
||||
>>>>>>> 813460c (1..)
|
||||
*/
|
||||
public interface SysConfigService extends IService<SysConfig> {
|
||||
List<SysConfig> pageQuery (SysConfig config);
|
||||
|
|
|
@ -2,7 +2,11 @@ package com.muyu.system.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.domain.SysUserRole;
|
||||
=======
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -29,7 +33,11 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public List<SysRole> selectRolesByUserId (String firmCode, Long userId);
|
||||
=======
|
||||
public List<SysRole> selectRolesByUserId (Long userId);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色权限
|
||||
|
@ -38,14 +46,22 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 权限列表
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public Set<String> selectRolePermissionByUserId (String firmCode, Long userId);
|
||||
=======
|
||||
public Set<String> selectRolePermissionByUserId (Long userId);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public List<SysRole> selectRoleAll (SysRole role);
|
||||
=======
|
||||
public List<SysRole> selectRoleAll ();
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
|
|
|
@ -45,8 +45,12 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public SysUser selectUserByUserName (String firmCode, String userName);
|
||||
|
||||
=======
|
||||
public SysUser selectUserByUserName (String userName);
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
|
@ -226,6 +230,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @return 结果
|
||||
*/
|
||||
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
<<<<<<< HEAD
|
||||
|
||||
List<SysUser> selectCompanyList();
|
||||
|
||||
|
@ -233,4 +238,6 @@ public interface SysUserService extends IService<SysUser> {
|
|||
|
||||
void insertUserRole(SysUser user);
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,11 @@ import com.muyu.common.redis.service.RedisService;
|
|||
import com.muyu.system.domain.SysConfig;
|
||||
import com.muyu.system.mapper.SysConfigMapper;
|
||||
import com.muyu.system.service.SysConfigService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
@ -26,7 +30,11 @@ import java.util.Objects;
|
|||
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig>
|
||||
implements SysConfigService {
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private RedisService redisService;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,9 +15,14 @@ import com.muyu.system.domain.vo.TreeSelect;
|
|||
import com.muyu.system.mapper.SysDeptMapper;
|
||||
import com.muyu.system.mapper.SysRoleMapper;
|
||||
import com.muyu.system.service.SysDeptService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
>>>>>>> 813460c (1..)
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -31,10 +36,17 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@Service
|
||||
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysDeptMapper deptMapper;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
/**
|
||||
|
@ -205,7 +217,10 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
@Transactional
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
public int insertDept (SysDept dept) {
|
||||
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
||||
// 如果父节点不为正常状态,则不允许新增子节点
|
||||
|
@ -213,9 +228,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
<<<<<<< HEAD
|
||||
deptMapper.insertDept(dept);
|
||||
// 修改saas编码
|
||||
return deptMapper.updateDeptFirmCode(dept.getDeptId());
|
||||
=======
|
||||
return deptMapper.insertDept(dept);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,11 @@ import com.muyu.common.security.utils.DictUtils;
|
|||
import com.muyu.common.system.domain.SysDictData;
|
||||
import com.muyu.system.mapper.SysDictDataMapper;
|
||||
import com.muyu.system.service.SysDictDataService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -17,7 +21,11 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,11 @@ import com.muyu.common.system.domain.SysDictType;
|
|||
import com.muyu.system.mapper.SysDictDataMapper;
|
||||
import com.muyu.system.mapper.SysDictTypeMapper;
|
||||
import com.muyu.system.service.SysDictTypeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -27,10 +31,17 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@Service
|
||||
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements SysDictTypeService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysDictTypeMapper dictTypeMapper;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysDictTypeMapper dictTypeMapper;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.common.system.domain.SysLogininfor;
|
||||
import com.muyu.system.mapper.SysLogininforMapper;
|
||||
import com.muyu.system.service.SysLogininforService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -17,7 +21,11 @@ import java.util.List;
|
|||
@Service
|
||||
public class SysLogininforServiceImpl extends ServiceImpl<SysLogininforMapper, SysLogininfor> implements SysLogininforService {
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysLogininforMapper logininforMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,11 @@ import com.muyu.system.mapper.SysMenuMapper;
|
|||
import com.muyu.system.mapper.SysRoleMapper;
|
||||
import com.muyu.system.mapper.SysRoleMenuMapper;
|
||||
import com.muyu.system.service.SysMenuService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -30,6 +34,7 @@ import java.util.stream.Collectors;
|
|||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {
|
||||
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysMenuMapper menuMapper;
|
||||
|
||||
|
@ -37,6 +42,15 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysMenuMapper menuMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.mapper.SysNoticeMapper;
|
||||
import com.muyu.system.service.SysNoticeService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,7 +20,11 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements SysNoticeService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysNoticeMapper noticeMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.common.system.domain.SysOperLog;
|
||||
import com.muyu.system.mapper.SysOperLogMapper;
|
||||
import com.muyu.system.service.SysOperLogService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,7 +20,11 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements SysOperLogService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysOperLogMapper operLogMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,11 @@ import com.muyu.common.system.domain.SysUser;
|
|||
import com.muyu.system.service.SysMenuService;
|
||||
import com.muyu.system.service.SysPermissionService;
|
||||
import com.muyu.system.service.SysRoleService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
@ -21,16 +25,27 @@ import java.util.Set;
|
|||
*/
|
||||
@Service
|
||||
public class SysPermissionServiceImpl implements SysPermissionService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysRoleService roleService;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 获取角色数据权限
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @param user 用户
|
||||
=======
|
||||
* @param userId 用户Id
|
||||
>>>>>>> 813460c (1..)
|
||||
*
|
||||
* @return 角色权限信息
|
||||
*/
|
||||
|
@ -41,7 +56,11 @@ public class SysPermissionServiceImpl implements SysPermissionService {
|
|||
if (user.isAdmin()) {
|
||||
roles.add("admin");
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
roles.addAll(roleService.selectRolePermissionByUserId(user.getFirmCode(), user.getUserId()));
|
||||
=======
|
||||
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
@ -49,7 +68,11 @@ public class SysPermissionServiceImpl implements SysPermissionService {
|
|||
/**
|
||||
* 获取菜单数据权限
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @param user 用户
|
||||
=======
|
||||
* @param userId 用户Id
|
||||
>>>>>>> 813460c (1..)
|
||||
*
|
||||
* @return 菜单权限信息
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,11 @@ import com.muyu.system.domain.SysPost;
|
|||
import com.muyu.system.mapper.SysPostMapper;
|
||||
import com.muyu.system.mapper.SysUserPostMapper;
|
||||
import com.muyu.system.service.SysPostService;
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -20,10 +24,17 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> implements SysPostService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysPostMapper postMapper;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysPostMapper postMapper;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysUserPostMapper userPostMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,17 +11,28 @@ import com.muyu.common.system.domain.SysRole;
|
|||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.SysRoleDept;
|
||||
import com.muyu.system.domain.SysRoleMenu;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.domain.SysUserRole;
|
||||
=======
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.system.mapper.SysRoleDeptMapper;
|
||||
import com.muyu.system.mapper.SysRoleMapper;
|
||||
import com.muyu.system.mapper.SysRoleMenuMapper;
|
||||
import com.muyu.system.mapper.SysUserRoleMapper;
|
||||
import com.muyu.system.service.SysRoleService;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
>>>>>>> 813460c (1..)
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -31,6 +42,7 @@ import java.util.*;
|
|||
*/
|
||||
@Service
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
|
@ -41,6 +53,18 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
private SysUserRoleMapper userRoleMapper;
|
||||
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysRoleDeptMapper roleDeptMapper;
|
||||
|
||||
/**
|
||||
|
@ -64,11 +88,17 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public List<SysRole> selectRolesByUserId (String firmCode, Long userId) {
|
||||
List<SysRole> userRoles = roleMapper.selectRolePermissionByUserId(firmCode, userId);
|
||||
SysRole sysRole = new SysRole();
|
||||
sysRole.setFirmCode(firmCode);
|
||||
List<SysRole> roles = selectRoleAll(sysRole);
|
||||
=======
|
||||
public List<SysRole> selectRolesByUserId (Long userId) {
|
||||
List<SysRole> userRoles = roleMapper.selectRolePermissionByUserId(userId);
|
||||
List<SysRole> roles = selectRoleAll();
|
||||
>>>>>>> 813460c (1..)
|
||||
for (SysRole role : roles) {
|
||||
for (SysRole userRole : userRoles) {
|
||||
if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) {
|
||||
|
@ -88,8 +118,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 权限列表
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public Set<String> selectRolePermissionByUserId (String firmCode, Long userId) {
|
||||
List<SysRole> perms = roleMapper.selectRolePermissionByUserId(firmCode, userId);
|
||||
=======
|
||||
public Set<String> selectRolePermissionByUserId (Long userId) {
|
||||
List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId);
|
||||
>>>>>>> 813460c (1..)
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (SysRole perm : perms) {
|
||||
if (StringUtils.isNotNull(perm)) {
|
||||
|
@ -105,8 +140,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public List<SysRole> selectRoleAll (SysRole role) {
|
||||
return SpringUtils.getAopProxy(this).selectRoleList(role);
|
||||
=======
|
||||
public List<SysRole> selectRoleAll () {
|
||||
return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,7 +183,11 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
@Override
|
||||
public boolean checkRoleNameUnique (SysRole role) {
|
||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||
<<<<<<< HEAD
|
||||
SysRole info = roleMapper.checkRoleNameUnique(role.getFirmCode(), role.getRoleName());
|
||||
=======
|
||||
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
||||
>>>>>>> 813460c (1..)
|
||||
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
|
|
|
@ -11,19 +11,31 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.SysPost;
|
||||
<<<<<<< HEAD
|
||||
import com.muyu.common.system.domain.SysUserPost;
|
||||
import com.muyu.common.system.domain.SysUserRole;
|
||||
=======
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
>>>>>>> 813460c (1..)
|
||||
import com.muyu.system.mapper.*;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import com.muyu.system.service.SysConfigService;
|
||||
import jakarta.validation.Validator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
>>>>>>> 813460c (1..)
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import javax.annotation.Resource;
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -36,6 +48,7 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
||||
<<<<<<< HEAD
|
||||
@Resource
|
||||
protected Validator validator;
|
||||
@Resource
|
||||
|
@ -49,6 +62,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
@Resource
|
||||
private SysUserPostMapper userPostMapper;
|
||||
@Resource
|
||||
=======
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
@Autowired
|
||||
private SysPostMapper postMapper;
|
||||
@Autowired
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
@Autowired
|
||||
private SysUserPostMapper userPostMapper;
|
||||
@Autowired
|
||||
>>>>>>> 813460c (1..)
|
||||
private SysConfigService configService;
|
||||
|
||||
/**
|
||||
|
@ -98,8 +126,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public SysUser selectUserByUserName (String firmCode, String userName) {
|
||||
return userMapper.selectUserByUserName(firmCode, userName);
|
||||
=======
|
||||
public SysUser selectUserByUserName (String userName) {
|
||||
return userMapper.selectUserByUserName(userName);
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -359,7 +392,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Override
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
public void insertUserRole (SysUser user) {
|
||||
this.insertUserRole(user.getUserId(), user.getRoleIds());
|
||||
}
|
||||
|
@ -369,7 +405,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Override
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
public void insertUserPost (SysUser user) {
|
||||
Long[] posts = user.getPostIds();
|
||||
if (StringUtils.isNotEmpty(posts)) {
|
||||
|
@ -465,9 +504,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
for (SysUser user : userList) {
|
||||
try {
|
||||
// 验证是否存在这个用户
|
||||
<<<<<<< HEAD
|
||||
|
||||
String firmCode = SecurityUtils.getSaasKey();
|
||||
SysUser u = userMapper.selectUserByUserName(firmCode, user.getUserName());
|
||||
=======
|
||||
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
||||
>>>>>>> 813460c (1..)
|
||||
if (StringUtils.isNull(u)) {
|
||||
BeanValidators.validateWithException(validator, user);
|
||||
user.setPassword(SecurityUtils.encryptPassword(password));
|
||||
|
@ -504,10 +547,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
return successMsg.toString();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Override
|
||||
public List<SysUser> selectCompanyList() {
|
||||
|
||||
return userMapper.selectCompanyList();
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,11 @@ nacos:
|
|||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
<<<<<<< HEAD
|
||||
namespace: one-saas
|
||||
=======
|
||||
namespace: one
|
||||
>>>>>>> 813460c (1..)
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
@ -53,7 +57,12 @@ spring:
|
|||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# xxl-job 配置文件
|
||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
# rabbit 配置文件
|
||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
>>>>>>> 813460c (1..)
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
<id property="deptId" column="dept_id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="ancestors" column="ancestors"/>
|
||||
<<<<<<< HEAD
|
||||
<result property="firmCode" column="firm_code"/>
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
<result property="deptName" column="dept_name"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="leader" column="leader"/>
|
||||
|
@ -27,7 +30,10 @@
|
|||
select d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
<<<<<<< HEAD
|
||||
d.firm_code,
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
d.dept_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
|
@ -46,9 +52,12 @@
|
|||
<if test="deptId != null and deptId != 0">
|
||||
AND dept_id = #{deptId}
|
||||
</if>
|
||||
<<<<<<< HEAD
|
||||
<if test="firmCode != null and firmCode != '' and firmCode != 'FIRM'">
|
||||
AND instr(firm_code, #{firmCode})
|
||||
</if>
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
<if test="parentId != null and parentId != 0">
|
||||
AND parent_id = #{parentId}
|
||||
</if>
|
||||
|
@ -114,10 +123,17 @@
|
|||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<insert id="insertDept" parameterType="com.muyu.common.system.domain.SysDept" useGeneratedKeys="true" keyProperty="deptId">
|
||||
insert into sys_dept(
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="firmCode != null and firmCode != ''">firm_code,</if>
|
||||
=======
|
||||
<insert id="insertDept" parameterType="com.muyu.common.system.domain.SysDept">
|
||||
insert into sys_dept(
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
>>>>>>> 813460c (1..)
|
||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
|
@ -128,8 +144,13 @@
|
|||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<<<<<<< HEAD
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="firmCode != null and firmCode != ''">#{firmCode},</if>
|
||||
=======
|
||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
>>>>>>> 813460c (1..)
|
||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
|
@ -138,7 +159,11 @@
|
|||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<<<<<<< HEAD
|
||||
now()
|
||||
=======
|
||||
sysdate()
|
||||
>>>>>>> 813460c (1..)
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
@ -146,7 +171,10 @@
|
|||
update sys_dept
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<<<<<<< HEAD
|
||||
<if test="firmCode != null and firmCode != ''">firm_code = #{firmCode},</if>
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
||||
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
|
@ -180,12 +208,15 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<update id="updateDeptFirmCode">
|
||||
update sys_dept
|
||||
set firm_code = CONCAT(firm_code,'_',#{deptId})
|
||||
where dept_id = #{deptId}
|
||||
</update>
|
||||
|
||||
=======
|
||||
>>>>>>> 813460c (1..)
|
||||
<delete id="deleteDeptById" parameterType="Long">
|
||||
update sys_dept
|
||||
set del_flag = '2'
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue