Compare commits

...

24 Commits

Author SHA1 Message Date
thinkgem
a872b9e02e v4.1.0 2018-10-14 19:55:19 +08:00
thinkgem
4ef6d1a981 修正二级缓存存储模式为hash的时候clear报错问题 2018-10-14 18:06:57 +08:00
thinkgem
6959238eec 支持菜单、用户、角色 Service 层自定义,详见 sys.service.impl 包。 2018-10-14 12:50:22 +08:00
thinkgem
a94de0c372 支持菜单、用户、角色 Service 层自定义,详见 sys.service.impl 包。 2018-10-14 12:50:22 +08:00
thinkgem
1d250a126a 其它各种优化,性能优化,增强autoconfigure,简化 Application.java;新增PwdUtils工具类 2018-10-13 22:30:02 +08:00
thinkgem
57f67c0a0e 日志配置优化,并重命名移动到 src/main/resources/config/logback-spring.xml 2018-10-13 21:44:35 +08:00
thinkgem
7dc85de589 演示组件中新增用户列表选择应用例子 2018-10-11 21:31:45 +08:00
thinkgem
ebf7b52656 角色数据权限范围,支持扩展自定义的数据权限,并相关权限功能优化改进;新增本部门数据、本公司数据、本部门和本公司数据的权限范围 2018-10-10 20:09:23 +08:00
thinkgem
021672b180 优化用户菜单缓存,提示主页面加载速度 2018-10-02 23:17:26 +08:00
thinkgem
0c84378419 代码优化 2018-09-29 22:08:40 +08:00
thinkgem
968e5fe357 新增超级管理员租户切换功能 2018-09-28 22:25:38 +08:00
thinkgem
bc66796ca7 修正岗位名称唯一验证不应该是LIKE 2018-09-28 22:17:31 +08:00
thinkgem
c16e81b410 修正树表名称有正则表达式特殊字符的时候更新报错 #IN6V8 2018-09-28 22:05:54 +08:00
thinkgem
8a64867ed3 form:treeselect增加callbackFuncName属性,可自定义回调方法的函数名 2018-09-28 22:02:25 +08:00
thinkgem
43a6f86115 代码生成器支持多数据源表生成 2018-09-26 22:37:22 +08:00
thinkgem
38f8c6cda3 新增 jeesite-module-swagger 模块 2018-09-26 22:36:25 +08:00
thinkgem
41db27ae0d 代码生成器支持栅格自定义 2018-09-26 20:19:43 +08:00
thinkgem
90ec91cc69 demo视图文件增加demo前缀 2018-09-26 20:19:10 +08:00
thinkgem
1ce27089e2 支持开发者自定义控制用户密码加密和验证策略。 2018-09-25 22:43:37 +08:00
thinkgem
8ebb5b07f6 form:checkbox组件,不选中时提交空字符串,而不是提交null 2018-09-25 22:42:16 +08:00
thinkgem
2717f036ec update 2018-09-24 18:12:10 +08:00
thinkgem
34125ee274 泛型化对象序列化和反序列化接口 2018-09-24 11:46:07 +08:00
thinkgem
7d6e99c8fb 缓存工具类新增timeToLiveInSeconds支持;优化分页接口 2018-09-23 23:40:56 +08:00
thinkgem
d9e18a70c7 升级到 Spring Boot 2.0.5 以及相关依赖库全面升级,采用J2Cache作为缓存。 2018-09-22 21:12:45 +08:00
127 changed files with 4795 additions and 1799 deletions

View File

@@ -22,6 +22,7 @@ JeeSite 自开源以来已被广大爱好者用到了企业、政府、医疗、
* 前端组件jQuery 1.12、jqGrid 4.7、layer 3.0、zTree 3.5、jquery-validation
* 工具组件Apache Commons、Logback 1.1、Jackson 2.8、POI 3.14、Quartz 2.2
* JFlow工作流引擎<https://gitee.com/thinkgem/jeesite4-jflow> <http://ccflow.org>
* 乐云短信网关SmsUtils.java <http://www.lehuo520.cn>
* 技术选型详情:<http://jeesite4.mydoc.io/?t=273599>
## 内置功能菜单

View File

@@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.7"/>
</faceted-project>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>4.0.7-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -27,17 +27,16 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
@@ -46,19 +45,33 @@
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${commons-text.version}</version>
</dependency>
<!-- Apache Tools Ant Tar Zip -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>${ant.version}</version>
</dependency>
<!-- Java serialization -->
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>${ruedigermoeller-fst.version}</version>
<version>${fst.version}</version>
</dependency>
<!-- Json in java -->
<!-- Json in java -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
</dependency>
<!-- Jackson json -->
@@ -93,11 +106,91 @@
<artifactId>snakeyaml</artifactId>
</dependency>
<!-- Bean To Bean copy -->
<!-- Apache HTTP -->
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>${dozer.version}</version>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- Jsoup HTTP -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
<!-- Email -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>${commons-email.version}</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${activation.version}</version>
</dependency>
<!-- User Agent -->
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>${UserAgentUtils.version}</version>
</dependency>
<!-- 图片Meta获取 -->
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>${metadata-extractor.version}</version>
</dependency>
<!-- 缩略图工具 -->
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>${thumbnailator.version}</version>
</dependency>
<!-- 图片验证码生成 -->
<dependency>
<groupId>com.bladejava</groupId>
<artifactId>blade-patchca</artifactId>
<version>${blade-patchca.version}</version>
</dependency>
<!-- File MimeType ContentType -->
<dependency>
<groupId>net.sf.jmimemagic</groupId>
<artifactId>jmimemagic</artifactId>
<version>${jmimemagic.version}</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 条形码、二维码生成 -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>${zxing.version}</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>${zxing.version}</version>
</dependency>
<!-- POI Office Tools -->
@@ -128,109 +221,14 @@
<version>${poi.version}</version>
</dependency>
<!-- Email -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<!-- 条形码、二维码生成 -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.0</version>
</dependency>
<!-- User Agent -->
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.20</version>
</dependency>
<!-- Apache HTTP -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- Jsoup HTTP -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.1</version>
</dependency>
<!-- 图片Meta获取 -->
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.9.1</version>
</dependency>
<!-- 缩略图工具 -->
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.8</version>
</dependency>
<!-- 图片验证码生成 -->
<dependency>
<groupId>com.bladejava</groupId>
<artifactId>blade-patchca</artifactId>
<version>1.0.5</version>
</dependency>
<!-- Apache Tools Ant Tar Zip -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.7</version>
</dependency>
<!-- File MimeType ContentType -->
<dependency>
<groupId>net.sf.jmimemagic</groupId>
<artifactId>jmimemagic</artifactId>
<version>0.1.3</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- pinyin4j -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.0</version>
<version>${pinyin4j.version}</version>
</dependency>
<!-- LOGGING begin -->
<!-- Logging begin -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -255,9 +253,9 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<!-- LOGGING end -->
<!-- Logging end -->
<!-- Spring Core Web-->
<!-- Spring begin -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
@@ -266,12 +264,7 @@
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- Bean validate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<!-- Spring end -->
<!-- JUnit Test -->
<dependency>

View File

