提交 735f0a96 编写于 作者: zhouweidong's avatar zhouweidong

clean

上级 db51b8e5
<?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>
<artifactId>ou-app</artifactId>
<groupId>cn.ibizlab</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>ou-app-web</artifactId>
<name>Ou Gateway web</name>
<description>Ou web</description>
<dependencies>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ou-util</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>web</id>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<!--注意此次必须要放在此目录下才能被访问到 -->
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>exec-yarn-run-install</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<workingDirectory>../../app_web</workingDirectory>
</configuration>
</execution>
<execution>
<id>exec-yarn-run-build</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument>build</argument>
</arguments>
<workingDirectory>../../app_web</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>ou-app-web</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>cn.ibizlab.web.webApplication</mainClass>
<outputDirectory>../../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
FROM openjdk:8-jre-alpine
ENV TZ=Asia/Shanghai \
SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
IBIZ_SLEEP=0 \
JAVA_OPTS=""
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ou-app-web.jar
EXPOSE 8080
ADD ou-app-web.jar /ou-app-web.jar
version: "3.2"
services:
ou-app-web:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ou-app-web:latest
ports:
- "8080:8080"
networks:
- agent_network
deploy:
resources:
limits:
memory: 800M
reservations:
memory: 400M
mode: replicated
replicas: 1
volumes:
- "nfs:/app/file"
volumes:
nfs:
driver: local
driver_opts:
type: "nfs"
o: "addr=172.16.240.109,rw"
device: ":/nfs"
networks:
agent_network:
driver: overlay
attachable: true
package cn.ibizlab.web.config;
import cn.ibizlab.util.security.AuthenticationEntryPoint;
import cn.ibizlab.util.security.AuthorizationTokenFilter;
import cn.ibizlab.util.service.AuthenticationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.context.annotation.Profile;
import org.springframework.beans.factory.annotation.Qualifier;
@Profile("web-prod")
@Configuration
@EnableWebSecurity
public class webSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
private AuthenticationUserService userDetailsService;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.auth.logoutpath:v7/logout}")
private String logoutPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
@Value("${ibiz.file.downloadpath:ibizutil/download}")
private String downloadpath;
@Value("${ibiz.file.previewpath:ibizutil/preview}")
private String previewpath;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoderBean());
}
@Bean
GrantedAuthorityDefaults grantedAuthorityDefaults() {
// Remove the ROLE_ prefix
return new GrantedAuthorityDefaults("");
}
@Bean
public PasswordEncoder passwordEncoderBean() {
return new BCryptPasswordEncoder();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(
HttpMethod.GET,
"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/**/*.ico",
"/**/assets/**",
"/**/css/**",
"/**/fonts/**",
"/**/js/**",
"/**/img/**",
"/**/svg/**",
"/"
).permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
//放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
}
package cn.ibizlab.web;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@Import({
FeignClientsConfiguration.class
})
@EnableDiscoveryClient
@Configuration
@EnableFeignClients(basePackages = {"cn.ibizlab" })
@EnableZuulProxy
@ComponentScan(basePackages = {"cn.ibizlab.web","cn.ibizlab.util"})
@MapperScan("cn.ibizlab.*.mapper")
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
})
public class webApplication extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(webApplication.class,args);
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(resolver);
}
}
server:
port: 8080
#Log配置
logging:
level:
cn.ibizlab: info
#zuul网关路由设置
zuul:
routes:
sys_post:
path: /sysposts/**
serviceId: ${ibiz.ref.service.ibzou-api:ibzou-api}
stripPrefix: false
sys_dept:
path: /sysdepartments/**
serviceId: ${ibiz.ref.service.ibzou-api:ibzou-api}
stripPrefix: false
sys_emp:
path: /sysemployees/**
serviceId: ${ibiz.ref.service.ibzou-api:ibzou-api}
stripPrefix: false
sys_team:
path: /systeams/**
serviceId: ${ibiz.ref.service.ibzou-api:ibzou-api}
stripPrefix: false
sys_org:
path: /sysorganizations/**
serviceId: ${ibiz.ref.service.ibzou-api:ibzou-api}
stripPrefix: false
sys_teammember:
path: /systeammembers/**
serviceId: ${ibiz.ref.service.ibzou-api:ibzou-api}
stripPrefix: false
sys_deptmember:
path: /sysdeptmembers/**
serviceId: ${ibiz.ref.service.ibzou-api:ibzou-api}
stripPrefix: false
loginv7:
path: /v7/login
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
changepwd:
path: /v7/changepwd
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
uaa:
path: /uaa/**
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
config:
path: /config/**
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
sensitive-headers:
- Cookie,Set-Cookie,Authorization
spring:
profiles:
include: sys ,nacos, web-prod
application:
name: ibzou-web
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<property name="LOG_PATH" value="logs" />
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %-40.40logger{39} : %msg%n" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="LOG_PATTERN2" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr([${LOG_LEVEL_PATTERN:-%5p}]) %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
<!-- 控制台输出 -->
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_PATH}/ibzou-web.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="Console" />
<appender-ref ref="file" />
</root>
</configuration>
<?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>
<artifactId>ou</artifactId>
<groupId>cn.ibizlab</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>ou-app</artifactId>
<name>Ou Application</name>
<description>Ou Application</description>
<packaging>pom</packaging>
<modules>
<module>ou-app-web</module>
</modules>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
</dependencies>
</project>
<?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>
<artifactId>ou</artifactId>
<groupId>cn.ibizlab</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>ou-boot</artifactId>
<name>Ou Dev Monolithic Boot</name>
<description>Ou Boot</description>
<dependencies>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ou-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ou-provider-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ou-app-web</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<!--由于boot是通过dependency来关联所有子项目,页面和配置等信息都存在与子项目中,
所以您在对boot进行打包前,需要先将子项目install到maven仓库,以确保boot可以正常引用所有完整的子项目-->
<profiles>
<profile>
<id>boot</id>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>ou</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>cn.ibizlab.DevBootApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
version: "3.2"
services:
ibzou-nacos:
image: nacos/nacos-server:latest
container_name: nacos-standalone
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
ports:
- "8848:8848"
networks:
- agent_network
networks:
agent_network:
attachable: true
version: "3.2"
services:
ibzou-redis:
image: redis
ports:
- 6379:6379
environment:
- TZ=Asia/Shanghai
logging:
driver: "json-file"
command: redis-server
networks:
- agent_network
networks:
agent_network:
attachable: true
package cn.ibizlab;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.util.List;
import cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@EnableDiscoveryClient
@Configuration
@EnableTransactionManagement
@EnableFeignClients(basePackages = {"cn.ibizlab" })
@SpringBootApplication(exclude = {
})
@ComponentScan(basePackages = {"cn.ibizlab"}
// ,excludeFilters={
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="cn.ibizlab.xxx.rest.xxx"),
// }
)
@Import({
org.springframework.cloud.openfeign.FeignClientsConfiguration.class
})
@EnableAsync
@EnableScheduling
public class DevBootApplication extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class,args);
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(resolver);
}
}
package cn.ibizlab.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
public class DevBootAutoConfiguration {
}
package cn.ibizlab.config;
import cn.ibizlab.util.security.AuthenticationEntryPoint;
import cn.ibizlab.util.security.AuthorizationTokenFilter;
import cn.ibizlab.util.service.AuthenticationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
private AuthenticationUserService userDetailsService;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoderBean());
}
@Bean
GrantedAuthorityDefaults grantedAuthorityDefaults() {
// Remove the ROLE_ prefix
return new GrantedAuthorityDefaults("");
}
@Bean
public PasswordEncoder passwordEncoderBean() {
return new BCryptPasswordEncoder();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(
HttpMethod.GET,
"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/**/*.ico",
"/**/assets/**",
"/**/css/**",
"/**/fonts/**",
"/**/js/**",
"/**/img/**",
"/"
).permitAll()
.antMatchers("/ibzou/org/**").permitAll()
.antMatchers("/ibzemployees/**/oumaps").permitAll()
.antMatchers("/dictionarys/**").permitAll()
.antMatchers("/sysemployees/**/oumaps").permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
.anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
}
server:
port: 8080
#zuul网关路由设置
zuul:
routes:
loginv7:
path: /v7/login
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
changepwd:
path: /v7/changepwd
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
uaa:
path: /uaa/**
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
config:
path: /config/**
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
sensitive-headers:
- Cookie,Set-Cookie,Authorization
spring:
profiles:
include: sys ,nacos, web-dev, api-dev, dev
application:
name: ibzou
main:
allow-bean-definition-overriding: true
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<property name="LOG_PATH" value="logs" />
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %-40.40logger{39} : %msg%n" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="LOG_PATTERN2" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr([${LOG_LEVEL_PATTERN:-%5p}]) %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
<!-- 控制台输出 -->
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_PATH}/ibzou.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="Console" />
<appender-ref ref="file" />
</root>
</configuration>
<?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>
<artifactId>ou</artifactId>
<groupId>cn.ibizlab</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>ou-core</artifactId>
<name>Ou Core</name>
<description>Ou Core</description>
<dependencies>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ou-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<!-- JBPM -->
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<!-- Drools -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<!-- MySQL数据库 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Druid阿里连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<!--MapStruct高性能属性映射工具-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
</dependency>
<!--MongoDB-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!--Liquibase数据库版本更新工具-->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<!--baomidou-jobs定时服务 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>jobs-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
<profiles>
<profile>
<id>diff</id>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<executions>
<execution>
<id>prepare-newdb</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/h2_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>prepare-olddb</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/master_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>make-diff</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/empty.xml</changeLogFile>
<diffChangeLogFile>${project.basedir}/src/main/resources/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<password></password>
<referenceUrl>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</referenceUrl>
<referenceDriver>org.h2.Driver</referenceDriver>
<referenceUsername>root</referenceUsername>
<verbose>true</verbose>
<logging>debug</logging>
<contexts>!test</contexts>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit,ibzcfg,IBZFILE,IBZUSER,IBZDATAAUDIT,IBZCFG</diffExcludeObjects>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>diff</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.ou.service.impl.SysEmployeeServiceImpl;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.core.ou.domain.SysEmployee;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[人员] 自定义服务对象
*/
@Slf4j
@Primary
@Service("SysEmployeeExService")
public class SysEmployeeExService extends SysEmployeeServiceImpl {
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
/**
* 自定义行为[InitPwd]用户扩展
* @param et
* @return
*/
@Override
@Transactional
public SysEmployee initPwd(SysEmployee et) {
return super.initPwd(et);
}
}
package cn.ibizlab.core.ou.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[部门]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZDEPT",resultMap = "SysDepartmentResultMap")
public class SysDepartment extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门标识
*/
@DEField(isKeyField=true)
@TableId(value= "deptid",type=IdType.ASSIGN_UUID)
@JSONField(name = "deptid")
@JsonProperty("deptid")
private String deptid;
/**
* 部门代码
*/
@TableField(value = "deptcode")
@JSONField(name = "deptcode")
@JsonProperty("deptcode")
private String deptcode;
/**
* 部门名称
*/
@TableField(value = "deptname")
@JSONField(name = "deptname")
@JsonProperty("deptname")
private String deptname;
/**
* 单位
*/
@DEField(preType = DEPredefinedFieldType.ORGID)
@TableField(value = "orgid")
@JSONField(name = "orgid")
@JsonProperty("orgid")
private String orgid;
/**
* 上级部门
*/
@DEField(name = "pdeptid")
@TableField(value = "pdeptid")
@JSONField(name = "parentdeptid")
@JsonProperty("parentdeptid")
private String parentdeptid;
/**
* 部门简称
*/
@TableField(value = "shortname")
@JSONField(name = "shortname")
@JsonProperty("shortname")
private String shortname;
/**
* 部门级别
*/
@TableField(value = "deptlevel")
@JSONField(name = "deptlevel")
@JsonProperty("deptlevel")
private Integer deptlevel;
/**
* 区属
*/
@TableField(value = "domains")
@JSONField(name = "domains")
@JsonProperty("domains")
private String domains;
/**
* 排序
*/
@TableField(value = "showorder")
@JSONField(name = "showorder")
@JsonProperty("showorder")
private Integer showorder;
/**
* 业务编码
*/
@TableField(value = "bcode")
@JSONField(name = "bcode")
@JsonProperty("bcode")
private String bcode;
/**
* 分管领导标识
*/
@TableField(value = "leaderid")
@JSONField(name = "leaderid")
@JsonProperty("leaderid")
private String leaderid;
/**
* 分管领导
*/
@TableField(value = "leadername")
@JSONField(name = "leadername")
@JsonProperty("leadername")
private String leadername;
/**
* 逻辑有效
*/
@DEField(preType = DEPredefinedFieldType.LOGICVALID, logicval = "1" , logicdelval="0")
@TableLogic(value= "1",delval="0")
@TableField(value = "enable")
@JSONField(name = "enable")
@JsonProperty("enable")
private Integer enable;
/**
* 单位
*/
@TableField(exist = false)
@JSONField(name = "orgname")
@JsonProperty("orgname")
private String orgname;
/**
* 上级部门
*/
@TableField(exist = false)
@JSONField(name = "parentdeptname")
@JsonProperty("parentdeptname")
private String parentdeptname;
/**
* 创建时间
*/
@DEField(preType = DEPredefinedFieldType.CREATEDATE)
@TableField(value = "createdate" , fill = FieldFill.INSERT)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate")
private Timestamp createdate;
/**
* 最后修改时间
*/
@DEField(preType = DEPredefinedFieldType.UPDATEDATE)
@TableField(value = "updatedate")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
private Timestamp updatedate;
/**
*
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysDepartment parentdept;
/**
* 单位
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysOrganization org;
/**
* 设置 [部门代码]
*/
public void setDeptcode(String deptcode){
this.deptcode = deptcode ;
this.modify("deptcode",deptcode);
}
/**
* 设置 [部门名称]
*/
public void setDeptname(String deptname){
this.deptname = deptname ;
this.modify("deptname",deptname);
}
/**
* 设置 [上级部门]
*/
public void setParentdeptid(String parentdeptid){
this.parentdeptid = parentdeptid ;
this.modify("pdeptid",parentdeptid);
}
/**
* 设置 [部门简称]
*/
public void setShortname(String shortname){
this.shortname = shortname ;
this.modify("shortname",shortname);
}
/**
* 设置 [部门级别]
*/
public void setDeptlevel(Integer deptlevel){
this.deptlevel = deptlevel ;
this.modify("deptlevel",deptlevel);
}
/**
* 设置 [区属]
*/
public void setDomains(String domains){
this.domains = domains ;
this.modify("domains",domains);
}
/**
* 设置 [排序]
*/
public void setShoworder(Integer showorder){
this.showorder = showorder ;
this.modify("showorder",showorder);
}
/**
* 设置 [业务编码]
*/
public void setBcode(String bcode){
this.bcode = bcode ;
this.modify("bcode",bcode);
}
/**
* 设置 [分管领导标识]
*/
public void setLeaderid(String leaderid){
this.leaderid = leaderid ;
this.modify("leaderid",leaderid);
}
/**
* 设置 [分管领导]
*/
public void setLeadername(String leadername){
this.leadername = leadername ;
this.modify("leadername",leadername);
}
}
package cn.ibizlab.core.ou.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[部门成员]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZDEPTMEMBER",resultMap = "SysDeptMemberResultMap")
public class SysDeptMember extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 标识
*/
@DEField(isKeyField=true)
@TableId(value= "memberid",type=IdType.ASSIGN_UUID)
@JSONField(name = "memberid")
@JsonProperty("memberid")
private String memberid;
/**
* 部门标识
*/
@TableField(value = "deptid")
@JSONField(name = "deptid")
@JsonProperty("deptid")
private String deptid;
/**
* 部门名称
*/
@TableField(exist = false)
@JSONField(name = "deptname")
@JsonProperty("deptname")
private String deptname;
/**
* 用户标识
*/
@TableField(value = "userid")
@JSONField(name = "userid")
@JsonProperty("userid")
private String userid;
/**
* 成员
*/
@TableField(exist = false)
@JSONField(name = "personname")
@JsonProperty("personname")
private String personname;
/**
* 岗位标识
*/
@TableField(value = "postid")
@JSONField(name = "postid")
@JsonProperty("postid")
private String postid;
/**
* 岗位名称
*/
@TableField(exist = false)
@JSONField(name = "postname")
@JsonProperty("postname")
private String postname;
/**
* 业务条线
*/
@TableField(exist = false)
@JSONField(name = "bcode")
@JsonProperty("bcode")
private String bcode;
/**
* 区属
*/
@TableField(value = "domains")
@JSONField(name = "domains")
@JsonProperty("domains")
private String domains;
/**
* 部门
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysDepartment dept;
/**
* 人员
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysEmployee emp;
/**
* 岗位
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysPost post;
/**
* 设置 [部门标识]
*/
public void setDeptid(String deptid){
this.deptid = deptid ;
this.modify("deptid",deptid);
}
/**
* 设置 [用户标识]
*/
public void setUserid(String userid){
this.userid = userid ;
this.modify("userid",userid);
}
/**
* 设置 [岗位标识]
*/
public void setPostid(String postid){
this.postid = postid ;
this.modify("postid",postid);
}
/**
* 设置 [区属]
*/
public void setDomains(String domains){
this.domains = domains ;
this.modify("domains",domains);
}
/**
* 获取 [标识]
*/
public String getMemberid(){
if(ObjectUtils.isEmpty(memberid)){
memberid=(String)getDefaultKey(true);
}
return memberid;
}
@Override
public Serializable getDefaultKey(boolean gen) {
if((!ObjectUtils.isEmpty(this.getDeptid()))&&(!ObjectUtils.isEmpty(this.getUserid())))
return DigestUtils.md5DigestAsHex(String.format("%s||%s" ,this.getDeptid(),this.getUserid()).getBytes());
return null;
}
}
package cn.ibizlab.core.ou.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[单位机构]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZORG",resultMap = "SysOrganizationResultMap")
public class SysOrganization extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 单位标识
*/
@DEField(defaultValue = "orgcode" , defaultValueType = DEFieldDefaultValueType.PARAM , isKeyField=true)
@TableId(value= "orgid",type=IdType.ASSIGN_UUID)
@JSONField(name = "orgid")
@JsonProperty("orgid")
private String orgid;
/**
* 单位代码
*/
@TableField(value = "orgcode")
@JSONField(name = "orgcode")
@JsonProperty("orgcode")
private String orgcode;
/**
* 名称
*/
@DEField(preType = DEPredefinedFieldType.ORGNAME)
@TableField(value = "orgname")
@JSONField(name = "orgname")
@JsonProperty("orgname")
private String orgname;
/**
* 上级单位
*/
@DEField(name = "porgid")
@TableField(value = "porgid")
@JSONField(name = "parentorgid")
@JsonProperty("parentorgid")
private String parentorgid;
/**
* 单位简称
*/
@TableField(value = "shortname")
@JSONField(name = "shortname")
@JsonProperty("shortname")
private String shortname;
/**
* 单位级别
*/
@TableField(value = "orglevel")
@JSONField(name = "orglevel")
@JsonProperty("orglevel")
private Integer orglevel;
/**
* 排序
*/
@TableField(value = "showorder")
@JSONField(name = "showorder")
@JsonProperty("showorder")
private Integer showorder;
/**
* 上级单位
*/
@TableField(exist = false)
@JSONField(name = "parentorgname")
@JsonProperty("parentorgname")
private String parentorgname;
/**
* 区属
*/
@TableField(value = "domains")
@JSONField(name = "domains")
@JsonProperty("domains")
private String domains;
/**
* 逻辑有效
*/
@DEField(preType = DEPredefinedFieldType.LOGICVALID, logicval = "1" , logicdelval="0")
@TableLogic(value= "1",delval="0")
@TableField(value = "enable")
@JSONField(name = "enable")
@JsonProperty("enable")
private Integer enable;
/**
* 创建时间
*/
@DEField(preType = DEPredefinedFieldType.CREATEDATE)
@TableField(value = "createdate" , fill = FieldFill.INSERT)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate")
private Timestamp createdate;
/**
* 最后修改时间
*/
@DEField(preType = DEPredefinedFieldType.UPDATEDATE)
@TableField(value = "updatedate")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
private Timestamp updatedate;
/**
*
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysOrganization parentorg;
/**
* 部门
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.ou.domain.SysDepartment> depts;
/**
* 设置 [单位代码]
*/
public void setOrgcode(String orgcode){
this.orgcode = orgcode ;
this.modify("orgcode",orgcode);
}
/**
* 设置 [上级单位]
*/
public void setParentorgid(String parentorgid){
this.parentorgid = parentorgid ;
this.modify("porgid",parentorgid);
}
/**
* 设置 [单位简称]
*/
public void setShortname(String shortname){
this.shortname = shortname ;
this.modify("shortname",shortname);
}
/**
* 设置 [单位级别]
*/
public void setOrglevel(Integer orglevel){
this.orglevel = orglevel ;
this.modify("orglevel",orglevel);
}
/**
* 设置 [排序]
*/
public void setShoworder(Integer showorder){
this.showorder = showorder ;
this.modify("showorder",showorder);
}
/**
* 设置 [区属]
*/
public void setDomains(String domains){
this.domains = domains ;
this.modify("domains",domains);
}
}
package cn.ibizlab.core.ou.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[岗位]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZPOST",resultMap = "SysPostResultMap")
public class SysPost extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 岗位标识
*/
@DEField(defaultValue = "postcode" , defaultValueType = DEFieldDefaultValueType.PARAM , isKeyField=true)
@TableId(value= "postid",type=IdType.ASSIGN_UUID)
@JSONField(name = "postid")
@JsonProperty("postid")
private String postid;
/**
* 岗位编码
*/
@TableField(value = "postcode")
@JSONField(name = "postcode")
@JsonProperty("postcode")
private String postcode;
/**
* 岗位名称
*/
@TableField(value = "postname")
@JSONField(name = "postname")
@JsonProperty("postname")
private String postname;
/**
* 区属
*/
@TableField(value = "domains")
@JSONField(name = "domains")
@JsonProperty("domains")
private String domains;
/**
* 备注
*/
@TableField(value = "memo")
@JSONField(name = "memo")
@JsonProperty("memo")
private String memo;
/**
* 设置 [岗位编码]
*/
public void setPostcode(String postcode){
this.postcode = postcode ;
this.modify("postcode",postcode);
}
/**
* 设置 [岗位名称]
*/
public void setPostname(String postname){
this.postname = postname ;
this.modify("postname",postname);
}
/**
* 设置 [区属]
*/
public void setDomains(String domains){
this.domains = domains ;
this.modify("domains",domains);
}
/**
* 设置 [备注]
*/
public void setMemo(String memo){
this.memo = memo ;
this.modify("memo",memo);
}
}
package cn.ibizlab.core.ou.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[组]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZTEAM",resultMap = "SysTeamResultMap")
public class SysTeam extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 组标识
*/
@DEField(isKeyField=true)
@TableId(value= "teamid",type=IdType.ASSIGN_UUID)
@JSONField(name = "teamid")
@JsonProperty("teamid")
private String teamid;
/**
* 组名称
*/
@TableField(value = "teamname")
@JSONField(name = "teamname")
@JsonProperty("teamname")
private String teamname;
/**
* 备注
*/
@TableField(value = "memo")
@JSONField(name = "memo")
@JsonProperty("memo")
private String memo;
/**
* 区属
*/
@TableField(value = "domains")
@JSONField(name = "domains")
@JsonProperty("domains")
private String domains;
/**
* 设置 [组名称]
*/
public void setTeamname(String teamname){
this.teamname = teamname ;
this.modify("teamname",teamname);
}
/**
* 设置 [备注]
*/
public void setMemo(String memo){
this.memo = memo ;
this.modify("memo",memo);
}
/**
* 设置 [区属]
*/
public void setDomains(String domains){
this.domains = domains ;
this.modify("domains",domains);
}
}
package cn.ibizlab.core.ou.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[组成员]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZTEAMMEMBER",resultMap = "SysTeamMemberResultMap")
public class SysTeamMember extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 组成员标识
*/
@DEField(isKeyField=true)
@TableId(value= "teammemberid",type=IdType.ASSIGN_UUID)
@JSONField(name = "teammemberid")
@JsonProperty("teammemberid")
private String teammemberid;
/**
* 组标识
*/
@TableField(value = "teamid")
@JSONField(name = "teamid")
@JsonProperty("teamid")
private String teamid;
/**
* 组名称
*/
@TableField(exist = false)
@JSONField(name = "teamname")
@JsonProperty("teamname")
private String teamname;
/**
* 用户标识
*/
@TableField(value = "userid")
@JSONField(name = "userid")
@JsonProperty("userid")
private String userid;
/**
* 姓名
*/
@TableField(exist = false)
@JSONField(name = "personname")
@JsonProperty("personname")
private String personname;
/**
* 岗位标识
*/
@TableField(value = "postid")
@JSONField(name = "postid")
@JsonProperty("postid")
private String postid;
/**
* 岗位
*/
@TableField(exist = false)
@JSONField(name = "postname")
@JsonProperty("postname")
private String postname;
/**
* 区属
*/
@TableField(value = "domains")
@JSONField(name = "domains")
@JsonProperty("domains")
private String domains;
/**
*
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysEmployee emp;
/**
* 岗位
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysPost post;
/**
*
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.core.ou.domain.SysTeam team;
/**
* 设置 [组标识]
*/
public void setTeamid(String teamid){
this.teamid = teamid ;
this.modify("teamid",teamid);
}
/**
* 设置 [用户标识]
*/
public void setUserid(String userid){
this.userid = userid ;
this.modify("userid",userid);
}
/**
* 设置 [岗位标识]
*/
public void setPostid(String postid){
this.postid = postid ;
this.modify("postid",postid);
}
/**
* 设置 [区属]
*/
public void setDomains(String domains){
this.domains = domains ;
this.modify("domains",domains);
}
/**
* 获取 [组成员标识]
*/
public String getTeammemberid(){
if(ObjectUtils.isEmpty(teammemberid)){
teammemberid=(String)getDefaultKey(true);
}
return teammemberid;
}
@Override
public Serializable getDefaultKey(boolean gen) {
if((!ObjectUtils.isEmpty(this.getTeamid()))&&(!ObjectUtils.isEmpty(this.getUserid())))
return DigestUtils.md5DigestAsHex(String.format("%s||%s" ,this.getTeamid(),this.getUserid()).getBytes());
return null;
}
}
package cn.ibizlab.core.ou.extensions.aspect;
import cn.ibizlab.core.ou.extensions.service.OUModelService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* 实体属性默认值切面,只有新建(Create)时才会填充默认值
*/
@Aspect
@Order(0)
@Component
public class OUModelRefreshAspect
{
@Autowired
@Lazy
private OUModelService ouModelService;
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.creat*(..))")
public void AfterCreateOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.updat*(..))")
public void AfterUpdateOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.remov*(..))")
public void AfterRemoveOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.sav*(..))")
public void AfterSaveOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.creat*(..))")
public void AfterCreateDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.updat*(..))")
public void AfterUpdateDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.remov*(..))")
public void AfterRemoveDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.sav*(..))")
public void AfterSaveDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
}
package cn.ibizlab.core.ou.extensions.domain;
import cn.ibizlab.core.ou.domain.SysDepartment;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.LinkedHashSet;
import java.util.Set;
@Data
public class DeptMap {
private String deptid;
private SysDepartment dept;
private Set<String> parent=new LinkedHashSet<>();
private Set<String> sub=new LinkedHashSet<>();
private Set<String> father=new LinkedHashSet<>();
private Set<String> children=new LinkedHashSet<>();
public String getDeptid()
{
if(StringUtils.isEmpty(deptid)&&dept!=null)
deptid=dept.getDeptid();
return deptid;
}
public Set<String> getSub()
{
if(sub.size()==0&&(dept!=null||(!StringUtils.isEmpty(getDeptid()))))
sub.add(getDeptid());
return sub;
}
public Set<String> getParent()
{
if(parent.size()==0&&dept!=null&&(!StringUtils.isEmpty(dept.getParentdeptid())))
parent.add(dept.getParentdeptid());
return parent;
}
public Set<String> getFather()
{
if(father.size()==0&&getParent().size()>0)
father.add(parent.iterator().next());
return father;
}
}
package cn.ibizlab.core.ou.extensions.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class DeptNode {
@JSONField(name = "id")
@JsonProperty("id")
private String deptid;
@JSONField(name = "label")
@JsonProperty("label")
private String deptname;
@JSONField(name = "code")
@JsonProperty("code")
private String deptcode;
@JSONField(name = "level")
@JsonProperty("level")
private Integer deptlevel;
@JSONField(name = "bcode")
@JsonProperty("bcode")
private String bcode;
@JSONField(name = "filter")
@JsonProperty("filter")
private List<String> filter = new ArrayList<>();
private List<DeptNode> children = new ArrayList<>();
private boolean disabled = false;
public boolean getIsLeaf()
{
return children.size()==0;
}
}
package cn.ibizlab.core.ou.extensions.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class EmpNode {
@JSONField(name = "id")
@JsonProperty("id")
private String userid;
@JSONField(name = "label")
@JsonProperty("label")
private String personname;
@JSONField(name = "code")
@JsonProperty("code")
private String usercode;
private String loginname;
private String domains;
private String username;
private String bcode;
private String mdeptid;
private String mdeptcode;
private String mdeptname;
private String postid;
private String postcode;
private String postname;
private String orgid;
private String orgcode;
private String orgname;
private String nickname;
private String sex;
private String certcode;
private String phone;
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(format="yyyy-MM-dd")
private Timestamp birthday;
private String email;
private String avatar;
private String addr;
public String getGroup()
{
return mdeptname;
}
}
package cn.ibizlab.core.ou.extensions.domain;
import cn.ibizlab.core.ou.domain.SysOrganization;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.LinkedHashSet;
import java.util.Set;
@Data
public class OrgMap {
private String orgid;
private SysOrganization org;
private Set<String> parent=new LinkedHashSet<>();
private Set<String> sub=new LinkedHashSet<>();
private Set<String> father=new LinkedHashSet<>();
private Set<String> children=new LinkedHashSet<>();
public String getOrgid()
{
if(StringUtils.isEmpty(orgid)&&org!=null)
orgid=org.getOrgid();
return orgid;
}
public Set<String> getSub()
{
if(sub.size()==0&&(org!=null||(!StringUtils.isEmpty(getOrgid()))))
sub.add(getOrgid());
return sub;
}
public Set<String> getParent()
{
if(parent.size()==0&&org!=null&&(!StringUtils.isEmpty(org.getParentorgid())))
parent.add(org.getParentorgid());
return parent;
}
public Set<String> getFather()
{
if(father.size()==0&&getParent().size()>0)
father.add(parent.iterator().next());
return father;
}
}
package cn.ibizlab.core.ou.extensions.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class OrgNode {
@JSONField(name = "id")
@JsonProperty("id")
private String orgid;
@JSONField(name = "label")
@JsonProperty("label")
private String orgname;
@JSONField(name = "code")
@JsonProperty("code")
private String orgcode;
@JSONField(name = "level")
@JsonProperty("level")
private Integer orglevel;
@JSONField(name = "filter")
@JsonProperty("filter")
private List<String> filter = new ArrayList<>();
private List<OrgNode> children = new ArrayList<>();
private boolean disabled = false;
public boolean getIsLeaf()
{
return children.size()==0;
}
}
package cn.ibizlab.core.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysDepartment;
import cn.ibizlab.core.ou.extensions.domain.DeptNode;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface SysDept2NodeMapping extends MappingBase<DeptNode, SysDepartment>
{
}
package cn.ibizlab.core.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysEmployee;
import cn.ibizlab.core.ou.extensions.domain.EmpNode;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface SysEmp2NodeMapping extends MappingBase<EmpNode, SysEmployee>
{
}
package cn.ibizlab.core.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysEmployee;
import cn.ibizlab.util.domain.IBZUSER;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface SysEmp2UserMapping extends MappingBase<IBZUSER, SysEmployee>
{
}
package cn.ibizlab.core.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysOrganization;
import cn.ibizlab.core.ou.extensions.domain.OrgNode;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface SysOrg2NodeMapping extends MappingBase<OrgNode, SysOrganization>
{
}
package cn.ibizlab.core.ou.extensions.service;
import cn.ibizlab.core.ou.domain.SysDepartment;
import cn.ibizlab.core.ou.domain.SysEmployee;
import cn.ibizlab.core.ou.domain.SysOrganization;
import cn.ibizlab.core.ou.extensions.domain.*;
import cn.ibizlab.core.ou.extensions.mapping.SysDept2NodeMapping;
import cn.ibizlab.core.ou.extensions.mapping.SysEmp2NodeMapping;
import cn.ibizlab.core.ou.extensions.mapping.SysOrg2NodeMapping;
import cn.ibizlab.core.ou.service.ISysEmployeeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
@Service
public class OUCoreService
{
@Autowired
@Lazy
private OUModelService ouModelService;
@Autowired
@Lazy
private ISysEmployeeService iibzEmployeeService;
public List<SysEmployee> getEmpByOrg(String orgid)
{
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().eq("orgid",orgid).orderByAsc("showorder"));
}
public List<SysEmployee> getEmpByDept(String deptid)
{
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().eq("mdeptid",deptid).orderByAsc("showorder"));
}
public List<SysEmployee> getSubEmpByOrg(String orgid)
{
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>();
Map<String, OrgMap> store=ouModelService.getOrgModel();
OrgMap orgmodel=this.getOrgModel(orgid);
if(orgmodel.getSub().size()==store.size())
return iibzEmployeeService.list();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("orgid",orgmodel.getSub()));
}
public List<SysEmployee> getSubEmpByDept(String deptid)
{
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>();
DeptMap deptmodel=this.getDeptModel(deptid);
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("mdeptid",deptmodel.getSub()));
}
public List<SysEmployee> getParentEmpByOrg(String orgid,boolean bRecurrence)
{
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>();
OrgMap orgmodel=this.getOrgModel(orgid);
List<String> parent=new ArrayList<>();
for(String str:orgmodel.getParent())
{
parent.add(str);
if(!bRecurrence)
break;
}
if(parent.size()==0)
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("orgid",parent));
}
public List<SysEmployee> getParentEmpByDept(String deptid,boolean bRecurrence)
{
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>();
DeptMap deptmodel=this.getDeptModel(deptid);
List<String> parent=new ArrayList<>();
for(String str:deptmodel.getParent())
{
parent.add(str);
if(!bRecurrence)
break;
}
if(parent.size()==0)
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("mdeptid",parent));
}
public OrgMap getOrgModel(String orgid)
{
Map<String, OrgMap> store=ouModelService.getOrgModel();
if(store.containsKey(orgid))
{
OrgMap map = store.get(orgid);
return map;
}
else
{
OrgMap map = new OrgMap();
map.setOrgid(orgid);
return map;
}
}
public DeptMap getDeptModel(String deptid)
{
Map<String, DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
if(store.containsKey(deptid))
{
DeptMap map = store.get(deptid);
return map;
}
else
{
DeptMap map = new DeptMap();
map.setDeptid(deptid);
return map;
}
}
@Autowired
private SysOrg2NodeMapping org2NodeMapping;
public List<OrgNode> getOrgNode(String root)
{
if(StringUtils.isEmpty(root))
root="alls";
List<OrgNode> list=new ArrayList<>();
Map<String,OrgMap> store=ouModelService.getOrgModel();
if(root.equals("alls"))
{
int rootcnt=0;
String tmp="";
for(OrgMap map:store.values()) {
SysOrganization org = map.getOrg();
if(StringUtils.isEmpty(org.getParentorgid())) {
rootcnt++;
tmp=org.getOrgid();
}
}
if(rootcnt==1)
root=tmp;
}
for(OrgMap map:store.values())
{
SysOrganization org=map.getOrg();
String parent=org.getParentorgid();
if(StringUtils.isEmpty(parent))
parent="alls";
if(parent.equals(root)||root.equals(org.getOrgid()))
{
OrgNode node=org2NodeMapping.toDto(org);
node.getFilter().addAll(map.getParent());
node.getFilter().add(node.getOrgid());
if(root.equals(org.getOrgid())) {
list.add(0,node);
}
else {
looporg(node, store);
list.add(node);
}
}
}
return list;
}
private void looporg(OrgNode node,Map<String,OrgMap> store)
{
Set<String> children=store.get(node.getOrgid()).getChildren();
for(String child:children)
{
OrgMap childMap=store.get(child);
OrgNode sub=org2NodeMapping.toDto(childMap.getOrg());
sub.getFilter().addAll(childMap.getParent());
sub.getFilter().add(sub.getOrgid());
node.getChildren().add(sub);
looporg(sub,store);
}
}
@Autowired
private SysDept2NodeMapping dept2NodeMapping;
public List<DeptNode> getDeptNode(String orgid)
{
List<DeptNode> list=new ArrayList<>();
if(StringUtils.isEmpty(orgid))
return list;
Map<String,DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
for(DeptMap map:store.values())
{
SysDepartment dept=map.getDept();
if(StringUtils.isEmpty(dept.getParentdeptid())&&orgid.equals(dept.getOrgid()))
{
DeptNode node=dept2NodeMapping.toDto(dept);
loopdept(node,store);
list.add(node);
}
}
return list;
}
public List<DeptNode> getOrgDeptNode(String orgid)
{
List<DeptNode> list=new ArrayList<>();
if(StringUtils.isEmpty(orgid))
orgid="alls";
Map<String,DeptNode> parentNode=new HashMap<>();
List<OrgNode> listOrg=getOrgNode(orgid);
for(OrgNode org:listOrg)
{
DeptNode node = changeOrgNode2DeptNode(org,parentNode);
list.add(node);
}
Map<String,DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
for(DeptMap map:store.values())
{
SysDepartment dept=map.getDept();
if(StringUtils.isEmpty(dept.getParentdeptid()))
{
DeptNode node=dept2NodeMapping.toDto(dept);
if(parentNode.containsKey(dept.getOrgid())) {
node.setFilter(parentNode.get(dept.getOrgid()).getFilter());
parentNode.get(dept.getOrgid()).getChildren().add(node);
loopdept(node,store);
}
}
}
return list;
}
private void loopdept(DeptNode node,Map<String,DeptMap> store)
{
Set<String> children=store.get(node.getDeptid()).getChildren();
for(String child:children)
{
DeptMap childMap=store.get(child);
DeptNode sub=dept2NodeMapping.toDto(childMap.getDept());
sub.setFilter(node.getFilter());
node.getChildren().add(sub);
loopdept(sub,store);
}
}
private DeptNode changeOrgNode2DeptNode(OrgNode orgnode,Map<String,DeptNode> parentNode)
{
DeptNode node = new DeptNode();
node.setDeptid(orgnode.getOrgid());
node.setDeptname(orgnode.getOrgname());
node.setFilter(orgnode.getFilter());
node.setDisabled(true);
parentNode.put(orgnode.getOrgid(),node);
for(OrgNode org:orgnode.getChildren())
{
node.getChildren().add(changeOrgNode2DeptNode(org,parentNode));
}
return node;
}
@Autowired
private SysEmp2NodeMapping emp2NodeMapping;
public List<EmpNode> getEmpNode(String orgid)
{
List<EmpNode> listemp=new ArrayList<>();
List<String> list=new ArrayList<>();
if(StringUtils.isEmpty(orgid))
return listemp;
Map<String,DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
for(DeptMap map:store.values())
{
SysDepartment dept=map.getDept();
if(StringUtils.isEmpty(dept.getParentdeptid())&&orgid.equals(dept.getOrgid()))
{
list.add(dept.getDeptid());
loopdept(dept.getDeptid(),store,list);
}
}
LinkedHashMap<String,List<EmpNode>> empmap=new LinkedHashMap<>();
for(String deptid:list)
{
empmap.put(deptid,new ArrayList<>());
}
for(EmpNode node:emp2NodeMapping.toDto(this.getEmpByOrg(orgid)))
{
if(empmap.containsKey(node.getMdeptid()))
empmap.get(node.getMdeptid()).add(node);
}
for(String deptid:list)
{
listemp.addAll(empmap.get(deptid));
}
return listemp;
}
private void loopdept(String node,Map<String,DeptMap> store,List<String> list)
{
Set<String> children=store.get(node).getChildren();
for(String child:children)
{
list.add(child);
loopdept(child,store,list);
}
}
}
package cn.ibizlab.core.ou.extensions.service;
import cn.ibizlab.core.ou.domain.SysDepartment;
import cn.ibizlab.core.ou.domain.SysOrganization;
import cn.ibizlab.core.ou.extensions.domain.DeptMap;
import cn.ibizlab.core.ou.extensions.domain.OrgMap;
import cn.ibizlab.core.ou.service.ISysDepartmentService;
import cn.ibizlab.core.ou.service.ISysOrganizationService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
@Service
public class OUModelService
{
@Autowired
private ISysOrganizationService iibzOrganizationService;
@Autowired
private ISysDepartmentService iibzDepartmentService;
private Map<String, OrgMap> orgmap=null;
private Object lockOrg=new Object();
//@Cacheable( value="ibzou-model",key = "'orgmap'")
public Map<String, OrgMap> getOrgModel()
{
if(orgmap!=null)
return orgmap;
synchronized(lockOrg)
{
if(orgmap!=null)
return orgmap;
Map<String, OrgMap> store=new LinkedHashMap<>();
List<SysOrganization> listOrg=iibzOrganizationService.list(new QueryWrapper<SysOrganization>().orderByAsc("showorder","orgcode"));
for(SysOrganization org:listOrg)
{
OrgMap map=new OrgMap();
map.setOrg(org);
store.put(org.getOrgid(),map);
}
for(SysOrganization org:listOrg)
{
loopOrg(org,store);
if(!StringUtils.isEmpty(org.getParentorgid())) {
if (store.containsKey(org.getParentorgid())) {
store.get(org.getParentorgid()).getChildren().add(org.getOrgid());
}
}
}
for(SysOrganization org:listOrg)
{
for(String sub:store.get(org.getOrgid()).getSub())
{
if(!org.getOrgid().equals(sub))
store.get(sub).getParent().add(org.getOrgid());
}
}
orgmap=store;
}
return orgmap;
}
public void loopOrg(SysOrganization org,Map<String, OrgMap> store)
{
if(!StringUtils.isEmpty(org.getParentorgid()))
{
if(store.containsKey(org.getParentorgid()))
{
store.get(org.getParentorgid()).getSub().add(org.getOrgid());
loopOrg(store.get(org.getParentorgid()).getOrg(),store);
}
}
}
private Map<String, DeptMap> deptmap=null;
private Object lockDept=new Object();
//@Cacheable( value="ibzou-model",key = "'deptmap'")
public Map<String, DeptMap> getDeptModel(Map<String, OrgMap> orgstore)
{
if(deptmap!=null)
return deptmap;
synchronized(lockDept)
{
if(deptmap!=null)
return deptmap;
if(orgstore==null)
orgstore=this.getOrgModel();
Map<String, DeptMap> store=new LinkedHashMap<>();
Map<String, Set<String>> bcmap=new HashMap<>();
List<SysDepartment> listDept=iibzDepartmentService.list(new QueryWrapper<SysDepartment>().orderByAsc("showorder","deptcode"));
for(SysDepartment dept:listDept)
{
DeptMap map=new DeptMap();
map.setDept(dept);
store.put(dept.getDeptid(),map);
String bc=dept.getBcode();
if(!StringUtils.isEmpty(bc))
{
bc=bc.replace(";",",").replace(";",",").replace(",",",");
String[] bcs=bc.split(",");
for(String strbc:bcs)
{
strbc=strbc.trim();
if(!StringUtils.isEmpty(strbc))
{
if(!bcmap.containsKey(strbc))
{
Set<String> bcset=new HashSet<>();
bcmap.put(strbc,bcset);
}
bcmap.get(strbc).add(dept.getDeptid()+":"+dept.getOrgid());
}
}
}
}
for(SysDepartment dept:listDept)
{
loopDept(dept,store);
if(!StringUtils.isEmpty(dept.getParentdeptid())) {
if (store.containsKey(dept.getParentdeptid())) {
store.get(dept.getParentdeptid()).getChildren().add(dept.getDeptid());
}
}
}
for(SysDepartment dept:listDept)
{
for(String sub:store.get(dept.getDeptid()).getSub())
{
if(!dept.getDeptid().equals(sub))
store.get(sub).getParent().add(dept.getDeptid());
}
}
for(SysDepartment dept:listDept)
{
String orgid=dept.getOrgid();
if(StringUtils.isEmpty(orgid)||(!orgstore.containsKey(orgid)))
continue;
String bc=dept.getBcode();
if(!StringUtils.isEmpty(bc))
{
bc = bc.replace(";", ",").replace(";", ",").replace(",", ",");
String[] bcs = bc.split(",");
for (String strbc : bcs)
{
strbc = strbc.trim();
if (!StringUtils.isEmpty(strbc))
{
if(bcmap.containsKey(strbc))
{
Set<String> bcset=bcmap.get(strbc);
for(String bcstring:bcset)
{
String[] bcstringarr=bcstring.split(":");
if(bcstringarr.length==2)
{
String bcdept=bcstringarr[0];
String bcorg=bcstringarr[1];
for(String porg:orgstore.get(orgid).getParent())
{
if(bcorg.equals(porg))
store.get(dept.getDeptid()).getParent().add(bcdept);
}
for(String sorg:orgstore.get(orgid).getSub())
{
if(bcorg.equals(sorg))
store.get(dept.getDeptid()).getSub().add(bcdept);
}
}
}
}
}
}
}
}
deptmap=store;
}
return deptmap;
}
public void loopDept(SysDepartment dept,Map<String,DeptMap> store)
{
if(!StringUtils.isEmpty(dept.getParentdeptid()))
{
if(store.containsKey(dept.getParentdeptid()))
{
store.get(dept.getParentdeptid()).getSub().add(dept.getDeptid());
loopDept(store.get(dept.getParentdeptid()).getDept(),store);
}
}
}
@CacheEvict( value="ibzou-model",allEntries = true)
public synchronized void refreshModel()
{
synchronized (lockDept)
{
this.deptmap = null;
}
synchronized (lockOrg)
{
this.orgmap = null;
}
}
}
package cn.ibizlab.core.ou.extensions.service;
import cn.ibizlab.util.domain.IBZUSER;
import cn.ibizlab.util.mapper.IBZUSERMapper;
import cn.ibizlab.util.service.IBZUSERService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
@Service("userservice")
public class SysUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> implements IBZUSERService{
}
\ No newline at end of file
package cn.ibizlab.core.ou.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.ou.domain.SysDepartment;
/**
* 关系型数据实体[SysDepartment] 查询条件对象
*/
@Slf4j
@Data
public class SysDepartmentSearchContext extends QueryWrapperContext<SysDepartment> {
private String n_deptcode_like;//[部门代码]
public void setN_deptcode_like(String n_deptcode_like) {
this.n_deptcode_like = n_deptcode_like;
if(!ObjectUtils.isEmpty(this.n_deptcode_like)){
this.getSearchCond().like("deptcode", n_deptcode_like);
}
}
private String n_deptname_like;//[部门名称]
public void setN_deptname_like(String n_deptname_like) {
this.n_deptname_like = n_deptname_like;
if(!ObjectUtils.isEmpty(this.n_deptname_like)){
this.getSearchCond().like("deptname", n_deptname_like);
}
}
private String n_orgid_eq;//[单位]
public void setN_orgid_eq(String n_orgid_eq) {
this.n_orgid_eq = n_orgid_eq;
if(!ObjectUtils.isEmpty(this.n_orgid_eq)){
this.getSearchCond().eq("orgid", n_orgid_eq);
}
}
private String n_pdeptid_eq;//[上级部门]
public void setN_pdeptid_eq(String n_pdeptid_eq) {
this.n_pdeptid_eq = n_pdeptid_eq;
if(!ObjectUtils.isEmpty(this.n_pdeptid_eq)){
this.getSearchCond().eq("pdeptid", n_pdeptid_eq);
}
}
private String n_bcode_like;//[业务编码]
public void setN_bcode_like(String n_bcode_like) {
this.n_bcode_like = n_bcode_like;
if(!ObjectUtils.isEmpty(this.n_bcode_like)){
this.getSearchCond().like("bcode", n_bcode_like);
}
}
private String n_orgname_eq;//[单位]
public void setN_orgname_eq(String n_orgname_eq) {
this.n_orgname_eq = n_orgname_eq;
if(!ObjectUtils.isEmpty(this.n_orgname_eq)){
this.getSearchCond().eq("orgname", n_orgname_eq);
}
}
private String n_orgname_like;//[单位]
public void setN_orgname_like(String n_orgname_like) {
this.n_orgname_like = n_orgname_like;
if(!ObjectUtils.isEmpty(this.n_orgname_like)){
this.getSearchCond().like("orgname", n_orgname_like);
}
}
private String n_pdeptname_eq;//[上级部门]
public void setN_pdeptname_eq(String n_pdeptname_eq) {
this.n_pdeptname_eq = n_pdeptname_eq;
if(!ObjectUtils.isEmpty(this.n_pdeptname_eq)){
this.getSearchCond().eq("pdeptname", n_pdeptname_eq);
}
}
private String n_pdeptname_like;//[上级部门]
public void setN_pdeptname_like(String n_pdeptname_like) {
this.n_pdeptname_like = n_pdeptname_like;
if(!ObjectUtils.isEmpty(this.n_pdeptname_like)){
this.getSearchCond().like("pdeptname", n_pdeptname_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("deptname", query)
);
}
}
}
package cn.ibizlab.core.ou.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.ou.domain.SysDeptMember;
/**
* 关系型数据实体[SysDeptMember] 查询条件对象
*/
@Slf4j
@Data
public class SysDeptMemberSearchContext extends QueryWrapperContext<SysDeptMember> {
private String n_deptid_eq;//[部门标识]
public void setN_deptid_eq(String n_deptid_eq) {
this.n_deptid_eq = n_deptid_eq;
if(!ObjectUtils.isEmpty(this.n_deptid_eq)){
this.getSearchCond().eq("deptid", n_deptid_eq);
}
}
private String n_deptname_eq;//[部门名称]
public void setN_deptname_eq(String n_deptname_eq) {
this.n_deptname_eq = n_deptname_eq;
if(!ObjectUtils.isEmpty(this.n_deptname_eq)){
this.getSearchCond().eq("deptname", n_deptname_eq);
}
}
private String n_deptname_like;//[部门名称]
public void setN_deptname_like(String n_deptname_like) {
this.n_deptname_like = n_deptname_like;
if(!ObjectUtils.isEmpty(this.n_deptname_like)){
this.getSearchCond().like("deptname", n_deptname_like);
}
}
private String n_userid_eq;//[用户标识]
public void setN_userid_eq(String n_userid_eq) {
this.n_userid_eq = n_userid_eq;
if(!ObjectUtils.isEmpty(this.n_userid_eq)){
this.getSearchCond().eq("userid", n_userid_eq);
}
}
private String n_personname_eq;//[成员]
public void setN_personname_eq(String n_personname_eq) {
this.n_personname_eq = n_personname_eq;
if(!ObjectUtils.isEmpty(this.n_personname_eq)){
this.getSearchCond().eq("personname", n_personname_eq);
}
}
private String n_personname_like;//[成员]
public void setN_personname_like(String n_personname_like) {
this.n_personname_like = n_personname_like;
if(!ObjectUtils.isEmpty(this.n_personname_like)){
this.getSearchCond().like("personname", n_personname_like);
}
}
private String n_postid_eq;//[岗位标识]
public void setN_postid_eq(String n_postid_eq) {
this.n_postid_eq = n_postid_eq;
if(!ObjectUtils.isEmpty(this.n_postid_eq)){
this.getSearchCond().eq("postid", n_postid_eq);
}
}
private String n_postname_eq;//[岗位名称]
public void setN_postname_eq(String n_postname_eq) {
this.n_postname_eq = n_postname_eq;
if(!ObjectUtils.isEmpty(this.n_postname_eq)){
this.getSearchCond().eq("postname", n_postname_eq);
}
}
private String n_postname_like;//[岗位名称]
public void setN_postname_like(String n_postname_like) {
this.n_postname_like = n_postname_like;
if(!ObjectUtils.isEmpty(this.n_postname_like)){
this.getSearchCond().like("postname", n_postname_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("personname", query)
);
}
}
}
package cn.ibizlab.core.ou.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.ou.domain.SysEmployee;
/**
* 关系型数据实体[SysEmployee] 查询条件对象
*/
@Slf4j
@Data
public class SysEmployeeSearchContext extends QueryWrapperContext<SysEmployee> {
private String n_personname_like;//[姓名]
public void setN_personname_like(String n_personname_like) {
this.n_personname_like = n_personname_like;
if(!ObjectUtils.isEmpty(this.n_personname_like)){
this.getSearchCond().like("personname", n_personname_like);
}
}
private String n_usercode_like;//[用户工号]
public void setN_usercode_like(String n_usercode_like) {
this.n_usercode_like = n_usercode_like;
if(!ObjectUtils.isEmpty(this.n_usercode_like)){
this.getSearchCond().like("usercode", n_usercode_like);
}
}
private String n_mdeptid_eq;//[主部门]
public void setN_mdeptid_eq(String n_mdeptid_eq) {
this.n_mdeptid_eq = n_mdeptid_eq;
if(!ObjectUtils.isEmpty(this.n_mdeptid_eq)){
this.getSearchCond().eq("mdeptid", n_mdeptid_eq);
}
}
private String n_mdeptname_like;//[主部门名称]
public void setN_mdeptname_like(String n_mdeptname_like) {
this.n_mdeptname_like = n_mdeptname_like;
if(!ObjectUtils.isEmpty(this.n_mdeptname_like)){
this.getSearchCond().like("mdeptname", n_mdeptname_like);
}
}
private String n_bcode_like;//[业务编码]
public void setN_bcode_like(String n_bcode_like) {
this.n_bcode_like = n_bcode_like;
if(!ObjectUtils.isEmpty(this.n_bcode_like)){
this.getSearchCond().like("bcode", n_bcode_like);
}
}
private String n_postid_eq;//[岗位标识]
public void setN_postid_eq(String n_postid_eq) {
this.n_postid_eq = n_postid_eq;
if(!ObjectUtils.isEmpty(this.n_postid_eq)){
this.getSearchCond().eq("postid", n_postid_eq);
}
}
private String n_postname_eq;//[岗位名称]
public void setN_postname_eq(String n_postname_eq) {
this.n_postname_eq = n_postname_eq;
if(!ObjectUtils.isEmpty(this.n_postname_eq)){
this.getSearchCond().eq("postname", n_postname_eq);
}
}
private String n_postname_like;//[岗位名称]
public void setN_postname_like(String n_postname_like) {
this.n_postname_like = n_postname_like;
if(!ObjectUtils.isEmpty(this.n_postname_like)){
this.getSearchCond().like("postname", n_postname_like);
}
}
private String n_orgid_eq;//[单位]
public void setN_orgid_eq(String n_orgid_eq) {
this.n_orgid_eq = n_orgid_eq;
if(!ObjectUtils.isEmpty(this.n_orgid_eq)){
this.getSearchCond().eq("orgid", n_orgid_eq);
}
}
private String n_orgcode_leftlike;//[单位代码]
public void setN_orgcode_leftlike(String n_orgcode_leftlike) {
this.n_orgcode_leftlike = n_orgcode_leftlike;
if(!ObjectUtils.isEmpty(this.n_orgcode_leftlike)){
this.getSearchCond().likeRight("orgcode", n_orgcode_leftlike);
}
}
private String n_sex_eq;//[性别]
public void setN_sex_eq(String n_sex_eq) {
this.n_sex_eq = n_sex_eq;
if(!ObjectUtils.isEmpty(this.n_sex_eq)){
this.getSearchCond().eq("sex", n_sex_eq);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("personname", query)
);
}
}
}
package cn.ibizlab.core.ou.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.ou.domain.SysOrganization;
/**
* 关系型数据实体[SysOrganization] 查询条件对象
*/
@Slf4j
@Data
public class SysOrganizationSearchContext extends QueryWrapperContext<SysOrganization> {
private String n_orgid_like;//[单位标识]
public void setN_orgid_like(String n_orgid_like) {
this.n_orgid_like = n_orgid_like;
if(!ObjectUtils.isEmpty(this.n_orgid_like)){
this.getSearchCond().like("orgid", n_orgid_like);
}
}
private String n_orgcode_leftlike;//[单位代码]
public void setN_orgcode_leftlike(String n_orgcode_leftlike) {
this.n_orgcode_leftlike = n_orgcode_leftlike;
if(!ObjectUtils.isEmpty(this.n_orgcode_leftlike)){
this.getSearchCond().likeRight("orgcode", n_orgcode_leftlike);
}
}
private String n_orgname_like;//[名称]
public void setN_orgname_like(String n_orgname_like) {
this.n_orgname_like = n_orgname_like;
if(!ObjectUtils.isEmpty(this.n_orgname_like)){
this.getSearchCond().like("orgname", n_orgname_like);
}
}
private String n_porgid_eq;//[上级单位]
public void setN_porgid_eq(String n_porgid_eq) {
this.n_porgid_eq = n_porgid_eq;
if(!ObjectUtils.isEmpty(this.n_porgid_eq)){
this.getSearchCond().eq("porgid", n_porgid_eq);
}
}
private String n_shortname_like;//[单位简称]
public void setN_shortname_like(String n_shortname_like) {
this.n_shortname_like = n_shortname_like;
if(!ObjectUtils.isEmpty(this.n_shortname_like)){
this.getSearchCond().like("shortname", n_shortname_like);
}
}
private Integer n_orglevel_gtandeq;//[单位级别]
public void setN_orglevel_gtandeq(Integer n_orglevel_gtandeq) {
this.n_orglevel_gtandeq = n_orglevel_gtandeq;
if(!ObjectUtils.isEmpty(this.n_orglevel_gtandeq)){
this.getSearchCond().ge("orglevel", n_orglevel_gtandeq);
}
}
private Integer n_orglevel_ltandeq;//[单位级别]
public void setN_orglevel_ltandeq(Integer n_orglevel_ltandeq) {
this.n_orglevel_ltandeq = n_orglevel_ltandeq;
if(!ObjectUtils.isEmpty(this.n_orglevel_ltandeq)){
this.getSearchCond().le("orglevel", n_orglevel_ltandeq);
}
}
private String n_porgname_eq;//[上级单位]
public void setN_porgname_eq(String n_porgname_eq) {
this.n_porgname_eq = n_porgname_eq;
if(!ObjectUtils.isEmpty(this.n_porgname_eq)){
this.getSearchCond().eq("porgname", n_porgname_eq);
}
}
private String n_porgname_like;//[上级单位]
public void setN_porgname_like(String n_porgname_like) {
this.n_porgname_like = n_porgname_like;
if(!ObjectUtils.isEmpty(this.n_porgname_like)){
this.getSearchCond().like("porgname", n_porgname_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("orgname", query)
);
}
}
}
package cn.ibizlab.core.ou.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.ou.domain.SysPost;
/**
* 关系型数据实体[SysPost] 查询条件对象
*/
@Slf4j
@Data
public class SysPostSearchContext extends QueryWrapperContext<SysPost> {
private String n_postcode_like;//[岗位编码]
public void setN_postcode_like(String n_postcode_like) {
this.n_postcode_like = n_postcode_like;
if(!ObjectUtils.isEmpty(this.n_postcode_like)){
this.getSearchCond().like("postcode", n_postcode_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("postname", query)
);
}
}
}
package cn.ibizlab.core.ou.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.ou.domain.SysTeamMember;
/**
* 关系型数据实体[SysTeamMember] 查询条件对象
*/
@Slf4j
@Data
public class SysTeamMemberSearchContext extends QueryWrapperContext<SysTeamMember> {
private String n_teammemberid_like;//[组成员标识]
public void setN_teammemberid_like(String n_teammemberid_like) {
this.n_teammemberid_like = n_teammemberid_like;
if(!ObjectUtils.isEmpty(this.n_teammemberid_like)){
this.getSearchCond().like("teammemberid", n_teammemberid_like);
}
}
private String n_teamid_eq;//[组标识]
public void setN_teamid_eq(String n_teamid_eq) {
this.n_teamid_eq = n_teamid_eq;
if(!ObjectUtils.isEmpty(this.n_teamid_eq)){
this.getSearchCond().eq("teamid", n_teamid_eq);
}
}
private String n_teamname_eq;//[组名称]
public void setN_teamname_eq(String n_teamname_eq) {
this.n_teamname_eq = n_teamname_eq;
if(!ObjectUtils.isEmpty(this.n_teamname_eq)){
this.getSearchCond().eq("teamname", n_teamname_eq);
}
}
private String n_teamname_like;//[组名称]
public void setN_teamname_like(String n_teamname_like) {
this.n_teamname_like = n_teamname_like;
if(!ObjectUtils.isEmpty(this.n_teamname_like)){
this.getSearchCond().like("teamname", n_teamname_like);
}
}
private String n_userid_eq;//[用户标识]
public void setN_userid_eq(String n_userid_eq) {
this.n_userid_eq = n_userid_eq;
if(!ObjectUtils.isEmpty(this.n_userid_eq)){
this.getSearchCond().eq("userid", n_userid_eq);
}
}
private String n_personname_eq;//[姓名]
public void setN_personname_eq(String n_personname_eq) {
this.n_personname_eq = n_personname_eq;
if(!ObjectUtils.isEmpty(this.n_personname_eq)){
this.getSearchCond().eq("personname", n_personname_eq);
}
}
private String n_personname_like;//[姓名]
public void setN_personname_like(String n_personname_like) {
this.n_personname_like = n_personname_like;
if(!ObjectUtils.isEmpty(this.n_personname_like)){
this.getSearchCond().like("personname", n_personname_like);
}
}
private String n_postid_eq;//[岗位标识]
public void setN_postid_eq(String n_postid_eq) {
this.n_postid_eq = n_postid_eq;
if(!ObjectUtils.isEmpty(this.n_postid_eq)){
this.getSearchCond().eq("postid", n_postid_eq);
}
}
private String n_postname_eq;//[岗位]
public void setN_postname_eq(String n_postname_eq) {
this.n_postname_eq = n_postname_eq;
if(!ObjectUtils.isEmpty(this.n_postname_eq)){
this.getSearchCond().eq("postname", n_postname_eq);
}
}
private String n_postname_like;//[岗位]
public void setN_postname_like(String n_postname_like) {
this.n_postname_like = n_postname_like;
if(!ObjectUtils.isEmpty(this.n_postname_like)){
this.getSearchCond().like("postname", n_postname_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("personname", query)
);
}
}
}
package cn.ibizlab.core.ou.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.ou.domain.SysTeam;
/**
* 关系型数据实体[SysTeam] 查询条件对象
*/
@Slf4j
@Data
public class SysTeamSearchContext extends QueryWrapperContext<SysTeam> {
private String n_teamid_like;//[组标识]
public void setN_teamid_like(String n_teamid_like) {
this.n_teamid_like = n_teamid_like;
if(!ObjectUtils.isEmpty(this.n_teamid_like)){
this.getSearchCond().like("teamid", n_teamid_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("teamname", query)
);
}
}
}
package cn.ibizlab.core.ou.mapper;
import java.util.List;
import org.apache.ibatis.annotations.*;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.HashMap;
import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.ou.domain.SysDepartment;
import cn.ibizlab.core.ou.filter.SysDepartmentSearchContext;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface SysDepartmentMapper extends BaseMapper<SysDepartment>{
Page<SysDepartment> searchDefault(IPage page, @Param("srf") SysDepartmentSearchContext context, @Param("ew") Wrapper<SysDepartment> wrapper) ;
@Override
@Cacheable( value="sysdepartment",key = "'row:'+#p0")
SysDepartment selectById(Serializable id);
@Override
@CacheEvict( value="sysdepartment",key = "'row:'+#p0.deptid")
int insert(SysDepartment entity);
@Override
@CacheEvict( value="sysdepartment",key = "'row:'+#p0.deptid")
int updateById(@Param(Constants.ENTITY) SysDepartment entity);
@Override
@CacheEvict(value="sysdepartment",key = "'row:'+#p0.deptid")
int update(@Param(Constants.ENTITY) SysDepartment entity, @Param("ew") Wrapper<SysDepartment> updateWrapper);
@Override
@CacheEvict( value="sysdepartment",key = "'row:'+#p0")
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update("${sql}")
boolean updateBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert("${sql}")
boolean insertBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<SysDepartment> selectByParentdeptid(@Param("deptid") Serializable deptid) ;
List<SysDepartment> selectByOrgid(@Param("orgid") Serializable orgid) ;
}
package cn.ibizlab.core.ou.mapper;
import java.util.List;
import org.apache.ibatis.annotations.*;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.HashMap;
import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.ou.domain.SysDeptMember;
import cn.ibizlab.core.ou.filter.SysDeptMemberSearchContext;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface SysDeptMemberMapper extends BaseMapper<SysDeptMember>{
Page<SysDeptMember> searchDefault(IPage page, @Param("srf") SysDeptMemberSearchContext context, @Param("ew") Wrapper<SysDeptMember> wrapper) ;
@Override
SysDeptMember selectById(Serializable id);
@Override
int insert(SysDeptMember entity);
@Override
int updateById(@Param(Constants.ENTITY) SysDeptMember entity);
@Override
int update(@Param(Constants.ENTITY) SysDeptMember entity, @Param("ew") Wrapper<SysDeptMember> updateWrapper);
@Override
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update("${sql}")
boolean updateBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert("${sql}")
boolean insertBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<SysDeptMember> selectByDeptid(@Param("deptid") Serializable deptid) ;
List<SysDeptMember> selectByUserid(@Param("userid") Serializable userid) ;
List<SysDeptMember> selectByPostid(@Param("postid") Serializable postid) ;
}
package cn.ibizlab.core.ou.mapper;
import java.util.List;
import org.apache.ibatis.annotations.*;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.HashMap;
import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.ou.domain.SysEmployee;
import cn.ibizlab.core.ou.filter.SysEmployeeSearchContext;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface SysEmployeeMapper extends BaseMapper<SysEmployee>{
Page<SysEmployee> searchDefault(IPage page, @Param("srf") SysEmployeeSearchContext context, @Param("ew") Wrapper<SysEmployee> wrapper) ;
@Override
@Cacheable( value="sysemployee",key = "'row:'+#p0")
SysEmployee selectById(Serializable id);
@Override
@CacheEvict( value="sysemployee",key = "'row:'+#p0.userid")
int insert(SysEmployee entity);
@Override
@CacheEvict( value="sysemployee",key = "'row:'+#p0.userid")
int updateById(@Param(Constants.ENTITY) SysEmployee entity);
@Override
@CacheEvict(value="sysemployee",key = "'row:'+#p0.userid")
int update(@Param(Constants.ENTITY) SysEmployee entity, @Param("ew") Wrapper<SysEmployee> updateWrapper);
@Override
@CacheEvict( value="sysemployee",key = "'row:'+#p0")
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update("${sql}")
boolean updateBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert("${sql}")
boolean insertBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<SysEmployee> selectByMdeptid(@Param("deptid") Serializable deptid) ;
List<SysEmployee> selectByOrgid(@Param("orgid") Serializable orgid) ;
List<SysEmployee> selectByPostid(@Param("postid") Serializable postid) ;
}
package cn.ibizlab.core.ou.mapper;
import java.util.List;
import org.apache.ibatis.annotations.*;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.HashMap;
import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.ou.domain.SysOrganization;
import cn.ibizlab.core.ou.filter.SysOrganizationSearchContext;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface SysOrganizationMapper extends BaseMapper<SysOrganization>{
Page<SysOrganization> searchDefault(IPage page, @Param("srf") SysOrganizationSearchContext context, @Param("ew") Wrapper<SysOrganization> wrapper) ;
@Override
@Cacheable( value="sysorganization",key = "'row:'+#p0")
SysOrganization selectById(Serializable id);
@Override
@CacheEvict( value="sysorganization",key = "'row:'+#p0.orgid")
int insert(SysOrganization entity);
@Override
@CacheEvict( value="sysorganization",key = "'row:'+#p0.orgid")
int updateById(@Param(Constants.ENTITY) SysOrganization entity);
@Override
@CacheEvict(value="sysorganization",key = "'row:'+#p0.orgid")
int update(@Param(Constants.ENTITY) SysOrganization entity, @Param("ew") Wrapper<SysOrganization> updateWrapper);
@Override
@CacheEvict( value="sysorganization",key = "'row:'+#p0")
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update("${sql}")
boolean updateBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert("${sql}")
boolean insertBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<SysOrganization> selectByParentorgid(@Param("orgid") Serializable orgid) ;
}
此差异已折叠。
!!!!模版产生代码错误:----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${dbinst.getUserName()} [in template "CODETEMPL_en_US" at line 28, column 24]
----
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册