Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ee1722be5 | ||
|
|
ffad5e5e18 | ||
|
|
768d8a1c47 | ||
|
|
45fde1ef66 | ||
|
|
414bad08d5 | ||
|
|
09ff1c68b0 | ||
|
|
6529dd10b2 | ||
|
|
9ce3eb94fa | ||
|
|
83de9b91c0 | ||
|
|
3f2f00b6f6 | ||
|
|
6beec711b6 | ||
|
|
0352fff7e6 | ||
|
|
9dc99927b3 | ||
|
|
d7d5ef01ed | ||
|
|
53abddef44 | ||
|
|
fe17f43f3a | ||
|
|
4090a655e9 | ||
|
|
a660a8e912 | ||
|
|
22e1a6d7ea | ||
|
|
2abe3348fb | ||
|
|
8d7c499321 | ||
|
|
7ad0379066 | ||
|
|
da5dbdf23b | ||
|
|
4866a13365 | ||
|
|
9d4f849371 | ||
|
|
5dd679eb24 | ||
|
|
f788cb7e78 | ||
|
|
9ec99230ad | ||
|
|
9c390d7cb1 | ||
|
|
28aef61cea | ||
|
|
15ae96b04a | ||
|
|
a8764cf247 | ||
|
|
e5842b42f4 | ||
|
|
4d7a40d30f | ||
|
|
fe18621aa9 | ||
|
|
a029e6d56a | ||
|
|
73f64ca648 | ||
|
|
63e3bd03b4 | ||
|
|
4103bf1d6a | ||
|
|
7a33736d43 | ||
|
|
298d1adbba | ||
|
|
9be2959d7d | ||
|
|
0fad02369b | ||
|
|
548a747e19 | ||
|
|
e2101b438f | ||
|
|
bbcb4b937d | ||
|
|
bcde73efed | ||
|
|
a6ddb4ed16 | ||
|
|
59fbee7a2f |
17
README.md
17
README.md
@@ -4,8 +4,8 @@
|
||||
</p>
|
||||
<h3 align="center" style="margin:30px 0 30px;font-weight:bold;font-size:30px;">快速开发平台 - Spring Boot</h3>
|
||||
<p align="center">
|
||||
<a href="https://jeesite.com/docs/upgrade/" target="__blank"><img alt="JeeSite-V4.5" src="https://img.shields.io/badge/JeeSite-V4.5-success.svg"></a>
|
||||
<a href="https://spring.io/projects/spring-boot#learn" target="__blank"><img alt="SpringBoot-2.6" src="https://img.shields.io/badge/SpringBoot-2.6-blue.svg"></a>
|
||||
<a href="https://jeesite.com/docs/upgrade/" target="__blank"><img alt="JeeSite-V4.6" src="https://img.shields.io/badge/JeeSite-V4.6-success.svg"></a>
|
||||
<a href="https://spring.io/projects/spring-boot#learn" target="__blank"><img alt="SpringBoot-2.7" src="https://img.shields.io/badge/SpringBoot-2.7-blue.svg"></a>
|
||||
<a href="https://gitee.com/thinkgem/jeesite4/stargazers" target="__blank"><img alt="star" src="https://gitee.com/thinkgem/jeesite4/badge/star.svg?theme=dark"></a>
|
||||
<a href="https://gitee.com/thinkgem/jeesite4/members" target="__blank"><img alt="fork" src="https://gitee.com/thinkgem/jeesite4/badge/fork.svg?theme=dark"></a>
|
||||
</p>
|
||||
@@ -43,6 +43,8 @@ JeeSite 是一个低代码开发平台,具有较高的封装度、扩展性,
|
||||
|
||||
大家都在用 Spring,也在学习 Spring 的优点,Spring 提供了较好的扩展性,可又有多少人去修改它的源代码呢,退一步说,大家去修改了 Spring 的源码,反而会对未来升级造成很大困扰,您说不是呢?这样的例子很多,所以不要纠结,我们非常注重这一点,JeeSite 也一样具备强大的扩展性。
|
||||
|
||||
为什么说 JeeSite 比较易于学习?JeeSite 很好的把握了设计的 “度”,避免过度设计的情况。过度设计是在产品设计过程中忽略了产品和用户的实际需求,反而带来了不必要的复杂性,而忽略了系统的学习、开发和维护成本。
|
||||
|
||||
* 至今 JeeSite 平台架构已经非常稳定。
|
||||
* JeeSite 精益求精,用心打磨每一个细节。
|
||||
* JeeSite 是一个专业的平台,是一个让你使用放心的平台。
|
||||
@@ -51,7 +53,7 @@ JeeSite 是一个低代码开发平台,具有较高的封装度、扩展性,
|
||||
|
||||
## 技术选型
|
||||
|
||||
* 主框架:Spring Boot 2.6、Spring Framework 5.3、Apache Shiro 1.9、J2Cache
|
||||
* 主框架:Spring Boot 2.7、Spring Framework 5.3、Apache Shiro 1.11、J2Cache
|
||||
* 持久层:Apache MyBatis 3.5、Hibernate Validator 6.2、Alibaba Druid 1.2
|
||||
* 视图层:Spring MVC 5.3、Beetl 3.3(替换JSP)、Bootstrap 3.3、AdminLTE 2.4
|
||||
* 前端组件:jQuery 3.5、jqGrid 4.7、layer 3.5、zTree 3.5、jQuery Validation
|
||||
@@ -72,11 +74,12 @@ JeeSite 是一个低代码开发平台,具有较高的封装度、扩展性,
|
||||
|
||||
## 生态系统
|
||||
|
||||
* 分布式微服务系统(Spring Cloud):<https://gitee.com/thinkgem/jeesite4-cloud>
|
||||
* 分布式微服务(Spring Cloud):<https://gitee.com/thinkgem/jeesite4-cloud>
|
||||
* Flowable业务流程引擎(BPM):<http://jeesite.com/docs/bpm/>
|
||||
* JFlow工作流引擎:<https://gitee.com/thinkgem/jeesite4-jflow> :<http://ccflow.org>
|
||||
* Flowable业务流程模块(BPM):<http://jeesite.com/docs/bpm/>
|
||||
* 内容管理模块(CMS):<https://gitee.com/thinkgem/jeesite4-cms>
|
||||
* 内容管理模块(CMS):<https://gitee.com/thinkgem/jeesite4/tree/v5.3/modules/cms>
|
||||
* 手机端移动端:<https://gitee.com/thinkgem/jeesite4-uniapp>
|
||||
* PC客户端程序:<https://gitee.com/thinkgem/jeesite-client>
|
||||
* Vue3分离版本:<https://gitee.com/thinkgem/jeesite-vue>
|
||||
|
||||
## 快速体验
|
||||
@@ -88,7 +91,7 @@ JeeSite 是一个低代码开发平台,具有较高的封装度、扩展性,
|
||||
### 本地运行
|
||||
|
||||
1. 环境准备:`JDK 1.8 or 11、17`、`Maven 3.6+`、使用 `MySQL 5.7 or 8.0` 数据库、[其它数据库](https://jeesite.com/docs/technology/#_8、已支持数据库)
|
||||
2. 下载源码:<https://gitee.com/thinkgem/jeesite4/repository/archive/v4.5.zip> 并解压
|
||||
2. 下载源码:<https://gitee.com/thinkgem/jeesite4/repository/archive/v4.6.zip> 并解压
|
||||
3. 打开文件:`/web/src/main/resources/config/application.yml` 配置JDBC连接
|
||||
4. 执行脚本:`/web/bin/init-data.bat` 初始化数据库
|
||||
5. 执行脚本:`/web/bin/run-tomcat.bat` 启动服务即可
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<version>4.7.0-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -194,11 +194,6 @@
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
|
||||
@@ -4,11 +4,8 @@
|
||||
*/
|
||||
package com.jeesite.common.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import org.springframework.boot.env.OriginTrackedMapPropertySource;
|
||||
import org.springframework.boot.env.PropertiesPropertySourceLoader;
|
||||
import org.springframework.boot.env.YamlPropertySourceLoader;
|
||||
@@ -16,8 +13,10 @@ import org.springframework.core.Ordered;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 配置文件加载(Boot)
|
||||
@@ -40,7 +39,11 @@ public class PropertyLoader implements org.springframework.boot.env.PropertySour
|
||||
List<PropertySource<?>> propertySources = new ArrayList<>();
|
||||
if (!isLoadJeeSitePropertySource) {
|
||||
isLoadJeeSitePropertySource = true;
|
||||
ParserConfig.getGlobalInstance().setSafeMode(true); // 开启 FastJSON 安全模式
|
||||
try {
|
||||
ParserConfig.getGlobalInstance().setSafeMode(true); // 开启 FastJSON 安全模式
|
||||
} catch (Exception ignored) {
|
||||
// 兼容 fastjson2 的调用,不返回异常
|
||||
}
|
||||
Properties properties = PropertiesUtils.getInstance().getProperties();
|
||||
propertySources.add(new OriginTrackedMapPropertySource("jeesite", properties));
|
||||
} else {
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2005-2012 springside.org.cn
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
package com.jeesite.common.mapper;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.annotation.XmlAnyElement;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import com.jeesite.common.lang.ExceptionUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.reflect.ReflectUtils;
|
||||
|
||||
/**
|
||||
* 使用Jaxb2.0实现XML<->Java Object的Mapper.
|
||||
*
|
||||
* 在创建时需要设定所有需要序列化的Root对象的Class.
|
||||
* 特别支持Root对象是Collection的情形.
|
||||
*
|
||||
* @author calvin
|
||||
* @version 2013-01-15
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class JaxbMapper {
|
||||
|
||||
private static ConcurrentMap<Class, JAXBContext> jaxbContexts = new ConcurrentHashMap<Class, JAXBContext>();
|
||||
|
||||
/**
|
||||
* Java Object->Xml without encoding.
|
||||
*/
|
||||
public static String toXml(Object root) {
|
||||
Class clazz = ReflectUtils.getUserClass(root);
|
||||
return toXml(root, clazz, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Java Object->Xml with encoding.
|
||||
*/
|
||||
public static String toXml(Object root, String encoding) {
|
||||
Class clazz = ReflectUtils.getUserClass(root);
|
||||
return toXml(root, clazz, encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Java Object->Xml with encoding.
|
||||
*/
|
||||
public static String toXml(Object root, Class clazz, String encoding) {
|
||||
try {
|
||||
StringWriter writer = new StringWriter();
|
||||
createMarshaller(clazz, encoding).marshal(root, writer);
|
||||
return writer.toString();
|
||||
} catch (JAXBException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Java Collection->Xml without encoding, 特别支持Root Element是Collection的情形.
|
||||
*/
|
||||
public static String toXml(Collection<?> root, String rootName, Class clazz) {
|
||||
return toXml(root, rootName, clazz, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Java Collection->Xml with encoding, 特别支持Root Element是Collection的情形.
|
||||
*/
|
||||
public static String toXml(Collection<?> root, String rootName, Class clazz, String encoding) {
|
||||
try {
|
||||
CollectionWrapper wrapper = new CollectionWrapper();
|
||||
wrapper.collection = root;
|
||||
|
||||
JAXBElement<CollectionWrapper> wrapperElement = new JAXBElement<CollectionWrapper>(new QName(rootName),
|
||||
CollectionWrapper.class, wrapper);
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
createMarshaller(clazz, encoding).marshal(wrapperElement, writer);
|
||||
|
||||
return writer.toString();
|
||||
} catch (JAXBException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Xml->Java Object.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T fromXml(String xml, Class<T> clazz) {
|
||||
try {
|
||||
StringReader reader = new StringReader(xml);
|
||||
return (T) createUnmarshaller(clazz).unmarshal(reader);
|
||||
} catch (JAXBException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建Marshaller并设定encoding(可为null).
|
||||
* 线程不安全,需要每次创建或pooling。
|
||||
*/
|
||||
public static Marshaller createMarshaller(Class clazz, String encoding) {
|
||||
try {
|
||||
JAXBContext jaxbContext = getJaxbContext(clazz);
|
||||
|
||||
Marshaller marshaller = jaxbContext.createMarshaller();
|
||||
|
||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||
|
||||
if (StringUtils.isNotBlank(encoding)) {
|
||||
marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding);
|
||||
}
|
||||
|
||||
return marshaller;
|
||||
} catch (JAXBException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建UnMarshaller.
|
||||
* 线程不安全,需要每次创建或pooling。
|
||||
*/
|
||||
public static Unmarshaller createUnmarshaller(Class clazz) {
|
||||
try {
|
||||
JAXBContext jaxbContext = getJaxbContext(clazz);
|
||||
return jaxbContext.createUnmarshaller();
|
||||
} catch (JAXBException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected static JAXBContext getJaxbContext(Class clazz) {
|
||||
if (clazz == null){
|
||||
throw new RuntimeException("'clazz' must not be null");
|
||||
}
|
||||
JAXBContext jaxbContext = jaxbContexts.get(clazz);
|
||||
if (jaxbContext == null) {
|
||||
try {
|
||||
jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class);
|
||||
jaxbContexts.putIfAbsent(clazz, jaxbContext);
|
||||
} catch (JAXBException ex) {
|
||||
// throw new HttpMessageConversionException("Could not instantiate JAXBContext for class [" + clazz
|
||||
// + "]: " + ex.getMessage(), ex);
|
||||
throw new RuntimeException("Could not instantiate JAXBContext for class [" + clazz
|
||||
+ "]: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
return jaxbContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装Root Element 是 Collection的情况.
|
||||
*/
|
||||
public static class CollectionWrapper {
|
||||
|
||||
@XmlAnyElement
|
||||
protected Collection<?> collection;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,235 +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.common.utils.excel;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.xssf.eventusermodel.XSSFReader;
|
||||
import org.apache.poi.xssf.model.SharedStringsTable;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
/**
|
||||
* Excel超大数据读取,抽象Excel2007读取器,excel2007的底层数据结构是xml文件,采用SAX的事件驱动的方法解析
|
||||
* xml,需要继承DefaultHandler,在遇到文件内容时,事件会触发,这种做法可以大大降低 内存的耗费,特别使用于大数据量的文件。
|
||||
* @version 2014-9-2
|
||||
*/
|
||||
public abstract class ExcelReader extends DefaultHandler {
|
||||
|
||||
// 共享字符串表
|
||||
private SharedStringsTable sst;
|
||||
|
||||
// 上一次的内容
|
||||
private String lastContents;
|
||||
private boolean nextIsString;
|
||||
|
||||
private int sheetIndex = -1;
|
||||
private List<String> rowList = new ArrayList<String>();
|
||||
|
||||
// 当前行
|
||||
private int curRow = 0;
|
||||
// 当前列
|
||||
private int curCol = 0;
|
||||
// 日期标志
|
||||
private boolean dateFlag;
|
||||
// 数字标志
|
||||
private boolean numberFlag;
|
||||
|
||||
private boolean isTElement;
|
||||
|
||||
/**
|
||||
* 遍历工作簿中所有的电子表格
|
||||
* @param filename
|
||||
* @throws Exception
|
||||
*/
|
||||
public void process(String filename) throws Exception {
|
||||
OPCPackage pkg = OPCPackage.open(filename);
|
||||
XSSFReader r = new XSSFReader(pkg);
|
||||
SharedStringsTable sst = r.getSharedStringsTable();
|
||||
XMLReader parser = fetchSheetParser(sst);
|
||||
Iterator<InputStream> sheets = r.getSheetsData();
|
||||
while (sheets.hasNext()) {
|
||||
curRow = 0;
|
||||
sheetIndex++;
|
||||
InputStream sheet = sheets.next();
|
||||
InputSource sheetSource = new InputSource(sheet);
|
||||
parser.parse(sheetSource);
|
||||
sheet.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 只遍历一个电子表格,其中sheetId为要遍历的sheet索引,从1开始,1-3
|
||||
* @param filename
|
||||
* @param sheetId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void process(String filename, int sheetId) throws Exception {
|
||||
OPCPackage pkg = OPCPackage.open(filename);
|
||||
XSSFReader r = new XSSFReader(pkg);
|
||||
SharedStringsTable sst = r.getSharedStringsTable();
|
||||
XMLReader parser = fetchSheetParser(sst);
|
||||
// 根据 rId# 或 rSheet# 查找sheet
|
||||
InputStream sheet2 = r.getSheet("rId" + sheetId);
|
||||
sheetIndex++;
|
||||
InputSource sheetSource = new InputSource(sheet2);
|
||||
parser.parse(sheetSource);
|
||||
sheet2.close();
|
||||
}
|
||||
|
||||
public XMLReader fetchSheetParser(SharedStringsTable sst)
|
||||
throws SAXException {
|
||||
XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
|
||||
this.sst = sst;
|
||||
parser.setContentHandler(this);
|
||||
return parser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String name,
|
||||
Attributes attributes) throws SAXException {
|
||||
|
||||
// System.out.println("startElement: " + localName + ", " + name + ", " + attributes);
|
||||
|
||||
// c => 单元格
|
||||
if ("c".equals(name)) {
|
||||
// 如果下一个元素是 SST 的索引,则将nextIsString标记为true
|
||||
String cellType = attributes.getValue("t");
|
||||
if ("s".equals(cellType)) {
|
||||
nextIsString = true;
|
||||
} else {
|
||||
nextIsString = false;
|
||||
}
|
||||
// 日期格式
|
||||
String cellDateType = attributes.getValue("s");
|
||||
if ("1".equals(cellDateType)) {
|
||||
dateFlag = true;
|
||||
} else {
|
||||
dateFlag = false;
|
||||
}
|
||||
String cellNumberType = attributes.getValue("s");
|
||||
if ("2".equals(cellNumberType)) {
|
||||
numberFlag = true;
|
||||
} else {
|
||||
numberFlag = false;
|
||||
}
|
||||
|
||||
}
|
||||
// 当元素为t时
|
||||
if ("t".equals(name)) {
|
||||
isTElement = true;
|
||||
} else {
|
||||
isTElement = false;
|
||||
}
|
||||
|
||||
// 置空
|
||||
lastContents = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String name)
|
||||
throws SAXException {
|
||||
|
||||
// System.out.println("endElement: " + localName + ", " + name);
|
||||
|
||||
// 根据SST的索引值的到单元格的真正要存储的字符串
|
||||
// 这时characters()方法可能会被调用多次
|
||||
if (nextIsString) {
|
||||
try {
|
||||
int idx = Integer.parseInt(lastContents);
|
||||
lastContents = new XSSFRichTextString(sst.getEntryAt(idx))
|
||||
.toString();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
// t元素也包含字符串
|
||||
if (isTElement) {
|
||||
String value = lastContents.trim();
|
||||
rowList.add(curCol, value);
|
||||
curCol++;
|
||||
isTElement = false;
|
||||
// v => 单元格的值,如果单元格是字符串则v标签的值为该字符串在SST中的索引
|
||||
// 将单元格内容加入rowlist中,在这之前先去掉字符串前后的空白符
|
||||
} else if ("v".equals(name)) {
|
||||
String value = lastContents.trim();
|
||||
value = "".equals(value) ? " " : value;
|
||||
try {
|
||||
// 日期格式处理
|
||||
if (dateFlag) {
|
||||
Date date = HSSFDateUtil.getJavaDate(Double.valueOf(value));
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||
value = dateFormat.format(date);
|
||||
}
|
||||
// 数字类型处理
|
||||
if (numberFlag) {
|
||||
BigDecimal bd = new BigDecimal(value);
|
||||
value = bd.setScale(3, BigDecimal.ROUND_UP).toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 转换失败仍用读出来的值
|
||||
}
|
||||
rowList.add(curCol, value);
|
||||
curCol++;
|
||||
} else {
|
||||
// 如果标签名称为 row ,这说明已到行尾,调用 optRows() 方法
|
||||
if ("row".equals(name)) {
|
||||
getRows(sheetIndex + 1, curRow, rowList);
|
||||
rowList.clear();
|
||||
curRow++;
|
||||
curCol = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length)
|
||||
throws SAXException {
|
||||
// 得到单元格内容的值
|
||||
lastContents += new String(ch, start, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行数据回调
|
||||
* @param sheetIndex
|
||||
* @param curRow
|
||||
* @param rowList
|
||||
*/
|
||||
public abstract void getRows(int sheetIndex, int curRow, List<String> rowList);
|
||||
|
||||
// /**
|
||||
// * 测试方法
|
||||
// */
|
||||
// public static void main(String[] args) throws Exception {
|
||||
//
|
||||
// String file = "E:/销售数据导入.xlsx";
|
||||
//
|
||||
// ExcelReader reader = new ExcelReader() {
|
||||
// @Override
|
||||
// public void getRows(int sheetIndex, int curRow, List<String> rowList) {
|
||||
//
|
||||
// System.out.println("Sheet:" + sheetIndex + ", Row:" + curRow + ", Data:" +rowList);
|
||||
//
|
||||
// }
|
||||
// };
|
||||
// reader.process(file, 1);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,343 +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.common.utils.excel;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.Calendar;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
/**
|
||||
* Excel超大数据写入,抽象excel2007读入器,先构建.xlsx一张模板,改写模板中的sheet.xml,
|
||||
* 使用这种方法 写入.xlsx文件,不需要太大的内存
|
||||
* @version 2014-9-2
|
||||
*/
|
||||
public abstract class ExcelWriter {
|
||||
|
||||
private SpreadsheetWriter sw;
|
||||
|
||||
/**
|
||||
* 写入电子表格的主要流程
|
||||
*
|
||||
* @param fileName
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public void process(String fileName) throws Exception {
|
||||
|
||||
// 建立工作簿和电子表格对象
|
||||
XSSFWorkbook wb = new XSSFWorkbook();
|
||||
XSSFSheet sheet = wb.createSheet("sheet1");
|
||||
|
||||
// 持有电子表格数据的xml文件名 例如 /xl/worksheets/sheet1.xml
|
||||
String sheetRef = sheet.getPackagePart().getPartName().getName();
|
||||
|
||||
// 保存模板
|
||||
FileOutputStream os = new FileOutputStream("template.xlsx");
|
||||
wb.write(os);
|
||||
os.close();
|
||||
|
||||
// 生成xml文件
|
||||
File tmp = File.createTempFile("sheet", ".xml");
|
||||
Writer fw = new FileWriter(tmp);
|
||||
sw = new SpreadsheetWriter(fw);
|
||||
generate();
|
||||
fw.close();
|
||||
|
||||
// 使用产生的数据替换模板
|
||||
File templateFile = new File("template.xlsx");
|
||||
FileOutputStream out = new FileOutputStream(fileName);
|
||||
substitute(templateFile, tmp, sheetRef.substring(1), out);
|
||||
out.close();
|
||||
// 删除文件之前调用一下垃圾回收器,否则无法删除模板文件
|
||||
System.gc();
|
||||
// 删除临时模板文件
|
||||
if (templateFile.isFile() && templateFile.exists()) {
|
||||
templateFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 类使用者应该使用此方法进行写操作
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public abstract void generate() throws Exception;
|
||||
|
||||
public void beginSheet() throws IOException {
|
||||
sw.beginSheet();
|
||||
}
|
||||
|
||||
public void insertRow(int rowNum) throws IOException {
|
||||
sw.insertRow(rowNum);
|
||||
}
|
||||
|
||||
public void createCell(int columnIndex, String value) throws IOException {
|
||||
sw.createCell(columnIndex, value, -1);
|
||||
}
|
||||
|
||||
public void createCell(int columnIndex, double value) throws IOException {
|
||||
sw.createCell(columnIndex, value, -1);
|
||||
}
|
||||
|
||||
public void endRow() throws IOException {
|
||||
sw.endRow();
|
||||
}
|
||||
|
||||
public void endSheet() throws IOException {
|
||||
sw.endSheet();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param zipfile the template file
|
||||
* @param tmpfile the XML file with the sheet data
|
||||
* @param entry the name of the sheet entry to substitute, e.g. xl/worksheets/sheet1.xml
|
||||
* @param out the stream to write the result to
|
||||
*/
|
||||
private static void substitute(File zipfile, File tmpfile, String entry,
|
||||
OutputStream out) throws IOException {
|
||||
ZipFile zip = null;
|
||||
ZipOutputStream zos = null;
|
||||
InputStream is = null;
|
||||
try{
|
||||
zip = new ZipFile(zipfile);
|
||||
zos = new ZipOutputStream(out);
|
||||
@SuppressWarnings("unchecked")
|
||||
Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries();
|
||||
while (en.hasMoreElements()) {
|
||||
ZipEntry ze = en.nextElement();
|
||||
if (!ze.getName().equals(entry)) {
|
||||
zos.putNextEntry(new ZipEntry(ze.getName()));
|
||||
InputStream is2 = null;
|
||||
try{
|
||||
is2 = zip.getInputStream(ze);
|
||||
copyStream(is2, zos);
|
||||
}finally {
|
||||
if (is2 != null){
|
||||
is2.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
zos.putNextEntry(new ZipEntry(entry));
|
||||
is = new FileInputStream(tmpfile);
|
||||
copyStream(is, zos);
|
||||
}finally {
|
||||
if (is != null){
|
||||
is.close();
|
||||
}
|
||||
if (zos != null){
|
||||
zos.close();
|
||||
}
|
||||
if (zip != null){
|
||||
zip.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyStream(InputStream in, OutputStream out)
|
||||
throws IOException {
|
||||
byte[] chunk = new byte[1024];
|
||||
int count;
|
||||
while ((count = in.read(chunk)) >= 0) {
|
||||
out.write(chunk, 0, count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 在写入器中写入电子表格
|
||||
*
|
||||
*/
|
||||
public static class SpreadsheetWriter {
|
||||
private final Writer _out;
|
||||
private int _rownum;
|
||||
private static String LINE_SEPARATOR = System
|
||||
.getProperty("line.separator");
|
||||
|
||||
public SpreadsheetWriter(Writer out) {
|
||||
_out = out;
|
||||
}
|
||||
|
||||
public void beginSheet() throws IOException {
|
||||
_out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||
+ "<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
|
||||
_out.write("<sheetData>" + LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
public void endSheet() throws IOException {
|
||||
_out.write("</sheetData>");
|
||||
_out.write("</worksheet>");
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入新行
|
||||
*
|
||||
* @param rownum
|
||||
* 以0开始
|
||||
*/
|
||||
public void insertRow(int rownum) throws IOException {
|
||||
_out.write("<row r=\"" + (rownum + 1) + "\">" + LINE_SEPARATOR);
|
||||
this._rownum = rownum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入行结束标志
|
||||
*/
|
||||
public void endRow() throws IOException {
|
||||
_out.write("</row>" + LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入新列
|
||||
*
|
||||
* @param columnIndex
|
||||
* @param value
|
||||
* @param styleIndex
|
||||
* @throws IOException
|
||||
*/
|
||||
public void createCell(int columnIndex, String value, int styleIndex)
|
||||
throws IOException {
|
||||
String ref = new CellReference(_rownum, columnIndex)
|
||||
.formatAsString();
|
||||
_out.write("<c r=\"" + ref + "\" t=\"inlineStr\"");
|
||||
if (styleIndex != -1) {
|
||||
_out.write(" s=\"" + styleIndex + "\"");
|
||||
}
|
||||
_out.write(">");
|
||||
_out.write("<is><t>" + encoderXML(value) + "</t></is>");
|
||||
_out.write("</c>");
|
||||
}
|
||||
|
||||
public void createCell(int columnIndex, String value)
|
||||
throws IOException {
|
||||
createCell(columnIndex, value, -1);
|
||||
}
|
||||
|
||||
public void createCell(int columnIndex, double value, int styleIndex)
|
||||
throws IOException {
|
||||
String ref = new CellReference(_rownum, columnIndex)
|
||||
.formatAsString();
|
||||
_out.write("<c r=\"" + ref + "\" t=\"n\"");
|
||||
if (styleIndex != -1) {
|
||||
_out.write(" s=\"" + styleIndex + "\"");
|
||||
}
|
||||
_out.write(">");
|
||||
_out.write("<v>" + value + "</v>");
|
||||
_out.write("</c>");
|
||||
}
|
||||
|
||||
public void createCell(int columnIndex, double value)
|
||||
throws IOException {
|
||||
createCell(columnIndex, value, -1);
|
||||
}
|
||||
|
||||
public void createCell(int columnIndex, Calendar value, int styleIndex)
|
||||
throws IOException {
|
||||
createCell(columnIndex, DateUtil.getExcelDate(value, false),
|
||||
styleIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// XML Encode
|
||||
private static final String[] xmlCode = new String[256];
|
||||
|
||||
static {
|
||||
// Special characters
|
||||
xmlCode['\''] = "'";
|
||||
xmlCode['\"'] = "\""; // double quote
|
||||
xmlCode['&'] = "&"; // ampersand
|
||||
xmlCode['<'] = "<"; // lower than
|
||||
xmlCode['>'] = ">"; // greater than
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Encode the given text into xml.
|
||||
* </p>
|
||||
*
|
||||
* @param string the text to encode
|
||||
* @return the encoded string
|
||||
*/
|
||||
public static String encoderXML(String string) {
|
||||
if (string == null) {
|
||||
return "";
|
||||
}
|
||||
int n = string.length();
|
||||
char character;
|
||||
String xmlchar;
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
// loop over all the characters of the String.
|
||||
for (int i = 0; i < n; i++) {
|
||||
character = string.charAt(i);
|
||||
// the xmlcode of these characters are added to a StringBuffer
|
||||
// one by one
|
||||
try {
|
||||
xmlchar = xmlCode[character];
|
||||
if (xmlchar == null) {
|
||||
buffer.append(character);
|
||||
} else {
|
||||
buffer.append(xmlCode[character]);
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException aioobe) {
|
||||
buffer.append(character);
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 测试方法
|
||||
// */
|
||||
// public static void main(String[] args) throws Exception {
|
||||
//
|
||||
// String file = "E:/测试导出数据.xlsx";
|
||||
//
|
||||
// ExcelWriter writer = new ExcelWriter() {
|
||||
// @Override
|
||||
// public void generate() throws Exception {
|
||||
//
|
||||
// // 电子表格开始
|
||||
// this.beginSheet();
|
||||
//
|
||||
// for (int rownum = 0; rownum < 100; rownum++) {
|
||||
// // 插入新行
|
||||
// this.insertRow(rownum);
|
||||
//
|
||||
// // 建立新单元格,索引值从0开始,表示第一列
|
||||
// this.createCell(0, "第 " + rownum + " 行");
|
||||
// this.createCell(1, 34343.123456789);
|
||||
// this.createCell(2, "23.67%");
|
||||
// this.createCell(3, "12:12:23");
|
||||
// this.createCell(4, "2014-10-11 12:12:23");
|
||||
// this.createCell(5, "true");
|
||||
// this.createCell(6, "false");
|
||||
//
|
||||
// // 结束行
|
||||
// this.endRow();
|
||||
// }
|
||||
//
|
||||
// // 电子表格结束
|
||||
// this.endSheet();
|
||||
// }
|
||||
// };
|
||||
// writer.process(file);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<version>4.7.0-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import com.jeesite.modules.cms.entity.Article;
|
||||
@MyBatisDao
|
||||
public interface ArticleDao extends CrudDao<Article> {
|
||||
|
||||
public long updateExpiredWeight(Article article);
|
||||
long updateExpiredWeight(Article article);
|
||||
|
||||
public long updateHitsAddOne(String id);
|
||||
long updateHitsAddOne(String id);
|
||||
|
||||
}
|
||||
@@ -4,13 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jeesite.common.entity.BaseEntity;
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
@@ -20,6 +13,11 @@ import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文章表Entity
|
||||
* @author 长春叭哥、ThinkGem
|
||||
@@ -45,7 +43,12 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
@Column(name = "word_count", attrName = "wordCount", label = "字数", comment = "字数(不包含html)"),
|
||||
@Column(name = "custom_content_view", attrName = "customContentView", label = "自定义内容视图"),
|
||||
@Column(name = "view_config", attrName = "viewConfig", label = "视图配置"),
|
||||
@Column(includeEntity = DataEntity.class),
|
||||
@Column(name="status", attrName="status", label="状态", isUpdate=false),
|
||||
@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=true),
|
||||
@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
|
||||
@Column(name="update_by", attrName="updateBy", label="更新者", isUpdate=true),
|
||||
@Column(name="update_date", attrName="updateDate", label="更新时间", isUpdate=true, isQuery=false),
|
||||
@Column(name="remarks", attrName="remarks", label="备注信息", queryType=QueryType.LIKE),
|
||||
@Column(includeEntity = BaseEntity.class),
|
||||
}, joinTable = {
|
||||
@JoinTable(entity = Category.class, alias = "c",
|
||||
@@ -83,12 +86,13 @@ public class Article extends DataEntity<Article> {
|
||||
private Integer wordCount; // 字数(不包含html)
|
||||
private String customContentView; // 自定义内容视图
|
||||
private String viewConfig; // 视图配置
|
||||
|
||||
private ArticleData articleData; //文章副表
|
||||
private Boolean isQueryArticleData; // 是否查询文章内容
|
||||
|
||||
private Date beginDate; // 开始时间
|
||||
private Date endDate; // 结束时间
|
||||
|
||||
private Boolean isQueryArticleData; // 是否查询文章内容
|
||||
|
||||
public Article() {
|
||||
super();
|
||||
//this.weight = 0;
|
||||
@@ -223,8 +227,6 @@ public class Article extends DataEntity<Article> {
|
||||
this.hits = hits;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer getHitsPlus() {
|
||||
return hitsPlus;
|
||||
}
|
||||
@@ -275,6 +277,18 @@ public class Article extends DataEntity<Article> {
|
||||
this.articleData = articleData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否查询文章内容
|
||||
* @return
|
||||
*/
|
||||
public Boolean getIsQueryArticleData() {
|
||||
return isQueryArticleData;
|
||||
}
|
||||
|
||||
public void setIsQueryArticleData(Boolean isQueryArticleData) {
|
||||
this.isQueryArticleData = isQueryArticleData;
|
||||
}
|
||||
|
||||
public Date getBeginDate() {
|
||||
return beginDate;
|
||||
}
|
||||
@@ -291,20 +305,6 @@ public class Article extends DataEntity<Article> {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否查询文章内容
|
||||
* @return
|
||||
*/
|
||||
public Boolean getIsQueryArticleData() {
|
||||
return isQueryArticleData;
|
||||
}
|
||||
|
||||
public void setIsQueryArticleData(Boolean isQueryArticleData) {
|
||||
this.isQueryArticleData = isQueryArticleData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getUrl() {
|
||||
return CmsUtils.getUrlDynamic(this);
|
||||
}
|
||||
|
||||
@@ -4,19 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
@@ -31,8 +18,19 @@ import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 文章表Service
|
||||
@@ -81,7 +79,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param article 查询条件
|
||||
* @param article.page 分页对象
|
||||
* @param article page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -4,16 +4,18 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.jeesite.modules.cms.entity.FileTemplete;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.cms.utils.FileTempleteUtils;
|
||||
import com.jeesite.modules.sys.entity.DictData;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模版文件Service
|
||||
|
||||
@@ -4,14 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.utils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import com.jeesite.common.cache.CacheUtils;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
@@ -26,6 +18,12 @@ import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.ArticleService;
|
||||
import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.SiteService;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* CmsUtils
|
||||
@@ -191,7 +189,7 @@ public class CmsUtils {
|
||||
* @param siteCode 站点编号
|
||||
* @param categoryCode 分类编号
|
||||
* @param number 获取数目
|
||||
* @param param 预留参数,例: key1:'value1', key2:'value2' ...<br>
|
||||
* @param params 预留参数,例: key1:'value1', key2:'value2' ...<br>
|
||||
* posid : 推荐位(1:首页焦点图;2:栏目页文章推荐;)<br>
|
||||
* image : 文章图片(1:有图片的文章)<br>
|
||||
* isQueryArticleData : 是否查询文章详情信息,查询会影响效率<br>
|
||||
|
||||
@@ -4,22 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
@@ -33,6 +17,20 @@ 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.utils.UserUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章表Controller
|
||||
|
||||
@@ -4,20 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.collect.MapUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
@@ -33,6 +19,20 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.entity.Office;
|
||||
import com.jeesite.modules.sys.utils.DictUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 栏目表Controller
|
||||
@@ -252,7 +252,7 @@ public class CategoryController extends BaseController {
|
||||
* @param isShowCode 是否显示编码(true or 1:显示在左侧;2:显示在右侧;false or null:不显示)
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cms:category:view")
|
||||
@RequiresPermissions(value = {"cms:category:view", "cms:article:view"}, logical = Logical.OR)
|
||||
@RequestMapping(value = "treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeData(String siteCode, String module, String excludeCode, Boolean isAll, String isShowCode) {
|
||||
|
||||
@@ -4,37 +4,27 @@
|
||||
*/
|
||||
package com.jeesite.modules.cmsfront.web;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.ObjectUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Article;
|
||||
import com.jeesite.modules.cms.entity.ArticleData;
|
||||
import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.entity.Comment;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.entity.*;
|
||||
import com.jeesite.modules.cms.service.ArticleService;
|
||||
import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.CommentService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.utils.ValidCodeUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 网站Controller
|
||||
@@ -310,8 +300,8 @@ public class FrontController extends BaseController {
|
||||
/**
|
||||
* 内容评论
|
||||
*/
|
||||
@RequestMapping(value = "comment", method = RequestMethod.GET)
|
||||
public String comment(Comment comment, String theme, HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestMapping(value = "comment-{theme}", method = RequestMethod.GET)
|
||||
public String comment(Comment comment, @PathVariable String theme, HttpServletRequest request, HttpServletResponse response,
|
||||
Model model) {
|
||||
Page<Comment> page = new Page<Comment>(request, response);
|
||||
Comment c = new Comment();
|
||||
|
||||
@@ -13,4 +13,8 @@
|
||||
4.3.3
|
||||
4.4.0
|
||||
4.4.1
|
||||
4.5.0
|
||||
4.5.0
|
||||
4.6.0
|
||||
4.6.1
|
||||
4.6.2
|
||||
4.7.0
|
||||
@@ -2,15 +2,23 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jeesite.modules.cms.dao.ArticleDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="CmsArticle">
|
||||
<!-- 查询数据 -->
|
||||
<select id="findList" resultType="Article">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
<if test="isQueryArticleData">,
|
||||
ad.content AS "articleData.content",
|
||||
ad.relation AS "articleData.relation",
|
||||
ad.is_can_comment AS "articleData.isCanComment"
|
||||
</if>
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<if test="isQueryArticleData">
|
||||
JOIN ${_prefix}cms_article_data ad ON ad.id = a.id
|
||||
</if>
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
</select>
|
||||
|
||||
<update id="updateExpiredWeight">
|
||||
update ${_prefix}cms_article SET weight = 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
body{padding-top:50px;font-size:14px;}
|
||||
body{padding-top:50px;font-size:15px;background:#f7f8f9;}
|
||||
body>.navbar{-webkit-transition:background-color .3s ease-in;transition:background-color .3s ease-in}
|
||||
@media (min-width:768px){
|
||||
body>.navbar-transparent{background-color:transparent}
|
||||
@@ -51,20 +51,34 @@ footer p{clear:left;margin-bottom:0}
|
||||
#banner{margin-bottom:2em;text-align:center}
|
||||
}
|
||||
|
||||
.jumbotron {background:#f1f1f1;margin:48px auto;}
|
||||
.panel-title small .more {padding-top:4px;}
|
||||
.breadcrumb {border-radius:8px;background:transparent;padding:0;margin:2px 15px 21px 15px;}
|
||||
|
||||
.jumbotron {background:#fff;margin:48px auto;border:1px solid #ededed;box-shadow:0 1px 4px 0 rgb(0 0 0 / 5%);border-radius:8px!important;}
|
||||
.jumbotron h1, .jumbotron .h1 {font-size:43px;margin: 0 0 30px;}
|
||||
.jumbotron .btn-sm {font-size:17px;}
|
||||
|
||||
.panel {border-radius:8px}
|
||||
.panel-heading {border-radius:8px 8px 0 0}
|
||||
.panel-footer {border-radius:0 0 8px 8px}
|
||||
.panel-title {font-size:18px;}
|
||||
.panel-title small .more {padding-top:4px;font-size:14px}
|
||||
|
||||
.nav-search {margin-top:9px;}
|
||||
.nav-search .form-control {height:30px;padding:5px;}
|
||||
.nav-search .btn {height:31px;padding:5px 10px;}
|
||||
|
||||
.main {background:#fff;box-shadow:0 1px 4px 0 rgb(0 0 0 / 8%);border-radius:0 0 8px 8px;padding:20px 10px;margin:0 -1px}
|
||||
.main-list {border-radius:8px;}
|
||||
.main-right::before {content:'';border-left:1px solid #e6e6e6;position:absolute;height:100%;left:-20px;}
|
||||
|
||||
.article-list {padding:5px;margin:0;}
|
||||
.article-list li {list-style:none;padding:8px 0;}
|
||||
|
||||
.article-title {color:#555555;font-size:20px;text-align:center;border-bottom:1px solid #ddd;padding:15px 20px 20px 20px;margin-bottom:30px;}
|
||||
.article-info {border-top:1px solid #ddd;padding:10px;margin:25px 0 0;}
|
||||
.article-desc {padding:8px 10px 8px;margin:10px 20px 20px 35px;font-size:13px;}
|
||||
.article-content {padding-top:10px;}
|
||||
.article-view {border-radius:8px;padding:30px 50px;}
|
||||
.article-title {color:#333;font-size:30px;text-align:center;border-bottom:1px solid #ddd;padding:15px 20px 20px 20px;margin-bottom:30px;}
|
||||
.article-info {border-top:1px solid #ddd;padding:10px;margin:30px 0 0;}
|
||||
.article-desc {padding:8px 10px 8px;margin:10px 20px 20px 35px;font-size:14px;}
|
||||
.article-content {padding-top:20px;}
|
||||
|
||||
.pagination {margin:8px 0;display:block;/* text-align:center; */font-size:13px;} /* .pagination .controls a{border:0;} */
|
||||
.pagination>li>a, .pagination>li>span {min-width:37px;text-align:center;padding:6px;border:1px solid #ddd;background:transparent;/* border-radius:3px; */}
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<!--<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4">${text('推荐位')}:</label>
|
||||
<div class="col-sm-8">
|
||||
@@ -162,14 +162,14 @@
|
||||
<#form:select path="state" dictType="sys_status" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="${text('可修改发布时间,不填则使用当前时间')}">
|
||||
${text('发布时间')}: <i class="fa icon-question"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="createDate" readonly="true" maxlength="20" class="form-control Wdate"
|
||||
dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
|
||||
<#form:input path="createDate" readonly="true" maxlength="20" class="form-control laydate"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -208,7 +208,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<#form:extend collapsed="true" />
|
||||
<#form:extend collapsed="true" pathPrefix="articleData"/>
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
@@ -129,7 +129,7 @@ $('#dataGrid').dataGrid({
|
||||
}},
|
||||
{header:'${text('操作')}', name:'actions', width:120, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
//<% if(hasPermi('cms:comment:edit')){ %>
|
||||
<% 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> ');
|
||||
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> ');
|
||||
@@ -138,7 +138,7 @@ $('#dataGrid').dataGrid({
|
||||
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> ');
|
||||
}
|
||||
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> ');
|
||||
//<% } %>
|
||||
<% } %>
|
||||
return actions.join('');
|
||||
}}
|
||||
],
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
<meta content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
|
||||
<title>${(isNotBlank(title!) ? title! + ' - ' : '') + @Global.getConfig('productName')}</title>
|
||||
<script src="${ctxPath}/global.min.js?ctx=${ctx}"></script>
|
||||
<script src="${ctxStatic}/jquery/jquery-1.12.4.min.js"></script>
|
||||
<script src="${ctxStatic}/jquery/jquery-migrate-1.4.1.min.js"></script>
|
||||
<script src="${ctxStatic}/jquery/jquery-3.5.0.min.js"></script>
|
||||
<script src="${ctxStatic}/jquery/jquery-migrate-3.2.0.min.js"></script>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
href="${ctx}/list-${c.categoryCode}">${c.categoryName}</a></li>
|
||||
</#html:if>
|
||||
</#html:foreach>
|
||||
<li><a href="http://jeesite.com" target="_blank">官方网站</a></li>
|
||||
<li><a href="http://s.jeesite.com" target="_blank">技术服务</a></li>
|
||||
<li id="siteSwitch" class="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" title="站点">子站切换 <span class="caret"></span></a>
|
||||
@@ -36,7 +35,7 @@
|
||||
</ul>
|
||||
</li> -->
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<ul class="nav navbar-nav navbar-right hidden-xs hidden-sm">
|
||||
<form class="navbar-form navbar-left nav-search" action="${ctx}/search">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="全站搜索...">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% layout('layouts/default.html', {title: '列表页面', libs: []}){ %>
|
||||
<% include('include/banner.html'){} %>
|
||||
<div class="row">
|
||||
<div class="col-xs-2">
|
||||
<div class="row main main-list">
|
||||
<div class="col-sm-2 col-xs-12 main-left">
|
||||
<h4>栏目列表</h4>
|
||||
<ul class="article-list">
|
||||
<#html:foreach items="${qmark(categoryList! != null, categoryList!, categoryList(site.siteCode, category.parentCode, 50, ''))}" var="category,status">
|
||||
@@ -9,7 +9,7 @@
|
||||
</#html:foreach>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<div class="col-sm-10 col-xs-12 main-right">
|
||||
<h4>${category.categoryName}</h4>
|
||||
<#html:if test="${page! != null && category.moduleType == 'article'}">
|
||||
<ul class="article-list">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% layout('layouts/default.html', {title: '列表页面', libs: []}){ %>
|
||||
<% include('include/banner.html'){} %>
|
||||
<div class="row">
|
||||
<div class="col-xs-2">
|
||||
<div class="row main main-list">
|
||||
<div class="col-sm-2 col-xs-12 main-left">
|
||||
<h4>栏目列表</h4>
|
||||
<ul class="article-list">
|
||||
<#html:foreach items="${qmark(categoryList! != null, categoryList!, categoryList(site.siteCode, category.parentCode, 50, ''))}" var="category,status">
|
||||
@@ -9,7 +9,7 @@
|
||||
</#html:foreach>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<div class="col-sm-10 col-xs-12 main-right">
|
||||
<h4>${category.categoryName}</h4>
|
||||
<div class="row"><br/>
|
||||
<#html:foreach items="${qmark(categoryList! != null, categoryList!, [])}" var="category,status">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% layout('layouts/default.html', {title: '站点地图', libs: []}){ %>
|
||||
<style type="text/css">
|
||||
h2 {padding-left:10px;}
|
||||
h2 {padding-left:10px;text-align:center;}
|
||||
h3.title {padding:5px 5px;margin:15px 8px 10px;}
|
||||
dl.map{border:1px solid #ddd;border-top:0;margin:10px 8px 8px;}
|
||||
dl.map dt{border-top:1px solid #ddd;padding:10px 15px;} dl.map dd{margin:20px 30px 30px;}
|
||||
@@ -8,7 +8,7 @@
|
||||
dl.map span:hover{border:1px solid #bbb;background:#f1f1f1;}
|
||||
dl.map span a:hover{text-decoration:none;color:#333;}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="row main">
|
||||
<h2>站点地图</h2>
|
||||
<#html:foreach items="${siteList()}" var="site">
|
||||
<h3 class="title breadcrumb">${site.siteName}</h3>
|
||||
|
||||
@@ -37,7 +37,7 @@ $(function(){
|
||||
laydate.render({elem:'#ed', type:'date', format:'yyyy-MM-dd'});
|
||||
});
|
||||
</script>
|
||||
<div class="row">
|
||||
<div class="row main">
|
||||
<form id="searchForm" method="get" class="search">
|
||||
<input type="hidden" id="pageNo" name="pageNo" value="${page.pageNo!}"/>
|
||||
<input type="hidden" id="t" name="t" value="${isNotBlank(t)?t:'article'}"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% layout('layouts/default.html', {title:'文章查看',libs: []}){ %>
|
||||
<% include('include/banner.html'){} %>
|
||||
<div class="row article-view">
|
||||
<div class="row main article-view">
|
||||
<h3 class="article-title">${article.title}</h3>
|
||||
<blockquote class="article-desc">摘要:${article.description}</blockquote>
|
||||
<div class="article-content uparse">${article.articleData.content}</div>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<version>4.7.0-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
<!-- MySQL -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- Oracle 11g -->
|
||||
|
||||
@@ -4,19 +4,19 @@
|
||||
*/
|
||||
package com.jeesite.common.shiro.filter;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.jeesite.common.lang.ExceptionUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.shiro.realm.BaseAuthorizingRealm;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
|
||||
import com.jeesite.common.lang.ExceptionUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.shiro.realm.BaseAuthorizingRealm;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* CAS过滤器
|
||||
@@ -25,12 +25,15 @@ import com.jeesite.common.shiro.realm.BaseAuthorizingRealm;
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CasFilter extends org.apache.shiro.cas.CasFilter {
|
||||
|
||||
|
||||
private BaseAuthorizingRealm authorizingRealm;
|
||||
|
||||
/**
|
||||
* 登录成功调用事件
|
||||
*/
|
||||
@Override
|
||||
protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
|
||||
authorizingRealm.onLoginSuccess(UserUtils.getLoginInfo(), (HttpServletRequest)request);
|
||||
return FormFilter.onLoginSuccess((HttpServletRequest)request, (HttpServletResponse)response);
|
||||
}
|
||||
|
||||
@@ -66,7 +69,7 @@ public class CasFilter extends org.apache.shiro.cas.CasFilter {
|
||||
}
|
||||
|
||||
public void setAuthorizingRealm(BaseAuthorizingRealm authorizingRealm) {
|
||||
|
||||
this.authorizingRealm = authorizingRealm;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.common.shiro.filter;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* 内部系统访问过滤器
|
||||
* @author ThinkGem
|
||||
@@ -29,7 +28,7 @@ public class InnerFilter extends AccessControlFilter {
|
||||
"shiro.innerFilterAllowRemoteAddrs", "127.0.0.1"), ",");
|
||||
}
|
||||
if (prefixes != null && request instanceof HttpServletRequest){
|
||||
String ip = ((HttpServletRequest)request).getRemoteAddr();
|
||||
String ip = request.getRemoteAddr();
|
||||
for (String prefix : prefixes){
|
||||
result = StringUtils.startsWithIgnoreCase(ip, StringUtils.trim(prefix));
|
||||
if (result){
|
||||
|
||||
@@ -4,22 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.common.shiro.realm;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.ValidationException;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.cas.CasToken;
|
||||
import org.jasig.cas.client.authentication.AttributePrincipal;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.TicketValidationException;
|
||||
import org.jasig.cas.client.validation.TicketValidator;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
import com.jeesite.common.codec.EncodeUtils;
|
||||
import com.jeesite.common.collect.MapUtils;
|
||||
import com.jeesite.common.lang.ObjectUtils;
|
||||
@@ -35,6 +19,20 @@ import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import com.jeesite.modules.sys.service.UserService;
|
||||
import com.jeesite.modules.sys.utils.LogUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.cas.CasToken;
|
||||
import org.jasig.cas.client.authentication.AttributePrincipal;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.TicketValidationException;
|
||||
import org.jasig.cas.client.validation.TicketValidator;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.ValidationException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 系统认证授权实现类
|
||||
@@ -181,20 +179,11 @@ public class CasAuthorizingRealm extends BaseAuthorizingRealm {
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
super.onLoginSuccess(loginInfo, request);
|
||||
|
||||
// 单点登录登出句柄(登录时注入session),在这之前必须获取下授权信息
|
||||
String ticket = loginInfo.getParam("ticket");
|
||||
casOutHandler.recordSession(request, ticket);
|
||||
//System.out.print("__sid: "+request.getSession().getId());
|
||||
//System.out.println(" == "+UserUtils.getSession().getId());
|
||||
|
||||
// 更新登录IP、时间、会话ID等
|
||||
User user = UserUtils.get(loginInfo.getId());
|
||||
getUserService().updateUserLoginInfo(user);
|
||||
|
||||
// 记录用户登录日志
|
||||
LogUtils.saveLog(user, ServletUtils.getRequest(), "系统登录", Log.TYPE_LOGIN_LOGOUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,6 +72,13 @@ public class EmpUserServiceSupport extends CrudService<EmpUserDao, EmpUser>
|
||||
*/
|
||||
@Override
|
||||
public void addDataScopeFilter(EmpUser empUser, String ctrlPermi) {
|
||||
// String defaultRoleCodes = Global.getConfig(
|
||||
// "sys.user.defaultRoleCodes." + empUser.getCurrentUser().getUserType());
|
||||
// if (StringUtils.isNotBlank(defaultRoleCodes)) {
|
||||
// empUser.getCurrentUser().getRoleList().addAll(Arrays
|
||||
// .stream(StringUtils.split(defaultRoleCodes,','))
|
||||
// .map(roleCode -> RoleUtils.get(roleCode)).collect(Collectors.toList()));
|
||||
// }
|
||||
empUser.getSqlMap().getDataScope().addFilter("dsfOffice",
|
||||
"Office", "e.office_code", "a.create_by", ctrlPermi, "office_user");
|
||||
if (StringUtils.isNotBlank(EmpUtils.getCompany().getCompanyCode())){
|
||||
|
||||
@@ -55,7 +55,11 @@ public class EmpUtils {
|
||||
*/
|
||||
public static Employee get(User user){
|
||||
if (user != null && User.USER_TYPE_EMPLOYEE.equals(user.getUserType())){
|
||||
return user.getRefObj();
|
||||
Employee employee = user.getRefObj();
|
||||
if (employee == null) {
|
||||
employee = Static.employeeService.get(user.getRefCode());
|
||||
}
|
||||
return employee;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ DIRECT_BYTE_OUTPUT = FALSE
|
||||
HTML_TAG_SUPPORT = true
|
||||
HTML_TAG_FLAG = #
|
||||
HTML_TAG_BINDING_ATTRIBUTE = var,export
|
||||
HTML_TAG_ATTR_CONVERT=org.beetl.core.text.DefaultAttributeNameConvert
|
||||
HTML_TAG_ATTR_CONVERT=com.jeesite.common.beetl.text.BlankAttributeNameConvert
|
||||
NATIVE_CALL = TRUE
|
||||
TEMPLATE_CHARSET = UTF-8
|
||||
#ERROR_HANDLER = org.beetl.core.ConsoleErrorHandler
|
||||
|
||||
@@ -659,7 +659,7 @@ file:
|
||||
# 设置允许上传的文件后缀(全局设置)
|
||||
imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,
|
||||
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,.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,
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param ${className} 查询条件
|
||||
* @param ${className}.page 分页对象
|
||||
* @param ${className} page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.jeesite.modules.bpm.entity.BpmTreeEntity;
|
||||
import com.jeesite.modules.bpm.entity.BpmEntity;
|
||||
<% } %>
|
||||
<% } %>
|
||||
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
|
||||
<% if(!table.parentExists && toBoolean(table.optionMap['isImportExport'])){ %>
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
@@ -215,7 +215,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
||||
// 生成构造方法
|
||||
%>
|
||||
|
||||
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
|
||||
<% if(!table.parentExists && toBoolean(table.optionMap['isImportExport'])){ %>
|
||||
@ExcelFields({
|
||||
<% for(c in table.columnList){ if(c.optionMap['isImportExport'] == @Global.YES){ %>
|
||||
@ExcelField(title="${c.columnLabel}", attrName="${c.attrName}"${
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param ${className} 查询条件
|
||||
* @param ${className}.page 分页对象
|
||||
* @param ${className} page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<% } %>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">\${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">\${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">\${text('重置')}</button>
|
||||
</div>
|
||||
</${'#'}form:form>
|
||||
<% /* 查询表单 end // 此行是为了去除空行 */ %>
|
||||
@@ -31,7 +31,7 @@ cd app
|
||||
jar -xvf web.war
|
||||
rm web.war
|
||||
cd WEB-INF
|
||||
exec ./startup.sh
|
||||
sh ./startup.sh
|
||||
]]>
|
||||
</content>
|
||||
</template>
|
||||
@@ -70,7 +70,7 @@ spring:
|
||||
server-addr: 127.0.0.1:8848
|
||||
file-extension: yml
|
||||
group: jeesite-cloud-yml
|
||||
ext-config:
|
||||
extension-configs:
|
||||
- data-id: application.yml
|
||||
group: jeesite-cloud-yml
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Query'}Ser
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param ${className} 查询条件
|
||||
* @param ${className}.page 分页对象
|
||||
* @param ${className} page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,10 @@ if (isBlank(message)){
|
||||
message = message + '☆ ' + text(e.defaultMessage) + ' (' + e.objectName + ')<br/>';
|
||||
}
|
||||
for (var e in ex.fieldErrors){
|
||||
if (@StringUtils.inString(e.field, 'pageNo', 'pageSize')){
|
||||
message = text('提交的分页参数,超出有效范围');
|
||||
break;
|
||||
}
|
||||
message = message + '☆ ' + text(e.defaultMessage) + ' (' + e.field + ')<br/>';
|
||||
}
|
||||
}else if (type.fullName(ex) == 'javax.validation.ConstraintViolationException'){
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
<ul class="content-info">
|
||||
<li><i class="fa fa-user"></i> 发送者:${msgInner.sendUserName}</li>
|
||||
<li><i class="fa fa-calendar"></i> 发送时间:${msgInner.sendDate, 'yyyy-MM-dd HH:mm'}</li>
|
||||
<li><i class="fa icon-envelope-letter"></i> 读取时间:${msgInner.sendDate, 'yyyy-MM-dd HH:mm'}</li>
|
||||
<li><i class="fa fa-bookmark-o"></i> 等级:${@DictUtils.getDictLabel('msg_inner_content_level', msgInner.contentLevel, '普通')}</li>
|
||||
<li><i class="fa fa-bookmark-o"></i> 类型:${@DictUtils.getDictLabel('msg_inner_content_type', msgInner.contentType, '其它')}</li>
|
||||
</ul>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">查询</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">重置</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">重置</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -732,7 +732,9 @@ $(function(){
|
||||
var footerHeight = $('.main-footer').outerHeight() || 0;
|
||||
var windowHeight = $(window).height();
|
||||
$('.content').css('min-height', windowHeight - footerHeight);
|
||||
myChart1.resize(); myChart2.resize(); myChart3.resize();
|
||||
if(myChart1) myChart1.resize();
|
||||
if(myChart2) myChart2.resize();
|
||||
if(myChart3) myChart3.resize();
|
||||
}).resize();
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
$(window).resize();
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
© ${@DateUtils.getYear()} ${@Global.getConfig('productName')} - Powered By <a
|
||||
id="loginKey" data-key="${@Global.getConfig('shiro.loginSubmit.secretKey')}"
|
||||
href="http://jeesite.com" target="_blank">JeeSite ${@Global.getProperty('jeesiteVersion')}</a>
|
||||
- <a href="https://gitee.com/thinkgem/jeesite-client" target="_blank">客户端下载</a>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<!-- <div class="form-row"></div> -->
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
<button type="button" class="btn btn-default btn-sm btnFormMore">${text('更多')}<i class="fa fa-angle-double-down"></i></button>
|
||||
</div>
|
||||
<div class="form-more">
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">查询</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">重置</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">重置</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<div class="col-xs-10 p0 pr10">
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<div class="row">
|
||||
|
||||
@@ -4,34 +4,24 @@
|
||||
*/
|
||||
package com.jeesite.test;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.DataScope;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.idgen.IdGen;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
||||
import com.jeesite.modules.file.dao.FileUploadDao;
|
||||
import com.jeesite.modules.file.entity.FileUpload;
|
||||
import com.jeesite.modules.sys.dao.*;
|
||||
import com.jeesite.modules.sys.entity.*;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.DataScope;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
||||
import com.jeesite.modules.file.dao.FileUploadDao;
|
||||
import com.jeesite.modules.file.entity.FileUpload;
|
||||
import com.jeesite.modules.sys.dao.AreaDao;
|
||||
import com.jeesite.modules.sys.dao.CompanyDao;
|
||||
import com.jeesite.modules.sys.dao.ConfigDao;
|
||||
import com.jeesite.modules.sys.dao.DictDataDao;
|
||||
import com.jeesite.modules.sys.dao.EmpUserDao;
|
||||
import com.jeesite.modules.sys.dao.UserDao;
|
||||
import com.jeesite.modules.sys.entity.Area;
|
||||
import com.jeesite.modules.sys.entity.Company;
|
||||
import com.jeesite.modules.sys.entity.Config;
|
||||
import com.jeesite.modules.sys.entity.DictData;
|
||||
import com.jeesite.modules.sys.entity.EmpUser;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper测试
|
||||
@@ -56,67 +46,110 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
private FileUploadDao fileUploadDao;
|
||||
@Autowired
|
||||
private EmpUserDao empUserDao;
|
||||
|
||||
|
||||
@Test
|
||||
public void testTableAnnotation() throws Exception{
|
||||
try{
|
||||
|
||||
System.out.println("============ 插入和批量插入测试 ============");
|
||||
|
||||
System.out.println("============ 插入测试 ============");
|
||||
Config config = new Config();
|
||||
config.setId("1");
|
||||
config.setConfigKey("test");
|
||||
config.setConfigName("test");
|
||||
config.setConfigValue("1");
|
||||
config.setIsSys("1");
|
||||
long configInsertNum = configDao.insert(config);
|
||||
Assert.assertEquals("configDao.insert", configInsertNum , 1);
|
||||
Config configInsertRes = configDao.get(config);
|
||||
Assert.assertEquals("configDao.insert result", configInsertRes.getId() , "1");
|
||||
|
||||
System.out.println("============ 批量插入测试 ============");
|
||||
Config config2 = (Config)config.clone();
|
||||
config2.setId("2");
|
||||
config.setConfigKey("test2");
|
||||
config2.setConfigKey("test2");
|
||||
Config config3 = (Config)config.clone();
|
||||
config3.setId("3");
|
||||
config.setConfigKey("test3");
|
||||
System.out.println(configDao.insert(config));
|
||||
System.out.println(configDao.insertBatch(ListUtils.newArrayList(config2, config3)));
|
||||
|
||||
System.out.println("============ 更新测试 ============");
|
||||
config3.setConfigKey("test3");
|
||||
long configinsertBatchNum = configDao.insertBatch(ListUtils.newArrayList(config2, config3));
|
||||
Assert.assertEquals("configDao.insertBatch", configinsertBatchNum , 2);
|
||||
Config configInsertBatchRes2 = configDao.get(config2);
|
||||
Assert.assertEquals("configDao.insertBatch result", configInsertBatchRes2.getId() , "2");
|
||||
Config configInsertBatchRes3 = configDao.get(config3);
|
||||
Assert.assertEquals("configDao.insertBatch result", configInsertBatchRes3.getId() , "3");
|
||||
|
||||
System.out.println("============ 按主键更新测试 ============");
|
||||
Area area = new Area();
|
||||
area.setAreaCode("1");
|
||||
area.setAreaName("你好");
|
||||
area.setParentCode("0");
|
||||
area.setParentCodes("0,");
|
||||
area.setTreeSort(1);
|
||||
area.setTreeSorts("1,");
|
||||
area.setTreeLevel(0);
|
||||
area.setTreeLeaf("1");
|
||||
area.setTreeNames(area.getAreaName());
|
||||
area.setStatus("0");
|
||||
Area area2 = (Area) area.clone();
|
||||
area2.setAreaCode("2");
|
||||
Area area3 = (Area) area.clone();
|
||||
area3.setAreaCode("3");
|
||||
long areaInsertNum = areaDao.insertBatch(ListUtils.newArrayList(area, area2, area3));
|
||||
Assert.assertEquals("areaDao.insert", areaInsertNum , 3);
|
||||
area.setAreaName("你好2");
|
||||
long areaUpdateNum = areaDao.update(area);
|
||||
Assert.assertEquals("areaDao.update", areaUpdateNum , 1);
|
||||
Area areaUpdateRes = areaDao.get(area);
|
||||
Assert.assertEquals("areaDao.update result", areaUpdateRes.getAreaName() , "你好2");
|
||||
|
||||
System.out.println("============ 按主键批量更新测试 ============");
|
||||
long areaUpdateBatchNum = areaDao.updateBatch(ListUtils.newArrayList(area2, area3));
|
||||
Assert.assertEquals("areaDao.update", areaUpdateBatchNum , 2);
|
||||
|
||||
System.out.println("============ 自定义更新条件测试 ============");
|
||||
Area where = new Area();
|
||||
where.setId("2");
|
||||
where.setId_in(new String[]{"1","2"});
|
||||
where.setAreaName("你好2");
|
||||
where.setStatus("0");
|
||||
System.out.println(areaDao.update(area));
|
||||
System.out.println(areaDao.updateByEntity(area, where));
|
||||
System.out.println(areaDao.updateStatus(area));
|
||||
System.out.println(areaDao.updateStatusByEntity(area, where));
|
||||
|
||||
where.setId(areaUpdateRes.getId());
|
||||
where.setId_in(new String[]{areaUpdateRes.getId()});
|
||||
where.setAreaName(areaUpdateRes.getAreaName());
|
||||
where.setStatus(areaUpdateRes.getStatus());
|
||||
long areaUpdateByEntityNum = areaDao.updateByEntity(area, where);
|
||||
Assert.assertEquals("areaDao.updateByEntity", areaUpdateByEntityNum , 1);
|
||||
|
||||
System.out.println("============ 更新数据状态测试 ============");
|
||||
long areaStatusNum = areaDao.updateStatus(area);
|
||||
Assert.assertEquals("areaDao.updateStatus", areaUpdateByEntityNum , 1);
|
||||
long areaStatusByEntityNum = areaDao.updateStatusByEntity(area, where);
|
||||
Assert.assertEquals("areaDao.updateStatusByEntity", areaUpdateByEntityNum , 1);
|
||||
|
||||
System.out.println("============ 逻辑删除测试 ============");
|
||||
System.out.println(areaDao.delete(area));
|
||||
System.out.println(areaDao.delete((Area)where.clone()));
|
||||
System.out.println(areaDao.deleteByEntity((Area)where.clone()));
|
||||
long areaDeleteNum = areaDao.delete(area);
|
||||
Assert.assertEquals("areaDao.delete", areaDeleteNum , 1);
|
||||
where.setStatus("1");
|
||||
long areaDeleteByEntityNum = areaDao.deleteByEntity(where);
|
||||
Assert.assertEquals("areaDao.deleteByEntity", areaDeleteByEntityNum , 1);
|
||||
|
||||
System.out.println("============ 物理删除测试 ============");
|
||||
System.out.println(areaDao.phyDelete((Area)where.clone()));
|
||||
System.out.println(areaDao.phyDeleteByEntity((Area)where.clone()));
|
||||
long areaPhyDeleteNum = areaDao.phyDelete(area2);
|
||||
Assert.assertEquals("areaDao.phyDelete", areaPhyDeleteNum , 1);
|
||||
long areaPhyDeleteByEntityNum = areaDao.phyDeleteByEntity(area3);
|
||||
Assert.assertEquals("areaDao.phyDeleteByEntity", areaPhyDeleteByEntityNum , 1);
|
||||
|
||||
System.out.println("============ 基本信息查询测试 ============");
|
||||
System.out.println(areaDao.findList(area));
|
||||
System.out.println("============ 基本查询测试 ============");
|
||||
List<Area> areaList = areaDao.findList(area);
|
||||
Assert.assertEquals("areaDao.findList", areaList.size() , 1);
|
||||
User user = new User();
|
||||
user.setUserType(User.USER_TYPE_NONE);
|
||||
System.out.println(userDao.findList(user));
|
||||
|
||||
List<User> userList = userDao.findList(user);
|
||||
Assert.assertTrue("userDao.findList", userList.size() > 0);
|
||||
|
||||
System.out.println("============ 条件嵌套,日期范围,自定义sqlMap测试 ============");
|
||||
Company company = new Company("1");
|
||||
company.setCompanyName("a");
|
||||
company.setCreateDate_gte(new Date());
|
||||
company.setCreateDate_lte(new Date());
|
||||
company.setArea(new Area("2"));
|
||||
company.getArea().setAreaName("a");
|
||||
company.getArea().setCreateDate_gte(new Date());
|
||||
company.getArea().setCreateDate_lte(new Date());
|
||||
company.setFullName("a");
|
||||
company.setArea(areaList.get(0));
|
||||
company.getArea().setCreateDate_gte(company.getCreateDate_gte());
|
||||
company.getArea().setCreateDate_lte(company.getCreateDate_gte());
|
||||
company.setFullName(IdGen.nextId());
|
||||
company.setViewCode("1");
|
||||
company.setParentCode("0");
|
||||
company.setParentCodes("0,");
|
||||
@@ -124,47 +157,73 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
company.setTreeSorts("1,");
|
||||
company.setTreeLevel(0);
|
||||
company.setTreeLeaf("1");
|
||||
company.setTreeNames("a");
|
||||
System.out.println(companyDao.insert(company));
|
||||
System.out.println(companyDao.get(company));
|
||||
System.out.println(companyDao.findCount(company));
|
||||
|
||||
company.setTreeNames(company.getCompanyName());
|
||||
Company company2 = (Company) company.clone();
|
||||
company2.setParentCode(company.getCompanyCode());
|
||||
company2.setParentCodes("0,1," + company.getCompanyCode());
|
||||
company2.setCompanyCode("12");
|
||||
Company company3 = (Company) company.clone();
|
||||
company3.setParentCode(company.getCompanyCode());
|
||||
company3.setParentCodes("0,1," + company.getCompanyCode());
|
||||
company3.setCompanyCode("13");
|
||||
company3.setCompanyName("b");
|
||||
long companyInsertNum = companyDao.insertBatch(ListUtils.newArrayList(company, company2, company3));
|
||||
Assert.assertEquals("advanced query init", companyInsertNum , 3);
|
||||
Company companyWhere = (Company) company.clone();
|
||||
companyWhere.setCompanyCode(null);
|
||||
companyWhere.setParentCode(null);
|
||||
long companyFindCount = companyDao.findCount(companyWhere);
|
||||
Assert.assertEquals("advanced query list", companyFindCount , 2);
|
||||
|
||||
System.out.println("============ 分页测试,查询子节点 ============");
|
||||
company.setPage(new Page<Company>(1, 20));
|
||||
company.setIsQueryChildren(true);
|
||||
System.out.println(companyDao.findList(company));
|
||||
|
||||
Company company4 = new Company("1");
|
||||
company4.setFullName(company.getFullName());
|
||||
company4.setPage(new Page<Company>(1, 2));
|
||||
company4.setIsQueryChildren(true);
|
||||
List<Company> companyListPage = companyDao.findList(company4);
|
||||
Assert.assertEquals("find page list size", companyListPage.size(), 2);
|
||||
Assert.assertEquals("find page list get(1)", companyListPage.get(1).getCompanyCode(), company2.getCompanyCode());
|
||||
Assert.assertEquals("find page count", company4.getPage().getCount(), 3);
|
||||
|
||||
System.out.println("============ 扩展条件语句前带AND容错测试 ============");
|
||||
Company company2 = new Company();
|
||||
company2.getSqlMap().getWhere().disableAutoAddStatusWhere();
|
||||
company2.getSqlMap().getDataScope().addFilter("dsf",
|
||||
Company company5 = new Company();
|
||||
company5.getSqlMap().getWhere().disableAutoAddStatusWhere();
|
||||
company5.getSqlMap().getDataScope().addFilter("dsf",
|
||||
"Company", "a.`company_code`", DataScope.CTRL_PERMI_HAVE);
|
||||
System.out.println(companyDao.findList(company2));
|
||||
List<Company> companyList = companyDao.findList(company5);
|
||||
System.out.println(companyList);
|
||||
Assert.assertEquals("companyDao.findList extWhere", companyList.size(), 0);
|
||||
|
||||
System.out.println("============ 联合查询未设定columns和attrName为this时测试 ============");
|
||||
FileUpload fileUpload = new FileUpload();
|
||||
fileUpload.getSqlMap().getWhere().and("u.`user_name`", QueryType.EQ, "user1");
|
||||
System.out.println(fileUploadDao.findList(fileUpload));
|
||||
|
||||
List<FileUpload> fileUploadList = fileUploadDao.findList(fileUpload);
|
||||
System.out.println(fileUploadList);
|
||||
Assert.assertEquals("fileUploadDao.findList attrName this", fileUploadList.size(), 0);
|
||||
|
||||
System.out.println("============ 树结构基本查询测试 ============");
|
||||
DictData dictData = new DictData();
|
||||
dictData.setParentCodes("0,");
|
||||
System.out.println(dictDataDao.findByParentCodesLike(dictData));
|
||||
System.out.println(dictDataDao.findList(dictData));
|
||||
List<DictData> dictDataList = dictDataDao.findByParentCodesLike(dictData);
|
||||
Assert.assertTrue("dictDataDao.findByParentCodesLike", dictDataList.size() > 0);
|
||||
List<DictData> dictDataList2 = dictDataDao.findList(dictData);
|
||||
System.out.println(dictDataList2);
|
||||
Assert.assertTrue("dictDataDao.findList", dictDataList2.size() > 0);
|
||||
|
||||
System.out.println("============ 分页情况下foreach测试 ============");
|
||||
EmpUser empUser = new EmpUser();
|
||||
empUser.setCodes(new String[]{"SDJN01","SDJN02"});
|
||||
empUser.setPage(new Page<>(1, 3));
|
||||
List<EmpUser> list = empUserDao.findUserListByOfficeCodes(empUser);
|
||||
System.out.println(list);
|
||||
|
||||
List<EmpUser> empUserList = empUserDao.findUserListByOfficeCodes(empUser);
|
||||
System.out.println(empUserList);
|
||||
Assert.assertTrue("empUserDao.findUserListByOfficeCodes", empUserList.size() > 0);
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String a = null, b = null;
|
||||
System.out.println("============ 基本测试 ============");
|
||||
@@ -172,25 +231,25 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
.getWhere().and("name", QueryType.EQ, "abc").toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND a.name = #{sqlMap.where.name#EQ1.val}";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.and("name", QueryType.IN, new String[]{"1", "2", "3"}).toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND a.name IN ( #{sqlMap.where.name#IN1.val[0]},"
|
||||
+ " #{sqlMap.where.name#IN1.val[1]}, #{sqlMap.where.name#IN1.val[2]} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.or("name", QueryType.IN, new String[]{"1", "2", "3"}).toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} OR a.name IN ( #{sqlMap.where.name#IN1.val[0]},"
|
||||
+ " #{sqlMap.where.name#IN1.val[1]}, #{sqlMap.where.name#IN1.val[2]} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ 重复赋值测试 ============");
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.and("name", QueryType.LIKE, "abc").and("name", QueryType.LIKE, "def").toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND a.name LIKE #{sqlMap.where.name#LIKE1.val}";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ IN、NOT IN 测试 ============");
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.and("name", QueryType.IN, new String[]{"abc","def"})
|
||||
@@ -198,21 +257,21 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND a.name IN ( #{sqlMap.where.name#IN1.val[0]}, #{sqlMap.where.name#IN1.val[1]} )"
|
||||
+ " AND a.name2 NOT IN ( #{sqlMap.where.name2#NOT_IN1.val[0]}, #{sqlMap.where.name2#NOT_IN1.val[1]} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.and("name", QueryType.IN, null).and("name2", QueryType.IN, new String[]{})
|
||||
.and("name3", QueryType.NOT_IN, ListUtils.newArrayList()).toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1}";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ 带括号测试 ============");
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.andBracket("name", QueryType.EQ, "abc", 1).or("name", QueryType.EQ, "def", 2)
|
||||
.or("name", QueryType.EQ, "ghi", 3).endBracket().toSql();
|
||||
.or("name", QueryType.EQ, "ghi", 3).endBracket().toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND ( a.name = #{sqlMap.where.name#EQ1.val}"
|
||||
+ " OR a.name = #{sqlMap.where.name#EQ2.val} OR a.name = #{sqlMap.where.name#EQ3.val} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
a = new Config().getSqlMap().getWhere()
|
||||
.andBracket("name", QueryType.EQ, "val1", 1).and("name", QueryType.NE, "val2", 11).endBracket(1)
|
||||
.orBracket("name", QueryType.NE, "val3", 2).and("name", QueryType.NE, "val4", 22).endBracket(2)
|
||||
@@ -222,41 +281,41 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
+ " OR ( a.name != #{sqlMap.where.name#NE2.val} AND a.name != #{sqlMap.where.name#NE22.val} )"
|
||||
+ " OR ( a.name != #{sqlMap.where.name#NE3.val} AND a.name = #{sqlMap.where.name#EQ33.val} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ 带括号部分空值测试 ============");
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.andBracket("name", QueryType.EQ, "", 1).or("name", QueryType.EQ, "def", 2)
|
||||
.or("name", QueryType.EQ, "", 3).endBracket().toSql();
|
||||
.or("name", QueryType.EQ, "", 3).endBracket().toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND ( a.name = #{sqlMap.where.name#EQ2.val} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.andBracket("name", QueryType.EQ, "abc", 1).or("name", QueryType.EQ, "def", 2)
|
||||
.or("name", QueryType.EQ, "", 3).endBracket().toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND ( a.name = #{sqlMap.where.name#EQ1.val}"
|
||||
+ " OR a.name = #{sqlMap.where.name#EQ2.val} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.andBracket("name", QueryType.EQ, "", 1).or("name", QueryType.EQ, "def", 2)
|
||||
.or("name", QueryType.EQ, "ghi", 3).endBracket().toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} AND ( a.name = #{sqlMap.where.name#EQ2.val}"
|
||||
+ " OR a.name = #{sqlMap.where.name#EQ3.val} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ 带括号全部空值测试 ============");
|
||||
a = new Config("1").getSqlMap().getWhere()
|
||||
.andBracket("name", QueryType.EQ, "", 1).or("name", QueryType.EQ, "", 2)
|
||||
.or("name", QueryType.EQ, "", 3).endBracket().toSql();
|
||||
b = "a.`id` = #{sqlMap.where#id#EQ1} ";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
a = new Config().getSqlMap().getWhere()
|
||||
.andBracket("name", QueryType.EQ, "", 1).or("name", QueryType.EQ, "", 2)
|
||||
.or("name", QueryType.EQ, "", 3).endBracket().toSql();
|
||||
b = "";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ 实体嵌套测试 ============");
|
||||
Company company = new Company("1");
|
||||
company.setCreateDate_gte(new Date());
|
||||
@@ -280,7 +339,7 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
a = new FileUpload().getSqlMap().getWhere().and("u.`user_name`", QueryType.EQ, "user1").toSql();
|
||||
b = "a.`status` != #{STATUS_DELETE} AND u.`user_name` = #{sqlMap.where.u#_user_name_#EQ1.val}";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ 联合查询,返回到当前实体测试 ============");
|
||||
FileUpload fileUpload = new FileUpload();
|
||||
fileUpload.getSqlMap().getWhere().and("create_by", QueryType.IN, new String[]{"user1","user2"});
|
||||
@@ -288,7 +347,7 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
b = "a.`status` != #{STATUS_DELETE} AND a.create_by IN ( #{sqlMap.where.create_by#IN1.val[0]},"
|
||||
+ " #{sqlMap.where.create_by#IN1.val[1]} )";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.out.println("============ 联合查询,属性为this时也可作为查询条件 ============");
|
||||
FileUpload fileUpload2 = new FileUpload();
|
||||
fileUpload2.setCreateByName("ThinkGem/JeeSite");
|
||||
@@ -297,7 +356,7 @@ public class DaoMapperTest extends BaseSpringContextTests {
|
||||
b = "a.`status` != #{STATUS_DELETE} AND a.create_by IN ( #{sqlMap.where.create_by#IN1.val[0]},"
|
||||
+ " #{sqlMap.where.create_by#IN1.val[1]} ) AND u.`user_name` LIKE #{sqlMap.where#user_name#LIKE1}";
|
||||
System.out.println("a >> "+a);System.out.println("b >> "+b);Assert.assertEquals(a, b);
|
||||
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V4.5
|
||||
copyrightYear: 2022
|
||||
productVersion: V4.7
|
||||
copyrightYear: 2023
|
||||
|
||||
# 数据库连接
|
||||
jdbc:
|
||||
|
||||
@@ -3,9 +3,16 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.12</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<version>4.7.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>JeeSite Parent</name>
|
||||
@@ -15,39 +22,41 @@
|
||||
<properties>
|
||||
|
||||
<!-- common version setting -->
|
||||
<commons-io.version>2.11.0</commons-io.version>
|
||||
<commons-text.version>1.9</commons-text.version>
|
||||
<commons-io.version>2.13.0</commons-io.version>
|
||||
<commons-text.version>1.10.0</commons-text.version>
|
||||
<commons-beanutils.version>1.9.4</commons-beanutils.version>
|
||||
<commons-email.version>1.5</commons-email.version>
|
||||
<fst.version>2.57</fst.version>
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
<fastjson.version>2.0.33</fastjson.version>
|
||||
<!-- <jackson.version>2.12.6</jackson.version> -->
|
||||
<!-- <activation.version>1.1.1</activation.version> -->
|
||||
<UserAgentUtils.version>1.21</UserAgentUtils.version>
|
||||
<!-- <metadata-extractor.version>2.11.0</metadata-extractor.version> -->
|
||||
<thumbnailator.version>0.4.17</thumbnailator.version>
|
||||
<twelvemonkeys.version>3.8.2</twelvemonkeys.version>
|
||||
<thumbnailator.version>0.4.19</thumbnailator.version>
|
||||
<twelvemonkeys.version>3.9.3</twelvemonkeys.version>
|
||||
<blade-patchca.version>1.1.2</blade-patchca.version>
|
||||
<jmimemagic.version>0.1.5</jmimemagic.version>
|
||||
<zxing.version>3.4.1</zxing.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<zxing.version>3.5.1</zxing.version>
|
||||
<poi.version>5.2.3</poi.version>
|
||||
<pinyin4j.version>2.5.1</pinyin4j.version>
|
||||
<groovy.version>3.0.10</groovy.version>
|
||||
<groovy.version>3.0.17</groovy.version>
|
||||
<joda-time.version>2.10.4</joda-time.version>
|
||||
<logstash-logback.version>7.3</logstash-logback.version>
|
||||
<elasticsearch.version>7.17.8</elasticsearch.version>
|
||||
<lucene.version>8.11.1</lucene.version>
|
||||
|
||||
<!-- framework version setting -->
|
||||
<spring-boot.version>2.6.10</spring-boot.version>
|
||||
<mybatis.version>3.5.9</mybatis.version>
|
||||
<mybatis.version>3.5.13</mybatis.version>
|
||||
<mybatis-spring.version>2.0.7</mybatis-spring.version>
|
||||
<jsqlparser.version>4.4</jsqlparser.version>
|
||||
<druid.version>1.2.10</druid.version>
|
||||
<shiro.version>1.9.1</shiro.version>
|
||||
<jsqlparser.version>4.6</jsqlparser.version>
|
||||
<druid.version>1.2.18</druid.version>
|
||||
<shiro.version>1.11.0</shiro.version>
|
||||
<j2cache.version>2.8.0-release</j2cache.version>
|
||||
<swagger.version>1.6.0</swagger.version>
|
||||
<log4j2.version>2.17.0</log4j2.version>
|
||||
<swagger.version>1.6.6</swagger.version>
|
||||
<log4j2.version>2.18.0</log4j2.version>
|
||||
|
||||
<!-- jdbc setting -->
|
||||
<!-- <mysql.version>5.1.49</mysql.version> -->
|
||||
<mysql.version>8.0.29</mysql.version>
|
||||
<h2.version>1.4.200</h2.version>
|
||||
|
||||
<!-- environment setting -->
|
||||
<java.version>1.8</java.version>
|
||||
@@ -56,7 +65,7 @@
|
||||
<resource.delimiter>@</resource.delimiter>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version><!-- 降级到该版本,新版本可能会出现VM崩溃 -->
|
||||
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version><!-- 其它版本可能会出现VM崩溃 -->
|
||||
<eclipse-plugin-download-sources>false</eclipse-plugin-download-sources>
|
||||
<eclipse-plugin-download-javadocs>false</eclipse-plugin-download-javadocs>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -69,18 +78,6 @@
|
||||
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
@@ -137,6 +134,9 @@
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
<manifestEntries>
|
||||
<Build-Time>${maven.build.timestamp}</Build-Time>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
@@ -177,6 +177,9 @@
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
<manifestEntries>
|
||||
<Build-Time>${maven.build.timestamp}</Build-Time>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@@ -199,7 +202,6 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite</artifactId>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<version>4.7.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>JeeSite</name>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-root</artifactId>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<version>4.7.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>JeeSite Root</name>
|
||||
|
||||
@@ -18,4 +18,4 @@ ENTRYPOINT jar -xvf app.war && rm app.war && cd WEB-INF && sh startup.sh
|
||||
|
||||
EXPOSE 8980
|
||||
|
||||
#docker run -p 8980:8980 thinkgem/jeesite-web:4.4
|
||||
#docker run -p 8980:8980 thinkgem/jeesite-web:4.6
|
||||
|
||||
@@ -24,4 +24,4 @@ cd app
|
||||
jar -xvf web.war
|
||||
rm web.war
|
||||
cd WEB-INF
|
||||
exec ./startup.sh
|
||||
sh ./startup.sh
|
||||
|
||||
@@ -6,7 +6,7 @@ set global read_only=0;
|
||||
|
||||
create user 'jeesite'@'%' identified by 'jeesite';
|
||||
|
||||
create database jeesite DEFAULT CHARSET 'utf8' COLLATE 'utf8_general_ci';
|
||||
create database jeesite DEFAULT CHARSET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
|
||||
|
||||
grant all privileges on jeesite.* to 'jeesite'@'%' identified by 'jeesite';
|
||||
|
||||
|
||||
23
web/pom.xml
23
web/pom.xml
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<version>4.7.0-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -46,6 +46,20 @@
|
||||
<artifactId>jeesite-module-swagger</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 内容管理模块 -->
|
||||
<dependency>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-module-cms</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 移动端模块 -->
|
||||
<dependency>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-module-app</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 文件管理共享(标准版)
|
||||
<dependency>
|
||||
@@ -61,13 +75,6 @@
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency> -->
|
||||
|
||||
<!-- 内容管理模块
|
||||
<dependency>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-module-cms</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency> -->
|
||||
|
||||
<!-- Spring Boot Tomcat
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -38,19 +38,25 @@ public class TestDataService extends CrudService<TestDataDao, TestData> {
|
||||
*/
|
||||
@Override
|
||||
public TestData get(TestData testData) {
|
||||
TestData entity = super.get(testData);
|
||||
if (entity != null){
|
||||
TestDataChild testDataChild = new TestDataChild(entity);
|
||||
return super.get(testData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载子表数据
|
||||
*/
|
||||
public TestData loadChildData(TestData testData) {
|
||||
if (testData != null && !testData.getIsNewRecord()){
|
||||
TestDataChild testDataChild = new TestDataChild(testData);
|
||||
testDataChild.setStatus(TestDataChild.STATUS_NORMAL);
|
||||
entity.setTestDataChildList(testDataChildDao.findList(testDataChild));
|
||||
testData.setTestDataChildList(testDataChildDao.findList(testDataChild));
|
||||
}
|
||||
return entity;
|
||||
return testData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param testData
|
||||
* @param testData page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
*/
|
||||
package com.jeesite.modules.test.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
import com.jeesite.modules.test.entity.TestDataChild;
|
||||
import com.jeesite.modules.test.service.TestDataService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -19,12 +21,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
import com.jeesite.modules.test.entity.TestDataChild;
|
||||
import com.jeesite.modules.test.service.TestDataService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 测试数据Controller
|
||||
@@ -83,9 +82,10 @@ public class TestDataController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions("test:testData:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(TestData testData, Model model) {
|
||||
public String form(TestData testData, String flag, Model model) {
|
||||
testDataService.loadChildData(testData);
|
||||
model.addAttribute("testData", testData);
|
||||
return "modules/test/testDataForm";
|
||||
return "modules/test/testDataForm"+ StringUtils.defaultString(flag, "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,8 +8,8 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V4.5
|
||||
copyrightYear: 2022
|
||||
productVersion: V4.7
|
||||
copyrightYear: 2023
|
||||
|
||||
# 是否演示模式
|
||||
demoMode: false
|
||||
@@ -24,7 +24,7 @@ server:
|
||||
servlet:
|
||||
context-path: /js
|
||||
register-default-servlet: false
|
||||
encoding.enabled: true
|
||||
#encoding.enabled: true
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
# 表单请求数据的最大大小
|
||||
@@ -818,7 +818,7 @@ file:
|
||||
# # 设置允许上传的文件后缀(全局设置)
|
||||
# imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,
|
||||
# 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,.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,
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">查询</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">重置</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">重置</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal table-form">
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">查询</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">重置</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">重置</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
data-order-by="${parameter.orderBy!'post_code desc'}">
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="button" id="search" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
478
web/src/main/resources/views/modules/test/testDataForm2.html
Normal file
478
web/src/main/resources/views/modules/test/testDataForm2.html
Normal file
@@ -0,0 +1,478 @@
|
||||
<% layout('/layouts/default.html', {title: '数据管理', libs: ['validate','fileupload','dataGrid']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-note"></i> ${text(testData.isNewRecord ? '新增数据' : '编辑数据')}
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal">
|
||||
<div class="box-body">
|
||||
<div class="form-unit">${text('基本信息')}</div>
|
||||
<#form:hidden path="id"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> ${text('单行文本')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> ${text('多行文本')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:textarea path="testTextarea" rows="4" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('下拉框')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('下拉多选')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('单选框')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('复选框')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('日期选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDate" readonly="true" maxlength="20" class="form-control laydate"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('日期时间')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDatetime" readonly="true" maxlength="20" class="form-control laydate"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('用户选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testUser" title="${text('用户选择')}"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('机构选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testOffice" title="${text('机构选择')}"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('区域选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testAreaCode" title="${text('区域选择')}"
|
||||
path="testAreaCode" labelPath="testAreaName"
|
||||
url="${ctx}/sys/area/treeData"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> ${text('备注信息')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">${text('图片上传')}:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadImage" bizKey="${testData.id}" bizType="testData_image"
|
||||
uploadType="image" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">${text('附件上传')}:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadFile" bizKey="${testData.id}" bizType="testData_file"
|
||||
uploadType="all" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-unit">${text('子表数据')}</h4>
|
||||
<div class="ml10 mr10 table-form">
|
||||
<table id="testDataChildDataGrid"></table>
|
||||
<% if (hasPermi('test:testData:edit')){ %>
|
||||
<a href="#" id="testDataChildDataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> ${text('增行')}</a>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<% if (hasPermi('test:testData:edit')){ %>
|
||||
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>
|
||||
<% } %>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#form:form>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script id="treeselectTpl" type="text/template">//<!--<div>
|
||||
<#form:treeselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true" readonly="{{d.readonly}}"/>
|
||||
</div>//--></script>
|
||||
<script id="listselectTpl" type="text/template">//<!--<div>
|
||||
<#form:listselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true" readonly="{{d.readonly}}"
|
||||
itemCode="{{d.itemCode}}" itemName="{{d.itemName}}"/>
|
||||
</div>//--></script>
|
||||
<script id="fileuploadTpl" type="text/template">//<!--<div>
|
||||
<#form:fileupload id="{{d.id}}" bizKey="{{d.bizKey}}" bizType="{{d.bizType}}" uploadType="all"
|
||||
class="{{d.cssClass}}" isMini="true" preview="true" readonly="{{d.readonly}}"/>
|
||||
</div>//--></script>
|
||||
<script>
|
||||
//初始化测试数据子表DataGrid对象
|
||||
$("#testDataChildDataGrid").dataGrid({
|
||||
|
||||
data: ${toJson(testData.testDataChildList)},
|
||||
datatype: "local", // 设置本地数据
|
||||
autoGridHeight: function(){return 'auto'}, // 设置自动高度
|
||||
|
||||
// 设置数据表格列
|
||||
columnModel: [
|
||||
|
||||
{header:'${text("操作")}', name:'actions', width:40, align:"center", formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
if (val == 'new'){
|
||||
actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗?")}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}else{
|
||||
actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗?")}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}
|
||||
//actions.push('<a href="#" onclick="$(\'#testDataChildDataGrid\').dataGrid(\'editRow\',\''+obj.rowId+'\',{keys:true,focusField:true});return false;"><i class="fa fa-pencil"></i></a> ');
|
||||
return actions.join('');
|
||||
}, editoptions: {defaultValue: 'new'}},
|
||||
|
||||
{header:'状态', name:'status', editable:true, hidden:true},
|
||||
{header:'主键', name:'id', editable:true, hidden:true},
|
||||
{header:'${text("排序号")}', name:'testSort', width:100, editable:true, edittype:'text', editoptions:{'maxlength':'11', 'class':'form-control digits'}},
|
||||
{header:'${text("父表主键")}', name:'testData.id', editable:true, hidden:true},
|
||||
{header:'${text("单行文本")}', name:'testInput', width:100, editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'}},
|
||||
{header:'${text("多行文本")}', name:'testTextarea', width:100, editable:true, edittype:'textarea', editoptions:{'maxlength':'200', 'class':'form-control', 'rows':'1'}},
|
||||
{header:'${text("下拉框")}', name:'testSelect', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel(obj.colModel.editoptions.items, val, '${text("未知")}', true);
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return val;
|
||||
},
|
||||
editable:true, edittype:'select', editoptions:{'class':'form-control',
|
||||
items: $.merge([{dictLabel:' ',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("下拉多选")}', name:'testSelectMultiple', width:90, fixed: true,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel(obj.colModel.editoptions.items, val, '${text("未知")}', true);
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return val;
|
||||
},
|
||||
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
|
||||
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("单选框")}', name:'testRadio', width:135, fixed: true,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel(obj.colModel.editoptions.items, val, '${text("未知")}', true);
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return val;
|
||||
},
|
||||
editable:true, edittype:'radio', editoptions:{'class':'form-control icheck',
|
||||
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.iCheck(element).on("ifChanged",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("复选框")}', name:'testCheckbox', width:135, fixed: true,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text("未知")}', true);
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return val;
|
||||
},
|
||||
editable:true, edittype:'checkbox', editoptions:{'class':'form-control icheck',
|
||||
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.iCheck(element).on("ifChanged",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("日期选择")}', name:'testDate', width:120,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'date', format:'yyyy-MM-dd', done: function(){
|
||||
// 选择日期后,自动给下一个输入框赋值(联动实例)
|
||||
// $(element).closest('td').next().find('.form-control').val('2020-11-26 10:10');
|
||||
}});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("日期时间")}', name:'testDatetime', width:155,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'datetime', format:'yyyy-MM-dd HH:mm'});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("用户选择")}', name:'testUser', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testUser.userName');
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return js.val(obj.colModel.data[obj.rowId], 'userCode')
|
||||
+ '|' + js.val(obj.colModel.data[obj.rowId], 'userName');
|
||||
},
|
||||
editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?isLoadUser=true', cssClass: '', readonly: false
|
||||
});
|
||||
},
|
||||
custom_value: function(element, act){
|
||||
return {userCode: element.find('[type=hidden]').val(),
|
||||
userName: element.find('[type=text]').val()};
|
||||
},
|
||||
dataInit: function(element){
|
||||
// 初始化控件后设置只读模式(实例)
|
||||
// $(element).find('.form-control, .btn').addClass('disabled');
|
||||
}
|
||||
},
|
||||
},
|
||||
{header:'${text("列表选择")}', name:'testUser2', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
obj.colModel.data[obj.rowId] = row.testUser;
|
||||
return js.val(row, 'testUser.userName');
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return js.val(obj.colModel.data[obj.rowId], 'userCode')
|
||||
+ '|' + js.val(obj.colModel.data[obj.rowId], 'userName');
|
||||
},
|
||||
editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('listselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser2.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser2.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/empUser/empUserSelect', cssClass: '', readonly: false,
|
||||
itemCode: 'userCode', itemName: 'userName'
|
||||
});
|
||||
},
|
||||
custom_value: function(element, act){
|
||||
return {userCode2: element.find('[type=hidden]').val(),
|
||||
userName2: element.find('[type=text]').val()};
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("机构选择")}', name:'testOffice', width:100, title:false,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testOffice.officeName');
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return js.val(obj.colModel.data[obj.rowId], 'officeCode')
|
||||
+ '|' + js.val(obj.colModel.data[obj.rowId], 'officeName');
|
||||
},
|
||||
editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'office_'+editOptions.id, title: '机构选择',
|
||||
name: 'testOffice.officeCode', value: val.split('|')[0],
|
||||
labelName: 'testOffice.officeName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?officeTypes=1,2', cssClass: '', readonly: false
|
||||
});
|
||||
},
|
||||
custom_value: function(element, act){
|
||||
return {officeCode: element.find('[type=hidden]').val(),
|
||||
officeName: element.find('[type=text]').val()};
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("区域选择")}', name:'testAreaCode', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
obj.colModel.data[obj.rowId] = {
|
||||
testAreaCode: row.testAreaCode,
|
||||
testAreaName: row.testAreaName
|
||||
};
|
||||
return js.val(row, 'testAreaName');
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return js.val(obj.colModel.data[obj.rowId], 'testAreaCode')
|
||||
+ '|' + js.val(obj.colModel.data[obj.rowId], 'testAreaName');
|
||||
},
|
||||
editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'area_'+editOptions.id, title: '区域选择',
|
||||
name: 'testAreaCode', value: val.split('|')[0],
|
||||
labelName: 'testAreaName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/area/treeData', cssClass: '', readonly: false
|
||||
});
|
||||
},
|
||||
custom_value: function(element, act){
|
||||
return {areaCode: element.find('[type=hidden]').val(),
|
||||
areaName: element.find('[type=text]').val()};
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("文件上传")}', name:'id', width:200, classes:'editable',
|
||||
formatter: function(val, obj, row, act){
|
||||
return '<button type="button" class="btn btn-xs btn-default uploaderFile" data-val="'
|
||||
+(obj.rowId)+'">查看文件</button>';
|
||||
},
|
||||
editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
log(val, editOptions)
|
||||
return js.template('fileuploadTpl', {
|
||||
id: 'fileupload_'+editOptions.rowId, bizKey: editOptions.rowId,
|
||||
bizType: 'testDataChild_file', cssClass: '', readonly: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
onSelectRow: function(id, stat, e) {
|
||||
if (id && e && !$(e.target).hasClass('btn')){
|
||||
$('#testDataChildDataGrid').dataGrid('editRow', id,{keys:true,focusField:true});
|
||||
}
|
||||
},
|
||||
shrinkToFit: false, // 是否按百分比自动调整列宽
|
||||
|
||||
// 编辑表格参数
|
||||
editGrid: true, // 是否是编辑表格
|
||||
editGridInitRowNum: 1, // 编辑表格的初始化新增行数
|
||||
editGridInitAllRowEdit: false, // 是否初始化就编辑所有行(*** 重点 ***)
|
||||
editGridAddRowBtn: $('#testDataChildDataGridAddRowBtn'), // 子表增行按钮
|
||||
editGridAddRowBtnToHeader: true, // 子表增行按钮是否显示到表头上 v4.1.7
|
||||
editGridAddRowInitData: {id: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
|
||||
|
||||
// 编辑表格的提交数据参数
|
||||
editGridInputFormListName: 'testDataChildList', // 提交的数据列表名
|
||||
editGridInputFormListAttrs: 'status,id,testSort,testData.id,testInput,testTextarea,testSelect,testSelectMultiple,'
|
||||
+'testRadio,testCheckbox,testDate,testDatetime,testUser.userCode,testUser.userName,testOffice.officeCode,'
|
||||
+'testOffice.officeName,testAreaCode,testAreaName,testDataChild_file,testDataChild_file__del', // 提交数据列表的属性字段
|
||||
|
||||
// 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
// $('#jqgh_testDataChildDataGrid_rn').append('<a href="javascript:" onclick="'
|
||||
// + '$(\'#testDataChildDataGridAddRowBtn\').click();">'
|
||||
// + '<i class="fa fa-plus"></i></a>');
|
||||
}
|
||||
});
|
||||
$('#testDataChildDataGrid').on('click', '.uploaderFile', function(){
|
||||
var val = $(this).data('val'); layer.open({ title: '查看文件',
|
||||
content: '文件列表:' + js.template('fileuploadTpl', {
|
||||
id: 'fileupload_'+val, bizKey: val, bizType: 'testDataChild_file', cssClass: '', readonly: true
|
||||
})
|
||||
});
|
||||
});
|
||||
$("#inputForm").validate({
|
||||
submitHandler: function(form){
|
||||
js.ajaxSubmitForm($(form), function(data){
|
||||
js.showMessage(data.message);
|
||||
if(data.result == Global.TRUE){
|
||||
js.closeCurrentTabPage(function(contentWindow){
|
||||
contentWindow.page();
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
<button type="button" class="btn btn-default btn-sm btnFormMore">${text('更多')}<i class="fa fa-angle-double-down"></i></button>
|
||||
</div>
|
||||
<div class="form-more">
|
||||
@@ -123,7 +123,7 @@ $('#dataGrid').dataGrid({
|
||||
searchForm: $("#searchForm"),
|
||||
columnModel: [
|
||||
{header:'${text("单行文本")}', name:'testInput', index:'a.test_input', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
|
||||
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="${text("编辑数据")}">'+(val||row.id)+'</a>';
|
||||
return '<a href="${ctx}/test/testData/form?id='+row.id+'&flag=2" class="btnList" data-title="${text("编辑数据")}">'+(val||row.id)+'</a>';
|
||||
}, searchoptions: { dataInit: function (element) {
|
||||
$(element).attr('form', 'searchForm').attr('name', 'testInput2');
|
||||
}}},
|
||||
@@ -150,7 +150,7 @@ $('#dataGrid').dataGrid({
|
||||
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', firstsortorder:'desc', width:150, align:"center"},
|
||||
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
|
||||
{header:'${text("备注")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
|
||||
{header:'${text("操作")}', name:'actions', width:100, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
//<% if(hasPermi('test:testData:edit')){ %>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
|
||||
Reference in New Issue
Block a user