@@ -15,7 +15,7 @@ import java.util.regex.Pattern;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -76,13 +76,12 @@ public class Md5Utils {
/**
* 获取文件的MD5值支持获取文件部分的MD5值
* uploader.md5File(file, 0, 10 * 1024 * 1024)
*/
public static String md5File(File file, int size) {
if (file != null && file.exists()){
InputStream in = null;
try {
try (InputStream in = FileUtils.openInputStream(file)){
byte[] bytes = null;
in = FileUtils.openInputStream(file);
if (size != -1 && file.length() >= size){
bytes = IOUtils.toByteArray(in, size);
}else{
@@ -91,8 +90,6 @@ public class Md5Utils {
return EncodeUtils.encodeHex(md5(bytes));
} catch (IOException e) {
return StringUtils.EMPTY;
} finally {
IOUtils.closeQuietly(in);
}
}
return StringUtils.EMPTY;

View File

@@ -242,14 +242,10 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
* @author ThinkGem 2016-7-4
*/
public static String readFileToString(String classResourcePath){
InputStream in = null;
try {
in = new ClassPathResource(classResourcePath).getInputStream();
try (InputStream in = new ClassPathResource(classResourcePath).getInputStream()){
return IOUtils.toString(in, Charsets.toCharset("UTF-8"));
} catch (IOException e) {
logger.warn("Error file convert: {}", e.getMessage());
}finally{
IOUtils.closeQuietly(in);
}
return null;
}
@@ -758,7 +754,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
try {
response.addHeader("Content-Disposition", "attachment; filename=\"" +
EncodeUtils.encodeUrl(StringUtils.isBlank(fileName) ? file.getName() : fileName) + "\"");
response.setContentType(getContentType(file.getName())); // set the MIME type.
response.setContentType(FileUtils.getContentType(file.getName())); // set the MIME type.
response.addHeader("Content-Length", String.valueOf(contentLength));
os = response.getOutputStream();
out = new BufferedOutputStream(os);
@@ -808,7 +804,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
logger.debug("提醒向客户端传输时出现IO异常但此异常是允许的有可能客户端取消了下载导致此异常不用关心");
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
logger.debug(e.getMessage(), e);
} finally {
if (out != null) {
try {
@@ -944,9 +940,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
projectPath = file.toString();
}
} catch (FileNotFoundException e) {
;
// 忽略异常
} catch (IOException e) {
e.printStackTrace();
// 忽略异常
}
// 取不到,取当前工作路径
if (StringUtils.isBlank(projectPath)){
@@ -982,9 +978,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
webappPath = file.toString();
}
} catch (FileNotFoundException e) {
;
// 忽略异常
} catch (IOException e) {
e.printStackTrace();
// 忽略异常
}
// 取不到,取当前工作路径
if (StringUtils.isBlank(webappPath)){

View File

@@ -3,10 +3,13 @@
*/
package com.jeesite.common.io;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* 数据流工具类
@@ -80,4 +83,24 @@ public class IOUtils extends org.apache.commons.io.IOUtils {
return fileOutputStream;
}
/**
* Closes a <code>Closeable</code> unconditionally.
*/
public static void closeQuietly(final InputStream input) {
closeQuietly((Closeable) input);
}
/**
* Closes a <code>Closeable</code> unconditionally.
*/
public static void closeQuietly(final Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (final IOException ioe) {
// ignore
}
}
}

View File

@@ -12,7 +12,6 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
@@ -37,7 +36,7 @@ public class PropertiesUtils {
"classpath:config/application.yml", "classpath:application.yml"};
private static Logger logger = PropertiesUtils.initLogger();
private final Set<String> configSet = SetUtils.newLinkedHashSet();
private final Properties properties = new Properties();
/**
@@ -55,7 +54,7 @@ public class PropertiesUtils {
for(Resource resource : resources){
configSet.add("classpath:config/"+resource.getFilename());
}
configSet.add("classpath:config/jeesite.yml");
//configSet.add("classpath:config/jeesite.yml");
// 获取全局设置默认的配置文件(以下是支持环境配置的属性文件)
Set<String> set = SetUtils.newLinkedHashSet();
for (String configFile : DEFAULT_CONFIG_FILE){
@@ -83,7 +82,7 @@ public class PropertiesUtils {
}
for (String location : configFiles){
configSet.add(location);
if (StringUtils.isNotBlank(profiles) && !StringUtils.equals(profiles, "default")){
if (StringUtils.isNotBlank(profiles)){
if (location.endsWith(".properties")){
configSet.add(StringUtils.substringBeforeLast(location, ".properties")
+ "-" + profiles + ".properties");
@@ -108,14 +107,11 @@ public class PropertiesUtils {
Resource resource = ResourceUtils.getResource(location);
if (resource.exists()){
if (location.endsWith(".properties")){
InputStreamReader is = null;
try {
is = new InputStreamReader(resource.getInputStream(), "UTF-8");
try (InputStreamReader is = new InputStreamReader(resource.getInputStream(), "UTF-8")){
properties.load(is);
configSet.add(location);
} catch (IOException ex) {
logger.error("Load " + location + " failure. ", ex);
} finally {
IOUtils.closeQuietly(is);
}
}
else if (location.endsWith(".yml")){
@@ -125,18 +121,24 @@ public class PropertiesUtils {
properties.put(ObjectUtils.toString(entry.getKey()),
ObjectUtils.toString(entry.getValue()));
}
configSet.add(location);
}
}
} catch (Exception e) {
logger.error("Load " + location + " failure. ", e);
}
// 存储当前加载的配置文件路径和名称
properties.setProperty("configFiles", StringUtils.join(configFiles, ","));
}
}
/**
* 获取当前加载的属性
* 获取当前加载的属性文件
*/
public Set<String> getConfigSet() {
return configSet;
}
/**
* 获取当前加载的属性数据
*/
public Properties getProperties() {
return properties;

View File

@@ -67,14 +67,10 @@ public class ResourceUtils extends org.springframework.util.ResourceUtils {
* @author ThinkGem
*/
public static String getResourceFileContent(String location){
InputStream is = null;
try{
is = ResourceUtils.getResourceFileStream(location);
try(InputStream is = ResourceUtils.getResourceFileStream(location)){
return IOUtils.toString(is, "UTF-8");
}catch (IOException e) {
throw ExceptionUtils.unchecked(e);
}finally{
IOUtils.closeQuietly(is);
}
}

View File

@@ -16,8 +16,6 @@ import org.nustaq.serialization.FSTConfiguration;
import org.springframework.beans.BeanUtils;
import org.springframework.core.NamedThreadLocal;
import com.jeesite.common.io.IOUtils;
/**
* 对象操作工具类, 继承org.apache.commons.lang3.ObjectUtils类
* @author ThinkGem
@@ -118,9 +116,13 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
if (source == null){
return null;
}
Object target = BeanUtils.instantiate(source.getClass());
BeanUtils.copyProperties(source, target, ignoreProperties);
return target;
try {
Object target = source.getClass().newInstance();
BeanUtils.copyProperties(source, target, ignoreProperties);
return target;
} catch (InstantiationException | IllegalAccessException e) {
throw ExceptionUtils.unchecked(e);
}
}
/**
@@ -162,18 +164,12 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
}
long beginTime = System.currentTimeMillis();
byte[] bytes = null;
ObjectOutputStream oos = null;
ByteArrayOutputStream baos = null;
try {
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);) {
oos.writeObject(object);
bytes = baos.toByteArray();
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(oos);
IOUtils.closeQuietly(baos);
}
long totalTime = System.currentTimeMillis() - beginTime;
if (totalTime > 3000){
@@ -193,19 +189,13 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
}
long beginTime = System.currentTimeMillis();
Object object = null;
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
if (bytes.length > 0) {
bais = new ByteArrayInputStream(bytes);
ois = new ObjectInputStream(bais);
if (bytes.length > 0) {
try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais);) {
object = ois.readObject();
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(ois);
IOUtils.closeQuietly(bais);
}
long totalTime = System.currentTimeMillis() - beginTime;
if (totalTime > 3000){

View File

@@ -9,8 +9,6 @@ import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringEscapeUtils;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.collect.ListUtils;
@@ -140,7 +138,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
try {
StringBuilder sb = new StringBuilder();
int currentLength = 0;
for (char c : stripHtml(StringEscapeUtils.unescapeHtml4(str)).toCharArray()) {
for (char c : stripHtml(EncodeUtils.decodeHtml(str)).toCharArray()) {
currentLength += String.valueOf(c).getBytes("GBK").length;
if (currentLength <= length - 3) {
sb.append(c);

View File

@@ -1,37 +0,0 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package com.jeesite.common.mail;
/**
* 发送电子邮件
*/
@Deprecated
public class EmailUtils {
/**
* 发送邮件
* @param toAddress 接收地址
* @param subject 标题
* @param content 内容
* @return
*/
@Deprecated
public static boolean sendEmail(String toAddress, String subject, String content) {
return com.jeesite.common.msg.EmailUtils.send(toAddress, subject, content);
}
/**
* 发送邮件
* @param toAddress 接收地址
* @param subject 标题
* @param content 内容
* @return
*/
@Deprecated
public static boolean sendEmail(String fromAddress, String fromPassword, String fromHostName,
String sslOnConnect, String sslSmtpPort, String toAddress, String subject, String content) {
return com.jeesite.common.msg.EmailUtils.send(fromAddress, fromPassword, fromHostName, sslOnConnect, sslSmtpPort, toAddress, subject, content);
}
}

View File

@@ -1,59 +0,0 @@
/**
* Copyright (c) 2005-2012 springside.org.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
package com.jeesite.common.mapper;
import java.util.Collection;
import java.util.List;
import org.dozer.DozerBeanMapper;
import com.jeesite.common.collect.ListUtils;
/**
* 简单封装Dozer, 实现深度转换Bean<->Bean的Mapper.实现:
*
* 1. 持有Mapper的单例.
* 2. 返回值类型转换.
* 3. 批量转换Collection中的所有对象.
* 4. 区分创建新的B对象与将对象A值复制到已存在的B对象两种函数.
*
* @author calvin
* @version 2013-01-15
*/
public class BeanMapper {
/**
* 持有Dozer单例, 避免重复创建DozerMapper消耗资源.
*/
private static DozerBeanMapper dozer = new DozerBeanMapper();
/**
* 基于Dozer转换对象的类型.
*/
public static <T> T map(Object source, Class<T> destinationClass) {
return dozer.map(source, destinationClass);
}
/**
* 基于Dozer转换Collection中对象的类型.
*/
@SuppressWarnings("rawtypes")
public static <T> List<T> mapList(Collection sourceList, Class<T> destinationClass) {
List<T> destinationList = ListUtils.newArrayList();
for (Object sourceObject : sourceList) {
T destinationObject = dozer.map(sourceObject, destinationClass);
destinationList.add(destinationObject);
}
return destinationList;
}
/**
* 基于Dozer将对象A的值拷贝到对象B中.
*/
public static void copy(Object source, Object destinationObject) {
dozer.map(source, destinationObject);
}
}

View File

@@ -43,20 +43,21 @@ public class ReflectUtils {
* 调用Getter方法.
* 支持多级,如:对象名.对象名.方法
*/
public static Object invokeGetter(Object obj, String propertyName) {
@SuppressWarnings("unchecked")
public static <E> E invokeGetter(Object obj, String propertyName) {
Object object = obj;
for (String name : StringUtils.split(propertyName, ".")){
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name);
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
}
return object;
return (E)object;
}
/**
* 调用Setter方法, 仅匹配方法名。
* 支持多级,如:对象名.对象名.方法
*/
public static void invokeSetter(Object obj, String propertyName, Object value) {
public static <E> void invokeSetter(Object obj, String propertyName, E value) {
Object object = obj;
String[] names = StringUtils.split(propertyName, ".");
for (int i=0; i<names.length; i++){
@@ -73,16 +74,17 @@ public class ReflectUtils {
/**
* 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数.
*/
public static Object getFieldValue(final Object obj, final String fieldName) {
@SuppressWarnings("unchecked")
public static <E> E getFieldValue(final Object obj, final String fieldName) {
Field field = getAccessibleField(obj, fieldName);
if (field == null) {
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
logger.warn("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
return null;
}
Object result = null;
E result = null;
try {
result = field.get(obj);
result = (E)field.get(obj);
} catch (IllegalAccessException e) {
logger.error("不可能抛出的异常{}", e.getMessage());
}
@@ -92,11 +94,11 @@ public class ReflectUtils {
/**
* 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数.
*/
public static void setFieldValue(final Object obj, final String fieldName, final Object value) {
public static <E> void setFieldValue(final Object obj, final String fieldName, final E value) {
Field field = getAccessibleField(obj, fieldName);
if (field == null) {
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
logger.warn("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
return;
}
try {
@@ -111,7 +113,8 @@ public class ReflectUtils {
* 用于一次性调用的情况否则应使用getAccessibleMethod()函数获得Method后反复调用.
* 同时匹配方法名+参数类型,
*/
public static Object invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes,
@SuppressWarnings("unchecked")
public static <E> E invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes,
final Object[] args) {
if (obj == null || methodName == null){
return null;
@@ -119,11 +122,11 @@ public class ReflectUtils {
Method method = getAccessibleMethod(obj, methodName, parameterTypes);
if (method == null) {
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
logger.warn("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
return null;
}
try {
return method.invoke(obj, args);
return (E)method.invoke(obj, args);
} catch (Exception e) {
String msg = "method: "+method+", obj: "+obj+", args: "+args+"";
throw convertReflectionExceptionToUnchecked(msg, e);
@@ -135,12 +138,13 @@ public class ReflectUtils {
* 用于一次性调用的情况否则应使用getAccessibleMethodByName()函数获得Method后反复调用.
* 只匹配函数名,如果有多个同名函数调用第一个。
*/
public static Object invokeMethodByName(final Object obj, final String methodName, final Object[] args) {
@SuppressWarnings("unchecked")
public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args) {
Method method = getAccessibleMethodByName(obj, methodName, args.length);
if (method == null) {
// 如果为空不报错,直接返回空。
// throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
logger.warn("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
return null;
}
try {
@@ -171,7 +175,7 @@ public class ReflectUtils {
}
}
}
return method.invoke(obj, args);
return (E)method.invoke(obj, args);
} catch (Exception e) {
String msg = "method: "+method+", obj: "+obj+", args: "+args+"";
throw convertReflectionExceptionToUnchecked(msg, e);
@@ -300,19 +304,19 @@ public class ReflectUtils {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType)) {
logger.warn(clazz.getSimpleName() + "'s superclass not ParameterizedType");
logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
return Object.class;
}
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0) {
logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
+ params.length);
return Object.class;
}
if (!(params[index] instanceof Class)) {
logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
return Object.class;
}

View File

@@ -585,18 +585,18 @@ public class ExcelExport implements Closeable{
return this;
}
/**
* 清理临时文件
* @deprecated see close()
*/
public ExcelExport dispose(){
try {
this.close();
} catch (Exception e) {
e.printStackTrace();
}
return this;
}
// /**
// * 清理临时文件
// * @deprecated see close()
// */
// public ExcelExport dispose(){
// try {
// this.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
// return this;
// }
@Override
public void close() {

View File

@@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.utility"/>
<fixed facet="java"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.7"/>
</faceted-project>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.utility"/>
<fixed facet="java"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,919 @@
/* Drop Tables */
DROP TABLE js_gen_table_column;
DROP TABLE js_gen_table;
DROP TABLE js_sys_company_office;
DROP TABLE js_sys_employee_post;
DROP TABLE js_sys_user_data_scope;
DROP TABLE js_sys_user_role;
DROP TABLE js_sys_user;
DROP TABLE js_sys_employee;
DROP TABLE js_sys_company;
DROP TABLE js_sys_area;
DROP TABLE js_sys_config;
DROP TABLE js_sys_dict_data;
DROP TABLE js_sys_dict_type;
DROP TABLE js_sys_file_upload;
DROP TABLE js_sys_file_entity;
DROP TABLE js_sys_job_log;
DROP TABLE js_sys_job;
DROP TABLE js_sys_lang;
DROP TABLE js_sys_log;
DROP TABLE js_sys_role_menu;
DROP TABLE js_sys_menu;
DROP TABLE js_sys_module;
DROP TABLE js_sys_msg_inner_record;
DROP TABLE js_sys_msg_inner;
DROP TABLE js_sys_msg_push;
DROP TABLE js_sys_msg_pushed;
DROP TABLE js_sys_msg_template;
DROP TABLE js_sys_office;
DROP TABLE js_sys_post;
DROP TABLE js_sys_role_data_scope;
DROP TABLE js_sys_role;
/* Create Tables */
-- 代码生成表
CREATE TABLE js_gen_table
(
table_name varchar(64) NOT NULL,
class_name varchar(100) NOT NULL,
comments varchar(500) NOT NULL,
parent_table_name varchar(64),
parent_table_fk_name varchar(64),
data_source_name varchar(64),
tpl_category varchar(200),
package_name varchar(500),
module_name varchar(30),
sub_module_name varchar(30),
function_name varchar(200),
function_name_simple varchar(50),
function_author varchar(50),
gen_base_dir varchar(1000),
options varchar(1000),
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (table_name)
);
-- 代码生成表列
CREATE TABLE js_gen_table_column
(
id varchar(64) NOT NULL,
table_name varchar(64) NOT NULL,
column_name varchar(64) NOT NULL,
column_sort decimal(10),
column_type varchar(100) NOT NULL,
column_label varchar(50),
comments varchar(500) NOT NULL,
attr_name varchar(200) NOT NULL,
attr_type varchar(200) NOT NULL,
is_pk char(1),
is_null char(1),
is_insert char(1),
is_update char(1),
is_list char(1),
is_query char(1),
query_type varchar(200),
is_edit char(1),
show_type varchar(200),
options varchar(1000),
PRIMARY KEY (id)
);
-- 行政区划
CREATE TABLE js_sys_area
(
area_code varchar(100) NOT NULL,
parent_code varchar(64) NOT NULL,
parent_codes varchar(1000) NOT NULL,
tree_sort decimal(10) NOT NULL,
tree_sorts varchar(1000) NOT NULL,
tree_leaf char(1) NOT NULL,
tree_level decimal(4) NOT NULL,
tree_names varchar(1000) NOT NULL,
area_name varchar(100) NOT NULL,
area_type char(1),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (area_code)
);
-- 公司表
CREATE TABLE js_sys_company
(
company_code varchar(64) NOT NULL,
parent_code varchar(64) NOT NULL,
parent_codes varchar(1000) NOT NULL,
tree_sort decimal(10) NOT NULL,
tree_sorts varchar(1000) NOT NULL,
tree_leaf char(1) NOT NULL,
tree_level decimal(4) NOT NULL,
tree_names varchar(1000) NOT NULL,
view_code varchar(100) NOT NULL,
company_name varchar(200) NOT NULL,
full_name varchar(200) NOT NULL,
area_code varchar(100),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
extend_s1 varchar(500),
extend_s2 varchar(500),
extend_s3 varchar(500),
extend_s4 varchar(500),
extend_s5 varchar(500),
extend_s6 varchar(500),
extend_s7 varchar(500),
extend_s8 varchar(500),
extend_i1 decimal(19),
extend_i2 decimal(19),
extend_i3 decimal(19),
extend_i4 decimal(19),
extend_f1 decimal(19,4),
extend_f2 decimal(19,4),
extend_f3 decimal(19,4),
extend_f4 decimal(19,4),
extend_d1 timestamp,
extend_d2 timestamp,
extend_d3 timestamp,
extend_d4 timestamp,
PRIMARY KEY (company_code)
);
-- 公司部门关联表
CREATE TABLE js_sys_company_office
(
company_code varchar(64) NOT NULL,
office_code varchar(64) NOT NULL,
PRIMARY KEY (company_code, office_code)
);
-- 参数配置表
CREATE TABLE js_sys_config
(
id varchar(64) NOT NULL,
config_name varchar(100) NOT NULL,
config_key varchar(100) NOT NULL,
config_value varchar(1000),
is_sys char(1) NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (id)
);
-- 字典数据表
CREATE TABLE js_sys_dict_data
(
dict_code varchar(64) NOT NULL,
parent_code varchar(64) NOT NULL,
parent_codes varchar(1000) NOT NULL,
tree_sort decimal(10) NOT NULL,
tree_sorts varchar(1000) NOT NULL,
tree_leaf char(1) NOT NULL,
tree_level decimal(4) NOT NULL,
tree_names varchar(1000) NOT NULL,
dict_label varchar(100) NOT NULL,
dict_value varchar(100) NOT NULL,
dict_type varchar(100) NOT NULL,
is_sys char(1) NOT NULL,
description varchar(500),
css_style varchar(500),
css_class varchar(500),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
extend_s1 varchar(500),
extend_s2 varchar(500),
extend_s3 varchar(500),
extend_s4 varchar(500),
extend_s5 varchar(500),
extend_s6 varchar(500),
extend_s7 varchar(500),
extend_s8 varchar(500),
extend_i1 decimal(19),
extend_i2 decimal(19),
extend_i3 decimal(19),
extend_i4 decimal(19),
extend_f1 decimal(19,4),
extend_f2 decimal(19,4),
extend_f3 decimal(19,4),
extend_f4 decimal(19,4),
extend_d1 timestamp,
extend_d2 timestamp,
extend_d3 timestamp,
extend_d4 timestamp,
PRIMARY KEY (dict_code)
);
-- 字典类型表
CREATE TABLE js_sys_dict_type
(
id varchar(64) NOT NULL,
dict_name varchar(100) NOT NULL,
dict_type varchar(100) NOT NULL,
is_sys char(1) NOT NULL,
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (id)
);
-- 员工表
CREATE TABLE js_sys_employee
(
emp_code varchar(64) NOT NULL,
emp_name varchar(100) NOT NULL,
emp_name_en varchar(100),
office_code varchar(64) NOT NULL,
office_name varchar(100) NOT NULL,
company_code varchar(64),
company_name varchar(200),
status char(1) NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
PRIMARY KEY (emp_code)
);
-- 员工与岗位关联表
CREATE TABLE js_sys_employee_post
(
emp_code varchar(64) NOT NULL,
post_code varchar(64) NOT NULL,
PRIMARY KEY (emp_code, post_code)
);
-- 文件实体表
CREATE TABLE js_sys_file_entity
(
file_id varchar(64) NOT NULL,
file_md5 varchar(64) NOT NULL UNIQUE,
file_path varchar(1000) NOT NULL,
file_content_type varchar(200) NOT NULL,
file_extension varchar(100) NOT NULL,
file_size decimal(31) NOT NULL,
PRIMARY KEY (file_id)
);
-- 文件上传表
CREATE TABLE js_sys_file_upload
(
id varchar(64) NOT NULL,
file_id varchar(64) NOT NULL,
file_name varchar(500) NOT NULL,
file_type varchar(20) NOT NULL,
biz_key varchar(64),
biz_type varchar(64),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (id)
);
-- 作业调度表
CREATE TABLE js_sys_job
(
job_name varchar(64) NOT NULL,
job_group varchar(64) NOT NULL,
description varchar(100) NOT NULL,
invoke_target varchar(1000) NOT NULL,
cron_expression varchar(255) NOT NULL,
misfire_instruction decimal(1) NOT NULL,
concurrent char(1) NOT NULL,
status char(1) NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (job_name, job_group)
);
-- 作业调度日志表
CREATE TABLE js_sys_job_log
(
id varchar(64) NOT NULL,
job_name varchar(64) NOT NULL,
job_group varchar(64) NOT NULL,
job_type varchar(50),
job_event varchar(200),
job_message varchar(500),
is_exception char(1),
exception_info clob,
create_date timestamp,
PRIMARY KEY (id)
);
-- 国际化语言
CREATE TABLE js_sys_lang
(
id varchar(64) NOT NULL,
module_code varchar(64) NOT NULL,
lang_code varchar(500) NOT NULL,
lang_text varchar(500) NOT NULL,
lang_type varchar(50) NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (id)
);
-- 操作日志表
CREATE TABLE js_sys_log
(
id varchar(64) NOT NULL,
log_type varchar(50) NOT NULL,
log_title varchar(500) NOT NULL,
create_by varchar(64) NOT NULL,
create_by_name varchar(100) NOT NULL,
create_date timestamp NOT NULL,
request_uri varchar(500),
request_method varchar(10),
request_params clob,
diff_modify_data clob,
biz_key varchar(64),
biz_type varchar(64),
remote_addr varchar(255) NOT NULL,
server_addr varchar(255) NOT NULL,
is_exception char(1),
exception_info clob,
user_agent varchar(500),
device_name varchar(100),
browser_name varchar(100),
execute_time decimal(19),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
PRIMARY KEY (id)
);
-- 菜单表
CREATE TABLE js_sys_menu
(
menu_code varchar(64) NOT NULL,
parent_code varchar(64) NOT NULL,
parent_codes varchar(1000) NOT NULL,
tree_sort decimal(10) NOT NULL,
tree_sorts varchar(1000) NOT NULL,
tree_leaf char(1) NOT NULL,
tree_level decimal(4) NOT NULL,
tree_names varchar(1000) NOT NULL,
menu_name varchar(100) NOT NULL,
menu_type char(1) NOT NULL,
menu_href varchar(1000),
menu_target varchar(20),
menu_icon varchar(100),
menu_color varchar(50),
permission varchar(1000),
weight decimal(4),
is_show char(1) NOT NULL,
sys_code varchar(64) NOT NULL,
module_codes varchar(500) NOT NULL,
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
extend_s1 varchar(500),
extend_s2 varchar(500),
extend_s3 varchar(500),
extend_s4 varchar(500),
extend_s5 varchar(500),
extend_s6 varchar(500),
extend_s7 varchar(500),
extend_s8 varchar(500),
extend_i1 decimal(19),
extend_i2 decimal(19),
extend_i3 decimal(19),
extend_i4 decimal(19),
extend_f1 decimal(19,4),
extend_f2 decimal(19,4),
extend_f3 decimal(19,4),
extend_f4 decimal(19,4),
extend_d1 timestamp,
extend_d2 timestamp,
extend_d3 timestamp,
extend_d4 timestamp,
PRIMARY KEY (menu_code)
);
-- 模块表
CREATE TABLE js_sys_module
(
module_code varchar(64) NOT NULL,
module_name varchar(100) NOT NULL,
description varchar(500),
main_class_name varchar(500),
current_version varchar(50),
upgrade_info varchar(300),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (module_code)
);
-- 内部消息
CREATE TABLE js_sys_msg_inner
(
id varchar(64) NOT NULL,
msg_title varchar(200) NOT NULL,
content_level char(1) NOT NULL,
content_type char(1),
msg_content clob NOT NULL,
receive_type char(1) NOT NULL,
receive_codes clob NOT NULL,
receive_names clob NOT NULL,
send_user_code varchar(64) NOT NULL,
send_user_name varchar(100) NOT NULL,
send_date timestamp NOT NULL,
is_attac char(1),
notify_types varchar(100) NOT NULL,
status char(1) NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (id)
);
-- 内部消息发送记录表
CREATE TABLE js_sys_msg_inner_record
(
id varchar(64) NOT NULL,
msg_inner_id varchar(64) NOT NULL,
receive_user_code varchar(64),
receive_user_name varchar(100) NOT NULL,
read_status char(1) NOT NULL,
read_date timestamp,
is_star char(1),
PRIMARY KEY (id)
);
-- 消息推送表
CREATE TABLE js_sys_msg_push
(
id varchar(64) NOT NULL,
msg_type varchar(16) NOT NULL,
msg_title varchar(200) NOT NULL,
msg_content clob NOT NULL,
biz_key varchar(64),
biz_type varchar(64),
receive_code varchar(64) NOT NULL,
receive_user_code varchar(64) NOT NULL,
receive_user_name varchar(100) NOT NULL,
send_user_code varchar(64) NOT NULL,
send_user_name varchar(100) NOT NULL,
send_date timestamp NOT NULL,
is_merge_push char(1),
plan_push_date timestamp,
push_number int,
push_return_code varchar(200),
push_return_msg_id varchar(200),
push_return_content clob,
push_status char(1),
push_date timestamp,
read_status char(1),
read_date timestamp,
PRIMARY KEY (id)
);
-- 消息已推送表
CREATE TABLE js_sys_msg_pushed
(
id varchar(64) NOT NULL,
msg_type varchar(16) NOT NULL,
msg_title varchar(200) NOT NULL,
msg_content clob NOT NULL,
biz_key varchar(64),
biz_type varchar(64),
receive_code varchar(64) NOT NULL,
receive_user_code varchar(64) NOT NULL,
receive_user_name varchar(100) NOT NULL,
send_user_code varchar(64) NOT NULL,
send_user_name varchar(100) NOT NULL,
send_date timestamp NOT NULL,
is_merge_push char(1),
plan_push_date timestamp,
push_number int,
push_return_content clob,
push_return_code varchar(200),
push_return_msg_id varchar(200),
push_status char(1),
push_date timestamp,
read_status char(1),
read_date timestamp,
PRIMARY KEY (id)
);
-- 消息模板
CREATE TABLE js_sys_msg_template
(
id varchar(64) NOT NULL,
module_code varchar(64),
tpl_key varchar(100) NOT NULL,
tpl_name varchar(100) NOT NULL,
tpl_type varchar(16) NOT NULL,
tpl_content clob NOT NULL,
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
PRIMARY KEY (id)
);
-- 组织机构表
CREATE TABLE js_sys_office
(
office_code varchar(64) NOT NULL,
parent_code varchar(64) NOT NULL,
parent_codes varchar(1000) NOT NULL,
tree_sort decimal(10) NOT NULL,
tree_sorts varchar(1000) NOT NULL,
tree_leaf char(1) NOT NULL,
tree_level decimal(4) NOT NULL,
tree_names varchar(1000) NOT NULL,
view_code varchar(100) NOT NULL,
office_name varchar(100) NOT NULL,
full_name varchar(200) NOT NULL,
office_type char(1) NOT NULL,
leader varchar(100),
phone varchar(100),
address varchar(255),
zip_code varchar(100),
email varchar(300),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
extend_s1 varchar(500),
extend_s2 varchar(500),
extend_s3 varchar(500),
extend_s4 varchar(500),
extend_s5 varchar(500),
extend_s6 varchar(500),
extend_s7 varchar(500),
extend_s8 varchar(500),
extend_i1 decimal(19),
extend_i2 decimal(19),
extend_i3 decimal(19),
extend_i4 decimal(19),
extend_f1 decimal(19,4),
extend_f2 decimal(19,4),
extend_f3 decimal(19,4),
extend_f4 decimal(19,4),
extend_d1 timestamp,
extend_d2 timestamp,
extend_d3 timestamp,
extend_d4 timestamp,
PRIMARY KEY (office_code)
);
-- 员工岗位表
CREATE TABLE js_sys_post
(
post_code varchar(64) NOT NULL,
post_name varchar(100) NOT NULL,
post_type varchar(100),
post_sort decimal(10),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
PRIMARY KEY (post_code)
);
-- 角色表
CREATE TABLE js_sys_role
(
role_code varchar(64) NOT NULL,
role_name varchar(100) NOT NULL,
role_type varchar(100),
role_sort decimal(10),
is_sys char(1),
user_type varchar(16),
data_scope char(1),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
PRIMARY KEY (role_code)
);
-- 角色数据权限表
CREATE TABLE js_sys_role_data_scope
(
role_code varchar(64) NOT NULL,
ctrl_type varchar(20) NOT NULL,
ctrl_data varchar(64) NOT NULL,
ctrl_permi varchar(64) NOT NULL,
PRIMARY KEY (role_code, ctrl_type, ctrl_data, ctrl_permi)
);
-- 角色与菜单关联表
CREATE TABLE js_sys_role_menu
(
role_code varchar(64) NOT NULL,
menu_code varchar(64) NOT NULL,
PRIMARY KEY (role_code, menu_code)
);
-- 用户表
CREATE TABLE js_sys_user
(
user_code varchar(100) NOT NULL,
login_code varchar(100) NOT NULL,
user_name varchar(100) NOT NULL,
password varchar(100) NOT NULL,
email varchar(300),
mobile varchar(100),
phone varchar(100),
sex char(1),
avatar varchar(1000),
sign varchar(200),
wx_openid varchar(100),
mobile_imei varchar(100),
user_type varchar(16) NOT NULL,
ref_code varchar(64),
ref_name varchar(100),
mgr_type char(1) NOT NULL,
pwd_security_level decimal(1),
pwd_update_date timestamp,
pwd_update_record varchar(1000),
pwd_question varchar(200),
pwd_question_answer varchar(200),
pwd_question_2 varchar(200),
pwd_question_answer_2 varchar(200),
pwd_question_3 varchar(200),
pwd_question_answer_3 varchar(200),
pwd_quest_update_date timestamp,
last_login_ip varchar(100),
last_login_date timestamp,
freeze_date timestamp,
freeze_cause varchar(200),
user_weight decimal(8) DEFAULT 0,
status char NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks varchar(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name varchar(100) DEFAULT 'JeeSite' NOT NULL,
extend_s1 varchar(500),
extend_s2 varchar(500),
extend_s3 varchar(500),
extend_s4 varchar(500),
extend_s5 varchar(500),
extend_s6 varchar(500),
extend_s7 varchar(500),
extend_s8 varchar(500),
extend_i1 decimal(19),
extend_i2 decimal(19),
extend_i3 decimal(19),
extend_i4 decimal(19),
extend_f1 decimal(19,4),
extend_f2 decimal(19,4),
extend_f3 decimal(19,4),
extend_f4 decimal(19,4),
extend_d1 timestamp,
extend_d2 timestamp,
extend_d3 timestamp,
extend_d4 timestamp,
PRIMARY KEY (user_code)
);
-- 用户数据权限表
CREATE TABLE js_sys_user_data_scope
(
user_code varchar(100) NOT NULL,
ctrl_type varchar(20) NOT NULL,
ctrl_data varchar(64) NOT NULL,
ctrl_permi varchar(64) NOT NULL,
PRIMARY KEY (user_code, ctrl_type, ctrl_data, ctrl_permi)
);
-- 用户与角色关联表
CREATE TABLE js_sys_user_role
(
user_code varchar(100) NOT NULL,
role_code varchar(64) NOT NULL,
PRIMARY KEY (user_code, role_code)
);
/* Create Indexes */
CREATE INDEX idx_gen_table_ptn ON js_gen_table (parent_table_name);
CREATE INDEX idx_gen_table_column_tn ON js_gen_table_column (table_name);
CREATE INDEX idx_sys_area_pc ON js_sys_area (parent_code);
CREATE INDEX idx_sys_area_ts ON js_sys_area (tree_sort);
CREATE INDEX idx_sys_area_status ON js_sys_area (status);
CREATE INDEX idx_sys_area_pcs ON js_sys_area (parent_codes);
CREATE INDEX idx_sys_area_tss ON js_sys_area (tree_sorts);
CREATE INDEX idx_sys_company_cc ON js_sys_company (corp_code);
CREATE INDEX idx_sys_company_pc ON js_sys_company (parent_code);
CREATE INDEX idx_sys_company_ts ON js_sys_company (tree_sort);
CREATE INDEX idx_sys_company_status ON js_sys_company (status);
CREATE INDEX idx_sys_company_vc ON js_sys_company (view_code);
CREATE INDEX idx_sys_company_pcs ON js_sys_company (parent_codes);
CREATE INDEX idx_sys_company_tss ON js_sys_company (tree_sorts);
CREATE INDEX idx_sys_config_key ON js_sys_config (config_key);
CREATE INDEX idx_sys_dict_data_cc ON js_sys_dict_data (corp_code);
CREATE INDEX idx_sys_dict_data_dt ON js_sys_dict_data (dict_type);
CREATE INDEX idx_sys_dict_data_pc ON js_sys_dict_data (parent_code);
CREATE INDEX idx_sys_dict_data_status ON js_sys_dict_data (status);
CREATE INDEX idx_sys_dict_data_pcs ON js_sys_dict_data (parent_codes);
CREATE INDEX idx_sys_dict_data_ts ON js_sys_dict_data (tree_sort);
CREATE INDEX idx_sys_dict_data_tss ON js_sys_dict_data (tree_sorts);
CREATE INDEX idx_sys_dict_data_dv ON js_sys_dict_data (dict_value);
CREATE INDEX idx_sys_dict_type_is ON js_sys_dict_type (is_sys);
CREATE INDEX idx_sys_dict_type_status ON js_sys_dict_type (status);
CREATE INDEX idx_sys_employee_cco ON js_sys_employee (company_code);
CREATE INDEX idx_sys_employee_cc ON js_sys_employee (corp_code);
CREATE INDEX idx_sys_employee_ud ON js_sys_employee (update_date);
CREATE INDEX idx_sys_employee_oc ON js_sys_employee (office_code);
CREATE INDEX idx_sys_employee_status ON js_sys_employee (status);
CREATE INDEX idx_sys_file_entity_md5 ON js_sys_file_entity (file_md5);
CREATE INDEX idx_sys_file_entity_size ON js_sys_file_entity (file_size);
CREATE INDEX idx_sys_file_biz_ft ON js_sys_file_upload (file_type);
CREATE INDEX idx_sys_file_biz_fi ON js_sys_file_upload (file_id);
CREATE INDEX idx_sys_file_biz_status ON js_sys_file_upload (status);
CREATE INDEX idx_sys_file_biz_cb ON js_sys_file_upload (create_by);
CREATE INDEX idx_sys_file_biz_ud ON js_sys_file_upload (update_date);
CREATE INDEX idx_sys_file_biz_bt ON js_sys_file_upload (biz_type);
CREATE INDEX idx_sys_file_biz_bk ON js_sys_file_upload (biz_key);
CREATE INDEX idx_sys_job_status ON js_sys_job (status);
CREATE INDEX idx_sys_job_log_jn ON js_sys_job_log (job_name);
CREATE INDEX idx_sys_job_log_jg ON js_sys_job_log (job_group);
CREATE INDEX idx_sys_job_log_t ON js_sys_job_log (job_type);
CREATE INDEX idx_sys_job_log_e ON js_sys_job_log (job_event);
CREATE INDEX idx_sys_job_log_ie ON js_sys_job_log (is_exception);
CREATE INDEX idx_sys_lang_code ON js_sys_lang (lang_code);
CREATE INDEX idx_sys_lang_type ON js_sys_lang (lang_type);
CREATE INDEX idx_sys_log_cb ON js_sys_log (create_by);
CREATE INDEX idx_sys_log_cc ON js_sys_log (corp_code);
CREATE INDEX idx_sys_log_lt ON js_sys_log (log_type);
CREATE INDEX idx_sys_log_bk ON js_sys_log (biz_key);
CREATE INDEX idx_sys_log_bt ON js_sys_log (biz_type);
CREATE INDEX idx_sys_log_ie ON js_sys_log (is_exception);
CREATE INDEX idx_sys_log_cd ON js_sys_log (create_date);
CREATE INDEX idx_sys_menu_pc ON js_sys_menu (parent_code);
CREATE INDEX idx_sys_menu_ts ON js_sys_menu (tree_sort);
CREATE INDEX idx_sys_menu_status ON js_sys_menu (status);
CREATE INDEX idx_sys_menu_mt ON js_sys_menu (menu_type);
CREATE INDEX idx_sys_menu_pss ON js_sys_menu (parent_codes);
CREATE INDEX idx_sys_menu_tss ON js_sys_menu (tree_sorts);
CREATE INDEX idx_sys_menu_sc ON js_sys_menu (sys_code);
CREATE INDEX idx_sys_menu_is ON js_sys_menu (is_show);
CREATE INDEX idx_sys_menu_mcs ON js_sys_menu (module_codes);
CREATE INDEX idx_sys_menu_wt ON js_sys_menu (weight);
CREATE INDEX idx_sys_module_status ON js_sys_module (status);
CREATE INDEX idx_sys_msg_inner_cb ON js_sys_msg_inner (create_by);
CREATE INDEX idx_sys_msg_inner_status ON js_sys_msg_inner (status);
CREATE INDEX idx_sys_msg_inner_cl ON js_sys_msg_inner (content_level);
CREATE INDEX idx_sys_msg_inner_sc ON js_sys_msg_inner (send_user_code);
CREATE INDEX idx_sys_msg_inner_sd ON js_sys_msg_inner (send_date);
CREATE INDEX idx_sys_msg_inner_r_mi ON js_sys_msg_inner_record (msg_inner_id);
CREATE INDEX idx_sys_msg_inner_r_rc ON js_sys_msg_inner_record (receive_user_code);
CREATE INDEX idx_sys_msg_inner_r_ruc ON js_sys_msg_inner_record (receive_user_code);
CREATE INDEX idx_sys_msg_inner_r_status ON js_sys_msg_inner_record (read_status);
CREATE INDEX idx_sys_msg_inner_r_star ON js_sys_msg_inner_record (is_star);
CREATE INDEX idx_sys_msg_push_type ON js_sys_msg_push (msg_type);
CREATE INDEX idx_sys_msg_push_rc ON js_sys_msg_push (receive_code);
CREATE INDEX idx_sys_msg_push_uc ON js_sys_msg_push (receive_user_code);
CREATE INDEX idx_sys_msg_push_suc ON js_sys_msg_push (send_user_code);
CREATE INDEX idx_sys_msg_push_pd ON js_sys_msg_push (plan_push_date);
CREATE INDEX idx_sys_msg_push_ps ON js_sys_msg_push (push_status);
CREATE INDEX idx_sys_msg_push_rs ON js_sys_msg_push (read_status);
CREATE INDEX idx_sys_msg_push_bk ON js_sys_msg_push (biz_key);
CREATE INDEX idx_sys_msg_push_bt ON js_sys_msg_push (biz_type);
CREATE INDEX idx_sys_msg_push_imp ON js_sys_msg_push (is_merge_push);
CREATE INDEX idx_sys_msg_pushed_type ON js_sys_msg_pushed (msg_type);
CREATE INDEX idx_sys_msg_pushed_rc ON js_sys_msg_pushed (receive_code);
CREATE INDEX idx_sys_msg_pushed_uc ON js_sys_msg_pushed (receive_user_code);
CREATE INDEX idx_sys_msg_pushed_suc ON js_sys_msg_pushed (send_user_code);
CREATE INDEX idx_sys_msg_pushed_pd ON js_sys_msg_pushed (plan_push_date);
CREATE INDEX idx_sys_msg_pushed_ps ON js_sys_msg_pushed (push_status);
CREATE INDEX idx_sys_msg_pushed_rs ON js_sys_msg_pushed (read_status);
CREATE INDEX idx_sys_msg_pushed_bk ON js_sys_msg_pushed (biz_key);
CREATE INDEX idx_sys_msg_pushed_bt ON js_sys_msg_pushed (biz_type);
CREATE INDEX idx_sys_msg_pushed_imp ON js_sys_msg_pushed (is_merge_push);
CREATE INDEX idx_sys_msg_tpl_key ON js_sys_msg_template (tpl_key);
CREATE INDEX idx_sys_msg_tpl_type ON js_sys_msg_template (tpl_type);
CREATE INDEX idx_sys_msg_tpl_status ON js_sys_msg_template (status);
CREATE INDEX idx_sys_office_cc ON js_sys_office (corp_code);
CREATE INDEX idx_sys_office_pc ON js_sys_office (parent_code);
CREATE INDEX idx_sys_office_pcs ON js_sys_office (parent_codes);
CREATE INDEX idx_sys_office_status ON js_sys_office (status);
CREATE INDEX idx_sys_office_ot ON js_sys_office (office_type);
CREATE INDEX idx_sys_office_vc ON js_sys_office (view_code);
CREATE INDEX idx_sys_office_ts ON js_sys_office (tree_sort);
CREATE INDEX idx_sys_office_tss ON js_sys_office (tree_sorts);
CREATE INDEX idx_sys_post_cc ON js_sys_post (corp_code);
CREATE INDEX idx_sys_post_status ON js_sys_post (status);
CREATE INDEX idx_sys_post_ps ON js_sys_post (post_sort);
CREATE INDEX idx_sys_role_cc ON js_sys_role (corp_code);
CREATE INDEX idx_sys_role_is ON js_sys_role (is_sys);
CREATE INDEX idx_sys_role_status ON js_sys_role (status);
CREATE INDEX idx_sys_role_rs ON js_sys_role (role_sort);
CREATE INDEX idx_sys_user_lc ON js_sys_user (login_code);
CREATE INDEX idx_sys_user_email ON js_sys_user (email);
CREATE INDEX idx_sys_user_mobile ON js_sys_user (mobile);
CREATE INDEX idx_sys_user_wo ON js_sys_user (wx_openid);
CREATE INDEX idx_sys_user_imei ON js_sys_user (mobile_imei);
CREATE INDEX idx_sys_user_rt ON js_sys_user (user_type);
CREATE INDEX idx_sys_user_rc ON js_sys_user (ref_code);
CREATE INDEX idx_sys_user_mt ON js_sys_user (mgr_type);
CREATE INDEX idx_sys_user_us ON js_sys_user (user_weight);
CREATE INDEX idx_sys_user_ud ON js_sys_user (update_date);
CREATE INDEX idx_sys_user_status ON js_sys_user (status);
CREATE INDEX idx_sys_user_cc ON js_sys_user (corp_code);

View File

@@ -46,6 +46,7 @@ CREATE TABLE [js_gen_table]
[comments] nvarchar(500) NOT NULL,
[parent_table_name] varchar(64),
[parent_table_fk_name] varchar(64),
[data_source_name] varchar(64),
[tpl_category] varchar(200),
[package_name] varchar(500),
[module_name] varchar(30),
@@ -292,7 +293,7 @@ CREATE TABLE [js_sys_file_entity]
[file_path] nvarchar(1000) NOT NULL,
[file_content_type] varchar(200) NOT NULL,
[file_extension] varchar(100) NOT NULL,
[file_size] decimal(38) NOT NULL,
[file_size] decimal(31) NOT NULL,
PRIMARY KEY ([file_id])
);

View File

@@ -47,6 +47,7 @@ CREATE TABLE js_gen_table
comments varchar(500) NOT NULL COMMENT '表说明',
parent_table_name varchar(64) COMMENT '关联父表的表名',
parent_table_fk_name varchar(64) COMMENT '本表关联父表的外键名',
data_source_name varchar(64) COMMENT '数据源名称',
tpl_category varchar(200) COMMENT '使用的模板',
package_name varchar(500) COMMENT '生成包路径',
module_name varchar(30) COMMENT '生成模块名',
@@ -293,7 +294,7 @@ CREATE TABLE js_sys_file_entity
file_path varchar(1000) NOT NULL COMMENT '文件相对路径',
file_content_type varchar(200) NOT NULL COMMENT '文件内容类型',
file_extension varchar(100) NOT NULL COMMENT '文件后缀扩展名',
file_size decimal(38) NOT NULL COMMENT '文件大小(单位B)',
file_size decimal(31) NOT NULL COMMENT '文件大小(单位B)',
PRIMARY KEY (file_id),
UNIQUE (file_md5)
) COMMENT = '文件实体表';

View File

@@ -1,13 +0,0 @@
-- 打开 my.ini 给 [mysqld] 增加如下配置:
-- sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
set global read_only=0;
create user 'jeesite'@'%' identified by 'jeesite';
create database jeesite DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
grant all privileges on jeesite.* to 'jeesite'@'%' identified by 'jeesite';
flush privileges;

View File

@@ -46,6 +46,7 @@ CREATE TABLE js_gen_table
comments nvarchar2(500) NOT NULL,
parent_table_name varchar2(64),
parent_table_fk_name varchar2(64),
data_source_name varchar2(64),
tpl_category varchar2(200),
package_name varchar2(500),
module_name varchar2(30),
@@ -292,7 +293,7 @@ CREATE TABLE js_sys_file_entity
file_path nvarchar2(1000) NOT NULL,
file_content_type varchar2(200) NOT NULL,
file_extension varchar2(100) NOT NULL,
file_size number(38) NOT NULL,
file_size number(31) NOT NULL,
PRIMARY KEY (file_id)
);
@@ -924,6 +925,7 @@ COMMENT ON COLUMN js_gen_table.class_name IS '实体类名称';
COMMENT ON COLUMN js_gen_table.comments IS '表说明';
COMMENT ON COLUMN js_gen_table.parent_table_name IS '关联父表的表名';
COMMENT ON COLUMN js_gen_table.parent_table_fk_name IS '本表关联父表的外键名';
COMMENT ON COLUMN js_gen_table.data_source_name IS '数据源名称';
COMMENT ON COLUMN js_gen_table.tpl_category IS '使用的模板';
COMMENT ON COLUMN js_gen_table.package_name IS '生成包路径';
COMMENT ON COLUMN js_gen_table.module_name IS '生成模块名';

View File

@@ -1,15 +0,0 @@
create user jeesite
identified by jeesite
quota unlimited on users;
grant connect,resource,create session,select any table,
create any view,create any table,create any index,
drop any table,drop any view,drop any index
to jeesite;
-- 多数据源分布式事务下需要对目标用户进行如下授权否则会提示错误ResourceException: Error in recovery
grant select on sys.dba_pending_transactions to jeesite;
grant select on sys.pending_trans$ to jeesite;
grant select on sys.dba_2pc_pending to jeesite;
grant execute on sys.dbms_system to jeesite;

View File

@@ -46,6 +46,7 @@ CREATE TABLE js_gen_table
comments varchar(500) NOT NULL,
parent_table_name varchar(64),
parent_table_fk_name varchar(64),
data_source_name varchar(64),
tpl_category varchar(200),
package_name varchar(500),
module_name varchar(30),
@@ -292,7 +293,7 @@ CREATE TABLE js_sys_file_entity
file_path varchar(1000) NOT NULL,
file_content_type varchar(200) NOT NULL,
file_extension varchar(100) NOT NULL,
file_size decimal(38) NOT NULL,
file_size decimal(31) NOT NULL,
PRIMARY KEY (file_id)
) WITHOUT OIDS;
@@ -924,6 +925,7 @@ COMMENT ON COLUMN js_gen_table.class_name IS '实体类名称';
COMMENT ON COLUMN js_gen_table.comments IS '表说明';
COMMENT ON COLUMN js_gen_table.parent_table_name IS '关联父表的表名';
COMMENT ON COLUMN js_gen_table.parent_table_fk_name IS '本表关联父表的外键名';
COMMENT ON COLUMN js_gen_table.data_source_name IS '数据源名称';
COMMENT ON COLUMN js_gen_table.tpl_category IS '使用的模板';
COMMENT ON COLUMN js_gen_table.package_name IS '生成包路径';
COMMENT ON COLUMN js_gen_table.module_name IS '生成模块名';

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>4.0.7-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
@@ -23,12 +23,38 @@
<dependencies>
<!-- JDBC device begin -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- JDBC device end -->
<!-- Common -->
<dependency>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- Framework -->
<dependency>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-framework</artifactId>

View File

@@ -18,9 +18,6 @@ import com.jeesite.common.config.Global;
import com.jeesite.common.shiro.realm.BaseAuthorizingRealm;
import com.jeesite.common.shiro.realm.LoginInfo;
import com.jeesite.common.web.http.ServletUtils;
import com.jeesite.modules.sys.entity.Log;
import com.jeesite.modules.sys.utils.LogUtils;
import com.jeesite.modules.sys.utils.UserUtils;
/**
* 登出过滤器
@@ -41,16 +38,16 @@ public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter
try {
Object principal = subject.getPrincipal();
if (principal != null){
// 记录用户退出日志(@Deprecated v4.0.5支持setAuthorizingRealm之后版本可删除此if子句
if (authorizingRealm == null){
LogUtils.saveLog(UserUtils.getUser(), ServletUtils.getRequest(),
"系统退出", Log.TYPE_LOGIN_LOGOUT);
}
// 退出成功之前初始化授权信息并处理登录后的操作
else{
// // 记录用户退出日志(@Deprecated v4.0.5支持setAuthorizingRealm之后版本可删除此if子句
// if (authorizingRealm == null){
// LogUtils.saveLog(UserUtils.getUser(), ServletUtils.getRequest(),
// "系统退出", Log.TYPE_LOGIN_LOGOUT);
// }
// else{
// 退出成功之前初始化授权信息并处理登录后的操作
authorizingRealm.onLogoutSuccess((LoginInfo)subject.getPrincipal(),
(HttpServletRequest)request);
}
// }
}
// 退出登录
subject.logout();

View File

@@ -5,6 +5,10 @@ package com.jeesite.common.shiro.realm;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.codec.Sha1Utils;
import com.jeesite.common.utils.SpringUtils;
import com.jeesite.modules.sys.entity.Log;
import com.jeesite.modules.sys.entity.User;
@@ -18,11 +22,48 @@ import com.jeesite.modules.sys.utils.UserUtils;
* @version 2018-7-11
*/
public class AuthorizingRealm extends BaseAuthorizingRealm {
public static final String HASH_ALGORITHM = "SHA-1";
public static final int HASH_INTERATIONS = 1024;
public static final int SALT_SIZE = 8;
private UserService userService;
public AuthorizingRealm() {
super();
// 设定密码校验的Hash算法与迭代次数
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(HASH_ALGORITHM);
matcher.setHashIterations(HASH_INTERATIONS);
this.setCredentialsMatcher(matcher);
}
/**
* 生成密文密码生成随机的16位salt并经过1024次 sha-1 hash
* @param plainPassword 明文密码
* @return 16位salt密钥 + 40位hash密码
*/
public String encryptPassword(String plainPassword) {
String plain = EncodeUtils.decodeHtml(plainPassword);
byte[] salt = Sha1Utils.genSalt(SALT_SIZE);
byte[] hashPassword = Sha1Utils.sha1(plain.getBytes(), salt, HASH_INTERATIONS);
return EncodeUtils.encodeHex(salt) + EncodeUtils.encodeHex(hashPassword);
}
/**
* 验证密码正确性
* @param plainPassword 明文密码
* @param password 密文密码
* @return 验证成功返回true
*/
public boolean validatePassword(String plainPassword, String password) {
try{
String plain = EncodeUtils.decodeHtml(plainPassword);
byte[] salt = EncodeUtils.decodeHex(password.substring(0, 16));
byte[] hashPassword = Sha1Utils.sha1(plain.getBytes(), salt, HASH_INTERATIONS);
return password.equals(EncodeUtils.encodeHex(salt) + EncodeUtils.encodeHex(hashPassword));
}catch(Exception e){
return false;
}
}
@Override

View File

@@ -54,8 +54,8 @@ public class ShiroConfig {
@Bean
@Order(3000)
@ConditionalOnMissingBean(name="shiroFilterProxy")
public FilterRegistrationBean shiroFilterProxy(ShiroFilterFactoryBean shiroFilter) throws Exception {
FilterRegistrationBean bean = new FilterRegistrationBean();
public FilterRegistrationBean<Filter> shiroFilterProxy(ShiroFilterFactoryBean shiroFilter) throws Exception {
FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<>();
bean.setFilter((Filter) shiroFilter.getInstance());
bean.addUrlPatterns("/*");
return bean;

View File

@@ -25,8 +25,8 @@ public class DruidStatConfig {
* 注册DruidFilter拦截
*/
@Bean
public FilterRegistrationBean duridFilter() {
FilterRegistrationBean bean = new FilterRegistrationBean();
public FilterRegistrationBean<WebStatFilter> duridFilter() {
FilterRegistrationBean<WebStatFilter> bean = new FilterRegistrationBean<>();
bean.setFilter(new WebStatFilter());
bean.addInitParameter("exclusions", "*.css,*.js,*.png,"
+ "*.jpg,*.gif,*.jpeg,*.bmp,*.ico,*.swf,*.psd,*.htc,*.htm,*.html,"
@@ -40,8 +40,8 @@ public class DruidStatConfig {
* 注册DruidServlet
*/
@Bean
public ServletRegistrationBean druidServlet() {
ServletRegistrationBean bean = new ServletRegistrationBean();
public ServletRegistrationBean<StatViewServlet> druidServlet() {
ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>();
bean.setServlet(new StatViewServlet());
bean.addUrlMappings("/druid/*");
return bean;

View File

@@ -3,42 +3,47 @@
*/
package com.jeesite.modules.config.web;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import com.jeesite.common.config.Global;
import com.jeesite.common.web.PageCachingFilter;
/**
* Filter 配置
* 页面缓存,如果需要,则加入如下依赖并取消下面注释
1、pom.xml:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-web</artifactId>
<version>2.0.4</version>
</dependency>
2、application.yml:
# 页面缓存配置
ehcache:
pageCaching:
enabled: false
urlPatterns: "*.html"
* @author ThinkGem
* @version 2017年11月30日
*/
@Configuration
public class PageCacheConfig {
/**
* PageCache Filter, cache .html suffix.
*/
@Bean
@Order(2000)
@ConditionalOnProperty(name = "ehcache.pageCaching.enabled", havingValue = "true")
@ConditionalOnMissingBean(name="pageCachingFilter")
public FilterRegistrationBean pageCachingFilter(EhCacheManagerFactoryBean ehCacheManager) {
FilterRegistrationBean bean = new FilterRegistrationBean();
PageCachingFilter pageCachingFilter = new PageCachingFilter();
pageCachingFilter.setCacheManager(ehCacheManager.getObject());
bean.setFilter(pageCachingFilter);
bean.addInitParameter("cacheName", "pageCachingFilter");
bean.addUrlPatterns(StringUtils.split(Global.getProperty(
"ehcache.pageCaching.urlPatterns"), ","));
return bean;
}
// /**
// * PageCache Filter, cache .html suffix.
// */
// @Bean
// @Order(2000)
// @ConditionalOnProperty(name = "ehcache.pageCaching.enabled", havingValue = "true")
// @ConditionalOnMissingBean(name="pageCachingFilter")
// public FilterRegistrationBean<PageCachingFilter> pageCachingFilter(EhCacheManagerFactoryBean ehCacheManager) {
// FilterRegistrationBean<PageCachingFilter> bean = new FilterRegistrationBean<>();
// SimplePageCachingFilter pageCachingFilter = new SimplePageCachingFilter();
// pageCachingFilter.setCacheManager(ehCacheManager.getObject());
// bean.setFilter(pageCachingFilter);
// bean.addInitParameter("cacheName", "pageCachingFilter");
// bean.addUrlPatterns(StringUtils.split(Global.getProperty(
// "ehcache.pageCaching.urlPatterns"), ","));
// return bean;
// }
}

View File

@@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.jeesite.common.config.Global;
import com.jeesite.common.lang.StringUtils;
@@ -22,7 +22,7 @@ import com.jeesite.modules.sys.interceptor.LogInterceptor;
@Configuration
@EnableWebMvc
@ConditionalOnProperty(name="web.interceptor.log.enabled", havingValue="true", matchIfMissing=true)
public class LogInterceptorConfig extends WebMvcConfigurerAdapter {
public class LogInterceptorConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {

View File

@@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.jeesite.common.config.Global;
import com.jeesite.common.lang.StringUtils;
@@ -22,7 +22,7 @@ import com.jeesite.modules.sys.interceptor.MobileInterceptor;
@Configuration
@EnableWebMvc
@ConditionalOnProperty(name="web.interceptor.mobile.enabled", havingValue="true", matchIfMissing=false)
public class MobileViewInterceptorConfig extends WebMvcConfigurerAdapter {
public class MobileViewInterceptorConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {

View File

@@ -4,7 +4,7 @@
package com.jeesite.modules.sys.entity;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotBlank;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.entity.TreeEntity;

View File

@@ -9,7 +9,7 @@ import javax.validation.constraints.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotBlank;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.BaseEntity;

View File

@@ -61,7 +61,9 @@ import com.jeesite.common.utils.excel.fieldtype.OfficeType;
@Column(name="area_name", label="区域名称", isQuery=false),
@Column(name="area_type", label="区域类型"),
}),
}, extWhereKeys="dsfOffice, dsfCompany", orderBy="a.user_weight DESC, a.update_date DESC"
},
extWhereKeys="dsfOffice, dsfCompany",
orderBy="a.user_weight DESC, a.update_date DESC"
)
public class EmpUser extends User {

View File

@@ -7,7 +7,7 @@ import java.util.Map;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotBlank;
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.entity.BaseEntity;

View File

@@ -6,7 +6,7 @@ package com.jeesite.modules.sys.entity;
import javax.validation.constraints.Pattern;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeesite.common.entity.BaseEntity;
@@ -47,7 +47,7 @@ public class Office extends TreeEntity<Office> {
private String viewCode; // 机构代码(作为显示用,多租户内唯一)
private String officeName; // 机构名称
private String fullName; // 机构全称
private String officeType; // 机构类型1公司2部门3小组
private String officeType; // 机构类型1省级公司2市级公司3部门
private String leader; // 负责人
private String phone; // 电话
private String address; // 联系地址

View File

@@ -4,7 +4,7 @@
package com.jeesite.modules.sys.entity;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotBlank;
import com.jeesite.common.entity.BaseEntity;
import com.jeesite.common.entity.DataEntity;
@@ -16,7 +16,7 @@ import com.jeesite.common.mybatis.mapper.query.QueryType;
@Column(includeEntity=BaseEntity.class),
@Column(includeEntity=DataEntity.class),
@Column(name="post_code", attrName="postCode", label="岗位编码", isPK=true),
@Column(name="post_name", attrName="postName", label="岗位名称", queryType=QueryType.LIKE),
@Column(name="post_name", attrName="postName", label="岗位名称"),
@Column(name="post_type", attrName="postType", label="岗位分类", comment="岗位分类(高管、中层、基层)"),
@Column(name="post_sort", attrName="postSort", label="岗位排序", comment="岗位排序(升序)"),
}, orderBy="a.update_date DESC"
@@ -57,6 +57,14 @@ public class Post extends DataEntity<Post> {
this.postName = postName;
}
public String getPostName_like() {
return getSqlMap().getWhere().getValue("post_name", QueryType.LIKE);
}
public void setPostName_like(String roleName) {
getSqlMap().getWhere().and("post_name", QueryType.LIKE, roleName);
}
@Length(min=0, max=100, message="岗位分类长度不能超过 100 个字符")
public String getPostType() {
return postType;

View File

@@ -68,8 +68,8 @@ public class EmpUserService extends CrudService<EmpUserDao, EmpUser> {
* 分页查询数据
*/
@Override
public Page<EmpUser> findPage(Page<EmpUser> page, EmpUser empUser) {
return super.findPage(page, empUser);
public Page<EmpUser> findPage(EmpUser empUser) {
return super.findPage(empUser);
}
/**

View File

@@ -41,8 +41,8 @@ public class EmployeeService extends CrudService<EmployeeDao, Employee> {
* 查询分页数据
*/
@Override
public Page<Employee> findPage(Page<Employee> page, Employee employee) {
return super.findPage(page, employee);
public Page<Employee> findPage(Employee employee) {
return super.findPage(employee);
}
/**

View File

@@ -25,7 +25,7 @@ public class LogService extends CrudService<LogDao, Log> {
* 查询日志记录
*/
@Override
public Page<Log> findPage(Page<Log> page, Log log) {
public Page<Log> findPage(Log log) {
// // 设置默认时间范围,默认当前月
// if (log.getCreateDate_gte() == null){
// log.setCreateDate_gte(DateUtils.setDays(new Date(), 1));
@@ -37,7 +37,7 @@ public class LogService extends CrudService<LogDao, Log> {
if (!log.getCurrentUser().isAdmin()){
log.setCreateBy(log.getCurrentUser().getUserCode());
}
return super.findPage(page, log);
return super.findPage(log);
}

View File

@@ -38,11 +38,11 @@ public class PostService extends CrudService<PostDao, Post> {
}
/**
* 查询可分页的岗位列表
* 查询岗位
*/
@Override
public Page<Post> findPage(Page<Post> page, Post post) {
return super.findPage(page, post);
public Page<Post> findPage(Post post) {
return super.findPage(post);
}
/**

View File

@@ -0,0 +1,53 @@
///**
// * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
// */
//package com.jeesite.modules.sys.service.impl;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.stereotype.Service;
//
//import com.jeesite.modules.file.entity.FileEntity;
//import com.jeesite.modules.file.entity.FileUpload;
//import com.jeesite.modules.file.service.FileUploadServiceExtendSupport;
//
///**
// * 文件上传扩展实现类
// * @author ThinkGem
// * @version 2018年10月13日
// */
//@Service
//public class FileUploadServiceExtendImpl extends FileUploadServiceExtendSupport {
//
// @Override
// public boolean fileExists(FileEntity fileEntity) {
// System.out.println("============= fileupload fileExists ");
// return super.fileExists(fileEntity);
// }
//
// @Override
// public void uploadFile(FileEntity fileEntity) {
// System.out.println("============= fileupload uploadFile ");
// super.uploadFile(fileEntity);
// }
//
// @Override
// public void saveUploadFile(FileUpload fileUpload) {
// System.out.println("============= fileupload saveUploadFile ");
// super.saveUploadFile(fileUpload);
// }
//
// @Override
// public String getFileUrl(FileUpload fileUpload) {
// System.out.println("============= fileupload getFileUrl ");
// return super.getFileUrl(fileUpload);
// }
//
// @Override
// public String downFile(FileUpload fileUpload, HttpServletRequest request, HttpServletResponse response) {
// System.out.println("============= fileupload downFile ");
// return super.downFile(fileUpload, request, response);
// }
//
//}

View File

@@ -0,0 +1,49 @@
///**
// * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
// */
//package com.jeesite.modules.sys.service.impl;
//
//import java.util.List;
//
//import org.springframework.stereotype.Service;
//
//import com.jeesite.modules.sys.entity.Menu;
//import com.jeesite.modules.sys.service.MenuServiceSupport;
//
///**
// * 菜单服务扩展实现类
// * @author ThinkGem
// * @version 2018年10月13日
// */
//@Service
//public class MenuServiceExtendImpl extends MenuServiceSupport {
//
// public MenuServiceExtendImpl() {
// this.entityClass = Menu.class;
// }
//
// @Override
// public Menu get(Menu menu) {
// System.out.println("============= menu get ");
// return super.get(menu);
// }
//
// @Override
// public List<Menu> findList(Menu menu) {
// System.out.println("============= menu findList ");
// return super.findList(menu);
// }
//
// @Override
// public List<Menu> findByRoleCode(Menu menu) {
// System.out.println("============= menu findByRoleCode ");
// return super.findByRoleCode(menu);
// }
//
// @Override
// public List<Menu> findByUserCode(Menu menu) {
// System.out.println("============= menu findByUserCode ");
// return super.findByUserCode(menu);
// }
//
//}

View File

@@ -0,0 +1,43 @@
///**
// * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
// */
//package com.jeesite.modules.sys.service.impl;
//
//import java.util.List;
//
//import org.springframework.stereotype.Service;
//
//import com.jeesite.modules.sys.entity.Role;
//import com.jeesite.modules.sys.service.RoleServiceSupport;
//
///**
// * 角色服务扩展实现类
// * @author ThinkGem
// * @version 2018年10月13日
// */
//@Service
//public class RoleServiceExtendImpl extends RoleServiceSupport {
//
// public RoleServiceExtendImpl() {
// this.entityClass = Role.class;
// }
//
// @Override
// public Role get(Role role) {
// System.out.println("============= role get ");
// return super.get(role);
// }
//
// @Override
// public List<Role> findList(Role role) {
// System.out.println("============= role findList ");
// return super.findList(role);
// }
//
// @Override
// public List<Role> findListByUserCode(Role role) {
// System.out.println("============= role findListByUserCode ");
// return super.findListByUserCode(role);
// }
//
//}

View File

@@ -0,0 +1,49 @@
///**
// * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
// */
//package com.jeesite.modules.sys.service.impl;
//
//import java.util.List;
//
//import org.springframework.stereotype.Service;
//
//import com.jeesite.modules.sys.entity.User;
//import com.jeesite.modules.sys.service.UserServiceSupport;
//
///**
// * 用户服务扩展实现类
// * @author ThinkGem
// * @version 2018年10月13日
// */
//@Service
//public class UserServiceExtendImpl extends UserServiceSupport {
//
// public UserServiceExtendImpl() {
// this.entityClass = User.class;
// }
//
// @Override
// public User get(User user) {
// System.out.println("============= user get ");
// return super.get(user);
// }
//
// @Override
// public User getByLoginCode(User user) {
// System.out.println("============= user getByLoginCode ");
// return super.getByLoginCode(user);
// }
//
// @Override
// public User getByUserTypeAndRefCode(User user) {
// System.out.println("============= user getByUserTypeAndRefCode ");
// return super.getByUserTypeAndRefCode(user);
// }
//
// @Override
// public List<User> findList(User user) {
// System.out.println("============= user findList ");
// return super.findList(user);
// }
//
//}

View File

@@ -28,7 +28,6 @@ import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sys.entity.Company;
import com.jeesite.modules.sys.entity.Office;
import com.jeesite.modules.sys.entity.UserDataScope;
import com.jeesite.modules.sys.service.CompanyService;
import com.jeesite.modules.sys.service.OfficeService;
import com.jeesite.modules.sys.utils.UserUtils;
@@ -74,7 +73,7 @@ public class CompanyController extends BaseController {
@RequiresPermissions("user")
@RequestMapping(value = "listData")
@ResponseBody
public List<Company> listData(Company company) {
public List<Company> listData(Company company, String ctrlPermi) {
if (StringUtils.isBlank(company.getParentCode())) {
company.setParentCode(Company.ROOT_CODE);
}
@@ -83,7 +82,7 @@ public class CompanyController extends BaseController {
|| StringUtils.isNotBlank(company.getFullName())){
company.setParentCode(null);
}
companyService.addDataScopeFilter(company, UserDataScope.CTRL_PERMI_MANAGE);
companyService.addDataScopeFilter(company, ctrlPermi);
List<Company> list = companyService.findList(company);
return list;
}
@@ -211,8 +210,7 @@ public class CompanyController extends BaseController {
Company where = new Company();
where.setStatus(Company.STATUS_NORMAL);
if (!(isAll != null && isAll)){
companyService.addDataScopeFilter(where, StringUtils.defaultIfBlank(
ctrlPermi, UserDataScope.CTRL_PERMI_HAVE));
companyService.addDataScopeFilter(where, ctrlPermi);
}
List<Company> list = companyService.findList(where);
for (int i = 0; i < list.size(); i++) {

View File

@@ -65,7 +65,8 @@ public class LogController extends BaseController {
@RequestMapping(value = "listData")
@ResponseBody
public Page<Log> listData(Log log, HttpServletRequest request, HttpServletResponse response) {
Page<Log> page = logService.findPage(new Page<Log>(request, response), log);
log.setPage(new Page<>(request, response));
Page<Log> page = logService.findPage(log);
return page;
}

View File

@@ -33,7 +33,7 @@ import com.jeesite.common.web.CookieUtils;
import com.jeesite.common.web.http.ServletUtils;
import com.jeesite.modules.sys.entity.Menu;
import com.jeesite.modules.sys.entity.User;
import com.jeesite.modules.sys.service.UserService;
import com.jeesite.modules.sys.utils.PwdUtils;
import com.jeesite.modules.sys.utils.UserUtils;
/**
@@ -280,7 +280,7 @@ public class LoginController extends BaseController{
}
// 初始密码策略和密码修改策略验证0关闭1提醒用户2强制修改初始或旧密码
String passwordModifyUrl = UserService.passwordModifyValid(user, model);
String passwordModifyUrl = PwdUtils.passwordModifyValid(user, model);
if (passwordModifyUrl != null){
try {
request.getRequestDispatcher(passwordModifyUrl).forward(request, response);
@@ -334,8 +334,8 @@ public class LoginController extends BaseController{
if (user.isSuperAdmin() && StringUtils.isNotBlank(sysCode)){
if (!StringUtils.equals(principal.getParam("sysCode"), sysCode)){
principal.setParam("sysCode", sysCode);
UserUtils.removeCacheByKeyPrefix(UserUtils.CACHE_MENU_LIST);
UserUtils.removeCache(UserUtils.CACHE_AUTH_INFO);
UserUtils.removeCache(UserUtils.CACHE_MENU_LIST);
}
}
return REDIRECT + adminPath + "/index";

View File

@@ -24,7 +24,6 @@ import com.jeesite.common.idgen.IdGen;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sys.entity.Office;
import com.jeesite.modules.sys.entity.UserDataScope;
import com.jeesite.modules.sys.service.OfficeService;
import com.jeesite.modules.sys.utils.UserUtils;
import com.jeesite.modules.sys.web.user.EmpUserController;
@@ -71,7 +70,7 @@ public class OfficeController extends BaseController {
@RequiresPermissions("user")
@RequestMapping(value = "listData")
@ResponseBody
public List<Office> listData(Office office) {
public List<Office> listData(Office office, String ctrlPermi) {
if (StringUtils.isBlank(office.getParentCode())){
office.setParentCode(Office.ROOT_CODE);
}
@@ -80,7 +79,7 @@ public class OfficeController extends BaseController {
|| StringUtils.isNotBlank(office.getFullName())){
office.setParentCode(null);
}
officeService.addDataScopeFilter(office, UserDataScope.CTRL_PERMI_MANAGE);
officeService.addDataScopeFilter(office, ctrlPermi);
List<Office> list = officeService.findList(office);
return list;
}
@@ -204,7 +203,7 @@ public class OfficeController extends BaseController {
* @param excludeCode 排除的ID
* @param parentCode 上级Code
* @param isAll 是否显示所有机构true不进行权限过滤
* @param officeTypes 机构类型1公司, 2部门, 3小组, 4其它
* @param officeTypes 机构类型1省级公司2市级公司3部门
* @param companyCode 仅查询公司下的机构
* @param isShowCode 是否显示编码true or 1显示在左侧2显示在右侧false or null不显示
* @param isShowFullName 是否显示全机构名称
@@ -224,8 +223,7 @@ public class OfficeController extends BaseController {
where.setStatus(Office.STATUS_NORMAL);
where.setCompanyCode(companyCode);
if (!(isAll != null && isAll)){
officeService.addDataScopeFilter(where, StringUtils.defaultIfBlank(
ctrlPermi, UserDataScope.CTRL_PERMI_HAVE));
officeService.addDataScopeFilter(where, ctrlPermi);
}
List<Office> list = officeService.findList(where);
for (int i = 0; i < list.size(); i++) {
@@ -272,7 +270,7 @@ public class OfficeController extends BaseController {
map.put("isParent", true);
List<Map<String, Object>> userList;
userList = empUserController.treeData("u_", e.getOfficeCode(), e.getOfficeCode(),
companyCode, postCode, roleCode, isAll, isShowCode);
companyCode, postCode, roleCode, isAll, isShowCode, ctrlPermi);
mapList.addAll(userList);
}
mapList.add(map);

View File

@@ -106,13 +106,15 @@ public class OnlineController extends BaseController{
map.put("startTimestamp", DateUtils.formatDateTime(session.getStartTimestamp()));
map.put("lastAccessTime", DateUtils.formatDateTime(session.getLastAccessTime()));
map.put("timeout", TimeUtils.formatDateAgo(session.getTimeout()-(currentTime-session.getLastAccessTime().getTime())));
PrincipalCollection pc = (PrincipalCollection)session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
LoginInfo principal = (pc != null ? (LoginInfo)pc.getPrimaryPrincipal() : null);
if (principal != null){
map.put("userCode", session.getAttribute("userCode"));// principal.getId());
map.put("userName", session.getAttribute("userName"));// principal.getName());
map.put("userType", session.getAttribute("userType"));// ObjectUtils.toString(principal.getParam("userType")));
map.put("deviceType", ObjectUtils.toString(principal.getParam("deviceType")));
Object pc = session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
if (pc != null && pc instanceof PrincipalCollection){
LoginInfo loginInfo = (LoginInfo)((PrincipalCollection)pc).getPrimaryPrincipal();
if (loginInfo != null){
map.put("userCode", session.getAttribute("userCode"));// principal.getId());
map.put("userName", session.getAttribute("userName"));// principal.getName());
map.put("userType", session.getAttribute("userType"));// ObjectUtils.toString(principal.getParam("userType")));
map.put("deviceType", ObjectUtils.toString(loginInfo.getParam("deviceType")));
}
}
map.put("host", session.getHost());
list.add(map);

View File

@@ -51,7 +51,8 @@ public class PostController extends BaseController {
@RequestMapping(value = {"listData"})
@ResponseBody
public Page<Post> listData(Post post, HttpServletRequest request, HttpServletResponse response) {
Page<Post> page = postService.findPage(new Page<Post>(request, response), post);
post.setPage(new Page<>(request, response));
Page<Post> page = postService.findPage(post);
return page;
}

View File

@@ -25,6 +25,7 @@ import com.jeesite.common.service.ServiceException;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sys.entity.User;
import com.jeesite.modules.sys.service.UserService;
import com.jeesite.modules.sys.utils.PwdUtils;
import com.jeesite.modules.sys.utils.UserUtils;
import com.jeesite.modules.sys.utils.ValidCodeUtils;
@@ -201,9 +202,9 @@ public class AccountController extends BaseController{
// 验证三个密保问题是否正确。
User u = UserUtils.getByLoginCode(user.getLoginCode());
if (!(u != null && loginCode.equals(user.getLoginCode())
&& UserService.validatePassword(user.getPwdQuestionAnswer(), u.getPwdQuestionAnswer())
&& UserService.validatePassword(user.getPwdQuestionAnswer2(), u.getPwdQuestionAnswer2())
&& UserService.validatePassword(user.getPwdQuestionAnswer3(), u.getPwdQuestionAnswer3()))) {
&& PwdUtils.validatePassword(user.getPwdQuestionAnswer(), u.getPwdQuestionAnswer())
&& PwdUtils.validatePassword(user.getPwdQuestionAnswer2(), u.getPwdQuestionAnswer2())
&& PwdUtils.validatePassword(user.getPwdQuestionAnswer3(), u.getPwdQuestionAnswer3()))) {
return renderResult(Global.FALSE, "您填写的密保问题答案不正确!");
}

View File

@@ -4,21 +4,26 @@
package com.jeesite.modules.sys.web.user;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.config.Global;
import com.jeesite.common.entity.Page;
import com.jeesite.common.lang.StringUtils;
@@ -64,7 +69,8 @@ public class CorpAdminController extends BaseController {
user.getSqlMap().getWhere().disableAutoAddCorpCodeWhere()
.and("corp_code", QueryType.EQ, user.getCorpCode_())
.and("corp_name", QueryType.LIKE, user.getCorpName_());
Page<User> page = userService.findPage(new Page<User>(request, response), user);
user.setPage(new Page<>(request, response));
Page<User> page = userService.findPage(user);
return page;
}
@@ -215,5 +221,55 @@ public class CorpAdminController extends BaseController {
return renderResult(Global.TRUE, "取消用户'" + user.getUserName() + "'管理员身份成功!");
}
}
/**
* 查询租户数据树格式
* @param pId 父级编码,默认 -1
* @param isShowCode 是否显示编码true or 1显示在左侧2显示在右侧false or null不显示
* @return
*/
@RequiresPermissions("user")
@RequestMapping(value = "treeData")
@ResponseBody
public List<Map<String, Object>> treeData(String pId, String isShowCode) {
List<Map<String, Object>> mapList = ListUtils.newArrayList();
User where = new User();
List<User> list = userService.findCorpList(where);
for (int i = 0; i < list.size(); i++) {
User e = list.get(i);
Map<String, Object> map = MapUtils.newHashMap();
map.put("id", e.getCorpCode_());
map.put("pId", StringUtils.defaultIfBlank(pId, "-1"));
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.getCorpCode_(), e.getCorpName_()));
mapList.add(map);
}
return mapList;
}
/**
* 切换租户
* @param user
* @return
*/
@RequiresPermissions("sys:corpAdmin:edit")
@RequestMapping(value = "switch/{corpCode}")
@ResponseBody
public String switchCorp(@PathVariable String corpCode) {
if (UserUtils.getUser().isSuperAdmin()){
User where = new User();
where.setCorpCode_(corpCode);
List<User> list = userService.findCorpList(where);
if (list.size() > 0){
Session session = UserUtils.getSession();
User user = list.get(0);
session.setAttribute("corpCode", user.getCorpCode_());
session.setAttribute("corpName", user.getCorpName_());
return renderResult(Global.TRUE, "租户切换成功!");
}else{
return renderResult(Global.TRUE, "租户切换失败,没有这个租户!");
}
}
return renderResult(Global.FALSE, "租户切换失败,只有超级管理员才可以操作!");
}
}

View File

@@ -92,13 +92,13 @@ public class EmpUserController extends BaseController {
@RequiresPermissions("user")
@RequestMapping(value = "listData")
@ResponseBody
public Page<EmpUser> listData(EmpUser empUser, Boolean isAll, HttpServletRequest request, HttpServletResponse response) {
public Page<EmpUser> listData(EmpUser empUser, Boolean isAll, String ctrlPermi, HttpServletRequest request, HttpServletResponse response) {
empUser.getEmployee().getOffice().setIsQueryChildren(true);
empUser.getEmployee().getCompany().setIsQueryChildren(true);
if (!(isAll != null && isAll)){
empUserService.addDataScopeFilter(empUser, UserDataScope.CTRL_PERMI_MANAGE);
empUserService.addDataScopeFilter(empUser, ctrlPermi);
}
empUser.setPage(new Page<EmpUser>(request, response));
empUser.setPage(new Page<>(request, response));
Page<EmpUser> page = empUserService.findPage(empUser);
return page;
}
@@ -172,11 +172,11 @@ public class EmpUserController extends BaseController {
*/
@RequiresPermissions("sys:empUser:view")
@RequestMapping(value = "exportData")
public void exportData(EmpUser empUser, Boolean isAll, HttpServletResponse response) {
public void exportData(EmpUser empUser, Boolean isAll, String ctrlPermi, HttpServletResponse response) {
empUser.getEmployee().getOffice().setIsQueryChildren(true);
empUser.getEmployee().getCompany().setIsQueryChildren(true);
if (!(isAll != null && isAll)){
empUserService.addDataScopeFilter(empUser, UserDataScope.CTRL_PERMI_MANAGE);
empUserService.addDataScopeFilter(empUser, ctrlPermi);
}
List<EmpUser> list = empUserService.findList(empUser);
String fileName = "用户数据" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
@@ -354,8 +354,8 @@ public class EmpUserController extends BaseController {
@RequestMapping(value = "treeData")
@ResponseBody
public List<Map<String, Object>> treeData(String idPrefix, String pId,
String officeCode, String companyCode, String postCode,
String roleCode, Boolean isAll, String isShowCode) {
String officeCode, String companyCode, String postCode, String roleCode,
Boolean isAll, String isShowCode, String ctrlPermi) {
List<Map<String, Object>> mapList = ListUtils.newArrayList();
EmpUser empUser = new EmpUser();
Employee employee = empUser.getEmployee();
@@ -369,7 +369,7 @@ public class EmpUserController extends BaseController {
empUser.setUserType(User.USER_TYPE_EMPLOYEE);
empUser.setMgrType(User.MGR_TYPE_NOT_ADMIN);
if (!(isAll != null && isAll)) {
empUserService.addDataScopeFilter(empUser);
empUserService.addDataScopeFilter(empUser, ctrlPermi);
}
List<EmpUser> list = empUserService.findList(empUser);
for (int i = 0; i < list.size(); i++) {
@@ -388,13 +388,12 @@ public class EmpUserController extends BaseController {
*/
@RequiresPermissions("user")
@RequestMapping(value = "empUserSelect")
public String empUserSelect(EmpUser empUser, String selectData, String checkbox, Model model) {
public String empUserSelect(EmpUser empUser, String selectData, Model model) {
String selectDataJson = EncodeUtils.decodeUrl(selectData);
if (JsonMapper.fromJson(selectDataJson, Map.class) != null){
model.addAttribute("selectData", selectDataJson);
}
model.addAttribute("checkbox", checkbox); // 是否显示复选框,支持多选
model.addAttribute("empUser", empUser); // ModelAttribute
model.addAttribute("empUser", empUser);
return "modules/sys/user/empUserSelect";
}

View File

@@ -55,7 +55,8 @@ public class SecAdminController extends BaseController {
@ResponseBody
public Page<User> listData(User user, HttpServletRequest request, HttpServletResponse response) {
user.setMgrType(User.MGR_TYPE_SEC_ADMIN); // 二级管理员
Page<User> page = userService.findPage(new Page<User>(request, response), user);
user.setPage(new Page<>(request, response));
Page<User> page = userService.findPage(user);
return page;
}

View File

@@ -1,8 +1,8 @@
# 温馨提示:不建议直接修改此文件,为了平台升级方便,建议将需要修改的参数值,复制到jeesite.yml里进行覆盖该参数值。
# 温馨提示:不建议直接修改此文件,为了平台升级方便,建议将需要修改的参数值,复制到application.yml里进行覆盖该参数值。
#============================#
#===== Database sttings =====#
#============================#
#======================================#
#========== Database sttings ==========#
#======================================#
# 数据库连接
jdbc:
@@ -24,7 +24,7 @@ jdbc:
minIdle: 3
# 最大连接数
maxActive: 20
# 获取连接等待超时时间单位毫秒4.0.6+
maxWait: 60000
@@ -42,25 +42,6 @@ jdbc:
removeAbandoned: true
removeAbandonedTimeout: 1800
# # 多数据源名称列表,启用方式:@MyBatisDao(dataSourceName="ds2")
# dataSourceNames: ds2
#
# # 多数据源配置ds2
# ds2:
# type: oracle
# driver: oracle.jdbc.driver.OracleDriver
# url: jdbc:oracle:thin:@127.0.0.1:1521/orcl
# username: jeesite
# password: jeesite
# testSql: SELECT 1 FROM DUAL
# encrypt:
# username: false
# password: true
# pool:
# init: 1
# minIdle: 3
# maxActive: 20
# JTA 分布式事务v4.0.4+
jta:
enabled: false
@@ -73,47 +54,44 @@ jdbc:
stat:
enabled: true
# Redis 配置
redis:
enabled: false
# Redis 连接参数
host: 127.0.0.1
port: 6379
isSSL: false
timeout: 2000
password: 1234
database: 0
clientName: ~
# Redis 连接池配置
pool:
maxIdle: 3
maxTotal: 20
# 是否启用Redis系统缓存及会话专业版
cacheAndSession: false
# 定义Key的前缀标识
keyPrefix: ${jdbc.tablePrefix}
#======================================#
#========== Spring settings ===========#
#======================================#
#============================#
#===== System settings ======#
#============================#
spring:
# 缓存配置
cache:
# 缓存及会话共享(专业版)
isClusterMode: false
# 清理全部缓存按钮所清理的缓存列表
clearNames: sysCache,corpCache,userCache,cmsCache
# 关闭 Spring Boot Banner 打印
main:
bannerMode: "off"
#管理基础路径
# 日志配置
logging:
config: classpath:config/logback-spring.xml
#======================================#
#========== System settings ===========#
#======================================#
# 管理基础路径
adminPath: /a
#前端基础路径
# 前端基础路径
frontPath: /f
# 分页配置
# 分页相关
page:
# 分页默认大小
pageSize: 20
# 用户相关参数
# 用户相关
user:
# 指定超级管理员编号(研发团队使用的账号)
@@ -169,7 +147,7 @@ user:
expandLevel: -1,
remarks: ""
}]
# 多租户模式SAAS模式专业版
useCorpModel: false
@@ -179,7 +157,47 @@ user:
registerUser:
enabled: false
userTypes: 0, 1
# 角色管理
role:
# 扩展数据权限定义3本部门4本公司5本部门和本公司
# 如果 ctrlTypeClass 为 NONE则代表是不控制该类型权限
extendDataScopes: >
{
3: {
Office: {
ctrlTypeClass: "com.jeesite.modules.sys.entity.Office",
ctrlDataAttrName: "currentUser.refObj.office.officeCode",
ctrlDataParentCodesAttrName: "currentUser.refObj.office.parentCodes"
},
Company: {
ctrlTypeClass: "NONE"
}
},
4: {
Office: {
ctrlTypeClass: "NONE"
},
Company: {
ctrlTypeClass: "com.jeesite.modules.sys.entity.Company",
ctrlDataAttrName: "currentUser.refObj.company.companyCode",
ctrlDataParentCodesAttrName: "currentUser.refObj.company.parentCodes"
}
},
5: {
Office: {
ctrlTypeClass: "com.jeesite.modules.sys.entity.Office",
ctrlDataAttrName: "currentUser.refObj.office.officeCode",
ctrlDataParentCodesAttrName: "currentUser.refObj.office.parentCodes"
},
Company: {
ctrlTypeClass: "com.jeesite.modules.sys.entity.Company",
ctrlDataAttrName: "currentUser.refObj.company.companyCode",
ctrlDataParentCodesAttrName: "currentUser.refObj.company.parentCodes"
}
}
}
# 菜单管理
menu:
# 根据模块状态去更新相连的菜单状态仅作为微服务时设为false
@@ -232,15 +250,15 @@ job:
trigger:
enabled: false
# 内容管理
cms:
# 内容管理主站点编码
mainSiteCode: main
## 内容管理
#cms:
#
# # 内容管理主站点编码
# mainSiteCode: main
#============================#
#==== Framework settings ====#
#============================#
#======================================#
#========= Framework settings =========#
#======================================#
# Shiro 相关配置
shiro:
@@ -296,17 +314,13 @@ shiro:
isAllowExternalSiteIframe: true
# 是否允许跨域访问,如果允许,设置允许的域名,全部域名设置*号,如果不允许,此设置应该为空
# accessControlAllowOrigin: http://demo.jeesite.net
# accessControlAllowOrigin: http://demo.jeesite.com
# accessControlAllowOrigin: '*'
# 是否在登录后生成新的Session默认false
isGenerateNewSessionAfterLogin: false
# URI 权限过滤器定义
filterChainDefinitions: |
/ReportServer/** = user
${adminPath}/** = user
# filterChainDefinitions: |
# /ReportServer/** = user
# ${adminPath}/file/** = anon
@@ -318,12 +332,18 @@ shiro:
# ${adminPath}/cms/article/* = anon
# ${adminPath}/cms/link/* = anon
# ${adminPath}/** = user
filterChainDefinitions: |
/ReportServer/** = user
${adminPath}/** = user
# 默认的授权过滤定义如果在filterChainDefinitions中已经定义则该定义会被覆盖。
defaultFilterChainDefinitions: |
/static/** = anon
/userfiles/** = anon
/druid/** = perms[sys:state:druid]
/v2/api-docs = perms[sys:swagger]
/swagger-ui.html = perms[sys:swagger]
/swagger-resources/** = perms[sys:swagger]
${adminPath}/login-cas = cas
${adminPath}/login = authc
${adminPath}/logout = logout
@@ -339,19 +359,19 @@ shiro:
# Session 相关
session:
#全局会话超时,单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms, 12h=43200000ms, 1day=86400000ms
# 全局会话超时,单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms, 12h=43200000ms, 1day=86400000ms
sessionTimeout: 1800000
#手机APP设备会话超时参数设置登录请求参数加 param_deviceType=mobileApp 时有效
# 手机APP设备会话超时参数设置登录请求参数加 param_deviceType=mobileApp 时有效
mobileAppSessionTimeout: 43200000
#定时清理失效会话,清理用户直接关闭浏览器造成的孤立会话
# 定时清理失效会话,清理用户直接关闭浏览器造成的孤立会话
sessionTimeoutClean: 1200000
#会话唯一标识SessionId在Cookie中的名称。
# 会话唯一标识SessionId在Cookie中的名称。
sessionIdCookieName: jeesite.session.id
#共享的SessionId的Cookie名称保存到跟路径下第三方应用获取。同一域名下多个项目时需设置共享Cookie的名称。
# 共享的SessionId的Cookie名称保存到跟路径下第三方应用获取。同一域名下多个项目时需设置共享Cookie的名称。
#shareSessionIdCookieName: ${session.sessionIdCookieName}
# MyBatis 相关
@@ -371,21 +391,6 @@ mybatis:
sleepSeconds: 3
mappingPath: mappings
# 缓存设置
ehcache:
# 缓存配置文件路径
configFile: cache/ehcache-local.xml
# configFile: cache/ehcache-rmi.xml
# 清理缓存的缓存名称
clearNames: sysCache,userCache,corpCache,cmsCache,pageCachingFilter
# 页面缓存配置
pageCaching:
enabled: false
urlPatterns: "*.html"
# Web 相关
web:
@@ -431,21 +436,25 @@ web:
# 自定义正则表达式验证(主键、登录名)
validator:
id: '[a-zA-Z0-9_\-/\u4e00-\u9fa5]{0,64}'
id: '[a-zA-Z0-9_\-/#\u4e00-\u9fa5]{0,64}'
user.loginCode: '[a-zA-Z0-9_\u4e00-\u9fa5]{4,20}'
# 关闭核心模块的Web功能仅作为微服务时设为false
core:
enabled: true
# 在线API文档工具
swagger:
enabled: true
# 错误页面500.html是否输出错误信息正式环境为提供安全性可设置为false
error:
page:
printErrorInfo: true
#============================#
#=== FileUpload settings ====#
#============================#
#======================================#
#======== FileUpload settings =========#
#======================================#
file:
enabled: true
@@ -470,13 +479,14 @@ file:
# application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
# application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation
#============================#
#===== Message settings =====#
#============================#
#======================================#
#========== Message settings ==========#
#======================================#
# 消息提醒中心(专业版)
msg:
enabled: true
# 是否开启实时发送消息(保存消息后立即检查未读消息并发送),分布式部署下请单独配置消息发送服务,不建议开启此选项。
realtime:
# 是否开启
@@ -499,7 +509,7 @@ msg:
# 短信网关
sms:
beanName: smsSendService
url: http://lehuo520.cn/a/sms/api
url: http://localhost:80/msg/sms/send
data: username=jeesite&password=jeesite.com
prefix: 【JeeSite】
suffix: ~
@@ -521,11 +531,11 @@ msg:
debug: true
# 微信OAuth登录授权回调地址
oauth:
redirectUri: http://demo.jeesite.com/jeesite
redirectUri: http://demo.jeesite.com/js
#============================#
#===== Video settings =======#
#============================#
#======================================#
#========== Video settings ============#
#======================================#
video:
@@ -538,8 +548,3 @@ video:
# 将mp4视频的元数据信息转到视频第一帧
qtFaststartFile: d:/tools/video/qt-faststart/qt-faststart.exe
#============================#
#===== Project settings =====#
#============================#

View File

@@ -1,23 +1,28 @@
<included>
<!-- https://github.com/spring-projects/spring-boot/blob/v2.0.5.RELEASE/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml -->
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<logger name="org.springframework.boot.web.embedded" level="INFO" />
<logger name="net.oschina.j2cache.caffeine.CaffeineProvider" level="ERROR" />
<!-- <logger name="org.apache.ibatis" level="DEBUG" /> -->
<!-- <logger name="org.mybatis.spring" level="DEBUG" /> -->
<!-- <logger name="org.springframework.jdbc" level="DEBUG" /> -->
<logger name="org.mybatis.spring.transaction" level="DEBUG" />
<logger name="org.apache.catalina.webresources.Cache" level="ERROR" />
<logger name="org.springframework.boot.context.embedded" level="INFO" />
<logger name="org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer" level="INFO" />
<logger name="com.atomikos.icatch.config.UserTransactionServiceImp" level="ERROR" />
<logger name="com.atomikos.jdbc.AbstractDataSourceBean" level="ERROR" />
<logger name="springfox.documentation.spring.web.readers.parameter.ParameterDataTypeReader" level="ERROR" />
<!-- <logger name="io.swagger" level="DEBUG" /> -->
<!-- <logger name="springfox" level="DEBUG" /> -->
<logger name="com.jeesite" level="DEBUG" />
<logger name="com.jeesite.common.i18n" level="INFO" />
<logger name="com.jeesite.common.shiro" level="INFO" />
<logger name="com.jeesite.common.mybatis" level="INFO" />
<logger name="com.jeesite.common.mybatis.mapper" level="DEBUG" />
<logger name="com.jeesite.common.reflect.ReflectUtils" level="INFO" />
<logger name="com.jeesite.common.io.FileUtils" level="INFO" />
<logger name="com.jeesite.common.cache.JedisUtils" level="INFO" />
<logger name="com.jeesite.common.web.view.JstlView" level="INFO" />
<logger name="com.jeesite.modules.job.service.JobService" level="INFO" />
</included>

View File

@@ -0,0 +1,7 @@
-- 代码生成添加数据源字段
ALTER TABLE ${_prefix}gen_table ADD data_source_name varchar(64) NULL;
-- 新增在线文档Swagger菜单
INSERT INTO ${_prefix}sys_menu (menu_code, parent_code, parent_codes, tree_sort, tree_sorts, tree_leaf, tree_level, tree_names, menu_name, menu_type, menu_href, menu_target, menu_icon, menu_color, permission, weight, is_show, sys_code, module_codes, status, create_by, create_date, update_by, update_date, remarks)
VALUES ('1044942498470014976', '0', '0,', '9040', '0000009040,', '1', 0, '在线文档', '在线文档', '1', '//swagger-ui.html', '', 'icon-book-open', '', 'sys:swagger', 80, '0', 'default', 'core', '0', 'system', getdate(), 'system', getdate(), '');

View File

@@ -0,0 +1,10 @@
-- 代码生成添加数据源字段
ALTER TABLE ${_prefix}gen_table
ADD COLUMN `data_source_name` varchar(64) NULL COMMENT '数据源名称' AFTER `tpl_category`;
-- 新增在线文档Swagger菜单
INSERT INTO ${_prefix}sys_menu (menu_code, parent_code, parent_codes, tree_sort, tree_sorts, tree_leaf, tree_level, tree_names, menu_name, menu_type, menu_href, menu_target, menu_icon, menu_color, permission, weight, is_show, sys_code, module_codes, status, create_by, create_date, update_by, update_date, remarks)
VALUES ('1044942498470014976', '0', '0,', '9040', '0000009040,', '1', 0, '在线文档', '在线文档', '1', '//swagger-ui.html', '', 'icon-book-open', '', 'sys:swagger', 80, '0', 'default', 'core', '0', 'system', now(), 'system', now(), '');
commit;

View File

@@ -0,0 +1,10 @@
-- 代码生成添加数据源字段
ALTER TABLE ${_prefix}gen_table ADD data_source_name varchar(64) NULL;
COMMENT ON COLUMN ${_prefix}gen_table.data_source_name IS '数据源名称';
-- 新增在线文档Swagger菜单
INSERT INTO ${_prefix}sys_menu (menu_code, parent_code, parent_codes, tree_sort, tree_sorts, tree_leaf, tree_level, tree_names, menu_name, menu_type, menu_href, menu_target, menu_icon, menu_color, permission, weight, is_show, sys_code, module_codes, status, create_by, create_date, update_by, update_date, remarks)
VALUES ('1044942498470014976', '0', '0,', '9040', '0000009040,', '1', 0, '在线文档', '在线文档', '1', '//swagger-ui.html', '', 'icon-book-open', '', 'sys:swagger', 80, '0', 'default', 'core', '0', 'system', sysdate, 'system', sysdate, '');
commit;

View File

@@ -0,0 +1,10 @@
-- 日志表新增执行时间字段
ALTER TABLE ${_prefix}gen_table ADD COLUMN data_source_name varchar(64);
COMMENT ON COLUMN ${_prefix}gen_table.data_source_name IS '数据源名称';
-- 新增在线文档Swagger菜单
INSERT INTO ${_prefix}sys_menu (menu_code, parent_code, parent_codes, tree_sort, tree_sorts, tree_leaf, tree_level, tree_names, menu_name, menu_type, menu_href, menu_target, menu_icon, menu_color, permission, weight, is_show, sys_code, module_codes, status, create_by, create_date, update_by, update_date, remarks)
VALUES ('1044942498470014976', '0', '0,', '9040', '0000009040,', '1', 0, '在线文档', '在线文档', '1', '//swagger-ui.html', '', 'icon-book-open', '', 'sys:swagger', 80, '0', 'default', 'core', '0', 'system', now(), 'system', now(), '');
commit;

View File

@@ -5,4 +5,5 @@
4.0.4
4.0.5
4.0.6
4.0.7
4.0.7
4.1.0

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<!-- 模板分类 -->
<tplCategory>
<category value="crud" label="单表/主子表 (增删改查)">
<template>category-ref:dao</template>
<template>crud/service.xml</template>
<template>crud/controller.xml</template>
<template>crud/viewList.xml</template>
<template>crud/viewForm.xml</template>
<childTable>
<template>category-ref:dao</template>
</childTable>
</category>
<category value="treeGrid" label="树表/树结构表(增删改查)">
<template>category-ref:crud</template>
</category>
<category value="service" label="业务层和持久层(增删改查)">
<template>category-ref:dao</template>
<template>crud/service.xml</template>
</category>
<category value="dao" label="仅持久层dao/mapper/entity">
<template>crud/dao.xml</template>
<template>crud/mapper.xml</template>
<template>crud/entity.xml</template>
</category>
<!-- <category value="tableForm" label="单表 - 表格表单(增删改查)"> -->
<!-- <template>category-ref:dao</template> -->
<!-- <template>crud/service.xml</template> -->
<!-- <template>crud/controller.xml</template> -->
<!-- <template>crud/viewList.xml</template> -->
<!-- <template>crud/viewTableForm.xml</template> -->
<!-- </category> -->
<!-- <category value="treeTableAndList" name="树结构表(左树右表)"> -->
<!-- <template>category-ref:dao</template> -->
<!-- </category> -->
<!-- <category value="query" label="仅查询功能"> -->
<!-- <template>query/entity.xml</template> -->
<!-- <template>query/mapper.xml</template> -->
<!-- <template>query/dao.xml</template> -->
<!-- <template>query/service.xml</template> -->
<!-- <template>query/controller.xml</template> -->
<!-- <template>query/viewList.xml</template> -->
<!-- <template>query/viewView.xml</template> -->
<!-- </category> -->
</tplCategory>
<!-- 属性类型 -->
<attrType>
<dict value="String" label="String"/>
<dict value="Long" label="Long"/>
<dict value="Integer" label="Integer"/>
<dict value="Double" label="Double"/>
<dict value="java.util.Date" label="Date"/>
<dict value="com.jeesite.modules.sys.entity.User" label="User"/>
<dict value="com.jeesite.modules.sys.entity.Office" label="Office"/>
<dict value="This" label="This" description="生成当前对象"/>
</attrType>
<!-- 查询类型 -->
<queryType>
<dict value="EQ" label="="/>
<dict value="NE" label="!="/>
<dict value="GT" label="&gt;"/>
<dict value="GTE" label="&gt;="/>
<dict value="LT" label="&lt;"/>
<dict value="LTE" label="&lt;="/>
<dict value="BETWEEN" label="Between"/>
<dict value="LIKE" label="Like"/>
<dict value="LEFT_LIKE" label="左 Like"/>
<dict value="RIGHT_LIKE" label="右 Like"/>
</queryType>
<!-- 字段显示类型 -->
<showType>
<dict value="input" label="单行文本框"/>
<dict value="textarea" label="多行文本框"/>
<dict value="hidden" label="隐藏域字段"/>
<dict value="select" label="单选下拉框"/>
<dict value="select_multiple" label="多选下拉框"/>
<dict value="radio" label="单选按钮"/>
<dict value="checkbox" label="复选框"/>
<dict value="date" label="日期选择"/>
<dict value="datetime" label="日期时间"/>
<dict value="userselect" label="人员选择"/>
<dict value="officeselect" label="机构选择"/>
<dict value="areaselect" label="区域选择"/>
</showType>
<!-- 字段验证 -->
<fieldValid>
<dict value="email" label="电子邮件"/>
<dict value="url" label="网址"/>
<dict value="date" label="日期"/>
<dict value="number" label="数值"/>
<dict value="integer" label="整数"/>
<dict value="digits" label="正整数"/>
<dict value="userName" label="登录账号"/>
<dict value="realName" label="真实姓名"/>
<dict value="abc" label="字母数字下划线"/>
<dict value="mobile" label="手机号"/>
<dict value="simplePhone" label="固定电话"/>
<dict value="phone" label="手机或电话"/>
<dict value="zipCode" label="邮政编码"/>
<dict value="ipv4" label="IPv4"/>
<dict value="ipv6" label="IPv6"/>
<dict value="qq" label="QQ"/>
<dict value="idcard" label="身份证"/>
</fieldValid>
<!-- 栅格布局 -->
<gridRowCol>
<dict value="6/4/8" label="6/4/8 两列"/>
<dict value="12/2/10" label="12/2/10 一列"/>
<dict value="12/2/8" label="12/2/8 小一列"/>
<dict value="12/2/5" label="12/2/5 中一列"/>
<dict value="4/4/8" label="4/4/8 三列"/>
<dict value="3/4/8" label="3/4/8 四列"/>
</gridRowCol>
</config>

View File

@@ -0,0 +1,269 @@
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>controller</name>
<filePath>src/main/java/${packageName}/${moduleName}/web/${subModuleName}</filePath>
<fileName>${ClassName}Controller.java</fileName>
<content><![CDATA[
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
<% if(table.isTreeEntity){ %>
import java.util.List;
import java.util.Map;
<% }else{ %>
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<% } %>
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jeesite.common.config.Global;
<% if(table.isTreeEntity){ %>
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.idgen.IdGen;
import com.jeesite.modules.sys.utils.UserUtils;
<% }else{ %>
import com.jeesite.common.entity.Page;
<% } %>
import com.jeesite.common.web.BaseController;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
import ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Service;
/**
* ${functionName}Controller
* @author ${functionAuthor}
* @version ${functionVersion}
*/
@Controller
@RequestMapping(value = "\${adminPath}/${urlPrefix}")
public class ${ClassName}Controller extends BaseController {
@Autowired
private ${ClassName}Service ${className}Service;
/**
* 获取数据
*/
@ModelAttribute
public ${ClassName} get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>, boolean isNewRecord) {
<% if (table.pkList.~size == 1){ %>
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
<% }else{ %>
return ${className}Service.get(new Class<?>[]{<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType}.class<% } %>},
new Object[]{<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>}, isNewRecord);
<% } %>
}
/**
* 查询列表
*/
@RequiresPermissions("${permissionPrefix}:view")
@RequestMapping(value = {"list", ""})
public String list(${ClassName} ${className}, Model model) {
model.addAttribute("${className}", ${className});
return "${lastPackageName}/${viewPrefix}List";
}
/**
* 查询列表数据
*/
@RequiresPermissions("${permissionPrefix}:view")
@RequestMapping(value = "listData")
@ResponseBody
<% if(table.isTreeEntity){ %>
public List<${ClassName}> listData(${ClassName} ${className}) {
if (StringUtils.isBlank(${className}.getParentCode())) {
${className}.setParentCode(${ClassName}.ROOT_CODE);
}
<% for(c in table.columnList){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn){ %>
if (StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})){
${className}.setParentCode(null);
}
<% } %>
<% } %>
List<${ClassName}> list = ${className}Service.findList(${className});
return list;
}
<% }else{ %>
public Page<${ClassName}> listData(${ClassName} ${className}, HttpServletRequest request, HttpServletResponse response) {
${className}.setPage(new Page<>(request, response));
Page<${ClassName}> page = ${className}Service.findPage(${className});
return page;
}
<% } %>
/**
* 查看编辑表单
*/
@RequiresPermissions("${permissionPrefix}:view")
@RequestMapping(value = "form")
public String form(${ClassName} ${className}, Model model) {
<% if(table.isTreeEntity){ %>
// 创建并初始化下一个节点信息
${className} = createNextNode(${className});
<% } %>
model.addAttribute("${className}", ${className});
return "${lastPackageName}/${viewPrefix}Form";
}
<% if(table.isTreeEntity){ %>
/**
* 创建并初始化下一个节点信息,如:排序号、默认值
*/
@RequiresPermissions("${permissionPrefix}:edit")
@RequestMapping(value = "createNextNode")
@ResponseBody
public ${ClassName} createNextNode(${ClassName} ${className}) {
if (StringUtils.isNotBlank(${className}.getParentCode())){
${className}.setParent(${className}Service.get(${className}.getParentCode()));
}
if (${className}.getIsNewRecord()) {
${ClassName} where = new ${ClassName}();
where.setParentCode(${className}.getParentCode());
${ClassName} last = ${className}Service.getLastByParentCode(where);
// 获取到下级最后一个节点
if (last != null){
${className}.setTreeSort(last.getTreeSort() + 30);
<% if(table.isPkCustom){ %>
${className}.set${@StringUtils.cap(table.treeViewCodeAttrName)}(IdGen.nextCode(last.get${@StringUtils.cap(table.treeViewCodeAttrName)}()));
}else if (${className}.getParent() != null){
${className}.set${@StringUtils.cap(table.treeViewCodeAttrName)}(${className}.getParent().get${@StringUtils.cap(table.treeViewCodeAttrName)}() + "001");
<% } %>
}
}
// 以下设置表单默认数据
if (${className}.getTreeSort() == null){
${className}.setTreeSort(${ClassName}.DEFAULT_TREE_SORT);
}
return ${className};
}
<% } %>
/**
* 保存${functionNameSimple}
*/
@RequiresPermissions("${permissionPrefix}:edit")
@PostMapping(value = "save")
@ResponseBody
public String save(@Validated ${ClassName} ${className}) {
${className}Service.save(${className});
return renderResult(Global.TRUE, text("保存${functionNameSimple}成功!"));
}
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
/**
* 停用${functionNameSimple}
*/
@RequiresPermissions("${permissionPrefix}:edit")
@RequestMapping(value = "disable")
@ResponseBody
public String disable(${ClassName} ${className}) {
<% if(table.isTreeEntity){ %>
${ClassName} where = new ${ClassName}();
where.setStatus(${ClassName}.STATUS_NORMAL);
where.setParentCodes("," + ${className}.getId() + ",");
long count = ${className}Service.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该${functionNameSimple}包含未停用的子${functionNameSimple}"));
}
<% } %>
${className}.setStatus(${ClassName}.STATUS_DISABLE);
${className}Service.updateStatus(${className});
return renderResult(Global.TRUE, text("停用${functionNameSimple}成功"));
}
/**
* 启用${functionNameSimple}
*/
@RequiresPermissions("${permissionPrefix}:edit")
@RequestMapping(value = "enable")
@ResponseBody
public String enable(${ClassName} ${className}) {
${className}.setStatus(${ClassName}.STATUS_NORMAL);
${className}Service.updateStatus(${className});
return renderResult(Global.TRUE, text("启用${functionNameSimple}成功"));
}
<% } %>
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDelete'])){ %>
/**
* 删除${functionNameSimple}
*/
@RequiresPermissions("${permissionPrefix}:edit")
@RequestMapping(value = "delete")
@ResponseBody
public String delete(${ClassName} ${className}) {
${className}Service.delete(${className});
return renderResult(Global.TRUE, text("删除${functionNameSimple}成功!"));
}
<% } %>
<% if(table.isTreeEntity){ %>
/**
* 获取树结构数据
* @param excludeCode 排除的Code
* @param isShowCode 是否显示编码true or 1显示在左侧2显示在右侧false or null不显示
* @return
*/
@RequiresPermissions("${permissionPrefix}:view")
@RequestMapping(value = "treeData")
@ResponseBody
public List<Map<String, Object>> treeData(String excludeCode, String isShowCode) {
List<Map<String, Object>> mapList = ListUtils.newArrayList();
List<${ClassName}> list = ${className}Service.findList(new ${ClassName}());
for (int i=0; i<list.size(); i++){
${ClassName} e = list.get(i);
// 过滤非正常的数据
if (!${ClassName}.STATUS_NORMAL.equals(e.getStatus())){
continue;
}
// 过滤被排除的编码(包括所有子级)
if (StringUtils.isNotBlank(excludeCode)){
if (e.getId().equals(excludeCode)){
continue;
}
if (e.getParentCodes().contains("," + excludeCode + ",")){
continue;
}
}
Map<String, Object> map = MapUtils.newHashMap();
map.put("id", e.getId());
map.put("pId", e.getParentCode());
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.get${@StringUtils.cap(table.treeViewCodeAttrName)}(), e.get${@StringUtils.cap(table.treeViewNameAttrName)}()));
mapList.add(map);
}
return mapList;
}
/**
* 修复表结构相关数据
*/
@RequiresPermissions("${permissionPrefix}:edit")
@RequestMapping(value = "fixTreeData")
@ResponseBody
public String fixTreeData(${ClassName} ${className}){
if (!UserUtils.getUser().isAdmin()){
return renderResult(Global.FALSE, "操作失败,只有管理员才能进行修复!");
}
${className}Service.fixTreeData();
return renderResult(Global.TRUE, "数据修复成功");
}
<% } %>
}]]>
</content>
</template>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>dao</name>
<filePath>src/main/java/${packageName}/${moduleName}/dao/${subModuleName}</filePath>
<fileName>${ClassName}Dao.java</fileName>
<content><![CDATA[
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''};
import com.jeesite.common.dao.${table.isTreeEntity?'Tree':'Crud'}Dao;
import com.jeesite.common.mybatis.annotation.MyBatisDao;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
/**
* ${functionName}DAO接口
* @author ${functionAuthor}
* @version ${functionVersion}
*/
@MyBatisDao<% if(table.dataSourceName != ''){ %>(dataSourceName="${table.dataSourceName}")<% } %>
public interface ${ClassName}Dao extends ${table.isTreeEntity?'Tree':'Crud'}Dao<${ClassName}> {
}]]>
</content>
</template>

View File

@@ -0,0 +1,343 @@
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>entity</name>
<filePath>src/main/java/${packageName}/${moduleName}/entity/${subModuleName}</filePath>
<fileName>${ClassName}.java</fileName>
<content><![CDATA[
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package ${packageName}.${moduleName}.entity${isNotBlank(subModuleName)?'.'+subModuleName:''};
<% for(i in table.importList){ %>
import ${i};
<% } %>
import com.jeesite.common.entity.DataEntity;
<% if(table.isTreeEntity){ %>
import com.jeesite.common.entity.TreeEntity;
<% } %>
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
/**
* ${functionName}Entity
* @author ${functionAuthor}
* @version ${functionVersion}
*/
@Table(name="${table.genTableName}", alias="a", columns={
<%
var isBase = false, isData = false,
isTree = false, isExtend = false;
// 生成字段属性
for(c in table.columnList){
// 如果是BaseEntity类属性
if(c.isBaseEntityColumn){
if(!isBase){
isBase = true;
%>
@Column(includeEntity=BaseEntity.class),
<%
}
// 如果是DataEntity类属性
}else if(c.isDataEntityColumn){
if(!isData){
isData = true;
%>
@Column(includeEntity=DataEntity.class),
<%
}
// 如果是TreeEntity类属性
}else if(c.isTreeEntityColumn){
if(!isTree){
isTree = true;
%>
@Column(includeEntity=TreeEntity.class),
<%
}
// 如果是Extend类属性
}else if(c.isExtendColumn){
if(!isExtend){
isExtend = true;
%>
@Column(includeEntity=Extend.class, attrName="extend"),
<%
}
// 其它情况下
}else{
// 容错,如果没有设置父表的主键属性,则设置
if(!@StringUtils.contains(c.attrName, ".")){
if (table.parentExists && table.parentTableFkName == c.columnName){
for (pk in table.parent.pkList){
c.fullAttrName = c.fullAttrName + '.' + pk.attrName;
break;
}
}
}
%>
@Column(name="${c.columnName}", attrName="${c.attrName}", label="${c.columnLabel}"<%
if (c.comments != c.columnLabel){
print(', comment="'+c.comments+'"');
}
if (c.isPk == @Global.YES){
print(', isPK=true');
}else{
if (c.isInsert == @Global.NO){
print(', isInsert=false');
}
if (c.isUpdate == @Global.NO){
print(', isUpdate=false');
}
if (c.isQuery == @Global.YES && @StringUtils.inString(c.queryType,
'NE', 'GT', 'GTE', 'LT', 'LTE', 'LIKE', 'LEFT_LIKE', 'RIGHT_LIKE')){
print(', queryType=QueryType.'+c.queryType);
}
if (c.isQuery == @Global.NO){
print(', isQuery=false');
}
if (c.attrName == table.treeViewNameAttrName){
print(', isTreeName=true');
}
}
%>),
<%
}
}
%>
}, <%
// 关联系统表
var joinTables = '';
for(c in table.columnList){
if (c.attrType == 'com.jeesite.modules.sys.entity.User'){
var joinTable = {
%>
@JoinTable(type=Type.LEFT_JOIN, entity=User.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
on="u${cLP.index}.user_code = a.${c.columnName}", columns={
@Column(name="user_code", label="用户编码", isPK=true),
@Column(name="user_name", label="用户名称", isQuery=false),
}),
<%
};
joinTables = joinTables + joinTable;
}
else if (c.attrType == 'com.jeesite.modules.sys.entity.Office'){
var joinTable = {
%>
@JoinTable(type=Type.LEFT_JOIN, entity=Office.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
on="u${cLP.index}.office_code = a.${c.columnName}", columns={
@Column(name="office_code", label="机构编码", isPK=true),
@Column(name="office_name", label="机构名称", isQuery=false),
}),
<%
};
joinTables = joinTables + joinTable;
}
}
if (isNotBlank(joinTables)){
print('joinTable={\n');
print(joinTables);
print('\t}, ');
}
%>orderBy="<% if (isTree){
%>a.tree_sorts<%
for(pk in table.pkList){
%>, a.${pk.columnName}<%
}
}else if(table.parentExists && table.createDateExists){
%>a.create_date ASC<%
}else if(table.updateDateExists){
%>a.update_date DESC<%
}else{
for(pk in table.pkList){
%>${pkLP.index!=1?', ':''}a.${pk.columnName} ${table.parentExists?'ASC':'DESC'}<%
}
} %>"
)
public class ${ClassName} extends ${table.isTreeEntity?'Tree':'Data'}Entity<${ClassName}> {
private static final long serialVersionUID = 1L;
<%
isExtend = false;
// 生成字段属性
for(c in table.columnList){
// 如果是Extend类属性
if(c.isExtendColumn){
if(!isExtend){
isExtend = true;
%>
private Extend extend; // 扩展字段
<%
}
}
// 如果不是基类属性
else if(c.columnName != 'id' && !c.isSuperColumn){
// 父类对象
if(table.parentExists && table.parentTableFkName == c.columnName){
%>
private ${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}; <% if (isNotBlank(c.comments)){ %>// ${c.comments} 父类<% } %>
<%
// 其它字段
}else{
%>
private ${c.simpleAttrType} ${c.simpleAttrName}; <%if(isNotBlank(c.comments)){%>// ${c.comments}<%}%>
<%
}
}
}
// 生成子表列表字段
for(child in table.childList){
%>
private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List = ListUtils.newArrayList(); // 子表列表
<%
}
// 生成构造方法
%>
public ${ClassName}() {
this(null);
}
<%
// 生成带主键参数的构造
if (!table.parentExists){
if (table.pkList.~size == 1){ %>
public ${ClassName}(String id){
super(id);
}
<% }else{ %>
public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
<% for(pk in table.pkList){ %>
this.${pk.simpleAttrName} = ${pk.simpleAttrName};
<% } %>
}
<%
}
}
// 生成父表参数的构造
else{
for(c in table.columnList){
if(table.parentExists && table.parentTableFkName == c.columnName){
%>
public ${ClassName}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}){
this.${c.simpleAttrName} = ${c.simpleAttrName};
}
<%
}
}
}
// 如果是树实体,则输出相应方法
if (table.isTreeEntity){
%>
@Override
public ${ClassName} getParent() {
return parent;
}
@Override
public void setParent(${ClassName} parent) {
this.parent = parent;
}
<%
}
// 生成属性的get和set方法
isExtend = false;
for(c in table.columnList){
// 如果是Extend类属性
if(c.isExtendColumn){
if(!isExtend){
isExtend = true;
%>
public Extend getExtend() {
return extend;
}
public void setExtend(Extend extend) {
this.extend = extend;
}
<%
}
// 如果不是基类属性
}else if(c.columnName != 'id' && !c.isSuperColumn){
%>
<%
for(a in c.simpleAnnotationList){
%>
@${a}
<%
}
// 父类对象
if(table.parentExists && table.parentTableFkName == c.columnName){
%>
public ${@StringUtils.cap(table.parent.className)} get${@StringUtils.cap(c.simpleAttrName)}() {
return ${c.simpleAttrName};
}
public void set${@StringUtils.cap(c.simpleAttrName)}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}) {
this.${c.simpleAttrName} = ${c.simpleAttrName};
}
<%
// 其它字段
}else{
%>
public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
return ${c.simpleAttrName};
}
public void set${@StringUtils.cap(c.simpleAttrName)}(${c.simpleAttrType} ${c.simpleAttrName}) {
this.${c.simpleAttrName} = ${c.simpleAttrName};
}
<%
}
}
}
// 生成条件字段get和set方法范围类型
for(c in table.columnList){
if(c.isQuery == "1" && c.queryType == "BETWEEN"){
%>
public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_gte() {
return sqlMap.getWhere().getValue("${c.columnName}", QueryType.GTE);
}
public void set${@StringUtils.cap(c.simpleAttrName)}_gte(${c.simpleAttrType} ${c.simpleAttrName}) {
sqlMap.getWhere().and("${c.columnName}", QueryType.GTE, ${c.simpleAttrName});
}
public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_lte() {
return sqlMap.getWhere().getValue("${c.columnName}", QueryType.LTE);
}
public void set${@StringUtils.cap(c.simpleAttrName)}_lte(${c.simpleAttrType} ${c.simpleAttrName}) {
sqlMap.getWhere().and("${c.columnName}", QueryType.LTE, ${c.simpleAttrName});
}
<%
}
}
// 生成子表列表get和set方法
for(child in table.childList){
%>
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
return ${@StringUtils.uncap(child.className)}List;
}
public void set${@StringUtils.cap(child.className)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List) {
this.${@StringUtils.uncap(child.className)}List = ${@StringUtils.uncap(child.className)}List;
}
<% } %>
}]]>
</content>
</template>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>mapper</name>
<filePath>src/main/resources/mappings/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<fileName>${ClassName}Dao.xml</fileName>
<content><![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${packageName}.${moduleName}.dao${isNotBlank(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao">
<!-- 查询数据
<select id="findList" resultType="${ClassName}">
SELECT \${sqlMap.column.toSql()}
FROM \${sqlMap.table.toSql()}
<where>
\${sqlMap.where.toSql()}
</where>
ORDER BY \${sqlMap.order.toSql()}
</select> -->
</mapper>]]>
</content>
</template>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>service</name>
<filePath>src/main/java/${packageName}/${moduleName}/service/${subModuleName}</filePath>
<fileName>${ClassName}Service.java</fileName>
<content><![CDATA[
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''};
import java.util.List;
<% if (table.childList.~size > 0){ %>
import org.springframework.beans.factory.annotation.Autowired;
<% } %>
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeesite.common.entity.Page;
import com.jeesite.common.service.${table.isTreeEntity?'Tree':'Crud'}Service;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao;
<% if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload']) || @ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ %>
import com.jeesite.modules.file.utils.FileUploadUtils;
<% } %>
<% for (child in table.childList){ %>
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)};
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)}Dao;
<% } %>
/**
* ${functionName}Service
* @author ${functionAuthor}
* @version ${functionVersion}
*/
@Service
@Transactional(readOnly=true)
public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Service<${ClassName}Dao, ${ClassName}> {
<% for (child in table.childList){ %>
@Autowired
private ${@StringUtils.cap(child.className)}Dao ${@StringUtils.uncap(child.className)}Dao;
<% } %>
/**
* 获取单条数据
* @param ${className}
* @return
*/
@Override
public ${ClassName} get(${ClassName} ${className}) {
<% if (table.childList.~size > 0){ %>
${ClassName} entity = super.get(${className});
if (entity != null){
<% for (child in table.childList){ %>
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}(entity);
${@StringUtils.uncap(child.className)}.setStatus(${@StringUtils.cap(child.className)}.STATUS_NORMAL);
entity.set${@StringUtils.cap(child.className)}List(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
<% } %>
}
return entity;
<% }else{ %>
return super.get(${className});
<% } %>
}
<% if(!table.isTreeEntity){ %>
/**
* 查询分页数据
* @param ${className} 查询条件
* @param ${className}.page 分页对象
* @return
*/
@Override
public Page<${ClassName}> findPage(${ClassName} ${className}) {
return super.findPage(${className});
}
<% }else{ %>
/**
* 查询列表数据
* @param ${className}
* @return
*/
@Override
public List<${ClassName}> findList(${ClassName} ${className}) {
return super.findList(${className});
}
<% } %>
/**
* 保存数据(插入或更新)
* @param ${className}
*/
@Override
@Transactional(readOnly=false)
public void save(${ClassName} ${className}) {
super.save(${className});
<% if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload'])){ %>
// 保存上传图片
FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_image");
<% } %>
<% if(@ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ %>
// 保存上传附件
FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_file");
<% } %>
<% for (child in table.childList) { %>
// 保存 ${ClassName}子表
for (${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} : ${className}.get${@StringUtils.cap(child.className)}List()){
if (!${@StringUtils.cap(child.className)}.STATUS_DELETE.equals(${@StringUtils.uncap(child.className)}.getStatus())){
<%
for(c in child.columnList){
if (child.parentExists && child.parentTableFkName == c.columnName){
%>
${@StringUtils.uncap(child.className)}.set${@StringUtils.cap(c.simpleAttrName)}(${className});
<%
}
}
%>
if (${@StringUtils.uncap(child.className)}.getIsNewRecord()){
${@StringUtils.uncap(child.className)}.preInsert();
${@StringUtils.uncap(child.className)}Dao.insert(${@StringUtils.uncap(child.className)});
}else{
${@StringUtils.uncap(child.className)}.preUpdate();
${@StringUtils.uncap(child.className)}Dao.update(${@StringUtils.uncap(child.className)});
}
}else{
${@StringUtils.uncap(child.className)}Dao.delete(${@StringUtils.uncap(child.className)});
}
}
<% } %>
}
/**
* 更新状态
* @param ${className}
*/
@Override
@Transactional(readOnly=false)
public void updateStatus(${ClassName} ${className}) {
super.updateStatus(${className});
}
/**
* 删除数据
* @param ${className}
*/
@Override
@Transactional(readOnly=false)
public void delete(${ClassName} ${className}) {
super.delete(${className});
<% for (child in table.childList) { %>
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}();
<%
for(c in child.columnList){
if (child.parentExists && child.parentTableFkName == c.columnName){
%>
${@StringUtils.uncap(child.className)}.set${@StringUtils.cap(c.simpleAttrName)}(${className});
<%
}
}
%>
${@StringUtils.uncap(child.className)}Dao.delete(${@StringUtils.uncap(child.className)});
<% } %>
}
}]]>
</content>
</template>

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>viewForm</name>
<filePath>src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<fileName>${className}Form.html</fileName>
<content><![CDATA[
<%
var extLibs = '';
if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload']) || @ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){
extLibs = extLibs + ',\'fileupload\'';
}
if(table.childList.~size > 0){
extLibs = extLibs + ',\'dataGrid\'';
}
%>
\<% layout('/layouts/default.html', {title: '${functionNameSimple}管理', libs: ['validate'${extLibs}]}){ %>
<div class="main-content">
<div class="box box-main">
<div class="box-header with-border">
<div class="box-title">
<i class="fa fa-list-alt"></i> \${text(${className}.isNewRecord ? '新增${functionNameSimple}' : '编辑${functionNameSimple}')}
</div>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<${'#'}form:form id="inputForm" model="\${${className}}" action="\${ctx}/${urlPrefix}/save" method="post" class="form-horizontal">
<div class="box-body">
<div class="form-unit">\${text('基本信息')}</div>
<% if(table.isTreeEntity){ %>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4">\${text('上级${functionNameSimple}')}</label>
<div class="col-sm-8">
<${'#'}form:treeselect id="parent" title="\${text('上级${functionNameSimple}')}"
path="parent.id" labelPath="parent.${table.treeViewNameAttrName}"
url="\${ctx}/${urlPrefix}/treeData?excludeCode=\${${className}.id}"
class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
</div>
</div>
</div>
</div>
<% } %>
<% include('/templates/modules/gen/include/formControl.html'){} %>
<% include('/templates/modules/gen/include/formChildTable.html'){} %>
</div>
<div class="box-footer">
<div class="row">
<div class="col-sm-offset-2 col-sm-10">
\<% if (hasPermi('${permissionPrefix}:edit')){ %>
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> \${text('保 存')}</button>&nbsp;
\<% } %>
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> \${text('关 闭')}</button>
</div>
</div>
</div>
</${'#'}form:form>
</div>
</div>
\<% } %>
<% include('/templates/modules/gen/include/formChildTableScript.html'){} %>
<script>
$("#inputForm").validate({
submitHandler: function(form){
js.ajaxSubmitForm($(form), function(data){
js.showMessage(data.message);
if(data.result == Global.TRUE){
js.closeCurrentTabPage(function(contentWindow){
<% if(table.isTreeEntity){ %>
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
$('#parentCode').val(), '\${${className}.id}');
<% }else{ %>
contentWindow.page();
<% } %>
});
}
}, "json");
}
});
<% if(table.isTreeEntity){ %>
// 选择父级菜单回调方法
function treeselectCallback(id, act, index, layero){
if (id == 'parent' && (act == 'ok' || act == 'clear')){
// 创建并初始化下一个节点信息,如:排序号、默认值
$.get('\${ctx}/${urlPrefix}/createNextNode?parentCode='
+$('#parentCode').val(), function(data){
$('#treeSort').val(data.treeSort);
});
}
}
<% } %>
</script>]]>
</content>
</template>

View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>viewList</name>
<filePath>src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<fileName>${className}List.html</fileName>
<content><![CDATA[
\<% layout('/layouts/default.html', {title: '${functionNameSimple}管理', libs: ['dataGrid']}){ %>
<div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa fa-list-alt"></i> \${text('${functionNameSimple}管理')}
</div>
<div class="box-tools pull-right">
<a href="#" class="btn btn-default" id="btnSearch" title="\${text('查询')}"><i class="fa fa-filter"></i> \${text('查询')}</a>
<% if(table.isTreeEntity){ %>
<a href="#" class="btn btn-default" id="btnRefreshTree" title="\${text('刷新')}"><i class="fa fa-refresh"></i> \${text('刷新')}</a>
<a href="#" class="btn btn-default" id="btnExpandTreeNode" title="\${text('展开一级')}"><i class="fa fa-angle-double-down"></i> \${text('展开')}</a>
<a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="\${text('折叠全部')}"><i class="fa fa-angle-double-up"></i> \${text('折叠')}</a>
<% } %>
\<% if(hasPermi('${permissionPrefix}:edit')){ %>
<a href="\${ctx}/${urlPrefix}/form" class="btn btn-default btnTool" title="\${text('新增${functionNameSimple}')}"><i class="fa fa-plus"></i> \${text('新增')}</a>
\<% } %>
</div>
</div>
<div class="box-body">
<% include('/templates/modules/gen/include/searchForm.html'){} %>
<table id="dataGrid"></table>
<% if(!table.isTreeEntity){ %>
<div id="dataGridPage"></div>
<% } %>
</div>
</div>
</div>
\<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
<%
// 是否是第一列
var firstColumn = true;
// 获取到唯一ID的url参数字符串
var idParam = '';
for(pk in table.pkList){
idParam = idParam + (pkLP.index!=1?'&':'') + pk.attrName + '=\'+row.' + pk.attrName + '+\'';
}
// 生成树表的节点列
if(table.isTreeEntity){
for(c in table.columnList){
if(c.attrName == table.treeViewNameAttrName){
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', index:'a.${c.columnName}', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '( '+row.${table.treeViewCodeAttrName}+' ) '+'<a href="\${ctx}/${urlPrefix}/form?${idParam}" class="btnList" data-title="\${text('编辑${functionNameSimple}')}">'+(val||row.id)+'</a>';
}},
<%
firstColumn = false;
break;
}
}
}
%>
<%
for(c in table.columnList){
if(c.isList == "1"){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && @StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')
&& c.attrName != table.treeViewCodeAttrName
&& c.attrName != table.treeViewNameAttrName){
}
// 如果是首列,则输出带链接的列
else if(firstColumn){
firstColumn = false;
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', index:'a.${c.columnName}', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="\${ctx}/${urlPrefix}/form?${idParam}" class="btnList" data-title="\${text('编辑${functionNameSimple}')}">'+(val||row.id)+'</a>';
}},
<% }else if(c.showType == 'select' || c.showType == 'select_multiple' || c.showType == 'checkbox' || c.showType == 'radio'){ %>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', index:'a.${c.columnName}', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(\${@DictUtils.getDictListJson('${c.optionMap['dictType']}')}, val, '\${text('未知')}', true);
}},
<% }else if(c.showType == "userselect" || c.showType == "officeselect" || c.showType == "areaselect"){ %>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName2}', index:'a.${c.columnName}', width:150, align:"center"},
<% }else{
if (@StringUtils.inString(c.attrType, 'java.util.Date', 'Integer', 'Long')){
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', index:'a.${c.columnName}', width:150, align:"center"},
<%
}else if (@StringUtils.inString(c.attrType, 'Float', 'Double')){
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', index:'a.${c.columnName}', width:150, align:"right", formatter: function(val, obj, row, act){
return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值金额情况下设置0.00);
}},
<%
}else {
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', index:'a.${c.columnName}', width:150, align:"left"},
<%
}
}
}
}
%>
{header:'\${text('操作')}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
\<% if(hasPermi('${permissionPrefix}:edit')){ %>
actions.push('<a href="\${ctx}/${urlPrefix}/form?${idParam}" class="btnList" title="\${text('编辑${functionNameSimple}')}"><i class="fa fa-pencil"></i></a>&nbsp;');
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="\${ctx}/${urlPrefix}/disable?${idParam}" class="btnList" title="\${text('停用${functionNameSimple}')}" data-confirm="\${text('确认要停用该${functionNameSimple}吗?')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="\${ctx}/${urlPrefix}/enable?${idParam}" class="btnList" title="\${text('启用${functionNameSimple}')}" data-confirm="\${text('确认要启用该${functionNameSimple}吗?')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
<% } %>
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDelete'])){ %>
actions.push('<a href="\${ctx}/${urlPrefix}/delete?${idParam}" class="btnList" title="\${text('删除${functionNameSimple}')}" data-confirm="\${text('确认要删除该${functionNameSimple}<% if(table.isTreeEntity){ %>及所有子${functionNameSimple}<% } %>吗?')}"<% if(table.isTreeEntity){ %> data-deltreenode="'+row.id+'"<% } %>><i class="fa fa-trash-o"></i></a>&nbsp;');
<% } %>
<% if(table.isTreeEntity){ %>
actions.push('<a href="\${ctx}/${urlPrefix}/form?parentCode='+row.id+'" class="btnList" title="\${text('新增下级${functionNameSimple}')}"><i class="fa fa-plus-square"></i></a>&nbsp;');
<% } %>
\<% } %>
return actions.join('');
}}
],
<% if(table.isTreeEntity){ %>
treeGrid: true, // 启用树结构表格
defaultExpandLevel: 0, // 默认展开的层次
expandNodeClearPostData: '<%
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
print(c.attrName + ',');
}
} %>', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据)
<% } %>
// 加载成功后执行事件
ajaxSuccess: function(data){
}
});
</script>]]>
</content>
</template>

View File

@@ -0,0 +1,14 @@
<%
// 输出子表控件
for (child in table.childList){
%>
<h4 class="form-unit">\${text('${child.comments}')}</h4>
<div class="ml10 mr10">
<table id="${@StringUtils.uncap(child.className)}DataGrid"></table>
\<% if (hasPermi('${permissionPrefix}:edit')){ %>
<a href="#" id="${@StringUtils.uncap(child.className)}DataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> \${text('增行')}</a>
\<% } %>
</div>
<%
}
%>

View File

@@ -0,0 +1,172 @@
<% // 输出子表 Script脚本
if (table.childList.~size > 0){ %>
<script>
<%
var treeselectExists = false;
for(child in table.childList){
%>
//初始化${child.comments}DataGrid对象
$("#${@StringUtils.uncap(child.className)}DataGrid").dataGrid({
data: \${toJson(${className}.${@StringUtils.uncap(child.className)}List)},
datatype: "local", // 设置本地数据
autoGridHeight: function(){return 'auto'}, // 设置自动高度
// 设置数据表格列
columnModel: [
{header:'状态', name:'status', editable:true, hidden:true},
{header:'主键', name:'<% for(pk in child.pkList){ %>${pk.attrName}<% break; }%>', editable:true, hidden:true},
<%
// 遍历子表字段
for (c in child.columnList){
// 如果不是编辑字段,则跳过
if (c.isEdit != '1'){
continue;
}
// 如果是外键,父级的主键
if(child.parentExists && child.parentTableFkName == c.columnName){
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', editable:true, hidden:true},
<%
continue;
}
// 生成控件属性
var attrs = '';
if (c.dataLength != '0'){
var s = { %>'maxlength':'${c.dataLength}', <% };
attrs = attrs + s;
}
// 生成控件样式
var cssClass = '';
if (c.isNull != '1'){
cssClass = cssClass + ' required';
}
if (c.attrType == 'Long' || c.attrType == 'Integer'){
cssClass = cssClass + ' digits';
}
if (c.attrType == 'Double'){
cssClass = cssClass + ' number';
}
// 输出列字段
if(c.showType == 'input'){
%> {header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', width:150, editable:true, edittype:'text', editoptions:{${attrs}'class':'form-control${cssClass}'}},
<%
}else if(c.showType == 'textarea'){
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', width:150, editable:true, edittype:'textarea', editoptions:{${attrs}'class':'form-control${cssClass}', 'rows':'1'}},
<%
}else if(c.showType == 'select' || c.showType == 'select_multiple' || c.showType == 'radio' || c.showType == 'checkbox'){
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', width:100,
editable:true, edittype:'select', editoptions:{<%if (c.showType == 'select_multiple' || c.showType == 'checkbox'){ %>multiple:true, <% } %>'class':'form-control${cssClass}',
items: $.merge([<%if (!(c.showType == 'select_multiple' || c.showType == 'checkbox')){ %>{dictLabel:'&nbsp;',dictValue:''}<% } %>], \${@DictUtils.getDictListJson('${c.optionMap['dictType']}')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()});
}
}
},
<%
}else if(c.showType == 'date' || c.showType == 'datetime'){
var isTime = (c.showType == 'datetime');
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.attrName}', width:150,
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d${isTime?' H:i:s':''}'},
editable:true, edittype:'text', editoptions:{'class':'form-control Wdate${cssClass}', 'readonly':'true',
dataInit: function(element){ $(element).on('focus', function(){
WdatePicker({dateFmt:'yyyy-MM-dd${isTime?' HH:mm':''}',isShowClear:false});
});
}}
},
<%
}else if(c.showType == 'userselect'){
treeselectExists = true; %>
{header:'\${text('${c.columnLabel}')}', name:'${c.simpleAttrName}', width:150,
formatter: function(val, obj, row, act){
return js.val(row, '${c.attrName}')+'|'+js.val(row, '${c.attrName2}');
}, editable: true, edittype: "custom", editoptions: {
custom_element: function(val, editOptions) {
return js.template('treeselectTpl', {
id: 'user_'+editOptions.id, title: '用户选择',
name: '${c.attrName}', value: val.split('|')[0],
labelName: '${c.attrName2}', labelValue: val.split('|')[1],
url: '\${ctx}/sys/office/treeData?isLoadUser=true', cssClass: '${cssClass}'
});
}
}
},
<%
}else if(c.showType == 'officeselect'){
treeselectExists = true;
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.simpleAttrName}', width:150,
formatter: function(val, obj, row, act){
return js.val(row, '${c.attrName}')+'|'+js.val(row, '${c.attrName2}');
}, editable: true, edittype: "custom", editoptions: {
custom_element: function(val, editOptions) {
return js.template('treeselectTpl', {
id: 'office_'+editOptions.id, title: '机构选择',
name: '${c.attrName}', value: val.split('|')[0],
labelName: '${c.attrName2}', labelValue: val.split('|')[1],
url: '\${ctx}/sys/office/treeData?officeTypes=1,2', cssClass: '${cssClass}'
});
}
}
},
<%
}else if(c.showType == 'areaselect'){
treeselectExists = true;
%>
{header:'\${text('${c.columnLabel}')}', name:'${c.simpleAttrName}', width:150,
formatter: function(val, obj, row, act){
return js.val(row, '${c.attrName}')+'|'+js.val(row, '${c.attrName2}');
}, editable: true, edittype: "custom", editoptions: {
custom_element: function(val, editOptions) {
return js.template('treeselectTpl', {
id: 'area_'+editOptions.id, title: '区域选择',
name: '${c.attrName}', value: val.split('|')[0],
labelName: '${c.attrName2}', labelValue: val.split('|')[1],
url: '\${ctx}/sys/area/treeData', cssClass: '${cssClass}'
});
}
}
},
<%
}
}
%>
{header:'\${text('操作')}', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
var actions = [];
if (val == 'new'){
actions.push('<a href="#" onclick="js.confirm(\'\${text('你确认要删除这条数据吗')}\', function(){$(\'#${@StringUtils.uncap(child.className)}DataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
}else{
actions.push('<a href="#" onclick="js.confirm(\'\${text('你确认要删除这条数据吗')}\', function(){$(\'#${@StringUtils.uncap(child.className)}DataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'})});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
}
return actions.join('');
}, editoptions: {defaultValue: 'new'}}
],
// 编辑表格参数
editGrid: true, // 是否是编辑表格
editGridInitRowNum: 1, // 编辑表格的初始化新增行数
editGridAddRowBtn: $('#${@StringUtils.uncap(child.className)}DataGridAddRowBtn'), // 子表增行按钮
editGridAddRowInitData: {<% for(pk in child.pkList){ %>${pk.attrName}<% break; }%>: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
// 编辑表格的提交数据参数
editGridInputFormListName: '${@StringUtils.uncap(child.className)}List', // 提交的数据列表名
editGridInputFormListAttrs: 'status,<% for(c in child.columnList){if(c.attrName!="status"){%>${c.attrName},<% }} %>', // 提交数据列表的属性字段
// 加载成功后执行事件
ajaxSuccess: function(data){
}
});
<% } %>
</script>
<% if(treeselectExists){ %>
<script id="treeselectTpl" type="text/template">//<!--<div>
<${'#'}form:treeselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true"/>
</div>//--></script>
<% } %>
<% } %>

View File

@@ -0,0 +1,213 @@
<%
var rowFlag = -1, preGridRowCol;
for (c in table.columnList){
if (c.isEdit == '1'){
// 如果是树结构的字段,则自动忽略
if(table.isTreeEntity && @StringUtils.inString(c.columnName, 'parent_code',
'parent_codes', 'tree_sorts', 'tree_leaf', 'tree_level', 'tree_names')){
}
// 如果是隐藏域
else if (c.showType == 'hidden'){
%>
<${'#'}form:hidden path="${c.attrName}"/>
<%
}
// 输出表单字段
else{
// 栅格参数获取
var gridRowCol = @StringUtils.split(c.optionMap['gridRowCol'], '/');
if (isBlank(gridRowCol) || gridRowCol.~size != 3){
if (c.showType == 'textarea'){
gridRowCol = @StringUtils.split('12/2/10', '/');
}else{
gridRowCol = @StringUtils.split('6/4/8', '/');
}
}
// 是否强制新行获取,生成字段界面用户设定的
var isNewLine = @Global.YES.equals(c.optionMap['isNewLine']);
if (isBlank(c.optionMap['isNewLine'])){
if (c.showType == 'textarea'){
isNewLine = true;
}
}
// 如果上一个控件占12列则强制新行算了
if (isNotEmpty(preGridRowCol) && preGridRowCol[0] == '12'){
isNewLine = true;
}
// 保存上一个控件输出栅格对象
preGridRowCol = gridRowCol;
// 如果完成输出2列则换行
if(rowFlag == 2){
isNewLine = true;
}
// 如果是扩展字段,则输出子标题,并且强制换行
if (c.columnName == 'extend_s1'){
isNewLine = true;
}
// 如果是第一个控件
if (rowFlag == -1){
%>
<div class="row">
<%
}
// 如果不是第一个控件,并且是新行,或者是扩展字段,则输出结束符
else if(isNewLine){
%>
</div>
<%
}
// 如果是扩展字段,则输出子标题,并且强制换行
if (c.columnName == 'extend_s1'){
%>
<div class="form-unit">\${text('扩展字段')}</div>
<%
}
// 如果是新行,则换行
if(isNewLine){
rowFlag = 0; // 输出行标记清零
%>
<div class="row">
<%
}
// 开始输出控件
%>
<div class="col-xs-${gridRowCol[0]}">
<div class="form-group">
<label class="control-label col-sm-${gridRowCol[1]}" title="">
<span class="required ${c.isNull == '1' ? 'hide' : ''}">*</span> \${text('${c.columnLabel}')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-${gridRowCol[2]}">
<%
var attrs = '';
if (c.dataLength != '0'){
var s = { %> maxlength="${c.dataLength}"<% };
attrs = attrs + s;
}
if (c.isPk == '1'){
var s = { %> readonly="\${!${className}.isNewRecord}"<% };
attrs = attrs + s;
}
var cssClass = '';
if (c.isRequired == '1'){
cssClass = cssClass + ' required';
}
var fieldValid = c.optionMap['fieldValid'];
if (isNotEmpty(fieldValid)){
if (type.name(fieldValid) == 'String[]'){
for (var fv in fieldValid){
cssClass = cssClass + ' ' + fv;
}
}else if(isNotBlank(fieldValid)){
cssClass = cssClass + ' ' + fieldValid;
}
}
if (c.showType == 'input'){
// 如果为自定义主键则第一个pk字段需输出isNewRecord
if (c.isPk == '1' && table.pkList[0].columnName == c.columnName){
%>
<${'#'}form:hidden path="isNewRecord"/>
<%
}
%>
<${'#'}form:input path="${c.attrName}"${attrs} class="form-control${cssClass}"/>
<%
} else if (c.showType == 'textarea') {
%>
<${'#'}form:textarea path="${c.attrName}" rows="4"${attrs} class="form-control${cssClass}"/>
<%
} else if (c.showType == 'select' || c.showType == 'select_multiple') {
var isMultiple = (c.showType == 'select_multiple');
%>
<${'#'}form:select path="${c.attrName}" dictType="${c.optionMap['dictType']}"${isMultiple?' multiple="true"':''}${c.isRequired != '1'?' blankOption="true"':''} class="form-control${cssClass}" />
<%
} else if (c.showType == 'radio') {
%>
<${'#'}form:radio path="${c.attrName}" dictType="${c.optionMap['dictType']}" class="form-control${cssClass}" />
<%
} else if (c.showType == 'checkbox') {
%>
<${'#'}form:checkbox path="${c.attrName}" dictType="${c.optionMap['dictType']}" class="form-control${cssClass}" />
<%
} else if (c.showType == 'date' || c.showType == 'datetime') {
var isTime = (c.showType == 'datetime');
%>
<${'#'}form:input path="${c.attrName}" readonly="true" maxlength="20" class="form-control Wdate${cssClass}"
dataFormat="date${isTime?'time':''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd${isTime?' HH:mm':''}',isShowClear:false});"/>
<%
} else if (c.showType == 'userselect') {
%>
<${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('用户选择')}"
path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/office/treeData?isLoadUser=true"
class="${cssClass}" allowClear="true"/>
<%
} else if (c.showType == 'officeselect') {
%>
<${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('机构选择')}"
path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/office/treeData"
class="${cssClass}" allowClear="true"/>
<%
} else if (c.showType == 'areaselect') {
%>
<${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('区域选择')}"
path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/area/treeData"
class="${cssClass}" allowClear="true"/>
<%
}
%>
</div>
</div>
</div>
<%
// 如果是第一个控件输出
if (rowFlag == -1){
rowFlag = 1;
}
// 行标记+1代表完成输出1列
else{
rowFlag = rowFlag + 1;
}
}
// 输出控件 End
}
}
// 如果没有输出row结束符则输出
if (rowFlag > 0){
%>
</div>
<%
}
// 输出上传图片控件
if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload'])){
%>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2">\${text('图片上传')}</label>
<div class="col-sm-10">
<${'#'}form:fileupload id="uploadImage" bizKey="\${${className}.id}" bizType="${className}_image"
uploadType="image" class="" readonly="false"/>
</div>
</div>
</div>
</div>
<%
}
// 输出上传附件控件
if(@ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){
%>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2">\${text('附件上传')}</label>
<div class="col-sm-10">
<${'#'}form:fileupload id="uploadFile" bizKey="\${${className}.id}" bizType="${className}_file"
uploadType="all" class="" readonly="false"/>
</div>
</div>
</div>
</div>
<%
}
%>

View File

@@ -0,0 +1,72 @@
<% /* 查询表单 begin // 此行是为了去除空行 */ %>
<${'#'}form:form id="searchForm" model="\${${className}}" action="\${ctx}/${urlPrefix}/listData" method="post" class="form-inline hide"
data-page-no="\${parameter.pageNo}" data-page-size="\${parameter.pageSize}" data-order-by="\${parameter.orderBy}">
<% for(c in table.columnList){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn){ %>
<div class="form-group">
<label class="control-label">\${text('${c.columnLabel}')}</label>
<% if(c.showType == 'input' || c.showType == 'textarea'){ %>
<div class="control-inline">
<% if (c.queryType == 'BETWEEN'){ %>
<${'#'}form:input path="${c.attrName}_gte"${c.dataLength != "0" ? ' maxlength="'+c.dataLength+'"' : ''} class="form-control width-60"/>
&nbsp;--&nbsp;
<${'#'}form:input path="${c.attrName}_lte"${c.dataLength != "0" ? ' maxlength="'+c.dataLength+'"' : ''} class="form-control width-60"/>
<% } else { %>
<${'#'}form:input path="${c.attrName}"${c.dataLength != "0" ? ' maxlength="'+c.dataLength+'"' : ''} class="form-control width-120"/>
<% } %>
</div>
<% }else if(c.showType == 'select' || c.showType == 'select_multiple'){
var isMultiple = (c.showType == 'select_multiple'); %>
<div class="control-inline width-120">
<${'#'}form:select path="${c.attrName}" dictType="${c.optionMap['dictType']}"${isMultiple?' multiple="true"':''} blankOption="true" class="form-control"/>
</div>
<% }else if(c.showType == 'radio'){ %>
<div class="control-inline">
<${'#'}form:radio path="${c.attrName}" dictType="${c.optionMap['dictType']}" blankOption="true" class="form-control"/>
</div>
<% }else if(c.showType == 'checkbox'){ %>
<div class="control-inline">
<${'#'}form:checkbox path="${c.attrName}" dictType="${c.optionMap['dictType']}" blankOption="true" class="form-control"/>
</div>
<% }else if(c.showType == 'date' || c.showType == 'datetime'){
var isTime = (c.showType == 'datetime'); %>
<div class="control-inline">
<% if (c.queryType == 'BETWEEN'){ %>
<${'#'}form:input path="${c.attrName}_gte" readonly="true" maxlength="20" class="form-control Wdate-date${isTime?'time':''}"
dataFormat="date${isTime?'time':''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd${isTime?' HH:mm':''}',isShowClear:false,onpicked:function(){${c.attrName}_lte.click()}});"/>
&nbsp;--&nbsp;
<${'#'}form:input path="${c.attrName}_lte" readonly="true" maxlength="20" class="form-control Wdate-date${isTime?'time':''}"
dataFormat="date${isTime?'time':''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd${isTime?' HH:mm':''}',isShowClear:false});"/>
<% } else { %>
<${'#'}form:input path="${c.attrName}" readonly="true" maxlength="20" class="form-control Wdate-date${isTime?'time':''}"
dataFormat="date${isTime?'time':''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd${isTime?' HH:mm':''}',isShowClear:false});"/>
<% } %>
</div>
<% }else if(c.showType == 'userselect'){ %>
<div class="control-inline width-120" >
<${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('用户选择')}"
path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/office/treeData?isLoadUser=true" allowClear="true"/>
</div>
<% }else if(c.showType == 'officeselect'){ %>
<div class="control-inline width-120" >
<${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('机构选择')}"
path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/office/treeData" allowClear="true"/>
</div>
<% }else if(c.showType == 'areaselect'){ %>
<div class="control-inline width-120" >
<${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('区域选择')}"
path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/area/treeData" allowClear="true"/>
</div>
<% } %>
</div>
<% } %>
<% } %>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-sm">\${text('查询')}</button>
<button type="reset" class="btn btn-default btn-sm">\${text('重置')}</button>
</div>
</${'#'}form:form>
<% /* 查询表单 end // 此行是为了去除空行 */ %>

