Compare commits

..

89 Commits

Author SHA1 Message Date
thinkgem
0e5a9aeeda update README.md 2025-07-10 10:06:38 +08:00
thinkgem
b0e6ab234e 完善xss正则表达式,处理on前面是/的问题;完善beetl的xss格式化,默认使用非html文本处理 2025-07-09 13:37:41 +08:00
thinkgem
0e33e2a6a9 Recover 修改个人信息后跳转目标页面不对问题 2025-07-09 11:03:19 +08:00
thinkgem
d611238583 5.12.1 2025-07-08 00:30:29 +08:00
thinkgem
200c374dee 调整默认的允许重定向地址,只允许项目内部跳转 2025-07-08 00:22:58 +08:00
thinkgem
0408671952 禁用UEditor图片抓取器,对CMS模版查看的地址进行限定 2025-07-08 00:22:57 +08:00
thinkgem
c869dc037c 5.12.1 2025-07-07 18:29:23 +08:00
thinkgem
055d3036fb 新增 SHA-256 工具,使用 ShaUtils 替代 Sha1Utils 2025-07-07 08:56:11 +08:00
thinkgem
94d8dcff3f 代码生成模版,优化 useI18n 参数 2025-07-05 16:31:01 +08:00
thinkgem
3819fb1276 左树右表,切换树节点的时候定向到列表第一页 2025-07-04 15:00:47 +08:00
thinkgem
af42b315b2 代码生成使用简化请求路径时,api文件名中不含模块名。 2025-07-03 16:49:37 +08:00
thinkgem
6bc118efeb update yml 2025-07-03 14:01:02 +08:00
thinkgem
19e395ae1f 默认使用oracle ojdbc8驱动 2025-07-03 13:47:58 +08:00
thinkgem
bdbd616130 代码生成模版支持多级模块设置,如模块管理:ai-core;功能生成模块名:ai.core;新增几个模版参数:moduleMinus、modulePath、subModuleNameDot、subModulePath 2025-06-30 11:19:56 +08:00
thinkgem
b12a225768 修正beetl修改密码后再登录系统,没有跳转到首页问题 2025-06-30 11:18:50 +08:00
thinkgem
1ca6bfa942 生成模版优化 2025-06-27 17:18:19 +08:00
thinkgem
bf8b05a49e vue主键为输入框的时候,不验证主键重复问题 2025-06-27 17:13:31 +08:00
thinkgem
26587e106f ztree 当没有title数据的时候,使用name作为title显示 2025-06-27 09:22:12 +08:00
thinkgem
7317bc227e 增加 spring.cache.globalKeyNames 参数,指定哪些为全局缓存,节省资源 2025-06-23 09:37:40 +08:00
thinkgem
3392c66fd5 修正请求对象被回收提示 2025-06-21 19:30:34 +08:00
thinkgem
6c8e8b930b 新增vue前端模块代码生成模板 2025-06-18 11:03:33 +08:00
thinkgem
2e832ef693 代码优化 2025-06-10 11:46:47 +08:00
thinkgem
b10f9d36fb lint type 2025-06-08 10:42:32 +08:00
thinkgem
ae2d2ae76f 代码生成模板默认替换为 Monorepo 2025-06-08 10:38:34 +08:00
thinkgem
6d5cd49c19 增加ureport接口权限配置 2025-06-06 15:03:15 +08:00
thinkgem
6b7813beaf 增加JsonFormat条件防止出现类型转换问题 2025-06-05 13:04:34 +08:00
thinkgem
119ceae9fe update jdbc driver 2025-05-27 23:36:36 +08:00
thinkgem
f7381ab736 5.12.0 2025-05-26 10:19:07 +08:00
thinkgem
5a830b7307 新增用户界面的时区切换 2025-05-26 09:42:50 +08:00
thinkgem
b5bde1e58c JsonMapper日期类型转换代码优化 2025-05-24 18:42:19 +08:00
thinkgem
a35d4654f5 新增 LocaleUtils 本地化语言和时区对象管理工具类 2025-05-24 18:41:41 +08:00
thinkgem
4634055b43 DateUtils.parseDate 多格式字符串解析性能优化,并支持时区 2025-05-24 18:41:02 +08:00
thinkgem
b4629aa465 更新语言包 2025-05-24 18:36:24 +08:00
thinkgem
4b6cdce814 beetl 日期格式化,使用性能更好的 DataUtils 管理 2025-05-24 18:35:24 +08:00
thinkgem
c478f2a969 代码优化 2025-05-24 16:59:16 +08:00
thinkgem
c7d317c1da JsonMapper 使用 DateUtils 解析日期,以支持更多的格式;优化 JsonFormat 注解非日期类型的自定义 2025-05-19 10:44:20 +08:00
thinkgem
8f6fd6000f 移除 web.json.defaultDateFormat 参数,使用 DateUtils 解析,以支持更多的格式 2025-05-19 10:41:10 +08:00
thinkgem
8f1dbaf3bd DateUtils 增加 yyyy-MM-dd'T'HH:mm:ss'Z' 格式解析 2025-05-19 10:38:43 +08:00
thinkgem
a414489ea9 默认包含达梦和人大金仓驱动,减少咨询,由于个别jdbc驱动体积比较大,可按需移除依赖 2025-05-12 11:09:40 +08:00
thinkgem
dc23dbcd6d 当已知异常信息包含更多异常的时候,将异常信息打印到日志中 2025-05-09 17:49:23 +08:00
thinkgem
62294446bd fileAllowSuffixes add .ofd 2025-05-09 14:29:14 +08:00
thinkgem
d7433b3c45 顶部消息框优化 2025-05-08 09:51:58 +08:00
thinkgem
f88e432403 next 2025-05-08 09:50:49 +08:00
thinkgem
3d99759a06 表单界面优化 2025-05-07 14:55:06 +08:00
thinkgem
7601d4d530 增加参数 mybatis.orderBySqlFilter 仅对内部参数设置生效,UI传输的数据仍然必须经过过滤。 2025-05-07 12:19:23 +08:00
thinkgem
59996a2a5b 一级菜单美化,圆角展示选中背景色 2025-05-06 15:08:32 +08:00
thinkgem
a35b7fd143 切换主题时,刷新当前页,不跳转到首页 2025-05-06 15:06:05 +08:00
thinkgem
ad28115fb3 update DaoMapperTest.java 2025-04-29 15:43:04 +08:00
thinkgem
9a816b18c2 移动端代码生成模板增强 2025-04-27 22:16:12 +08:00
thinkgem
f3d283ae4e 移动端模板补充日期时间组件生成 2025-04-27 15:39:11 +08:00
thinkgem
3abf83ff63 修正移动端模板的一些问题,textarea v-model 重复问题;maxlength 为 0 问题;列表 query 参数不对问题 2025-04-27 14:23:47 +08:00
thinkgem
9fedbcaa64 增加 按多个角色查询用户接口 user.roleCodes 2025-04-25 18:47:42 +08:00
thinkgem
bd059ab63e 当选择控件未设置查询列的时候没有生成office接口问题 2025-04-25 18:46:39 +08:00
thinkgem
053f1ee499 5.11.1 2025-04-23 09:41:48 +08:00
thinkgem
4fa4ade638 健壮性增强 2025-04-21 13:40:08 +08:00
thinkgem
1ae24c82c0 删除用不到的文件 2025-04-21 13:38:33 +08:00
thinkgem
4b16fcf58a 界面优化 2025-04-19 09:58:30 +08:00
thinkgem
5f18c9635d 整理初始化数据库脚本菜单,扩展模块移到扩展菜单里。 2025-04-18 15:38:55 +08:00
thinkgem
8b58259c97 update Dockerfile 2025-04-17 16:15:44 +08:00
thinkgem
ce47d7f341 update docker-build.sh 2025-04-17 14:00:41 +08:00
thinkgem
6ad05b6037 调整属性文件加载顺序,classpath:application.yml 优先于 classpath:config/application.yml(升级注意) 2025-04-17 09:07:44 +08:00
thinkgem
645f6f68fc update h2 2025-04-17 09:06:37 +08:00
thinkgem
1a92a275cd 代码优化 2025-04-17 09:05:49 +08:00
thinkgem
33c1865bf1 优化界面 2025-04-15 12:42:09 +08:00
thinkgem
5e67bd380b 表格操作列图标更新、默认按钮美化、表格设置按钮更新 2025-04-14 12:59:22 +08:00
thinkgem
77f245cbd7 弹窗消息透明度修改为0.9 2025-04-14 12:55:23 +08:00
thinkgem
95f68ac197 新增 Markdown 编辑器,文件上传接口 2025-04-09 15:07:40 +08:00
thinkgem
dc348365ce update PropertiesUtils 2025-04-07 18:39:28 +08:00
thinkgem
8c7a50f679 remove SchemeHttpsConfig 2025-04-07 18:38:36 +08:00
thinkgem
a8fb860bc1 支持 dataSourceNames 免配置,自动读取 jdbc 的属性来加载多数据源 2025-04-07 18:37:15 +08:00
thinkgem
737219388c 代码生成模板中增加重启流程操作 2025-04-07 12:04:57 +08:00
thinkgem
f01b6e7818 webp格式上传,默认参数少个点 2025-04-07 11:53:51 +08:00
thinkgem
ec95efccbc 启用岗位角色权限权限后,给予操作提示 2025-04-04 17:18:50 +08:00
thinkgem
5ffcba1c4e 增加参数:登录后激活当前用户所在的主部门,默认为不激活即混合权限 2025-04-04 10:49:04 +08:00
thinkgem
78c10ba2be 优化 DataScope 数据权限,移除 apiMode 参数,增加 apiMode 方法;
优化 DataScope 数据权限,增加 debug、joinMode、ruleSql 方法,方便动态调用
优化 扩展查询 SQL 实现,使用 sqlMap().getColumn().addExtSql 替代 extColumnKeys;
优化 扩展查询 SQL 实现,使用 sqlMap().getTable().addExtSql 替代 extFormKeys;
优化 扩展查询 SQL 实现,使用 sqlMap().getWhere().addExtSql 替代 extWhereKeys;
新增 扩展更新 SQL 语句,sqlMap().getUpdate().addExtColumnSql 和 addExtWhereSql
2025-04-02 16:38:23 +08:00
thinkgem
e28f4c9d12 优化 SqlMap 性能,增加 update 和 insert 生成参数接口,方便在 Mapper 中直接引用。 2025-04-01 11:57:26 +08:00
thinkgem
f4adf804a3 update title 2025-03-31 11:27:49 +08:00
thinkgem
95b08d24cf 优化树表性能,左树右表联动时,减少一次查询 2025-03-31 09:42:17 +08:00
thinkgem
198e76110b 查询条件如区域、公司、配置、机构、岗位、栏目、站点、分类等显示编码使用 like 查询,等其它功能查询细节优化 2025-03-30 15:04:53 +08:00
thinkgem
c5cbb22621 优化树表管理代码生成模板,左树右表代码生成模板 2025-03-29 22:22:30 +08:00
thinkgem
c2fc3e5c96 /test/testTree/list to /test/testTree/index 2025-03-29 22:08:09 +08:00
thinkgem
00b53ba722 EncodeUtils增加手机号和邮箱的掩码处理方法 2025-03-29 22:07:18 +08:00
thinkgem
17d6d9a822 testTree增加index,左树快捷选择 2025-03-29 22:04:29 +08:00
thinkgem
0465f35d4c 支持机构子节点数据的机构负责人和电话的模糊查询 2025-03-29 11:15:58 +08:00
thinkgem
a2b19c4b17 更正机构导出模板的显示标题 2025-03-29 11:14:24 +08:00
thinkgem
99321f4943 公司和部门管理列表,根据代码模糊查询时,可以查出子节点 2025-03-28 10:20:19 +08:00
thinkgem
a4c3476693 优化外部调用接口调用测试类 2025-03-27 14:15:36 +08:00
thinkgem
415dc88a79 EncodeUtils.encodeUrl 忽略字符编码传递空值,默认 UTF-8 2025-03-27 14:14:24 +08:00
thinkgem
eaad1b6e51 next version 2025-03-27 09:00:06 +08:00
250 changed files with 2415 additions and 1511 deletions

View File

