1024宅男优化版本

jeecg_3.8
zhangdaiscott@163.com 6 years ago
parent a231fe8885
commit a694706e2d

@ -1,7 +1,7 @@
JEECG 微云快速开发平台
===============
当前最新版本: 3.7.8发布日期20180806
当前最新版本: 3.8发布日期20181024
JEECG微服务架构 [jeecg-p3 1.0版](https://gitee.com/jeecg/jeecg-p3)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -5,9 +5,9 @@
1.oracle 导入命令
说明: jeecg脚本导出用户是scott
imp scott/tiger@orcl file=jeecg_3.7.8_oracle11g.dmp
imp scott/tiger@orcl file=jeecg_3.8_oracle11g.dmp
导入其他用户的表
imp jeecgos/jeecgos@orcl file=/opt/datatmp/jeecg_3.7.8_oracle11g.dmp fromuser=scott touser=jeecgos ignore=y commit=y buffer=300000000 feedback=10000
imp jeecgos/jeecgos@orcl file=/opt/datatmp/jeecg_3.8_oracle11g.dmp fromuser=scott touser=jeecgos ignore=y commit=y buffer=300000000 feedback=10000
2. oracle、SqlServer脚步索引会有部分丢失为了系统性能请自行补加索引。
@ -16,6 +16,6 @@
4.老版本数据库增量升级
执行老版本升级SQL脚本
3.7.7升级到3.7.8
docs/老版本增量升级/jeecg_mysql-3.7.7-update-3.7.8.sql
3.7.8升级到3.8
docs/老版本增量升级/jeecg_mysql-3.7.8-update-3.8.sql

@ -1,12 +0,0 @@
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('402881fa64a1ca500164a1d549e40001', NULL, '1', 'Bootstrap树形列表', '5', 'jeecgFormDemoController.do?bootstrapTreeListDemo', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-tree', 'admin', '管理员', 'admin', '2018-07-16 16:17:45', '2018-07-16 14:44:27', '管理员');
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f68164caf6520164cb5ecade0006', NULL, '1', '检索下拉框', '100', 'jeecgListDemoController.do?suggest', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', '', 'admin', '管理员', NULL, NULL, '2018-07-24 16:19:04', NULL);
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f68164caf6520164cb5d79670004', NULL, '1', 'plupload上传1', '100', 'jeecgFormDemoController.do?plupload1', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', '', 'admin', '管理员', NULL, NULL, '2018-07-24 16:17:38', NULL);
UPDATE `t_s_function` SET `function_icon_style`='fa-list-ol' WHERE (`ID`='4028f68164caf6520164cb5ecade0006');
UPDATE `t_s_function` SET `function_icon_style`='fa-upload' WHERE (`ID`='4028f68164caf6520164cb5d79670004');
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f68164cfec7b0164d07373540002', NULL, '1', 'plupload上传2', '100', 'jeecgFormDemoController.do?plupload2', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-upload', 'admin', '管理员', NULL, NULL, '2018-07-25 15:59:44', NULL);
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028810a64e8d94d0164e9033a580005', NULL, '1', '单据打印', '10', 'jeecgFormDemoController.do?printingDemo', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-print', 'admin', '管理员', 'admin', '2018-07-30 14:30:52', '2018-07-30 10:27:40', '管理员');
UPDATE `t_s_icon` SET `extend` = 'png', `iconclas` = 'deskIcon', `content` = NULL, `name` = 'Online表单开发', `path` = 'plug-in/sliding/icon/Finder.png', `type` = 3 WHERE `ID` = '8a8ab0b246dc81120146dc818102002c';
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('4028810264f4f97d0164f528560a0010', 'please.input.table.content', 'Please Input Table Content', 'en', '2018-08-01 19:03:39', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('4028810264f4f97d0164f527c5dd000e', 'please.input.table.content', '请填写表描述!', 'zh-cn', '2018-08-01 19:03:02', 'admin', '管理员', NULL, NULL, NULL);
UPDATE `cgform_field` SET `id`='ff8080816021b031016021fced19000f', `content`='收货人', `create_by`='admin', `create_date`='2017-12-04 22:45:12', `create_name`='管理员', `dict_field`='receiver_name,receiver_mobile', `dict_table`='user_msg', `dict_text`='realname,account', `field_default`='', `field_href`='', `field_length`='120', `field_name`='receiver_name', `field_valid_type`='', `field_must_input`='N', `is_key`='N', `is_null`='Y', `is_query`='Y', `is_show`='Y', `is_show_list`='Y', `length`='56', `main_field`='', `main_table`='', `old_field_name`='receiver_name', `order_num`='11', `point_length`='0', `query_mode`='single', `show_type`='popup', `type`='string', `update_by`='admin', `update_date`='2018-08-02 20:14:54', `update_name`='管理员', `table_id`='ff8080816021b031016021fced100004', `extend_json`='', `fill_rule_code`='' WHERE (`id`='ff8080816021b031016021fced19000f');
update t_s_muti_lang set lang_context = '3.7.8' where lang_key ='system.version.number';

@ -0,0 +1,19 @@
INSERT INTO `t_s_function`(`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('40288102653ced6601653cee431c0001', NULL, 1, '面板拖拽', '37', 'jeecgListDemoController.do?goDraggablePanels', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', 0, 'fa-clone', 'admin', '管理员', 'admin', '2018-08-15 18:17:15', '2018-08-15 17:32:52', '管理员');
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('402881026560c0a0016560e2bd800007', 'common.position.name', 'Position Name', 'en', '2018-08-22 17:06:37', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('402881026560c0a0016560e237d50005', 'common.position.name', '职务', 'zh-cn', '2018-08-22 17:06:03', 'admin', '管理员', NULL, NULL, NULL);
update cgform_ftl SET FTL_CONTENT = replace(FTL_CONTENT, 'plug-in/uploadify/jquery.uploadify-3.1.js', 'plug-in/plupload/plupload.full.min.js');
UPDATE `jform_graphreport_head` SET `cgr_sql` = 'select a.userid, count(*) ct, sum(CASE WHEN a.logcontent like \'%\' or a.logcontent like \'%cess\' THEN 1 ELSE 0 END) login_count from t_s_log a where {operatetime} group by a.userid order by ct desc' WHERE `id` = '402881e64ca71152014ca71152480000';
ALTER TABLE `cgform_enhance_java`
ADD COLUMN `event` varchar(10) NOT NULL COMMENT '事件状态(end:结束start:开始)' AFTER `active_status`;
alter table cgform_enhance_java alter column event set default 'end';
update cgform_enhance_java set event = 'end' where event is null;
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('40288102657927c401657947f3f90003', 'common.event', 'Event State', 'en', '2018-08-27 10:48:03', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('40288102657927c401657947644c0001', 'common.event', '事件状态', 'zh-cn', '2018-08-27 10:47:27', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('40288102657951ed01657954835f0007', 'common.end', 'End', 'en', '2018-08-27 11:01:46', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('40288102657951ed0165795465070005', 'common.end', '结束', 'zh-cn', '2018-08-27 11:01:39', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('40288102657951ed0165795414370003', 'common.begin', 'Begin', 'en', '2018-08-27 11:01:18', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_muti_lang`(`id`, `lang_key`, `lang_context`, `lang_code`, `create_date`, `create_by`, `create_name`, `update_date`, `update_by`, `update_name`) VALUES ('40288102657951ed016579537e400001', 'common.begin', '开始', 'zh-cn', '2018-08-27 11:00:40', 'admin', '管理员', NULL, NULL, NULL);
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f681658063000165806aa21c0001', NULL, '1', 'jxls导出excel', '99', 'jeecgDemoExcelController.do?jxls', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-file-excel-o', 'admin', '管理员', 'admin', '2018-08-28 20:07:29', '2018-08-28 20:03:16', '管理员');
INSERT INTO `t_s_function` (`ID`, `functioniframe`, `functionlevel`, `functionname`, `functionorder`, `functionurl`, `parentfunctionid`, `iconid`, `desk_iconid`, `functiontype`, `function_icon_style`, `create_by`, `create_name`, `update_by`, `update_date`, `create_date`, `update_name`) VALUES ('4028f68165a8fe350165a90f06d50001', NULL, '1', '下拉多选demo', '100', 'jeecgFormDemoController.do?multiSelect', '4028f6815af3ce54015af3d1ad610001', '8a8ab0b246dc81120146dc8180460000', '8a8ab0b246dc81120146dc8180dd001e', '0', 'fa-list-ol', 'admin', '管理员', 'admin', '2018-09-05 17:28:15', '2018-09-05 17:27:38', '管理员');
update t_s_muti_lang set lang_context = '3.8' where lang_key ='system.version.number';

@ -3,12 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jeecgframework</groupId>
<artifactId>jeecg</artifactId>
<version>3.7.8</version>
<version>3.8</version>
<packaging>war</packaging>
<properties>
<!-- 自定义依赖包 -->
<codegenerate.version>3.6.3</codegenerate.version>
<codegenerate.version>3.6.4</codegenerate.version>
<jeecg-common-plugin-ui.version>1.0.0</jeecg-common-plugin-ui.version>
<!-- springmvc -->
@ -70,7 +70,7 @@
<!-- pinyin4j -->
<pinyin4j.version>2.5.1</pinyin4j.version>
<!-- jeasypoi 工具类 -->
<jeasypoi.version>2.1.9</jeasypoi.version>
<jeasypoi.version>2.2.0</jeasypoi.version>
<!-- cxf webservice -->
<cxf.version>3.0.2</cxf.version>
<!-- jacob -->
@ -143,7 +143,7 @@
<artifactId>codegenerate</artifactId>
<version>${codegenerate.version}</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/codegenerate-3.6.3-20180614.jar</systemPath>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/codegenerate-3.6.4-20180823.jar</systemPath>
</dependency>
<!-- jeecg plugin-ui-->
<dependency>
@ -151,7 +151,7 @@
<artifactId>jeecg-common-plugin-ui</artifactId>
<version>${jeecg-common-plugin-ui.version}</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/jeecg-common-plugin-ui-1.0.0-20180613.jar</systemPath>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/jeecg-common-plugin-ui-1.0.0-20180813.jar</systemPath>
</dependency>
<!-- 自定义的依赖包 end -->
@ -444,7 +444,7 @@
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
<scope>system</scope>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/freemarker-null-2.3.19.jar</systemPath>
</dependency>
<!-- jeasypoi 工具类 -->
@ -614,6 +614,14 @@
</dependency>
<!-- Jeecg Plugin end -->
<!-- update-begin-author:taoYan date:20180828 for:jxls导出excel -->
<dependency>
<groupId>net.sf.jxls</groupId>
<artifactId>jxls-core</artifactId>
<version>1.0.6</version>
</dependency>
<!-- update-end-author:taoYan date:20180828 for:jxls导出excel -->
</dependencies>
<organization>

@ -1,10 +1,15 @@
package com.jeecg.demo.controller;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Validator;
@ -15,6 +20,7 @@ import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.JxlsExcelExportUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
@ -37,10 +43,14 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.jeecg.demo.entity.JeecgDemoExcelEntity;
import com.jeecg.demo.entity.JformOrderCustomerEntity;
import com.jeecg.demo.entity.JformOrderMainEntity;
import com.jeecg.demo.page.JformOrderMainPage;
import com.jeecg.demo.service.JeecgDemoExcelServiceI;
import com.jeecg.demo.util.FreemarkerUtil;
import io.swagger.annotations.Api;
import net.sf.jxls.transformer.XLSTransformer;
/**
* @Title: Controller
@ -324,5 +334,117 @@ public class JeecgDemoExcelController extends BaseController {
e.printStackTrace();
}
}
@RequestMapping("/jxlsExportXls")
public void jxlsExportXls(JeecgDemoExcelEntity jeecgDemoExcel,HttpServletRequest request,HttpServletResponse response) throws IOException{
try {
//查询组织结构表 由集合转化成map
List<Map<String,Object>> departs = this.systemService.findForJdbc("select id,departname from t_s_depart");
Map<String,Object> dptMap = new HashMap<String,Object>();
for (Map<String, Object> map : departs) {
dptMap.put(map.get("id").toString(), map.get("departname"));
}
//获取数据集
List<JeecgDemoExcelEntity> list = this.jeecgDemoExcelService.loadAll(JeecgDemoExcelEntity.class);
//遍历替换值
for (JeecgDemoExcelEntity temp : list) {
String sex = temp.getSex();
if("0".equals(sex)){
sex = "男性";
}else if("1".equals(sex)){
sex = "女性";
}
temp.setSex(sex);
Object depart =dptMap.get(temp.getDepart());
temp.setDepart(depart==null?"":String.valueOf(depart));
}
//JXLS生成workbook
Map<String,Object> beans =new HashMap<String,Object>();
beans.put("datac",list);
XLSTransformer transformer = new XLSTransformer();
String srcFilePath = request.getServletContext().getRealPath("/")+"export/template/jxls.xls";
InputStream is = new BufferedInputStream(new FileInputStream(srcFilePath));
org.apache.poi.ss.usermodel.Workbook workbook = transformer.transformXLS(is, beans);
//设置导出
response.addHeader("Cache-Control","no-cache");
response.setCharacterEncoding("UTF-8");
response.setContentType("application/octet-stream;charset=UTF-8");
String ua = request.getHeader("user-agent");
ua = ua == null ? null : ua.toLowerCase();
String docFileName = "jxls导出excel-demo.xls";
if(ua != null && (ua.indexOf("firefox") > 0 || ua.indexOf("safari")>0)){
try {
docFileName = new String(docFileName.getBytes(),"ISO8859-1");
response.addHeader("Content-Disposition","attachment;filename=" + docFileName);
} catch (Exception e) {
}
}else{
try {
docFileName = URLEncoder.encode(docFileName, "utf-8");
response.addHeader("Content-Disposition","attachment;filename=" + docFileName);
} catch (Exception e) {
}
}
ServletOutputStream out = response.getOutputStream();
workbook.write(out);
out.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping(params = "jxls")
public ModelAndView jxls(HttpServletRequest req) {
return new ModelAndView("com/jeecg/demo/excel/jxlsOne2manyIndex");
}
@RequestMapping(params = "mainlist")
public ModelAndView mainlist(HttpServletRequest req) {
return new ModelAndView("com/jeecg/demo/excel/jxlsOne2manyMain");
}
@RequestMapping(params = "sublist")
public ModelAndView sublist(HttpServletRequest req) {
return new ModelAndView("com/jeecg/demo/excel/jxlsOne2manySub");
}
@RequestMapping(params = "jxlsExportXlsOne2Many")
public void jxlsExportXlsOne2Many(JformOrderMainEntity jformOrderMain,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) {
CriteriaQuery cq = new CriteriaQuery(JformOrderMainEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformOrderMain);
try{
cq.add();
List<JformOrderMainEntity> list=this.systemService.getListByCriteriaQuery(cq, false);
List<JformOrderMainPage> pageList=new ArrayList<JformOrderMainPage>();
if(list!=null&&list.size()>0){
for(JformOrderMainEntity entity:list){
try{
JformOrderMainPage page=new JformOrderMainPage();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
String hql0 = "from JformOrderCustomerEntity where 1 = 1 AND fK_ID = ? ";
List<JformOrderCustomerEntity> jformOrderCustomerEntityList = systemService.findHql(hql0,id0);
for (JformOrderCustomerEntity temp : jformOrderCustomerEntityList) {
String sex = temp.getSex();
if("0".equals(sex)){
sex = "男性";
}else if("1".equals(sex)){
sex = "女性";
}
temp.setSex(sex);
}
page.setJformOrderCustomerList(jformOrderCustomerEntityList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
Map<String,Object> beans =new HashMap<String,Object>();
beans.put("datac",pageList);
String repeat = request.getParameter("repeat");
String templateFilePath = request.getServletContext().getRealPath("/")+"export/template/jxlsone2many-"+repeat+".xls";
String exportFileName = "jxls导出excel-demo(一对多).xls";
JxlsExcelExportUtil.export(beans,exportFileName,templateFilePath, request, response);
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
}
}

@ -1012,4 +1012,14 @@ public class JeecgFormDemoController extends BaseController {
return new ModelAndView("com/jeecg/demo/printingDemo");
}
/**
* DEMO
* @author taoYan
* @since 201895
*/
@RequestMapping(params = "multiSelect")
public ModelAndView multiSelect() {
return new ModelAndView("com/jeecg/demo/select_multi");
}
}