View File

@@ -19,7 +19,7 @@
<div class="col-sm-8">
<#form:treeselect id="parent" title="${text('上级公司')}"
path="parent.id" labelPath="parent.companyName"
url="${ctx}/sys/company/treeData?excludeCode=${company.id}"
url="${ctx}/sys/company/treeData?excludeCode=${company.id}&ctrlPermi=2"
class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
</div>
</div>

View File

@@ -18,6 +18,7 @@
<div class="box-body">
<#form:form id="searchForm" model="${company}" action="${ctx}/sys/company/listData" method="post" class="form-inline hide"
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden name="ctrlPermi" value="2"/>
<div class="form-group">
<label class="control-label">${text('公司代码')}</label>
<div class="control-inline">

View File

@@ -19,7 +19,7 @@
<div class="col-sm-8">
<#form:treeselect id="parent" title="${text('上级机构')}"
path="parent.id" labelPath="parent.officeName"
url="${ctx}/sys/office/treeData?excludeCode=${office.id}"
url="${ctx}/sys/office/treeData?excludeCode=${office.id}&ctrlPermi=2"
class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
</div>
</div>

View File

@@ -18,6 +18,7 @@
<div class="box-body">
<#form:form id="searchForm" model="${office}" action="${ctx}/sys/office/listData" method="post" class="form-inline hide"
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden name="ctrlPermi" value="2"/>
<div class="form-group">
<label class="control-label">${text('机构代码')}</label>
<div class="control-inline">