@@ -112,6 +112,7 @@
* 内置功能:<https://jeesite.com/docs/function/>
* 目录结构:<https://jeesite.com/docs/catalog/>
* 架构特点:<https://jeesite.com/docs/feature/>
* 参数配置:<https://jeesite.com/docs/config/>
* 开发规范:<https://jeesite.com/docs/standard/>
* 代码生成:<https://jeesite.com/docs/code-gen/>
@@ -133,8 +134,8 @@
### 在线演示
1. 全栈版地址:<http://demo.jeesite.com>
2. Vue3分离版地址:<http://vue.jeesite.com>
1. 分离版地址:<https://vue.jeesite.com>
2. 经典版地址:<https://demo.jeesite.com>
### 本地运行
@@ -146,10 +147,11 @@
6. 浏览器访问:<http://127.0.0.1:8980/js> 账号 system 密码 admin
7. 部署常见问题:<https://jeesite.com/docs/faq/>
8. 分离端安装:<https://jeesite.com/docs/vue-install-deploy/>
9. 分离端常见问题:<https://jeesite.com/docs/vue-faq/>
### 快速运行
1. 环境准备:`JDK 1.8 or 11、17``Maven 3.6+`、无需准备数据库(使用内嵌 H2 DB、Vue资源包)
1. 环境准备:`JDK 1.8 or 11、17``Maven 3.6+`、无需准备数据库(使用内嵌 H2 DB、包含 Vue 和 全栈双版本
2. 下载源码:<https://gitee.com/thinkgem/jeesite5/repository/archive/v5.9.zip> 并解压
3. 执行脚本:`/web-fast/bin/run-tomcat.bat` 启动服务即可(自动初始化库)
4. Vue分离版本地址<http://127.0.0.1:8980/vue/login>
@@ -159,7 +161,7 @@
### 容器运行
- 拉取 Docker 镜像(演示使用,JeeSite版本较久
- 拉取 Docker 镜像JeeSite版本不是最新
```sh
docker pull thinkgem/jeesite-web
```
@@ -169,31 +171,50 @@ docker run --name jeesite-web -p 8980:8980 -d --restart unless-stopped \
-v ~/:/data thinkgem/jeesite-web && docker logs -f jeesite-web
```
- 浏览器访问:<http://127.0.0.1:8980/js/> 账号 system 密码 admin
- 分离端安装:<https://jeesite.com/docs/vue-install-deploy/>
### 开发环境
1. 部署运行文档:<https://jeesite.com/docs/install-deploy/>
2. 部署常见问题:<https://jeesite.com/docs/faq/>
3. 分离端安装<https://jeesite.com/docs/vue-install-deploy/>
3. 分离端运行文档<https://jeesite.com/docs/vue-install-deploy/>
4. 分离端常见问题:<https://jeesite.com/docs/vue-faq/>
## 技术文章
* 菜单和按钮权限:<https://jeesite.com/docs/permi-shiro/>
* 强大的数据权限:<https://jeesite.com/docs/service-datascope/#数据权限>
* 表结构数据字典<https://jeesite.com/docs/code-gen/#表结构数据字典>
* 持久层设计<https://jeesite.com/docs/dao-mybatis/>
* 后端工具<https://jeesite.com/docs/sys-utils/>
* 库表生成、代码生成https://jeesite.com/docs/code-gen/>
* 菜单权限、按钮权限:<https://jeesite.com/docs/permi-shiro/>
* 数据权限、库事务<https://jeesite.com/docs/service-datascope/#数据权限>
* 表结构、数据字典<https://jeesite.com/docs/code-gen/#表结构数据字典>
* 持久层框架、SQL<https://jeesite.com/docs/dao-mybatis/>
* 后端常用工具:<https://jeesite.com/docs/sys-utils/>
**分离版**
* 版本介绍:<https://jeesite.com/docs/jeesite-vue/>
* 源码解析:<https://jeesite.com/docs/vue-crud-view/>
* 表单组件:<https://jeesite.com/docs/vue-basic-form/>
* 表格组件:<https://jeesite.com/docs/vue-basic-table/>
* 参数配置:<https://jeesite.com/docs/vue-settings/>
* 常用组件:<https://jeesite.com/docs/vue-comp/>
* 前端权限:<https://jeesite.com/docs/vue-auth/>
* 图标组件:<https://jeesite.com/docs/vue-icon/>
* 前端样式库:<https://jeesite.com/docs/vue-style/>
* 多语言国际化:<https://jeesite.com/docs/vue-i18n/>
**经典版**
* 表单组件:<https://jeesite.com/docs/views-beetl/>
* 表格组件:<https://jeesite.com/docs/datagrid/>
* js工具:<https://jeesite.com/docs/jeesite-js/>
* 常用工具:<https://jeesite.com/docs/jeesite-js/>
* 自定义主题:<https://jeesite.com/docs/custom-views/>
## 专题文章
* 自定义主题<https://jeesite.com/docs/custom-views/>
* 国际化多语言:<https://jeesite.com/docs/i18n-locale/>
* 接口文档:<https://jeesite.com/docs/mobile-rest-api/>
* 系统接口文档<https://jeesite.com/docs/mobile-rest-api/>
* 多语言国际化<https://jeesite.com/docs/i18n-locale/>
* BPM工作流引擎<https://jeesite.com/docs/bpm/>
* CMS内容管理<https://jeesite.com/docs/cms/>
* AI知识库助手<https://jeesite.com/docs/cms-ai/>
* 用户类型:<https://jeesite.com/docs/user-type/>
* 消息推送:<https://jeesite.com/docs/msg-push-use/>
* 单点登录:<https://jeesite.com/docs/sso-cas/>
@@ -214,20 +235,9 @@ docker run --name jeesite-web -p 8980:8980 -d --restart unless-stopped \
* Spring Cloud 微服务:<https://jeesite.com/docs/springcloud/>
* 分布式事务 Seata<https://jeesite.com/docs/springcloud-seata/>
* 读写分离、分库分表:<https://jeesite.com/docs/sharding/>
## 前后分离版
* Vue 版介绍:<https://jeesite.com/docs/jeesite-vue/>
* Vue 安装部署:<https://jeesite.com/docs/vue-install-deploy/>
* Vue 参数配置:<https://jeesite.com/docs/vue-settings/>
* Vue 前端权限:<https://jeesite.com/docs/vue-auth/>
* Vue 源码解析:<https://jeesite.com/docs/vue-crud-view/>
* Vue 表单组件:<https://jeesite.com/docs/vue-basic-form/>
* Vue 表格组件:<https://jeesite.com/docs/vue-basic-table/>
* Vue 常用组件:<https://jeesite.com/docs/vue-comp/>
* Vue 图标组件:<https://jeesite.com/docs/vue-icon/>
* Vue 国际化多语言:<https://jeesite.com/docs/vue-i18n/>
* Vue 样式库:<https://jeesite.com/docs/vue-style/>
* 监控系统集成:<https://jeesite.com/docs/webadmin/>
* 追踪系统集成:<https://jeesite.com/docs/skywalking/>
* ELK日志收集<https://jeesite.com/docs/elk-log/>
## 授权协议声明

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>5.11.0-SNAPSHOT</version>
<version>5.12.1-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -249,6 +249,11 @@
<artifactId>spring-web</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>

View File

@@ -19,6 +19,7 @@ import java.security.*;
public class DigestUtils {
public static final String SHA1 = "SHA-1";
public static final String SHA256 = "SHA-256";
public static final String MD5 = "MD5";
public static final String SM3 = "SM3";

View File

@@ -154,7 +154,7 @@ public class EncodeUtils {
return null;
}
try {
return URLEncoder.encode(part, encoding);
return URLEncoder.encode(part, StringUtils.isNotBlank(encoding) ? encoding : EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
throw ExceptionUtils.unchecked(e);
}
@@ -175,7 +175,7 @@ public class EncodeUtils {
return null;
}
try {
return URLDecoder.decode(part, encoding);
return URLDecoder.decode(part, StringUtils.isNotBlank(encoding) ? encoding : EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
throw ExceptionUtils.unchecked(e);
}
@@ -192,7 +192,7 @@ public class EncodeUtils {
private static final List<Pattern> xssPatterns = ListUtils.newArrayList(
Pattern.compile("(<\\s*(script|link|style|iframe)([\\s\\S]*?)(>|<\\/\\s*\\1\\s*>))|(</\\s*(script|link|style|iframe)\\s*>)", Pattern.CASE_INSENSITIVE),
Pattern.compile("\\s*(href|src)\\s*=\\s*(\"\\s*(javascript|vbscript):[^\"]+\"|'\\s*(javascript|vbscript):[^']+'|(javascript|vbscript):[^\\s]+)\\s*(?=>)", Pattern.CASE_INSENSITIVE),
Pattern.compile("\\s*on[a-z]+\\s*=\\s*(\"[^\"]+\"|'[^']+'|[^\\s]+)\\s*(?=>)", Pattern.CASE_INSENSITIVE),
Pattern.compile("\\s*/?\\s*on[a-zA-Z]+\\s*=\\s*(['\"]?)(.*?)\\1(?=\\s|>|/>)", Pattern.CASE_INSENSITIVE),
Pattern.compile("(eval\\((.*?)\\)|expression\\((.*?)\\))", Pattern.CASE_INSENSITIVE),
Pattern.compile("^(javascript:|vbscript:)", Pattern.CASE_INSENSITIVE)
);
@@ -309,4 +309,27 @@ public class EncodeUtils {
return null;
}
// 对邮箱和手机号进行安全处理
private static final Pattern emailPattern = Pattern.compile("([\\w\\W]?)([\\w\\W]+)([\\w\\W])(@[\\w\\W]+)");
private static final Pattern mobilePattern = Pattern.compile("(\\d{3})(\\d+)(\\d{3})");
/**
* 手机号码进行掩码处理
*/
public static String mobileMask(String mobile){
if (StringUtils.isBlank(mobile)){
return mobile;
}
return mobilePattern.matcher(mobile).replaceAll("$1****$3");
}
/**
* 对电子邮箱进行掩码处理
*/
public static String emailMask(String email){
if (StringUtils.isBlank(email)){
return email;
}
return emailPattern.matcher(email).replaceAll("$1****$3$4");
}
}

View File

@@ -4,79 +4,11 @@
*/
package com.jeesite.common.codec;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/**
* SHA-1 加密工具类,散列加密,不可逆加密
* @author ThinkGem
*/
public class Sha1Utils {
/**
* 生成随机的 Byte[] 作为 salt 密钥.
* @param numBytes byte数组的大小
*/
public static byte[] genSalt(int numBytes) {
return DigestUtils.genSalt(numBytes);
}
/**
* 生成随机的 Byte[] 作为 salt 密钥,返回 HEX 值
* @param numBytes byte 数组的大小
*/
public static String genSaltString(int numBytes) {
return DigestUtils.genSaltString(numBytes);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static byte[] sha1(byte[] input) {
return DigestUtils.digest(input, DigestUtils.SHA1, null, 1);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static String sha1(String input) {
return EncodeUtils.encodeHex(sha1(input.getBytes(StandardCharsets.UTF_8)));
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static byte[] sha1(byte[] input, byte[] salt) {
return DigestUtils.digest(input, DigestUtils.SHA1, salt, 1);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static String sha1(String data, String salt) {
return EncodeUtils.encodeHex(sha1(data.getBytes(StandardCharsets.UTF_8), EncodeUtils.decodeHex(salt)));
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static byte[] sha1(byte[] input, byte[] salt, int iterations) {
return DigestUtils.digest(input, DigestUtils.SHA1, salt, iterations);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static String sha1(String input, String salt, int iterations) {
return EncodeUtils.encodeHex(sha1(input.getBytes(StandardCharsets.UTF_8), EncodeUtils.decodeHex(salt), iterations));
}
/**
* 对文件进行 SHA-1 散列.
*/
public static byte[] sha1(InputStream input) throws IOException {
return DigestUtils.digest(input, DigestUtils.SHA1);
}
@Deprecated
public class Sha1Utils extends ShaUtils {
}

View File

@@ -0,0 +1,131 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
*/
package com.jeesite.common.codec;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/**
* SHA-1 和 SHA-256 加密工具类,散列加密,不可逆加密
* @author ThinkGem
*/
public class ShaUtils {
/**
* 生成随机的 Byte[] 作为 salt 密钥.
* @param numBytes byte数组的大小
*/
public static byte[] genSalt(int numBytes) {
return DigestUtils.genSalt(numBytes);
}
/**
* 生成随机的 Byte[] 作为 salt 密钥,返回 HEX 值
* @param numBytes byte 数组的大小
*/
public static String genSaltString(int numBytes) {
return DigestUtils.genSaltString(numBytes);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static byte[] sha1(byte[] input) {
return DigestUtils.digest(input, DigestUtils.SHA1, null, 1);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static String sha1(String input) {
return EncodeUtils.encodeHex(sha1(input.getBytes(StandardCharsets.UTF_8)));
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static byte[] sha1(byte[] input, byte[] salt) {
return DigestUtils.digest(input, DigestUtils.SHA1, salt, 1);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static String sha1(String data, String salt) {
return EncodeUtils.encodeHex(sha1(data.getBytes(StandardCharsets.UTF_8), EncodeUtils.decodeHex(salt)));
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static byte[] sha1(byte[] input, byte[] salt, int iterations) {
return DigestUtils.digest(input, DigestUtils.SHA1, salt, iterations);
}
/**
* 对输入字符串进行 SHA-1 散列.
*/
public static String sha1(String input, String salt, int iterations) {
return EncodeUtils.encodeHex(sha1(input.getBytes(StandardCharsets.UTF_8), EncodeUtils.decodeHex(salt), iterations));
}
/**
* 对文件进行 SHA-1 散列.
*/
public static byte[] sha1(InputStream input) throws IOException {
return DigestUtils.digest(input, DigestUtils.SHA1);
}
/**
* 对输入字符串进行 SHA-256 散列.
*/
public static byte[] sha256(byte[] input) {
return DigestUtils.digest(input, DigestUtils.SHA256, null, 1);
}
/**
* 对输入字符串进行 SHA-256 散列.
*/
public static String sha256(String input) {
return EncodeUtils.encodeHex(sha256(input.getBytes(StandardCharsets.UTF_8)));
}
/**
* 对输入字符串进行 SHA-256 散列.
*/
public static byte[] sha256(byte[] input, byte[] salt) {
return DigestUtils.digest(input, DigestUtils.SHA256, salt, 1);
}
/**
* 对输入字符串进行 SHA-256 散列.
*/
public static String sha256(String data, String salt) {
return EncodeUtils.encodeHex(sha256(data.getBytes(StandardCharsets.UTF_8), EncodeUtils.decodeHex(salt)));
}
/**
* 对输入字符串进行 SHA-256 散列.
*/
public static byte[] sha256(byte[] input, byte[] salt, int iterations) {
return DigestUtils.digest(input, DigestUtils.SHA256, salt, iterations);
}
/**
* 对输入字符串进行 SHA-256 散列.
*/
public static String sha256(String input, String salt, int iterations) {
return EncodeUtils.encodeHex(sha256(input.getBytes(StandardCharsets.UTF_8), EncodeUtils.decodeHex(salt), iterations));
}
/**
* 对文件进行 SHA-256 散列.
*/
public static byte[] sha256(InputStream input) throws IOException {
return DigestUtils.digest(input, DigestUtils.SHA256);
}
}

View File

@@ -103,5 +103,9 @@ public class IOUtils extends org.apache.commons.io.IOUtils {
// ignore
}
}
@Deprecated
public IOUtils() {
// empty
}
}

View File

@@ -4,7 +4,6 @@
*/
package com.jeesite.common.io;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.collect.SetUtils;
import com.jeesite.common.lang.ObjectUtils;
import com.jeesite.common.lang.StringUtils;
@@ -17,6 +16,8 @@ import org.springframework.core.io.Resource;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -35,10 +36,10 @@ public class PropertiesUtils {
// 默认加载的文件可通过继承覆盖若有相同Key优先加载后面的
public static final String[] DEFAULT_CONFIG_FILE = new String[]{
"classpath:application.yml", "classpath:config/application.yml",
"classpath:bootstrap.yml", "classpath:config/bootstrap.yml",
"file:application.yml", "file:config/application.yml",
"file:bootstrap.yml", "file:config/bootstrap.yml",
"classpath:config/application.yml", "classpath:application.yml",
"classpath:config/bootstrap.yml", "classpath:bootstrap.yml",
"file:config/application.yml", "file:application.yml",
"file:config/bootstrap.yml", "file:bootstrap.yml",
};
private static final Logger logger = PropertiesUtils.initLogger();
@@ -64,9 +65,7 @@ public class PropertiesUtils {
//configSet.add("classpath:config/jeesite.yml");
// 获取全局设置默认的配置文件(以下是支持环境配置的属性文件)
Set<String> set = SetUtils.newLinkedHashSet();
for (String configFile : DEFAULT_CONFIG_FILE){
set.add(configFile);
}
set.addAll(Arrays.asList(DEFAULT_CONFIG_FILE));
// 获取 spring.config.location 外部自定义的配置文件
String customConfigs = System.getProperty("spring.config.location");
if (StringUtils.isNotBlank(customConfigs)){
@@ -81,7 +80,7 @@ public class PropertiesUtils {
}
}
// 获取 spring.profiles.active 活动环境名称的配置文件
String[] configFiles = set.toArray(new String[set.size()]);
String[] configFiles = set.toArray(new String[0]);
String profiles = System.getProperty("spring.profiles.active");
if (StringUtils.isBlank(profiles)){
PropertiesUtils propsTemp = new PropertiesUtils(configFiles);
@@ -101,7 +100,7 @@ public class PropertiesUtils {
}
}
}
configFiles = configSet.toArray(new String[configSet.size()]);
configFiles = configSet.toArray(new String[0]);
logger.debug("Trying: {}", (Object)configFiles);
INSTANCE = new PropertiesUtils(configFiles);
}
@@ -115,12 +114,11 @@ public class PropertiesUtils {
Resource resource = ResourceUtils.getResource(location);
if (resource.exists()){
if (location.endsWith(".properties")){
try (InputStreamReader is = new InputStreamReader(resource.getInputStream(), EncodeUtils.UTF_8)){
try (InputStreamReader is = new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8)){
properties.load(is);
configSet.add(location);
} catch (IOException e) {
System.err.println("Load " + location + " failure.");
e.printStackTrace();
logger.error("Load {} failure.", location, e);
}
}
else if (location.endsWith(".yml")){
@@ -133,8 +131,7 @@ public class PropertiesUtils {
}
configSet.add(location);
} catch (Exception e) {
System.err.println("Load " + location + " failure.");
e.printStackTrace();
logger.error("Load {} failure.", location, e);
}
}
}
@@ -316,7 +313,6 @@ public class PropertiesUtils {
/**
* 设置环境属性
* @param environment
*/
public static void setEnvironment(Environment environment) {
PropertiesUtils.environment = environment;

View File

@@ -4,10 +4,11 @@
*/
package com.jeesite.common.lang;
import com.jeesite.common.utils.LocaleUtils;
import org.apache.commons.lang3.time.FastDateFormat;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Calendar;
import java.util.Date;
@@ -17,14 +18,14 @@ import java.util.Date;
* @version 2017-1-4
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
private static final String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd HH", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM/dd HH", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM.dd HH", "yyyy.MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM.dd HH", "yyyy.MM",
"yyyy年MM月dd日", "yyyy年MM月dd日 HH时mm分ss秒", "yyyy年MM月dd日 HH时mm分", "yyyy年MM月dd日 HH时", "yyyy年MM月",
"yyyyMMdd", "yyyyMM", "yyyy"};
"yyyyMMdd", "yyyyMM", "yyyy", "yyyy-MM-dd'T'HH:mm:ss'Z'"};
/**
* 得到日期字符串 转换格式yyyy-MM-dd
*/
@@ -45,15 +46,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String formatDate(Date date, String pattern) {
String formatDate = null;
if (date != null){
// if (StringUtils.isNotBlank(pattern)) {
// formatDate = DateFormatUtils.format(date, pattern);
// } else {
// formatDate = DateFormatUtils.format(date, "yyyy-MM-dd");
// }
if (StringUtils.isBlank(pattern)) {
pattern = "yyyy-MM-dd";
}
formatDate = FastDateFormat.getInstance(pattern).format(date);
// formatDate = DateFormatUtils.format(date, "yyyy-MM-dd");
formatDate = FastDateFormat.getInstance(pattern,
LocaleUtils.getTimeZone(), LocaleUtils.getLocale()).format(date);
}
return formatDate;
}
@@ -77,7 +75,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
*/
public static String getDate(String pattern) {
// return DateFormatUtils.format(new Date(), pattern);
return FastDateFormat.getInstance(pattern).format(new Date());
return FastDateFormat.getInstance(pattern,
LocaleUtils.getTimeZone(), LocaleUtils.getLocale()).format(new Date());
}
/**
@@ -88,11 +87,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return
*/
public static String getDate(String pattern, int amont, int type) {
Calendar calendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(LocaleUtils.getTimeZone(), LocaleUtils.getLocale());
calendar.setTime(new Date());
calendar.add(type, amont);
// return DateFormatUtils.format(calendar.getTime(), pattern);
return FastDateFormat.getInstance(pattern).format(calendar.getTime());
return FastDateFormat.getInstance(pattern,
LocaleUtils.getTimeZone(), LocaleUtils.getLocale()).format(calendar.getTime());
}
/**
@@ -138,17 +138,43 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
/**
* 日期型字符串转化为日期 格式 see to DateUtils#parsePatterns
* 日期型字符串转化为日期对象,使用默认格式集
*/
public static Date parseDate(Object str) {
if (str == null){
return null;
}
try {
return parseDate(str.toString(), parsePatterns);
} catch (ParseException e) {
String dateStr = str.toString();
if (StringUtils.isBlank(dateStr)){
return null;
}
return parseDate(dateStr, parsePatterns);
}
/**
* 日期型字符串转化为日期对象,指定日期解析格式
*/
public static Date parseDate(final String str, final String... parsePatterns) {
// try {
// return DateUtils.parseDate(str, Locale.getDefault(), parsePatterns);
// } catch (ParseException e) {
// return null;
// }
ParsePosition pos = new ParsePosition(0);
Calendar calendar = Calendar.getInstance(LocaleUtils.getTimeZone(), LocaleUtils.getLocale());
for (final String parsePattern : parsePatterns) {
FastDateFormat format = FastDateFormat.getInstance(parsePattern);
calendar.clear();
try {
if (format.parse(str, pos, calendar) && pos.getIndex() == str.length()) {
return calendar.getTime();
}
} catch (final IllegalArgumentException ignored) {
// leniency is preventing calendar from being set
}
pos.setIndex(0);
}
return null;
}
/**
@@ -228,7 +254,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return
*/
public static int getWeekOfYear(Date date){
Calendar cal = Calendar.getInstance();
Calendar cal = Calendar.getInstance(LocaleUtils.getTimeZone(), LocaleUtils.getLocale());
cal.setTime(date);
return cal.get(Calendar.WEEK_OF_YEAR);
}
@@ -242,7 +268,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
if (date == null){
return null;
}
Calendar calendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(LocaleUtils.getTimeZone(), LocaleUtils.getLocale());
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
@@ -260,7 +286,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
if (date == null){
return null;
}
Calendar calendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(LocaleUtils.getTimeZone(), LocaleUtils.getLocale());
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
@@ -315,5 +341,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
return new Date[]{beginDate, endDate};
}
@Deprecated
public DateUtils() {
// empty
}
}

View File

@@ -37,16 +37,19 @@ public class ExceptionUtils {
public static String getExceptionMessage(Throwable ex){
String message = null;
Throwable e = ex;
while (true){
if (e == null){
while (true) {
if (e == null) {
break;
}
if (StringUtils.startsWith(e.getMessage(), "msg:")){
if (StringUtils.startsWith(e.getMessage(), "msg:")) {
message = StringUtils.replace(e.getMessage(), "msg:", "");
break;
}else if ("com.jeesite.common.service.ServiceException"
.equals(e.getClass().getName())){
} else if ("com.jeesite.common.service.ServiceException".equals(e.getClass().getName())){
message = e.getMessage();
}
if (StringUtils.isNotBlank(message)){
if (e.getSuppressed() != null && e.getCause() != null){
ex.addSuppressed(e.getCause());
}
break;
}
e = e.getCause();

View File

@@ -119,5 +119,9 @@ public class NumberUtils extends org.apache.commons.lang3.math.NumberUtils {
}
return df.format(data);
}
@Deprecated
public NumberUtils() {
// empty
}
}

View File

@@ -363,5 +363,9 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
// inputPool.free(input);
// }
// }
@Deprecated
public ObjectUtils() {
// empty
}
}

View File

@@ -415,5 +415,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
return name;
}
}
@Deprecated
public StringUtils() {
// empty
}
}

View File

@@ -9,9 +9,9 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.AnnotatedClass;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.module.SimpleModule;
@@ -20,6 +20,7 @@ import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.io.PropertiesUtils;
import com.jeesite.common.lang.DateUtils;
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,7 +28,6 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import java.io.IOException;
import java.lang.reflect.AnnotatedElement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -52,65 +52,106 @@ public class JsonMapper extends ObjectMapper {
}
public JsonMapper() {
// Spring ObjectMapper 初始化配置,支持 @JsonView
new Jackson2ObjectMapperBuilder().configure(this);
// 日志类型格式化处理
this.setLocaleTimeZoneDateFormat();
// 为Null时不序列化
this.setSerializationInclusion(Include.NON_NULL);
// 允许单引号
this.configure(Feature.ALLOW_SINGLE_QUOTES, true);
// 允许不带引号的字段名称
this.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
// 设置默认时区
this.setDefaultTimeZone();
// 设置默认日期格式
this.setDefaultDateFormat();
// 遇到空值处理为空串
// 遇到空值处理为空串
this.enabledNullValueToEmpty();
// 设置输入时忽略在JSON字符串中存在但Java对象实际没有的属性
this.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
// Spring ObjectMapper 初始化配置,支持 @JsonView
new Jackson2ObjectMapperBuilder().configure(this);
}
/**
* 开启日期类型默认格式化
* 日志类型格式化处理
* @author ThinkGem
*/
public JsonMapper setDefaultTimeZone(){
public JsonMapper setLocaleTimeZoneDateFormat(){
this.setLocale(LocaleUtils.toLocale(PropertiesUtils.getInstance()
.getProperty("lang.defaultLocale", "zh_CN")));
this.setTimeZone(TimeZone.getTimeZone(PropertiesUtils.getInstance()
.getProperty("lang.defaultTimeZone", "GMT+08:00")));
return this;
}
/**
* 开启日期类型默认格式化
* @author ThinkGem
*/
public JsonMapper setDefaultDateFormat(){
this.setDateFormat(new SimpleDateFormat(PropertiesUtils.getInstance()
.getProperty("web.json.defaultDateFormat", "yyyy-MM-dd HH:mm:ss")));
this.setAnnotationIntrospector(new JacksonAnnotationIntrospector() {
private static final long serialVersionUID = 1L;
@Override
public Object findSerializer(Annotated a) {
if (a instanceof AnnotatedMethod) {
AnnotatedElement m = a.getAnnotated();
JsonFormat jf = m.getAnnotation(JsonFormat.class);
if (jf != null) {
return new JsonSerializer<Date>(){
@Override
public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
if (value != null){
jgen.writeString(DateUtils.formatDate(value, jf.pattern()));
}
}
};
AnnotatedMethod am = (AnnotatedMethod) a;
if (am.getRawReturnType() == Date.class) {
JsonFormat jf = am.getAnnotation(JsonFormat.class);
if (jf != null && StringUtils.containsAnyIgnoreCase(jf.pattern(), pattern)) {
return new JeeSiteJsonSerializer(jf.pattern());
}
return new JeeSiteJsonSerializer(null);
}
} else if (a instanceof AnnotatedClass) {
if (a.getRawType() == Date.class) {
return new JeeSiteJsonSerializer(null);
}
}
return super.findSerializer(a);
}
@Override
public Object findDeserializer(Annotated a) {
if (a instanceof AnnotatedMethod) {
AnnotatedMethod am = (AnnotatedMethod) a;
if (am.getParameterCount() > 0 && am.getParameterType(0).getRawClass() == Date.class) {
AnnotatedElement m = am.getAnnotated();
JsonFormat jf = m.getAnnotation(JsonFormat.class);
if (jf != null && StringUtils.containsAnyIgnoreCase(jf.pattern(), pattern)) {
return new JeeSiteJsonDeserializer(jf.pattern());
}
return new JeeSiteJsonDeserializer(null);
}
} else if (a instanceof AnnotatedClass) {
if (a.getRawType() == Date.class) {
return new JeeSiteJsonDeserializer(null);
}
}
return super.findDeserializer(a);
}
});
return this;
}
private static final String[] pattern = new String[] {"yyyy", "MM", "dd", "HH", "mm", "ss", "SSS"};
private static final class JeeSiteJsonSerializer extends JsonSerializer<Date> {
private final String pattern;
private JeeSiteJsonSerializer(String pattern) {
this.pattern = pattern;
}
@Override
public void serialize(Date value, JsonGenerator gen, SerializerProvider provider) throws IOException {
if (value != null){
if (StringUtils.isNotBlank(pattern)) {
gen.writeString(DateUtils.formatDate(value, pattern));
} else {
gen.writeString(DateUtils.formatDateTime(value));
}
}
}
}
private static final class JeeSiteJsonDeserializer extends JsonDeserializer<Date> {
private final String pattern;
private JeeSiteJsonDeserializer(String pattern) {
this.pattern = pattern;
}
@Override
public Date deserialize(JsonParser parser, DeserializationContext context) throws IOException {
if (StringUtils.isNotBlank(pattern)) {
return DateUtils.parseDate(parser.getText(), pattern);
} else {
return DateUtils.parseDate(parser.getText());
}
}
}
/**
* 开启将空值转换为空字符串
* @author ThinkGem
@@ -121,7 +162,7 @@ public class JsonMapper extends ObjectMapper {
public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeString(StringUtils.EMPTY);
}
});
});
return this;
}
@@ -152,7 +193,7 @@ public class JsonMapper extends ObjectMapper {
try {
return this.writeValueAsString(object);
} catch (IOException e) {
logger.warn("write to json string error:" + object, e);
logger.warn("write to json string error: {}", object, e);
return null;
}
}
@@ -166,7 +207,7 @@ public class JsonMapper extends ObjectMapper {
try {
return this.writerWithView(jsonView).writeValueAsString(object);
} catch (IOException e) {
logger.warn("write to json string error:" + object, e);
logger.warn("write to json string error: {}", object, e);
return null;
}
}
@@ -192,7 +233,7 @@ public class JsonMapper extends ObjectMapper {
try {
return this.readValue(jsonString, clazz);
} catch (IOException e) {
logger.warn("parse json string error:" + jsonString, e);
logger.warn("parse json string error: {}", jsonString, e);
return null;
}
}
@@ -209,7 +250,7 @@ public class JsonMapper extends ObjectMapper {
try {
return (T) this.readValue(jsonString, javaType);
} catch (IOException e) {
logger.warn("parse json string error:" + jsonString, e);
logger.warn("parse json string error: {}", jsonString, e);
return null;
}
}
@@ -230,10 +271,8 @@ public class JsonMapper extends ObjectMapper {
public <T> T update(String jsonString, T object) {
try {
return (T) this.readerForUpdating(object).readValue(jsonString);
} catch (JsonProcessingException e) {
logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e);
} catch (Exception e) {
logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e);
logger.warn("update json string: {} to object: {} error.", jsonString, object, e);
}
return null;
}

View File

@@ -1,7 +1,5 @@
package com.jeesite.common.utils;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -11,11 +9,10 @@ import java.util.Map;
/**
* 身份证工具类
*
* @author June
* @version 1.0, 2010-06-17
* @version 2010-06-17
*/
public class IdcardUtils extends StringUtils {
public class IdcardUtils {
/** 中国公民身份证号码最小长度。 */
public static final int CHINA_ID_MIN_LENGTH = 15;

View File

@@ -0,0 +1,100 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
*/
package com.jeesite.common.utils;
import com.jeesite.common.io.PropertiesUtils;
import com.jeesite.common.web.http.ServletUtils;
import org.springframework.context.i18n.TimeZoneAwareLocaleContext;
import org.springframework.core.NamedThreadLocal;
import org.springframework.web.servlet.LocaleContextResolver;
import javax.servlet.http.HttpServletRequest;
import java.util.Locale;
import java.util.TimeZone;
/**
* 本地化工具
* @author ThinkGem
* @version 2025-05-21
*/
public class LocaleUtils {
private static final Boolean LANG_ENABLED = PropertiesUtils.getInstance().getPropertyToBoolean("lang.enabled", "false");
private static final ThreadLocal<TimeZoneAwareLocaleContext> timeZoneAwareLocaleContext = new NamedThreadLocal<>("TimeZoneAwareLocaleContext");
private static LocaleContextResolver localeResolver;
/**
* 获取当前 Locale 对象,获取顺序:请求 -> 会话 -> Cookie -> lang.defaultLocale
*/
public static Locale getLocale() {
return getTimeZoneAwareLocaleContext().getLocale();
}
/**
* 获取当前 TimeZone 对象,获取顺序:请求 -> 会话 -> Cookie -> lang.defaultTimeZone
*/
public static TimeZone getTimeZone() {
return getTimeZoneAwareLocaleContext().getTimeZone();
}
/**
* 获取 TimeZoneAwareLocaleContext
*/
public static TimeZoneAwareLocaleContext getTimeZoneAwareLocaleContext() {
TimeZoneAwareLocaleContext context = timeZoneAwareLocaleContext.get();
if (context != null){
return context;
}
Locale locale;
TimeZone timeZone;
if (LANG_ENABLED && localeResolver != null){
HttpServletRequest request = ServletUtils.getRequest();
if (request != null){
context = (TimeZoneAwareLocaleContext)localeResolver.resolveLocaleContext(request);
}
}
if (context != null){
locale = context.getLocale();
timeZone = context.getTimeZone();
} else {
locale = Locale.getDefault();
timeZone = TimeZone.getDefault();
}
context = new TimeZoneAwareLocaleContext() {
@Override
public Locale getLocale() {
return locale;
}
@Override
public TimeZone getTimeZone() {
return timeZone;
}
};
setTimeZoneAwareLocaleContext(context);
return context;
}
/**
* 设置 TimeZoneAwareLocaleContext
*/
public static void setTimeZoneAwareLocaleContext(TimeZoneAwareLocaleContext context) {
timeZoneAwareLocaleContext.set(context);
}
/**
* 清理本地线程对象(请求结束时调用)
*/
public static void removeTimeZoneAwareLocaleContext() {
timeZoneAwareLocaleContext.remove();
}
/**
* 设置 LocaleContextResolver
*/
public static void setLocaleResolver(LocaleContextResolver localeResolver) {
LocaleUtils.localeResolver = localeResolver;
}
}

View File

@@ -2,14 +2,14 @@
* http://jeesite.com
*/
a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sortable {
color:#1890ff;
color:#1677ff;
}
.main-header .navbar {
background: #1890ff;
background: -webkit-gradient(linear, left bottom, right top, color-stop(0, #2684f5), color-stop(1, #1890ff));
background: -ms-linear-gradient(left, #2684f5, #1890ff);
background: -moz-linear-gradient(left top, #2684f5 0%, #1890ff 100%);
background: -o-linear-gradient(#1890ff, #2684f5);
background: #1677ff;
background: -webkit-gradient(linear, left bottom, right top, color-stop(0, #2684f5), color-stop(1, #1677ff));
background: -ms-linear-gradient(left, #2684f5, #1677ff);
background: -moz-linear-gradient(left top, #2684f5 0%, #1677ff 100%);
background: -o-linear-gradient(#1677ff, #2684f5);
}
.main-header .navbar .nav > li > a {
color: #ffffff;
@@ -54,10 +54,10 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
border-bottom: 0 solid transparent;
}
.main-header .logo:hover {
background-color: #1890ff;
background-color: #1677ff;
}
.main-header li.user-header {
background-color: #1890ff;
background-color: #1677ff;
}
.content-header {
background: transparent;
@@ -93,7 +93,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
background: #ffffff;
}
.sidebar-menu > li.active {
border-left-color: #1890ff;
border-left-color: #1677ff;
}
.sidebar-menu > li.active > a {
font-weight: 600;
@@ -154,7 +154,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
border-radius: 4px;
}
.skin-blue.layout-top-nav .main-header > .logo {
background-color: #1890ff;
background-color: #1677ff;
color: #ffffff;
border-bottom: 0 solid transparent;
}
@@ -164,7 +164,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.sidebar-menu {padding:0 8px 0 7px;}
.sidebar-menu li>a>.pull-right-container {left:0;}
.sidebar-menu .treeview-item.active>a {color:#1890ff;background-color:#e7f4ff;border-right:0;border-radius:6px;}
.sidebar-menu .treeview-item.active>a {color:#1677ff;background-color:#e7f4ff;border-right:0;border-radius:6px;}
.content-wrapper, .right-side, body {background-color:#f0f2f5;}
@@ -189,12 +189,13 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.select2-container--default .select2-results__option--highlighted[aria-selected],
.pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover,
.pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover,
.wup_container .placeholder .webuploader-pick {background-color:#1890ff!important;border-color:#1890ff;}
.form-unit, th[aria-selected=true] .ui-jqgrid-sortable {color:#1890ff;}
.wup_container .placeholder .webuploader-pick {background-color:#1677ff!important;border-color:#1677ff;}
.form-unit, th[aria-selected=true] .ui-jqgrid-sortable {color:#1677ff;}
.form-unit {border-bottom:1px solid #eee;}
.form-unit:before {background-color:#1677ff;}
.box-main>.box-header {border-bottom-color:#eeeeee;}
.box-main>.box-header .box-title .fa {color:#1890ff;}
.box-main>.box-header .box-title .fa {color:#1677ff;}
.nav-tabs-custom>.nav-tabs>li.active {border-top-color:#3aa0ff;}
.form-control:focus,.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-search--dropdown .select2-search__field,

View File

@@ -2,17 +2,37 @@
* http://jeesite.com
*/
a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sortable {
color:#1890ff;
color:#1677ff;
}
.main-header .navbar {
background: #1890ff;
background: -webkit-gradient(linear, left bottom, right top, color-stop(0, #2684f5), color-stop(1, #1890ff));
background: -ms-linear-gradient(left, #2684f5, #1890ff);
background: -moz-linear-gradient(left top, #2684f5 0%, #1890ff 100%);
background: -o-linear-gradient(#1890ff, #2684f5);
background: #1677ff;
background: -webkit-gradient(linear, left bottom, right top, color-stop(0, #2684f5), color-stop(1, #1677ff));
background: -ms-linear-gradient(left, #2684f5, #1677ff);
background: -moz-linear-gradient(left top, #2684f5 0%, #1677ff 100%);
background: -o-linear-gradient(#1677ff, #2684f5);
}
.main-header .navbar .nav > li > a {
color: #ffffff;
margin: 4.5px 2px 0;
padding: 10px 13px;
border-radius: 6px;
}
.main-header .navbar .nav > li > a > i {
font-size: 16px;
vertical-align: bottom;
line-height: 20px;
}
.navbar-nav>.user-menu>.dropdown-menu {
margin-top: 7px;
border-radius: 6px;
}
.navbar-nav .treeview-menu,
.navbar-custom-menu>.navbar-nav>li>.dropdown-menu {
margin-top: 5px;
border-radius: 6px;
}
.navbar-nav .treeview-menu a {
border-radius: 6px;
}
.main-header .navbar .nav > li > a:hover,
.main-header .navbar .nav > li > a:active,
@@ -54,10 +74,10 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
border-bottom: 0 solid transparent;
}
.main-header .logo:hover {
background-color: #1890ff;
background-color: #1677ff;
}
.main-header li.user-header {
background-color: #1890ff;
background-color: #1677ff;
}
.content-header {
background: transparent;
@@ -93,7 +113,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
background: #ffffff;
}
.sidebar-menu > li.active {
border-left-color: #1890ff;
border-left-color: #1677ff;
}
.sidebar-menu > li.active > a {
font-weight: 600;
@@ -154,7 +174,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
border-radius: 4px;
}
.skin-blue.layout-top-nav .main-header > .logo {
background-color: #1890ff;
background-color: #1677ff;
color: #ffffff;
border-bottom: 0 solid transparent;
}
@@ -164,12 +184,12 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.sidebar-menu {padding:0 8px 0 7px;}
.sidebar-menu li>a>.pull-right-container {left:0;}
.sidebar-menu .treeview-item.active>a {color:#1890ff;background-color:#e7f4ff;border-right:0;border-radius:6px;}
.sidebar-menu .treeview-item.active>a {color:#1677ff;background-color:#e7f4ff;border-right:0;border-radius:6px;}
/* 页签添加内边距 */
.content-wrapper, .tabpanel_content, .tabpanel_content .html_content, body {background-color:#f0f2f5;}
.box-main, .nav-main, .ui-layout-pane, iframe {border-radius:5px;}
.tabpanel_content .html_content {padding:13px 14px 13px 15px;}
.tabpanel_content .html_content {padding:12px 14px 12px 15px;}
.tabpanel_tab_content {border-bottom:0;}
.ui-layout-resizer {background:none;}
.content {padding:0!important}
@@ -211,12 +231,13 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.select2-container--default .select2-results__option--highlighted[aria-selected],
.pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover,
.pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover,
.wup_container .placeholder .webuploader-pick {background-color:#1890ff!important;border-color:#1890ff!important;}
.form-unit, th[aria-selected=true] .ui-jqgrid-sortable {color:#1890ff;}
.wup_container .placeholder .webuploader-pick {background-color:#1677ff!important;border-color:#1677ff!important;}
.form-unit, th[aria-selected=true] .ui-jqgrid-sortable {color:#1677ff;}
.form-unit {border-bottom:1px solid #eee;}
.form-unit:before {background-color:#1677ff;}
.box-main>.box-header {border-bottom-color:#eeeeee;}
.box-main>.box-header .box-title .fa {color:#1890ff;}
.box-main>.box-header .box-title .fa {color:#1677ff;}
.nav-tabs-custom>.nav-tabs>li.active {border-top-color:#3aa0ff;}
.form-control:focus,.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-search--dropdown .select2-search__field,

View File

@@ -192,6 +192,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.wup_container .placeholder .webuploader-pick {background-color:#1e5edb!important;border-color:#1e5edb!important;}
.form-unit, th[aria-selected=true] .ui-jqgrid-sortable {color:#1e5edb;}
.form-unit {border-bottom:1px solid #eee;}
.form-unit:before {background-color:#1e5edb;}
.box-main>.box-header {border-bottom-color:#eeeeee;}
.box-main>.box-header .box-title .fa {color:#1e5edb;}
@@ -199,7 +200,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.form-control:focus,.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-search--dropdown .select2-search__field,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {border-color:#557bfa!important;box-shadow:0 0 0 2px rgba(24,80,236,.2);}
.select2-container--default.select2-container--focus .select2-selection--multiple {border-color:#557bfa!important;box-shadow:0 0 0 2px rgba(5, 88, 255, 0.06);}
.table thead tr, .ui-jqgrid-htable thead tr, .ui-jqgrid-hdiv, .ui-jqgrid-hbox {background-color:#f6f6f6;}
.ui-jqgrid .ui-jqgrid-labels th, .ui-jqgrid tr.ui-row-ltr td, .ui-jqgrid tr.ui-row-rtl td, .ui-jqgrid tr.ui-row-ltr td:last-child,
.ui-jqgrid .ui-jqgrid-htable th.ui-th-column-header, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column,

View File

@@ -13,6 +13,26 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
}
.main-header .navbar .nav > li > a {
color: #ffffff;
margin: 4.5px 2px 0;
padding: 10px 13px;
border-radius: 6px;
}
.main-header .navbar .nav > li > a > i {
font-size: 16px;
vertical-align: bottom;
line-height: 20px;
}
.navbar-nav .treeview-menu,
.navbar-nav>.user-menu>.dropdown-menu {
margin-top: 7px;
border-radius: 6px;
}
.navbar-custom-menu>.navbar-nav>li>.dropdown-menu {
margin-top: 5px;
border-radius: 6px;
}
.navbar-nav .treeview-menu a {
border-radius: 6px;
}
.main-header .navbar .nav > li > a:hover,
.main-header .navbar .nav > li > a:active,
@@ -169,7 +189,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
/* 页签添加内边距 */
.content-wrapper, .tabpanel_content, .tabpanel_content .html_content, body {background-color:#f0f2f5;}
.box-main, .nav-main, .ui-layout-pane, iframe {border-radius:5px;}
.tabpanel_content .html_content {padding:13px 14px 13px 15px;}
.tabpanel_content .html_content {padding:12px 14px 12px 15px;}
.tabpanel_tab_content {border-bottom:0;}
.ui-layout-resizer {background:none;}
.content {padding:0!important}
@@ -214,6 +234,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.wup_container .placeholder .webuploader-pick {background-color:#1e5edb!important;border-color:#1e5edb!important;}
.form-unit, th[aria-selected=true] .ui-jqgrid-sortable {color:#1e5edb;}
.form-unit {border-bottom:1px solid #eee;}
.form-unit:before {background-color:#1e5edb;}
.box-main>.box-header {border-bottom-color:#eeeeee;}
.box-main>.box-header .box-title .fa {color:#1e5edb;}
@@ -221,7 +242,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.form-control:focus,.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-search--dropdown .select2-search__field,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {border-color:#557bfa!important;box-shadow:0 0 0 2px rgba(24,80,236,.2);}
.select2-container--default.select2-container--focus .select2-selection--multiple {border-color:#557bfa!important;box-shadow:0 0 0 2px rgba(5, 88, 255, 0.06);}
.table thead tr, .ui-jqgrid-htable thead tr, .ui-jqgrid-hdiv, .ui-jqgrid-hbox {background-color:#fafafa;}
.ui-jqgrid .ui-jqgrid-labels th, .ui-jqgrid tr.ui-row-ltr td, .ui-jqgrid tr.ui-row-rtl td, .ui-jqgrid tr.ui-row-ltr td:last-child,
.ui-jqgrid .ui-jqgrid-htable th.ui-th-column-header, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column,

View File

@@ -167,7 +167,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
/* 页签添加内边距 */
.content-wrapper, .tabpanel_content, .tabpanel_content .html_content, body {background-color:#000;}
.box-main, .nav-main, .ui-layout-pane, iframe {border-radius:5px;}
.tabpanel_content .html_content {padding:13px 14px 13px 15px;}
.tabpanel_content .html_content {padding:12px 14px 12px 15px;}
.tabpanel_tab_content {border-bottom:0;}
.ui-layout-resizer {background:none;}
.content {padding:0!important}
@@ -203,7 +203,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
::-webkit-scrollbar {background:#2a2a2a;}
::-webkit-scrollbar-thumb {background:#6a6a6a;}
.btn-default {background-color:#323232;border-color:#323232;color:#b5b5b5;}
.btn-default {background-color:#323232;border-color:#323232;color:#b5b5b5;} .btn-default i {color:#dfdfdf;}
.btn-default.active, .btn-default:active {background-color:#3e3e3e;border-color:#3e3e3e;color:#dfdfdf;}
.btn-default:hover, .btn-default:active, .btn-default.hover, .btn-default:focus,
.btn-default.active.focus, .btn-default.active:focus, .btn-default.active:hover, .btn-default:active.focus,
@@ -227,6 +227,7 @@ a, a:hover, a:active, a:focus, .form-unit, th[aria-selected=true] .ui-jqgrid-sor
.wup_container .placeholder .webuploader-pick {background-color:#3aa0ff!important;border-color:#3aa0ff!important;}
.form-unit, th[aria-selected=true] .ui-jqgrid-sortable {color:#2975bc;}
.form-unit {border-bottom:1px solid #4e4e4e;}
.form-unit:before {background-color:#2975bc;}
.form-inline .form-more {background-color:#1a1a1a;border-bottom-color:#393939;}
.form-control, .input-group .input-group-addon, input, select, textarea, pre {background-color:#1a1a1a;border-color:#414141!important;color:#ddd}

View File

@@ -435,7 +435,7 @@
},
getNodeTitle: function(setting, node) {
var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title;
return "" + node[t];
return "" + (node[t] || node[setting.data.key.name]);
},
getNodes: function(setting) {
return data.getRoot(setting)[setting.data.key.children];

View File

@@ -434,7 +434,7 @@
},
getNodeTitle: function(setting, node) {
var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title;
return "" + node[t];
return "" + (node[t] || node[setting.data.key.name]);
},
getNodes: function(setting) {
return data.getRoot(setting)[setting.data.key.children];

View File

@@ -14,37 +14,49 @@ import com.jeesite.common.codec.EncodeUtils;
public class EncodeUtilsTest {
public static void main(String[] args) {
EncodeUtils.xssFilter("1 你好 <script>alert(document.cookie)</script>我还在。");
EncodeUtils.xssFilter("2 你好 <strong>加粗文字</strong>我还在。");
EncodeUtils.xssFilter("<!--HTML-->3 你好 \"><strong>加粗文字</strong>我还在。");
EncodeUtils.xssFilter("<!--HTML-->4 你好 <iframe src=\"abcdef\"></iframe><strong>加粗文字</strong>我还在。");
EncodeUtils.xssFilter("<!--HTML-->5 你好 <iframe src=\"abcdef\"/><strong>加粗文字</strong>我还在。");
EncodeUtils.xssFilter("<!--HTML-->6 你好 <iframe src=\"abcdef\"><strong>加粗文字</strong>我还在。");
EncodeUtils.xssFilter("<!--HTML-->7 你好 <script type=\"text/javascript\">alert(document.cookie)</script>我还在。");
EncodeUtils.xssFilter("<!--HTML-->8 你好 <script\n type=\"text/javascript\">\nalert(document.cookie)\n</script>我还在。");
EncodeUtils.xssFilter("<!--HTML-->9 你好 <script src='' onerror='alert(document.cookie)'></script>我还在。");
EncodeUtils.xssFilter("<!--HTML-->10 你好 <script type=text/javascript>alert()我还在。");
EncodeUtils.xssFilter("<!--HTML-->11 你好 <script>alert(document.cookie)</script>我还在。");
EncodeUtils.xssFilter("<!--HTML-->12 你好 <script>window.location='url'我还在。");
EncodeUtils.xssFilter("<!--HTML-->13 你好 </script></iframe>我还在。");
EncodeUtils.xssFilter("<!--HTML-->14 你好 eval(abc)我还在。");
EncodeUtils.xssFilter("<!--HTML-->15 你好 expression(abc)我还在。");
EncodeUtils.xssFilter("<!--HTML-->16 你好 <img src='abc.jpg' onerror='location='';alert(document.cookie);'></img>我还在。");
EncodeUtils.xssFilter("<!--HTML-->17 你好 <img src='abc.jpg' onerror='alert(document.cookie);'/>我还在。");
EncodeUtils.xssFilter("<!--HTML-->18 你好 <img src='abc.jpg' onerror='alert(document.cookie);'>我还在。");
EncodeUtils.xssFilter("<!--HTML-->19 你好 <a onload='alert(\"abc\")'>hello</a>我还在。");
EncodeUtils.xssFilter("<!--HTML-->20 你好 <a href=\"/abc\">hello</a>我还在。");
EncodeUtils.xssFilter("<!--HTML-->21 你好 <a href='/abc'>hello</a>我还在。");
EncodeUtils.xssFilter("<!--HTML-->22 你好 <a href='vbscript:alert(\"abc\");'>hello</a>我还在。");
EncodeUtils.xssFilter("<!--HTML-->23 你好 <a href='javascript:alert(\"abc\");'>hello</a>我还在。");
EncodeUtils.xssFilter("<!--HTML-->24 你好 ?abc=def&hello=123&world={\"a\":1}我还在。");
EncodeUtils.xssFilter("<!--HTML-->25 你好 ?abc=def&hello=123&world={'a':1}我还在。");
EncodeUtils.sqlFilter("1 你好 select * from xxx where abc=def and 1=1我还在。");
EncodeUtils.sqlFilter("2 你好 insert into xxx values(1,2,3,4,5)我还在。");
EncodeUtils.sqlFilter("3 你好 delete from xxx我还在。");
EncodeUtils.sqlFilter("4 a.audit_result asc,case when 1 like case when length(database())=6 then 1 else exp(111) end then 1 else 1/0 end", "orderBy");
EncodeUtils.sqlFilter("5 if(1=2,1,SLEEP(10)), if(mid(database(),{},1)=\\\"{}\\\",a.id,a.login_name)", "orderBy");
EncodeUtils.sqlFilter("6 a.audit_result asc, b.audit_result2 desc, b.AuditResult3 desc", "orderBy");
int i = 0;
xssFilter(i++, "你好 <script>alert(document.cookie)</script>我还在。");
xssFilter(i++, "你好 <strong>加粗文字</strong>我还在。");
xssFilter(i++, "<!--HTML-->你好 \"><strong>加粗文字</strong>我还在。");
xssFilter(i++, "<!--HTML-->你好 <iframe src=\"abcdef\"></iframe><strong>加粗文字</strong>我还在。");
xssFilter(i++, "<!--HTML-->你好 <iframe src=\"abcdef\"/><strong>加粗文字</strong>我还在。");
xssFilter(i++, "<!--HTML-->你好 <iframe src=\"abcdef\"><strong>加粗文字</strong>我还在。");
xssFilter(i++, "<!--HTML-->你好 <script type=\"text/javascript\">alert(document.cookie)</script>我还在。");
xssFilter(i++, "<!--HTML-->你好 <script\n type=\"text/javascript\">\nalert(document.cookie)\n</script>我还在。");
xssFilter(i++, "<!--HTML-->你好 <script src='' onerror='alert(document.cookie)'></script>我还在。");
xssFilter(i++, "<!--HTML-->你好 <script type=text/javascript>alert()我还在。");
xssFilter(i++, "<!--HTML-->你好 <script>alert(document.cookie)</script>我还在。");
xssFilter(i++, "<!--HTML-->你好 <script>window.location='url'我还在。");
xssFilter(i++, "<!--HTML-->你好 </script></iframe>我还在。");
xssFilter(i++, "<!--HTML-->你好 eval(abc)我还在。");
xssFilter(i++, "<!--HTML-->你好 expression(abc)我还在。");
xssFilter(i++, "<!--HTML-->你好 <img src='abc.jpg' onerror='location='';alert(document.cookie);'></img>我还在。");
xssFilter(i++, "<!--HTML-->你好 <img src='abc.jpg' onerror='alert(document.cookie);'/>我还在。");
xssFilter(i++, "<!--HTML-->你好 <img src='abc.jpg' onerror='alert(document.cookie);'>我还在。");
xssFilter(i++, "<!--HTML-->你好 <a onload='alert(\"abc\")'>hello</a>我还在。");
xssFilter(i++, "<!--HTML-->你好 <a href=\"/abc\">hello</a>我还在。");
xssFilter(i++, "<!--HTML-->你好 <a href='/abc'>hello</a>我还在。");
xssFilter(i++, "<!--HTML-->你好 <a href='vbscript:alert(\"abc\");'>hello</a>我还在。");
xssFilter(i++, "<!--HTML-->你好 <a href='javascript:alert(\"abc\");'>hello</a>我还在。");
xssFilter(i++, "<!--HTML-->你好 ?abc=def&hello=123&world={\"a\":1}我还在。");
xssFilter(i++, "<!--HTML-->你好 ?abc=def&hello=123&world={'a':1}我还在。");
xssFilter(i++, "<!--HTML-->\"><svg/ONLOAD=confirm(3) />");
sqlFilter(i++, "你好 select * from xxx where abc=def and 1=1我还在。", "common");
sqlFilter(i++, "你好 insert into xxx values(1,2,3,4,5)我还在。", "common");
sqlFilter(i++, "你好 delete from xxx我还在。", "common");
sqlFilter(i++, "a.audit_result asc,case when 1 like case when length(database())=6 then 1 else exp(111) end then 1 else 1/0 end", "orderBy");
sqlFilter(i++, "if(1=2,1,SLEEP(10)), if(mid(database(),{},1)=\\\"{}\\\",a.id,a.login_name)", "orderBy");
sqlFilter(i++, "a.audit_result asc, b.audit_result2 desc, b.AuditResult3 desc", "orderBy");
}
private static void xssFilter(int num, String text) {
String text2 = EncodeUtils.xssFilter(text);
System.out.println(num + ". " + text + "\t ==> \t" + text2 + "\t ==> \t" + text.equals(text2));
}
private static void sqlFilter(int num, String text, String source) {
String text2 = EncodeUtils.sqlFilter(text, source);
System.out.println(num + ". " + text + "\t ==> \t" + text2 + "\t ==> \t" + text.equals(text2));
}
}

View File

@@ -1,28 +0,0 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
*/
package com.jeesite.test.codec;
import com.jeesite.common.codec.Sha1Utils;
/**
* SHA-1 加密工具类,散列加密,不可逆加密
* @author ThinkGem
* @version 2024-07-22
*/
public class Sha1UtilsTest {
public static void main(String[] args) {
String s = "Hello word! 你好,中文!";
System.out.println(s);
String salt = Sha1Utils.genSaltString(8);
System.out.println(salt);
String data = Sha1Utils.sha1(s, salt);
System.out.println(data);
}
}

View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
*/
package com.jeesite.test.codec;
import com.jeesite.common.codec.ShaUtils;
/**
* SHA-1 加密工具类,散列加密,不可逆加密
* @author ThinkGem
* @version 2024-07-22
*/
public class ShaUtilsTest {
public static final int HASH_ITERATIONS = 1024;
public static final int SALT_SIZE = 8;
public static void main(String[] args) {
String s = "Hello word! 你好,中文!";
System.out.println(s);
String salt = ShaUtils.genSaltString(SALT_SIZE);
System.out.println(salt);
String data = ShaUtils.sha1(s, salt, HASH_ITERATIONS);
System.out.println(data);
String salt2 = ShaUtils.genSaltString(SALT_SIZE);
System.out.println(salt2);
String data2 = ShaUtils.sha256(s, salt2, HASH_ITERATIONS);
System.out.println(data2);
}
}

View File

@@ -18,6 +18,7 @@ public class DateUtilsTest {
public static void main(String[] args) throws ParseException {
System.out.println(DateUtils.formatDate(DateUtils.parseDate("2023/3/6")));
System.out.println(DateUtils.formatDateTime(DateUtils.parseDate("2023-3-6 12:30:15")));
System.out.println(DateUtils.getDate("yyyy年MM月dd日 E"));
long time = new Date().getTime()-DateUtils.parseDate("2023-11-19").getTime();
System.out.println(time/(24*60*60*1000));

View File

@@ -8,6 +8,7 @@ import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.mapper.JsonMapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -30,6 +31,7 @@ public class JsonMapperTest {
map.put("pId", 1);
map.put("name", "你好");
map.put("open", true);
map.put("date", new Date());
list.add(map);
String json = JsonMapper.toJson(list);
System.out.println(json);

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>5.11.0-SNAPSHOT</version>
<version>5.12.1-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

View File

@@ -25,4 +25,7 @@
5.9.2
5.10.0
5.10.1
5.11.0
5.11.0
5.11.1
5.12.0
5.12.1

View File

@@ -8,9 +8,9 @@
<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(hasPermi('app:appComment:edit')){ %>
<a href="${ctx}/app/appComment/form" class="btn btn-default btnTool" title="${text('新增意见')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="${ctx}/app/appComment/form" class="btn btn-primary btnTool" title="${text('新增意见')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
<a href="#" class="btn-setting" id="btnSetting" title="${text('设置')}"><i class="fa icon-settings"></i></a>
</div>
</div>
<div class="box-body">
@@ -82,11 +82,11 @@ $('#dataGrid').dataGrid({
{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('app:appComment:edit')){
actions.push('<a href="${ctx}/app/appComment/form?id='+row.id+'" class="btnList" title="${text("编辑意见")}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/app/appComment/form?id='+row.id+'" class="btnList" title="${text("编辑意见")}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/app/appComment/disable?id='+row.id+'" class="btnList" title="${text("停用意见")}" data-confirm="${text("确认要停用该意见吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/app/appComment/disable?id='+row.id+'" class="btnList" title="${text("停用意见")}" data-confirm="${text("确认要停用该意见吗?")}"><i class="fa icon-ban"></i></a>&nbsp;');
} else if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/app/appComment/enable?id='+row.id+'" class="btnList" title="${text("启用意见")}" data-confirm="${text("确认要启用该意见吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/app/appComment/enable?id='+row.id+'" class="btnList" title="${text("启用意见")}" data-confirm="${text("确认要启用该意见吗?")}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/app/appComment/delete?id='+row.id+'" class="btnList" title="${text("删除意见")}" data-confirm="${text("确认要删除该意见吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
//# }

View File

@@ -8,9 +8,9 @@
<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(hasPermi('app:appUpgrade:edit')){ %>
<a href="${ctx}/app/appUpgrade/form" class="btn btn-default btnTool" title="${text('新增版本')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="${ctx}/app/appUpgrade/form" class="btn btn-primary btnTool" title="${text('新增版本')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
<a href="#" class="btn-setting" id="btnSetting" title="${text('设置')}"><i class="fa icon-settings"></i></a>
</div>
</div>
<div class="box-body">
@@ -82,11 +82,11 @@ $('#dataGrid').dataGrid({
{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('app:appUpgrade:edit')){
actions.push('<a href="${ctx}/app/appUpgrade/form?id='+row.id+'" class="btnList" title="${text("编辑版本")}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/app/appUpgrade/form?id='+row.id+'" class="btnList" title="${text("编辑版本")}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/app/appUpgrade/disable?id='+row.id+'" class="btnList" title="${text("停用版本")}" data-confirm="${text("确认要停用该版本吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/app/appUpgrade/disable?id='+row.id+'" class="btnList" title="${text("停用版本")}" data-confirm="${text("确认要停用该版本吗?")}"><i class="fa icon-ban"></i></a>&nbsp;');
} else if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/app/appUpgrade/enable?id='+row.id+'" class="btnList" title="${text("启用版本")}" data-confirm="${text("确认要启用该版本吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/app/appUpgrade/enable?id='+row.id+'" class="btnList" title="${text("启用版本")}" data-confirm="${text("确认要启用该版本吗?")}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/app/appUpgrade/delete?id='+row.id+'" class="btnList" title="${text("删除版本")}" data-confirm="${text("确认要删除该版本吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
//# }

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>5.11.0-SNAPSHOT</version>
<version>5.12.1-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

View File

@@ -61,7 +61,7 @@ import java.util.Date;
@Column(name = "site_code"),
@Column(name = "site_name"),
})
}, extWhereKeys = "dsfCategory", orderBy = "a.weight DESC, a.update_date DESC"
}, orderBy = "a.weight DESC, a.update_date DESC"
)
public class Article extends DataEntity<Article> {

View File

@@ -28,23 +28,28 @@ import java.util.List;
@Column(name = "category_code", attrName = "categoryCode", label = "栏目编码", isPK = true),
@Column(name = "category_name", attrName = "categoryName", label = "栏目名称", queryType = QueryType.LIKE, isTreeName = true),
@Column(name = "site_code", attrName = "site.siteCode", label = "站点编码", queryType = QueryType.EQ),
@Column(name = "module_type", attrName = "moduleType", label = "模块类型"), @Column(name = "image", attrName = "image", label = "栏目图片"),
@Column(name = "href", attrName = "href", label = "链接"), @Column(name = "target", attrName = "target", label = "目标"),
@Column(name = "keywords", attrName = "keywords", label = "关键字"), @Column(name = "description", attrName = "description", label = "描述"),
@Column(name = "in_menu", attrName = "inMenu", label = "是否在导航中显示"), @Column(name = "in_list", attrName = "inList", label = "是否在分类页中显示列表"),
@Column(name = "module_type", attrName = "moduleType", label = "模块类型"),
@Column(name = "image", attrName = "image", label = "栏目图片"),
@Column(name = "href", attrName = "href", label = "链接"),
@Column(name = "target", attrName = "target", label = "目标"),
@Column(name = "keywords", attrName = "keywords", label = "关键字"),
@Column(name = "description", attrName = "description", label = "描述"),
@Column(name = "in_menu", attrName = "inMenu", label = "是否在导航中显示"),
@Column(name = "in_list", attrName = "inList", label = "是否在分类页中显示列表"),
@Column(name = "show_modes", attrName = "showModes", label = "展现模式"),
@Column(name = "is_need_audit", attrName = "isNeedAudit", label = "是否需要审核"),
@Column(name = "is_can_comment", attrName = "isCanComment", label = "是否允许评论"),
@Column(name = "custom_list_view", attrName = "customListView", label = "自定义列表视图"),
@Column(name = "custom_content_view", attrName = "customContentView", label = "自定义内容视图"),
@Column(name = "view_config", attrName = "viewConfig", label = "视图配置"), @Column(includeEntity = DataEntity.class),
@Column(name = "view_config", attrName = "viewConfig", label = "视图配置"),
@Column(includeEntity = DataEntity.class),
@Column(includeEntity = Extend.class, attrName = "extend"),
}, joinTable = {
@JoinTable(entity = Site.class, alias = "s",
on = "s.site_code = a.site_code", columns = {
@Column(name = "site_name"),
})
}, extWhereKeys = "dsfCategory", orderBy = "a.tree_sorts, a.category_code"
}, orderBy = "a.tree_sorts, a.category_code"
)
public class Category extends TreeEntity<Category> {
@@ -109,6 +114,14 @@ public class Category extends TreeEntity<Category> {
this.categoryCode = categoryCode;
}
public String getCategoryCode_like() {
return sqlMap().getWhere().getValue("category_code", QueryType.LIKE);
}
public void setCategoryCode_like(String categoryCode) {
sqlMap().getWhere().and("category_code", QueryType.LIKE, categoryCode);
}
@NotBlank(message = "栏目名称不能为空")
@Size(min = 0, max = 100, message = "栏目名称长度不能超过 100 个字符")
public String getCategoryName() {

View File

@@ -29,7 +29,7 @@ import java.util.List;
@Column(name = "site_sort", attrName = "siteSort", label = "站点排序号"),
@Column(name = "title", attrName = "title", label = "站点标题", queryType = QueryType.LIKE),
@Column(name = "logo", attrName = "logo", label = "站点Logo"),
@Column(name = "domain_name", attrName = "domain", label = "站点域名"),
@Column(name = "domain_name", attrName = "domain", label = "站点域名", queryType = QueryType.LIKE),
@Column(name = "keywords", attrName = "keywords", label = "关键字"),
@Column(name = "description", attrName = "description", label = "描述"),
@Column(name = "theme", attrName = "theme", label = "主题"),

View File

@@ -4,16 +4,16 @@
*/
package com.jeesite.modules.cms.utils;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import org.springframework.core.io.Resource;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.collect.SetUtils;
import com.jeesite.common.io.ResourceUtils;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.modules.cms.entity.FileTemplete;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Set;
/**
* 模板文件公共类库
@@ -26,7 +26,10 @@ public class FileTempleteUtils {
* 获取模版文件
* @param fileName
*/
public static FileTemplete getFileTempleteByResource(String fileName) throws IOException {
public static FileTemplete getFileTempleteByResource(String fileName) {
if (!StringUtils.startsWith(fileName, "views/modules/cmsfront")) {
fileName = "views/modules/cmsfront/themes/default/index.html";
}
Resource resource = ResourceUtils.getResource(fileName);
return new FileTemplete(resource, fileName);
}

View File

@@ -16,7 +16,6 @@ import com.jeesite.modules.cms.entity.Site;
import com.jeesite.modules.cms.service.CategoryService;
import com.jeesite.modules.cms.service.FileTempleteService;
import com.jeesite.modules.cms.utils.CmsUtils;
import com.jeesite.modules.sys.entity.Office;
import com.jeesite.modules.sys.utils.DictUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -29,6 +28,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -52,10 +52,23 @@ public class CategoryController extends BaseController {
* 获取数据
*/
@ModelAttribute
public Category get(String categoryCode, boolean isNewRecord) {
public Category get(String categoryCode, boolean isNewRecord, HttpServletRequest request) {
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new Category();
}
return categoryService.get(categoryCode, isNewRecord);
}
/**
* 管理主页
*/
@RequiresPermissions("cms:category:view")
@RequestMapping(value = "index")
public String index(Category category, Model model) {
model.addAttribute("category", category);
return "modules/cms/categoryIndex";
}
/**
* 查询列表
*/
@@ -78,17 +91,18 @@ public class CategoryController extends BaseController {
@ResponseBody
public List<Category> listData(Category category) {
if (StringUtils.isBlank(category.getParentCode())) {
category.setParentCode(Office.ROOT_CODE);
category.setParentCode(Category.ROOT_CODE);
}
if (StringUtils.isBlank(category.getSite().getSiteCode())) {
category.setSite(new Site(Site.getCurrentSiteCode()));
}
List<Category> list = null;
if (StringUtils.isNotBlank(category.getCategoryCode())) {
list = ListUtils.newArrayList(get(category.getCategoryCode(), false));
} else {
list = categoryService.findList(category);
if (StringUtils.isNotBlank(category.getCategoryCode())
|| StringUtils.isNotBlank(category.getCategoryCode_like())
|| StringUtils.isNotBlank(category.getCategoryName())
|| StringUtils.isNotBlank(category.getRemarks())) {
category.setParentCode(null);
}
List<Category> list = categoryService.findList(category);
return list;
}
@@ -212,7 +226,7 @@ public class CategoryController extends BaseController {
public String disable(Category category) {
Category where = new Category();
where.setStatus(Category.STATUS_NORMAL);
where.setParentCodes("," + category.getId() + ",");
where.setParentCodes_rightLike(category.getParentCodes() + category.getId() + ",");
long count = categoryService.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该栏目表包含未停用的子栏目表!"));

View File

@@ -12,10 +12,10 @@ IMPORT_PACKAGE_cms=\
#FNP.strutil = org.beetl.ext.fn.StringUtil
##内置的格式化函数
#FT.dateFormat = org.beetl.ext.format.DateFormat
#FT.dateFormat = com.jeesite.common.beetl.ext.format.DateFormat
##内置的默认格式化函数
#FTC.java.util.Date = org.beetl.ext.format.DateFormat
#FTC.java.util.Date = com.jeesite.common.beetl.ext.format.DateFormat
## 标签类
#TAG.include= org.beetl.ext.tag.IncludeTag

View File

@@ -33,4 +33,7 @@
5.9.2
5.10.0
5.10.1
5.11.0
5.11.0
5.11.1
5.12.0
5.12.1

View File

@@ -6,10 +6,10 @@
<i class="fa icon-note"></i> ${text('内容管理')}
</div>
<div class="box-tools pull-right">
<a href="${ctxFront}/index" target="_blank" class="btn btn-default" title="${text('访问站点')}"><i class="fa fa-globe"></i> ${text('访问网站')}</a>
<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
<a href="${ctxFront}/index" target="_blank" class="btn btn-default" title="${text('访问站点')}"><i class="fa fa-globe"></i> ${text('访问网站')}</a>
<% if(hasPermi('cms:article:edit')){ %>
<a href="${ctx}/cms/article/form" onclick="$(this).data('href', this.href+'?category.categoryCode='+$('#categoryCode').val())" class="btn btn-default btnTool" title="${text('新增文章')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="${ctx}/cms/article/form" onclick="$(this).data('href', this.href+'?category.categoryCode='+$('#categoryCode').val())" class="btn btn-primary btnTool" title="${text('新增文章')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
</div>
</div>
@@ -71,12 +71,12 @@ $('#dataGrid').dataGrid({
{header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('cms:article:edit')){
actions.push('<a href="${ctx}/cms/article/form?id='+row.id+'" class="btnList" title="${text("编辑文章")}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/article/form?id='+row.id+'" class="btnList" title="${text("编辑文章")}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/cms/article/disable?id='+row.id+'" class="btnList" title="${text("停用文章")}" data-confirm="${text("确认要停用该文章吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/article/disable?id='+row.id+'" class="btnList" title="${text("停用文章")}" data-confirm="${text("确认要停用该文章吗?")}"><i class="fa icon-ban"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/cms/article/enable?id='+row.id+'" class="btnList" title="${text("启用文章")}" data-confirm="${text("确认要启用该文章吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/article/enable?id='+row.id+'" class="btnList" title="${text("启用文章")}" data-confirm="${text("确认要启用该文章吗?")}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/cms/article/delete?id='+row.id+'" class="btnList" title="${text("删除文章")}" data-confirm="${text("确认要删除该文章吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){

View File

@@ -0,0 +1,78 @@
<% layout('/layouts/default.html', {title: '栏目管理', libs: ['layout','zTree']}){ %>
<div class="ui-layout-west">
<div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-grid"></i> ${text('栏目导航')}
</div>
<div class="box-tools pull-right">
<% if(hasPermi('bpm:bpmCategory:edit')){ %>
<button type="button" class="btn btn-box-tool addTabPage" data-href="${ctx}/cms/category/list" title="${text('栏目管理')}"><i class="fa fa-edit"></i></button>
<% } %>
<button type="button" class="btn btn-box-tool" id="btnExpand" title="${text('展开')}" style="display:none;"><i class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="${text('折叠')}"><i class="fa fa-chevron-down"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="${text('刷新')}"><i class="fa fa-refresh"></i></button>
</div>
</div>
<div class="ui-layout-content">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
</div>
<div class="ui-layout-center">
<iframe id="mainFrame" name="mainFrame" class="ui-layout-content p0"
src="${ctx}/cms/category/list"></iframe>
</div>
<% } %>
<script>
//# // 初始化布局
$('body').layout({
west__initClosed: $(window).width() <= 767, // 是否默认关闭
west__size: 190
});
//# // 主页框架
var win = $("#mainFrame")[0].contentWindow;
//# // 树结构初始化加载
var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}},
async:{enable:true,autoParam:["id=parentCode"],url:"${ctx}/cms/category/treeData"},
callback:{onClick:function(event, treeId, treeNode){
tree.expandNode(treeNode);
//win.$('button[type=reset]').click();
win.$('#categoryCode').val(treeNode.id);
win.page(1);
}}
}, tree, loadTree = function(){
js.ajaxSubmit(setting.async.url+"?___t="+new Date().getTime(), {
parentCode:'${parameter.parentCode!}'}, function(data){
tree = $.fn.zTree.init($("#tree"), setting, data);
var level = -1, nodes;
while (++level <= 1) {
nodes = tree.getNodesByParam("level", level);
if (nodes.length > 10) { break; }
for(var i=0; i<nodes.length; i++) {
tree.expandNode(nodes[i], true, false, false);
}
}
}, null, null, js.text('loading.message'));
};loadTree();
//# // 工具栏按钮绑定
$('#btnExpand').click(function(){
tree.expandAll(true);
$(this).hide();
$('#btnCollapse').show();
});
$('#btnCollapse').click(function(){
tree.expandAll(false);
$(this).hide();
$('#btnExpand').show();
});
$('#btnRefresh').click(function(){
loadTree();
});
//调用子页分页函数
function page(){
win.page();
}
</script>

View File

@@ -24,7 +24,7 @@
<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('cms:category:edit')){ %>
<a href="${ctx}/cms/category/form?site.siteCode=${category.site.siteCode}" class="btn btn-default btnTool" title="${text('栏目添加')}"><i class="fa fa-plus"></i>${text('新增')}</a>
<a href="${ctx}/cms/category/form?site.siteCode=${category.site.siteCode}" class="btn btn-primary btnTool" title="${text('新增栏目')}"><i class="fa fa-plus"></i>${text('新增')}</a>
<% } %>
</div>
</div>
@@ -32,28 +32,35 @@
<#form:form id="searchForm" model="${category}" action="${ctx}/cms/category/listData" method="post" class="form-inline "
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden path="site.siteCode" maxlength="64" class="form-control width-120" />
<#form:hidden path="categoryCode" />
<div class="form-group">
<label class="control-label">${text('栏目名称')}</label>
<label class="control-label">${text('编码')}</label>
<div class="control-inline">
<#form:input path="categoryName" maxlength="100" class="form-control width-120" />
<#form:input path="categoryCode_like" maxlength="100" class="form-control width-90" />
</div>
</div>
<div class="form-group">
<label class="control-label">${text('模块类型')}</label>
<label class="control-label">${text('名称')}</label>
<div class="control-inline">
<#form:input path="moduleType" maxlength="50" class="form-control width-120" />
<#form:input path="categoryName" maxlength="100" class="form-control width-90" />
</div>
</div>
<div class="form-group">
<label class="control-label">${text('模型')}</label>
<div class="control-inline width-90">
<#form:select path="moduleType" dictType="cms_module_type" blankOption="true" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="control-label">${text('状态')}</label>
<div class="control-inline width-120">
<div class="control-inline width-90">
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="control-label">${text('备注信息')}</label>
<label class="control-label">${text('备注')}</label>
<div class="control-inline">
<#form:input path="remarks" maxlength="500" class="form-control width-120" />
<#form:input path="remarks" maxlength="500" class="form-control width-90" />
</div>
</div>
<div class="form-group">
@@ -74,31 +81,40 @@ $('#dataGrid').dataGrid({
{header:'${text("名称")}', name:'categoryName', index:'a.category_name', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '( '+row.categoryCode+' ) '+'<a href="${ctx}/cms/category/form?categoryCode='+row.categoryCode+'" class="btnList" data-title="${text("编辑栏目表")}">'+(val||row.id)+'</a>';
}},
{header:'${text("模型")}', name:'moduleType', index:'a.module_type', width:100, align:"center"},
{header:'${text("排序")}', name:'treeSort', index:'a.tree_sort', width:50, align:"center"},
{header:'${text("模型")}', name:'moduleType', index:'a.module_type', width:100, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel("#{@DictUtils.getDictListJson('cms_module_type')}", val, '未知', true);
}},
{header:'${text("排序")}', name:'treeSort', index:'a.tree_sort', width:60, align:"center"},
{header:'${text("导航栏目")}', name:'inMenu', index:'a.in_menu', width:80, fixed:true, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_show_hide')}", val, '未知', true);
}},
{header:'${text("栏目列表")}', name:'inList', index:'a.in_list', width:80, fixed:true, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_show_hide')}", val, '未知', true);
}},
{header:'${text("展现方式")}', name:'showModes', index:'a.show_modes', width:150, fixed:true, align:"center", formatter: function(val, obj, row, act){
{header:'${text("展现方式")}', name:'showModes', index:'a.show_modes', width:90, fixed:true, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel("#{@DictUtils.getDictListJson('cms_show_modes')}", val, '未知', true);
}},
{header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
{header:'${text("状态")}', name:'status', index:'a.status', width:90, fixed:true, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_status')}", val, '未知', true);
}},
{header:'${text("备注")}', name:'remarks', index:'a.remarks', width:100, align:"left"},
{header:'${text("操作")}', name:'actions', width:210, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('cms:category:edit')){
actions.push('<a href="${ctx}/cms/category/form?categoryCode='+row.categoryCode+'" class="btnList" title="${text("编辑栏目表")}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/category/form?categoryCode='+row.categoryCode+'" class="btnList" title="${text("编辑栏目表")}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/cms/category/disable?categoryCode='+row.categoryCode+'" class="btnList" title="${text("停用栏目表")}" data-confirm="${text("确认要停用该栏目表吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/category/disable?categoryCode='+row.categoryCode+'" class="btnList" title="${text("停用栏目表")}" data-confirm="${text("确认要停用该栏目表吗?")}"><i class="fa icon-ban"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/cms/category/enable?categoryCode='+row.categoryCode+'" class="btnList" title="${text("启用栏目表")}" data-confirm="${text("确认要启用该栏目表吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/category/enable?categoryCode='+row.categoryCode+'" class="btnList" title="${text("启用栏目表")}" data-confirm="${text("确认要启用该栏目表吗?")}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/cms/category/delete?categoryCode='+row.categoryCode+'" class="btnList" title="${text("删除栏目表")}" data-confirm="${text("确认要删除该栏目表及所有子栏目表吗?")}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/category/form?parentCode='+row.id+'&site.siteCode=${category.site.siteCode}" class="btnList" title="${text("新增下级栏目表")}"><i class="fa fa-plus-square"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/category/form?parentCode='+row.id+'&site.siteCode=${category.site.siteCode}" class="btnList" title="${text("新增下级栏目表")}"><i class="fa icon-plus"></i></a>&nbsp;');
//# if(hasPermi('cms:category:rebuildIndex')){
actions.push('<a href="${ctx}/cms/category/rebuildIndex?categoryCode='+row.categoryCode+'" class="btnList" title="${text("重建该栏目索引")}" data-confirm="${text("确认重建该栏目文章索引吗")}"><i class="fa fa-crosshairs"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/category/rebuildIndex?categoryCode='+row.categoryCode+'" class="btnList" title="${text("重建该栏目索引")}" data-confirm="${text("确认重建该栏目文章索引吗")}"><i class="fa fa-crosshairs"></i></a>&nbsp;');
//# }
//# if(hasPermi('cms:category:rebuildVectorStore')){
actions.push('<a href="${ctx}/cms/category/rebuildVectorStore?categoryCode='+row.categoryCode+'" class="btnList" title="${text("重建该栏目向量数据库")}" data-confirm="${text("确认重建该栏目文章向量数据库吗")}"><i class="fa fa-database"></i></a>&nbsp;');
//# }
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctxFront}/list-'+row.categoryCode+'" target="_blank" title="${text("访问栏目")}"><i class="fa fa-globe"></i></a>&nbsp;');
@@ -109,10 +125,13 @@ $('#dataGrid').dataGrid({
],
treeGrid: true, // 启用树结构表格
defaultExpandLevel: 0, // 默认展开的层次
expandNodeClearPostData: 'categoryName,siteCode,moduleType,image,href,target,keywords,description,inMenu,inList,showModes,isNeedAudit,isCanComment,customListView,customContentView,viewConfig,status,remarks,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据)
expandNodeClearPostData: 'categoryCode,categoryName,siteCode,moduleType,image,href,target,keywords,description,inMenu,inList,showModes,isNeedAudit,isCanComment,customListView,customContentView,viewConfig,status,remarks,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据)
//# // 加载成功后执行事件
ajaxSuccess: function(data){
if ($('#categoryCode').val() != ''){
$('#categoryCode').val('');
$('#btnExpandTreeNode').click();
}
}
});
</script>

View File

@@ -58,13 +58,13 @@ var setting = {
&& ((src.indexOf("article") > 0 && adminUrl.indexOf("article") > 0)
|| (src.indexOf("link") > 0 && adminUrl.indexOf("link") > 0))){
var win = ifr[0].contentWindow, conts = ifr.contents();
conts.find('input[type=reset]').click();
//conts.find('input[type=reset]').click();
conts.find('#categoryCode').val(treeNode.id);
conts.find('#outline').val(adminUrl.indexOf("outline=true") != -1); // 文章模型是否显示大纲视图
conts.find('#fileDown').val(adminUrl.indexOf("fileDown=true") != -1); // 链接模型是否是下载栏目
var caption = conts.find('.portlet-title .caption');
caption.html(caption.find('i').prop("outerHTML") + " " + treeNode.name);
win.page();
win.page(1);
}else{
$('#mainFrame').attr("src", adminUrl);
}

View File

@@ -8,7 +8,7 @@
<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(hasPermi('cms:comment:edit')){ %>
<a href="${ctx}/cms/comment/form" class="btn btn-default btnTool" title="${text('新增文章评论表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="${ctx}/cms/comment/form" class="btn btn-primary btnTool" title="${text('新增文章评论表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
</div>
</div>
@@ -130,12 +130,12 @@ $('#dataGrid').dataGrid({
{header:'${text('操作')}', name:'actions', width:120, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('cms:comment:edit')){
actions.push('<a href="${ctx}/cms/comment/form?id='+row.id+'" class="btnList" title="${text('编辑文章评论表')}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/comment/form?id='+row.id+'" class="btnList" title="${text('编辑文章评论表')}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/cms/comment/disable?id='+row.id+'" class="btnList" title="${text('停用文章评论表')}" data-confirm="${text('确认要停用该文章评论表吗')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/comment/disable?id='+row.id+'" class="btnList" title="${text('停用文章评论表')}" data-confirm="${text('确认要停用该文章评论表吗')}"><i class="fa icon-ban"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/cms/comment/enable?id='+row.id+'" class="btnList" title="${text('启用文章评论表')}" data-confirm="${text('确认要启用该文章评论表吗')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/comment/enable?id='+row.id+'" class="btnList" title="${text('启用文章评论表')}" data-confirm="${text('确认要启用该文章评论表吗')}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/cms/comment/delete?id='+row.id+'" class="btnList" title="${text('删除文章评论表')}" data-confirm="${text('确认要删除该文章评论表吗')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
//# }

View File

@@ -8,7 +8,7 @@
<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(hasPermi('cms:report:edit')){ %>
<a href="${ctx}/cms/report/form" class="btn btn-default btnTool" title="${text('新增内容举报表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="${ctx}/cms/report/form" class="btn btn-primary btnTool" title="${text('新增内容举报表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
</div>
</div>
@@ -71,12 +71,12 @@ $('#dataGrid').dataGrid({
{header:'${text('操作')}', name:'actions', width:120, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('cms:report:edit')){
actions.push('<a href="${ctx}/cms/report/form?id='+row.id+'" class="btnList" title="${text('编辑内容举报表')}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/report/form?id='+row.id+'" class="btnList" title="${text('编辑内容举报表')}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/cms/report/disable?id='+row.id+'" class="btnList" title="${text('停用内容举报表')}" data-confirm="${text('确认要停用该内容举报表吗')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/report/disable?id='+row.id+'" class="btnList" title="${text('停用内容举报表')}" data-confirm="${text('确认要停用该内容举报表吗')}"><i class="fa icon-ban"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/cms/report/enable?id='+row.id+'" class="btnList" title="${text('启用内容举报表')}" data-confirm="${text('确认要启用该内容举报表吗')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/report/enable?id='+row.id+'" class="btnList" title="${text('启用内容举报表')}" data-confirm="${text('确认要启用该内容举报表吗')}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/cms/report/delete?id='+row.id+'" class="btnList" title="${text('删除内容举报表')}" data-confirm="${text('确认要删除该内容举报表吗')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
//# }

View File

@@ -8,7 +8,7 @@
<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(hasPermi('cms:site:edit')){ %>
<a href="${ctx}/cms/site/form" class="btn btn-default btnTool" title="${text('新增站点')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="${ctx}/cms/site/form" class="btn btn-primary btnTool" title="${text('新增站点')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
</div>
</div>
@@ -67,20 +67,23 @@ $('#dataGrid').dataGrid({
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_search_status')}", val, '${text("未知")}', true);
}},
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
{header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
{header:'${text("操作")}', name:'actions', width:183, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('cms:site:edit')){
actions.push('<a href="${ctx}/cms/site/form?siteCode='+row.siteCode+'" class="btnList" title="${text("编辑站点")}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/site/form?siteCode='+row.siteCode+'" class="btnList" title="${text("编辑站点")}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/cms/site/disable?siteCode='+row.siteCode+'" class="btnList" title="${text("停用站点")}" data-confirm="${text("确认要停用该站点吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/site/disable?siteCode='+row.siteCode+'" class="btnList" title="${text("停用站点")}" data-confirm="${text("确认要停用该站点吗?")}"><i class="fa icon-ban"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/cms/site/enable?siteCode='+row.siteCode+'" class="btnList" title="${text("启用站点")}" data-confirm="${text("确认要启用该站点吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/site/enable?siteCode='+row.siteCode+'" class="btnList" title="${text("启用站点")}" data-confirm="${text("确认要启用该站点吗?")}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/cms/site/delete?siteCode='+row.siteCode+'" class="btnList" title="${text("删除站点")}" data-confirm="${text("确认要删除该站点吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
//# if(hasPermi('cms:site:rebuildIndex')){
actions.push('<a href="${ctx}/cms/site/rebuildIndex?siteCode='+row.siteCode+'" class="btnList" title="${text("重建该站点索引")}" data-confirm="${text("确认重建该站点文章索引吗")}"><i class="fa fa-crosshairs"></i></a>&nbsp;');
//# }
//# if(hasPermi('cms:site:rebuildVectorStore')){
actions.push('<a href="${ctx}/cms/site/rebuildVectorStore?siteCode='+row.siteCode+'" class="btnList" title="${text("重建该站点向量数据库")}" data-confirm="${text("确认重建该站点文章向量数据库吗")}"><i class="fa fa-database"></i></a>&nbsp;');
//# }
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctxFront}/index-'+row.siteCode+'" target="_blank" title="${text("访问站点")}"><i class="fa fa-globe"></i></a>&nbsp;');
}

View File

@@ -8,7 +8,7 @@
<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(hasPermi('cms:visitLog:edit')){ %>
<a href="${ctx}/cms/visitLog/form" class="btn btn-default btnTool" title="${text('新增访问日志表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="${ctx}/cms/visitLog/form" class="btn btn-primary btnTool" title="${text('新增访问日志表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %> -->
</div>
</div>
@@ -92,12 +92,12 @@ $('#dataGrid').dataGrid({
{header:'${text('操作')}', name:'actions', width:120, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('cms:visitLog:edit')){
actions.push('<a href="${ctx}/cms/visitLog/form?id='+row.id+'" class="btnList" title="${text('编辑访问日志表')}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/visitLog/form?id='+row.id+'" class="btnList" title="${text('编辑访问日志表')}"><i class="fa icon-note"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/cms/visitLog/disable?id='+row.id+'" class="btnList" title="${text('停用访问日志表')}" data-confirm="${text('确认要停用该访问日志表吗')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/visitLog/disable?id='+row.id+'" class="btnList" title="${text('停用访问日志表')}" data-confirm="${text('确认要停用该访问日志表吗')}"><i class="fa icon-ban"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/cms/visitLog/enable?id='+row.id+'" class="btnList" title="${text('启用访问日志表')}" data-confirm="${text('确认要启用该访问日志表吗')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/visitLog/enable?id='+row.id+'" class="btnList" title="${text('启用访问日志表')}" data-confirm="${text('确认要启用该访问日志表吗')}"><i class="fa icon-check"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/cms/visitLog/delete?id='+row.id+'" class="btnList" title="${text('删除访问日志表')}" data-confirm="${text('确认要删除该访问日志表吗')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
//# }

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>5.11.0-SNAPSHOT</version>
<version>5.12.1-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
@@ -30,19 +30,19 @@
<scope>runtime</scope>
</dependency>
<!-- Oracle 11g -->
<!-- Oracle 11g
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
<scope>runtime</scope>
</dependency>
<!-- Oracle 12c 及以上版本
</dependency> -->
<!-- Oracle 12c 及以上版本 -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency> -->
</dependency>
<!-- SqlServer 2008
<dependency>
@@ -71,19 +71,21 @@
<scope>runtime</scope>
</dependency> -->
<!-- 达梦数据库
<!-- 达梦数据库 -->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>Dm8JdbcDriver18</artifactId>
<version>8.1.1.49</version>
</dependency> -->
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.3.62</version>
<scope>runtime</scope>
</dependency>
<!-- 人大金仓数据库
<!-- 人大金仓数据库 -->
<dependency>
<groupId>com.kingbase</groupId>
<artifactId>kingbasejdbc8</artifactId>
<version>8.6.0</version>
</dependency> -->
<groupId>cn.com.kingbase</groupId>
<artifactId>kingbase8</artifactId>
<version>8.6.1</version>
<scope>runtime</scope>
</dependency>
<!-- Web Server -->
<dependency>

View File

@@ -58,6 +58,7 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
public static final Boolean POST_ROLE_PERMI = Global.getConfigToBoolean("user.postRolePermi", "false");
public static final Boolean SWITCH_OFFICE = Global.getConfigToBoolean("user.switchOffice", "false");
public static final Boolean LOGIN_AFTER_ACTIVE_MAIN_OFFICE = Global.getConfigToBoolean("user.loginAfterActiveMainOffice", "false");
private static final Logger logger = LoggerFactory.getLogger(FormFilter.class);
@@ -430,6 +431,8 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
data.put("company", Global.getProperty("companyName"));
data.put("version", Global.getProperty("productVersion"));
data.put("year", Global.getProperty("copyrightYear"));
data.put("lang", Global.getLang(request));
data.put("timeZone", Global.getTimeZone(request));
}
/**
@@ -457,7 +460,8 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
data.put("company", Global.getProperty("companyName"));
data.put("version", Global.getProperty("productVersion"));
data.put("year", Global.getProperty("copyrightYear"));
data.put("lang", Global.getLang());
data.put("lang", Global.getLang(request));
data.put("timeZone", Global.getTimeZone(request));
List<Map<String, Object>> roleList = ListUtils.newArrayList();
String desktopUrl = null; String roleCode = (String)session.getAttribute("roleCode");
Set<String> roleCodes = roleCode != null ? SetUtils.newHashSet(StringUtils.splitComma(roleCode)) : null;
@@ -497,7 +501,9 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
}
if (SWITCH_OFFICE && User.USER_TYPE_EMPLOYEE.equals(user.getUserType())) {
data.put("switchOffice", "true");
data.put("officeCode", session.getAttribute("officeCode"));
// 登录后指定当前部门,即当前部门权限,否则为混合权限
data.put("officeCode", LOGIN_AFTER_ACTIVE_MAIN_OFFICE ? EmpUtils.getCurrentOfficeCode()
: session.getAttribute("officeCode"));
data.put("officeName", EmpUtils.getCurrentOfficeName());
}
data.put("desktopUrl", desktopUrl != null ? desktopUrl : Global.getConfig("sys.index.desktopUrl"));

View File

@@ -6,7 +6,7 @@ package com.jeesite.common.shiro.realm;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.codec.SM3Utils;
import com.jeesite.common.codec.Sha1Utils;
import com.jeesite.common.codec.ShaUtils;
import com.jeesite.common.config.Global;
import com.jeesite.common.shiro.authc.FormToken;
import com.jeesite.common.utils.SpringUtils;
@@ -31,7 +31,6 @@ import javax.servlet.http.HttpServletRequest;
*/
public class AuthorizingRealm extends BaseAuthorizingRealm {
public static final String HASH_ALGORITHM = "SHA-1";
public static final int HASH_ITERATIONS = 1024;
public static final int SALT_SIZE = 8;
@@ -89,7 +88,7 @@ public class AuthorizingRealm extends BaseAuthorizingRealm {
String data = SM3Utils.sm3(plain, salt, HASH_ITERATIONS);
return salt + data;
}
String data = Sha1Utils.sha1(plain, salt, HASH_ITERATIONS);
String data = ShaUtils.sha1(plain, salt, HASH_ITERATIONS);
return salt + data;
}
@@ -108,7 +107,7 @@ public class AuthorizingRealm extends BaseAuthorizingRealm {
String data = SM3Utils.sm3(plain, salt, HASH_ITERATIONS);
return password.equals(salt + data);
}
String data = Sha1Utils.sha1(plain, salt, HASH_ITERATIONS);
String data = ShaUtils.sha1(plain, salt, HASH_ITERATIONS);
return password.equals(salt + data);
}catch(Exception e){
return false;

View File

@@ -72,13 +72,14 @@ public class ActionEnter {
state = new Uploader(request, conf).doExec();
break;
case ActionMap.CATCH_IMAGE:
if (Global.isDemoMode()) {
state = new BaseState(false, "演示模式,不允许操作!");
break;
}
conf = configManager.getConfig(actionCode);
String[] list = this.request.getParameterValues((String) conf.get("fieldName"));
state = new ImageHunter(request, conf).capture(list);
// if (Global.isDemoMode()) {
// state = new BaseState(false, "演示模式,不允许操作!");
// break;
// }
// conf = configManager.getConfig(actionCode);
// String[] list = this.request.getParameterValues((String) conf.get("fieldName"));
// state = new ImageHunter(request, conf).capture(list);
state = new BaseState(false, "该功能暂不提供支持");
break;
case ActionMap.LIST_IMAGE:
case ActionMap.LIST_FILE:

View File

@@ -71,6 +71,14 @@ public class BizCategory extends TreeEntity<BizCategory> {
this.viewCode = viewCode;
}
public String getViewCode_like() {
return sqlMap().getWhere().getValue("view_code", QueryType.LIKE);
}
public void setViewCode_like(String viewCode) {
sqlMap().getWhere().and("view_code", QueryType.LIKE, viewCode);
}
@NotBlank(message="分类名称不能为空")
@Size(min=0, max=64, message="分类名称长度不能超过 64 个字符")
public String getCategoryName() {

View File

@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@@ -43,7 +44,10 @@ public class BizCategoryController extends BaseController {
* 获取数据
*/
@ModelAttribute
public BizCategory get(String categoryCode, boolean isNewRecord) {
public BizCategory get(String categoryCode, boolean isNewRecord, HttpServletRequest request) {
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new BizCategory();
}
return bizCategoryService.get(categoryCode, isNewRecord);
}
@@ -77,13 +81,11 @@ public class BizCategoryController extends BaseController {
if (StringUtils.isBlank(bizCategory.getParentCode())) {
bizCategory.setParentCode(BizCategory.ROOT_CODE);
}
if (StringUtils.isNotBlank(bizCategory.getViewCode())) {
bizCategory.setParentCode(null);
}
if (StringUtils.isNotBlank(bizCategory.getCategoryName())){
bizCategory.setParentCode(null);
}
if (StringUtils.isNotBlank(bizCategory.getRemarks())){
if (StringUtils.isNotBlank(bizCategory.getCategoryCode())
|| StringUtils.isNotBlank(bizCategory.getViewCode())
|| StringUtils.isNotBlank(bizCategory.getViewCode_like())
|| StringUtils.isNotBlank(bizCategory.getCategoryName())
|| StringUtils.isNotBlank(bizCategory.getRemarks())){
bizCategory.setParentCode(null);
}
List<BizCategory> list = bizCategoryService.findList(bizCategory);
@@ -151,7 +153,7 @@ public class BizCategoryController extends BaseController {
public String disable(BizCategory bizCategory) {
BizCategory where = new BizCategory();
where.setStatus(BizCategory.STATUS_NORMAL);
where.setParentCodes("," + bizCategory.getId() + ",");
where.setParentCodes_rightLike(bizCategory.getParentCodes() + bizCategory.getId() + ",");
long count = bizCategoryService.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该业务分类包含未停用的子业务分类!"));

View File

@@ -1,51 +0,0 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
*/
package com.jeesite.modules.config.server;
import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
/**
* 将请求协议转换为 https
* @author ThinkGem
* @version 2020年1月21日
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name="server.schemeHttps", havingValue="true", matchIfMissing=false)
public class SchemeHttpsConfig {
@Bean
public FilterRegistrationBean<Filter> schemeHttpsFilter() {
FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<>();
bean.setName("schemeHttpsFilter");
bean.setFilter((request, response, chain) -> {
chain.doFilter(new HttpServletRequestWrapper((HttpServletRequest) request) {
@Override
public String getScheme() {
return "https";
}
@Override
public StringBuffer getRequestURL() {
StringBuffer sb = super.getRequestURL();
if ("http:".equals(sb.substring(0, 5))){
return sb.replace(0, 5, "https:");
}else{
return sb;
}
}
}, response);
});
bean.addUrlPatterns("/*");
return bean;
}
}

View File

@@ -6,11 +6,13 @@ package com.jeesite.modules.config.web;
import com.jeesite.common.config.Global;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.utils.LocaleUtils;
import com.jeesite.common.web.http.ServletUtils;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.LocaleContextResolver;
import javax.servlet.Filter;
import javax.servlet.ServletRequest;
@@ -28,7 +30,7 @@ public class IpAddrFilterConfig {
private static String[] denyPrefixes;
@Bean
public FilterRegistrationBean<Filter> ipAddrFilter() {
public FilterRegistrationBean<Filter> ipAddrFilter(LocaleContextResolver localeResolver) {
FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<>();
bean.setName("ipAddrFilter");
bean.setOrder(Ordered.HIGHEST_PRECEDENCE + 10);
@@ -40,7 +42,9 @@ public class IpAddrFilterConfig {
response.setStatus(403);
ServletUtils.renderString(response, Global.getText("访问拒绝"));
}
LocaleUtils.removeTimeZoneAwareLocaleContext();
});
LocaleUtils.setLocaleResolver(localeResolver);
bean.addUrlPatterns("/*");
return bean;
}

View File

@@ -0,0 +1,82 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
*/
package com.jeesite.modules.file.web;
import com.jeesite.common.config.Global;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.file.entity.FileUpload;
import com.jeesite.modules.file.entity.FileUploadParams;
import com.jeesite.modules.file.utils.FileUploadUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.Map;
/**
* Vditor Controller
* @author ThinkGem
* @version 2025-04-09
*/
@Controller
@RequestMapping(value = "${adminPath}/file/vditor")
@ConditionalOnProperty(name={"file.enabled","web.core.enabled"}, havingValue="true", matchIfMissing=true)
public class VditorController extends BaseController {
@RequestMapping(value = "upload")
@ResponseBody
public Map<String, Object> upload(MultipartFile[] files, String md5s, String bizKey, String bizType, String updateType) {
Map<String, Object> result = new HashMap<>();
result.put("code", 0);
if (files == null || files.length == 0 || StringUtils.isAnyBlank(md5s, bizKey, bizType)) {
result.put("msg", text("上传的文件不能为空"));
return result;
}
String[] fileMd5s = StringUtils.splitComma(md5s);
if (fileMd5s.length != files.length) {
result.put("msg", text("文件校验码与文件的长度不等"));
return result;
}
Map<String, Object> data = new HashMap<>();
Map<String, String> succMap = new HashMap<>();
Map<String, String> errFiles = new HashMap<>();
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
FileUploadParams params = new FileUploadParams();
params.setFileMd5(fileMd5s[i]);
params.setFileName(file.getOriginalFilename());
params.setBizKey(bizKey);
params.setBizType(bizType);
params.setUploadType(updateType);
params.setFile(file);
Map<String, Object> res = FileUploadUtils.saveFileUpload(params);
if (Global.FALSE.equals(res.get("result"))) {
errFiles.put(params.getFileName(), (String)res.get("message"));
} else {
FileUpload fileUpload = (FileUpload)res.get("fileUpload");
succMap.put(params.getFileName(), Global.getCtxPath() + fileUpload.getFileUrl());
}
}
if (!errFiles.isEmpty()) {
result.put("code", 1);
if (errFiles.size() == files.length) {
result.put("msg", StringUtils.join(errFiles.values(), "; "));
} else {
result.put("msg", text("部分上传失败:") + StringUtils.join(errFiles.values(), "; "));
}
data.put("errFiles", errFiles.keySet());
} else {
result.put("msg", text("上传的文件成功"));
data.put("succMap", succMap);
}
result.put("data", data);
return result;
}
}

View File

@@ -4,15 +4,15 @@
*/
package com.jeesite.modules.sys.entity;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.jeesite.common.entity.DataEntity;
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;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 行政区划Entity
* @author ThinkGem
@@ -59,6 +59,14 @@ public class Area extends TreeEntity<Area> {
this.areaCode = areaCode;
}
public String getAreaCode_like() {
return sqlMap().getWhere().getValue("area_code", QueryType.LIKE);
}
public void setAreaCode_like(String areaCode) {
sqlMap().getWhere().and("area_code", QueryType.LIKE, areaCode);
}
@NotBlank(message="名称不能为空")
@Size(min=0, max=100, message="名称长度不能超过 100 个字符")
public String getAreaName() {

View File

@@ -45,7 +45,7 @@ import java.util.List;
@Column(name="area_type", label="区域类型"),
@Column(name="tree_names", label="区域全称"),
}),
}, extWhereKeys="dsf", orderBy="a.tree_sorts, a.company_code"
}, orderBy="a.tree_sorts, a.company_code"
)
public class Company extends TreeEntity<Company> {

View File

@@ -81,9 +81,6 @@ import javax.validation.Valid;
// @Column(name="user_name", attrName="createByName", label="用户名称", isQuery=false),
// }),
},
// extFromKeys="dsfOfficeFrom, dsfCompanyFrom",
// extWhereKeys="dsfOfficeWhere, dsfCompanyWhere",
extWhereKeys="dsfOffice, dsfCompany",
orderBy="a.user_weight DESC, a.update_date DESC"
)
public class EmpUser extends User {

View File

@@ -42,7 +42,7 @@ import javax.validation.constraints.Size;
@Column(name="zip_code", attrName="zipCode", label="邮政编码", queryType=QueryType.LIKE),
@Column(name="email", attrName="email", label="邮箱", queryType=QueryType.LIKE),
@Column(includeEntity=Extend.class, attrName="extend"),
}, extWhereKeys="dsf", orderBy="a.tree_sorts, a.office_code"
}, orderBy="a.tree_sorts, a.office_code"
)
public class Office extends TreeEntity<Office> {
@@ -64,7 +64,7 @@ public class Office extends TreeEntity<Office> {
@ExcelFields({
@ExcelField(title="上级编码", attrName="parentCode", align=Align.LEFT, sort=10),
@ExcelField(title="机构编码", attrName="officeCode", align=Align.LEFT, sort=20),
@ExcelField(title="显示编", attrName="viewCode", align = Align.LEFT, sort=30),
@ExcelField(title="机构代", attrName="viewCode", align = Align.LEFT, sort=30),
@ExcelField(title="机构名称", attrName="officeName", align=Align.LEFT, sort=40),
@ExcelField(title="机构全称", attrName="fullName", align=Align.LEFT, sort=50),
@ExcelField(title="机构类型", attrName="officeType", align=Align.CENTER, sort=60, dictType="sys_office_type"),

View File

@@ -5,6 +5,7 @@
package com.jeesite.modules.sys.web;
import com.jeesite.common.codec.DesUtils;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.config.Global;
@@ -549,39 +550,39 @@ public class AccountController extends BaseController{
* 发送邮件验证码
*/
private String sendEmailValidCode(User user, String code, String title, Map<String, Object> data){
String account = user.getEmail();
String email = user.getEmail();
try {
title = text("{0}{1}{2}验证码", user.getUserName(), user.getLoginCode(), title);
String content = text("尊敬的用户,您好!\n\n您的验证码是{0}(请勿透露给其他人)\n\n"
+ "请复制后,填写在你的验证码窗口完成验证。\n\n本邮件由系统自动发出请勿回复。\n\n感谢您的使用", code);
// String receiveUserCode = "[CODE]"+account;
// String receiveUserCode = "[CODE]"+email;
// MsgPushUtils.push(MsgPush.TYPE_EMAIL, title, content, null, null, receiveUserCode);
EmailUtils.send(account, title, content);
EmailUtils.send(email, title, content);
} catch (Exception e) {
logger.error(title + "发送邮件错误。", e);
return renderResult(Global.FALSE, text("系统出现了点问题,错误信息:{0}", e.getMessage()));
}
account = account.replaceAll("([\\w\\W]?)([\\w\\W]+)([\\w\\W])(@[\\w\\W]+)", "$1****$3$4");
return renderResult(Global.TRUE, text("验证码已发送到“{0}”邮箱账号,请尽快查收!", account), data);
email = EncodeUtils.emailMask(email);
return renderResult(Global.TRUE, text("验证码已发送到“{0}”邮箱账号,请尽快查收!", email), data);
}
/**
* 发送短信验证码
*/
private String sendSmsValidCode(User user, String code, String title, Map<String, Object> data){
String account = user.getMobile();
String mobile = user.getMobile();
try {
title = text("{0}{1}{2}验证码", user.getUserName(), user.getLoginCode(), title);
String content = text("您好,您的验证码是:{0}(请勿透露给其他人)感谢您的使用。", code);
// String receiveUserCode = "[CODE]"+account;
// String receiveUserCode = "[CODE]"+mobile;
// MsgPushUtils.push(MsgPush.TYPE_SMS, title, content, null, null, receiveUserCode);
SmsUtils.send(content, account);
SmsUtils.send(content, mobile);
} catch (Exception e) {
logger.error(title + "发送短信错误。", e);
return renderResult(Global.FALSE, text("系统出现了点问题,错误信息:{0}", e.getMessage()));
}
account = account.replaceAll("(\\d{3})(\\d+)(\\d{3})","$1****$3");
return renderResult(Global.TRUE, text("验证码已发送到“{0}”的手机号码,请尽快查收!", account), data);
mobile = EncodeUtils.mobileMask(mobile);
return renderResult(Global.TRUE, text("验证码已发送到“{0}”的手机号码,请尽快查收!", mobile), data);
}
}

View File

@@ -49,7 +49,10 @@ public class AreaController extends BaseController {
* 获取区域
*/
@ModelAttribute
public Area get(String areaCode, boolean isNewRecord) {
public Area get(String areaCode, boolean isNewRecord, HttpServletRequest request) {
if (StringUtils.endsWithAny(request.getRequestURI(), "listData", "listPageData")) {
return new Area();
}
return areaService.get(areaCode, isNewRecord);
}
@@ -173,7 +176,7 @@ public class AreaController extends BaseController {
public String disable(Area area) {
Area where = new Area();
where.setStatus(Area.STATUS_NORMAL);
where.setParentCodes("," + area.getId() + ",");
where.setParentCodes_rightLike(area.getParentCodes() + area.getId() + ",");
long count = areaService.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该区域包含未停用的子区域!"));

View File

@@ -54,7 +54,10 @@ public class CompanyController extends BaseController {
* 获取公司
*/
@ModelAttribute
public Company get(String companyCode, boolean isNewRecord) {
public Company get(String companyCode, boolean isNewRecord, HttpServletRequest request) {
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new Company();
}
return companyService.get(companyCode, isNewRecord);
}
@@ -92,7 +95,9 @@ public class CompanyController extends BaseController {
if (StringUtils.isBlank(company.getParentCode())) {
company.setParentCode(Company.ROOT_CODE);
}
if (StringUtils.isNotBlank(company.getViewCode())
if (StringUtils.isNotBlank(company.getCompanyCode())
|| StringUtils.isNotBlank(company.getViewCode())
|| StringUtils.isNotBlank(company.getViewCode_like())
|| StringUtils.isNotBlank(company.getCompanyName())
|| StringUtils.isNotBlank(company.getFullName())){
company.setParentCode(null);
@@ -180,7 +185,7 @@ public class CompanyController extends BaseController {
public String disable(Company company) {
Company where = new Company();
where.setStatus(Company.STATUS_NORMAL);
where.setParentCodes("," + company.getId() + ",");
where.setParentCodes_rightLike(company.getParentCodes() + company.getId() + ",");
long count = companyService.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该公司包含未停用的子公司!"));

View File

@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* 字典管理Controller
* @author ThinkGem
@@ -51,7 +52,10 @@ public class DictDataController extends BaseController {
* 获取数据
*/
@ModelAttribute
public DictData get(String dictCode, boolean isNewRecord) {
public DictData get(String dictCode, boolean isNewRecord, HttpServletRequest request) {
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new DictData();
}
return dictDataService.get(dictCode, isNewRecord);
}
@@ -185,7 +189,7 @@ public class DictDataController extends BaseController {
}
// DictData where = new DictData();
// where.setStatus(DictData.STATUS_NORMAL);
// where.setParentCodes("," + dictData.getId() + ",");
// where.setParentCodes_rightLike(dictData.getParentCodes() + dictData.getId() + ",");
// long count = dictDataService.findCount(where);
// if (count > 0) {
// return renderResult(Global.FALSE, text("该字典包含未停用的子字典!"));

View File

@@ -48,7 +48,10 @@ public class MenuController extends BaseController {
private ModuleService moduleService;
@ModelAttribute
public Menu get(String menuCode, boolean isNewRecord) {
public Menu get(String menuCode, boolean isNewRecord, HttpServletRequest request) {
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new Menu();
}
return menuService.get(menuCode, isNewRecord);
}
@@ -79,13 +82,10 @@ public class MenuController extends BaseController {
if (StringUtils.isBlank(menu.getParentCode())) {
menu.setParentCode(Menu.ROOT_CODE);
}
if (StringUtils.isNotBlank(menu.getMenuNameRaw())){
menu.setParentCode(null);
}
if (StringUtils.isNotBlank(menu.getMenuHref())){
menu.setParentCode(null);
}
if (StringUtils.isNotBlank(menu.getPermission())){
if (StringUtils.isNotBlank(menu.getMenuCode())
|| StringUtils.isNotBlank(menu.getMenuNameRaw())
|| StringUtils.isNotBlank(menu.getMenuHref())
|| StringUtils.isNotBlank(menu.getPermission())){
menu.setParentCode(null);
}
List<Menu> list = menuService.findList(menu);

View File

@@ -40,13 +40,13 @@ import java.util.stream.Collectors;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/module")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
@ConditionalOnProperty(name={"config.enabled","web.core.enabled"}, havingValue="true", matchIfMissing=true)
@ApiIgnore
public class ModuleController extends BaseController {
@Autowired
private ModuleService moduleService;
/**
* 获取数据
* @param moduleCode
@@ -56,7 +56,7 @@ public class ModuleController extends BaseController {
public Module get(String moduleCode, boolean isNewRecord) {
return moduleService.get(moduleCode, isNewRecord);
}
/**
* 查询列表
* @param module
@@ -70,7 +70,7 @@ public class ModuleController extends BaseController {
model.addAttribute("module", module);
return "modules/sys/moduleList";
}
/**
* 查询列表
* @param module
@@ -83,7 +83,7 @@ public class ModuleController extends BaseController {
@ResponseBody
public Page<Module> listData(Module module, HttpServletRequest request, HttpServletResponse response) {
module.setPage(new Page<>(request, response));
Page<Module> page = moduleService.findPage(module);
Page<Module> page = moduleService.findPage(module);
return page;
}

View File

@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@@ -57,7 +58,10 @@ public class OfficeController extends BaseController {
* 获取机构
*/
@ModelAttribute
public Office get(String officeCode, boolean isNewRecord) {
public Office get(String officeCode, boolean isNewRecord, HttpServletRequest request) {
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new Office();
}
return officeService.get(officeCode, isNewRecord);
}
@@ -95,9 +99,13 @@ public class OfficeController extends BaseController {
if (StringUtils.isBlank(office.getParentCode())){
office.setParentCode(Office.ROOT_CODE);
}
if (StringUtils.isNotBlank(office.getViewCode())
if (StringUtils.isNotBlank(office.getOfficeCode())
|| StringUtils.isNotBlank(office.getViewCode())
|| StringUtils.isNotBlank(office.getViewCode_like())
|| StringUtils.isNotBlank(office.getOfficeName())
|| StringUtils.isNotBlank(office.getFullName())){
|| StringUtils.isNotBlank(office.getFullName())
|| StringUtils.isNotBlank(office.getLeader())
|| StringUtils.isNotBlank(office.getPhone())){
office.setParentCode(null);
}
officeService.addDataScopeFilter(office, ctrlPermi);
@@ -232,7 +240,7 @@ public class OfficeController extends BaseController {
public String disable(Office office) {
Office where = new Office();
where.setStatus(Office.STATUS_NORMAL);
where.setParentCodes("," + office.getId() + ",");
where.setParentCodes_rightLike(office.getParentCodes() + office.getId() + ",");
long count = officeService.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该机构包含未停用的子机构!"));

View File

@@ -23,6 +23,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -136,13 +137,14 @@ public class SwitchController extends BaseController{
*/
//@RequiresPermissions("user")
@RequestMapping(value = "switchSkin/{skinName}")
public String switchSkin(@PathVariable String skinName, HttpServletRequest request, HttpServletResponse response) {
public String switchSkin(@PathVariable String skinName, @RequestParam(defaultValue="${adminPath}/index") String url,
HttpServletRequest request, HttpServletResponse response) {
if (StringUtils.isNotBlank(skinName) && !"select".equals(skinName)){
CookieUtils.setCookie(response, "skinName", EncodeUtils.encodeUrl(EncodeUtils.xssFilter(skinName, request)));
if (ServletUtils.isAjaxRequest(request)) {
return renderResult(response, Global.TRUE, text("主题切换成功"));
}
return REDIRECT + adminPath + "/index";
return REDIRECT + EncodeUtils.decodeUrl2(url);
}
return "modules/sys/switchSkin";
}

View File

@@ -165,8 +165,9 @@ public class EmpUserController extends BaseController {
model.addAttribute("op", op);
model.addAttribute("empUser", empUser);
// 获取控制权限类型
// 获取控制权限类型、岗位角色权限参数
model.addAttribute("ctrlPermi", Global.getConfig("user.adminCtrlPermi", "2"));
model.addAttribute("postRolePermi", Global.getConfigToBoolean("user.postRolePermi", "false"));
return "modules/sys/user/empUserForm";
}
@@ -191,7 +192,11 @@ public class EmpUserController extends BaseController {
if (StringUtils.inString(op, Global.OP_ADD, Global.OP_EDIT) && subject.isPermitted("sys:empUser:edit")){
empUserService.save(empUser);
}
if (StringUtils.inString(op, Global.OP_ADD, Global.OP_AUTH) && subject.isPermitted("sys:empUser:authRole")){
if (Global.getConfigToBoolean("user.postRolePermi", "false")) {
if (StringUtils.inString(op, Global.OP_AUTH)) {
return renderResult(Global.FALSE, text("启用岗位角色权限后,请在用户关联岗位中关联角色", empUser.getUserName()));
}
}else if (StringUtils.inString(op, Global.OP_ADD, Global.OP_AUTH) && subject.isPermitted("sys:empUser:authRole")){
userService.saveAuth(empUser);
}
return renderResult(Global.TRUE, text("保存用户''{0}''成功", empUser.getUserName()));

View File

@@ -117,15 +117,15 @@ FNP.array = org.beetl.ext.fn.ArrayUtil
FNP.dict = com.jeesite.common.beetl.ext.fn.DictUtil
##内置的格式化函数
FT.dateFormat = org.beetl.ext.format.DateFormat
FT.dateFormat = com.jeesite.common.beetl.ext.format.DateFormat
FT.numberFormat = com.jeesite.common.beetl.ext.format.NumberFormat
FT.xss = com.jeesite.common.beetl.ext.format.XssFormat
##内置的默认格式化函数
FTC.java.util.Date = org.beetl.ext.format.DateFormat
FTC.java.sql.Date = org.beetl.ext.format.DateFormat
FTC.java.sql.Time = org.beetl.ext.format.DateFormat
FTC.java.sql.Timestamp = org.beetl.ext.format.DateFormat
FTC.java.util.Date = com.jeesite.common.beetl.ext.format.DateFormat
FTC.java.sql.Date = com.jeesite.common.beetl.ext.format.DateFormat
FTC.java.sql.Time = com.jeesite.common.beetl.ext.format.DateFormat
FTC.java.sql.Timestamp = com.jeesite.common.beetl.ext.format.DateFormat
FTC.java.lang.Short = com.jeesite.common.beetl.ext.format.NumberFormat
FTC.java.lang.Long = com.jeesite.common.beetl.ext.format.NumberFormat
FTC.java.lang.Integer = com.jeesite.common.beetl.ext.format.NumberFormat

View File

@@ -92,6 +92,10 @@ spring:
cache:
# 缓存及会话共享(专业版)
isClusterMode: false
# 给缓存Key增加数据源名称前缀 v5.6.1
keyPrefixWithDsName: false
# 指定全局Key不加DsName前缀当keyPrefixWithDsName设置为true的时有效cacheName:key|*v5.12.1
globalKeyNames: sysCache:configMap,sysCache:moduleMap,sysCache:areaAllList
# 清理全部缓存按钮所清理的缓存列表
clearNames: sysCache,corpCache,userCache,roleCache,fileUploadCache,msgPcPoolCache,cmsCache,bpmFormCache
# 用户缓存
@@ -133,13 +137,19 @@ mybatis:
# 批量插入和更新的分批默认大小防止库一次性接受不了太大的sql语句
defaultBatchSize: 500
# 执行逻辑删除的时候,同时修改主键字段值,方便再次使用这个主键值 v5.4.0+
# 执行逻辑删除的时候,同时修改主键字段值,方便再次使用这个主键值(调用 entity.sqlMap().markIdDelete() 时生效) v5.4.0+
# 案例分析(角色管理场景):
# 1.如果是逻辑删除数据,并非物理删除,所以删除了角色 abc 再次新增时,会提示 abc 编号已存在
# 2.使用方法为:在 super.delete(entity); 前调用entity.sqlMap().markIdDelete();
# 3.一般在手动填写主键业务中使用,启用后将会在删除后,修改 ID 值数据例如abc__del_随机串
markIdDeleteFlag: __del_
# 允许 @Table orderBy 排序 设置为空,否则默认使用 主键 排序 v4.5.0 v5.1.0
allowOrderEmpty: true
# 排序字段 SQL 过滤,该参数仅对 sqlMap.getOrder().setOrderBy 内部调用方法有效 page.setOrderBy 和 entity.setOrderBy 必须经过过滤 v5.12.0
orderBySqlFilter: false
# Mapper文件刷新线程
mapper:
refresh:
@@ -197,6 +207,9 @@ user:
# 是否启用切换部门功能,再开启启用岗位角色后可支持 用户->附属部门->岗位->关联角色,纳入菜单和权限管理 v5.10.1
switchOffice: false
# 登录后激活当前用户所在的主部门,默认为不激活即混合权限
loginAfterActiveMainOffice: false
# 多租户模式SAAS模式专业版
useCorpModel: false
@@ -495,7 +508,7 @@ shiro:
#allowReferers: http://127.0.0.1,http://localhost
# 允许重定向的地址不设置为全部允许设置this只允许本项目内部跳转多个用逗号隔开例如this,http://*.jeesite.com
#allowRedirects: ~
allowRedirects: this
# 是否在登录后生成新的Session默认false
isGenerateNewSessionAfterLogin: false
@@ -537,6 +550,8 @@ shiro:
/oauth2/authorize = user
/druid/** = perms[sys:state:druid]
/bpm/modeler/** = perms[bpm:modeler]
/ureport/designer/** = perms[ureport]
/ureport/datasource/** = perms[ureport]
${adminPath}/login-cas = cas
${adminPath}/login-ldap = ldap
${adminPath}/login = authc
@@ -713,10 +728,6 @@ web:
id: '[a-zA-Z0-9_\-/#\u4e00-\u9fa5]{0,64}'
user.loginCode: '[a-zA-Z0-9_\u4e00-\u9fa5]{4,20}'
# 默认的日期格式JsonMapper
json:
defaultDateFormat: yyyy-MM-dd HH:mm:ss
# 默认不启用(为兼用旧版保留,建议使用 CORS
jsonp:
enabled: false
@@ -753,9 +764,9 @@ file:
maxFileSize: '500*1024*1024'
# 设置允许上传的文件后缀(全局设置)
imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,webp,
imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,.webp,
mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,
fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk,
fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.ofd,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk,
# 允许上传的文件内容类型图片、word、excel、ppt防止修改后缀恶意上传文件默认不启用验证
# allowContentTypes: image/jpeg,image/gif,image/bmp,image/png,image/x-png,

View File

@@ -33,7 +33,7 @@
公司管理=Company manage
岗位管理=Position manage
权限管理=Rights Manage
权限管理=Rights manage
角色管理=Role manage
二级管理员=Secondary admin
系统管理员=System admin
@@ -56,6 +56,7 @@
在线用户=Online user
在线文档=Online doc
数据管理=Data manage
研发工具=Develop Tools
用户选择=User select
@@ -317,6 +318,8 @@
# =========== 公司管理 ===========
公司架构=Company
新增公司=New company
编辑公司=Edit company
@@ -545,6 +548,7 @@
主类全名=Main class name
模块描述=Module description
当前版本=Current version
升级信息=Upgrade info
版本=version
未知=Unknown
未安装=Uninstalled
@@ -632,6 +636,8 @@ CSS类名=CSS class
# =========== 区域管理 ===========
区域导航=Area
新增区域=New area
编辑区域=Edit area

View File

@@ -56,6 +56,7 @@
在线用户=オンラインユーザー
在线文档=オンラインドキュメント
数据管理=データかんり
研发工具=開発ツール
用户选择=ユーザー選択
@@ -460,6 +461,7 @@
主类全名=主類のフルネーム
模块描述=モジュール記述
当前版本=現行版
升级信息=アップグレードします情報
版本=バージョン
未知=未知
未安装=未実装

View File

@@ -13,7 +13,7 @@
<select id="findList" resultType="EmpUser">
SELECT ${sqlMap.column.toSql()}
FROM ${sqlMap.table.toSql()}
<if test="roleCode != null and roleCode != ''">
<if test="(roleCode != null and roleCode != '') or (roleCodes != null and roleCodes.length gt 0)">
JOIN ${_prefix}sys_user_role ur2 ON ur2.user_code = a.user_code
</if>
<if test="employee.postCode != null and employee.postCode != ''">
@@ -24,6 +24,12 @@
<if test="roleCode != null and roleCode != ''">
AND ur2.role_code = #{roleCode}
</if>
<if test="roleCodes != null and roleCodes.length gt 0">
AND ur2.role_code IN
<foreach collection="roleCodes" item="roleCode" open="(" separator="," close=")">
#{roleCode}
</foreach>
</if>
<if test="employee.postCode != null and employee.postCode != ''">
AND (
ep.post_code = #{employee.postCode}

View File

@@ -24,5 +24,25 @@
</where>
ORDER BY ${sqlMap.order.toSql()}
</select>
<!-- 重写 Dao 中的 insert 查询方法 v5.11.1
<insert id="insert">
INSERT INTO ${sqlMap.insert.toTableSql()}
(${sqlMap.insert.toColumnSql()})
VALUES (${sqlMap.insert.toValuesSql()})
</insert> -->
<!-- 重写 Dao 中的 update 查询方法 v5.11.1
<update id="update">
UPDATE ${sqlMap.update.toTableSql()}
SET ${sqlMap.update.toColumnSql()}
WHERE ${sqlMap.update.toWhereSql()}
</update> -->
<!-- 重写 Dao 中的 phyDelete 查询方法 v5.11.1
<delete id="phyDelete">
DELETE FROM ${sqlMap.update.toTableSql()}
WHERE ${sqlMap.update.toWhereSql()}
</delete> -->
</mapper>

View File

@@ -40,54 +40,59 @@
}
%>
<% if(c.showType == 'input'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<u-input placeholder="请输入${c.columnLabel}" v-model="model.${c.attrName}" type="text" maxlength="${c.dataLength}"></u-input>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<u-input placeholder="请输入${c.columnLabel}" v-model="model.${c.attrName}" type="text"${c.dataLength != "0" ? ' maxlength="'+c.dataLength+'"' : ''}></u-input>
</u-form-item>
<% }else if(c.showType == 'textarea'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180" label-position="top">
<u-input type="textarea" placeholder="请输入${c.columnLabel}" v-model="model.testTextarea" height="100" maxlength="${c.dataLength}" />
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180" label-position="top">
<u-input type="textarea" placeholder="请输入${c.columnLabel}" v-model="model.${c.attrName}" height="100"${c.dataLength != "0" ? ' maxlength="'+c.dataLength+'"' : ''} />
</u-form-item>
<% }else if(c.showType == 'select' || c.showType == 'select_multiple'){
var isMultiple = (c.showType == 'select_multiple'); %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<js-select v-model="model.${c.attrName}" dict-type="${c.optionMap['dictType']}"<% if(isMultiple){ %> multiple="true"<% } %> placeholder="请选择${c.columnLabel}"></js-select>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<js-select v-model="model.${c.attrName}" dict-type="${c.optionMap['dictType']}"<% if(isMultiple){ %> :multiple="true"<% } %> placeholder="请选择${c.columnLabel}"></js-select>
</u-form-item>
<% }else if(c.showType == 'radio'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<js-radio v-model="model.${c.attrName}" dict-type="${c.optionMap['dictType']}"></js-radio>
</u-form-item>
<% }else if(c.showType == 'checkbox'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<js-checkbox v-model="model.${c.attrName}" dict-type="${c.optionMap['dictType']}"></js-checkbox>
</u-form-item>
<% }else if(c.showType == 'date' || c.showType == 'datetime'){
var isTime = (c.showType == 'datetime'); %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<u-input placeholder="请输入${c.columnLabel}" v-model="model.${c.attrName}" format="yyyy-MM-dd${isTime?' HH:mm':''}" type="text" maxlength="${c.dataLength}"></u-input>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<u-input placeholder="请输入${c.columnLabel}" v-model="model.${c.attrName}" type="text"
@click="${c.attrName}Open = true;" :disabled="true"></u-input>
<u-picker v-model="${c.attrName}Open" mode="time" :default-time="model.${c.attrName}"
:params="{year: true, month: true, day: true<% if(isTime){ %>, hour: true, minute: true, second: false<% } %>}"
@confirm="model.${c.attrName} = $event.year + '-' + $event.month + '-' + $event.day<% if(isTime){ %> + ' ' + $event.hour + ':' + $event.minute<% } %>"
></u-picker>
</u-form-item>
<% }else if(c.showType == 'userselect'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.attrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.simpleAttrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
:label-value="model.${c.attrName2}" @label-input="model.${c.attrName2} = $event"<% } %>></js-select>
</u-form-item>
<% }else if(c.showType == 'officeselect'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.attrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.simpleAttrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
:label-value="model.${c.attrName2}" @label-input="model.${c.attrName2} = $event"<% } %>></js-select>
</u-form-item>
<% }else if(c.showType == 'companyselect'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.attrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.simpleAttrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
:label-value="model.${c.attrName2}" @label-input="model.${c.attrName2} = $event"<% } %>></js-select>
</u-form-item>
<% }else if(c.showType == 'areaselect'){ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.attrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<js-select v-model="model.${c.attrName}" :items="${c.simpleAttrName}List" placeholder="请选择${c.columnLabel}" :tree="true"<% if (isNotBlank(c.attrName2)){ %>
:label-value="model.${c.attrName2}" @label-input="model.${c.attrName2} = $event"<% } %>></js-select>
</u-form-item>
<% }else{ %>
<u-form-item label="${c.columnLabel}" prop="${c.attrName}" label-width="180">
<u-input placeholder="请输入${c.columnLabel}" v-model="model.${c.attrName}" type="text" maxlength="${c.dataLength}"></u-input>
<u-form-item label="${c.columnLabel}" prop="${c.simpleAttrName}" label-width="180">
<u-input placeholder="请输入${c.columnLabel}" v-model="model.${c.attrName}" type="text"${c.dataLength != "0" ? ' maxlength="'+c.dataLength+'"' : ''}></u-input>
</u-form-item>
<% } %>
<%
@@ -126,28 +131,31 @@ export default {
continue;
}
%>
<% if(c.showType == 'userselect'){ %>
<% if(c.showType == 'userselect' && c.attrType != 'String'){ %>
${c.simpleAttrName}: {
userCode: '',
userName: ''
},
<% }else if(c.showType == 'officeselect'){ %>
<% }else if(c.showType == 'officeselect' && c.attrType != 'String'){ %>
${c.simpleAttrName}: {
officeCode: '',
officeName: ''
},
<% }else if(c.showType == 'companyselect'){ %>
<% }else if(c.showType == 'companyselect' && c.attrType != 'String'){ %>
${c.simpleAttrName}: {
companyCode: '',
companyName: ''
},
<% }else if(c.showType == 'areaselect'){ %>
<% }else if(c.showType == 'areaselect' && c.attrType != 'String'){ %>
${c.simpleAttrName}: {
areaCode: '',
areaName: ''
},
<% }else{ %>
${c.attrName}: '',
<% if (!isBlank(c.attrName2)){ %>
${c.attrName2}: '',
<% } %>
<% } %>
<%
}
@@ -167,7 +175,7 @@ export default {
}
%>
<% if(c.isRequired == '1'){ %>
'${c.attrName}': [
'${c.simpleAttrName}': [
{
required: true,
message: '请输入${c.columnLabel}',
@@ -199,6 +207,8 @@ export default {
${c.simpleAttrName}List: [],
<% }else if(c.showType == 'areaselect'){ %>
${c.simpleAttrName}List: [],
<% }else if(c.showType == 'date' || c.showType == 'datetime'){ %>
${c.attrName}Open: false,
<% } %>
<%
}

View File

@@ -15,7 +15,7 @@
<u-cell-group class="list" :border="false">
<u-swipe-action :options="options" v-for="(item, index) in list" :key="item.id" :index="index" @click="optionsClick">
<%
var idParam = '', idParam2 = '';
var idParam = '', idParam2 = '', queryField = '';
for(pk in table.pkList){
idParam = idParam + (pk.attrName + '=\'+item.' + pk.attrName);
idParam2 = idParam2 + ('item.' + pk.attrName);
@@ -39,6 +39,7 @@
<text slot="label">创建者:{{item.createBy}} &nbsp;|&nbsp; 时间:{{item.createDate}}</text>
</u-cell-item>
<%
queryField = c.attrName;
break;
}
}
@@ -130,7 +131,7 @@ export default {
search(value) {
this.list = [];
this.query.pageNo = 0;
this.query.testInput = value;
this.query.${queryField} = value;
this.loadList();
},
navTo(url) {

View File

@@ -293,5 +293,13 @@
<template>module_cloud/web/pom.xml</template>
<template>module_cloud/pom.xml</template>
</category>
<category value="module_vue" label="生成前端模块代码Vue">
<template>module_vue/api/api.xml</template>
<template>module_vue/views/views.xml</template>
<template>module_vue/index.ts.xml</template>
<template>module_vue/package.json.xml</template>
<template>module_vue/README.md.xml</template>
<template>module_vue/tsconfig.json.xml</template>
</category>
</moduleTplCategory>
</config>

View File

@@ -3,17 +3,19 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>controller</name>
<filePath>${baseDir}/src/main/java/${packagePath}/${moduleName}/web/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/java${packagePath}${modulePath}/web${subModulePath}</filePath>
<fileName>${ClassName}Controller.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.web${subModuleNameDot};
<% if (table.isTreeEntity){ %>
import java.util.Map;
<% } %>
<% if (table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import java.util.List;
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
<% } %>
import javax.servlet.http.HttpServletRequest;
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import javax.servlet.http.HttpServletResponse;
<% } %>
@@ -49,11 +51,11 @@ import com.alibaba.fastjson.JSONValidator;
import com.jeesite.common.codec.EncodeUtils;
<% } %>
import com.jeesite.common.web.BaseController;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${ClassName};
<% for (child in table.childList){ %>
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)};
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${@StringUtils.cap(child.className)};
<% } %>
import ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Service;
import ${packageName}.${moduleName}.service${subModuleNameDot}.${ClassName}Service;
/**
* ${functionName}Controller
@@ -71,7 +73,12 @@ public class ${ClassName}Controller extends BaseController {
* 获取数据
*/
@ModelAttribute
public ${ClassName} get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>, boolean isNewRecord) {
public ${ClassName} get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>, boolean isNewRecord<% if (table.isTreeEntity){ %>, HttpServletRequest request<% } %>) {
<% if (table.isTreeEntity){ %>
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new ${ClassName}();
}
<% } %>
<% if (table.pkList.~size == 1){ %>
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
<% }else{ %>
@@ -117,19 +124,23 @@ public class ${ClassName}Controller extends BaseController {
if (StringUtils.isBlank(${className}.getParentCode())) {
${className}.setParentCode(${ClassName}.ROOT_CODE);
}
<% for(c in table.columnList){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status'){ %>
<% if(c.attrType == 'String'){ %>
if (StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})){
<% var where = {
for(c in table.columnList){
if(c.isPk == "1" || (c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status')){
if(c.attrType == 'String'){ %>
|| StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})
<% }else{ %>
|| ${className}.${c.attrNameForGetMethod} != null
<% }
}
}
};
where = @StringUtils.trim(@ObjectUtils.toString(where));
if (isNotBlank(where)){ %>
if (${@StringUtils.substring(where, 3)}){
${className}.setParentCode(null);
}
<% }else{ %>
if (${className}.${c.attrNameForGetMethod} != null){
${className}.setParentCode(null);
}
<% } %>
<% } %>
<% } %>
<% } %>
List<${ClassName}> list = ${className}Service.findList(${className});
return list;
}
@@ -268,7 +279,7 @@ public class ${ClassName}Controller extends BaseController {
<% if(table.isTreeEntity){ %>
${ClassName} where = new ${ClassName}();
where.setStatus(${ClassName}.STATUS_NORMAL);
where.setParentCodes("," + ${className}.getId() + ",");
where.setParentCodes_rightLike(${className}.getParentCodes() + ${className}.getId() + ",");
long count = ${className}Service.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该${functionNameSimple}包含未停用的子${functionNameSimple}"));

View File

@@ -3,14 +3,14 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>dao</name>
<filePath>${baseDir}/src/main/java/${packagePath}/${moduleName}/dao/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/java${packagePath}${modulePath}/dao${subModulePath}</filePath>
<fileName>${ClassName}Dao.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.dao${subModuleNameDot};
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};
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${ClassName};
/**
* ${functionName}DAO接口

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>entity</name>
<filePath>${baseDir}/src/main/java/${packagePath}/${moduleName}/entity/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/java${packagePath}${modulePath}/entity${subModulePath}</filePath>
<fileName>${ClassName}.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.entity${isNotBlank(subModuleName)?'.'+subModuleName:''};
@@ -179,7 +179,7 @@ import com.jeesite.common.utils.excel.annotation.ExcelFields;
} %>"
)
public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(table.isTreeEntity?'BpmTree':'Bpm'):table.isTreeEntity?'Tree':'Data'}Entity<${ClassName}> {
private static final long serialVersionUID = 1L;
<%
isExtend = false;

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>mapper</name>
<filePath>${baseDir}/src/main/resources/mappings/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/resources/mappings/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${ClassName}Dao.xml</fileName>
<content><![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>

View File

@@ -3,10 +3,10 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>service</name>
<filePath>${baseDir}/src/main/java/${packagePath}/${moduleName}/service/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/java${packagePath}${modulePath}/service${subModulePath}</filePath>
<fileName>${ClassName}Service.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.service${subModuleNameDot};
import java.util.List;
<% if (table.childList.~size > 0){ %>
@@ -17,8 +17,8 @@ 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;
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${ClassName};
import ${packageName}.${moduleName}.dao${subModuleNameDot}.${ClassName}Dao;
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
import java.util.Map;
import com.jeesite.common.lang.StringUtils;
@@ -32,8 +32,8 @@ import com.jeesite.common.service.ServiceException;
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;
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${@StringUtils.cap(child.className)};
import ${packageName}.${moduleName}.dao${subModuleNameDot}.${@StringUtils.cap(child.className)}Dao;
<% } %>
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
import com.jeesite.common.config.Global;
@@ -131,6 +131,13 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
if (${ClassName}.STATUS_NORMAL.equals(${className}.getStatus())){
throw new ServiceException(text("非法操作,前端数据被劫持!"));
}
// 如果是重启流程操作,则恢复审核状态,并标记重启状态
boolean isRestart = false;
if (${ClassName}.STATUS_RESTART.equals(${className}.getStatus())) {
${className}.setStatus(${ClassName}.STATUS_AUDIT);
isRestart = true;
}
// 如果状态为草稿或审核状态,才可以保存业务数据
if (${ClassName}.STATUS_DRAFT.equals(${className}.getStatus())
@@ -140,15 +147,28 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
// 如果为审核状态,则进行审批流操作
if (${ClassName}.STATUS_AUDIT.equals(${className}.getStatus())){
// 流程定义中的表单Key不是流程Key
String formKey = "${table.optionMap['bpmFormKey']}";
// 指定流程变量,作为流程条件,决定流转方向
Map<String, Object> variables = MapUtils.newHashMap();
//variables.put("leaveDays", ${className}.getLeaveDays());
// 如果是流程重启,则先检查流程状态
if (isRestart) {
if (BpmUtils.getRunProcIns(${className}, formKey) != null) {
throw new ServiceException(text("重启失败,流程已经启动!"));
}
if (StringUtils.isNotBlank(${className}.getBpm().getProcInsId())) {
variables.put("parentProcInsId", ${className}.getBpm().getProcInsId());
}
}
// 如果流程实例为空,任务编号也为空,则:启动流程
if (StringUtils.isBlank(${className}.getBpm().getProcInsId())
&& StringUtils.isBlank(${className}.getBpm().getTaskId())){
BpmUtils.start(${className}, "${table.optionMap['bpmFormKey']}", variables, null);
if (isRestart || (StringUtils.isBlank(${className}.getBpm().getProcInsId())
&& StringUtils.isBlank(${className}.getBpm().getTaskId()))){
BpmUtils.start(${className}, formKey, variables, null);
}
// 如果有任务信息,则:提交任务
else{

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>viewForm</name>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${className}Form.html</fileName>
<content><![CDATA[
<% include('/templates/modules/gen/view/viewForm.html'){} %>]]>

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>viewIndex</name>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${className}Index.html</fileName>
<content><![CDATA[
<% include('/templates/modules/gen/view/viewIndex.html'){} %>]]>

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>viewList</name>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${className}List.html</fileName>
<content><![CDATA[
<% include('/templates/modules/gen/view/viewList.html'){} %>]]>

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>viewSelect</name>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}/src/main/resources/views/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${className}Select.html</fileName>
<content><![CDATA[
<% include('/templates/modules/gen/view/viewSelect.html'){} %>]]>

View File

@@ -2,16 +2,16 @@
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved.
No deletion without permission, or be held responsible to law. -->
<template>
<name>controller</name>
<filePath>${baseDir}/${moduleName}-client/src/main/java/${packagePath}/${moduleName}/api/${subModuleName}</filePath>
<name>api</name>
<filePath>${baseDir}${modulePath}-client/src/main/java${packagePath}${modulePath}/api${subModulePath}</filePath>
<fileName>${ClassName}ServiceApi.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.api${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.api${subModuleNameDot};
import org.springframework.web.bind.annotation.RequestMapping;
import com.jeesite.common.service.rest.${table.isTreeEntity?'Tree':'Crud'}ServiceRest;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${ClassName};
/**
* ${functionName}API

View File

@@ -3,15 +3,15 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>client</name>
<filePath>${baseDir}/${moduleName}-client/src/main/java/${packagePath}/${moduleName}/client/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}-client/src/main/java${packagePath}${modulePath}/client${subModulePath}</filePath>
<fileName>${ClassName}ServiceClient.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.client${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.client${subModuleNameDot};
import org.springframework.cloud.openfeign.FeignClient;
import com.jeesite.modules.cloud.feign.condition.ConditionalOnNotCurrentApplication;
import ${packageName}.${moduleName}.api${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}ServiceApi;
import ${packageName}.${moduleName}.api${subModuleNameDot}.${ClassName}ServiceApi;
/**
* ${functionName}API

View File

@@ -3,17 +3,19 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>controller</name>
<filePath>${baseDir}/${moduleName}/src/main/java/${packagePath}/${moduleName}/web/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}/src/main/java${packagePath}${modulePath}/web${subModulePath}</filePath>
<fileName>${ClassName}Controller.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.web${subModuleNameDot};
<% if (table.isTreeEntity){ %>
import java.util.Map;
<% } %>
<% if (table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import java.util.List;
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
<% } %>
import javax.servlet.http.HttpServletRequest;
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import javax.servlet.http.HttpServletResponse;
<% } %>
@@ -49,11 +51,11 @@ import com.alibaba.fastjson.JSONValidator;
import com.jeesite.common.codec.EncodeUtils;
<% } %>
import com.jeesite.common.web.BaseController;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${ClassName};
<% for (child in table.childList){ %>
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)};
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${@StringUtils.cap(child.className)};
<% } %>
import ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Service;
import ${packageName}.${moduleName}.service${subModuleNameDot}.${ClassName}Service;
import io.seata.spring.annotation.GlobalTransactional;
@@ -73,7 +75,12 @@ public class ${ClassName}Controller extends BaseController {
* 获取数据
*/
@ModelAttribute
public ${ClassName} get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>, boolean isNewRecord) {
public ${ClassName} get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>, boolean isNewRecord<% if (table.isTreeEntity){ %>, HttpServletRequest request<% } %>) {
<% if (table.isTreeEntity){ %>
if (StringUtils.endsWith(request.getRequestURI(), "listData")) {
return new ${ClassName}();
}
<% } %>
<% if (table.pkList.~size == 1){ %>
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
<% }else{ %>
@@ -119,19 +126,23 @@ public class ${ClassName}Controller extends BaseController {
if (StringUtils.isBlank(${className}.getParentCode())) {
${className}.setParentCode(${ClassName}.ROOT_CODE);
}
<% for(c in table.columnList){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status'){ %>
<% if(c.attrType == 'String'){ %>
if (StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})){
<% var where = {
for(c in table.columnList){
if(c.isPk == "1" || (c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status')){
if(c.attrType == 'String'){ %>
|| StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})
<% }else{ %>
|| ${className}.${c.attrNameForGetMethod} != null
<% }
}
}
};
where = @StringUtils.trim(@ObjectUtils.toString(where));
if (isNotBlank(where)){ %>
if (${@StringUtils.substring(where, 3)}){
${className}.setParentCode(null);
}
<% }else{ %>
if (${className}.${c.attrNameForGetMethod} != null){
${className}.setParentCode(null);
}
<% } %>
<% } %>
<% } %>
<% } %>
List<${ClassName}> list = ${className}Service.findList(${className});
return list;
}
@@ -273,7 +284,7 @@ public class ${ClassName}Controller extends BaseController {
<% if(table.isTreeEntity){ %>
${ClassName} where = new ${ClassName}();
where.setStatus(${ClassName}.STATUS_NORMAL);
where.setParentCodes("," + ${className}.getId() + ",");
where.setParentCodes_rightLike(${className}.getParentCodes() + ${className}.getId() + ",");
long count = ${className}Service.findCount(where);
if (count > 0) {
return renderResult(Global.FALSE, text("该${functionNameSimple}包含未停用的子${functionNameSimple}"));
@@ -307,6 +318,11 @@ public class ${ClassName}Controller extends BaseController {
@ResponseBody
@GlobalTransactional
public String delete(${ClassName} ${className}) {
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
if (!${ClassName}.STATUS_DRAFT.equals(${className}.getStatus())){
return renderResult(Global.FALSE, text("只能删除草稿状态的数据!"));
}
<% } %>
${className}Service.delete(${className});
return renderResult(Global.TRUE, text("删除${functionNameSimple}成功!"));
}

View File

@@ -3,14 +3,14 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>dao</name>
<filePath>${baseDir}/${moduleName}/src/main/java/${packagePath}/${moduleName}/dao/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}/src/main/java${packagePath}${modulePath}/dao${subModulePath}</filePath>
<fileName>${ClassName}Dao.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.dao${subModuleNameDot};
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};
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${ClassName};
/**
* ${functionName}DAO接口

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>entity</name>
<filePath>${baseDir}/${moduleName}-client/src/main/java/${packagePath}/${moduleName}/entity/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}-client/src/main/java${packagePath}${modulePath}/entity${subModulePath}</filePath>
<fileName>${ClassName}.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.entity${isNotBlank(subModuleName)?'.'+subModuleName:''};
@@ -179,7 +179,7 @@ import com.jeesite.common.utils.excel.annotation.ExcelFields;
} %>"
)
public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(table.isTreeEntity?'BpmTree':'Bpm'):table.isTreeEntity?'Tree':'Data'}Entity<${ClassName}> {
private static final long serialVersionUID = 1L;
<%
isExtend = false;

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>mapper</name>
<filePath>${baseDir}/${moduleName}/src/main/resources/mappings/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}/src/main/resources/mappings/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${ClassName}Dao.xml</fileName>
<content><![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>

View File

@@ -3,10 +3,10 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>service</name>
<filePath>${baseDir}/${moduleName}/src/main/java/${packagePath}/${moduleName}/service/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}/src/main/java${packagePath}${modulePath}/service${subModulePath}</filePath>
<fileName>${ClassName}Service.java</fileName>
<content><![CDATA[
package ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''};
package ${packageName}.${moduleName}.service${subModuleNameDot};
import java.util.List;
<% if (table.childList.~size > 0){ %>
@@ -18,9 +18,9 @@ import org.springframework.web.bind.annotation.RestController;
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;
import ${packageName}.${moduleName}.api${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}ServiceApi;
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${ClassName};
import ${packageName}.${moduleName}.dao${subModuleNameDot}.${ClassName}Dao;
import ${packageName}.${moduleName}.api${subModuleNameDot}.${ClassName}ServiceApi;
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
import java.util.Map;
import com.jeesite.common.lang.StringUtils;
@@ -34,8 +34,8 @@ import com.jeesite.common.service.ServiceException;
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;
import ${packageName}.${moduleName}.entity${subModuleNameDot}.${@StringUtils.cap(child.className)};
import ${packageName}.${moduleName}.dao${subModuleNameDot}.${@StringUtils.cap(child.className)}Dao;
<% } %>
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
import com.jeesite.common.config.Global;

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>viewForm</name>
<filePath>${baseDir}/${moduleName}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}/src/main/resources/views/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${className}Form.html</fileName>
<content><![CDATA[
<% include('/templates/modules/gen/view/viewForm.html'){} %>]]>

View File

@@ -3,7 +3,7 @@
No deletion without permission, or be held responsible to law. -->
<template>
<name>viewIndex</name>
<filePath>${baseDir}/${moduleName}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<filePath>${baseDir}${modulePath}/src/main/resources/views/${lastPackageName}${modulePath}${subModulePath}</filePath>
<fileName>${className}Index.html</fileName>
<content><![CDATA[
<% include('/templates/modules/gen/view/viewIndex.html'){} %>]]>

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