@ -1411,12 +1411,21 @@ public class JeecgListDemoController extends BaseController {
@RequestMapping(value = "loadSuggestData")
@ResponseBody
public Object loadSuggestData(String keyword,HttpServletRequest request) {
String sql = "select a.username,a.realname,IFNULL(c.departname,'火星人') as depart from t_s_base_user a left join t_s_user_org b on b.user_id = a.ID left join t_s_depart c on c.id = b.org_id "
String sql = "select a.username,a.realname,c.departname as depart from t_s_base_user a left join t_s_user_org b on b.user_id = a.ID left join t_s_depart c on c.id = b.org_id "
+ "";//TODO keyword 没用到
JSONObject object = new JSONObject();
object.put("message", "");
try {
List<Map<String,Object>> data = this.systemService.findForJdbc(sql);
for (Map<String, Object> map : data) {
for (String key : map.keySet()) {
if(null == map.get(key)){
map.put(key,"");
}
}
}
net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(data);
object.put("value", array);
object.put("code", 200);
@ -1427,4 +1436,13 @@ public class JeecgListDemoController extends BaseController {
return object;
}
/**
* DropDownDatagrid
* @return
*/
@RequestMapping(params = "goDraggablePanels")
public ModelAndView goDraggablePanels(HttpServletRequest request) {
return new ModelAndView("com/jeecg/demo/draggablePanels");
}
}

@ -4,6 +4,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@ -66,7 +67,11 @@ public class JeecgDemoServiceImpl extends CommonServiceImpl implements JeecgDemo
ps.setString(1, id);
ps.setString(2, name);
ps.setInt(3, age);
ps.setString(4, DateUtils.date2Str(new SimpleDateFormat("yyyy-MM-dd HH:mm")));
// ps.setString(4, DateUtils.date2Str(new SimpleDateFormat("yyyy-MM-dd HH:mm")));
java.sql.Date date = new java.sql.Date(new Date().getTime());
ps.setDate(4, date);
}
public int getBatchSize()
{

@ -39,7 +39,7 @@ public class FreemarkerUtil {
if (ftl == null) {
synchronized (LOCK) {
try {
ftl = new FreemarkerUtil(request.getServletContext().getRealPath("/")+"export/template");
ftl = new FreemarkerUtil(request.getSession().getServletContext().getRealPath("/")+"export/template");
} catch (IOException e) {
e.printStackTrace();
}

@ -40,6 +40,7 @@ import java.util.*;
* @author
*
*/
@SuppressWarnings("unchecked")
@Repository
public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGenericBaseCommonDao {

@ -135,4 +135,10 @@ public final class Globals {
BUTTON_AUTHORITY_CHECK = true;
}
}
/**
* rest list
*/
public static Integer MAX_PAGESIZE = 2000; //条数
}

@ -11,6 +11,8 @@ import org.jeecgframework.core.util.oConvertUtils;
*/
public enum StoreUploadFilePathEnum {
PHOTOSUCAI("photosucai", "upload"+File.separator+"img"+File.separator+"photosucai"),
/**online文件上传位置*/
ONlINE("online","upload"+File.separator+"online"),
DEFAULT("default", "upload"+File.separator+"files");
private String name;

@ -19,7 +19,8 @@ public enum SysThemesEnum {
ACE_LE_STYLE("acele","main/ace_main","metrole", "ACE2风格"),
DIY("diy","main/diy","default","diy风格"),
HPLUS("hplus","main/hplus_main","metrole","H+风格"),
FINEUI_STYLE("fineui","main/fineui_main","metrole", "fineUI风格");
FINEUI_STYLE("fineui","main/fineui_main","metrole", "fineUI风格"),
ADMINLTE_STYLE("adminlte","main/adminlte_main","metrole","AdminLTE风格");
/**
*

@ -76,6 +76,9 @@ public class AuthInterceptor implements HandlerInterceptor {
//通过转换获取用户的请求URL地址
String requestPath = ResourceUtil.getJgAuthRequsetPath(request);
requestPath = filterUrl(requestPath);
//API接口不做登陆验证
if (requestPath.length()>3&&"api/".equals(requestPath.substring(0,4))) {
return true;
@ -106,7 +109,6 @@ public class AuthInterceptor implements HandlerInterceptor {
}
logger.debug("-----authInterceptor----requestPath------"+requestPath);
//步骤三: 判断请求URL是否有菜单访问权限
if(!systemService.loginUserIsHasMenuAuth(requestPath,functionId,loginUserId,orgId)){
Boolean isAjax=isAjax(request);
@ -267,4 +269,20 @@ public class AuthInterceptor implements HandlerInterceptor {
public void setExcludeContainUrls(List<String> excludeContainUrls) {
this.excludeContainUrls = excludeContainUrls;
}
private String filterUrl(String requestPath){
String url = "";
if(oConvertUtils.isNotEmpty(requestPath)){
url = requestPath.replace("\\", "/");
url = requestPath.replace("//", "/");
if(url.indexOf("//")>=0){
url = filterUrl(url);
}
if(url.startsWith("/")){
url=url.substring(1);
}
}
return url;
}
}

@ -137,17 +137,18 @@ public class DynamicDBUtil {
list = findList(dbKey, sql, param);
if(ListUtils.isNullOrEmpty(list))
{
logger.error("Except one, but not find actually");
return null;
}
if(list.size() > 1)
{
logger.error("Except one, but more than one actually");
return null;
}
return list.get(0);
}
@ -161,12 +162,16 @@ public class DynamicDBUtil {
public static Object findOneByHash(final String dbKey, String sql, HashMap<String, Object> data){
List<Map<String, Object>> list;
list = findListByHash(dbKey, sql, data);
if(ListUtils.isNullOrEmpty(list)){
logger.error("Except one, but not find actually");
return null;
}
if(list.size() > 1){
logger.error("Except one, but more than one actually");
return null;
}
return list.get(0);
}

@ -0,0 +1,52 @@
package org.jeecgframework.core.util;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import net.sf.jxls.exception.ParsePropertyException;
import net.sf.jxls.transformer.XLSTransformer;
public class JxlsExcelExportUtil {
public static void export(Map<String,Object> beans,String exportFileName,String templateFilePath, HttpServletRequest request,HttpServletResponse response) throws ParsePropertyException, InvalidFormatException, IOException{
XLSTransformer transformer = new XLSTransformer();
InputStream is = new BufferedInputStream(new FileInputStream(templateFilePath));
org.apache.poi.ss.usermodel.Workbook workbook = transformer.transformXLS(is, beans);
//设置导出
response.addHeader("Cache-Control","no-cache");
response.setCharacterEncoding("UTF-8");
response.setContentType("application/octet-stream;charset=UTF-8");
String ua = request.getHeader("user-agent");
ua = ua == null ? null : ua.toLowerCase();
if(ua != null && (ua.indexOf("firefox") > 0 || ua.indexOf("safari")>0)){
try {
exportFileName = new String(exportFileName.getBytes(),"ISO8859-1");
response.addHeader("Content-Disposition","attachment;filename=" + exportFileName);
} catch (Exception e) {
}
}else{
try {
exportFileName = URLEncoder.encode(exportFileName, "utf-8");
response.addHeader("Content-Disposition","attachment;filename=" + exportFileName);
} catch (Exception e) {
}
}
ServletOutputStream out = response.getOutputStream();
workbook.write(out);
out.flush();
}
}

@ -860,7 +860,9 @@ public class ListtoMenu {
menuString.append("<li>");
if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+function.getFunctionIconStyle()+"\"></i>");
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\"fa "+function.getFunctionIconStyle()+"\"></i>");
}else{
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+SysACEIconEnum.toEnum(function.getTSIcon().getIconClas()).getThemes()+"\"></i>");
}
@ -1118,4 +1120,26 @@ public class ListtoMenu {
return menuString.toString();
}
/**
* AdminLTE
* @param map the map of Map<Integer, List<TSFunction>>
* @param style AdminLTE
* @return
*/
public static String getAdminlteTree(Map<Integer, List<TSFunction>> map) {
if(map==null||map.size()==0||!map.containsKey(0)){return "不具有任何权限,\n请找管理员分配权限";}
StringBuffer menuString = new StringBuffer();
List<TSFunction> list = map.get(0);
for (TSFunction function : list) {
if(!function.hasSubFunction(map)){
menuString.append(getChildOfTree(function,1,map));
}else{
menuString.append("<li fit=\"false\" border=\"false\">");
menuString.append("<a onclick=\"onSelectTree('"+function.getId()+"')\">"+ getMutiLang(function.getFunctionName()) +"</a>");
menuString.append("</li>");
}
}
return menuString.toString();
}
}

@ -0,0 +1,36 @@
package org.jeecgframework.core.util;
public class UrlCheckUtil {
/**
*url
*
* @return
*/
public static Boolean checkUrl(String url,String specifyCharacter) {
url=url.replace("\\", "/");
Boolean flag = false;
if(url.contains(specifyCharacter)){
flag=true;
}
return flag;
}
/**
* url/.//../,true
*/
public static Boolean checkUrl(String url) {
return checkUrl(url,"/./") || checkUrl(url,"/../");
}
public static void main(String[] args) {
try {
Boolean checkUrl = checkUrl("\\user\\.\\aa.jpg","/./");
System.out.println(checkUrl);
if(checkUrl){
throw new Exception("文件地址不合法");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -235,8 +235,13 @@ public class BaseTag extends JeecgTag {
sb.append("<script type=\"text/javascript\" charset=\"utf-8\" src=\""+basePath+"/plug-in/ueditor/ueditor.all.min.js\"></script>");
}
if (oConvertUtils.isIn("uploadify", types)) {
/*sb.append("<link rel=\"stylesheet\" href=\""+basePath+"/plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");*/
sb.append("<link rel=\"stylesheet\" href=\""+basePath+"/plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/plupload/plupload.full.min.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/tools/Map.js\"></script>");
}
types = null;

@ -15,6 +15,7 @@ import javax.servlet.jsp.tagext.TagSupport;
* @version 1.0
*/
public class ComboTreeTag extends TagSupport {
private static final long serialVersionUID = 1L;
protected String id;// ID
protected String url;// 远程数据URL
protected String name;// 控件名称

@ -1565,7 +1565,8 @@ public class DataGridTag extends TagSupport {
sb.append("columns:[[");
this.getField(sb);
sb.append("]],");
sb.append("onLoadSuccess:function(data){$(\"#"+name+"\")."+grid+"(\"clearSelections\");");
sb.append("onLoadSuccess:function(data){$(\"#"+name+"\")."+grid+"(\"clearChecked\");$(\"#"+name+"\")."+grid+"(\"clearSelections\");");
//sb.append(" $(this).datagrid(\"fixRownumber\");");
@ -4122,7 +4123,7 @@ appendLine(sb," }}\">关系</th>");
}else{
appendLine(sb,"var toolbar = [{");
appendLine(sb," text:'',");
appendLine(sb," iconCls:'"+btnCls+"',");
appendLine(sb," iconCls:'icon-add',");
appendLine(sb," handler:function(){append();}");
appendLine(sb,"},{");
appendLine(sb," text:'',");

@ -129,6 +129,9 @@ public class MenuTag extends JeecgTag {
}else if (style.equals("fineui")){
sb.append(ListtoMenu.getFineuiMultistageTree(menuFun));
}
if(style.equals("adminlte")) {
sb.append(ListtoMenu.getAdminlteTree(menuFun));
}
this.putTagCache(sb);

@ -18,11 +18,9 @@ import org.codehaus.jackson.map.ObjectMapper;
import org.jeecgframework.core.common.hibernate.qbc.PageList;
import org.jeecgframework.core.common.model.json.ComboBox;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ReflectHelper;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.core.util.GzipUtilities;
import org.jeecgframework.tag.vo.datatable.DataTableReturn;
import org.jeecgframework.tag.vo.easyui.Autocomplete;
import org.jeecgframework.web.system.pojo.base.TSRole;
@ -486,22 +484,10 @@ public class TagUtil {
response.setHeader("Cache-Control", "no-store");
String jsonStr = TagUtil.getJson(dg);
try {
HttpServletRequest request = ContextHolderUtils.getRequest();
if (GzipUtilities.isGzipSupported(request) && !GzipUtilities.isGzipDisabled(request)) {
log.debug("-------datagrid----json-----开启Gzip压缩-------------");
response.setHeader("Content-Encoding", "gzip");
OutputStream pw = GzipUtilities.getGzipWriter(response);
pw.write(jsonStr.getBytes("UTF-8"));
pw.flush();
pw.close();
} else {
PrintWriter pw = response.getWriter();
pw.write(jsonStr.toString());
pw.flush();
pw.close();
}
PrintWriter pw = response.getWriter();
pw.write(jsonStr.toString());
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}finally{
@ -528,22 +514,10 @@ public class TagUtil {
JSONObject object = JSONObject.parseObject(jsonStr);
JSONArray rows = object.getJSONArray("rows");
try {
HttpServletRequest request = ContextHolderUtils.getRequest();
if (GzipUtilities.isGzipSupported(request) && !GzipUtilities.isGzipDisabled(request)) {
log.debug("-------datagrid----json-----开启Gzip压缩-------------");
response.setHeader("Content-Encoding", "gzip");
OutputStream pw = GzipUtilities.getGzipWriter(response);
pw.write(rows.toString().getBytes("UTF-8"));
pw.flush();
pw.close();
} else {
PrintWriter pw = response.getWriter();
pw.write(rows.toString());
pw.flush();
pw.close();
}
PrintWriter pw = response.getWriter();
pw.write(rows.toString());
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}finally{
@ -577,23 +551,11 @@ public class TagUtil {
}
try {
HttpServletRequest request = ContextHolderUtils.getRequest();
if (GzipUtilities.isGzipSupported(request) && !GzipUtilities.isGzipDisabled(request)) {
log.debug("-------datagrid----json-----开启Gzip压缩-------------");
response.setHeader("Content-Encoding", "gzip");
OutputStream pw = GzipUtilities.getGzipWriter(response);
pw.write(object.toString().getBytes("UTF-8"));
pw.flush();
pw.close();
} else {
PrintWriter pw = response.getWriter();
pw = response.getWriter();
pw.write(object.toString());
pw.flush();
pw.close();
}
PrintWriter pw = response.getWriter();
pw = response.getWriter();
pw.write(object.toString());
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}finally{

@ -0,0 +1,402 @@
package org.jeecgframework.tag.core.easyui;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.SysThemesUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.core.JeecgTag;
/**
* pluploaduploadify<br>
* uploadify <br>
* 1easyui.tld uploadtag-class<br>
* 2baseuploadify<br>
* @author taoYan
* @since 2018816
*/
public class UploadPlTag extends JeecgTag {
private static final long serialVersionUID = -9022815118906773203L;
/**通用文件后缀*/
private static final String ALL_COMMON_FILE = "doc,docx,txt,ppt,xls,xlsx,html,htm";
/**图片文件后缀*/
private static final String ALL_IMG_FILE = "jpg,jpeg,png,gif,bmp,ico,tif";
protected String id;// ID
protected String uploader;//url
protected String name;//控件名称
protected String formData;//参数名称
protected String extend="";//上传文件的扩展名
protected String buttonText="浏览";//按钮文本
protected boolean multi=true;//是否多文件
protected String queueID="filediv";//文件容器ID
protected boolean dialog=true;//是否是弹出窗口模式
protected String callback;
protected boolean auto=false;//是否自动上传
protected String onUploadSuccess;//上传成功处理函数
protected boolean view=false;//生成查看删除链接
protected String formId;//参数名称
private boolean outhtml = true;
private String onUploadStart;//上传开始处理函数
private String height="18";//自定义上传按钮高度
private String width="80";//自定义上传按钮宽度
private String fileSizeLimit = "15MB";//上传文件大小设置
private String onFileAdded;//文件添加时触发方法
private String onFilesRemoved;//文件移除时触发方法
@SuppressWarnings("unchecked")
public int doStartTag() throws JspTagException {
List<String> idList = (List<String>) pageContext.getRequest().getAttribute("nameList");
if(idList == null || idList.isEmpty()){
idList = new ArrayList<String>();
}
idList.add(id);
pageContext.getRequest().setAttribute("nameList", idList);
return EVAL_PAGE;
}
public int doEndTag() throws JspTagException {
JspWriter out = null;
try {
out = this.pageContext.getOut();
out.print(end().toString());
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
out.clear();
out.close();
} catch (Exception e2) {
}
}
return EVAL_PAGE;
}
public StringBuffer end() {
StringBuffer sb = this.getTagCache();
if(sb != null){
return sb;
}
sb = new StringBuffer();
FreemarkerHelper free = new FreemarkerHelper();
Map<String, Object> mainConfig = new HashMap<String, Object>();
mainConfig.put("obj",this);
mainConfig.put("style","uploadify");
List<String> idList = (List<String>) pageContext.getRequest().getAttribute("nameList");
mainConfig.put("idList",idList);
String superQuery = free.parseTemplate("/org/jeecgframework/tag/ftl/plupload.ftl", mainConfig);
String format = "\r\n"; //调试 格式化
sb.append(superQuery).append(format);
return sb;
}
public String getAllowedFilesExt(){
if(oConvertUtils.isEmpty(extend)){
return ALL_COMMON_FILE+","+ALL_IMG_FILE;
}else{
if("pic".equals(extend)){
return ALL_IMG_FILE;
}else if(extend.equals("office")){
return ALL_COMMON_FILE;
}else{
if(extend.indexOf("*.")>=0){
extend = extend.replace("*.", "");
}
if(extend.indexOf(";")>=0){
extend = extend.replace(";", ",");
}
return extend;
}
}
}
/**
* ,jsessionidbug jueyue --- 20130916
* @return
*/
public String getUploader() {
return uploader+"&sessionId="+pageContext.getSession().getId()+"',";
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the formData
*/
public String getFormData() {
return formData;
}
/**
* @param formData the formData to set
*/
public void setFormData(String formData) {
this.formData = formData;
}
/**
* @return the extend
*/
public String getExtend() {
return extend;
}
/**
* @param extend the extend to set
*/
public void setExtend(String extend) {
this.extend = extend;
}
/**
* @return the buttonText
*/
public String getButtonText() {
return buttonText;
}
/**
* @param buttonText the buttonText to set
*/
public void setButtonText(String buttonText) {
this.buttonText = buttonText;
}
/**
* @return the multi
*/
public boolean isMulti() {
return multi;
}
/**
* @param multi the multi to set
*/
public void setMulti(boolean multi) {
this.multi = multi;
}
/**
* @return the queueID
*/
public String getQueueID() {
return queueID;
}
/**
* @param queueID the queueID to set
*/
public void setQueueID(String queueID) {
this.queueID = queueID;
}
/**
* @return the dialog
*/
public boolean isDialog() {
return dialog;
}
/**
* @param dialog the dialog to set
*/
public void setDialog(boolean dialog) {
this.dialog = dialog;
}
/**
* @return the callback
*/
public String getCallback() {
return callback;
}
/**
* @param callback the callback to set
*/
public void setCallback(String callback) {
this.callback = callback;
}
/**
* @return the auto
*/
public boolean isAuto() {
return auto;
}
/**
* @param auto the auto to set
*/
public void setAuto(boolean auto) {
this.auto = auto;
}
/**
* @return the onUploadSuccess
*/
public String getOnUploadSuccess() {
return onUploadSuccess;
}
/**
* @param onUploadSuccess the onUploadSuccess to set
*/
public void setOnUploadSuccess(String onUploadSuccess) {
this.onUploadSuccess = onUploadSuccess;
}
/**
* @return the view
*/
public boolean isView() {
return view;
}
/**
* @param view the view to set
*/
public void setView(boolean view) {
this.view = view;
}
/**
* @return the formId
*/
public String getFormId() {
return formId;
}
/**
* @param formId the formId to set
*/
public void setFormId(String formId) {
this.formId = formId;
}
/**
* @return the outhtml
*/
public boolean isOuthtml() {
return outhtml;
}
/**
* @param outhtml the outhtml to set
*/
public void setOuthtml(boolean outhtml) {
this.outhtml = outhtml;
}
/**
* @return the onUploadStart
*/
public String getOnUploadStart() {
return onUploadStart;
}
/**
* @param onUploadStart the onUploadStart to set
*/
public void setOnUploadStart(String onUploadStart) {
this.onUploadStart = onUploadStart;
}
/**
* @return the height
*/
public String getHeight() {
return height;
}
/**
* @param height the height to set
*/
public void setHeight(String height) {
this.height = height;
}
/**
* @return the width
*/
public String getWidth() {
return width;
}
/**
* @param width the width to set
*/
public void setWidth(String width) {
this.width = width;
}
/**
* @return the fileSizeLimit
*/
public String getFileSizeLimit() {
return fileSizeLimit;
}
/**
* @param fileSizeLimit the fileSizeLimit to set
*/
public void setFileSizeLimit(String fileSizeLimit) {
this.fileSizeLimit = fileSizeLimit;
}
/**
* @param uploader the uploader to set
*/
public void setUploader(String uploader) {
this.uploader = uploader;
}
/**
* @return the onFileAdded
*/
public String getOnFileAdded() {
return onFileAdded;
}
/**
* @param onFileAdded the onFileAdded to set
*/
public void setOnFileAdded(String onFileAdded) {
this.onFileAdded = onFileAdded;
}
/**
* @return the onFilesRemoved
*/
public String getOnFilesRemoved() {
return onFilesRemoved;
}
/**
* @param onFilesRemoved the onFilesRemoved to set
*/
public void setOnFilesRemoved(String onFilesRemoved) {
this.onFilesRemoved = onFilesRemoved;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UploadTag [id=").append(id).append(", uploader=")
.append(uploader).append(", name=").append(name)
.append(", formData=").append(formData).append(", extend=")
.append(extend).append(", buttonText=").append(buttonText)
.append(", multi=").append(multi).append(", queueID=")
.append(queueID).append(", dialog=").append(dialog)
.append(", callback=").append(callback).append(", auto=")
.append(auto).append(", onUploadSuccess=")
.append(onUploadSuccess).append(", view=").append(view)
.append(", formId=").append(formId).append(", outhtml=")
.append(outhtml).append(", fileSizeLimit=").append(fileSizeLimit)
.append(",sysTheme=").append(SysThemesUtil.getSysTheme(ContextHolderUtils.getRequest()).getStyle())
.append(",brower_type=").append(ContextHolderUtils.getSession().getAttribute("brower_type"))
.append(",height=").append(height)
.append(",width=").append(width)
.append("]");
return builder.toString();
}
}

@ -0,0 +1,449 @@
package org.jeecgframework.tag.core.easyui;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.FileUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.oConvertUtils;
public class WebUploaderPlTag extends TagSupport {
private static final long serialVersionUID = -2057061070457899124L;
/**通用文件后缀*/
private static final String ALL_COMMON_FILE = "doc,docx,txt,ppt,xls,xlsx,html,htm";
/**图片文件后缀*/
private static final String ALL_IMG_FILE = "jpg,jpeg,png,gif,bmp,ico,tif";
private String name;//①文件路径 input默认name、②action返回的文件路径的name
private boolean auto=false;//是否自动上传上传按钮风格
private String url = "systemController/filedeal.do";//文件上传处理url
private int fileNumLimit =3;//fileNumLimit 最大文件数 TODO
private int fileSingleSizeLimit=5242880;//fileSingleSizeLimit单个文件最大5M[1024*1024*5]
private String fileVal="file";//fileVal设置文件上传域的name,默认file
private String buttonStyle;//自定义CSS样式 【 废弃】
private int size;//文件总大小【 废弃】
private boolean duplicate=false;//去重, 根据文件名字、文件大小和最后修改时间来生成hash Key.【 废弃】
private String showImgDiv;//显示图片的div,如果不给会默认在按钮下方添加div其id为'tempdiv_'+name【 废弃】
private String showAndDownUrl=ResourceUtil.getConfigByName("showAndDownUrl");//预览图片请求的url&文件下载url
private String pathValues;//默认值
private String type="file";
private String buttonText = "选择文件";//控件按钮显示文本
private String extensions;//允许的文件后缀,不带点,多个用逗号分割
private String extendParams;//类似css写法 这是文件上传时候需要传递的参数
private String datatype;//只要该属性有值,均视之为不为空
private String nullMsg;//空的时候的提示信息,默认会根据当前控件的类型提示,文件类则提示“请选择文件”;图片类则提示“请选择图片”.
private String readOnly="false";//保留字段
private String bizType;//业务类型,根据该类型确定上传路径
private boolean displayTxt=true;//是否显示上传列表[默认显示]true显示false隐藏
private boolean outJs = false;//是否在外部引入了js和css
private boolean swfTransform = false;//是否转换成swf文件文件预览使用
private String viewModel = "list";//TODO 未用到 支持list(文件列表)/thumb(缩略图模式)
public int doStartTag() throws JspTagException {
return EVAL_PAGE;
}
public int doEndTag() throws JspTagException {
JspWriter out = null;
StringBuffer sb = new StringBuffer();
try {
out = this.pageContext.getOut();
end(sb);
out.print(sb.toString());
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
if(out!=null){
try {
out.clearBuffer();
sb.setLength(0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return EVAL_PAGE;
}
public void end(StringBuffer sb) {
FreemarkerHelper free = new FreemarkerHelper();
Map<String, Object> mainConfig = new HashMap<String, Object>();
mainConfig.put("obj",this);
String superQuery = free.parseTemplate("/org/jeecgframework/tag/ftl/plupload.ftl", mainConfig);
String format = "\r\n"; //调试 格式化
sb.append(superQuery).append(format);
}
/**
* @param size
* @author taoYan
* @since 2018810
*/
private String random(int size){
String sources = "QAZWSXEDCRFVTGBYHNUJMIKOLP0123456789qwertyuiopasdfghjklzxcvbnm";
Random rand = new Random();
StringBuffer flag = new StringBuffer();
for (int j = 0; j < size; j++){
flag.append(sources.charAt(rand.nextInt(sources.length())) + "");
}
return flag.toString();
}
public String randomSix(){
return random(6);
}
/**
*
* @author taoYan
* @since 2018810
*/
public String getFilename(String path){
if(oConvertUtils.isEmpty(path)){
return null;
}
int index1 = path.lastIndexOf("/");
int index2 = path.lastIndexOf("_");
int index3 = path.lastIndexOf(".");
if(index1==-1 ||index2==-1||index3==-1){
return null;
}
String name = path.substring(index1+1,index2);
String ext = path.substring(index3);
return name+ext;
}
/**
* 1 -1
* @author taoYan
* @since 2018810
*/
public Integer supportView(String path){
Integer res = -1;
int index = path.lastIndexOf(".");
if(oConvertUtils.isEmpty(path)||index==-1){
return res;
}
String ext = path.substring(index+1);
if(FileUtils.isPicture(ext)){
res = 1;
}else if(this.swfTransform){
res = 1;
}
return res;
}
/**
*
* @author taoYan
* @since 2018810
*/
public String getAllowedFilesExt(){
if(oConvertUtils.isEmpty(extensions)){
return ALL_COMMON_FILE;
}
return extensions;
}
public String getAllowedIMG(){
if(oConvertUtils.isEmpty(extensions)){
return ALL_IMG_FILE;
}
return extensions;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the auto
*/
public boolean isAuto() {
return auto;
}
/**
* @param auto the auto to set
*/
public void setAuto(boolean auto) {
this.auto = auto;
}
/**
* @return the buttonStyle
*/
public String getButtonStyle() {
return buttonStyle;
}
/**
* @param buttonStyle the buttonStyle to set
*/
public void setButtonStyle(String buttonStyle) {
this.buttonStyle = buttonStyle;
}
/**
* @return the url
*/
public String getUrl() {
return url;
}
/**
* @param url the url to set
*/
public void setUrl(String url) {
this.url = url;
}
/**
* @return the fileNumLimit
*/
public int getFileNumLimit() {
return fileNumLimit;
}
/**
* @param fileNumLimit the fileNumLimit to set
*/
public void setFileNumLimit(int fileNumLimit) {
this.fileNumLimit = fileNumLimit;
}
/**
* @return the fileSingleSizeLimit
*/
public int getFileSingleSizeLimit() {
return fileSingleSizeLimit;
}
/**
* @param fileSingleSizeLimit the fileSingleSizeLimit to set
*/
public void setFileSingleSizeLimit(int fileSingleSizeLimit) {
this.fileSingleSizeLimit = fileSingleSizeLimit;
}
/**
* @return the size
*/
public int getSize() {
return size;
}
/**
* @param size the size to set
*/
public void setSize(int size) {
this.size = size;
}
/**
* @return the fileVal
*/
public String getFileVal() {
return fileVal;
}
/**
* @param fileVal the fileVal to set
*/
public void setFileVal(String fileVal) {
this.fileVal = fileVal;
}
/**
* @return the duplicate
*/
public boolean isDuplicate() {
return duplicate;
}
/**
* @param duplicate the duplicate to set
*/
public void setDuplicate(boolean duplicate) {
this.duplicate = duplicate;
}
/**
* @return the showImgDiv
*/
public String getShowImgDiv() {
return showImgDiv;
}
/**
* @param showImgDiv the showImgDiv to set
*/
public void setShowImgDiv(String showImgDiv) {
this.showImgDiv = showImgDiv;
}
/**
* @return the showAndDownUrl
*/
public String getShowAndDownUrl() {
return showAndDownUrl;
}
/**
* @param showAndDownUrl the showAndDownUrl to set
*/
public void setShowAndDownUrl(String showAndDownUrl) {
this.showAndDownUrl = showAndDownUrl;
}
/**
* @return the pathValues
*/
public String getPathValues() {
return pathValues;
}
/**
* @param pathValues the pathValues to set
*/
public void setPathValues(String pathValues) {
this.pathValues = pathValues;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* @return the buttonText
*/
public String getButtonText() {
return buttonText;
}
/**
* @param buttonText the buttonText to set
*/
public void setButtonText(String buttonText) {
this.buttonText = buttonText;
}
/**
* @return the extensions
*/
public String getExtensions() {
return extensions;
}
/**
* @param extensions the extensions to set
*/
public void setExtensions(String extensions) {
this.extensions = extensions;
}
/**
* @return the extendParams
*/
public String getExtendParams() {
return extendParams;
}
/**
* @param extendParams the extendParams to set
*/
public void setExtendParams(String extendParams) {
this.extendParams = extendParams;
}
/**
* @return the datatype
*/
public String getDatatype() {
return datatype;
}
/**
* @param datatype the datatype to set
*/
public void setDatatype(String datatype) {
this.datatype = datatype;
}
/**
* @return the nullMsg
*/
public String getNullMsg() {
return nullMsg;
}
/**
* @param nullMsg the nullMsg to set
*/
public void setNullMsg(String nullMsg) {
this.nullMsg = nullMsg;
}
/**
* @return the readOnly
*/
public String getReadOnly() {
return readOnly;
}
/**
* @param readOnly the readOnly to set
*/
public void setReadOnly(String readOnly) {
this.readOnly = readOnly;
}
/**
* @return the bizType
*/
public String getBizType() {
return bizType;
}
/**
* @param bizType the bizType to set
*/
public void setBizType(String bizType) {
this.bizType = bizType;
}
/**
* @return the displayTxt
*/
public boolean isDisplayTxt() {
return displayTxt;
}
/**
* @param displayTxt the displayTxt to set
*/
public void setDisplayTxt(boolean displayTxt) {
this.displayTxt = displayTxt;
}
/**
* @return the outJs
*/
public boolean isOutJs() {
return outJs;
}
/**
* @param outJs the outJs to set
*/
public void setOutJs(boolean outJs) {
this.outJs = outJs;
}
/**
* @return the swfTransform
*/
public boolean isSwfTransform() {
return swfTransform;
}
/**
* @param swfTransform the swfTransform to set
*/
public void setSwfTransform(boolean swfTransform) {
this.swfTransform = swfTransform;
}
/**
* @return the viewModel
*/
public String getViewModel() {
return viewModel;
}
/**
* @param viewModel the viewModel to set
*/
public void setViewModel(String viewModel) {
this.viewModel = viewModel;
}
}

@ -1,18 +1,17 @@
package org.jeecgframework.tag.core.easyui;
import java.io.IOException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
/**
* WebUploader
* WebUploader
* @author scott
*
*/
public class WebUploaderTag extends TagSupport {
private static final long serialVersionUID = 1L;

File diff suppressed because it is too large Load Diff

@ -38,7 +38,9 @@ public class FormHtmlUtil {
}else if(cgFormFieldEntity.getShowType().equals("datetime")){
html=getDatetimeFormHtml(cgFormFieldEntity);
}else if(cgFormFieldEntity.getShowType().equals("file")){
html=getFileFormHtml(cgFormFieldEntity);
html=getFilePluploadFormHtml(cgFormFieldEntity);
}else if(cgFormFieldEntity.getShowType().equals("textarea")){
html=getTextAreaFormHtml(cgFormFieldEntity);
}else if(cgFormFieldEntity.getShowType().equals("popup")){
@ -394,6 +396,7 @@ public class FormHtmlUtil {
/**
*filehtml
*/
@Deprecated
private static String getFileFormHtml(CgFormFieldEntity cgFormFieldEntity){
StringBuilder html = new StringBuilder("");
@ -443,6 +446,55 @@ public class FormHtmlUtil {
}
/**
*filehtml
*/
private static String getFilePluploadFormHtml(CgFormFieldEntity cgFormFieldEntity){
StringBuilder html = new StringBuilder("");
html.append("<div class='uploadify'>");
html.append("<table>");
html.append("<#list filesList as fileB>");
html.append("<tr style=\"height:34px;\">");
html.append("<td>\\${fileB['title']}</td>");
html.append("<td><a href=\"commonController.do?viewFile&fileid=\\${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity\" title=\"下载\">下载</a></td>");
html.append("<td><a href=\"javascript:void(0);\" onclick=\"openwindow('预览','commonController.do?openViewFile&fileid=\\${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity','fList',700,500)\">预览</a></td>");
html.append("<td><a href=\"javascript:void(0)\" class=\"jeecgDetail\" onclick=\"del('cgUploadController.do?delFile&id=\\${fileB['fileKey']}',this)\">删除</a></td>");
html.append("</tr></#list></table>");
html.append("<div class='plupload-btns'>");
html.append("<div id='"+cgFormFieldEntity.getFieldName()+"Upselector' class='uploadify-button' style='cursor:pointer;height:18px; line-height:18px; width:80px; position: relative; z-index: 1;'>");
html.append("<span class='uploadify-button-text'>添加文件</span></div><input type='button' id = '"+cgFormFieldEntity.getFieldName()+"' style='display:none'/>");
html.append("<div class='form' id='filediv_"+cgFormFieldEntity.getFieldName()+"'> </div></div>");
html.append("<script type=\"text/javascript\">");
html.append("\\$(function(){");
html.append("var serverMsg=\"\";");
html.append("var m = new Map();");
html.append("if(location.href.indexOf('load=detail')!=-1){\\$('.plupload-btns').hide();}");
html.append("var addtrFile = function(file) {var fileName = file.name;if (fileName.length > 20) {fileName = fileName.substring(0, 15) + '...';}var fileSize = Math.ceil(file.size/1024);");
html.append("var html = '<div id=\"'+file.id+'\" class=\"uploadify-queue-item\"><div class=\"cancel\"><a class=\"iqueueDel\" href=\"javascript:void(0)\">X</a></div><span class=\"fileName\" title=\"'+file.name+'\">'+fileName+'('+fileSize+'KB)</span><span class=\"sdata\"></span><div class=\"uploadify-progress\"><div class=\"uploadify-progress-bar\"></div></div></div>';");
html.append("\\$('#filediv_"+cgFormFieldEntity.getFieldName()+"').append(html);}\r\n");
html.append("var uploader = new plupload.Uploader({runtimes: 'html5,flash',");
html.append("browse_button: '"+cgFormFieldEntity.getFieldName()+"Upselector',");
html.append("url: '\\${basePath}/cgUploadController.do?saveFiles&jsessionid='+\\$(\"#sessionUID\").val()+'',");
html.append("flash_swf_url: '\\${basePath}/plug-in/plupload/Moxie.swf',");
html.append("filters: {max_file_size: \"15mb\", mime_types: [{title: \"Common files\", extensions:\"txt,doc,docx,xls,xlsx,ppt,pdf,jpg,jpeg,png,gif\"}],prevent_duplicates:false},");
html.append("multipart_params:{'cgFormName':'"+cgFormFieldEntity.getTable().getTableName()+"',");
html.append("'cgFormField':'"+cgFormFieldEntity.getFieldName()+"'},multi_selection: true,");
html.append("init: {PostInit: function() {\\$.iplupload('"+cgFormFieldEntity.getFieldName()+"',uploader);},");
html.append("FilesAdded: function(up, files) {for(var a = 0;a<files.length;a++){addtrFile(files[a]);}},");
html.append("UploadProgress: function(up, file) {var percent = file.percent;\\$('#' + file.id).find('.uploadify-progress-bar').css({'width': percent + '%'});},");
html.append("BeforeUpload: function(up, file) {var params = up.getOption('multipart_params');var cgFormId=\\$(\"input[name='id']\").val();params['cgFormId'] = cgFormId;up.setOption('multipart_params',params);},");
html.append("FileUploaded: function(up, file, info) {var response = jQuery.parseJSON(info.response);if (response.success) {serverMsg = response.msg;\\$(\"#\"+file.id).find(\".sdata\").text(' - Complete');setTimeout(function(){\\$(\"#\"+file.id).fadeOut(\"slow\");},500);}},");
html.append("UploadComplete: function(up, files) {if(files.length>0){var win = frameElement.api.opener;win.reloadTable();win.tip(serverMsg);frameElement.api.close();}},");
html.append("Error: function(up, err) {if(err.code == plupload.FILE_EXTENSION_ERROR){tip(\"文件类型不识别!\");}else if(plupload.FILE_SIZE_ERROR = err.code){tip(\"文件大小超标!\");}console.log(err);}}");
html.append("});\r\nuploader.init();");
html.append("\\$('#filediv_"+cgFormFieldEntity.getFieldName()+"').on('click','.iqueueDel',function(eve){");
html.append("var itemObj = \\$(eve.target).closest('.uploadify-queue-item');uploader.removeFile(uploader.getFile(itemObj.attr('id')));itemObj.find('.sdata').text(' - 已取消');setTimeout(function(){itemObj.fadeOut('slow');},500);});});");
html.append("function upload() {\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('upload', '\\*');}");
html.append("function cancel() {\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('cancel', '\\*');}");
html.append("</script>\r\n");
return html.toString();
}
/**
*popuphtml
*/

@ -33,6 +33,7 @@ import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity;
import org.jeecgframework.web.cgform.entity.config.CgFormHeadEntity;
import org.jeecgframework.web.cgform.entity.template.CgformTemplateEntity;
import org.jeecgframework.web.cgform.exception.BusinessException;
import org.jeecgframework.web.cgform.service.autolist.CgTableServiceI;
import org.jeecgframework.web.cgform.service.autolist.ConfigServiceI;
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
@ -389,18 +390,30 @@ public class CgAutoListController extends BaseController{
public AjaxJson del(String configId,String id,
HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String message = "删除成功";
String tableName = PublicUtil.replaceTableName(configId);
String jversion = cgFormFieldService.getCgFormVersionByTableName(tableName);
String table = (String) configService.queryConfigs(tableName,jversion).get(CgAutoListConstant.TABLENAME);
//String jversion = cgFormFieldService.getCgFormVersionByTableName(configId);
//String table = (String) configService.queryConfigs(configId,jversion).get(CgAutoListConstant.TABLENAME);
try {
String tableName = PublicUtil.replaceTableName(configId);
String jversion = cgFormFieldService.getCgFormVersionByTableName(tableName);
String table = (String) configService.queryConfigs(tableName,jversion).get(CgAutoListConstant.TABLENAME);
//String jversion = cgFormFieldService.getCgFormVersionByTableName(configId);
//String table = (String) configService.queryConfigs(configId,jversion).get(CgAutoListConstant.TABLENAME);
cgTableService.delete(table, id);
log.info("["+IpUtil.getIpAddr(request)+"][online表单数据删除]"+message+"表名:"+configId);
systemService.addLog(message, Globals.Log_Type_DEL,
Globals.Log_Leavel_INFO);
} catch (BusinessException e) {
e.printStackTrace();
message = e.getMessage();
j.setSuccess(false);
}catch (Exception e) {
e.printStackTrace();
message = e.getMessage();
j.setSuccess(false);
}
cgTableService.delete(table, id);
String message = "删除成功";
log.info("["+IpUtil.getIpAddr(request)+"][online表单数据删除]"+message+"表名:"+configId);
systemService.addLog(message, Globals.Log_Type_DEL,
Globals.Log_Leavel_INFO);
j.setMsg(message);
return j;
}

@ -458,7 +458,10 @@ public class CgFormBuildController extends BaseController {
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/tools/easyuiextend.js\"></script>");
sb.append(SysThemesUtil.getEasyUiMainTheme(sysThemesEnum,basePath));
sb.append("<link rel=\"stylesheet\" href=\""+basePath+"/plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
//sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/plupload/plupload.full.min.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/tools/Map.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script>");
@ -692,9 +695,12 @@ public class CgFormBuildController extends BaseController {
logger.debug("name:"+ok.toString()+";value:"+ov.toString());
}
data = CommUtils.mapConvert(data);
dataBaseService.executeJavaExtend(formId, buttonCode, data, "start");
dataBaseService.executeSqlExtend(formId, buttonCode, data);
dataBaseService.executeJavaExtend(formId, buttonCode, data);
dataBaseService.executeJavaExtend(formId, buttonCode, data, "end");
}
j.setSuccess(true);

@ -322,7 +322,10 @@ public class CgformFtlController extends BaseController {
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/easyuiextend.js\"></script>");
sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"${basePath}/plug-in/easyui/themes/metrole/main.css\" type=\"text/css\"></link>");
sb.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
//sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/plupload/plupload.full.min.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/Map.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script>");
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script>");

@ -153,7 +153,9 @@ public class CgformEnhanceJavaController extends BaseController {
@ResponseBody
public AjaxJson doCgformEnhanceJava(CgformEnhanceJavaEntity cgformEnhanceJavaEntity, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
CgformEnhanceJavaEntity doCgformEnhanceJava = cgformEnhanceJavaService.getCgformEnhanceJavaEntityByCodeFormId(cgformEnhanceJavaEntity.getButtonCode(), cgformEnhanceJavaEntity.getFormId());
CgformEnhanceJavaEntity doCgformEnhanceJava = cgformEnhanceJavaService.getCgformEnhanceJavaEntityByCodeFormId(cgformEnhanceJavaEntity.getButtonCode(), cgformEnhanceJavaEntity.getFormId(), cgformEnhanceJavaEntity.getEvent());
if(doCgformEnhanceJava!=null){
j.setObj(doCgformEnhanceJava);
j.setSuccess(true);
@ -216,7 +218,7 @@ public class CgformEnhanceJavaController extends BaseController {
//根据buttonCode和formId初始化数据
cgformEnhanceJavaEntity.setButtonCode("add");
if (StringUtil.isNotEmpty(cgformEnhanceJavaEntity.getButtonCode())&&StringUtil.isNotEmpty(cgformEnhanceJavaEntity.getFormId())) {
CgformEnhanceJavaEntity cgformEnhanceJavaEntityVo = cgformEnhanceJavaService.getCgformEnhanceJavaEntityByCodeFormId(cgformEnhanceJavaEntity.getButtonCode(), cgformEnhanceJavaEntity.getFormId());
CgformEnhanceJavaEntity cgformEnhanceJavaEntityVo = cgformEnhanceJavaService.getCgformEnhanceJavaEntityByCodeFormId(cgformEnhanceJavaEntity.getButtonCode(), cgformEnhanceJavaEntity.getFormId(), cgformEnhanceJavaEntity.getEvent());
if(cgformEnhanceJavaEntityVo!=null){
cgformEnhanceJavaEntity = cgformEnhanceJavaEntityVo;
}

@ -107,7 +107,7 @@ public class GenerateController extends BaseController {
if(cgFormHead.getJformType()==1 || cgFormHead.getJformType()==3){
//如果是单表或者附表,则进入单表模型
request.setAttribute("jspModeList", GenerateUtil.getOnlineGenerateEnum("single","ext-common","Y".equals(cgFormHead.getIsTree())));// 默认老版本模板(IE8+/不支持移动/列表标签)
request.setAttribute("jspModeList", GenerateUtil.getOnlineGenerateEnum("single","ext","Y".equals(cgFormHead.getIsTree())));// 默认老版本模板(IE8+/不支持移动/列表标签)
returnModelAndView = "jeecg/cgform/generate/single";
}else{
@ -122,7 +122,7 @@ public class GenerateController extends BaseController {
}
}
request.setAttribute("jspModeList", GenerateUtil.getOnlineGenerateEnum("onetomany","ext-common","Y".equals(cgFormHead.getIsTree())));// 默认老版本模板(IE8+/不支持移动/列表标签)
request.setAttribute("jspModeList", GenerateUtil.getOnlineGenerateEnum("onetomany","ext","Y".equals(cgFormHead.getIsTree())));// 默认老版本模板(IE8+/不支持移动/列表标签)
request.setAttribute("subTableList", subTableList);
returnModelAndView = "jeecg/cgform/generate/one2many";

@ -12,10 +12,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.web.cgform.entity.upload.CgUploadEntity;
import org.jeecgframework.web.cgform.service.upload.CgUploadServiceI;
import org.jeecgframework.web.system.pojo.base.TSAttachment;
@ -23,6 +21,7 @@ import org.jeecgframework.web.system.service.SystemService;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.common.UploadFile;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.constant.Globals;
@ -41,6 +40,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import net.sf.json.JSONObject;
/**
*
@ -195,18 +196,23 @@ public class CgUploadController extends BaseController {
write2Disk(mf, extend, savePath);
TSAttachment attachment = new TSAttachment();
attachment.setId(UUID.randomUUID().toString().replace("-", ""));
attachment.setAttachmenttitle(fileName);
attachment.setAttachmenttitle(fileName.substring(0,fileName.lastIndexOf(".")));
attachment.setCreatedate(new Timestamp(new Date().getTime()));
attachment.setExtend(extend);
attachment.setRealpath(path + myfilename);
attachment.setSwfpath( path + FileUtils.getFilePrefix(myfilename) + ".swf");
SwfToolsUtil.convert2SWF(savePath);
String globalSwfTransformFlag = ResourceUtil.getConfigByName("swf.transform.flag");
if("true".equals(globalSwfTransformFlag) && !FileUtils.isPicture(extend)){
attachment.setSwfpath( path + FileUtils.getFilePrefix(myfilename) + ".swf");
SwfToolsUtil.convert2SWF(savePath);
}
systemService.save(attachment);
attributes.put("url", path + myfilename);
attributes.put("name", fileName);
attributes.put("swfpath", attachment.getSwfpath());
attributes.put("fileid", attachment.getId());
}
}
ajaxJson.setAttributes(attributes);
@ -272,5 +278,77 @@ public class CgUploadController extends BaseController {
return hexString;
}
/**
* Online
* 1.,
* 2.(),,,(/)
*/
@RequestMapping(params = "delAttachment")
@ResponseBody
public AjaxJson delAttachment( HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String id = request.getParameter("id");
try {
CgUploadEntity file = systemService.getEntity(CgUploadEntity.class, id);
if(file==null){
//如果关系表中无数据,则表示是情景1
TSAttachment attachment = systemService.getEntity(TSAttachment.class, id);
cgUploadService.deleteAttachment(attachment);
j.setObj(1);//情景1
}else{
j.setObj(0);//情景2
}
j.setSuccess(true);
} catch (Exception e) {
j.setSuccess(false);
}
return j;
}
@RequestMapping(params = "updateCgformFile")
@ResponseBody
public AjaxJson updateCgformFile( HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String cgFormId = oConvertUtils.getString(request.getParameter("cgFormId"));//动态表主键ID
String tableName = oConvertUtils.getString(request.getParameter("cgFormName"));//动态表名
String attachments = oConvertUtils.getString(request.getParameter("attachment"));//动态表上传控件字段
try {
cgUploadService.updateCgFormFile(cgFormId, tableName, attachments);
} catch (Exception e) {
j.setSuccess(false);
}
return j;
}
/**
*
* @author taoYan
* @since 201894
*/
@RequestMapping(params = "fileList")
public ModelAndView fileList(HttpServletRequest request) {
String cgFormId = oConvertUtils.getString(request.getParameter("cgformId"));//动态表主键ID
String tableName = oConvertUtils.getString(request.getParameter("cgformName"));//动态表名
String cgField = oConvertUtils.getString(request.getParameter("cgformField"));//动态表上传控件字段
CriteriaQuery cq = new CriteriaQuery(CgUploadEntity.class);
cq.eq("cgformName", tableName);
cq.eq("cgformId", cgFormId);
cq.eq("cgformField", cgField);
cq.add();
List<CgUploadEntity> list = this.systemService.getListByCriteriaQuery(cq, false);
net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(list);
JSONObject json = new JSONObject();
json.put("total",list.size());
json.put("rows",array);
request.setAttribute("datagridData", json);
String img = request.getParameter("img");
if("1".equals(img)){
return new ModelAndView("common/upload/cgformUploadImglist");
}else{
return new ModelAndView("common/upload/cgformUploadFilelist");
}
}
//TODO 1.更新表cgform_uploadfiles的时候是根据页面传过来的ID以xx结尾判断历史OR新增文件,这个功能应该在java代码中查询数据库校验
//TODO 2.新增文件 但是不提交表单 那么附件表就会产生垃圾数据 需要写个xx功能 清除垃圾文件/数据
//TODO 3.上传代码在宏中定义但是依赖部分页面JS代码通用性不好。
}

@ -48,7 +48,11 @@ public class CgformEnhanceJavaEntity implements java.io.Serializable {
/**生效状态 0:无效/1:有效*/
@Excel(name="生效状态")
private java.lang.String activeStatus;
/**事件状态 end结束/start开始**/
@Excel(name="事件状态")
private java.lang.String event;
/**
*: java.lang.String
*@return: java.lang.String
@ -145,10 +149,27 @@ public class CgformEnhanceJavaEntity implements java.io.Serializable {
public void setActiveStatus(java.lang.String activeStatus){
this.activeStatus = activeStatus;
}
/**
*: java.lang.String
*@return: java.lang.String 0/1
*/
public java.lang.String getEvent() {
return event;
}
/**
*: java.lang.String
*@param: java.lang.String 0/1
*/
public void setEvent(java.lang.String event) {
this.event = event;
}
@Override
public String toString() {
return "CgformEnhanceJavaEntity [id=" + id + ", buttonCode="
+ buttonCode + ", cgJavaType=" + cgJavaType + ", cgJavaValue="
+ cgJavaValue + ", formId=" + formId + ", activeStatus=" + activeStatus + "]";
+ cgJavaValue + ", formId=" + formId + ", activeStatus=" + activeStatus + ", event=" + event + "]";
}
}

@ -49,7 +49,9 @@ public interface CgTableServiceI {
* @param id
* @return
*/
public boolean delete(String table,Object id);
public boolean delete(String table,Object id)throws org.jeecgframework.web.cgform.exception.BusinessException;
/**
*
* @param table

@ -28,7 +28,7 @@ public interface DataBaseService {
* sql
*
*/
public void executeSqlExtend(String formId,String buttonCode,Map<String, Object> data);
public void executeSqlExtend(String formId,String buttonCode,Map<String, Object> data) throws BusinessException;
public Object getPkValue(String tableName);
@ -40,6 +40,15 @@ public interface DataBaseService {
*/
public void executeJavaExtend(String formId, String buttonCode,Map<String, Object> data) throws BusinessException;
/**
* java
* @param formId
* @param buttonCode
* @param data
* @param event
*/
public void executeJavaExtend(String formId, String buttonCode,Map<String, Object> data, String event) throws BusinessException;
public List<CgformEnhanceJavaEntity> getCgformEnhanceJavaEntityByFormId(String formId);
}

@ -42,6 +42,15 @@ public interface CgformEnhanceJavaServiceI extends CommonService{
public CgformEnhanceJavaEntity getCgformEnhanceJavaEntityByCodeFormId(
String buttonCode, String formId);
/**
*
* @param buttonCode
* @param formId
* @return
*/
public CgformEnhanceJavaEntity getCgformEnhanceJavaEntityByCodeFormId(
String buttonCode, String formId, String event);
/**
*
* @param cgformEnhanceJavaEntity

@ -70,11 +70,14 @@ public class CgTableServiceImpl extends CommonServiceImpl implements CgTableServ
}
@SuppressWarnings("unchecked")
public boolean delete(String table, Object id) {
try{
public boolean delete(String table, Object id) throws org.jeecgframework.web.cgform.exception.BusinessException {
// try{
CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(table);
Map<String,Object> data = dataBaseService.findOneForJdbc(table, id.toString());
dataBaseService.executeJavaExtend(head.getId(), "delete", data, "start");
if(data!=null){
//打印测试
Iterator it=data.entrySet().iterator();
@ -86,9 +89,6 @@ public class CgTableServiceImpl extends CommonServiceImpl implements CgTableServ
}
data = CommUtils.mapConvert(data);
dataBaseService.executeSqlExtend(head.getId(), "delete", data);
dataBaseService.executeJavaExtend(head.getId(), "delete", data);
}
//step.1 删除表
StringBuilder deleteSql = new StringBuilder();
@ -125,13 +125,17 @@ public class CgTableServiceImpl extends CommonServiceImpl implements CgTableServ
cgFormFieldService.deleteEntityById(CgUploadEntity.class, b.getId());
}
}
dataBaseService.executeJavaExtend(head.getId(), "delete", data, "end");
//--------longjb-end--20150526 ----for:add step.3 判断是否有附件字段,进行连带删除附件及附件表---------------
}catch (Exception e) {
e.printStackTrace();
return false;
}
// }catch (Exception e) {
// e.printStackTrace();
// return false;
// }
return true;
}
@SuppressWarnings("unchecked")
private void dealQuerySql(String table, String field, Map params,StringBuilder sqlB){
sqlB.append(" SELECT ");
@ -203,7 +207,9 @@ public class CgTableServiceImpl extends CommonServiceImpl implements CgTableServ
}
}
parentIds = parentIds.substring(1);
String subSQL = "select `" + parentIdFieldName + "`, count(*) ct from " + table + " a where a.`" + parentIdFieldName + "` in" + "(" + parentIds + ") group by a.`" + parentIdFieldName + "`";
String subSQL = "select " + parentIdFieldName + ", count(*) ct from " + table + " a where a." + parentIdFieldName + " in" + "(" + parentIds + ") group by a." + parentIdFieldName + "";
List<Map<String, Object>> subCountResult = this.findForJdbc(subSQL);
Map<String, Object> subCountMap = new HashMap<String, Object>();
for (Map<String, Object> map : subCountResult) {

@ -72,6 +72,9 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
public void insertTable(String tableName, Map<String, Object> data) throws BusinessException {
CgFormHeadEntity cgFormHeadEntity = cgFormFieldService.getCgFormHeadByTableName(tableName);
executeJavaExtend(cgFormHeadEntity.getId(),"add",data,"start");
//系统上下文变量赋值
fillInsertSysVar(tableName,data);
//主键适配器(根据不同的数据库进行生成)
@ -106,7 +109,7 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
if(cgFormHeadEntity!=null){
executeSqlExtend(cgFormHeadEntity.getId(),"add",data);
executeJavaExtend(cgFormHeadEntity.getId(),"add",data);
executeJavaExtend(cgFormHeadEntity.getId(),"add",data,"end");
}
}
@ -248,6 +251,9 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
data.put("id", id);
CgFormHeadEntity cgFormHeadEntity = cgFormFieldService.getCgFormHeadByTableName(tableName);
executeJavaExtend(cgFormHeadEntity.getId(),"update",data, "start");
int num = this.executeSql(sqlBuffer.toString(), data);
if(cgFormHeadEntity!=null){
@ -256,7 +262,7 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
executeSqlExtend(cgFormHeadEntity.getId(),"update",data);
executeJavaExtend(cgFormHeadEntity.getId(),"update",data);
executeJavaExtend(cgFormHeadEntity.getId(),"update",data, "end");
}
return num;
@ -283,7 +289,7 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
* sql
*
*/
public void executeSqlExtend(String formId,String buttonCode,Map<String, Object> data){
public void executeSqlExtend(String formId,String buttonCode,Map<String, Object> data) throws BusinessException{
//根据formId和buttonCode获取
CgformButtonSqlEntity cgformButtonSqlVo = getCgformButtonSqlByCodeFormId(buttonCode,formId);
if(cgformButtonSqlVo!=null){
@ -325,7 +331,9 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
try {
num = namedParameterJdbcTemplate.update(sql, data);
} catch (Throwable e) {
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
}else{
num = this.executeSql(sql);
@ -723,10 +731,17 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
if(StringUtil.isNotEmpty(cgJavaValue)){
Object obj = null;
try {
// try {
if("class".equals(cgJavaType)){
//因新增时已经校验了实例化是否可以成功,所以这块就不需要再做一次判断
obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance();
try {
obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}else if("spring".equals(cgJavaType)){
obj = ApplicationContextUtil.getContext().getBean(cgJavaValue);
}
@ -737,11 +752,12 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
javaInter.execute(head.getTableName(),data);
}
} catch (Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
throw new BusinessException("执行JAVA增强出现异常");
}
// } catch (Exception e) {
// logger.error(e.getMessage());
// e.printStackTrace();
// throw new BusinessException("执行JAVA增强出现异常");
// }
}
}
@ -756,6 +772,7 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
hql.append(" and t.activeStatus ='1'");
hql.append(" and t.event = 'end' ");
List<CgformEnhanceJavaEntity> list = this.findHql(hql.toString(),formId,buttonCode);
if(list!=null&&list.size()>0){
@ -772,5 +789,72 @@ public class DataBaseServiceImpl extends CommonServiceImpl implements DataBaseSe
return list;
}
@Override
public void executeJavaExtend(String formId, String buttonCode,
Map<String, Object> data, String event) throws BusinessException {
CgformEnhanceJavaEntity cgformEnhanceJavaEntity = getCgformEnhanceJavaEntityByCodeFormId(buttonCode,formId,event);
if(cgformEnhanceJavaEntity!=null){
String cgJavaType = cgformEnhanceJavaEntity.getCgJavaType();
String cgJavaValue = cgformEnhanceJavaEntity.getCgJavaValue();
if(StringUtil.isNotEmpty(cgJavaValue)){
Object obj = null;
// try {
if("class".equals(cgJavaType)){
//因新增时已经校验了实例化是否可以成功,所以这块就不需要再做一次判断
try {
obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}else if("spring".equals(cgJavaType)){
obj = ApplicationContextUtil.getContext().getBean(cgJavaValue);
}
if(obj instanceof CgformEnhanceJavaInter){
CgFormHeadEntity head = this.get(CgFormHeadEntity.class, formId);
CgformEnhanceJavaInter javaInter = (CgformEnhanceJavaInter) obj;
javaInter.execute(head.getTableName(),data);
}
// } catch (Exception e) {
// logger.error(e.getMessage());
// e.printStackTrace();
// throw new BusinessException("执行JAVA增强出现异常");
// }
}
}
}
public CgformEnhanceJavaEntity getCgformEnhanceJavaEntityByCodeFormId(String buttonCode, String formId, String event) {
StringBuilder hql = new StringBuilder("");
List<CgformEnhanceJavaEntity> list = null;
hql.append(" from CgformEnhanceJavaEntity t");
hql.append(" where t.formId=?");
hql.append(" and t.buttonCode =?");
hql.append(" and t.activeStatus ='1'");
if(oConvertUtils.isNotEmpty(event)) {
hql.append(" and t.event = ?");
list = this.findHql(hql.toString(),formId,buttonCode,event);
} else {
list = this.findHql(hql.toString(),formId,buttonCode);
}
if(list!=null&&list.size()>0){
return list.get(0);
}
return null;
}
}

@ -6,6 +6,7 @@ import java.util.UUID;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.cgform.entity.enhance.CgformEnhanceJavaEntity;
import org.jeecgframework.web.cgform.service.enhance.CgformEnhanceJavaServiceI;
import org.springframework.stereotype.Service;
@ -81,6 +82,10 @@ public class CgformEnhanceJavaServiceImpl extends CommonServiceImpl implements C
hql.append(" where t.formId=?");
hql.append(" and t.buttonCode =?");
hql.append(" and t.event = 'end' ");
hql.append(" and t.activeStatus = '1'");
List<CgformEnhanceJavaEntity> list = this.findHql(hql.toString(),formId,buttonCode);
if(list!=null&&list.size()>0){
@ -97,12 +102,15 @@ public class CgformEnhanceJavaServiceImpl extends CommonServiceImpl implements C
hql.append(" where t.formId=?");
hql.append(" and t.buttonCode =?");
hql.append(" and t.event = ?");
hql.append(" and t.activeStatus = '1'");
List<CgformEnhanceJavaEntity> list = null;
if(cgformEnhanceJavaEntity.getId()!=null){
hql.append(" and t.id !=?");
list = this.findHql(hql.toString(),cgformEnhanceJavaEntity.getFormId(),cgformEnhanceJavaEntity.getButtonCode(),cgformEnhanceJavaEntity.getId());
list = this.findHql(hql.toString(),cgformEnhanceJavaEntity.getFormId(),cgformEnhanceJavaEntity.getButtonCode(),cgformEnhanceJavaEntity.getEvent(),cgformEnhanceJavaEntity.getId());
}else{
list = this.findHql(hql.toString(),cgformEnhanceJavaEntity.getFormId(),cgformEnhanceJavaEntity.getButtonCode());
list = this.findHql(hql.toString(),cgformEnhanceJavaEntity.getFormId(),cgformEnhanceJavaEntity.getButtonCode(),cgformEnhanceJavaEntity.getEvent());
}
return list;
@ -134,4 +142,29 @@ public class CgformEnhanceJavaServiceImpl extends CommonServiceImpl implements C
return true;
}
@Override
public CgformEnhanceJavaEntity getCgformEnhanceJavaEntityByCodeFormId(
String buttonCode, String formId, String event) {
StringBuilder hql = new StringBuilder("");
List<CgformEnhanceJavaEntity> list = null;
hql.append(" from CgformEnhanceJavaEntity t");
hql.append(" where t.formId=?");
hql.append(" and t.buttonCode =?");
hql.append(" and t.activeStatus = 1");
if(oConvertUtils.isNotEmpty(event)) {
hql.append(" and t.event = ?");
list = this.findHql(hql.toString(),formId,buttonCode,event);
} else {
list = this.findHql(hql.toString(),formId,buttonCode);
}
if(list!=null&&list.size()>0){
return list.get(0);
}
return null;
}
}

@ -5,13 +5,16 @@ import java.util.Map;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.FileUtils;
import org.jeecgframework.core.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.jeecgframework.web.cgform.dao.upload.CgFormUploadDao;
import org.jeecgframework.web.cgform.entity.upload.CgUploadEntity;
import org.jeecgframework.web.cgform.service.upload.CgUploadServiceI;
import org.jeecgframework.web.system.pojo.base.TSAttachment;
@Service("cgUploadService")
@Transactional
public class CgUploadServiceImpl extends CommonServiceImpl implements CgUploadServiceI {
@ -45,4 +48,54 @@ public class CgUploadServiceImpl extends CommonServiceImpl implements CgUploadSe
}
}
@Override
public void deleteAttachment(TSAttachment attachment) {
String realpath = attachment.getRealpath();//附件相对路径
String pathNosuffix = FileUtils.getFilePrefix2(realpath);
//获取部署项目绝对地址
String projectPath = ContextHolderUtils.getSession().getServletContext().getRealPath("/");
//step.1 删除附件
FileUtils.delete(projectPath+realpath);
if(!FileUtils.isPicture(attachment.getExtend())){
//文件类型删除预览生成的文件
FileUtils.delete(projectPath+pathNosuffix+".pdf");
FileUtils.delete(projectPath+pathNosuffix+".swf");
}
//step.2 删除数据
commonDao.delete(attachment);
}
@Override
public void updateCgFormFile(String cgFormId, String tableName, String attachments) throws Exception{
JSONArray array = JSONArray.parseArray(attachments);
String addSql = "INSERT INTO cgform_uploadfiles (id,CGFORM_FIELD,CGFORM_ID,CGFORM_NAME) VALUES(?,?,?,?)";
String delSql = "delete from cgform_uploadfiles where id = ?";
for (Object object : array) {
JSONObject json = (JSONObject)object;
String cgFormField = json.getString("cgFormField");//获取表字段
String attachmentId = json.getString("attachment");//获取附件ID(逗号隔开的字符串)
if(oConvertUtils.isNotEmpty(attachmentId)){
String attachmentArray[] = attachmentId.split(",");
for (String a : attachmentArray) {
if(oConvertUtils.isNotEmpty(a)){
if(a.endsWith("_D")){
//以_D结尾 代表你是被删除掉了哦
String metaId = a.substring(0,a.length()-2);
//删除cgform_uploadfiles
commonDao.executeSql(delSql,metaId);
//删除附件表同时删除文件
TSAttachment attachment = this.getEntity(TSAttachment.class,metaId);
deleteAttachment(attachment);
}else if(a.endsWith("_O")){
//String metaId = a.substring(0,a.length()-2);//获取原始ID
//以_O结尾 代表你历史文件 那么需要走更新操作,但是没有需要更新的内容
}else{
commonDao.executeSql(addSql, a,cgFormField,cgFormId,tableName);
}
}
}
}
}
}
}

@ -3,6 +3,7 @@ package org.jeecgframework.web.cgform.service.upload;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.cgform.entity.upload.CgUploadEntity;
import org.jeecgframework.web.system.pojo.base.TSAttachment;
/**
*
* @Title:CgUploadServiceI
@ -24,4 +25,21 @@ public interface CgUploadServiceI extends CommonService{
* @param cgFormField
*/
public void writeBack(String cgFormId,String cgFormName,String cgFormField,String fileId,String fileUrl);
/**
*
* @author taoYan
* @since 201893
*/
public void deleteAttachment(TSAttachment attachment);
/**
*
* @param cgFormId ID
* @param tableName
* @param attachments :[{,[ID]}]
* @author taoYan
* @since 201893
*/
public void updateCgFormFile(String cgFormId,String tableName,String attachments) throws Exception;
}

@ -332,13 +332,15 @@ public class CgReportServiceImpl extends CommonServiceImpl implements CgReportSe
}else{
List<Map<String, Object>> dicDatas = queryDicBySQL(dict_code);
for(Map r:result){
String value = String.valueOf(r.get(field_name));
for(Map m:dicDatas){
String typecode = String.valueOf(m.get("typecode"));
String typename = String.valueOf(m.get("typename"));
if(value.equalsIgnoreCase(typecode)){
r.put(bean.get(CgReportConstant.ITEM_FIELDNAME),typename);
if(result!=null){
for(Map r:result){
String value = String.valueOf(r.get(field_name));
for(Map m:dicDatas){
String typecode = String.valueOf(m.get("typecode"));
String typename = String.valueOf(m.get("typename"));
if(value.equalsIgnoreCase(typecode)){
r.put(bean.get(CgReportConstant.ITEM_FIELDNAME),typename);
}
}
}
}

@ -10,6 +10,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
@ -184,7 +185,18 @@ public class GraphReportController extends BaseController {
@SuppressWarnings("unchecked")
private void loadVars(Map<String, Object> cgReportMap) {
Map mainM = (Map) cgReportMap.get(CgReportConstant.MAIN);
List<Map<String,Object>> fieldList = (List<Map<String, Object>>) cgReportMap.get(CgReportConstant.ITEMS);
List<Map<String,Object>> fieldList2 = (List<Map<String, Object>>) cgReportMap.get(CgReportConstant.ITEMS);
List<Map<String,Object>> fieldList = new ArrayList<Map<String,Object>>();
for (Map<String, Object> map : fieldList2) {
Map<String, Object> temp = new HashMap<String, Object>();
for (Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
temp.put(key.toLowerCase(), entry.getValue());
}
fieldList.add(temp);
}
List<Map<String,Object>> queryList = new ArrayList<Map<String,Object>>(0);
//图表数据
List<Map<String,Object>> graphList = new ArrayList<Map<String,Object>>(0);

@ -8,6 +8,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -644,9 +645,20 @@ public class SuperQueryMainController extends BaseController {
public AjaxJson getTextById(HttpServletRequest request,HttpServletResponse response) {
AjaxJson json=new AjaxJson();
String tableName = request.getParameter("tableName");
String sql=" SELECT table_name, `name`, txt,ctype,stype,dict_code,dict_table ,dict_text,main_id from super_query_field where table_name= ? GROUP BY `name`,txt";
String sql=" SELECT DISTINCT table_name, name, txt,ctype,stype,dict_code,dict_table ,dict_text,main_id from super_query_field where table_name= ?";
List<Map<String, Object>> findForJdbc = systemService.findForJdbc(sql,tableName);
json.setObj(findForJdbc);
List<Map<String,Object>> fieldList = new ArrayList<Map<String,Object>>();
for (Map<String, Object> map : findForJdbc) {
Map<String, Object> temp = new HashMap<String, Object>();
for (Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
temp.put(key.toLowerCase(), entry.getValue());
}
fieldList.add(temp);
}
json.setObj(fieldList);
return json;
}
@ -825,7 +837,9 @@ public class SuperQueryMainController extends BaseController {
AjaxJson json = new AjaxJson();
try {
// step.1 获取mainId和字段名称查询数据
String sql = "select stype,`name`,txt,dict_table,dict_code,dict_text from super_query_field where `name`=? AND main_id = ?";
String sql = "select stype,name,txt,dict_table,dict_code,dict_text from super_query_field where name=? AND main_id = ?";
List<Map<String, Object>> page = systemService.findForJdbc(sql,field,mainId);
if(page.size()>0) {
json.setObj(page);

@ -1303,13 +1303,17 @@ public class DepartAuthGroupController extends BaseController {
if (pFunction.size() > 0) {
for (TSDepartAuthgFunctionRelEntity departGroupRel : pFunction) {
TSFunction function = (TSFunction) departGroupRel.getTsFunction();
// 获取上级所有选中的ID
selectChild.add(function.getId());
for (TSFunction ts : functionList) {
if (ts.getId().equals(function.getId())) {
lists.add(ts);
if(function!=null){
// 获取上级所有选中的ID
selectChild.add(function.getId());
for (TSFunction ts : functionList) {
if (ts.getId().equals(function.getId())) {
lists.add(ts);
}
}
}
}
functionList = lists;
} else {
@ -1356,9 +1360,11 @@ public class DepartAuthGroupController extends BaseController {
if (role != null) {
if (oConvertUtils.isNotEmpty(role.getDepartAgId())) {
String pid = role.getDepartAgId();
String groupSql = "select * from t_s_depart_authg_function_rel where group_id = ?";
String groupSql = "select * from t_s_depart_authg_function_rel where group_id = ? and auth_id = ?";
// 查询部门组记录赋值给pOperationArray
pGroup = this.systemService.findForJdbc(groupSql, pid);
pGroup = this.systemService.findForJdbc(groupSql, pid, functionId);
}
}
String[] pOperationArray = null;
@ -1401,9 +1407,11 @@ public class DepartAuthGroupController extends BaseController {
if (role != null) {
if (oConvertUtils.isNotEmpty(role.getDepartAgId())) {
String pid = role.getDepartAgId();
String groupSql = "select * from t_s_depart_authg_function_rel where group_id = ?";
String groupSql = "select * from t_s_depart_authg_function_rel where group_id = ? and auth_id = ?";
// 查询部门组记录赋值给pDataRuleArray
pGroup = this.systemService.findForJdbc(groupSql, pid);
pGroup = this.systemService.findForJdbc(groupSql, pid, functionId);
}
}
String[] pDataRuleArray = null;

@ -14,6 +14,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.model.json.AjaxJson;
@ -52,6 +54,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.kisso.SSOHelper;
import com.baomidou.kisso.SSOToken;
import com.baomidou.kisso.common.util.HttpUtil;
@ -234,7 +237,7 @@ public class LoginController extends BaseController{
modelMap.put("currentOrgName", clientManager.getClient().getUser().getCurrentDepart().getDepartname());
SysThemesEnum sysTheme = SysThemesUtil.getSysTheme(request);
if("fineui".equals(sysTheme.getStyle())|| "ace".equals(sysTheme.getStyle())||"diy".equals(sysTheme.getStyle())||"acele".equals(sysTheme.getStyle())||"hplus".equals(sysTheme.getStyle())){
if("fineui".equals(sysTheme.getStyle())|| "ace".equals(sysTheme.getStyle())||"diy".equals(sysTheme.getStyle())||"acele".equals(sysTheme.getStyle())||"hplus".equals(sysTheme.getStyle()) || "adminlte".equals(sysTheme.getStyle())){
request.setAttribute("menuMap", userService.getFunctionMap(user.getId()));
}
//国际化cookie
@ -698,4 +701,68 @@ public class LoginController extends BaseController{
public String login3(){
return "login/login3";
}
/**
* AdminLTE
*/
@RequestMapping(params = "getPrimaryMenuForAdminlte", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson getPrimaryMenuForAdminlte(String functionId, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
try {
//List<TSFunction> functions = this.systemService.findByProperty(TSFunction.class, "TSFunction.id", functionId);
String userid = ResourceUtil.getSessionUser().getId();
List<TSFunction> functions = userService.getSubFunctionList(userid, functionId);
JSONArray jsonArray = new JSONArray();
if(functions != null && functions.size() > 0) {
for (TSFunction function : functions) {
JSONObject jsonObjectInfo = new JSONObject();
jsonObjectInfo.put("id", function.getId());
jsonObjectInfo.put("text",oConvertUtils.getString(MutiLangUtil.getLang(function.getFunctionName())));
jsonObjectInfo.put("url",oConvertUtils.getString(function.getFunctionUrl()));
jsonObjectInfo.put("targetType", "iframe-tab");
jsonObjectInfo.put("icon", "fa " + oConvertUtils.getString(function.getFunctionIconStyle()));
jsonObjectInfo.put("children", getChildOfAdminLteTree(function));
jsonArray.add(jsonObjectInfo);
}
}
j.setObj(jsonArray);
} catch (Exception e) {
e.printStackTrace();
}
return j;
}
public JSONArray getChildOfAdminLteTree(TSFunction function) {
JSONArray jsonArray = new JSONArray();
List<TSFunction> functions = this.systemService.findByProperty(TSFunction.class, "TSFunction.id", function.getId());
if(functions != null && functions.size() > 0) {
for (TSFunction tsFunction : functions) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", tsFunction.getId());
jsonObject.put("text", MutiLangUtil.getLang(tsFunction.getFunctionName()));
jsonObject.put("url", tsFunction.getFunctionUrl());
jsonObject.put("targetType", "iframe-tab");
jsonObject.put("icon", "fa " + tsFunction.getFunctionIconStyle());
jsonObject.put("children", getChildOfAdminLteTree(tsFunction));
jsonArray.add(jsonObject);
}
}
return jsonArray;
}
/**
* AdminLTE
*
* @return
*/
@RequestMapping(params = "adminlteHome")
public ModelAndView adminlteHome(HttpServletRequest request) {
return new ModelAndView("main/adminlte_home");
}
}

@ -37,8 +37,10 @@ import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
import org.jeecgframework.tag.vo.easyui.TreeGridModel;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.web.system.pojo.base.TSUserOrg;
import org.jeecgframework.web.system.pojo.base.TSUserPositionRelEntity;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.service.UserService;
import org.jeecgframework.web.system.util.OrgConstants;
@ -239,33 +241,38 @@ public class OrganzationController extends BaseController {
public AjaxJson delUserOrg(@RequestParam(required=true)String userid,@RequestParam(required=true)String departid) {
AjaxJson ajaxJson = new AjaxJson();
try {
//判断授权部门角色是否赋值,有值则不可删除
String sql1 = "SELECT COUNT(0) FROM t_s_role_user ru WHERE ru.roleid in (SELECT tsr.id FROM t_s_role tsr WHERE depart_ag_id = (SELECT dag.id FROM t_s_depart_auth_group dag WHERE dag.dept_id = ?)) and ru.userid = ?";
long roleUserCount = this.systemService.getCountForJdbcParam(sql1,departid,userid);
List<TSUserOrg> userOrgList = this.systemService.findByProperty(TSUserOrg.class, "tsUser.id", userid);
//判断分配职务是否赋值,有值则不可删除
//查询角色用户关联记录
String queryRoleUserSql = "select ru.id from t_s_role_user ru WHERE ru.roleid in (SELECT tsr.id FROM t_s_role tsr WHERE depart_ag_id = (SELECT dag.id FROM t_s_depart_auth_group dag WHERE dag.dept_id = ?)) and ru.userid = ?";
List<Map<String,Object>> listMaps = this.systemService.findForJdbc(queryRoleUserSql, departid, userid);
if(listMaps != null && listMaps.size() > 0) {
for (Map<String, Object> map : listMaps) {
if(oConvertUtils.isNotEmpty(map.get("id").toString())) {
//删除角色用户关联记录
this.systemService.deleteEntityById(TSRoleUser.class, map.get("id").toString());
}
}
}
//查找直接上级公司
String companyId = getCompanyId(departid);
if(StringUtils.isEmpty(companyId)){
companyId = "";
}
String sql2 = "select count(0) from t_s_user_position_rel where user_id = ? and company_id = ?";
long duties = this.systemService.getCountForJdbcParam(sql2,userid,companyId);
if(roleUserCount >= 1 || duties >= 1) {
ajaxJson.setSuccess(false);
ajaxJson.setMsg("当前用户拥有职务或部门角色,不可删除。");
}else if(userOrgList.size() == 1){
ajaxJson.setSuccess(false);
ajaxJson.setMsg("当前用户只包含有当前组织机构关系,不可删除,请切换用户的组织机构关系");
}else{
String sql = "delete from t_s_user_org where user_id = ? and org_id = ?";
this.systemService.executeSql(sql,userid,departid);
ajaxJson.setMsg("成功删除用户对应的组织机构关系");
//查询用户职位关联记录
String userPositionSql = "select id from t_s_user_position_rel where user_id = ? and company_id = ?";
List<Map<String,Object>> userPositions = this.systemService.findForJdbc(userPositionSql, userid, companyId);
if(userPositions != null && userPositions.size() > 0) {
for (Map<String, Object> map : userPositions) {
if(oConvertUtils.isNotEmpty(map.get("id").toString())) {
//删除用户职位关联记录
this.systemService.deleteEntityById(TSUserPositionRelEntity.class, map.get("id").toString());
}
}
}
String sql = "delete from t_s_user_org where user_id = ? and org_id = ?";
this.systemService.executeSql(sql,userid,departid);
ajaxJson.setMsg("成功删除用户对应的组织机构关系");
} catch (Exception e) {
e.printStackTrace();
LogUtil.log("删除用户对应的组织机构关系失败", ajaxJson.getMsg());
@ -574,7 +581,24 @@ public class OrganzationController extends BaseController {
cq.in("status", userstate);
cq.add();
this.systemService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
Map<String,Map<String,Object>> extMap = new HashMap<String, Map<String,Object>>();
List<TSUser> tsUserList = dataGrid.getResults();
for(TSUser temp : tsUserList){
Map<String,Object> m = new HashMap<String, Object>();
String sql = "SELECT tscp.position_name FROM t_s_company_position tscp WHERE id in (SELECT tsupr.position_id FROM t_s_user_position_rel tsupr WHERE tsupr.user_id = ?)";
List<Map<String,Object>> listMaps = systemService.findForJdbc(sql, temp.getId());
if(listMaps != null && listMaps.size() > 0) {
String positionName = "";
for (Map<String, Object> map : listMaps) {
positionName += map.get("position_name").toString() + ",";
}
m.put("positionName", positionName);
}
extMap.put(temp.getId(), m);
}
TagUtil.datagrid(response, dataGrid, extMap);
}
//----
@ -1131,6 +1155,50 @@ public class OrganzationController extends BaseController {
}
return dataList;
}
@RequestMapping(params="getMyTreeDataAsync",method ={RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public List<Map<String,Object>> getMyTreeDataAsync(HttpServletResponse response,HttpServletRequest request ){
CriteriaQuery cq = new CriteriaQuery(TSDepart.class);
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
try{
String id = request.getParameter("id");
String userName = ResourceUtil.getSessionUser().getUserName();
if("admin".equals(userName)) {
if(oConvertUtils.isEmpty(id)){
//加载根节点
cq.isNull("TSPDepart");
}else{
//加载子节点
cq.eq("TSPDepart.id", id);
}
}else{
String sql = "select deptId from TSDepartAuthGroupEntity where id in (select groupId from TSDepartAuthgManagerEntity where userId = ?)";
List<String> deptIds = this.systemService.findHql(sql, userName);
if(deptIds!=null && deptIds.size()>0){
Object values[] = deptIds.toArray();
cq.in("id", values);
if(oConvertUtils.isEmpty(id)){
cq.isNull("TSPDepart");
}else{
//加载子节点
cq.eq("TSPDepart.id",id);
}
}else{
//如果非admin用户且无授权组织机构 那么 直接返回一个null
return null;
}
}
cq.addOrder("departOrder", SortDirection.asc);
cq.add();
List<TSDepart> departList = this.systemService.getListByCriteriaQuery(cq, false);
populateTree(departList,dataList);
}catch(Exception e){
e.printStackTrace();
}
return dataList;
}
private void populateTree(List<TSDepart> departList,List<Map<String,Object>> dataList){
Map<String,Object> map = null;

@ -51,6 +51,7 @@ import org.jeecgframework.core.util.PropertiesUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.SetListSort;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.UrlCheckUtil;
import org.jeecgframework.core.util.YouBianCodeUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.core.easyui.TagUtil;
@ -1755,6 +1756,11 @@ public class SystemController extends BaseController {
String ctxPath = request.getSession().getServletContext().getRealPath("/");
String dbpath = request.getParameter("filePath");
String downLoadPath = ctxPath + dbpath;
if(UrlCheckUtil.checkUrl(downLoadPath)){
return;
}
response.setContentType("application/x-msdownload;charset=utf-8");
String fileName=dbpath.substring(dbpath.lastIndexOf("/")+1);
String userAgent = request.getHeader("user-agent").toLowerCase();

@ -33,8 +33,10 @@ public interface DepartAuthGroupDao {
* @param userId
* @return
*/
@Sql("select dag.* from t_s_depart_auth_group as dag join t_s_depart_authg_manager as dam on dam.group_id=dag.id where user_id = :userId")
@Sql("select dag.* from t_s_depart_auth_group dag join t_s_depart_authg_manager dam on dam.group_id=dag.id where dam.user_id = :userId")
public List<Map<String,Object>> chkDepartAuthGroupList(@Param("userId") String userId);
/**
* ID

@ -176,11 +176,12 @@ public class TSDepartAuthGroupEntity implements java.io.Serializable {
*@return: java.lang.Integer
*/
@Column(name ="LEVEL",nullable=true,length=10)
@Column(name ="[LEVEL]",nullable=true,length=10)
public java.lang.Integer getLevel(){
return this.level;
}
/**
*: java.lang.Integer
*@param: java.lang.Integer

@ -74,5 +74,12 @@ public interface UserService extends CommonService{
* @return
*/
public String getShortcutPrimaryMenuDiy(List<TSFunction> primaryMenu);
/**
* ID
* @author taoYan
* @since 20181022
*/
public List<TSFunction> getSubFunctionList(String userid,String functionId);
}

@ -462,4 +462,28 @@ public class UserServiceImpl extends CommonServiceImpl implements UserService {
return floor;
}
@Override
public List<TSFunction> getSubFunctionList(String userid, String functionId) {
Map<String, TSFunction> loginActionlist = new HashMap<String, TSFunction>();
//查询用户角色对应的授权菜单
StringBuilder hqlsb1 = new StringBuilder("select distinct f from TSFunction f,TSRoleFunction rf,TSRoleUser ru ").append("where ru.TSRole.id=rf.TSRole.id and rf.TSFunction.id=f.id and ru.TSUser.id=? and f.TSFunction.id = ?");
//查询用户组织机构授权的菜单
StringBuilder hqlsb2 = new StringBuilder("select distinct c from TSFunction c,TSRoleFunction rf,TSRoleOrg b,TSUserOrg a ").append("where a.tsDepart.id=b.tsDepart.id and b.tsRole.id=rf.TSRole.id and rf.TSFunction.id=c.id and a.tsUser.id=? and c.TSFunction.id = ?");
List<TSFunction> list1 = this.findHql(hqlsb1.toString(), userid,functionId);
List<TSFunction> list2 = this.findHql(hqlsb2.toString(), userid,functionId);
for (TSFunction function : list1) {
loginActionlist.put(function.getId(), function);
}
for (TSFunction function : list2) {
loginActionlist.put(function.getId(), function);
}
list1.clear();
list2.clear();
list1 = null;
list2 = null;
List<TSFunction> list = new ArrayList<TSFunction>(loginActionlist.values());
Collections.sort(list, new NumberComparator());
return list;
}
}

@ -155,8 +155,17 @@ public class ImgServerServlet extends HttpServlet {
OutputStream outputStream = null;
try {
String imgurl = getUploadBasePath() + File.separator + imgPath;
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
try {
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
} catch (Exception e) {
//Online在线模板图片支持打进jar中如果图片寻找失败则再从jar中找
String imgClassPath = "/online/template/"+imgPath;
System.out.println(" imgClassPath "+imgClassPath);
if(inputStream==null){
inputStream = this.getClass().getResourceAsStream(imgClassPath);
}
}
outputStream = response.getOutputStream();
byte[] buf = new byte[1024];
int len;

@ -477,11 +477,19 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

@ -292,7 +292,11 @@ function resetTrNum(tableId) {
var s = onclick_str.indexOf("[");
var e = onclick_str.indexOf("]");
var new_onclick_str = onclick_str.substring(s+1,e);
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
<#-- update--begin--author:zhoujf date:20180827 forTASK #3064 popup控件实现 -->
if(new_onclick_str!=''){
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
}
<#-- update--end--author:jiaqiankun date:20180710 forTASK #3064 popup控件实现 -->
}
}
if(validtype_str!=null){

@ -325,7 +325,11 @@ function resetTrNum(tableId) {
var s = onclick_str.indexOf("[");
var e = onclick_str.indexOf("]");
var new_onclick_str = onclick_str.substring(s+1,e);
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
<#-- update--begin--author:zhoujf date:20180827 forTASK #3064 popup控件实现 -->
if(new_onclick_str!=''){
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
}
<#-- update--end--author:jiaqiankun date:20180710 forTASK #3064 popup控件实现 -->
}
}
if(validtype_str!=null){

@ -124,26 +124,6 @@ function btListFileFormatter(value,row,index){
return listFileImgFormat(value);
}
//列表文件图片 列格式化方法
function listFileImgFormat(value,type){
var href='';
if(value==null || value.length==0){
return href;
}
var value1 = "img/server/"+value;
if("image"==type){
href+="<img src='"+value1+"' width=30 height=30 onmouseover='tipImg(this)' onmouseout='moveTipImg()' style='vertical-align:middle'/>";
}else{
if(value.indexOf(".jpg")>-1 || value.indexOf(".gif")>-1 || value.indexOf(".png")>-1){
href+="<img src='"+value1+"' onmouseover='tipImg(this)' onmouseout='moveTipImg()' width=30 height=30 style='vertical-align:middle'/>";
}else{
var value2 = "img/server/"+value+"?down=true";
href+="<a href='"+value2+"' class='ace_button' style='text-decoration:none;' target=_blank><u><i class='fa fa-download'></i>点击下载</u></a>";
}
}
return href;
}
<#if cgformConfig.cgFormHead.isTree == 'Y'>
/**
* 获取表格对象

@ -460,15 +460,23 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful接口封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
public ResponseMessage<List<${entityName}Entity>> list() {
List<${entityName}Entity> list${entityName}s=${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Entity>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize > Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list${entityName}s = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
return Result.success(list${entityName}s);
}
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody

@ -25,7 +25,7 @@
<#assign hasDateTime=1>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;">
<#-- update--begin--author:liushaoqian date:20180713 for:TASK #2964 【代码生成器--张伟健】单表代码生成器新老模板测试 -->
@ -68,6 +68,10 @@
<input name="${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#elseif po.showType=='file' || po.showType=='image'>
<@webuploadtag po = po defval=""/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input name="${po.fieldName}" type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
</#if>
@ -129,6 +133,10 @@
<span class="input-group-addon" ><span class="glyphicon glyphicon-calendar"></span></span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval=""/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -26,7 +26,7 @@
<#assign hasDateTime=1>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;">
<div class="container" style="width:100%;">
@ -66,6 +66,10 @@
<input name="${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='both' value='${'$'}{${entityName?uncap_first}.${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#elseif po.showType=='file' || po.showType=='image'>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}.${po.fieldName}}"/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input name="${po.fieldName}" type="text" class="form-control" maxlength="${po.length?c}" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
</#if>
@ -129,6 +133,10 @@
<span class="input-group-addon" ><span class="glyphicon glyphicon-calendar"></span> </span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}.${po.fieldName}}"/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" value='${'$'}{${entityName?uncap_first}.${po.fieldName}}' type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -124,26 +124,6 @@ function btListFileFormatter(value,row,index){
return listFileImgFormat(value);
}
//列表文件图片 列格式化方法
function listFileImgFormat(value,type){
var href='';
if(value==null || value.length==0){
return href;
}
var value1 = "img/server/"+value;
if("image"==type){
href+="<img src='"+value1+"' width=30 height=30 onmouseover='tipImg(this)' onmouseout='moveTipImg()' style='vertical-align:middle'/>";
}else{
if(value.indexOf(".jpg")>-1 || value.indexOf(".gif")>-1 || value.indexOf(".png")>-1){
href+="<img src='"+value1+"' onmouseover='tipImg(this)' onmouseout='moveTipImg()' width=30 height=30 style='vertical-align:middle'/>";
}else{
var value2 = "img/server/"+value+"?down=true";
href+="<a href='"+value2+"' class='ace_button' style='text-decoration:none;' target=_blank><u><i class='fa fa-download'></i>点击下载</u></a>";
}
}
return href;
}
<#if cgformConfig.cgFormHead.isTree == 'Y'>
/**
* 获取表格对象

@ -476,11 +476,19 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

@ -292,7 +292,11 @@ function resetTrNum(tableId) {
var s = onclick_str.indexOf("[");
var e = onclick_str.indexOf("]");
var new_onclick_str = onclick_str.substring(s+1,e);
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
<#-- update--begin--author:zhoujf date:20180827 forTASK #3064 popup控件实现 -->
if(new_onclick_str!=''){
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
}
<#-- update--end--author:jiaqiankun date:20180710 forTASK #3064 popup控件实现 -->
}
}
if(validtype_str!=null){

@ -325,7 +325,11 @@ function resetTrNum(tableId) {
var s = onclick_str.indexOf("[");
var e = onclick_str.indexOf("]");
var new_onclick_str = onclick_str.substring(s+1,e);
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
<#-- update--begin--author:zhoujf date:20180827 forTASK #3064 popup控件实现 -->
if(new_onclick_str!=''){
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
}
<#-- update--end--author:jiaqiankun date:20180710 forTASK #3064 popup控件实现 -->
}
}
if(validtype_str!=null){

@ -33,7 +33,7 @@
<div class="accordion-inner">
<div class="panel panel-default" style="margin-bottom: 0px;">
<div class="panel-body">
<form id="${entityName?uncap_first}Form" onkeydown="if(event.keyCode==13){doSearch();return false;}">
<form id="searchForm" onkeydown="if(event.keyCode==13){doSearch();return false;}">
<#list columns as po>
<#if po.isQuery =='Y'>
<#if po.showType?index_of("datetime")!=-1>
@ -102,6 +102,13 @@
<select class="form-control input-sm" id="${po.fieldName}" name="${po.fieldName}"></select>
</div>
</div>
<#elseif po.showType=='popup'>
<div class="col-xs-12 col-sm-6 col-md-4">
<label for="${po.fieldName}">${po.content}</label>
<div class="input-group" style="width: 100%">
<input type="text" class="form-control input-sm" id="${po.fieldName}" name="${po.fieldName}" <#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if>/>
</div>
</div>
<#else>
<#if po.queryMode =='group'>
<div class="col-xs-12 col-sm-6 col-md-4">
@ -208,9 +215,9 @@
<#list columns as po>
<#if po.isQuery =='Y'>
<#if po.showType=='checkbox'||po.showType=='radio'>
loadSearchFormDicts($("#${entityName?uncap_first}Form").find(".${po.fieldName}-search"),${entityName?uncap_first}ListdictsData.${po.dictField},"${po.showType}","${po.fieldName}");
loadSearchFormDicts($("#searchForm").find(".${po.fieldName}-search"),${entityName?uncap_first}ListdictsData.${po.dictField},"${po.showType}","${po.fieldName}");
<#elseif po.showType=='select' || po.showType=='list'>
loadSearchFormDicts($("#${entityName?uncap_first}Form").find("select[name='${po.fieldName}']"),${entityName?uncap_first}ListdictsData.${po.dictField},"select");
loadSearchFormDicts($("#searchForm").find("select[name='${po.fieldName}']"),${entityName?uncap_first}ListdictsData.${po.dictField},"select");
</#if>
</#if>
</#list>
@ -355,7 +362,7 @@
field : '<#list columns as po>${po.fieldName},</#list>'
};
var params = $("#${entityName?uncap_first}Form").serializeArray();
var params = $("#searchForm").serializeArray();
for (x in params) {
temp[params[x].name] = params[x].value;
}
@ -373,7 +380,7 @@
}
function searchRest() {
$('#${entityName?uncap_first}Form').find(':input').each(function() {
$('#searchForm').find(':input').each(function() {
if("checkbox"== $(this).attr("type")){
$("input:checkbox[name='" + $(this).attr('name') + "']").attr('checked',false);
}else if("radio"== $(this).attr("type")){
@ -382,10 +389,10 @@
$(this).val("");
}
});
$('#${entityName?uncap_first}Form').find("input[type='checkbox']").each(function() {
$('#searchForm').find("input[type='checkbox']").each(function() {
$(this).attr('checked', false);
});
$('#${entityName?uncap_first}Form').find("input[type='radio']").each(function() {
$('#searchForm').find("input[type='radio']").each(function() {
$(this).attr('checked', false);
});
reloadTable();

@ -460,15 +460,23 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful接口封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
public ResponseMessage<List<${entityName}Entity>> list() {
List<${entityName}Entity> list${entityName}s=${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Entity>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize > Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list${entityName}s = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
return Result.success(list${entityName}s);
}
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody

@ -26,7 +26,7 @@
<#assign hasDateTime=1>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;">
<div class="container" style="width:100%;">
@ -66,6 +66,10 @@
<input name="${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#elseif po.showType=='file' || po.showType=='image'>
<@webuploadtag po = po defval=""/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input name="${po.fieldName}" type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
</#if>
@ -127,6 +131,10 @@
<span class="input-group-addon" ><span class="glyphicon glyphicon-calendar"></span></span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval=""/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -26,7 +26,7 @@
<#assign hasDateTime=1>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;">
<div class="container" style="width:100%;">
@ -66,6 +66,10 @@
<input name="${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='both' value='${'$'}{${entityName?uncap_first}.${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#elseif po.showType=='file' || po.showType=='image'>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}.${po.fieldName}}"/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input name="${po.fieldName}" type="text" class="form-control" maxlength="${po.length?c}" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
</#if>
@ -129,6 +133,10 @@
<span class="input-group-addon" ><span class="glyphicon glyphicon-calendar"></span> </span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}.${po.fieldName}}"/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" value='${'$'}{${entityName?uncap_first}.${po.fieldName}}' type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -33,7 +33,7 @@
<div class="accordion-inner">
<div class="panel panel-default" style="margin-bottom: 0px;">
<div class="panel-body">
<form id="${entityName?uncap_first}Form" onkeydown="if(event.keyCode==13){doSearch();return false;}">
<form id="searchForm" onkeydown="if(event.keyCode==13){doSearch();return false;}">
<#list columns as po>
<#if po.isQuery =='Y'>
<#if po.showType?index_of("datetime")!=-1>
@ -193,10 +193,10 @@
<#assign optionCodes="">
<#list columns as po>
<#if po.showType=='checkbox' || po.showType=='radio' || po.showType=='select' || po.showType=='list'>
<#if optionCodes?index_of(po.dictField) lt 0>
<#assign optionCodes=optionCodes+","+po.dictField >
<#if optionCodes?index_of(po.fieldName) lt 0>
<#assign optionCodes=optionCodes+","+po.fieldName >
promiseArr.push(new Promise(function(resolve, reject) {
initDictByCode(${entityName?uncap_first}ListdictsData,"${po.dictField}",resolve);
initDictByCode(${entityName?uncap_first}ListdictsData,"${po.dictField}",promiseArr,"${po.dictTable}","${po.dictText}");
}));
</#if>
</#if>
@ -206,9 +206,9 @@
<#list columns as po>
<#if po.isQuery =='Y'>
<#if po.showType=='checkbox'||po.showType=='radio'>
loadSearchFormDicts($("#${entityName?uncap_first}Form").find(".${po.fieldName}-search"),${entityName?uncap_first}ListdictsData.${po.dictField},"${po.showType}","${po.fieldName}");
loadSearchFormDicts($("#searchForm").find(".${po.fieldName}-search"),"${po.dictTable}","${po.dictField}","${po.showType}","${po.fieldName}");
<#elseif po.showType=='select' || po.showType=='list'>
loadSearchFormDicts($("#${entityName?uncap_first}Form").find("select[name='${po.fieldName}']"),${entityName?uncap_first}ListdictsData.${po.dictField},"select");
loadSearchFormDicts($("#searchForm").find("select[name='${po.fieldName}']"),"${po.dictTable}","${po.dictField}","select","${po.content}");
</#if>
</#if>
</#list>
@ -305,7 +305,7 @@
}
<#elseif po.showType=='checkbox' || po.showType=='radio' || po.showType=='select' || po.showType=='list'>
formatter : function(value, rec, index) {
return listDictFormat(value,${entityName?uncap_first}ListdictsData.${po.dictField});
return listDictFormat(value,"${po.dictField}","${po.dictTable}");
}
<#elseif po.showType=='image' ||po.showType=='file'>
formatter:function(value,rec,index){
@ -353,7 +353,7 @@
field : '<#list columns as po>${po.fieldName},</#list>'
};
var params = $("#${entityName?uncap_first}Form").serializeArray();
var params = $("#searchForm").serializeArray();
for (x in params) {
temp[params[x].name] = params[x].value;
}
@ -371,7 +371,7 @@
}
function searchRest() {
$('#${entityName?uncap_first}Form').find(':input').each(function() {
$('#searchForm').find(':input').each(function() {
if("checkbox"== $(this).attr("type")){
$("input:checkbox[name='" + $(this).attr('name') + "']").attr('checked',false);
}else if("radio"== $(this).attr("type")){
@ -380,10 +380,10 @@
$(this).val("");
}
});
$('#${entityName?uncap_first}Form').find("input[type='checkbox']").each(function() {
$('#searchForm').find("input[type='checkbox']").each(function() {
$(this).attr('checked', false);
});
$('#${entityName?uncap_first}Form').find("input[type='radio']").each(function() {
$('#searchForm').find("input[type='radio']").each(function() {
$(this).attr('checked', false);
});
reloadTable();
@ -416,8 +416,13 @@
}
//列表数据字典项格式化
function listDictFormat(value,dicts){
function listDictFormat(value,code,table){
if (!value) return '';
var dictKey = code;
if(code=="id"){
dictKey = table+code;
}
var dicts = ${entityName?uncap_first}ListdictsData[dictKey];
var valArray = value.split(',');
var showVal = '';
if (valArray.length > 1) {
@ -449,27 +454,43 @@
}
//加载字典数据
function initDictByCode(dictObj,code,callback){
function initDictByCode(dictObj,code,promiseArr,table,text){
var dictKey = code;
if(code=="id"){
//如果当前dictcode为id那么此处的字典对象对应的key为"表名+id"
dictKey = table+code;
}
if(!dictObj[code]){
jQuery.ajax({
url: "systemController.do?typeListJson&typeGroupName="+code,
var url = "systemController.do?typeListJson&typeGroupName="+code;
if(table){
url += "&dicTable="+table+"&dicText="+text;
}
var dictAjax = jQuery.ajax({
url:url,
type:"GET",
dataType:"JSON",
success: function (back) {
if(back.success){
dictObj[code]= back.obj;
dictObj[dictKey]= back.obj;
}
callback();
}
});
promiseArr.push(dictAjax);
}
}
//加载form查询数据字典项
function loadSearchFormDicts(obj,arr,type,name){
function loadSearchFormDicts(obj,table,code,type,name){
var html = "";
var dictKey = code;
if(code=="id"){
dictKey = table+code;
}
var arr = ${entityName?uncap_first}ListdictsData[dictKey];
for(var a = 0;a < arr.length;a++){
if("select"== type){
if(a==0){
html+="<option value = '' style='display: none'> 请选择"+name+"</option>";
}
html+="<option value = '"+arr[a].typecode+"'>"+arr[a].typename+"</option>";
}else{
if(!arr[a].typecode){

@ -477,11 +477,19 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

@ -292,7 +292,11 @@ function resetTrNum(tableId) {
var s = onclick_str.indexOf("[");
var e = onclick_str.indexOf("]");
var new_onclick_str = onclick_str.substring(s+1,e);
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
<#-- update--begin--author:zhoujf date:20180827 forTASK #3064 popup控件实现 -->
if(new_onclick_str!=''){
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
}
<#-- update--end--author:jiaqiankun date:20180710 forTASK #3064 popup控件实现 -->
}
}
if(validtype_str!=null){

@ -322,6 +322,14 @@ function resetTrNum(tableId) {
if (onclick_str.indexOf("#index#") >= 0){
$this.attr("onclick",onclick_str.replace(/#index#/g,i));
}else{
<#-- update--begin--author:zhoujf date:20180827 forTASK #3064 popup控件实现 -->
var s = onclick_str.indexOf("[");
var e = onclick_str.indexOf("]");
var new_onclick_str = onclick_str.substring(s+1,e);
if(new_onclick_str!=''){
$this.attr("onclick",onclick_str.replace(new_onclick_str,i));
}
<#-- update--end--author:jiaqiankun date:20180710 forTASK #3064 popup控件实现 -->
}
}
if(validtype_str!=null){

@ -460,15 +460,23 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful接口封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
public ResponseMessage<List<${entityName}Entity>> list() {
List<${entityName}Entity> list${entityName}s=${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Entity>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize > Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list${entityName}s = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
return Result.success(list${entityName}s);
}
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody

@ -26,7 +26,7 @@
<#assign hasDateTime=1>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;">
<div class="container" style="width:100%;">
@ -66,6 +66,10 @@
<input name="${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#elseif po.showType=='file' || po.showType=='image'>
<@webuploadtag po = po defval=""/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input name="${po.fieldName}" type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
</#if>
@ -127,6 +131,10 @@
<span class="input-group-addon" ><span class="glyphicon glyphicon-calendar"></span></span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval=""/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -26,7 +26,7 @@
<#assign hasDateTime=1>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;">
<div class="container" style="width:100%;">
@ -66,6 +66,10 @@
<input name="${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='both' value='${'$'}{${entityName?uncap_first}.${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#elseif po.showType=='file' || po.showType=='image'>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}.${po.fieldName}}"/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input name="${po.fieldName}" type="text" class="form-control" maxlength="${po.length?c}" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
</#if>
@ -129,6 +133,10 @@
<span class="input-group-addon" ><span class="glyphicon glyphicon-calendar"></span> </span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}.${po.fieldName}}"/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" value = "${'$'}{${entityName?uncap_first}.${po.fieldName}}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" value='${'$'}{${entityName?uncap_first}.${po.fieldName}}' type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -456,14 +456,22 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful方法封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}",method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2400 【功能不足】一对多restful接口不足目前只返回主表的数据应该把主子表的数据一起返回 -->
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

@ -426,15 +426,23 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful接口封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
public ResponseMessage<List<${entityName}Entity>> list() {
List<${entityName}Entity> list${entityName}s=${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Entity>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize > Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list${entityName}s = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
return Result.success(list${entityName}s);
}
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody

@ -594,14 +594,22 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful方法封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}",method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2400 【功能不足】一对多restful接口不足目前只返回主表的数据应该把主子表的数据一起返回 -->
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

@ -124,7 +124,7 @@
<!-- 主表 margin-bottom:6px;border-bottom:2px solid rgb(0, 116, 101) 375 -->
<div title="${ftl_description}" data-options="iconCls:'icon-ok',selected:true" >
<div id="easyui_mainList" class="resize-y-iframe" style="height:286px;padding-bottom:6px;">
<iframe id="mainList" src="${entityName?uncap_first}Controller.do?mainList" height="99%" width="100%" frameborder="0"></iframe>
<iframe id="mainList" src="" height="99%" width="100%" frameborder="0"></iframe>
</div>
</div>
</div>
@ -151,7 +151,7 @@
<div id="tabsok" style="height:500px">
<#list subtables as key>
<div title="${subsG['${key}'].ftlDescription}" data-options="closable:false" style="overflow:hidden;box-sizing: border-box;">
<iframe id="${subsG['${key}'].entityName?uncap_first}Iframe" src="${subsG['${key}'].entityName?uncap_first}Controller.do?list" scrolling="yes" frameborder="0" height="100%" width="100%"></iframe>
<iframe id="${subsG['${key}'].entityName?uncap_first}Iframe" src="" scrolling="yes" frameborder="0" height="100%" width="100%"></iframe>
</div>
</#list>
</div>
@ -179,6 +179,7 @@
<script type="text/javascript">
$(function(){
$("#mainList").attr("src","${'$'}{webRoot}/${entityName?uncap_first}Controller.do?mainList");
initdivwidth();
$(window).resize(function(){
initdivwidth();

@ -487,14 +487,22 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful方法封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}",method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2400 【功能不足】一对多restful接口不足目前只返回主表的数据应该把主子表的数据一起返回 -->
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

@ -421,25 +421,6 @@ function ExportXls() {
JeecgExcelExport("${entityName?uncap_first}Controller.do?exportXls","${entityName?uncap_first}List");
}
<#-- update--end--Author:gj_shaojc Date:20180608 forTASK #2779 【代码生成器模板】闫东版本代码生成器存在问题问题1 -->
//列表文件图片 列格式化方法
function listFileImgFormat(value,type){
var href='';
if(value==null || value.length==0){
return href;
}
var value1 = "img/server/"+value;
if("image"==type){
href+="<img src='"+value1+"' width=30 height=30 onmouseover='tipImg(this)' onmouseout='moveTipImg()' style='vertical-align:middle'/>";
}else{
if(value.indexOf(".jpg")>-1 || value.indexOf(".gif")>-1 || value.indexOf(".png")>-1){
href+="<img src='"+value1+"' onmouseover='tipImg(this)' onmouseout='moveTipImg()' width=30 height=30 style='vertical-align:middle'/>";
}else{
var value2 = "img/server/"+value+"?down=true";
href+="<a href='"+value2+"' class='ace_button' style='text-decoration:none;' target=_blank><u><i class='fa fa-download'></i>点击下载</u></a>";
}
}
return href;
}
</script>
</body>
</html>

@ -464,15 +464,23 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful接口封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
public ResponseMessage<List<${entityName}Entity>> list() {
List<${entityName}Entity> list${entityName}s=${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Entity>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize > Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list${entityName}s = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
return Result.success(list${entityName}s);
}
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody

@ -18,7 +18,7 @@
<#break>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;margin-top: 20px">
<form id="formobj" action="${entityName?uncap_first}Controller.do?doAdd" class="form-horizontal validform" role="form" method="post">
@ -44,6 +44,10 @@
</span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval=""/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -18,7 +18,7 @@
<#break>
</#if>
</#list>
<t:base type="bootstrap,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
<t:base type="bootstrap,bootstrap-table,layer,validform,<#if uploadFlag==1>webuploader,</#if>bootstrap-form"></t:base>
</head>
<body style="overflow:hidden;overflow-y:auto;margin-top: 20px">
<form id="formobj" action="${entityName?uncap_first}Controller.do?doUpdate" class="form-horizontal validform" role="form" method="post">
@ -51,6 +51,10 @@
</span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}Page.${po.fieldName}}"/>
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control input-sm" value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>

@ -124,8 +124,10 @@ $(function(){
<#assign optionCodes="">
<#list columns as po>
<#if po.showType=='checkbox' || po.showType=='radio' || po.showType=='select' || po.showType=='list'>
<#if optionCodes?index_of(po.dictField) lt 0>
<#assign optionCodes=optionCodes+","+po.dictField >
<#-- update-begin-Author:LiShaoQing date:20180823 for:多个控件只生成一个格式化,将po.dictField改为po.fileName -->
<#if optionCodes?index_of(po.fieldName) lt 0>
<#assign optionCodes=optionCodes+","+po.fieldName >
<#-- update-end-Author:LiShaoQing date:20180823 for:多个控件只生成一个格式化,将po.dictField改为po.fileName -->
<#if po.dictTable?if_exists?html!="">
<#if po.showType=='popup'><#rt/>
<#else><#rt/>
@ -407,26 +409,6 @@ function listDictFormat(value,code,table){
}
return showVal;
}
//列表文件图片 列格式化方法
function listFileImgFormat(value,type){
var href='';
if(value==null || value.length==0){
return href;
}
var value1 = "img/server/"+value;
if("image"==type){
href+="<img src='"+value1+"' width=30 height=30 onmouseover='tipImg(this)' onmouseout='moveTipImg()' style='vertical-align:middle'/>";
}else{
if(value.indexOf(".jpg")>-1 || value.indexOf(".gif")>-1 || value.indexOf(".png")>-1){
href+="<img src='"+value1+"' onmouseover='tipImg(this)' onmouseout='moveTipImg()' width=30 height=30 style='vertical-align:middle'/>";
}else{
var value2 = "img/server/"+value+"?down=true";
href+="<a href='"+value2+"' class='ace_button' style='text-decoration:none;' target=_blank><u><i class='fa fa-download'></i>点击下载</u></a>";
}
}
return href;
}
</script>
<#if (cgformConfig.listJs.cgJsStr)?? && cgformConfig.listJs.cgJsStr!="">
<script type="text/javascript">

@ -467,14 +467,22 @@ public class ${entityName}Controller extends BaseController {
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful方法封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}",method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2400 【功能不足】一对多restful接口不足目前只返回主表的数据应该把主子表的数据一起返回 -->
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

@ -41,8 +41,7 @@
</style>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<#if callbackFlag == true>
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
<t:base type="uploadify"></t:base>
</#if>
<script type="text/javascript">
$(document).ready(function(){

@ -41,8 +41,7 @@
</style>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<#if callbackFlag == true>
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
<t:base type="uploadify"></t:base>
</#if>
<script type="text/javascript">
$(document).ready(function(){

@ -461,15 +461,23 @@ public class ${entityName}Controller extends BaseController {
<#-- 列为文件类型的文件代码生成 -->
<#-- update--begin--author:zhangjiaqiang date:20171113 for:restful接口封装 -->
<#-- restful 通用方法生成 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}", method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
public ResponseMessage<List<${entityName}Entity>> list() {
List<${entityName}Entity> list${entityName}s=${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Entity>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize > Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list${entityName}s = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
return Result.success(list${entityName}s);
}
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody

@ -20,8 +20,7 @@
<title>${ftl_description}</title>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<#if callbackFlag == true>
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
<t:base type="uploadify"></t:base>
</#if>
<#if cgformConfig.cgFormHead.isTree == 'Y'>
<style type="text/css">

@ -20,8 +20,7 @@
<title>${ftl_description}</title>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<#if callbackFlag == true>
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
<t:base type="uploadify"></t:base>
</#if>
<#if cgformConfig.cgFormHead.isTree == 'Y'>
<style type="text/css">

@ -1,22 +1,22 @@
<#-- 表单列表当中每一列的处理 -->
<#macro formControl po namepre = "" valuepre = "" style="">
<#if po.showType == "text">
<input name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> style="width:150px" maxlength="${po.length?c}" type="text" class="form-control" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}" idFieldName="${namepre}id"/>/>
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> style="width:150px" maxlength="${po.length?c}" type="text" class="form-control" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}" idFieldName="${namepre}id"/>/>
<#rt/>
<#elseif po.showType=='password'>
<input name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> style="width:150px" maxlength="${po.length?c}" type="password" class="form-control" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> style="width:150px" maxlength="${po.length?c}" type="password" class="form-control" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
<#rt/>
<#elseif po.showType=='select' || po.showType=='list'>
<t:dictSelect field="${namepre}${po.fieldName}" type="${po.showType?if_exists?html}" extendJson="{class:'form-control',style:'width:150px !important'}" <@datatype inputCheck="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" /> <#if valuepre != ""> defaultVal="${'$'}{${valuepre}${po.fieldName}}" </#if> hasLabel="false" title="${po.content}"></t:dictSelect>
<t:dictSelect id="${namepre}${po.fieldName}" field="${namepre}${po.fieldName}" type="${po.showType?if_exists?html}" extendJson="{class:'form-control',style:'width:150px !important'}" <@datatype inputCheck="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" /> <#if valuepre != ""> defaultVal="${'$'}{${valuepre}${po.fieldName}}" </#if> hasLabel="false" title="${po.content}"></t:dictSelect>
<#rt/>
<#elseif po.showType=='radio' || po.showType=='checkbox'>
<t:dictSelect field="${namepre}${po.fieldName}" type="${po.showType?if_exists?html}" <@datatype inputCheck="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" /> <#if valuepre != ""> defaultVal="${'$'}{${valuepre}${po.fieldName}}" </#if> hasLabel="false" title="${po.content}"></t:dictSelect>
<t:dictSelect id="${namepre}${po.fieldName}" field="${namepre}${po.fieldName}" type="${po.showType?if_exists?html}" <@datatype inputCheck="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" /> <#if valuepre != ""> defaultVal="${'$'}{${valuepre}${po.fieldName}}" </#if> hasLabel="false" title="${po.content}"></t:dictSelect>
<#rt/>
<#elseif po.showType=='date'>
<input name="${namepre}${po.fieldName}" maxlength="${po.length?c}" type="text" class="form-control" onClick="WdatePicker()" style="width:150px;background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> value='<fmt:formatDate value='${'$'}{${valuepre}${po.fieldName}}' type="date" pattern="yyyy-MM-dd"/>'/>
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" maxlength="${po.length?c}" type="text" class="form-control" onClick="WdatePicker()" style="width:150px;background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> value='<fmt:formatDate value='${'$'}{${valuepre}${po.fieldName}}' type="date" pattern="yyyy-MM-dd"/>'/>
<#rt/>
<#elseif po.showType=='datetime'>
<input name="${namepre}${po.fieldName}" maxlength="${po.length?c}" type="text" class="form-control" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:150px;background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> value='<fmt:formatDate value='${'$'}{${valuepre}${po.fieldName}}' type="date" pattern="yyyy-MM-dd hh:mm:ss"/>'/>
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" maxlength="${po.length?c}" type="text" class="form-control" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:150px;background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> value='<fmt:formatDate value='${'$'}{${valuepre}${po.fieldName}}' type="date" pattern="yyyy-MM-dd hh:mm:ss"/>'/>
<#rt/>
<#elseif po.showType=='popup'>
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" type="text" class="form-control" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> style="width:150px" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" /><#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if>/>
@ -24,7 +24,7 @@
<#elseif po.showType=='file' || po.showType == 'image'>
<#if style == "onetomany">
<input onclick="onetomanyUpload('${namepre}${po.fieldName}')" class="file-upload-btn" type="button" value="上传附件" />
<input type="hidden" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if>/>
<input id="${namepre}${po.fieldName}" type="hidden" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if>/>
<#if valuepre != "">
<a target="_blank" class="file-down-btn"<#rt/>
<c:if test="${'$'}{not empty ${valuepre}${po.fieldName}}"><#rt/>
@ -40,6 +40,6 @@
</#if>
<#rt/>
<#else>
<input name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> maxlength="${po.length?c}" type="text" class="form-control" style="width:150px" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> maxlength="${po.length?c}" type="text" class="form-control" style="width:150px" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
</#if>
</#macro>

@ -1,36 +1,36 @@
<#-- bootstrap表单列表当中每一列的处理 TODO-后期可以和上面那个合并 -->
<#macro formControlbt po namepre = "" valuepre = "" tablestyle = "" tpl="">
<#if po.showType=='textarea'>
<textarea name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> class="form-control input-sm" rows="6" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>></textarea>
<textarea id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> class="form-control input-sm" rows="6" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>></textarea>
<#elseif po.showType=='text'>
<input name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
<#elseif po.showType=='password'>
<input name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="password" maxlength="${po.length?c}" class="form-control input-sm"<@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>/>
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="password" maxlength="${po.length?c}" class="form-control input-sm"<@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>/>
<#elseif po.showType=='radio'>
<div style="padding-top:5px">
<t:dictSelect field="${namepre}${po.fieldName}" <#if valuepre != "">defaultVal = "${'$'}{${valuepre}${po.fieldName}}"</#if> <#if tpl=='1'>extendJson="{class:'i-checks-tpl'}"<#else>extendJson="{class:'i-checks'}"</#if> type="radio" hasLabel="false" title="${po.content}" <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" />></t:dictSelect>
<t:dictSelect id="${namepre}${po.fieldName}" field="${namepre}${po.fieldName}" <#if valuepre != "">defaultVal = "${'$'}{${valuepre}${po.fieldName}}"</#if> <#if tpl=='1'>extendJson="{class:'i-checks-tpl'}"<#else>extendJson="{class:'i-checks'}"</#if> type="radio" hasLabel="false" title="${po.content}" <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" />></t:dictSelect>
</div>
<#elseif po.showType=='select' || po.showType=='list'>
<t:dictSelect field="${namepre}${po.fieldName}" <#if valuepre != "">defaultVal = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="select" hasLabel="false" title="${po.content}" extendJson="{class:'form-control input-sm'}" <@datatype inputCheck="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" />></t:dictSelect>
<t:dictSelect id="${namepre}${po.fieldName}" field="${namepre}${po.fieldName}" <#if valuepre != "">defaultVal = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="select" hasLabel="false" title="${po.content}" extendJson="{class:'form-control input-sm'}" <@datatype inputCheck="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" />></t:dictSelect>
<#elseif po.showType=='checkbox'>
<div style="padding-top:5px">
<t:dictSelect field="${namepre}${po.fieldName}" <#if valuepre != "">defaultVal = "${'$'}{${valuepre}${po.fieldName}}"</#if> <#if tpl=='1'>extendJson="{class:'i-checks-tpl'}"<#else>extendJson="{class:'i-checks'}"</#if> type="checkbox" hasLabel="false" title="${po.content}" <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" />></t:dictSelect>
<t:dictSelect id="${namepre}${po.fieldName}" field="${namepre}${po.fieldName}" <#if valuepre != "">defaultVal = "${'$'}{${valuepre}${po.fieldName}}"</#if> <#if tpl=='1'>extendJson="{class:'i-checks-tpl'}"<#else>extendJson="{class:'i-checks'}"</#if> type="checkbox" hasLabel="false" title="${po.content}" <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" />></t:dictSelect>
</div>
<#elseif po.showType=='date'>
<#if tablestyle=='1'>
<input name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-date" value="<fmt:formatDate pattern='yyyy-MM-dd' type='date' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-date" value="<fmt:formatDate pattern='yyyy-MM-dd' type='date' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#else>
<div class="input-group input-group-sm">
<input name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-date" value="<fmt:formatDate pattern='yyyy-MM-dd' type='date' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-date" value="<fmt:formatDate pattern='yyyy-MM-dd' type='date' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</#if>
<#elseif po.showType=='datetime'>
<#if tablestyle=='1'>
<input name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='both' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='both' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<#else>
<div class="input-group input-group-sm">
<input name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='both' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" type="text" class="form-control input-sm laydate-datetime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='both' value='${'$'}{${valuepre}${po.fieldName}}'/>" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</#if>
@ -40,7 +40,7 @@
<@webuploadtag po = po defval="${'$'}{${valuepre}${po.fieldName}}"/>
<#else>
<input onclick="onetomanyUpload('${namepre}${po.fieldName}')" class="btn btn-default" type="button" value="上传附件" />
<input type="hidden" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if>/>
<input id="${namepre}${po.fieldName}" type="hidden" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if>/>
<#if valuepre != "">
<a target="_blank" class=".btn-default"<#rt/>
<c:if test="${'$'}{not empty ${valuepre}${po.fieldName}}"><#rt/>
@ -53,7 +53,11 @@
</#if>
</#if>
<#-- update--end--author:liushaoqian Date:20180720 for:TASK #2959 【代码生成器模板】新模板Bootstrap 版本等模板,明细不支持上传附件 (统一改造) -->
<#-- update--begin--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<#elseif po.showType=='popup'>
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> <#if po.dictTable?if_exists?html!=""> onclick="popupClick(this,'${po.dictText}','${po.dictField}','${po.dictTable}')"</#if>/>
<#else>
<input name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
<#-- update--end--author:zhoujf Date:20180827 for:TASK #3064 popup控件实现 -->
<input id="${namepre}${po.fieldName}" name="${namepre}${po.fieldName}" <#if valuepre != "">value = "${'$'}{${valuepre}${po.fieldName}}"</#if> type="text" class="form-control input-sm" maxlength="${po.length?c}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/> />
</#if>
</#macro>

@ -492,14 +492,22 @@ public class ${entityName}Controller extends BaseController {
<#if cgformConfig.supportRestful?? && cgformConfig.supportRestful == "1">
<#-- restful 通用方法生成 -->
<#-- update--begin--author:zhangjiaqiang date:20171113 for:TASK #2415 【restful接口模板】模板再次改造封装了通用了返回结果加了必要校验 -->
@RequestMapping(method = RequestMethod.GET)
<#-- update-begin-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
@RequestMapping(value="/list/{pageNo}/{pageSize}",method = RequestMethod.GET)
@ResponseBody
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
@ApiOperation(value="${ftl_description}列表信息",produces="application/json",httpMethod="GET")
<#-- update--end--author:zhangjiaqiang date:20171031 for:TASK #2397 【新功能】代码生成器模板修改追加swagger-ui注解 -->
<#-- update--begin--author:zhangjiaqiang date:20171031 for:TASK #2400 【功能不足】一对多restful接口不足目前只返回主表的数据应该把主子表的数据一起返回 -->
public ResponseMessage<List<${entityName}Page>> list() {
List<${entityName}Entity> list= ${entityName?uncap_first}Service.getList(${entityName}Entity.class);
public ResponseMessage<List<${entityName}Page>> list(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize, HttpServletRequest request) {
if(pageSize>Globals.MAX_PAGESIZE){
return Result.error("每页请求不能超过" + Globals.MAX_PAGESIZE + "条");
}
CriteriaQuery query = new CriteriaQuery(${entityName}Entity.class);
query.setCurPage(pageNo<=0?1:pageNo);
query.setPageSize(pageSize<1?1:pageSize);
List<${entityName}Entity> list = this.${entityName?uncap_first}Service.getListByCriteriaQuery(query,true);
<#-- update-end-Author:LiShaoQing Date:20180828 for: TASK #3105 【代码生成器】代码生成rest接口 list获取改造 -->
List<${entityName}Page> pageList=new ArrayList<${entityName}Page>();
if(list!=null&&list.size()>0){
for(${entityName}Entity entity:list){

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

Loading…
Cancel
Save