View File

@@ -24,7 +24,7 @@
<div class="form-group">
<label class="control-label">${text('岗位名称')}</label>
<div class="control-inline">
<#form:input path="postName" maxlength="100" class="form-control width-120"/>
<#form:input path="postName_like" maxlength="100" class="form-control width-120"/>
</div>
</div>
<div class="form-group">

View File

@@ -25,7 +25,7 @@
<div class="col-sm-8">
<#form:treeselect id="office" title="${text('机构选择')}"
path="employee.office.officeCode" labelPath="employee.office.officeName"
url="${ctx}/sys/office/treeData" class="required" allowClear="false"/>
url="${ctx}/sys/office/treeData?ctrlPermi=2" class="required" allowClear="false"/>
</div>
</div>
</div>
@@ -36,7 +36,7 @@
<div class="col-sm-8">
<#form:treeselect id="company" title="${text('公司选择')}"
path="employee.company.companyCode" labelPath="employee.company.companyName"
url="${ctx}/sys/company/treeData" btnClass="" allowClear="true"/>
url="${ctx}/sys/company/treeData?ctrlPermi=2" btnClass="" allowClear="true"/>
</div>
</div>
</div>

View File

@@ -24,6 +24,7 @@
<div class="box-body">
<#form:form id="searchForm" model="${empUser}" action="${ctx}/sys/empUser/listData" method="post" class="form-inline "
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden name="ctrlPermi" value="2"/>
<div class="form-group">
<label class="control-label">${text('账号')}</label>
<div class="control-inline">
@@ -66,7 +67,7 @@
<div class="control-inline width-90">
<#form:treeselect id="office" title="${text('机构选择')}"
path="employee.office.officeCode" labelPath="employee.office.officeName"
url="${ctx}/sys/office/treeData" btnClass="btn-sm" allowClear="true" canSelectParent="true"/>
url="${ctx}/sys/office/treeData?ctrlPermi=2" btnClass="btn-sm" allowClear="true" canSelectParent="true"/>
</div>
</div>
<div class="form-group">
@@ -74,7 +75,7 @@
<div class="control-inline width-90">
<#form:treeselect id="company" title="${text('公司选择')}"
path="employee.company.companyCode" labelPath="employee.company.companyName"
url="${ctx}/sys/company/treeData" btnClass="btn-sm" allowClear="true" canSelectParent="true"/>
url="${ctx}/sys/company/treeData?ctrlPermi=2" btnClass="btn-sm" allowClear="true" canSelectParent="true"/>
</div>
</div>
<div class="form-group">

