diff --git a/modules/core/src/main/resources/templates/modules/gen/config.xml b/modules/core/src/main/resources/templates/modules/gen/config.xml
index 1fd2789b..47ed8517 100644
--- a/modules/core/src/main/resources/templates/modules/gen/config.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/config.xml
@@ -11,6 +11,7 @@
crud/controller.xml
crud/viewList.xml
crud/viewForm.xml
+ crud/viewIndex.xml
category-ref:dao
@@ -32,6 +33,7 @@
crud_cloud/controller.xml
crud_cloud/viewList.xml
crud_cloud/viewForm.xml
+ crud_cloud/viewIndex.xml
crud_cloud/mapper.xml
crud_cloud/entity.xml
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml b/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml
index b8b2685a..302ee4af 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml
@@ -9,9 +9,10 @@
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
<% if (table.isTreeEntity){ %>
-import java.util.List;
import java.util.Map;
-<% }else{ %>
+<% } %>
+<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
+import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<% } %>
@@ -27,8 +28,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jeesite.common.config.Global;
-<% if(table.isTreeEntity){ %>
+<% if(table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import com.jeesite.common.collect.ListUtils;
+<% } %>
+<% if(table.isTreeEntity){ %>
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.idgen.IdGen;
@@ -36,6 +39,12 @@ import com.jeesite.modules.sys.utils.UserUtils;
<% }else{ %>
import com.jeesite.common.entity.Page;
<% } %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+import com.jeesite.common.lang.DateUtils;
+import com.jeesite.common.utils.excel.ExcelExport;
+import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
+import org.springframework.web.multipart.MultipartFile;
+<% } %>
<% if (table.tplCategory == 'crud_select'){ %>
import com.alibaba.fastjson.JSONValidator;
import com.jeesite.common.codec.EncodeUtils;
@@ -75,6 +84,18 @@ public class ${ClassName}Controller extends BaseController {
return ${className}Service.getAndValid(${className});
<% } %>
}
+ <% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableUrl'])){ %>
+
+ /**
+ * 管理主页
+ */
+ @RequiresPermissions("${permissionPrefix}:view")
+ @RequestMapping(value = "index")
+ public String index(${ClassName} ${className}, Model model) {
+ model.addAttribute("${className}", ${className});
+ return "${lastPackageName}/${viewPrefix}Index";
+ }
+ <% } %>
/**
* 查询列表
@@ -192,6 +213,50 @@ public class ${ClassName}Controller extends BaseController {
${className}Service.save(${className});
return renderResult(Global.TRUE, text("保存${functionNameSimple}成功!"));
}
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+
+ /**
+ * 导出数据
+ */
+ @RequiresPermissions("${permissionPrefix}:view")
+ @RequestMapping(value = "exportData")
+ public void exportData(${ClassName} ${className}, HttpServletResponse response) {
+ List<${ClassName}> list = ${className}Service.findList(${className});
+ String fileName = "${functionNameSimple}" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
+ try(ExcelExport ee = new ExcelExport("${functionNameSimple}", ${ClassName}.class)){
+ ee.setDataList(list).write(response, fileName);
+ }
+ }
+
+ /**
+ * 下载模板
+ */
+ @RequiresPermissions("${permissionPrefix}:view")
+ @RequestMapping(value = "importTemplate")
+ public void importTemplate(HttpServletResponse response) {
+ ${ClassName} ${className} = new ${ClassName}();
+ List<${ClassName}> list = ListUtils.newArrayList(${className});
+ String fileName = "${functionNameSimple}模板.xlsx";
+ try(ExcelExport ee = new ExcelExport("${functionNameSimple}", ${ClassName}.class, Type.IMPORT)){
+ ee.setDataList(list).write(response, fileName);
+ }
+ }
+
+ /**
+ * 导入数据
+ */
+ @ResponseBody
+ @RequiresPermissions("${permissionPrefix}:edit")
+ @PostMapping(value = "importData")
+ public String importData(MultipartFile file) {
+ try {
+ String message = ${className}Service.importData(file);
+ return renderResult(Global.TRUE, "posfull:"+message);
+ } catch (Exception ex) {
+ return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
+ }
+ }
+ <% } %>
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
/**
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml b/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml
index 97a6a990..7b80ca95 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml
@@ -1,359 +1,375 @@
-
-
-
- entity
- src/main/java/${packageName}/${moduleName}/entity/${subModuleName}
- ${ClassName}.java
- 0){ %>
-import javax.validation.Valid;
-<% } %>
-<% for(i in table.importList){ %>
-import ${i};
-<% } %>
-
-import com.jeesite.common.entity.DataEntity;
-<% if(table.isTreeEntity){ %>
-import com.jeesite.common.entity.TreeEntity;
-<% } %>
-import com.jeesite.common.mybatis.annotation.Column;
-import com.jeesite.common.mybatis.annotation.Table;
-import com.jeesite.common.mybatis.mapper.query.QueryType;
-<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
- <% if(table.isTreeEntity){ %>
-import com.jeesite.modules.bpm.entity.BpmTreeEntity;
- <% }else{ %>
-import com.jeesite.modules.bpm.entity.BpmEntity;
- <% } %>
-<% } %>
-
-/**
- * ${functionName}Entity
- * @author ${functionAuthor}
- * @version ${functionVersion}
- */
-@Table(name="${table.genTableName}", alias="a", label="${functionNameSimple}信息", columns={
- <%
- var isBase = false, isData = false,
- isTree = false, isExtend = false;
- // ◆ 生成字段属性
- for(c in table.columnList){
- // ● 如果是BaseEntity类属性
- if(table.isBaseEntity && c.isBaseEntityColumn){
- if(!isBase){
- isBase = true;
- %>
- @Column(includeEntity=BaseEntity.class),
- <%
- }
- // ● 如果是DataEntity类属性
- }else if(table.isDataEntity && c.isDataEntityColumn){
- if(!isData){
- isData = true;
- %>
- @Column(includeEntity=DataEntity.class),
- <%
- }
- // ● 如果是TreeEntity类属性
- }else if(table.isTreeEntity && c.isTreeEntityColumn){
- if(!isTree){
- isTree = true;
- %>
- @Column(includeEntity=TreeEntity.class),
- <%
- }
- // ● 如果是Extend类属性
- }else if(table.isExtendEntity && c.isExtendColumn){
- if(!isExtend){
- isExtend = true;
- %>
- @Column(includeEntity=Extend.class, attrName="extend"),
- <%
- }
- // ● 其它情况下
- }else{
- // 容错,如果没有设置父表的主键属性,则设置
- if(!@StringUtils.contains(c.attrName, ".")){
- if (table.parentExists && table.parentTableFkName == c.columnName){
- for (pk in table.parent.pkList){
- c.fullAttrName = c.fullAttrName + '.' + pk.attrName;
- break;
- }
- }
- }
- %>
- @Column(name="${c.columnName}", attrName="${c.attrName}", label="${c.columnLabel}"<%
- if (c.comments != c.columnLabel){
- print(', comment="'+c.comments+'"');
- }
- if (c.isPk == @Global.YES){
- print(', isPK=true');
- }else{
- if (c.isInsert != @Global.YES){
- print(', isInsert=false');
- }
- if (c.isUpdate != @Global.YES){
- print(', isUpdate=false');
- }
- if (c.isQuery == @Global.YES && @StringUtils.inString(c.queryType,
- 'NE', 'GT', 'GTE', 'LT', 'LTE', 'LIKE', 'LEFT_LIKE', 'RIGHT_LIKE')){
- print(', queryType=QueryType.'+c.queryType);
- }
- if (c.isQuery != @Global.YES){
- print(', isQuery=false');
- }
- if (c.attrName == table.treeViewNameAttrName){
- print(', isTreeName=true');
- }
- if (c.isNull == @Global.YES && @StringUtils.inString(c.simpleAttrType,
- 'Long', 'Integer', 'Double', 'BigDecimal', 'Date')){
- print(', isUpdateForce=true');
- }
- }
- %>),
- <%
- }
- }
- %>
- }, <%
- // ◆ 生成关联表
- var joinTables = '';
- for(c in table.columnList){
- if (c.attrType == 'com.jeesite.modules.sys.entity.User'){
- var joinTable = {
- %>
- @JoinTable(type=Type.LEFT_JOIN, entity=User.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
- on="u${cLP.index}.user_code = a.${c.columnName}", columns={
- @Column(name="user_code", label="用户编码", isPK=true),
- @Column(name="user_name", label="用户名称", isQuery=false),
- }),
- <%
- };
- joinTables = joinTables + joinTable;
- }
- else if (c.attrType == 'com.jeesite.modules.sys.entity.Office'){
- var joinTable = {
- %>
- @JoinTable(type=Type.LEFT_JOIN, entity=Office.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
- on="u${cLP.index}.office_code = a.${c.columnName}", columns={
- @Column(name="office_code", label="机构编码", isPK=true),
- @Column(name="office_name", label="机构名称", isQuery=false),
- }),
- <%
- };
- joinTables = joinTables + joinTable;
- }
- }
- if (isNotBlank(joinTables)){
- print('joinTable={');
- print(joinTables);
- print('}, ');
- }
- // ◆ 生成排序字段
- %>orderBy="<% if (isTree){
- %>a.tree_sorts<%
- for(pk in table.pkList){
- %>, a.${pk.columnName}<%
- }
- }else if(table.parentExists && table.createDateExists){
- %>a.create_date ASC<%
- }else if(table.updateDateExists){
- %>a.update_date DESC<%
- }else{
- for(pk in table.pkList){
- %>${pkLP.index!=1?', ':''}a.${pk.columnName} ${table.parentExists?'ASC':'DESC'}<%
- }
- } %>"
-)
-public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(table.isTreeEntity?'BpmTree':'Bpm'):table.isTreeEntity?'Tree':'Data'}Entity<${ClassName}> {
-
- private static final long serialVersionUID = 1L;
- <%
- isExtend = false;
- // 生成字段属性
- for(c in table.columnList){
- // 如果是Extend类属性
- if(table.isExtendEntity && c.isExtendColumn){
- if(!isExtend){
- isExtend = true;
- %>
- private Extend extend; // 扩展字段
- <%
- }
- }
- // 如果不是基类属性
- else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
- // 父类对象
- if(table.parentExists && table.parentTableFkName == c.columnName){
- %>
- private ${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}; <% if (isNotBlank(c.comments)){ %>// ${c.comments} 父类<% } %>
- <%
- // 其它字段
- }else{
- %>
- private ${c.simpleAttrType} ${c.simpleAttrName}; <%if(isNotBlank(c.comments)){%>// ${c.comments}<%}%>
- <%
- }
- }
- }
-
- // 生成子表列表字段
- for(child in table.childList){
- %>
- private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List = ListUtils.newArrayList(); // 子表列表
- <%
- }
-
- // 生成构造方法
- %>
-
- public ${ClassName}() {
- this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
- }
- <%
- // 生成带主键参数的构造
- if (!table.parentExists){
- if (table.pkList.~size == 1){ %>
-
- public ${ClassName}(String id){
- super(id);
- }
- <% }else{ %>
-
- public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
- <% for(pk in table.pkList){ %>
- this.${pk.simpleAttrName} = ${pk.simpleAttrName};
- <% } %>
- }
- <%
- }
- }
-
- // 生成父表参数的构造
- else{
- for(c in table.columnList){
- if(table.parentExists && table.parentTableFkName == c.columnName){
- %>
-
- public ${ClassName}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}){
- this.${c.simpleAttrName} = ${c.simpleAttrName};
- }
- <%
- }
- }
- }
-
- // 如果是树实体,则输出相应方法
- if (table.isTreeEntity){
- %>
-
- @Override
- public ${ClassName} getParent() {
- return parent;
- }
-
- @Override
- public void setParent(${ClassName} parent) {
- this.parent = parent;
- }
- <%
- }
-
- // 生成属性的get和set方法
- isExtend = false;
- for(c in table.columnList){
- // 如果是Extend类属性
- if(c.isExtendColumn){
- if(!isExtend){
- isExtend = true;
- %>
-
- public Extend getExtend() {
- return extend;
- }
-
- public void setExtend(Extend extend) {
- this.extend = extend;
- }
- <%
- }
- // 如果不是基类属性
- }else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
- %>
-
- <%
- // 父类对象
- if(table.parentExists && table.parentTableFkName == c.columnName){
- %>
- public ${@StringUtils.cap(table.parent.className)} get${@StringUtils.cap(c.simpleAttrName)}() {
- return ${c.simpleAttrName};
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}) {
- this.${c.simpleAttrName} = ${c.simpleAttrName};
- }
- <%
- // 其它字段
- }else{
- for(a in c.simpleAnnotationList){
- %>
- @${a}
- <%
- }
- %>
- public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
- return ${c.simpleAttrName};
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}(${c.simpleAttrType} ${c.simpleAttrName}) {
- this.${c.simpleAttrName} = ${c.simpleAttrName};
- }
- <%
- }
- }
- }
-
- // 生成条件字段get和set方法(范围类型)
- for(c in table.columnList){
- if(c.isQuery == "1" && c.queryType == "BETWEEN"){
- %>
-
- public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_gte() {
- return sqlMap.getWhere().getValue("${c.columnName}", QueryType.GTE);
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}_gte(${c.simpleAttrType} ${c.simpleAttrName}) {
- sqlMap.getWhere().and("${c.columnName}", QueryType.GTE, ${c.simpleAttrName});
- }
-
- public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_lte() {
- return sqlMap.getWhere().getValue("${c.columnName}", QueryType.LTE);
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}_lte(${c.simpleAttrType} ${c.simpleAttrName}) {
- sqlMap.getWhere().and("${c.columnName}", QueryType.LTE, ${c.simpleAttrName});
- }
- <%
- }
- }
-
- // 生成子表列表get和set方法
- for(child in table.childList){
- %>
-
- @Valid
- public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
- return ${@StringUtils.uncap(child.className)}List;
- }
-
- public void set${@StringUtils.cap(child.className)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List) {
- this.${@StringUtils.uncap(child.className)}List = ${@StringUtils.uncap(child.className)}List;
- }
- <% } %>
-
-}]]>
-
+
+
+
+ entity
+ src/main/java/${packageName}/${moduleName}/entity/${subModuleName}
+ ${ClassName}.java
+ 0){ %>
+import javax.validation.Valid;
+<% } %>
+<% for(i in table.importList){ %>
+import ${i};
+<% } %>
+
+import com.jeesite.common.entity.DataEntity;
+<% if(table.isTreeEntity){ %>
+import com.jeesite.common.entity.TreeEntity;
+<% } %>
+import com.jeesite.common.mybatis.annotation.Column;
+import com.jeesite.common.mybatis.annotation.Table;
+import com.jeesite.common.mybatis.mapper.query.QueryType;
+<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
+ <% if(table.isTreeEntity){ %>
+import com.jeesite.modules.bpm.entity.BpmTreeEntity;
+ <% }else{ %>
+import com.jeesite.modules.bpm.entity.BpmEntity;
+ <% } %>
+<% } %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+import com.jeesite.common.utils.excel.annotation.ExcelField;
+import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
+import com.jeesite.common.utils.excel.annotation.ExcelFields;
+<% } %>
+
+/**
+ * ${functionName}Entity
+ * @author ${functionAuthor}
+ * @version ${functionVersion}
+ */
+@Table(name="${table.genTableName}", alias="a", label="${functionNameSimple}信息", columns={
+ <%
+ var isBase = false, isData = false,
+ isTree = false, isExtend = false;
+ // ◆ 生成字段属性
+ for(c in table.columnList){
+ // ● 如果是BaseEntity类属性
+ if(table.isBaseEntity && c.isBaseEntityColumn){
+ if(!isBase){
+ isBase = true;
+ %>
+ @Column(includeEntity=BaseEntity.class),
+ <%
+ }
+ // ● 如果是DataEntity类属性
+ }else if(table.isDataEntity && c.isDataEntityColumn){
+ if(!isData){
+ isData = true;
+ %>
+ @Column(includeEntity=DataEntity.class),
+ <%
+ }
+ // ● 如果是TreeEntity类属性
+ }else if(table.isTreeEntity && c.isTreeEntityColumn){
+ if(!isTree){
+ isTree = true;
+ %>
+ @Column(includeEntity=TreeEntity.class),
+ <%
+ }
+ // ● 如果是Extend类属性
+ }else if(table.isExtendEntity && c.isExtendColumn){
+ if(!isExtend){
+ isExtend = true;
+ %>
+ @Column(includeEntity=Extend.class, attrName="extend"),
+ <%
+ }
+ // ● 其它情况下
+ }else{
+ // 容错,如果没有设置父表的主键属性,则设置
+ if(!@StringUtils.contains(c.attrName, ".")){
+ if (table.parentExists && table.parentTableFkName == c.columnName){
+ for (pk in table.parent.pkList){
+ c.fullAttrName = c.fullAttrName + '.' + pk.attrName;
+ break;
+ }
+ }
+ }
+ %>
+ @Column(name="${c.columnName}", attrName="${c.attrName}", label="${c.columnLabel}"<%
+ if (c.comments != c.columnLabel){
+ print(', comment="'+c.comments+'"');
+ }
+ if (c.isPk == @Global.YES){
+ print(', isPK=true');
+ }else{
+ if (c.isInsert != @Global.YES){
+ print(', isInsert=false');
+ }
+ if (c.isUpdate != @Global.YES){
+ print(', isUpdate=false');
+ }
+ if (c.isQuery == @Global.YES && @StringUtils.inString(c.queryType,
+ 'NE', 'GT', 'GTE', 'LT', 'LTE', 'LIKE', 'LEFT_LIKE', 'RIGHT_LIKE')){
+ print(', queryType=QueryType.'+c.queryType);
+ }
+ if (c.isQuery != @Global.YES){
+ print(', isQuery=false');
+ }
+ if (c.attrName == table.treeViewNameAttrName){
+ print(', isTreeName=true');
+ }
+ if (c.isNull == @Global.YES && @StringUtils.inString(c.simpleAttrType,
+ 'Long', 'Integer', 'Double', 'BigDecimal', 'Date')){
+ print(', isUpdateForce=true');
+ }
+ }
+ %>),
+ <%
+ }
+ }
+ %>
+ }, <%
+ // ◆ 生成关联表
+ var joinTables = '';
+ for(c in table.columnList){
+ if (c.attrType == 'com.jeesite.modules.sys.entity.User'){
+ var joinTable = {
+ %>
+ @JoinTable(type=Type.LEFT_JOIN, entity=User.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
+ on="u${cLP.index}.user_code = a.${c.columnName}", columns={
+ @Column(name="user_code", label="用户编码", isPK=true),
+ @Column(name="user_name", label="用户名称", isQuery=false),
+ }),
+ <%
+ };
+ joinTables = joinTables + joinTable;
+ }
+ else if (c.attrType == 'com.jeesite.modules.sys.entity.Office'){
+ var joinTable = {
+ %>
+ @JoinTable(type=Type.LEFT_JOIN, entity=Office.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
+ on="u${cLP.index}.office_code = a.${c.columnName}", columns={
+ @Column(name="office_code", label="机构编码", isPK=true),
+ @Column(name="office_name", label="机构名称", isQuery=false),
+ }),
+ <%
+ };
+ joinTables = joinTables + joinTable;
+ }
+ }
+ if (isNotBlank(joinTables)){
+ print('joinTable={');
+ print(joinTables);
+ print('}, ');
+ }
+ // ◆ 生成排序字段
+ %>orderBy="<% if (isTree){
+ %>a.tree_sorts<%
+ for(pk in table.pkList){
+ %>, a.${pk.columnName}<%
+ }
+ }else if(table.parentExists && table.createDateExists){
+ %>a.create_date ASC<%
+ }else if(table.updateDateExists){
+ %>a.update_date DESC<%
+ }else{
+ for(pk in table.pkList){
+ %>${pkLP.index!=1?', ':''}a.${pk.columnName} ${table.parentExists?'ASC':'DESC'}<%
+ }
+ } %>"
+)
+public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(table.isTreeEntity?'BpmTree':'Bpm'):table.isTreeEntity?'Tree':'Data'}Entity<${ClassName}> {
+
+ private static final long serialVersionUID = 1L;
+ <%
+ isExtend = false;
+ // 生成字段属性
+ for(c in table.columnList){
+ // 如果是Extend类属性
+ if(table.isExtendEntity && c.isExtendColumn){
+ if(!isExtend){
+ isExtend = true;
+ %>
+ private Extend extend; // 扩展字段
+ <%
+ }
+ }
+ // 如果不是基类属性
+ else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
+ // 父类对象
+ if(table.parentExists && table.parentTableFkName == c.columnName){
+ %>
+ private ${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}; <% if (isNotBlank(c.comments)){ %>// ${c.comments} 父类<% } %>
+ <%
+ // 其它字段
+ }else{
+ %>
+ private ${c.simpleAttrType} ${c.simpleAttrName}; <%if(isNotBlank(c.comments)){%>// ${c.comments}<%}%>
+ <%
+ }
+ }
+ }
+
+ // 生成子表列表字段
+ for(child in table.childList){
+ %>
+ private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List = ListUtils.newArrayList(); // 子表列表
+ <%
+ }
+
+ // 生成构造方法
+ %>
+
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+ @ExcelFields({
+ <% for(c in table.columnList){ if(c.optionMap['isImportExport'] == @Global.YES){ %>
+ @ExcelField(title="${c.columnLabel}", attrName="${c.attrName}"${
+ isNotBlank(c.optionMap['dictType'])?', dictType="'+c.optionMap['dictType']+'"':''
+ }, align=Align.CENTER, sort=${c.columnSort}${
+ c.showType == 'date'?', dataFormat="yyyy-MM-dd"':c.showType == 'datetime'?', dataFormat="yyyy-MM-dd hh:mm"':''
+ }),
+ <% } } %>
+ })
+ <% } %>
+ public ${ClassName}() {
+ this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
+ }
+ <%
+ // 生成带主键参数的构造
+ if (!table.parentExists){
+ if (table.pkList.~size == 1){ %>
+
+ public ${ClassName}(String id){
+ super(id);
+ }
+ <% }else{ %>
+
+ public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
+ <% for(pk in table.pkList){ %>
+ this.${pk.simpleAttrName} = ${pk.simpleAttrName};
+ <% } %>
+ }
+ <%
+ }
+ }
+
+ // 生成父表参数的构造
+ else{
+ for(c in table.columnList){
+ if(table.parentExists && table.parentTableFkName == c.columnName){
+ %>
+
+ public ${ClassName}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}){
+ this.${c.simpleAttrName} = ${c.simpleAttrName};
+ }
+ <%
+ }
+ }
+ }
+
+ // 如果是树实体,则输出相应方法
+ if (table.isTreeEntity){
+ %>
+
+ @Override
+ public ${ClassName} getParent() {
+ return parent;
+ }
+
+ @Override
+ public void setParent(${ClassName} parent) {
+ this.parent = parent;
+ }
+ <%
+ }
+
+ // 生成属性的get和set方法
+ isExtend = false;
+ for(c in table.columnList){
+ // 如果是Extend类属性
+ if(c.isExtendColumn){
+ if(!isExtend){
+ isExtend = true;
+ %>
+
+ public Extend getExtend() {
+ return extend;
+ }
+
+ public void setExtend(Extend extend) {
+ this.extend = extend;
+ }
+ <%
+ }
+ // 如果不是基类属性
+ }else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
+ %>
+
+ <%
+ // 父类对象
+ if(table.parentExists && table.parentTableFkName == c.columnName){
+ %>
+ public ${@StringUtils.cap(table.parent.className)} get${@StringUtils.cap(c.simpleAttrName)}() {
+ return ${c.simpleAttrName};
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}) {
+ this.${c.simpleAttrName} = ${c.simpleAttrName};
+ }
+ <%
+ // 其它字段
+ }else{
+ for(a in c.simpleAnnotationList){
+ %>
+ @${a}
+ <%
+ }
+ %>
+ public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
+ return ${c.simpleAttrName};
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}(${c.simpleAttrType} ${c.simpleAttrName}) {
+ this.${c.simpleAttrName} = ${c.simpleAttrName};
+ }
+ <%
+ }
+ }
+ }
+
+ // 生成条件字段get和set方法(范围类型)
+ for(c in table.columnList){
+ if(c.isQuery == "1" && c.queryType == "BETWEEN"){
+ %>
+
+ public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_gte() {
+ return sqlMap.getWhere().getValue("${c.columnName}", QueryType.GTE);
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}_gte(${c.simpleAttrType} ${c.simpleAttrName}) {
+ sqlMap.getWhere().and("${c.columnName}", QueryType.GTE, ${c.simpleAttrName});
+ }
+
+ public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_lte() {
+ return sqlMap.getWhere().getValue("${c.columnName}", QueryType.LTE);
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}_lte(${c.simpleAttrType} ${c.simpleAttrName}) {
+ sqlMap.getWhere().and("${c.columnName}", QueryType.LTE, ${c.simpleAttrName});
+ }
+ <%
+ }
+ }
+
+ // 生成子表列表get和set方法
+ for(child in table.childList){
+ %>
+
+ @Valid
+ public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
+ return ${@StringUtils.uncap(child.className)}List;
+ }
+
+ public void set${@StringUtils.cap(child.className)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List) {
+ this.${@StringUtils.uncap(child.className)}List = ${@StringUtils.uncap(child.className)}List;
+ }
+ <% } %>
+
+}]]>
+
\ No newline at end of file
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/service.xml b/modules/core/src/main/resources/templates/modules/gen/crud/service.xml
index fa257fa5..a0891d1a 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud/service.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud/service.xml
@@ -23,9 +23,11 @@ import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModule
import java.util.Map;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.collect.MapUtils;
-import com.jeesite.common.service.ServiceException;
import com.jeesite.modules.bpm.utils.BpmUtils;
<% } %>
+<% if(toBoolean(table.optionMap['isBpmForm']) || toBoolean(table.optionMap['isImportExport'])){ %>
+import com.jeesite.common.service.ServiceException;
+<% } %>
<% if(toBoolean(table.optionMap['isImageUpload']) || toBoolean(table.optionMap['isFileUpload'])){ %>
import com.jeesite.modules.file.utils.FileUploadUtils;
<% } %>
@@ -33,6 +35,14 @@ import com.jeesite.modules.file.utils.FileUploadUtils;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)};
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)}Dao;
<% } %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+import com.jeesite.common.config.Global;
+import com.jeesite.common.validator.ValidatorUtils;
+import com.jeesite.common.utils.excel.ExcelImport;
+import org.springframework.web.multipart.MultipartFile;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+<% } %>
/**
* ${functionName}Service
@@ -180,6 +190,57 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
}
<% } %>
}
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+
+ /**
+ * 导入数据
+ * @param file 导入的数据文件
+ */
+ @Transactional
+ public String importData(MultipartFile file) {
+ if (file == null){
+ throw new ServiceException(text("请选择导入的数据文件!"));
+ }
+ int successNum = 0; int failureNum = 0;
+ StringBuilder successMsg = new StringBuilder();
+ StringBuilder failureMsg = new StringBuilder();
+ try(ExcelImport ei = new ExcelImport(file, 2, 0)){
+ List<${ClassName}> list = ei.getDataList(${ClassName}.class);
+ for (${ClassName} ${className} : list) {
+ try{
+ ValidatorUtils.validateWithException(${className});
+ this.save(${className});
+ successNum++;
+ successMsg.append("
" + successNum + "、编号 " + ${className}.getId() + " 导入成功");
+ } catch (Exception e) {
+ failureNum++;
+ String msg = "
" + failureNum + "、编号 " + ${className}.getId() + " 导入失败:";
+ if (e instanceof ConstraintViolationException){
+ ConstraintViolationException cve = (ConstraintViolationException)e;
+ for (ConstraintViolation> violation : cve.getConstraintViolations()) {
+ msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
+ }
+ }else{
+ msg += e.getMessage();
+ }
+ failureMsg.append(msg);
+ logger.error(msg, e);
+ }
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ failureMsg.append(e.getMessage());
+ return failureMsg.toString();
+ }
+ if (failureNum > 0) {
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+ throw new ServiceException(failureMsg.toString());
+ }else{
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+ }
+ return successMsg.toString();
+ }
+ <% } %>
/**
* 更新状态
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/viewIndex.xml b/modules/core/src/main/resources/templates/modules/gen/crud/viewIndex.xml
new file mode 100644
index 00000000..1277c7db
--- /dev/null
+++ b/modules/core/src/main/resources/templates/modules/gen/crud/viewIndex.xml
@@ -0,0 +1,96 @@
+
+
+
+ viewIndex
+ src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}
+ ${className}Index.html
+
+\<% layout('/layouts/default.html', {title: '${functionNameSimple}管理', libs: ['layout','zTree']}){ %>
+
+
+
+
+\<% } %>
+
+<% } %>]]>
+
+
\ No newline at end of file
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/viewList.xml b/modules/core/src/main/resources/templates/modules/gen/crud/viewList.xml
index c2d09e8c..aa2472bd 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud/viewList.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud/viewList.xml
@@ -20,7 +20,13 @@
\${text('展开')}
\${text('折叠')}
<% } %>
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+ ${text('导出')}
+ <% } %>
\<% if(hasPermi('${permissionPrefix}:edit')){ %>
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+ ${text('导入')}
+ <% } %>
\${text('新增')}
\<% } %>
@@ -36,6 +42,61 @@
\<% } %>
-<% include('/templates/modules/gen/include/dataGridScript.html'){} %>]]>
+<% include('/templates/modules/gen/include/dataGridScript.html'){} %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+
+<% } %>]]>
\ No newline at end of file
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/controller.xml b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/controller.xml
index 1d5952a3..6517d403 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/controller.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/controller.xml
@@ -9,9 +9,10 @@
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
<% if (table.isTreeEntity){ %>
-import java.util.List;
import java.util.Map;
-<% }else{ %>
+<% } %>
+<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
+import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<% } %>
@@ -27,8 +28,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jeesite.common.config.Global;
-<% if(table.isTreeEntity){ %>
+<% if(table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import com.jeesite.common.collect.ListUtils;
+<% } %>
+<% if(table.isTreeEntity){ %>
import com.jeesite.common.collect.MapUtils;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.idgen.IdGen;
@@ -36,6 +39,12 @@ import com.jeesite.modules.sys.utils.UserUtils;
<% }else{ %>
import com.jeesite.common.entity.Page;
<% } %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+import com.jeesite.common.lang.DateUtils;
+import com.jeesite.common.utils.excel.ExcelExport;
+import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
+import org.springframework.web.multipart.MultipartFile;
+<% } %>
<% if (table.tplCategory == 'crud_select'){ %>
import com.alibaba.fastjson.JSONValidator;
import com.jeesite.common.codec.EncodeUtils;
@@ -75,6 +84,18 @@ public class ${ClassName}Controller extends BaseController {
return ${className}Service.getAndValid(${className});
<% } %>
}
+ <% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableUrl'])){ %>
+
+ /**
+ * 管理主页
+ */
+ @RequiresPermissions("${permissionPrefix}:view")
+ @RequestMapping(value = "index")
+ public String index(${ClassName} ${className}, Model model) {
+ model.addAttribute("${className}", ${className});
+ return "${lastPackageName}/${viewPrefix}Index";
+ }
+ <% } %>
/**
* 查询列表
@@ -192,6 +213,50 @@ public class ${ClassName}Controller extends BaseController {
${className}Service.save(${className});
return renderResult(Global.TRUE, text("保存${functionNameSimple}成功!"));
}
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+
+ /**
+ * 导出数据
+ */
+ @RequiresPermissions("${permissionPrefix}:view")
+ @RequestMapping(value = "exportData")
+ public void exportData(${ClassName} ${className}, HttpServletResponse response) {
+ List<${ClassName}> list = ${className}Service.findList(${className});
+ String fileName = "${functionNameSimple}" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
+ try(ExcelExport ee = new ExcelExport("${functionNameSimple}", ${ClassName}.class)){
+ ee.setDataList(list).write(response, fileName);
+ }
+ }
+
+ /**
+ * 下载模板
+ */
+ @RequiresPermissions("${permissionPrefix}:view")
+ @RequestMapping(value = "importTemplate")
+ public void importTemplate(HttpServletResponse response) {
+ ${ClassName} ${className} = new ${ClassName}();
+ List<${ClassName}> list = ListUtils.newArrayList(${className});
+ String fileName = "${functionNameSimple}模板.xlsx";
+ try(ExcelExport ee = new ExcelExport("${functionNameSimple}", ${ClassName}.class, Type.IMPORT)){
+ ee.setDataList(list).write(response, fileName);
+ }
+ }
+
+ /**
+ * 导入数据
+ */
+ @ResponseBody
+ @RequiresPermissions("${permissionPrefix}:edit")
+ @PostMapping(value = "importData")
+ public String importData(MultipartFile file) {
+ try {
+ String message = ${className}Service.importData(file);
+ return renderResult(Global.TRUE, "posfull:"+message);
+ } catch (Exception ex) {
+ return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
+ }
+ }
+ <% } %>
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
/**
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml
index de773d8b..9a362616 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml
@@ -1,356 +1,375 @@
-
-
-
- entity
- ${moduleName}-client/src/main/java/${packageName}/${moduleName}/entity/${subModuleName}
- ${ClassName}.java
-
-import ${i};
-<% } %>
-
-import com.jeesite.common.entity.DataEntity;
-<% if(table.isTreeEntity){ %>
-import com.jeesite.common.entity.TreeEntity;
-<% } %>
-import com.jeesite.common.mybatis.annotation.Column;
-import com.jeesite.common.mybatis.annotation.Table;
-import com.jeesite.common.mybatis.mapper.query.QueryType;
-<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
- <% if(table.isTreeEntity){ %>
-import com.jeesite.modules.bpm.entity.BpmTreeEntity;
- <% }else{ %>
-import com.jeesite.modules.bpm.entity.BpmEntity;
- <% } %>
-<% } %>
-
-/**
- * ${functionName}Entity
- * @author ${functionAuthor}
- * @version ${functionVersion}
- */
-@Table(name="${table.genTableName}", alias="a", label="${functionNameSimple}信息", columns={
- <%
- var isBase = false, isData = false,
- isTree = false, isExtend = false;
- // ◆ 生成字段属性
- for(c in table.columnList){
- // ● 如果是BaseEntity类属性
- if(table.isBaseEntity && c.isBaseEntityColumn){
- if(!isBase){
- isBase = true;
- %>
- @Column(includeEntity=BaseEntity.class),
- <%
- }
- // ● 如果是DataEntity类属性
- }else if(table.isDataEntity && c.isDataEntityColumn){
- if(!isData){
- isData = true;
- %>
- @Column(includeEntity=DataEntity.class),
- <%
- }
- // ● 如果是TreeEntity类属性
- }else if(table.isTreeEntity && c.isTreeEntityColumn){
- if(!isTree){
- isTree = true;
- %>
- @Column(includeEntity=TreeEntity.class),
- <%
- }
- // ● 如果是Extend类属性
- }else if(table.isExtendEntity && c.isExtendColumn){
- if(!isExtend){
- isExtend = true;
- %>
- @Column(includeEntity=Extend.class, attrName="extend"),
- <%
- }
- // ● 其它情况下
- }else{
- // 容错,如果没有设置父表的主键属性,则设置
- if(!@StringUtils.contains(c.attrName, ".")){
- if (table.parentExists && table.parentTableFkName == c.columnName){
- for (pk in table.parent.pkList){
- c.fullAttrName = c.fullAttrName + '.' + pk.attrName;
- break;
- }
- }
- }
- %>
- @Column(name="${c.columnName}", attrName="${c.attrName}", label="${c.columnLabel}"<%
- if (c.comments != c.columnLabel){
- print(', comment="'+c.comments+'"');
- }
- if (c.isPk == @Global.YES){
- print(', isPK=true');
- }else{
- if (c.isInsert != @Global.YES){
- print(', isInsert=false');
- }
- if (c.isUpdate != @Global.YES){
- print(', isUpdate=false');
- }
- if (c.isQuery == @Global.YES && @StringUtils.inString(c.queryType,
- 'NE', 'GT', 'GTE', 'LT', 'LTE', 'LIKE', 'LEFT_LIKE', 'RIGHT_LIKE')){
- print(', queryType=QueryType.'+c.queryType);
- }
- if (c.isQuery != @Global.YES){
- print(', isQuery=false');
- }
- if (c.attrName == table.treeViewNameAttrName){
- print(', isTreeName=true');
- }
- if (c.isNull == @Global.YES && @StringUtils.inString(c.simpleAttrType,
- 'Long', 'Integer', 'Double', 'BigDecimal', 'Date')){
- print(', isUpdateForce=true');
- }
- }
- %>),
- <%
- }
- }
- %>
- }, <%
- // ◆ 生成关联表
- var joinTables = '';
- for(c in table.columnList){
- if (c.attrType == 'com.jeesite.modules.sys.entity.User'){
- var joinTable = {
- %>
- @JoinTable(type=Type.LEFT_JOIN, entity=User.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
- on="u${cLP.index}.user_code = a.${c.columnName}", columns={
- @Column(name="user_code", label="用户编码", isPK=true),
- @Column(name="user_name", label="用户名称", isQuery=false),
- }),
- <%
- };
- joinTables = joinTables + joinTable;
- }
- else if (c.attrType == 'com.jeesite.modules.sys.entity.Office'){
- var joinTable = {
- %>
- @JoinTable(type=Type.LEFT_JOIN, entity=Office.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
- on="u${cLP.index}.office_code = a.${c.columnName}", columns={
- @Column(name="office_code", label="机构编码", isPK=true),
- @Column(name="office_name", label="机构名称", isQuery=false),
- }),
- <%
- };
- joinTables = joinTables + joinTable;
- }
- }
- if (isNotBlank(joinTables)){
- print('joinTable={');
- print(joinTables);
- print('}, ');
- }
- // ◆ 生成排序字段
- %>orderBy="<% if (isTree){
- %>a.tree_sorts<%
- for(pk in table.pkList){
- %>, a.${pk.columnName}<%
- }
- }else if(table.parentExists && table.createDateExists){
- %>a.create_date ASC<%
- }else if(table.updateDateExists){
- %>a.update_date DESC<%
- }else{
- for(pk in table.pkList){
- %>${pkLP.index!=1?', ':''}a.${pk.columnName} ${table.parentExists?'ASC':'DESC'}<%
- }
- } %>"
-)
-public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(table.isTreeEntity?'BpmTree':'Bpm'):table.isTreeEntity?'Tree':'Data'}Entity<${ClassName}> {
-
- private static final long serialVersionUID = 1L;
- <%
- isExtend = false;
- // 生成字段属性
- for(c in table.columnList){
- // 如果是Extend类属性
- if(table.isExtendEntity && c.isExtendColumn){
- if(!isExtend){
- isExtend = true;
- %>
- private Extend extend; // 扩展字段
- <%
- }
- }
- // 如果不是基类属性
- else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
- // 父类对象
- if(table.parentExists && table.parentTableFkName == c.columnName){
- %>
- private ${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}; <% if (isNotBlank(c.comments)){ %>// ${c.comments} 父类<% } %>
- <%
- // 其它字段
- }else{
- %>
- private ${c.simpleAttrType} ${c.simpleAttrName}; <%if(isNotBlank(c.comments)){%>// ${c.comments}<%}%>
- <%
- }
- }
- }
-
- // 生成子表列表字段
- for(child in table.childList){
- %>
- private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List = ListUtils.newArrayList(); // 子表列表
- <%
- }
-
- // 生成构造方法
- %>
-
- public ${ClassName}() {
- this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
- }
- <%
- // 生成带主键参数的构造
- if (!table.parentExists){
- if (table.pkList.~size == 1){ %>
-
- public ${ClassName}(String id){
- super(id);
- }
- <% }else{ %>
-
- public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
- <% for(pk in table.pkList){ %>
- this.${pk.simpleAttrName} = ${pk.simpleAttrName};
- <% } %>
- }
- <%
- }
- }
-
- // 生成父表参数的构造
- else{
- for(c in table.columnList){
- if(table.parentExists && table.parentTableFkName == c.columnName){
- %>
-
- public ${ClassName}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}){
- this.${c.simpleAttrName} = ${c.simpleAttrName};
- }
- <%
- }
- }
- }
-
- // 如果是树实体,则输出相应方法
- if (table.isTreeEntity){
- %>
-
- @Override
- public ${ClassName} getParent() {
- return parent;
- }
-
- @Override
- public void setParent(${ClassName} parent) {
- this.parent = parent;
- }
- <%
- }
-
- // 生成属性的get和set方法
- isExtend = false;
- for(c in table.columnList){
- // 如果是Extend类属性
- if(c.isExtendColumn){
- if(!isExtend){
- isExtend = true;
- %>
-
- public Extend getExtend() {
- return extend;
- }
-
- public void setExtend(Extend extend) {
- this.extend = extend;
- }
- <%
- }
- // 如果不是基类属性
- }else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
- %>
-
- <%
- // 父类对象
- if(table.parentExists && table.parentTableFkName == c.columnName){
- %>
- public ${@StringUtils.cap(table.parent.className)} get${@StringUtils.cap(c.simpleAttrName)}() {
- return ${c.simpleAttrName};
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}) {
- this.${c.simpleAttrName} = ${c.simpleAttrName};
- }
- <%
- // 其它字段
- }else{
- for(a in c.simpleAnnotationList){
- %>
- @${a}
- <%
- }
- %>
- public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
- return ${c.simpleAttrName};
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}(${c.simpleAttrType} ${c.simpleAttrName}) {
- this.${c.simpleAttrName} = ${c.simpleAttrName};
- }
- <%
- }
- }
- }
-
- // 生成条件字段get和set方法(范围类型)
- for(c in table.columnList){
- if(c.isQuery == "1" && c.queryType == "BETWEEN"){
- %>
-
- public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_gte() {
- return sqlMap.getWhere().getValue("${c.columnName}", QueryType.GTE);
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}_gte(${c.simpleAttrType} ${c.simpleAttrName}) {
- sqlMap.getWhere().and("${c.columnName}", QueryType.GTE, ${c.simpleAttrName});
- }
-
- public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_lte() {
- return sqlMap.getWhere().getValue("${c.columnName}", QueryType.LTE);
- }
-
- public void set${@StringUtils.cap(c.simpleAttrName)}_lte(${c.simpleAttrType} ${c.simpleAttrName}) {
- sqlMap.getWhere().and("${c.columnName}", QueryType.LTE, ${c.simpleAttrName});
- }
- <%
- }
- }
-
- // 生成子表列表get和set方法
- for(child in table.childList){
- %>
-
- @Valid
- public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
- return ${@StringUtils.uncap(child.className)}List;
- }
-
- public void set${@StringUtils.cap(child.className)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List) {
- this.${@StringUtils.uncap(child.className)}List = ${@StringUtils.uncap(child.className)}List;
- }
- <% } %>
-
-}]]>
-
+
+
+
+ entity
+ ${moduleName}-client/src/main/java/${packageName}/${moduleName}/entity/${subModuleName}
+ ${ClassName}.java
+ 0){ %>
+import javax.validation.Valid;
+<% } %>
+<% for(i in table.importList){ %>
+import ${i};
+<% } %>
+
+import com.jeesite.common.entity.DataEntity;
+<% if(table.isTreeEntity){ %>
+import com.jeesite.common.entity.TreeEntity;
+<% } %>
+import com.jeesite.common.mybatis.annotation.Column;
+import com.jeesite.common.mybatis.annotation.Table;
+import com.jeesite.common.mybatis.mapper.query.QueryType;
+<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
+ <% if(table.isTreeEntity){ %>
+import com.jeesite.modules.bpm.entity.BpmTreeEntity;
+ <% }else{ %>
+import com.jeesite.modules.bpm.entity.BpmEntity;
+ <% } %>
+<% } %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+import com.jeesite.common.utils.excel.annotation.ExcelField;
+import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
+import com.jeesite.common.utils.excel.annotation.ExcelFields;
+<% } %>
+
+/**
+ * ${functionName}Entity
+ * @author ${functionAuthor}
+ * @version ${functionVersion}
+ */
+@Table(name="${table.genTableName}", alias="a", label="${functionNameSimple}信息", columns={
+ <%
+ var isBase = false, isData = false,
+ isTree = false, isExtend = false;
+ // ◆ 生成字段属性
+ for(c in table.columnList){
+ // ● 如果是BaseEntity类属性
+ if(table.isBaseEntity && c.isBaseEntityColumn){
+ if(!isBase){
+ isBase = true;
+ %>
+ @Column(includeEntity=BaseEntity.class),
+ <%
+ }
+ // ● 如果是DataEntity类属性
+ }else if(table.isDataEntity && c.isDataEntityColumn){
+ if(!isData){
+ isData = true;
+ %>
+ @Column(includeEntity=DataEntity.class),
+ <%
+ }
+ // ● 如果是TreeEntity类属性
+ }else if(table.isTreeEntity && c.isTreeEntityColumn){
+ if(!isTree){
+ isTree = true;
+ %>
+ @Column(includeEntity=TreeEntity.class),
+ <%
+ }
+ // ● 如果是Extend类属性
+ }else if(table.isExtendEntity && c.isExtendColumn){
+ if(!isExtend){
+ isExtend = true;
+ %>
+ @Column(includeEntity=Extend.class, attrName="extend"),
+ <%
+ }
+ // ● 其它情况下
+ }else{
+ // 容错,如果没有设置父表的主键属性,则设置
+ if(!@StringUtils.contains(c.attrName, ".")){
+ if (table.parentExists && table.parentTableFkName == c.columnName){
+ for (pk in table.parent.pkList){
+ c.fullAttrName = c.fullAttrName + '.' + pk.attrName;
+ break;
+ }
+ }
+ }
+ %>
+ @Column(name="${c.columnName}", attrName="${c.attrName}", label="${c.columnLabel}"<%
+ if (c.comments != c.columnLabel){
+ print(', comment="'+c.comments+'"');
+ }
+ if (c.isPk == @Global.YES){
+ print(', isPK=true');
+ }else{
+ if (c.isInsert != @Global.YES){
+ print(', isInsert=false');
+ }
+ if (c.isUpdate != @Global.YES){
+ print(', isUpdate=false');
+ }
+ if (c.isQuery == @Global.YES && @StringUtils.inString(c.queryType,
+ 'NE', 'GT', 'GTE', 'LT', 'LTE', 'LIKE', 'LEFT_LIKE', 'RIGHT_LIKE')){
+ print(', queryType=QueryType.'+c.queryType);
+ }
+ if (c.isQuery != @Global.YES){
+ print(', isQuery=false');
+ }
+ if (c.attrName == table.treeViewNameAttrName){
+ print(', isTreeName=true');
+ }
+ if (c.isNull == @Global.YES && @StringUtils.inString(c.simpleAttrType,
+ 'Long', 'Integer', 'Double', 'BigDecimal', 'Date')){
+ print(', isUpdateForce=true');
+ }
+ }
+ %>),
+ <%
+ }
+ }
+ %>
+ }, <%
+ // ◆ 生成关联表
+ var joinTables = '';
+ for(c in table.columnList){
+ if (c.attrType == 'com.jeesite.modules.sys.entity.User'){
+ var joinTable = {
+ %>
+ @JoinTable(type=Type.LEFT_JOIN, entity=User.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
+ on="u${cLP.index}.user_code = a.${c.columnName}", columns={
+ @Column(name="user_code", label="用户编码", isPK=true),
+ @Column(name="user_name", label="用户名称", isQuery=false),
+ }),
+ <%
+ };
+ joinTables = joinTables + joinTable;
+ }
+ else if (c.attrType == 'com.jeesite.modules.sys.entity.Office'){
+ var joinTable = {
+ %>
+ @JoinTable(type=Type.LEFT_JOIN, entity=Office.class, attrName="${c.simpleAttrName}", alias="u${cLP.index}",
+ on="u${cLP.index}.office_code = a.${c.columnName}", columns={
+ @Column(name="office_code", label="机构编码", isPK=true),
+ @Column(name="office_name", label="机构名称", isQuery=false),
+ }),
+ <%
+ };
+ joinTables = joinTables + joinTable;
+ }
+ }
+ if (isNotBlank(joinTables)){
+ print('joinTable={');
+ print(joinTables);
+ print('}, ');
+ }
+ // ◆ 生成排序字段
+ %>orderBy="<% if (isTree){
+ %>a.tree_sorts<%
+ for(pk in table.pkList){
+ %>, a.${pk.columnName}<%
+ }
+ }else if(table.parentExists && table.createDateExists){
+ %>a.create_date ASC<%
+ }else if(table.updateDateExists){
+ %>a.update_date DESC<%
+ }else{
+ for(pk in table.pkList){
+ %>${pkLP.index!=1?', ':''}a.${pk.columnName} ${table.parentExists?'ASC':'DESC'}<%
+ }
+ } %>"
+)
+public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(table.isTreeEntity?'BpmTree':'Bpm'):table.isTreeEntity?'Tree':'Data'}Entity<${ClassName}> {
+
+ private static final long serialVersionUID = 1L;
+ <%
+ isExtend = false;
+ // 生成字段属性
+ for(c in table.columnList){
+ // 如果是Extend类属性
+ if(table.isExtendEntity && c.isExtendColumn){
+ if(!isExtend){
+ isExtend = true;
+ %>
+ private Extend extend; // 扩展字段
+ <%
+ }
+ }
+ // 如果不是基类属性
+ else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
+ // 父类对象
+ if(table.parentExists && table.parentTableFkName == c.columnName){
+ %>
+ private ${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}; <% if (isNotBlank(c.comments)){ %>// ${c.comments} 父类<% } %>
+ <%
+ // 其它字段
+ }else{
+ %>
+ private ${c.simpleAttrType} ${c.simpleAttrName}; <%if(isNotBlank(c.comments)){%>// ${c.comments}<%}%>
+ <%
+ }
+ }
+ }
+
+ // 生成子表列表字段
+ for(child in table.childList){
+ %>
+ private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List = ListUtils.newArrayList(); // 子表列表
+ <%
+ }
+
+ // 生成构造方法
+ %>
+
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+ @ExcelFields({
+ <% for(c in table.columnList){ if(c.optionMap['isImportExport'] == @Global.YES){ %>
+ @ExcelField(title="${c.columnLabel}", attrName="${c.attrName}"${
+ isNotBlank(c.optionMap['dictType'])?', dictType="'+c.optionMap['dictType']+'"':''
+ }, align=Align.CENTER, sort=${c.columnSort}${
+ c.showType == 'date'?', dataFormat="yyyy-MM-dd"':c.showType == 'datetime'?', dataFormat="yyyy-MM-dd hh:mm"':''
+ }),
+ <% } } %>
+ })
+ <% } %>
+ public ${ClassName}() {
+ this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
+ }
+ <%
+ // 生成带主键参数的构造
+ if (!table.parentExists){
+ if (table.pkList.~size == 1){ %>
+
+ public ${ClassName}(String id){
+ super(id);
+ }
+ <% }else{ %>
+
+ public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
+ <% for(pk in table.pkList){ %>
+ this.${pk.simpleAttrName} = ${pk.simpleAttrName};
+ <% } %>
+ }
+ <%
+ }
+ }
+
+ // 生成父表参数的构造
+ else{
+ for(c in table.columnList){
+ if(table.parentExists && table.parentTableFkName == c.columnName){
+ %>
+
+ public ${ClassName}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}){
+ this.${c.simpleAttrName} = ${c.simpleAttrName};
+ }
+ <%
+ }
+ }
+ }
+
+ // 如果是树实体,则输出相应方法
+ if (table.isTreeEntity){
+ %>
+
+ @Override
+ public ${ClassName} getParent() {
+ return parent;
+ }
+
+ @Override
+ public void setParent(${ClassName} parent) {
+ this.parent = parent;
+ }
+ <%
+ }
+
+ // 生成属性的get和set方法
+ isExtend = false;
+ for(c in table.columnList){
+ // 如果是Extend类属性
+ if(c.isExtendColumn){
+ if(!isExtend){
+ isExtend = true;
+ %>
+
+ public Extend getExtend() {
+ return extend;
+ }
+
+ public void setExtend(Extend extend) {
+ this.extend = extend;
+ }
+ <%
+ }
+ // 如果不是基类属性
+ }else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
+ %>
+
+ <%
+ // 父类对象
+ if(table.parentExists && table.parentTableFkName == c.columnName){
+ %>
+ public ${@StringUtils.cap(table.parent.className)} get${@StringUtils.cap(c.simpleAttrName)}() {
+ return ${c.simpleAttrName};
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}(${@StringUtils.cap(table.parent.className)} ${c.simpleAttrName}) {
+ this.${c.simpleAttrName} = ${c.simpleAttrName};
+ }
+ <%
+ // 其它字段
+ }else{
+ for(a in c.simpleAnnotationList){
+ %>
+ @${a}
+ <%
+ }
+ %>
+ public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
+ return ${c.simpleAttrName};
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}(${c.simpleAttrType} ${c.simpleAttrName}) {
+ this.${c.simpleAttrName} = ${c.simpleAttrName};
+ }
+ <%
+ }
+ }
+ }
+
+ // 生成条件字段get和set方法(范围类型)
+ for(c in table.columnList){
+ if(c.isQuery == "1" && c.queryType == "BETWEEN"){
+ %>
+
+ public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_gte() {
+ return sqlMap.getWhere().getValue("${c.columnName}", QueryType.GTE);
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}_gte(${c.simpleAttrType} ${c.simpleAttrName}) {
+ sqlMap.getWhere().and("${c.columnName}", QueryType.GTE, ${c.simpleAttrName});
+ }
+
+ public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}_lte() {
+ return sqlMap.getWhere().getValue("${c.columnName}", QueryType.LTE);
+ }
+
+ public void set${@StringUtils.cap(c.simpleAttrName)}_lte(${c.simpleAttrType} ${c.simpleAttrName}) {
+ sqlMap.getWhere().and("${c.columnName}", QueryType.LTE, ${c.simpleAttrName});
+ }
+ <%
+ }
+ }
+
+ // 生成子表列表get和set方法
+ for(child in table.childList){
+ %>
+
+ @Valid
+ public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
+ return ${@StringUtils.uncap(child.className)}List;
+ }
+
+ public void set${@StringUtils.cap(child.className)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List) {
+ this.${@StringUtils.uncap(child.className)}List = ${@StringUtils.uncap(child.className)}List;
+ }
+ <% } %>
+
+}]]>
+
\ No newline at end of file
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/service.xml b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/service.xml
index 5d80b005..b361a54a 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/service.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/service.xml
@@ -25,8 +25,10 @@ import ${packageName}.${moduleName}.api${isNotEmpty(subModuleName)?'.'+subModule
import java.util.Map;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.collect.MapUtils;
+import com.jeesite.modules.bpm.utils.BpmUtils;
+<% } %>
+<% if(toBoolean(table.optionMap['isBpmForm']) || toBoolean(table.optionMap['isImportExport'])){ %>
import com.jeesite.common.service.ServiceException;
-import com.jeesite.modules.bpm.utils.client.BpmUtils;
<% } %>
<% if(toBoolean(table.optionMap['isImageUpload']) || toBoolean(table.optionMap['isFileUpload'])){ %>
import com.jeesite.modules.file.utils.FileUploadUtils;
@@ -35,6 +37,14 @@ import com.jeesite.modules.file.utils.FileUploadUtils;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)};
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${@StringUtils.cap(child.className)}Dao;
<% } %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+import com.jeesite.common.config.Global;
+import com.jeesite.common.validator.ValidatorUtils;
+import com.jeesite.common.utils.excel.ExcelImport;
+import org.springframework.web.multipart.MultipartFile;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+<% } %>
import io.seata.spring.annotation.GlobalTransactional;
@@ -115,8 +125,8 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
* @param ${className}
*/
@Override
- @GlobalTransactional
@Transactional
+ @GlobalTransactional
public void save(${ClassName} ${className}) {
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
// 如果未设置状态,则指定状态为审核状态,以提交审核流程
@@ -187,14 +197,66 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
}
<% } %>
}
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+
+ /**
+ * 导入数据
+ * @param file 导入的数据文件
+ */l
+ @Transactional
+ @GlobalTransactiona
+ public String importData(MultipartFile file) {
+ if (file == null){
+ throw new ServiceException(text("请选择导入的数据文件!"));
+ }
+ int successNum = 0; int failureNum = 0;
+ StringBuilder successMsg = new StringBuilder();
+ StringBuilder failureMsg = new StringBuilder();
+ try(ExcelImport ei = new ExcelImport(file, 2, 0)){
+ List<${ClassName}> list = ei.getDataList(${ClassName}.class);
+ for (${ClassName} ${className} : list) {
+ try{
+ ValidatorUtils.validateWithException(${className});
+ this.save(${className});
+ successNum++;
+ successMsg.append("
" + successNum + "、编号 " + ${className}.getId() + " 导入成功");
+ } catch (Exception e) {
+ failureNum++;
+ String msg = "
" + failureNum + "、编号 " + ${className}.getId() + " 导入失败:";
+ if (e instanceof ConstraintViolationException){
+ ConstraintViolationException cve = (ConstraintViolationException)e;
+ for (ConstraintViolation> violation : cve.getConstraintViolations()) {
+ msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
+ }
+ }else{
+ msg += e.getMessage();
+ }
+ failureMsg.append(msg);
+ logger.error(msg, e);
+ }
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ failureMsg.append(e.getMessage());
+ return failureMsg.toString();
+ }
+ if (failureNum > 0) {
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+ throw new ServiceException(failureMsg.toString());
+ }else{
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+ }
+ return successMsg.toString();
+ }
+ <% } %>
/**
* 更新状态
* @param ${className}
*/
@Override
- @GlobalTransactional
@Transactional
+ @GlobalTransactional
public void updateStatus(${ClassName} ${className}) {
super.updateStatus(${className});
}
@@ -204,8 +266,8 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
* @param ${className}
*/
@Override
- @GlobalTransactional
@Transactional
+ @GlobalTransactional
public void delete(${ClassName} ${className}) {
super.delete(${className});
<% for (child in table.childList) { %>
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/viewIndex.xml b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/viewIndex.xml
new file mode 100644
index 00000000..1277c7db
--- /dev/null
+++ b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/viewIndex.xml
@@ -0,0 +1,96 @@
+
+
+
+ viewIndex
+ src/main/resources/views/${lastPackageName}/${moduleName}/${subModuleName}
+ ${className}Index.html
+
+\<% layout('/layouts/default.html', {title: '${functionNameSimple}管理', libs: ['layout','zTree']}){ %>
+
+
+
+
+\<% } %>
+
+<% } %>]]>
+
+
\ No newline at end of file
diff --git a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/viewList.xml b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/viewList.xml
index affe2563..bc8aaea6 100644
--- a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/viewList.xml
+++ b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/viewList.xml
@@ -20,7 +20,13 @@
\${text('展开')}
\${text('折叠')}
<% } %>
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+ ${text('导出')}
+ <% } %>
\<% if(hasPermi('${permissionPrefix}:edit')){ %>
+ <% if(toBoolean(table.optionMap['isImportExport'])){ %>
+ ${text('导入')}
+ <% } %>
\${text('新增')}
\<% } %>
@@ -36,6 +42,61 @@
\<% } %>
-<% include('/templates/modules/gen/include/dataGridScript.html'){} %>]]>
+<% include('/templates/modules/gen/include/dataGridScript.html'){} %>
+<% if(toBoolean(table.optionMap['isImportExport'])){ %>
+
+<% } %>]]>
\ No newline at end of file