完成租户的部门用户权限管理
parent
b91eb2ffdc
commit
b5a95200f8
|
@ -36,6 +36,8 @@ public class SysRole extends BaseEntity {
|
|||
@Excel(name = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
private String firmCode;
|
||||
|
||||
/**
|
||||
* 角色权限
|
||||
*/
|
||||
|
|
|
@ -37,6 +37,8 @@ public class SysUser extends BaseEntity {
|
|||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
private Integer isAdmin;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
|
@ -148,8 +150,9 @@ public class SysUser extends BaseEntity {
|
|||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
|
||||
public boolean isAdmin () {
|
||||
return isAdmin(this.userId);
|
||||
return isAdmin(this.userId) || (this.isAdmin != null && this.isAdmin == 1);
|
||||
}
|
||||
|
||||
@Xss(message = "用户昵称不能包含脚本字符")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.cloud.firm;
|
||||
package com.muyu.system;
|
||||
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-modules-system-saas</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<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 Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 接口模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- XllJob定时任务 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-xxl</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.system.saas;
|
||||
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* @Author: 胡杨
|
||||
* @Name: CloudSystemSaas
|
||||
* @Description: SaaS系统驱动器
|
||||
* @CreatedDate: 2024/9/22 上午10:05
|
||||
* @FilePath: com.muyu.system.saas
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication(
|
||||
exclude = {
|
||||
DataSourceAutoConfiguration.class,
|
||||
DruidDataSourceAutoConfigure.class,
|
||||
DynamicDataSourceAutoConfiguration.class
|
||||
}
|
||||
)
|
||||
public class CloudSystemSaasApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudSystemSaasApplication.class, args);
|
||||
System.out.println("CloudSystemSaas 模块启动成功!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,59 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9704
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one-saas
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
amqp:
|
||||
deserialization:
|
||||
trust:
|
||||
all: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
# 应用名称
|
||||
name: cloud-system-saas
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
config:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统环境Config共享配置
|
||||
- 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}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-system-saas"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-system-saas"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-system-saas"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.muyu</groupId>-->
|
||||
<!-- <artifactId>cloud-common-saas</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.system;
|
||||
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
|
@ -16,6 +17,13 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
//@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
//@SpringBootApplication(
|
||||
// exclude = {
|
||||
// DataSourceAutoConfiguration.class,
|
||||
// DruidDataSourceAutoConfigure.class,
|
||||
// DynamicDataSourceAutoConfiguration.class
|
||||
// }
|
||||
//)
|
||||
public class CloudSystemApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudSystemApplication.class, args);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.muyu.cloud.firm.controller;
|
||||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.cloud.firm.service.ISysFirmService;
|
||||
import com.muyu.system.service.ISysFirmService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.cloud.firm.domain.SysFirm;
|
||||
import com.muyu.system.domain.SysFirm;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
|
@ -44,6 +44,7 @@ public class SysRoleController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<SysRole>> list (SysRole role) {
|
||||
startPage();
|
||||
role.setFirmCode(SecurityUtils.getSaasKey());
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
@ -74,6 +75,7 @@ public class SysRoleController extends BaseController {
|
|||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysRole role) {
|
||||
role.setFirmCode(SecurityUtils.getSaasKey());
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
|
@ -143,7 +145,9 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:query")
|
||||
@GetMapping("/optionselect")
|
||||
public Result optionselect () {
|
||||
return success(roleService.selectRoleAll());
|
||||
SysRole role = new SysRole();
|
||||
role.setFirmCode(SecurityUtils.getSaasKey());
|
||||
return success(roleService.selectRoleAll(role));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@ 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;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -165,9 +166,13 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:query")
|
||||
@GetMapping(value = {"/", "/{userId}"})
|
||||
public Result getInfo (@PathVariable(value = "userId", required = false) Long userId) {
|
||||
userService.checkUserDataScope(userId);
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
UserDetailInfoResp.UserDetailInfoRespBuilder<?, ?> builder = UserDetailInfoResp.builder();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
SysRole role = new SysRole();
|
||||
if (ObjectUtils.isNotEmpty(user)){
|
||||
role.setFirmCode(user.getFirmCode());
|
||||
}
|
||||
List<SysRole> roles = roleService.selectRoleAll(role);
|
||||
builder.roles(
|
||||
SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())
|
||||
)
|
||||
|
@ -198,7 +203,14 @@ public class SysUserController extends BaseController {
|
|||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setFirmCode(SecurityUtils.getSaasKey());
|
||||
|
||||
String saasKey = SecurityUtils.getSaasKey();
|
||||
if ("FIRM".equals(saasKey)) {
|
||||
SysDept sysDept = deptService.selectDeptById(user.getDeptId());
|
||||
user.setFirmCode(sysDept.getFirmCode());
|
||||
}else {
|
||||
user.setFirmCode(saasKey);
|
||||
}
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
|
@ -269,7 +281,7 @@ public class SysUserController extends BaseController {
|
|||
@GetMapping("/authRole/{userId}")
|
||||
public Result authRole (@PathVariable("userId") Long userId) {
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(user.getFirmCode(), userId);
|
||||
return Result.success(
|
||||
AuthRoleResp.builder()
|
||||
.roles(SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.cloud.firm.domain;
|
||||
package com.muyu.system.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.cloud.firm.mapper;
|
||||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.firm.domain.SysFirm;
|
||||
import com.muyu.system.domain.SysFirm;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
|
@ -2,6 +2,7 @@ package com.muyu.system.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -27,7 +28,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
|
|||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<SysRole> selectRolePermissionByUserId (Long userId);
|
||||
public List<SysRole> selectRolePermissionByUserId (@Param("firmCode") String firmCode, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
|
@ -70,7 +71,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
|
|||
*
|
||||
* @return 角色信息
|
||||
*/
|
||||
public SysRole checkRoleNameUnique (String roleName);
|
||||
public SysRole checkRoleNameUnique (@Param("firmCode") String firmCode, @Param("roleName") String roleName);
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.cloud.firm.service;
|
||||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.firm.domain.SysFirm;
|
||||
import com.muyu.system.domain.SysFirm;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -29,7 +29,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<SysRole> selectRolesByUserId (Long userId);
|
||||
public List<SysRole> selectRolesByUserId (String firmCode, Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色权限
|
||||
|
@ -38,14 +38,14 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 权限列表
|
||||
*/
|
||||
public Set<String> selectRolePermissionByUserId (Long userId);
|
||||
public Set<String> selectRolePermissionByUserId (String firmCode, Long userId);
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<SysRole> selectRoleAll ();
|
||||
public List<SysRole> selectRoleAll (SysRole role);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package com.muyu.cloud.firm.service.impl;
|
||||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.firm.domain.SysFirm;
|
||||
import com.muyu.cloud.firm.mapper.SysFirmMapper;
|
||||
import com.muyu.cloud.firm.service.ISysFirmService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.system.domain.SysFirm;
|
||||
import com.muyu.system.mapper.SysFirmMapper;
|
||||
import com.muyu.system.service.ISysFirmService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
|
@ -30,7 +30,7 @@ public class SysPermissionServiceImpl implements SysPermissionService {
|
|||
/**
|
||||
* 获取角色数据权限
|
||||
*
|
||||
* @param userId 用户Id
|
||||
* @param user 用户
|
||||
*
|
||||
* @return 角色权限信息
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ public class SysPermissionServiceImpl implements SysPermissionService {
|
|||
if (user.isAdmin()) {
|
||||
roles.add("admin");
|
||||
} else {
|
||||
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
|
||||
roles.addAll(roleService.selectRolePermissionByUserId(user.getFirmCode(), user.getUserId()));
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class SysPermissionServiceImpl implements SysPermissionService {
|
|||
/**
|
||||
* 获取菜单数据权限
|
||||
*
|
||||
* @param userId 用户Id
|
||||
* @param user 用户
|
||||
*
|
||||
* @return 菜单权限信息
|
||||
*/
|
||||
|
|
|
@ -17,10 +17,11 @@ import com.muyu.system.mapper.SysRoleMapper;
|
|||
import com.muyu.system.mapper.SysRoleMenuMapper;
|
||||
import com.muyu.system.mapper.SysUserRoleMapper;
|
||||
import com.muyu.system.service.SysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -30,16 +31,16 @@ import java.util.*;
|
|||
*/
|
||||
@Service
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
|
||||
@Autowired
|
||||
@Resource
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private SysRoleDeptMapper roleDeptMapper;
|
||||
|
||||
/**
|
||||
|
@ -63,9 +64,11 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> selectRolesByUserId (Long userId) {
|
||||
List<SysRole> userRoles = roleMapper.selectRolePermissionByUserId(userId);
|
||||
List<SysRole> roles = selectRoleAll();
|
||||
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);
|
||||
for (SysRole role : roles) {
|
||||
for (SysRole userRole : userRoles) {
|
||||
if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) {
|
||||
|
@ -85,8 +88,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 权限列表
|
||||
*/
|
||||
@Override
|
||||
public Set<String> selectRolePermissionByUserId (Long userId) {
|
||||
List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId);
|
||||
public Set<String> selectRolePermissionByUserId (String firmCode, Long userId) {
|
||||
List<SysRole> perms = roleMapper.selectRolePermissionByUserId(firmCode, userId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (SysRole perm : perms) {
|
||||
if (StringUtils.isNotNull(perm)) {
|
||||
|
@ -102,8 +105,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> selectRoleAll () {
|
||||
return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
|
||||
public List<SysRole> selectRoleAll (SysRole role) {
|
||||
return SpringUtils.getAopProxy(this).selectRoleList(role);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +143,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
@Override
|
||||
public boolean checkRoleNameUnique (SysRole role) {
|
||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
||||
SysRole info = roleMapper.checkRoleNameUnique(role.getFirmCode(), role.getRoleName());
|
||||
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.cloud.firm.mapper.SysFirmMapper">
|
||||
<mapper namespace="com.muyu.system.mapper.SysFirmMapper">
|
||||
|
||||
<resultMap type="com.muyu.cloud.firm.domain.SysFirm" id="SysFirmResult">
|
||||
<resultMap type="com.muyu.system.domain.SysFirm" id="SysFirmResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="firmCreditCode" column="firm_credit_code" />
|
||||
<result property="firmCode" column="firm_code" />
|
||||
|
@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select id, firm_credit_code, firm_code, firm_name, firm_logs , state, create_by, create_time, update_by, update_time, remark from sys_firm
|
||||
</sql>
|
||||
|
||||
<select id="selectSysFirmList" parameterType="com.muyu.cloud.firm.domain.SysFirm" resultMap="SysFirmResult">
|
||||
<select id="selectSysFirmList" parameterType="com.muyu.system.domain.SysFirm" resultMap="SysFirmResult">
|
||||
<include refid="selectSysFirmVo"/>
|
||||
<where>
|
||||
<if test="firmName != null and firmName != ''"> and firm_name like concat('%', #{firmName}, '%')</if>
|
||||
|
@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
|
||||
<insert id="insertSysFirm" parameterType="com.muyu.cloud.firm.domain.SysFirm" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="insertSysFirm" parameterType="com.muyu.system.domain.SysFirm" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_firm
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="firmCreditCode != null and firmCreditCode != ''">firm_credit_code,</if>
|
||||
|
@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysFirm" parameterType="com.muyu.cloud.firm.domain.SysFirm">
|
||||
<update id="updateSysFirm" parameterType="com.muyu.system.domain.SysFirm">
|
||||
update sys_firm
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="firmCreditCode != null and firmCreditCode != ''">firm_credit_code = #{firmCreditCode},</if>
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<resultMap type="com.muyu.common.system.domain.SysRole" id="SysRoleResult">
|
||||
<id property="roleId" column="role_id"/>
|
||||
<result property="firmCode" column="firm_code"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="roleKey" column="role_key"/>
|
||||
<result property="roleSort" column="role_sort"/>
|
||||
|
@ -23,6 +24,7 @@
|
|||
|
||||
<sql id="selectRoleVo">
|
||||
select distinct r.role_id,
|
||||
r.firm_code,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.role_sort,
|
||||
|
@ -51,6 +53,9 @@
|
|||
<if test="status != null and status != ''">
|
||||
AND r.status = #{status}
|
||||
</if>
|
||||
<if test="firmCode != null and firmCode != '' and firmCode != 'FIRM'">
|
||||
AND r.firm_code = #{firmCode}
|
||||
</if>
|
||||
<if test="roleKey != null and roleKey != ''">
|
||||
AND r.role_key like concat('%', #{roleKey}, '%')
|
||||
</if>
|
||||
|
@ -65,9 +70,9 @@
|
|||
order by r.role_sort
|
||||
</select>
|
||||
|
||||
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
|
||||
<select id="selectRolePermissionByUserId" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
WHERE r.del_flag = '0' and ur.user_id = #{userId}
|
||||
WHERE r.firm_code = #{firmCode} AND r.del_flag = '0' and ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectRoleAll" resultMap="SysRoleResult">
|
||||
|
@ -94,7 +99,7 @@
|
|||
|
||||
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
|
||||
where r.firm_code = #{firmCode} AND r.role_name=#{roleName} and r.del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
|
||||
|
@ -105,6 +110,7 @@
|
|||
<insert id="insertRole" parameterType="com.muyu.common.system.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
||||
insert into sys_role(
|
||||
<if test="roleId != null and roleId != 0">role_id,</if>
|
||||
<if test="firmCode != null and firmCode != ''">firm_code,</if>
|
||||
<if test="roleName != null and roleName != ''">role_name,</if>
|
||||
<if test="roleKey != null and roleKey != ''">role_key,</if>
|
||||
<if test="roleSort != null">role_sort,</if>
|
||||
|
@ -117,6 +123,7 @@
|
|||
create_time
|
||||
)values(
|
||||
<if test="roleId != null and roleId != 0">#{roleId},</if>
|
||||
<if test="firmCode != null and firmCode != ''">#{firmCode},</if>
|
||||
<if test="roleName != null and roleName != ''">#{roleName},</if>
|
||||
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
|
||||
<if test="roleSort != null">#{roleSort},</if>
|
||||
|
@ -133,6 +140,7 @@
|
|||
<update id="updateRole" parameterType="com.muyu.common.system.domain.SysRole">
|
||||
update sys_role
|
||||
<set>
|
||||
<if test="firmCode != null and firmCode != ''">firm_code = #{firmCode},</if>
|
||||
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
|
||||
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
|
||||
<if test="roleSort != null">role_sort = #{roleSort},</if>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<resultMap type="com.muyu.common.system.domain.SysUser" id="SysUserResult">
|
||||
<id property="userId" column="user_id"/>
|
||||
<result property="isAdmin" column="is_admin"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="firmCode" column="firm_code"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
|
@ -49,6 +50,7 @@
|
|||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id,
|
||||
u.is_admin,
|
||||
u.dept_id,
|
||||
u.firm_code,
|
||||
u.user_name,
|
||||
|
@ -85,7 +87,7 @@
|
|||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name,u.firm_code, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||
select u.user_id, u.dept_id,u.is_admin, u.nick_name,u.firm_code, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||
u.del_flag,u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
|
||||
u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
|
@ -120,7 +122,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectAllocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id,u.firm_code, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
select distinct u.user_id,u.is_admin, u.dept_id,u.firm_code, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
|
@ -137,7 +139,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectUnallocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id,u.firm_code, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
select distinct u.user_id,u.is_admin, u.dept_id,u.firm_code, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
|
@ -197,6 +199,7 @@
|
|||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="isAdmin != null and isAdmin != 0">is_admin,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="firmCode != null and firmCode != ''">firm_code,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
|
@ -212,6 +215,7 @@
|
|||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="isAdmin != null and isAdmin != ''">#{isAdmin},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="firmCode != null and firmCode != ''">#{firmCode},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
|
|
Loading…
Reference in New Issue