View File

@@ -5,6 +5,7 @@
<#form:form id="searchForm" action="${ctx}/sys/empUser/listData" method="post" class="form-inline "
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden name="status" value="${isNotBlank(empUser.status) ? empUser.status : '0'}"/>
<#form:hidden name="isAll" value="${parameter.isAll}"/>
<div class="form-group">
<label class="control-label">${text('账号')}</label>
<div class="control-inline">
@@ -98,11 +99,11 @@ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
}}
],
autoGridHeight: function(){
var height = $(window).height() - $('#searchForm').height() - $('#dataGridPage').height() - 73;
var height = $(window).height() - $('#searchForm').height() - $('#dataGridPage').height() - 75;
$('.tags-input').height($('.ui-jqgrid').height() - 10);
return height;
},
showCheckbox: ${checkbox! == 'true'},
showCheckbox: '${parameter.checkbox}' == 'true',
multiboxonly: false, // 单击复选框时再多选
ajaxSuccess: function(data){
$.each(selectData, function(key, value){
@@ -111,7 +112,7 @@ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
initSelectTag();
},
onSelectRow: function(id, isSelect, event){
if (${checkbox! == 'true'}){
if ('${parameter.checkbox}' == 'true'){
if(isSelect){
selectData[id] = JSON.parse(dataGrid.dataGrid('getRowData', id).rowData);
}else{
@@ -124,7 +125,7 @@ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
initSelectTag();
},
onSelectAll: function(ids, isSelect){
if (${checkbox! == 'true'}){
if ('${parameter.checkbox}' == 'true'){
for (var i=0; i<ids.length; i++){
if(isSelect){
selectData[ids[i]] = JSON.parse(dataGrid.dataGrid('getRowData', ids[i]).rowData);
@@ -136,7 +137,7 @@ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
initSelectTag();
},
ondblClickRow: function(id, rownum, colnum, event){
if (${checkbox! != 'true'}){
if ('${parameter.checkbox}' != 'true'){
js.layer.$('#' + window.name).closest('.layui-layer')
.find(".layui-layer-btn0").trigger("click");
}

View File

@@ -9,9 +9,7 @@
</a><%-->*/%>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<% if(__info_type == '0'){ %>
<li><a href="http://jeesite.com" target="_blank"><i class="fa fa-diamond"></i> 官方网站</a></li>
<% } %>
<% include('topMenuCorp.html'){} %>
<li><a href="javascript:" id="fullScreen" title="${text('全屏')}"><i class="fa fa-arrows-alt"></i></a></li>
<li><a href="javascript:" id="switchSkin" title="${text('切换主题')}" style="margin-top:-1px;"><i class="fa fa-dashboard"></i></a></li>
<% include('topMenuLang.html'){} %>

View File

@@ -0,0 +1,28 @@
<% if(@Global.getConfigToBoolean('user.useCorpModel', 'false') && user.superAdmin){ %>
<li>
<a href="javascript:" id="switchCorp">
<i class="fa icon-home"></i> 当前租户:(${session.corpCode}) ${session.corpName}
</a>
<div class="hide"><#form:treeselect id="switchCorpSelect" title="${text('租户切换')}" allowClear="false"
url="${ctx}/sys/corpAdmin/treeData?isShowCode=true" callbackFuncName="switchCorpSelectCallback"/>
</div>
<script>
$('#switchCorp').click(function(){
$('#switchCorpSelectButton').click();
});
function switchCorpSelectCallback(id, act, index, layero, nodes){
if (act == 'ok'){
var corpCode = $('#switchCorpSelectCode').val();
if (corpCode != ''){
js.ajaxSubmit("${ctx}/sys/corpAdmin/switch/"+corpCode, function(data){
js.showMessage(data.message);
top.location.reload();
});
}
}
}
</script>
</li>
<% }else if(__info_type == '0'){ %>
<li><a href="http://jeesite.com" target="_blank"><i class="fa fa-diamond"></i> 官方网站</a></li>
<% } %>

View File

@@ -1,3 +1,4 @@
<% if(@Global.getPropertyToBoolean('msg.enabled', 'true')){ %>
<li class="dropdown messages-menu">
<a href="javascript:" class="dropdown-toggle" data-hover="dropdown">
<i class="fa fa-envelope-o"></i>
@@ -41,4 +42,5 @@
onclick="readMsg(this, '${text('消息详情')}', '{{d.id}}')">${text('查看')}</button>&nbsp;
</div>
</script>
</li>
</li>
<% } %>

View File

@@ -15,7 +15,7 @@ import com.jeesite.common.io.PropertiesUtils;
* @version 2018-1-8
*/
@ActiveProfiles("test")
@SpringBootApplication(scanBasePackages={"com.jeesite.modules"})
@SpringBootApplication
public class ApplicationTest {
public static void main(String[] args) {

View File

@@ -4,6 +4,7 @@
package com.jeesite.test;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
@@ -15,14 +16,17 @@ import org.springframework.test.context.ActiveProfiles;
import com.jeesite.common.config.Global;
import com.jeesite.common.lang.DateUtils;
import com.jeesite.common.tests.BaseSpringContextTests;
import com.jeesite.modules.msg.entity.MsgTemplate;
import com.jeesite.modules.msg.entity.content.AppMsgContent;
import com.jeesite.modules.msg.entity.content.EmailMsgContent;
import com.jeesite.modules.msg.entity.content.PcMsgContent;
import com.jeesite.modules.msg.entity.content.SmsMsgContent;
import com.jeesite.modules.msg.service.MsgTemplateService;
import com.jeesite.modules.msg.task.impl.MsgLocalMergePushTask;
import com.jeesite.modules.msg.task.impl.MsgLocalPushTask;
import com.jeesite.modules.msg.utils.MsgPushUtils;
import com.jeesite.modules.sys.entity.User;
import com.jeesite.modules.sys.service.UserService;
import com.jeesite.modules.sys.utils.UserUtils;
/**
@@ -35,11 +39,16 @@ import com.jeesite.modules.sys.utils.UserUtils;
@Rollback(false)
public class MsgPushTest extends BaseSpringContextTests {
@Autowired
private UserService userService;
@Test
public void testSend(){
User user = UserUtils.get("system");
if (StringUtils.isAnyBlank(user.getMobile(), user.getEmail())){
throw new RuntimeException("请设置system用户的手机号码和邮箱地址");
user.setMobile("18555555555");
user.setEmail("test@163.com");
userService.updateUserInfo(user);
}
for (int i=0; i<1; i++){
testPC();
@@ -102,10 +111,22 @@ public class MsgPushTest extends BaseSpringContextTests {
// 延迟推送消息
MsgPushUtils.push(msgContent, "BizKey", "BizType", "system", new Date(), Global.YES);
}
@Autowired
private MsgTemplateService msgTemplateService;
public void testMailTpl(){
MsgTemplate msgTemplate = new MsgTemplate();
msgTemplate.setTplKey("mail_send_test");
List<MsgTemplate> tplList = msgTemplateService.findList(msgTemplate);
if (tplList.size() == 0){
msgTemplate.setTplName("邮件提示信息");
msgTemplate.setTplContent("你好,${keyword1},请于 ${keyword2},准时参加${keyword3}");
msgTemplate.setTplType("email");
msgTemplateService.save(msgTemplate);
}
EmailMsgContent msgContent = new EmailMsgContent();
msgContent.setTitle("提示信息");
msgContent.setTitle("邮件提示信息");
msgContent.setTplKey("mail_send_test");
msgContent.addTplData("keyword1", "小王");
msgContent.addTplData("keyword2", "2018-8-28 20:00");

View File

@@ -1,7 +1,7 @@
# 产品或项目名称、版本、版权年份
productName: JeeSite Demo
productVersion: V4.0
productVersion: V4.1
copyrightYear: 2018
# 软件提供商公司或个人名称
@@ -13,7 +13,7 @@ jdbc:
# Mysql 数据库配置
type: mysql
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/jeesite?useSSL=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
url: jdbc:mysql://127.0.0.1:3306/jeesite?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
username: root
password: 123456
testSql: SELECT 1

View File

@@ -0,0 +1,8 @@
#J2Cache configuration
j2cache.broadcast = none
j2cache.L1.provider_class = caffeine
j2cache.L2.provider_class = none
caffeine.region.default = 10000, 1h

View File

@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<!-- Spring boot default -->
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">

View File

@@ -1,5 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>4.0.7-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
<!-- ====== 这是一个新增模块示例项目,你可以拷贝此项目,修改 artifactId 为您的模块即可 ====== -->

View File

@@ -6,12 +6,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<version>2.0.5.RELEASE</version>
</parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>4.0.7-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JeeSite Parent</name>
@@ -21,26 +21,37 @@
<properties>
<!-- common version setting -->
<commons-lang3.version>3.4</commons-lang3.version>
<commons-io.version>2.5</commons-io.version>
<commons-fileupload.version>1.3.1</commons-fileupload.version>
<ruedigermoeller-fst.version>2.56</ruedigermoeller-fst.version>
<json.version>20170516</json.version>
<dozer.version>5.5.1</dozer.version>
<commons-io.version>2.6</commons-io.version>
<commons-fileupload.version>1.3.3</commons-fileupload.version>
<commons-beanutils.version>1.9.3</commons-beanutils.version>
<commons-text.version>1.3</commons-text.version>
<ant.version>1.9.7</ant.version>
<fst.version>2.57</fst.version>
<json.version>20180130</json.version>
<jsoup.version>1.11.3</jsoup.version>
<commons-email.version>1.5</commons-email.version>
<activation.version>1.1.1</activation.version>
<UserAgentUtils.version>1.21</UserAgentUtils.version>
<metadata-extractor.version>2.11.0</metadata-extractor.version>
<thumbnailator.version>0.4.8</thumbnailator.version>
<blade-patchca.version>1.1.0</blade-patchca.version>
<jmimemagic.version>0.1.5</jmimemagic.version>
<zxing.version>3.3.2</zxing.version>
<poi.version>3.14</poi.version>
<pinyin4j.version>2.5.1</pinyin4j.version>
<!-- framework version setting -->
<mybatis.version>3.4.5</mybatis.version>
<mybatis-spring.version>1.3.1</mybatis-spring.version>
<mybatis.version>3.4.6</mybatis.version>
<mybatis-spring.version>1.3.2</mybatis-spring.version>
<jsqlparser.version>1.1</jsqlparser.version>
<druid.version>1.1.10</druid.version>
<shiro.version>1.4.0</shiro.version>
<j2cache.version>2.7.0-release</j2cache.version>
<beetl.version>2.7-SNAPSHOT</beetl.version>
<ehcache-web.version>2.0.4</ehcache-web.version>
<quartz.version>2.2.3</quartz.version>
<swagger.version>1.5.20</swagger.version>
<!-- environment setting -->
<java.version>1.7</java.version>
<java.version>1.8</java.version>
<maven.test.skip>true</maven.test.skip>
<eclipse-plugin-download-sources>false</eclipse-plugin-download-sources>
<eclipse-plugin-download-javadocs>false</eclipse-plugin-download-javadocs>
@@ -153,8 +164,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes></packagingExcludes>
<warSourceExcludes></warSourceExcludes>
<warSourceExcludes>
WEB-INF/classes/*.lic,
userfiles/**
</warSourceExcludes>
<webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory>
<warName>${project.artifactId}</warName>
<archive>

View File

@@ -5,7 +5,7 @@
<groupId>com.jeesite</groupId>
<artifactId>jeesite-root</artifactId>
<version>4.0.7-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JeeSite</name>

View File

@@ -1,17 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="web">
<dependent-module archiveName="jeesite-module-core-4.0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/jeesite-module-core/jeesite-module-core">
<dependent-module archiveName="jeesite-module-core-4.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/jeesite-module-core/jeesite-module-core">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="jeesite-common-4.0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/jeesite-common/jeesite-common">
<dependent-module archiveName="jeesite-common-4.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/jeesite-common/jeesite-common">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="jeesite-framework-4.0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/jeesite-framework/jeesite-framework">
<dependent-module archiveName="jeesite-framework-4.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/jeesite-framework/jeesite-framework">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="jeesite-module-swagger-4.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/jeesite-module-swagger/jeesite-module-swagger">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="component.exclusion.patterns"/>
<property name="java-output-path" value="/src/main/webapp/WEB-INF/classes"/>
<property name="context-root" value="web"/>
<property name="component.exclusion.patterns" value="WEB-INF/classes/*.lic,userfiles/**"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>

View File

@@ -3,5 +3,5 @@
<fixed facet="jst.web"/>
<fixed facet="jst.java"/>
<installed facet="jst.java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="jst.web" version="3.1"/>
</faceted-project>

Some files were not shown because too many files have changed in this diff Show More