Cloud下代码生成模板完善
This commit is contained in:
@@ -22,19 +22,19 @@
|
|||||||
</childTable>
|
</childTable>
|
||||||
</category>
|
</category>
|
||||||
<category value="crud_cloud" label="单表/主子表 (增删改查 Cloud,生成 Api/Client)">
|
<category value="crud_cloud" label="单表/主子表 (增删改查 Cloud,生成 Api/Client)">
|
||||||
<template>crud/mapper.xml</template>
|
<template>crud_cloud/mapper.xml</template>
|
||||||
<template>crud_cloud/entity.xml</template>
|
<template>crud_cloud/entity.xml</template>
|
||||||
<template>crud/dao.xml</template>
|
<template>crud_cloud/dao.xml</template>
|
||||||
<template>crud_cloud/api.xml</template>
|
<template>crud_cloud/api.xml</template>
|
||||||
<template>crud_cloud/client.xml</template>
|
<template>crud_cloud/client.xml</template>
|
||||||
<template>crud_cloud/service.xml</template>
|
<template>crud_cloud/service.xml</template>
|
||||||
<template>crud/controller.xml</template>
|
<template>crud_cloud/controller.xml</template>
|
||||||
<template>crud/viewList.xml</template>
|
<template>crud_cloud/viewList.xml</template>
|
||||||
<template>crud/viewForm.xml</template>
|
<template>crud_cloud/viewForm.xml</template>
|
||||||
<childTable>
|
<childTable>
|
||||||
<template>crud/mapper.xml</template>
|
<template>crud_cloud/mapper.xml</template>
|
||||||
<template>crud_cloud/entity.xml</template>
|
<template>crud_cloud/entity.xml</template>
|
||||||
<template>crud/dao.xml</template>
|
<template>crud_cloud/dao.xml</template>
|
||||||
</childTable>
|
</childTable>
|
||||||
</category>
|
</category>
|
||||||
<category value="treeGrid" label="树表/树结构表(增删改查)">
|
<category value="treeGrid" label="树表/树结构表(增删改查)">
|
||||||
|
|||||||
@@ -0,0 +1,318 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
||||||
|
<template>
|
||||||
|
<name>controller</name>
|
||||||
|
<filePath>${moduleName}/src/main/java/${packageName}/${moduleName}/web/${subModuleName}</filePath>
|
||||||
|
<fileName>${ClassName}Controller.java</fileName>
|
||||||
|
<content><![CDATA[
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||||
|
*/
|
||||||
|
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
|
||||||
|
|
||||||
|
<% if (table.isTreeEntity){ %>
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
<% }else{ %>
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import com.jeesite.common.config.Global;
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
import com.jeesite.common.collect.ListUtils;
|
||||||
|
import com.jeesite.common.collect.MapUtils;
|
||||||
|
import com.jeesite.common.lang.StringUtils;
|
||||||
|
import com.jeesite.common.idgen.IdGen;
|
||||||
|
import com.jeesite.modules.sys.utils.UserUtils;
|
||||||
|
<% }else{ %>
|
||||||
|
import com.jeesite.common.entity.Page;
|
||||||
|
<% } %>
|
||||||
|
<% if (table.tplCategory == 'crud_select'){ %>
|
||||||
|
import com.alibaba.fastjson.JSONValidator;
|
||||||
|
import com.jeesite.common.codec.EncodeUtils;
|
||||||
|
<% } %>
|
||||||
|
import com.jeesite.common.web.BaseController;
|
||||||
|
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
|
||||||
|
<% for (child in table.childList){ %>
|
||||||
|
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)};
|
||||||
|
<% } %>
|
||||||
|
import ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}Controller
|
||||||
|
* @author ${functionAuthor}
|
||||||
|
* @version ${functionVersion}
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "\${adminPath}/${urlPrefix}")
|
||||||
|
public class ${ClassName}Controller extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ${ClassName}Service ${className}Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据
|
||||||
|
*/
|
||||||
|
@ModelAttribute
|
||||||
|
public ${ClassName} get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>, boolean isNewRecord) {
|
||||||
|
<% if (table.pkList.~size == 1){ %>
|
||||||
|
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
|
||||||
|
<% }else{ %>
|
||||||
|
${ClassName} ${className} = new ${ClassName}();
|
||||||
|
<% for(pk in table.pkList){ %>
|
||||||
|
${className}.set${@StringUtils.cap(pk.simpleAttrName)}(${pk.simpleAttrName});
|
||||||
|
<% } %>
|
||||||
|
${className}.setIsNewRecord(isNewRecord);
|
||||||
|
return ${className}Service.getAndValid(${className});
|
||||||
|
<% } %>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = {"list", ""})
|
||||||
|
public String list(${ClassName} ${className}, Model model) {
|
||||||
|
model.addAttribute("${className}", ${className});
|
||||||
|
return "${lastPackageName}/${viewPrefix}List";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "listData")
|
||||||
|
@ResponseBody
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
public List<${ClassName}> listData(${ClassName} ${className}) {
|
||||||
|
if (StringUtils.isBlank(${className}.getParentCode())) {
|
||||||
|
${className}.setParentCode(${ClassName}.ROOT_CODE);
|
||||||
|
}
|
||||||
|
<% for(c in table.columnList){ %>
|
||||||
|
<% if(c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status'){ %>
|
||||||
|
<% if(c.attrType == 'String'){ %>
|
||||||
|
if (StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})){
|
||||||
|
${className}.setParentCode(null);
|
||||||
|
}
|
||||||
|
<% }else{ %>
|
||||||
|
if (${className}.${c.attrNameForGetMethod} != null){
|
||||||
|
${className}.setParentCode(null);
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
<% } %>
|
||||||
|
<% } %>
|
||||||
|
List<${ClassName}> list = ${className}Service.findList(${className});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
<% }else{ %>
|
||||||
|
public Page<${ClassName}> listData(${ClassName} ${className}, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
${className}.setPage(new Page<>(request, response));
|
||||||
|
Page<${ClassName}> page = ${className}Service.findPage(${className});
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
<% for (child in table.childList){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询子表数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "${@StringUtils.uncap(child.className)}ListData")
|
||||||
|
@ResponseBody
|
||||||
|
public Page<${@StringUtils.cap(child.className)}> subListData(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
${@StringUtils.uncap(child.className)}.setPage(new Page<>(request, response));
|
||||||
|
Page<${@StringUtils.cap(child.className)}> page = ${className}Service.findSubPage(${@StringUtils.uncap(child.className)});
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看编辑表单
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "form")
|
||||||
|
public String form(${ClassName} ${className}, Model model) {
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
// 创建并初始化下一个节点信息
|
||||||
|
${className} = createNextNode(${className});
|
||||||
|
<% } %>
|
||||||
|
model.addAttribute("${className}", ${className});
|
||||||
|
return "${lastPackageName}/${viewPrefix}Form";
|
||||||
|
}
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建并初始化下一个节点信息,如:排序号、默认值
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:edit")
|
||||||
|
@RequestMapping(value = "createNextNode")
|
||||||
|
@ResponseBody
|
||||||
|
public ${ClassName} createNextNode(${ClassName} ${className}) {
|
||||||
|
if (StringUtils.isNotBlank(${className}.getParentCode())){
|
||||||
|
${className}.setParent(${className}Service.get(${className}.getParentCode()));
|
||||||
|
}
|
||||||
|
if (${className}.getIsNewRecord()) {
|
||||||
|
${ClassName} where = new ${ClassName}();
|
||||||
|
where.setParentCode(${className}.getParentCode());
|
||||||
|
${ClassName} last = ${className}Service.getLastByParentCode(where);
|
||||||
|
// 获取到下级最后一个节点
|
||||||
|
if (last != null){
|
||||||
|
${className}.setTreeSort(last.getTreeSort() + 30);
|
||||||
|
<% if(table.isPkCustom){ %>
|
||||||
|
${className}.set${@StringUtils.cap(table.treeViewCodeAttrName)}(IdGen.nextCode(last.get${@StringUtils.cap(table.treeViewCodeAttrName)}()));
|
||||||
|
}else if (${className}.getParent() != null){
|
||||||
|
${className}.set${@StringUtils.cap(table.treeViewCodeAttrName)}(${className}.getParent().get${@StringUtils.cap(table.treeViewCodeAttrName)}() + "001");
|
||||||
|
<% } %>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 以下设置表单默认数据
|
||||||
|
if (${className}.getTreeSort() == null){
|
||||||
|
${className}.setTreeSort(${ClassName}.DEFAULT_TREE_SORT);
|
||||||
|
}
|
||||||
|
return ${className};
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:edit")
|
||||||
|
@PostMapping(value = "save")
|
||||||
|
@ResponseBody
|
||||||
|
public String save(@Validated ${ClassName} ${className}) {
|
||||||
|
${className}Service.save(${className});
|
||||||
|
return renderResult(Global.TRUE, text("保存${functionNameSimple}成功!"));
|
||||||
|
}
|
||||||
|
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停用数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:edit")
|
||||||
|
@RequestMapping(value = "disable")
|
||||||
|
@ResponseBody
|
||||||
|
public String disable(${ClassName} ${className}) {
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
${ClassName} where = new ${ClassName}();
|
||||||
|
where.setStatus(${ClassName}.STATUS_NORMAL);
|
||||||
|
where.setParentCodes("," + ${className}.getId() + ",");
|
||||||
|
long count = ${className}Service.findCount(where);
|
||||||
|
if (count > 0) {
|
||||||
|
return renderResult(Global.FALSE, text("该${functionNameSimple}包含未停用的子${functionNameSimple}!"));
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
${className}.setStatus(${ClassName}.STATUS_DISABLE);
|
||||||
|
${className}Service.updateStatus(${className});
|
||||||
|
return renderResult(Global.TRUE, text("停用${functionNameSimple}成功"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:edit")
|
||||||
|
@RequestMapping(value = "enable")
|
||||||
|
@ResponseBody
|
||||||
|
public String enable(${ClassName} ${className}) {
|
||||||
|
${className}.setStatus(${ClassName}.STATUS_NORMAL);
|
||||||
|
${className}Service.updateStatus(${className});
|
||||||
|
return renderResult(Global.TRUE, text("启用${functionNameSimple}成功"));
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
<% if(toBoolean(table.optionMap['isHaveDelete'])){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:edit")
|
||||||
|
@RequestMapping(value = "delete")
|
||||||
|
@ResponseBody
|
||||||
|
public String delete(${ClassName} ${className}) {
|
||||||
|
${className}Service.delete(${className});
|
||||||
|
return renderResult(Global.TRUE, text("删除${functionNameSimple}成功!"));
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取树结构数据
|
||||||
|
* @param excludeCode 排除的Code
|
||||||
|
* @param isShowCode 是否显示编码(true or 1:显示在左侧;2:显示在右侧;false or null:不显示)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "treeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Map<String, Object>> treeData(String excludeCode, String isShowCode) {
|
||||||
|
List<Map<String, Object>> mapList = ListUtils.newArrayList();
|
||||||
|
List<${ClassName}> list = ${className}Service.findList(new ${ClassName}());
|
||||||
|
for (int i=0; i<list.size(); i++){
|
||||||
|
${ClassName} e = list.get(i);
|
||||||
|
<% if (table.statusExists){ %>
|
||||||
|
// 过滤非正常的数据
|
||||||
|
if (!${ClassName}.STATUS_NORMAL.equals(e.getStatus())){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
// 过滤被排除的编码(包括所有子级)
|
||||||
|
if (StringUtils.isNotBlank(excludeCode)){
|
||||||
|
if (e.getId().equals(excludeCode)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (e.getParentCodes().contains("," + excludeCode + ",")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, Object> map = MapUtils.newHashMap();
|
||||||
|
map.put("id", e.getId());
|
||||||
|
map.put("pId", e.getParentCode());
|
||||||
|
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.get${@StringUtils.cap(table.treeViewCodeAttrName)}(), e.get${@StringUtils.cap(table.treeViewNameAttrName)}()));
|
||||||
|
mapList.add(map);
|
||||||
|
}
|
||||||
|
return mapList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修复表结构相关数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:edit")
|
||||||
|
@RequestMapping(value = "fixTreeData")
|
||||||
|
@ResponseBody
|
||||||
|
public String fixTreeData(${ClassName} ${className}){
|
||||||
|
if (!UserUtils.getUser().isAdmin()){
|
||||||
|
return renderResult(Global.FALSE, "操作失败,只有管理员才能进行修复!");
|
||||||
|
}
|
||||||
|
${className}Service.fixTreeData();
|
||||||
|
return renderResult(Global.TRUE, "数据修复成功");
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
<% if (table.tplCategory == 'crud_select'){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表选择对话框
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "${className}Select")
|
||||||
|
public String ${className}Select(${ClassName} ${className}, String selectData, Model model) {
|
||||||
|
String selectDataJson = EncodeUtils.decodeUrl(selectData);
|
||||||
|
if (selectDataJson != null && JSONValidator.from(selectDataJson).validate()){
|
||||||
|
model.addAttribute("selectData", selectDataJson);
|
||||||
|
}
|
||||||
|
model.addAttribute("${className}", ${className});
|
||||||
|
return "${lastPackageName}/${viewPrefix}Select";
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
}]]>
|
||||||
|
</content>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
||||||
|
<template>
|
||||||
|
<name>dao</name>
|
||||||
|
<filePath>${moduleName}/src/main/java/${packageName}/${moduleName}/dao/${subModuleName}</filePath>
|
||||||
|
<fileName>${ClassName}Dao.java</fileName>
|
||||||
|
<content><![CDATA[
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||||
|
*/
|
||||||
|
package ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''};
|
||||||
|
|
||||||
|
import com.jeesite.common.dao.${table.isTreeEntity?'Tree':'Crud'}Dao;
|
||||||
|
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||||
|
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}DAO接口
|
||||||
|
* @author ${functionAuthor}
|
||||||
|
* @version ${functionVersion}
|
||||||
|
*/
|
||||||
|
@MyBatisDao<% if(isNotBlank(table.dataSourceName)){ %>(dataSourceName="${table.dataSourceName}")<% } %>
|
||||||
|
public interface ${ClassName}Dao extends ${table.isTreeEntity?'Tree':'Crud'}Dao<${ClassName}> {
|
||||||
|
|
||||||
|
}]]>
|
||||||
|
</content>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
||||||
|
<template>
|
||||||
|
<name>mapper</name>
|
||||||
|
<filePath>${moduleName}/src/main/resources/mappings/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
|
||||||
|
<fileName>${ClassName}Dao.xml</fileName>
|
||||||
|
<content><![CDATA[
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="${packageName}.${moduleName}.dao${isNotBlank(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao">
|
||||||
|
|
||||||
|
<!-- 查询数据
|
||||||
|
<select id="findList" resultType="${ClassName}">
|
||||||
|
SELECT \${sqlMap.column.toSql()}
|
||||||
|
FROM \${sqlMap.table.toSql()}
|
||||||
|
<where>
|
||||||
|
\${sqlMap.where.toSql()}
|
||||||
|
</where>
|
||||||
|
ORDER BY \${sqlMap.order.toSql()}
|
||||||
|
</select> -->
|
||||||
|
|
||||||
|
</mapper>]]>
|
||||||
|
</content>
|
||||||
|
</template>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
||||||
<template>
|
<template>
|
||||||
<name>service</name>
|
<name>service</name>
|
||||||
<filePath>src/main/java/${packageName}/${moduleName}/service/${subModuleName}</filePath>
|
<filePath>${moduleName}/src/main/java/${packageName}/${moduleName}/service/${subModuleName}</filePath>
|
||||||
<fileName>${ClassName}Service.java</fileName>
|
<fileName>${ClassName}Service.java</fileName>
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
||||||
|
<template>
|
||||||
|
<name>viewForm</name>
|
||||||
|
<filePath>${moduleName}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
|
||||||
|
<fileName>${className}Form.html</fileName>
|
||||||
|
<content><![CDATA[
|
||||||
|
<%
|
||||||
|
var extLibs = '';
|
||||||
|
if(toBoolean(table.optionMap['isImageUpload']) || toBoolean(table.optionMap['isFileUpload'])){
|
||||||
|
extLibs = extLibs + ',\'fileupload\'';
|
||||||
|
}
|
||||||
|
if(table.childList.~size > 0){
|
||||||
|
extLibs = extLibs + ',\'dataGrid\'';
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
\<% layout('/layouts/default.html', {title: '${functionNameSimple}管理', libs: ['validate'${extLibs}]}){ %>
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="box box-main">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<div class="box-title">
|
||||||
|
<i class="fa icon-note"></i> \${text(${className}.isNewRecord ? '新增${functionNameSimple}' : '编辑${functionNameSimple}')}
|
||||||
|
</div>
|
||||||
|
<div class="box-tools pull-right">
|
||||||
|
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<${'#'}form:form id="inputForm" model="\${${className}}" action="\${ctx}/${urlPrefix}/save" method="post" class="form-horizontal">
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="form-unit">\${text('基本信息')}</div>
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-4">\${text('上级${functionNameSimple}')}:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<${'#'}form:treeselect id="parent" title="\${text('上级${functionNameSimple}')}"
|
||||||
|
path="parent.id" labelPath="parent.${table.treeViewNameAttrName}"
|
||||||
|
url="\${ctx}/${urlPrefix}/treeData?excludeCode=\${${className}.id}"
|
||||||
|
class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
|
<% include('/templates/modules/gen/include/formControl.html'){} %>
|
||||||
|
<% include('/templates/modules/gen/include/formChildTable.html'){} %>
|
||||||
|
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
|
||||||
|
\<% if(isNotBlank(${className}.bpm.taskId)){ %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-2">${text('审批意见')}:</label>
|
||||||
|
<div class="col-xs-10">
|
||||||
|
<${'#'}bpm:comment bpmEntity="\${${className}}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
\<% } %>
|
||||||
|
<${'#'}bpm:nextTaskInfo bpmEntity="\${${className}}" />
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
<div class="box-footer">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
|
||||||
|
\<% if (hasPermi('${permissionPrefix}:edit')){ %>
|
||||||
|
<${'#'}form:hidden path="status"/>
|
||||||
|
\<% if (${className}.isNewRecord || ${className}.status == '9'){ %>
|
||||||
|
<button type="submit" class="btn btn-sm btn-info" id="btnDraft"><i class="fa fa-save"></i> ${text('暂 存')}</button>
|
||||||
|
\<% } %>
|
||||||
|
<${'#'}bpm:button bpmEntity="\${${className}}" formKey="${table.optionMap['bpmFormKey']}" completeText="${text('提 交')}"/>
|
||||||
|
\<% } %>
|
||||||
|
<% }else{ %>
|
||||||
|
\<% if (hasPermi('${permissionPrefix}:edit')){ %>
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> \${text('保 存')}</button>
|
||||||
|
\<% } %>
|
||||||
|
<% } %>
|
||||||
|
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> \${text('关 闭')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</${'#'}form:form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
\<% } %>
|
||||||
|
<% include('/templates/modules/gen/include/formChildTableScript.html'){} %>
|
||||||
|
<script>
|
||||||
|
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
|
||||||
|
// 业务实现草稿按钮
|
||||||
|
$('#btnDraft').click(function(){
|
||||||
|
$('#status').val(Global.STATUS_DRAFT);
|
||||||
|
});
|
||||||
|
// 流程按钮操作事件
|
||||||
|
BpmButton = window.BpmButton || {};
|
||||||
|
BpmButton.init = function(task){ }
|
||||||
|
BpmButton.complete = function($this, task){
|
||||||
|
$('#status').val(Global.STATUS_AUDIT);
|
||||||
|
};
|
||||||
|
// 表单验证提交事件
|
||||||
|
<% } %>
|
||||||
|
$("#inputForm").validate({
|
||||||
|
submitHandler: function(form){
|
||||||
|
js.ajaxSubmitForm($(form), function(data){
|
||||||
|
js.showMessage(data.message);
|
||||||
|
if(data.result == Global.TRUE){
|
||||||
|
js.closeCurrentTabPage(function(contentWindow){
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
|
||||||
|
$('#parentCode').val(), '\${${className}.id}');
|
||||||
|
<% }else{ %>
|
||||||
|
contentWindow.page();
|
||||||
|
<% } %>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
|
||||||
|
// 选择上级节点回调方法
|
||||||
|
function treeselectCallback(id, act, index, layero){
|
||||||
|
if (id == 'parent' && (act == 'ok' || act == 'clear')){
|
||||||
|
// 创建并初始化下一个节点信息,如:排序号、默认值
|
||||||
|
$.get('\${ctx}/${urlPrefix}/createNextNode?parentCode='
|
||||||
|
+$('#parentCode').val(), function(data){
|
||||||
|
$('#treeSort').val(data.treeSort);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
</script>]]>
|
||||||
|
</content>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
||||||
|
<template>
|
||||||
|
<name>viewList</name>
|
||||||
|
<filePath>${moduleName}/src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
|
||||||
|
<fileName>${className}List.html</fileName>
|
||||||
|
<content><![CDATA[
|
||||||
|
\<% layout('/layouts/default.html', {title: '${functionNameSimple}管理', libs: ['dataGrid']}){ %>
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="box box-main">
|
||||||
|
<div class="box-header">
|
||||||
|
<div class="box-title">
|
||||||
|
<i class="fa icon-notebook"></i> \${text('${functionNameSimple}管理')}
|
||||||
|
</div>
|
||||||
|
<div class="box-tools pull-right">
|
||||||
|
<a href="#" class="btn btn-default" id="btnSearch" title="\${text('查询')}"><i class="fa fa-filter"></i> \${text('查询')}</a>
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
<a href="#" class="btn btn-default" id="btnRefreshTree" title="\${text('刷新')}"><i class="fa fa-refresh"></i> \${text('刷新')}</a>
|
||||||
|
<a href="#" class="btn btn-default" id="btnExpandTreeNode" title="\${text('展开一级')}"><i class="fa fa-angle-double-down"></i> \${text('展开')}</a>
|
||||||
|
<a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="\${text('折叠全部')}"><i class="fa fa-angle-double-up"></i> \${text('折叠')}</a>
|
||||||
|
<% } %>
|
||||||
|
\<% if(hasPermi('${permissionPrefix}:edit')){ %>
|
||||||
|
<a href="\${ctx}/${urlPrefix}/form" class="btn btn-default btnTool" title="\${text('新增${functionNameSimple}')}"><i class="fa fa-plus"></i> \${text('新增')}</a>
|
||||||
|
\<% } %>
|
||||||
|
<a href="#" class="btn btn-default" id="btnSetting" title="\${text('设置')}"><i class="fa fa-navicon"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<% include('/templates/modules/gen/include/searchForm.html'){} %>
|
||||||
|
<table id="dataGrid"></table>
|
||||||
|
<% if(!table.isTreeEntity){ %>
|
||||||
|
<div id="dataGridPage"></div>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
\<% } %>
|
||||||
|
<% include('/templates/modules/gen/include/dataGridScript.html'){} %>]]>
|
||||||
|
</content>
|
||||||
|
</template>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
|
||||||
<template>
|
<template>
|
||||||
<name>pom</name>
|
<name>pom</name>
|
||||||
<filePath>${module.moduleCode}</filePath>
|
<filePath>${module.moduleCode}/${module.moduleCode}</filePath>
|
||||||
<fileName>pom.xml</fileName>
|
<fileName>pom.xml</fileName>
|
||||||
<charset></charset>
|
<charset></charset>
|
||||||
<content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
<content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||||
@@ -12,41 +12,165 @@
|
|||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.jeesite</groupId>
|
<groupId>com.jeesite</groupId>
|
||||||
<artifactId>jeesite-parent</artifactId>
|
<artifactId>jeesite-cloud-parent</artifactId>
|
||||||
<version>${jeesiteVersion}-SNAPSHOT</version>
|
<version>${jeesiteVersion}-SNAPSHOT</version>
|
||||||
<relativePath>../../parent/pom.xml</relativePath>
|
<relativePath>../../../parent/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>jeesite-module-${module.moduleCode}</artifactId>
|
<artifactId>jeesite-cloud-module-${module.moduleCode}</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<name>JeeSite Module ${module.moduleName}</name>
|
<name>JeeSite Cloud Module ${module.moduleName}</name>
|
||||||
<url>http://jeesite.com</url>
|
<url>http://jeesite.com</url>
|
||||||
<inceptionYear>2013-Now</inceptionYear>
|
<inceptionYear>2013-Now</inceptionYear>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
||||||
|
<finalName>web</finalName><!-- war包的名称 -->
|
||||||
|
<start-class>com.jeesite.modules.${@StringUtils.cap(module.moduleCode)}Application</start-class>
|
||||||
|
|
||||||
|
<!-- environment setting -->
|
||||||
|
<eclipse-plugin-download-sources>false</eclipse-plugin-download-sources>
|
||||||
|
<eclipse-plugin-download-javadocs>false</eclipse-plugin-download-javadocs>
|
||||||
|
|
||||||
|
<!-- docker setting -->
|
||||||
|
<docker.run.port>8989:8989</docker.run.port>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- 服务发现 -->
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
|
||||||
|
</dependency> -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 配置中心 -->
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-config</artifactId>
|
||||||
|
</dependency> -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 链路追踪服务 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 在线文档 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jeesite</groupId>
|
<groupId>com.jeesite</groupId>
|
||||||
<artifactId>jeesite-module-core</artifactId>
|
<artifactId>jeesite-module-swagger</artifactId>
|
||||||
<version>\${project.parent.version}</version>
|
<version>\${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 分布式事务
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jeesite</groupId>
|
||||||
|
<artifactId>jeesite-cloud-module-txlcn-client</artifactId>
|
||||||
|
<version>\${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jeesite</groupId>
|
||||||
|
<artifactId>jeesite-cloud-module-seata-client</artifactId>
|
||||||
|
<version>\${project.parent.version}</version>
|
||||||
|
</dependency> -->
|
||||||
|
|
||||||
|
<!-- 核心模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jeesite</groupId>
|
||||||
|
<artifactId>jeesite-cloud-module-core-client</artifactId>
|
||||||
|
<version>\${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jeesite</groupId>
|
||||||
|
<artifactId>jeesite-cloud-module-${module.moduleCode}-client</artifactId>
|
||||||
|
<version>\${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务流程
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jeesite</groupId>
|
||||||
|
<artifactId>jeesite-cloud-module-bpm-client</artifactId>
|
||||||
|
<version>\${project.parent.version}</version>
|
||||||
|
</dependency> -->
|
||||||
|
|
||||||
|
<!-- Spring Boot Tomcat
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency> -->
|
||||||
|
|
||||||
|
<!-- 自定义jar依赖包演示
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jeesite</groupId>
|
||||||
|
<artifactId>test-core</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>\${project.basedir}/src/main/webapp/WEB-INF/lib/test-core-1.0.jar</systemPath>
|
||||||
|
</dependency> -->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>\${finalName}</finalName>
|
||||||
|
<outputDirectory>\${project.basedir}/src/main/webapp/WEB-INF/classes/</outputDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
|
<!-- Spring Boot -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<!-- <plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
</plugin> -->
|
||||||
|
|
||||||
|
<!-- 打包插件, war包名称不带版本号 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<!-- <packagingExcludes></packagingExcludes>
|
||||||
|
<warSourceExcludes></warSourceExcludes> -->
|
||||||
|
<webappDirectory>\${project.build.directory}/\${project.artifactId}</webappDirectory>
|
||||||
|
<warName>\${finalName}</warName>
|
||||||
|
<archive>
|
||||||
|
<addMavenDescriptor>false</addMavenDescriptor>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Eclipse插件 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-eclipse-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<downloadSources>\${eclipse-plugin-download-sources}</downloadSources>
|
||||||
|
<downloadJavadocs>\${eclipse-plugin-download-javadocs}</downloadJavadocs>
|
||||||
|
<wtpContextName>\${finalName}</wtpContextName>
|
||||||
|
<wtpversion>2.0</wtpversion>
|
||||||
|
<jeeversion>6.0</jeeversion>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
@@ -63,6 +187,25 @@
|
|||||||
<name>JeeSite</name>
|
<name>JeeSite</name>
|
||||||
<url>http://jeesite.com</url>
|
<url>http://jeesite.com</url>
|
||||||
</organization>
|
</organization>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>aliyun-repos</id>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
<releases><enabled>true</enabled></releases>
|
||||||
|
<snapshots><enabled>false</enabled></snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jeesite-repos</id>
|
||||||
|
<url>http://maven.jeesite.net/repository/maven-public</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>aliyun-repos</id>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
]]>
|
]]>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<name>logback-spring</name>
|
<name>logback-spring</name>
|
||||||
<filePath>${module.moduleCode}/${module.moduleCode}/src/main/resources/config</filePath>
|
<filePath>${module.moduleCode}/${module.moduleCode}/src/main/resources/config</filePath>
|
||||||
<fileName>logback-spring.yml</fileName>
|
<fileName>logback-spring.xml</fileName>
|
||||||
<content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
<content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration debug="false" scan="false">
|
<configuration debug="false" scan="false">
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user