代码生成模板主子表服务类增加子表数据查询方法;去掉复选框必须选择一项的验证;
This commit is contained in:
@@ -9,12 +9,11 @@
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
|
||||
<% if(table.isTreeEntity){ %>
|
||||
|
||||
<% if (table.isTreeEntity){ %>
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
<% }else{ %>
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
<% } %>
|
||||
@@ -45,6 +44,9 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -120,6 +122,20 @@ public class ${ClassName}Controller extends BaseController {
|
||||
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;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
@@ -287,12 +303,12 @@ public class ${ClassName}Controller extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:view")
|
||||
@RequestMapping(value = "${className}Select")
|
||||
public String empUserSelect(${ClassName} ${className}, String selectData, Model model) {
|
||||
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});
|
||||
model.addAttribute("${className}", ${className});
|
||||
return "${lastPackageName}/${viewPrefix}Select";
|
||||
}
|
||||
<% } %>
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
*/
|
||||
package ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''};
|
||||
|
||||
<% if (table.isTreeEntity){ %>
|
||||
import java.util.List;
|
||||
<% } %>
|
||||
|
||||
<% if (table.childList.~size > 0){ %>
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,7 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
<% if (!table.isTreeEntity){ %>
|
||||
import com.jeesite.common.entity.Page;
|
||||
<% } %>
|
||||
import com.jeesite.common.service.${table.isTreeEntity?'Tree':'Crud'}Service;
|
||||
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
|
||||
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao;
|
||||
@@ -96,6 +100,20 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
||||
return super.findList(${className});
|
||||
}
|
||||
<% } %>
|
||||
<% for (child in table.childList){ %>
|
||||
|
||||
/**
|
||||
* 查询子表分页数据
|
||||
* @param ${@StringUtils.uncap(child.className)}
|
||||
* @param ${@StringUtils.uncap(child.className)}.page 分页对象
|
||||
* @return
|
||||
*/
|
||||
public Page<${@StringUtils.cap(child.className)}> findSubPage(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}) {
|
||||
Page<${@StringUtils.cap(child.className)}> page = ${@StringUtils.uncap(child.className)}.getPage();
|
||||
page.setList(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
||||
return page;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
*/
|
||||
package ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''};
|
||||
|
||||
<% if (table.isTreeEntity){ %>
|
||||
import java.util.List;
|
||||
<% } %>
|
||||
|
||||
<% if (table.childList.~size > 0){ %>
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,7 +21,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
<% if (!table.isTreeEntity){ %>
|
||||
import com.jeesite.common.entity.Page;
|
||||
<% } %>
|
||||
import com.jeesite.common.service.${table.isTreeEntity?'Tree':'Crud'}Service;
|
||||
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
|
||||
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao;
|
||||
@@ -100,6 +104,20 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
||||
return super.findList(${className});
|
||||
}
|
||||
<% } %>
|
||||
<% for (child in table.childList){ %>
|
||||
|
||||
/**
|
||||
* 查询子表分页数据
|
||||
* @param ${@StringUtils.uncap(child.className)}
|
||||
* @param ${@StringUtils.uncap(child.className)}.page 分页对象
|
||||
* @return
|
||||
*/
|
||||
public Page<${@StringUtils.cap(child.className)}> findSubPage(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}) {
|
||||
Page<${@StringUtils.cap(child.className)}> page = ${@StringUtils.uncap(child.className)}.getPage();
|
||||
page.setList(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
||||
return page;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModuleName:''};
|
||||
<% if(table.isTreeEntity){ %>
|
||||
|
||||
<% if (table.isTreeEntity){ %>
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
<% }else{ %>
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
<% } %>
|
||||
@@ -39,6 +38,9 @@ import com.jeesite.common.entity.Page;
|
||||
<% } %>
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -114,6 +116,20 @@ public class ${ClassName}Controller extends BaseController {
|
||||
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;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
|
||||
@@ -10,14 +10,18 @@
|
||||
*/
|
||||
package ${packageName}.${moduleName}.service${isNotEmpty(subModuleName)?'.'+subModuleName:''};
|
||||
|
||||
<% if (table.isTreeEntity){ %>
|
||||
import java.util.List;
|
||||
<% } %>
|
||||
|
||||
<% if (table.childList.~size > 0){ %>
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
<% } %>
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
<% if (!table.isTreeEntity){ %>
|
||||
import com.jeesite.common.entity.Page;
|
||||
<% } %>
|
||||
import com.jeesite.common.service.${table.isTreeEntity?'Tree':'Query'}Service;
|
||||
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
|
||||
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao;
|
||||
@@ -84,6 +88,20 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Query'}Ser
|
||||
return super.findList(${className});
|
||||
}
|
||||
<% } %>
|
||||
<% for (child in table.childList){ %>
|
||||
|
||||
/**
|
||||
* 查询子表分页数据
|
||||
* @param ${@StringUtils.uncap(child.className)}
|
||||
* @param ${@StringUtils.uncap(child.className)}.page 分页对象
|
||||
* @return
|
||||
*/
|
||||
public Page<${@StringUtils.cap(child.className)}> findSubPage(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}) {
|
||||
Page<${@StringUtils.cap(child.className)}> page = ${@StringUtils.uncap(child.className)}.getPage();
|
||||
page.setList(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
||||
return page;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
}]]>
|
||||
</content>
|
||||
|
||||
Reference in New Issue
Block a user