Commit 0844dd86 authored by Huang's avatar Huang
Browse files

no commit message

parent 962000a6
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>controller</name>
<filePath>src/main/java/${packageName}/${moduleName}/web/${subModuleName}</filePath>
<fileName>${ClassName}Controller.java</fileName>
<content><![CDATA[
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package ${packageName}.${moduleName}.web<#if subModuleName != "">.${subModuleName}</#if>;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.jeespring.common.config.Global;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.common.utils.StringUtils;
import ${packageName}.${moduleName}.entity<#if subModuleName != "">.${subModuleName}</#if>.${ClassName};
import ${packageName}.${moduleName}.service<#if subModuleName != "">.${subModuleName}</#if>.${ClassName}Service;
/**
* ${functionName}Controller
* @author ${functionAuthor}
* @version ${functionVersion}
*/
@Controller
@RequestMapping(value = "${r"${adminPath}"}/${urlPrefix}")
public class ${ClassName}Controller extends AbstractBaseController {
@Autowired
private ${ClassName}Service ${className}Service;
@ModelAttribute
public ${ClassName} get(@RequestParam(required=false) String id) {
${ClassName} entity = null;
if (StringUtils.isNotBlank(id)){
entity = ${className}Service.get(id);
}
if (entity == null){
entity = new ${ClassName}();
}
return entity;
}
/**
* ${functionNameSimple}列表页面
*/
//@RequiresPermissions("${permissionPrefix}:list")
@RequestMapping(value = {"list", ""})
public String list(${ClassName} ${className}, HttpServletRequest request, HttpServletResponse response, Model model) {
List<${ClassName}> list = ${className}Service.findList(${className});
model.addAttribute("list", list);
return "${lastPackageName}/${viewPrefix}List";
}
/**
* 查看,增加,编辑${functionNameSimple}表单页面
*/
//@RequiresPermissions(value={"${permissionPrefix}:view","${permissionPrefix}:add","${permissionPrefix}:edit"},logical=Logical.OR)
@RequestMapping(value = "form")
public String form(${ClassName} ${className}, Model model) {
if (${className}.getParent()!=null && StringUtils.isNotBlank(${className}.getParent().getId())){
${className}.setParent(${className}Service.get(${className}.getParent().getId()));
// 获取排序号,最末节点排序号+30
if (StringUtils.isBlank(${className}.getId())){
${ClassName} ${className}Child = new ${ClassName}();
${className}Child.setParent(new ${ClassName}(${className}.getParent().getId()));
List<${ClassName}> list = ${className}Service.findList(${className});
if (list.size() > 0){
${className}.setSort(list.get(list.size()-1).getSort());
if (${className}.getSort() != null){
${className}.setSort(${className}.getSort() + 30);
}
}
}
}
if (${className}.getSort() == null){
${className}.setSort(30);
}
model.addAttribute("${className}", ${className});
return "${lastPackageName}/${viewPrefix}Form";
}
/**
* 保存${functionNameSimple}
*/
//@RequiresPermissions(value={"${permissionPrefix}:add","${permissionPrefix}:edit"},logical=Logical.OR)
@RequestMapping(value = "save")
public String save(${ClassName} ${className}, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, ${className})){
return form(${className}, model);
}
${className}Service.save(${className});
addMessage(redirectAttributes, "保存${functionNameSimple}成功");
return "redirect:"+Global.getAdminPath()+"/${viewPrefix}/?repage";
}
/**
* 删除${functionNameSimple}
*/
//@RequiresPermissions("${permissionPrefix}:del")
@RequestMapping(value = "delete")
public String delete(${ClassName} ${className}, RedirectAttributes redirectAttributes) {
${className}Service.delete(${className});
addMessage(redirectAttributes, "删除${functionNameSimple}成功");
return "redirect:"+Global.getAdminPath()+"/${viewPrefix}/?repage";
}
//@RequiresPermissions("user")
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId, HttpServletResponse response) {
List<Map<String, Object>> mapList = Lists.newArrayList();
List<${ClassName}> list = ${className}Service.findList(new ${ClassName}());
for (int i=0; i<list.size(); i++){
${ClassName} e = list.get(i);
if (StringUtils.isBlank(extId) || (extId!=null && !extId.equals(e.getId()) && e.getParentIds().indexOf(","+extId+",")==-1)){
Map<String, Object> map = Maps.newHashMap();
map.put("id", e.getId());
map.put("pId", e.getParentId());
map.put("name", e.getName());
mapList.add(map);
}
}
return mapList;
}
}]]>
</content>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>dao</name>
<filePath>src/main/java/${packageName}/${moduleName}/dao/${subModuleName}</filePath>
<fileName>${ClassName}Dao.java</fileName>
<content><![CDATA[
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package ${packageName}.${moduleName}.dao<#if subModuleName != "">.${subModuleName}</#if>;
import com.jeespring.common.persistence.TreeDao;
import com.jeespring.common.persistence.annotation.MyBatisDao;
import org.apache.ibatis.annotations.Mapper;
import ${packageName}.${moduleName}.entity<#if subModuleName != "">.${subModuleName}</#if>.${ClassName};
/**
* ${functionName}DAO接口
* @author ${functionAuthor}
* @version ${functionVersion}
*/
@Mapper
public interface ${ClassName}Dao extends TreeDao<${ClassName}> {
}]]>
</content>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>entity</name>
<filePath>src/main/java/${packageName}/${moduleName}/entity/${subModuleName}</filePath>
<fileName>${ClassName}.java</fileName>
<content><![CDATA[
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package ${packageName}.${moduleName}.entity<#if subModuleName != "">.${subModuleName}</#if>;
<#list table.importList as i>
import ${i};
</#list>
import com.jeespring.common.persistence.TreeEntity;
/**
* ${functionName}Entity
* @author ${functionAuthor}
* @version ${functionVersion}
*/
public class ${ClassName} extends TreeEntity<${ClassName}> {
private static final long serialVersionUID = 1L;
<#-- 生成字段属性 -->
<#list table.columnList as c>
<#-- 如果不是基类属性 -->
<#if c.isNotBaseField>
<#-- 父类对象 -->
<#if table.parentExists && table.parentTableFk == c.name>
private ${table.parent.className?cap_first} ${c.simpleJavaField}; <#if c.comments??>// ${c.comments} 父类</#if>
<#-- 其它字段 -->
<#else>
private ${c.simpleJavaType} ${c.simpleJavaField}; <#if c.comments??>// ${c.comments}</#if>
</#if>
</#if>
</#list>
<#-- 范围条件字段 -->
<#list table.columnList as c>
<#if c.isQuery?? && c.isQuery == "1" && c.queryType == "between">
private ${c.simpleJavaType} begin${c.simpleJavaField?cap_first}; <#if c.comments??>// 开始 ${c.comments}</#if>
private ${c.simpleJavaType} end${c.simpleJavaField?cap_first}; <#if c.comments??>// 结束 ${c.comments}</#if>
</#if>
</#list>
<#-- 子表列表字段 -->
<#list table.childList as c>
private List<${c.className?cap_first}> ${c.className?uncap_first}List = Lists.newArrayList(); // 子表列表
</#list>
<#-- 构造方法 -->
public ${ClassName}() {
super();
}
public ${ClassName}(String id){
super(id);
}
<#list table.columnList as c>
<#if table.parentExists && table.parentTableFk == c.name>
public ${ClassName}(${table.parent.className?cap_first} ${c.simpleJavaField}){
this.${c.simpleJavaField} = ${c.simpleJavaField};
}
</#if>
</#list>
<#-- 生成get和set方法 -->
<#list table.columnList as c>
<#-- 如果不是基类属性 -->
<#if c.isNotBaseField>
<#list c.simpleAnnotationList as a>
@${a}
</#list>
<#-- 父类对象 -->
<#if table.parentExists && table.parentTableFk == c.name>
public ${table.parent.className?cap_first} get${c.simpleJavaField?cap_first}() {
return ${c.simpleJavaField};
}
public void set${c.simpleJavaField?cap_first}(${table.parent.className?cap_first} ${c.simpleJavaField}) {
this.${c.simpleJavaField} = ${c.simpleJavaField};
}
<#-- 其它字段 -->
<#else>
public ${c.simpleJavaType} get${c.simpleJavaField?cap_first}() {
return ${c.simpleJavaField};
}
public void set${c.simpleJavaField?cap_first}(${c.simpleJavaType} ${c.simpleJavaField}) {
this.${c.simpleJavaField} = ${c.simpleJavaField};
}
</#if>
</#if>
</#list>
<#-- 范围条件字段get和set方法 -->
<#list table.columnList as c>
<#if c.isQuery?? && c.isQuery == "1" && c.queryType == "between">
public ${c.simpleJavaType} getBegin${c.simpleJavaField?cap_first}() {
return begin${c.simpleJavaField?cap_first};
}
public void setBegin${c.simpleJavaField?cap_first}(${c.simpleJavaType} begin${c.simpleJavaField?cap_first}) {
this.begin${c.simpleJavaField?cap_first} = begin${c.simpleJavaField?cap_first};
}
public ${c.simpleJavaType} getEnd${c.simpleJavaField?cap_first}() {
return end${c.simpleJavaField?cap_first};
}
public void setEnd${c.simpleJavaField?cap_first}(${c.simpleJavaType} end${c.simpleJavaField?cap_first}) {
this.end${c.simpleJavaField?cap_first} = end${c.simpleJavaField?cap_first};
}
</#if>
</#list>
<#-- 子表列表get和set方法 -->
<#list table.childList as c>
public List<${c.className?cap_first}> get${c.className?cap_first}List() {
return ${c.className?uncap_first}List;
}
public void set${c.className?cap_first}List(List<${c.className?cap_first}> ${c.className?uncap_first}List) {
this.${c.className?uncap_first}List = ${c.className?uncap_first}List;
}
</#list>
<#-- JSON忽略了parent对象,添加此方法获取父类Id -->
<#list table.columnList as c>
<#if c.javaFieldId == 'parent.id'>
public String getParentId() {
return parent != null && parent.getId() != null ? parent.getId() : "0";
}
</#if>
</#list>
}]]>
</content>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>mapper</name>
<filePath>src/main/resources/mappings/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<fileName>${ClassName}Dao.xml</fileName>
<content><![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${packageName}.${moduleName}.dao<#if subModuleName != "">.${subModuleName}</#if>.${ClassName}Dao">
<#-- 输出字段列 -->
<sql id="${className}Columns">
<#assign columnField>
<#list table.columnList as c>
a.${c.name} AS "${c.javaFieldId}",
</#list>
<#list table.columnList as c>
<#if c.showType?? && c.showType == "userselect">
<#list c.javaFieldAttrs as a>
u${c_index + 1}.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
</#list>
<#elseif c.showType?? && c.showType == "officeselect">
<#list c.javaFieldAttrs as a>
o${c_index + 1}.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
</#list>
<#elseif c.showType?? && c.showType == "areaselect">
<#list c.javaFieldAttrs as a>
a${c_index + 1}.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
</#list>
</#if>
<#-- 父表关联字段 -->
<#if table.parentExists && table.parentTableFk == c.name>
<#list c.javaFieldAttrs as a>
b.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
</#list>
</#if>
</#list>
</#assign>
${columnField?substring(0, columnField?last_index_of(","))}
</sql>
<#-- 输出字段关联表 -->
<sql id="${className}Joins">
<#-- 关联父表 -->
<#if table.parentExists>
LEFT JOIN ${table.parent.name} b ON b.id = a.${table.parentTableFk}
</#if>
<#-- 关联系统表 -->
<#list table.columnList as c>
<#if c.showType?? && c.showType == "userselect">
LEFT JOIN sys_user u${c_index + 1} ON u${c_index + 1}.id = a.${c.name}
<#elseif c.showType?? && c.showType == "officeselect">
LEFT JOIN sys_office o${c_index + 1} ON o${c_index + 1}.id = a.${c.name}
<#elseif c.showType?? && c.showType == "areaselect">
LEFT JOIN sys_area a${c_index + 1} ON a${c_index + 1}.id = a.${c.name}
</#if>
</#list>
</sql>
<select id="get" resultType="${ClassName}">
SELECT
<include refid="${className}Columns"/>
FROM ${table.name} a
<include refid="${className}Joins"/>
WHERE a.id = ${"#"}{id}
</select>
<select id="findList" resultType="${ClassName}">
SELECT
<include refid="${className}Columns"/>
FROM ${table.name} a
<include refid="${className}Joins"/>
<where>
<#if table.delFlagExists>a.del_flag = ${"#"}{DEL_FLAG_NORMAL}</#if>
<#list table.columnList as c>
<#if (c.isQuery?? && c.isQuery == "1") || (table.parentExists && table.parentTableFk == c.name) || c.javaFieldId == 'parent.id' || c.javaFieldId == 'parentIds'>
<#if c.queryType ?? && c.queryType == 'between'>
<if test="begin${c.simpleJavaField?cap_first} != null and end${c.simpleJavaField?cap_first} != null <#if c.simpleJavaField != c.javaFieldId>and begin${c.javaFieldId?cap_first} != null and end${c.javaFieldId?cap_first} != null </#if>and begin${c.javaFieldId?cap_first} != '' and end${c.javaFieldId?cap_first} != ''">
<#else>
<if test="${c.simpleJavaField} != null<#if c.simpleJavaField != c.javaFieldId> and ${c.javaFieldId} != null</#if> and ${c.javaFieldId} != ''">
</#if>
<#if c.queryType ?? && c.queryType == 'between'>
AND a.${c.name} BETWEEN ${"#"}{begin${c.simpleJavaField?cap_first}} AND ${"#"}{end${c.simpleJavaField?cap_first}}
<#elseif c.queryType ?? && c.queryType == 'like'>
AND a.${c.name} LIKE
<if test="dbName == 'oracle'">'%'||${"#"}{${c.javaFieldId}}||'%'</if>
<if test="dbName == 'mssql'">'%'+${"#"}{${c.javaFieldId}}+'%'</if>
<if test="dbName == 'mysql'">concat('%',${"#"}{${c.javaFieldId}},'%')</if>
<#elseif c.queryType ?? && c.queryType == 'left_like'>
AND a.${c.name} LIKE
<if test="dbName == 'oracle'">'%'||${"#"}{${c.javaFieldId}}</if>
<if test="dbName == 'mssql'">'%'+${"#"}{${c.javaFieldId}}</if>
<if test="dbName == 'mysql'">concat('%',${"#"}{${c.javaFieldId}})</if>
<#elseif c.queryType ?? && c.queryType == 'right_like'>
AND a.${c.name} LIKE
<if test="dbName == 'oracle'">${"#"}{${c.javaFieldId}}||'%'</if>
<if test="dbName == 'mssql'">${"#"}{${c.javaFieldId}}+'%'</if>
<if test="dbName == 'mysql'">concat(${"#"}{${c.javaFieldId}},'%')</if>
<#else>
AND a.${c.name} ${c.queryType} ${"#"}{${c.javaFieldId}}
</#if>
</if>
</#if>
</#list>
</where>
<#list table.columnList as c>
<#if c.name == 'sort'>
ORDER BY a.sort ASC
</#if>
</#list>
</select>
<select id="findAllList" resultType="${ClassName}">
SELECT
<include refid="${className}Columns"/>
FROM ${table.name} a
<include refid="${className}Joins"/>
<where>
<#if table.delFlagExists>a.del_flag = ${"#"}{DEL_FLAG_NORMAL}</#if>
</where>
<#list table.columnList as c>
<#if c.name == 'sort'>
ORDER BY a.sort ASC
</#if>
</#list>
</select>
<select id="findByParentIdsLike" resultType="${ClassName}">
SELECT
a.id,
a.parent_id AS "parent.id",
a.parent_ids
FROM ${table.name} a
<include refid="${className}Joins"/>
<where>
<#if table.delFlagExists>a.del_flag = ${"#"}{DEL_FLAG_NORMAL}</#if>
AND a.parent_ids LIKE ${"#"}{parentIds}
</where>
<#list table.columnList as c>
<#if c.name == 'sort'>
ORDER BY a.sort ASC
</#if>
</#list>
</select>
<insert id="insert">
INSERT INTO ${table.name}(
<#assign insertField>
<#list table.columnList as c>
<#if c.isInsert?? && c.isInsert == "1">
${c.name},
</#if>
</#list>
</#assign>
${insertField?substring(0, insertField?last_index_of(","))}
) VALUES (
<#assign insertJavaField>
<#list table.columnList as c>
<#if c.isInsert?? && c.isInsert == "1">
${"#"}{${c.javaFieldId}},
</#if>
</#list>
</#assign>
${insertJavaField?substring(0, insertJavaField?last_index_of(","))}
)
</insert>
<update id="update">
UPDATE ${table.name} SET
<#assign updateField>
<#list table.columnList as c>
<#if c.isEdit?? && c.isEdit == "1">
${c.name} = ${"#"}{${c.javaFieldId}},
</#if>
</#list>
</#assign>
${updateField?substring(0, updateField?last_index_of(","))}
WHERE id = ${"#"}{id}
</update>
<update id="updateParentIds">
UPDATE ${table.name} SET
parent_id = ${"#"}{parent.id},
parent_ids = ${"#"}{parentIds}
WHERE id = ${"#"}{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM ${table.name}
<#if table.parentExists>
<#list table.columnList as c>
<#if table.parentTableFk == c.name>
<choose>
<when test="id !=null and id != ''">
WHERE id = ${"#"}{id}
</when>
<otherwise>
WHERE ${table.parentTableFk} = ${"#"}{${c.javaFieldId}}
</otherwise>
</choose>
</#if>
</#list>
<#else>
WHERE id = ${"#"}{id} OR parent_ids LIKE
<if test="dbName == 'oracle'">'%'||${"#"}{id}||'%'</if>
<if test="dbName == 'mssql'">'%'+${"#"}{id}+'%'</if>
<if test="dbName == 'mysql'">concat('%',${"#"}{id},'%')</if>
</#if>
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE ${table.name} SET
del_flag = ${"#"}{DEL_FLAG_DELETE}
<#if table.parentExists>
<#list table.columnList as c>
<#if table.parentTableFk == c.name>
<choose>
<when test="id !=null and id != ''">
WHERE id = ${"#"}{id}
</when>
<otherwise>
WHERE ${table.parentTableFk} = ${"#"}{${c.javaFieldId}}
</otherwise>
</choose>
</#if>
</#list>
<#else>
WHERE id = ${"#"}{id} OR parent_ids LIKE
<if test="dbName == 'oracle'">'%'||${"#"}{id}||'%'</if>
<if test="dbName == 'mssql'">'%'+${"#"}{id}+'%'</if>
<if test="dbName == 'mysql'">concat('%',${"#"}{id},'%')</if>
</#if>
</update>
</mapper>]]>
</content>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>service</name>
<filePath>src/main/java/${packageName}/${moduleName}/service/${subModuleName}</filePath>
<fileName>${ClassName}Service.java</fileName>
<content><![CDATA[
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package ${packageName}.${moduleName}.service<#if subModuleName != "">.${subModuleName}</#if>;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeespring.common.service.TreeService;
import com.jeespring.common.utils.StringUtils;
import ${packageName}.${moduleName}.entity<#if subModuleName != "">.${subModuleName}</#if>.${ClassName};
import ${packageName}.${moduleName}.dao<#if subModuleName != "">.${subModuleName}</#if>.${ClassName}Dao;
/**
* ${functionName}Service
* @author ${functionAuthor}
* @version ${functionVersion}
*/
@Service
@Transactional(readOnly = true)
public class ${ClassName}Service extends TreeService<${ClassName}Dao, ${ClassName}> {
public ${ClassName} get(String id) {
return super.get(id);
}
public List<${ClassName}> findList(${ClassName} ${className}) {
if (StringUtils.isNotBlank(${className}.getParentIds())){
${className}.setParentIds(","+${className}.getParentIds()+",");
}
return super.findList(${className});
}
@Transactional(readOnly = false)
public void save(${ClassName} ${className}) {
super.save(${className});
}
@Transactional(readOnly = false)
public void delete(${ClassName} ${className}) {
super.delete(${className});
}
}]]>
</content>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>viewForm</name>
<filePath>src/main/webapp/WEB-INF/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<fileName>${className}Form.jsp</fileName>
<content><![CDATA[
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>${functionNameSimple}管理</title>
<%@ include file="/WEB-INF/views/include/headMeta.jsp" %>
<%@ include file="/WEB-INF/views/include/headCss.jsp" %>
<%@ include file="/WEB-INF/views/include/headJs.jsp" %>
</head>
<body>
<!-- 内容-->
<div class="wrapper">
<!-- 内容盒子-->
<div class="box box-main">
<!-- 内容盒子头部 -->
<div class="box-header">
<div class="box-title"><i class="fa fa-edit"></i>
数据字典管理
</div>
</div>
<!-- 内容盒子身体 -->
<div class="box-body">
<form:form id="inputForm" modelAttribute="${className}" action="${r"${ctx}"}/${urlPrefix}/save" method="post" class="form-horizontal content-background">
<div class="content">
<form:hidden path="id"/>
<div class="form-unit">基本信息</div>
<div class="row">
<#list table.columnList as c>
<#if c.simpleJavaField == 'parent'>
<div class="col-xs-6 form-group">
<label class="control-label col-sm-4 pull-left">上级${c.comments}:</label>
<div class="col-sm-8">
<sys:treeselect id="${c.simpleJavaField}" name="${c.javaFieldId}" value="${"$"}{${className}.${c.javaFieldId}}" labelName="${c.javaFieldName}" labelValue="${"$"}{${className}.${c.javaFieldName}}"
title="${c.comments}" url="/${urlPrefix}/treeData" extId="${'$'}{${className}.id}" cssClass="form-control " allowClear="true"/>
</div>
</div>
<#elseif c.isEdit?? && c.isEdit == "1" && (c.isNotBaseField || c.simpleJavaField == 'remarks') && c.javaFieldId != 'parentIds'>
<div class="col-xs-6 form-group">
<label class="control-label col-sm-4 pull-left"><#if c.isNull != "1"><font color="red">*</font></#if>${c.comments}:</label>
<div class="col-sm-8">
<#if c.showType == "input">
<form:input path="${c.javaFieldId}" htmlEscape="false"<#if c.dataLength != "0"> maxlength="${c.dataLength}"</#if> class="form-control <#if c.isNull != "1">required</#if><#if c.javaType == "Long" || c.javaType == "Integer"> digits</#if><#if c.javaType == "Double"> number</#if>"/>
<#elseif c.showType == "textarea">
<form:textarea path="${c.javaFieldId}" htmlEscape="false" rows="4"<#if c.dataLength != "0"> maxlength="${c.dataLength}"</#if> class="form-control <#if c.isNull != "1">required</#if>"/>
<#elseif c.showType == "select">
<form:select path="${c.javaFieldId}" class="form-control <#if c.isNull != "1">required</#if>">
<form:option value="" label=""/>
<form:options items="${"$"}{fns:getDictList('${c.dictType}')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select>
<#elseif c.showType == "checkbox">
<form:checkboxes path="${c.javaFieldId}" items="${"$"}{fns:getDictList('${c.dictType}')}" itemLabel="label" itemValue="value" htmlEscape="false" class="form-control <#if c.isNull != "1">required</#if>"/>
<#elseif c.showType == "radiobox">
<form:radiobuttons path="${c.javaFieldId}" items="${"$"}{fns:getDictList('${c.dictType}')}" itemLabel="label" itemValue="value" htmlEscape="false" class="form-control <#if c.isNull != "1">required</#if>"/>
<#elseif c.showType == "dateselect">
<input name="${c.javaFieldId}" type="text" readonly="readonly" maxlength="20" class="laydate-icon form-control layer-date <#if c.isNull != "1">required</#if>"
value="<fmt:formatDate value="${"$"}{${className}.${c.javaFieldId}}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<#elseif c.showType == "userselect">
<sys:treeselect id="${c.simpleJavaField}" name="${c.javaFieldId}" value="${"$"}{${className}.${c.javaFieldId}}" labelName="${c.javaFieldName}" labelValue="${"$"}{${className}.${c.javaFieldName}}"
title="用户" url="/sys/office/treeData?type=3" cssClass="form-control <#if c.isNull != "1">required</#if>" allowClear="true" notAllowSelectParent="true"/>
<#elseif c.showType == "officeselect">
<sys:treeselect id="${c.simpleJavaField}" name="${c.javaFieldId}" value="${"$"}{${className}.${c.javaFieldId}}" labelName="${c.javaFieldName}" labelValue="${"$"}{${className}.${c.javaFieldName}}"
title="部门" url="/sys/office/treeData?type=2" cssClass="form-control <#if c.isNull != "1">required</#if>" allowClear="true" notAllowSelectParent="true"/>
<#elseif c.showType == "areaselect">
<sys:treeselect id="${c.simpleJavaField}" name="${c.javaFieldId}" value="${"$"}{${className}.${c.javaFieldId}}" labelName="${c.javaFieldName}" labelValue="${"$"}{${className}.${c.javaFieldName}}"
title="区域" url="/sys/area/treeData" cssClass="form-control <#if c.isNull != "1">required</#if>" allowClear="true" notAllowSelectParent="true"/>
<#elseif c.showType == "fileselect">
<form:hidden id="${c.simpleJavaField}" path="${c.javaFieldId}" htmlEscape="false"<#if c.dataLength != "0"> maxlength="${c.dataLength}"</#if> class="form-control"/>
<sys:ckfinder input="${c.simpleJavaField}" type="files" uploadPath="/${moduleName}<#if subModuleName != "">/${subModuleName}</#if>/${className}" selectMultiple="true"/>
</#if>
</div>
</div>
</#if>
</#list>
</div>
<div id="iframeSave" class="form-group">
<c:if test="${"$"}{action ne 'view'}">
<a id="btnSubmit" class="btn btn-primary">保存</a>
</c:if>
<a id="btnBack" class="btn btn-default">返回</a>
</div>
</div>
</form:form>
</div>
</div>
</div>
<div id="messageBox">${r"${message}"}</div>
<%@ include file="/WEB-INF/views/include/footJs.jsp" %>
<script src="/staticViews/viewBase.js"></script>
<script type="text/javascript">
$(document).ready(function() {
<#list table.columnList as c>
<#if c.isEdit?? && c.isEdit == "1" && (c.isNotBaseField || c.simpleJavaField == 'remarks')>
<#if c.showType == "dateselect">
laydate({
elem: '#${c.javaFieldId}', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
event: 'focus' //响应事件。如果没有传入event,则按照默认的click
});
</#if>
</#if>
</#list>
});
</script>
</body>
</html>]]>
</content>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>viewList</name>
<filePath>src/main/webapp/WEB-INF/views/${lastPackageName}/${moduleName}/${subModuleName}</filePath>
<fileName>${className}List.jsp</fileName>
<content><![CDATA[
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>${functionNameSimple}管理</title>
<%@ include file="/WEB-INF/views/include/headMeta.jsp" %>
<%@ include file="/WEB-INF/views/include/headCss.jsp" %>
<%@ include file="/WEB-INF/views/include/headJs.jsp" %>
<%@include file="/WEB-INF/views/include/treetable.jsp" %>
</head>
<body>
<!-- 内容-->
<div class="wrapper">
<!-- 内容盒子-->
<div class="box box-main">
<!-- 内容盒子头部 -->
<div class="box-header">
<div class="box-title"><i class="fa fa-edit"></i>${functionNameSimple}管理</div>
<div class="box-tools pull-right">
<a id="btnSearchView" href="#" class="btn btn-sm btn-default" title="筛选"><i
class="fa fa-filter"></i>筛选</a>
<shiro:hasPermission name="${permissionPrefix}:add">
<a id="btnAdd" href="${r"${ctx}"}/${urlPrefix}/form" class="btn btn-default btn-sm" title="新增"><i
class="fa fa-plus"></i>新增</a>
</shiro:hasPermission>
<button data-placement="left" onclick="refresh()"
class="btn btn-default btn-sm" title="刷新"><i class="glyphicon glyphicon-repeat"></i>刷新
</button>
<!-- 工具功能 -->
<%@ include file="/WEB-INF/views/include/btnGroup.jsp" %>
</div>
</div>
<!-- 内容盒子身体 -->
<div class="box-body">
<!--查询条件-->
<form:form id="searchForm" modelAttribute="${className}" action="${r"${ctx}"}/${urlPrefix}/" method="post" class="form-inline">
<#list table.columnList as c>
<#if c.isQuery?? && c.isQuery == "1">
<div class="form-group">
<label>${c.comments}:</label>
<#if c.showType == "input" || c.showType == "textarea">
<form:input path="${c.javaFieldId}" htmlEscape="false"<#if c.dataLength != "0"> maxlength="${c.dataLength}"</#if> class="form-control input-sm"/>
<#elseif c.showType == "select">
<form:select path="${c.javaFieldId}" class="form-control m-b">
<form:option value="" label=""/>
<form:options items="${"$"}{fns:getDictList('${c.dictType}')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select>
<#elseif c.showType == "checkbox">
<form:checkboxes class="i-checks" path="${c.javaFieldId}" items="${"$"}{fns:getDictList('${c.dictType}')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
<#elseif c.showType == "radiobox">
<form:radiobuttons class="i-checks" path="${c.javaFieldId}" items="${"$"}{fns:getDictList('${c.dictType}')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
<#elseif c.showType == "dateselect" && c.queryType == "between">
<input id="begin${c.simpleJavaField?cap_first}" name="begin${c.simpleJavaField?cap_first}" type="text" maxlength="20" class="laydate-icon form-control layer-date input-sm"
value="<fmt:formatDate value="${"$"}{${className}.begin${c.simpleJavaField?cap_first}}" pattern="yyyy-MM-dd HH:mm:ss"/>"/> -
<input id="end${c.simpleJavaField?cap_first}" name="end${c.simpleJavaField?cap_first}" type="text" maxlength="20" class="laydate-icon form-control layer-date input-sm"
value="<fmt:formatDate value="${"$"}{${className}.end${c.simpleJavaField?cap_first}}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<#elseif c.showType == "dateselect">
<input id="${c.javaFieldId}" name="${c.javaFieldId}" type="text" maxlength="20" class="laydate-icon form-control layer-date input-sm"
value="<fmt:formatDate value="${"$"}{${className}.${c.javaFieldId}}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<#elseif c.showType == "userselect">
<sys:treeselect id="${c.simpleJavaField}" name="${c.javaFieldId}" value="${"$"}{${className}.${c.javaFieldId}}" labelName="${c.javaFieldName}" labelValue="${"$"}{${className}.${c.javaFieldName}}"
title="用户" url="/sys/office/treeData?type=3" cssClass="form-control input-sm" allowClear="true" notAllowSelectParent="true"/>
<#elseif c.showType == "officeselect">
<sys:treeselect id="${c.simpleJavaField}" name="${c.javaFieldId}" value="${"$"}{${className}.${c.javaFieldId}}" labelName="${c.javaFieldName}" labelValue="${"$"}{${className}.${c.javaFieldName}}"
title="部门" url="/sys/office/treeData?type=2" cssClass="form-control input-sm" allowClear="true" notAllowSelectParent="true"/>
<#elseif c.showType == "areaselect">
<sys:treeselect id="${c.simpleJavaField}" name="${c.javaFieldId}" value="${"$"}{${className}.${c.javaFieldId}}" labelName="${c.javaFieldName}" labelValue="${"$"}{${className}.${c.javaFieldName}}"
title="区域" url="/sys/area/treeData" cssClass="form-control input-sm" allowClear="true" notAllowSelectParent="true"/>
</#if>
</div>
</#if>
</#list>
<div class="form-group">
<button id="btnSearch" class="btn btn-primary"><i class="fa fa-search"></i> 查询</button>
<button id="btnReset" class="btn btn-default"><i class="fa fa-refresh"></i> 重置</button>
</div>
</form:form>
<table id="treeTable" class="table table-hover table-condensed dataTables-example dataTable">
<thead>
<tr>
<#list table.columnList as c>
<#if c.isList?? && c.isList == "1">
<th>${c.comments}</th>
</#if>
</#list>
<shiro:hasPermission name="${permissionPrefix}:edit"><th>操作</th></shiro:hasPermission>
</tr>
</thead>
<tbody id="treeTableList"></tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
var tpl = $("#treeTableTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data = ${"$"}{fns:toJson(list)}, ids = [], rootIds = [];
for (var i=0; i<data.length; i++){
ids.push(data[i].id);
}
ids = ',' + ids.join(',') + ',';
for (var i=0; i<data.length; i++){
if (ids.indexOf(','+data[i].parentId+',') == -1){
if ((','+rootIds.join(',')+',').indexOf(','+data[i].parentId+',') == -1){
rootIds.push(data[i].parentId);
}
}
}
for (var i=0; i<rootIds.length; i++){
addRow("#treeTableList", tpl, data, rootIds[i], true);
}
$("#treeTable").treeTable({expandLevel : 5});
});
function addRow(list, tpl, data, pid, root){
for (var i=0; i<data.length; i++){
var row = data[i];
if ((${"$"}{fns:jsGetVal('row.parentId')}) == pid){
$(list).append(Mustache.render(tpl, {
dict: {
<#list table.columnList as c>
<#if c.isList?? && c.isList == "1" && (c.showType == "select" || c.showType == "checkbox" || c.showType == "radiobox")>
${c.simpleJavaField}: getDictLabel(${"$"}{fns:toJson(fns:getDictList('${c.dictType}'))}, row.${c.simpleJavaField}),
</#if>
</#list>
blank123:0}, pid: (root?0:pid), row: row
}));
addRow(list, tpl, data, row.id);
}
}
}
function refresh(){//刷新
window.location="${r"${ctx}"}/${urlPrefix}/";
}
</script>
<script type="text/template" id="treeTableTpl">
<tr id="{{row.id}}" pId="{{pid}}">
<#assign firstListField = true>
<#list table.columnList as c>
<#if c.isList?? && c.isList == "1">
<td><#if firstListField><a href="#" onclick="openDialogView('查看${functionNameSimple}', '${r"${ctx}"}/${urlPrefix}/form?id={{row.id}}','800px', '500px')"></#if>
<#if c.showType == "select" || c.showType == "checkbox" || c.showType == "radiobox">
{{dict.${c.simpleJavaField}}}
<#elseif c.showType == "userselect" || c.showType == "officeselect" || c.showType == "areaselect">
{{row.${c.javaFieldName}}}
<#else>
{{row.${c.javaFieldId}}}
</#if>
<#if firstListField></a></#if></td>
<#assign firstListField = false>
</#if>
</#list>
<td>
<shiro:hasPermission name="${permissionPrefix}:view">
<a href="${r"${ctx}"}/${urlPrefix}/form?id={{row.id}}" title="查看"><i class="fa fa-search-plus"></i></a>
</shiro:hasPermission>
<shiro:hasPermission name="${permissionPrefix}:edit">
<a href="${r"${ctx}"}/${urlPrefix}/form?id={{row.id}}" title="修改"><i class="fa fa-pencil"></i></a>
</shiro:hasPermission>
<shiro:hasPermission name="${permissionPrefix}:del">
<a href="${r"${ctx}"}/${urlPrefix}/delete?id={{row.id}}" onclick="return confirmx('确认要删除该${functionNameSimple}及所有子${functionNameSimple}吗?', this.href)" title="删除"><i class="fa fa-trash-o"></i></a>
</shiro:hasPermission>
<shiro:hasPermission name="${permissionPrefix}:add">
<a href="${r"${ctx}"}/${urlPrefix}/form?parent.id={{row.id}}"><i class="fa fa-plus"></i> 添加下级${functionNameSimple}</a>
</shiro:hasPermission>
</td>
</tr>
</script>
<!-- 信息-->
<div id="messageBox">${r"${message}"}</div>
<%@ include file="/WEB-INF/views/include/footJs.jsp" %>
<script src="/staticViews/viewBase.js"></script>
</body>
</html>]]>
</content>
</template>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment