【fix sonar】${entityName}Controller文件
This commit is contained in:
+19
-18
@@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import com.jero.common.aspect.annotation.AutoLog;
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
<#assign bpm_flag=false>
|
<#assign bpm_flag=false>
|
||||||
<#list originalColumns as po>
|
<#list originalColumns as po>
|
||||||
@@ -53,12 +54,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||||
@GetMapping(value = "/page")
|
@GetMapping(value = "/page")
|
||||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
|
public Results<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.queryPage(${entityName?uncap_first}, pageNo, pageSize, req);
|
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.queryPage(${entityName?uncap_first}, pageNo, pageSize, req);
|
||||||
return Result.OK(pageList);
|
return Results.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,9 +72,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-列表查询")
|
@AutoLog(value = "${tableVo.ftlDescription}-列表查询")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-列表查询", notes="${tableVo.ftlDescription}-列表查询")
|
@ApiOperation(value="${tableVo.ftlDescription}-列表查询", notes="${tableVo.ftlDescription}-列表查询")
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<List<${entityName}>> queryList(${entityName} ${entityName?uncap_first}, HttpServletRequest req) {
|
public Results<List<${entityName}>> queryList(${entityName} ${entityName?uncap_first}, HttpServletRequest req) {
|
||||||
List<${entityName}> list = ${entityName?uncap_first}Service.queryList(${entityName?uncap_first}, req);
|
List<${entityName}> list = ${entityName?uncap_first}Service.queryList(${entityName?uncap_first}, req);
|
||||||
return Result.OK(list);
|
return Results.OK(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,12 +86,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<?> add(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
public Results<T> add(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||||
<#if bpm_flag>
|
<#if bpm_flag>
|
||||||
${entityName?uncap_first}.setBpmStatus("1");
|
${entityName?uncap_first}.setBpmStatus("1");
|
||||||
</#if>
|
</#if>
|
||||||
${entityName?uncap_first}Service.add(${entityName?uncap_first});
|
${entityName?uncap_first}Service.add(${entityName?uncap_first});
|
||||||
return Result.OK("操作成功!");
|
return Results.OK("操作成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,9 +103,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||||
@PostMapping(value = "/edit")
|
@PostMapping(value = "/edit")
|
||||||
public Result<?> edit(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
public Results<T> edit(@Validated @RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||||
${entityName?uncap_first}Service.editById(${entityName?uncap_first});
|
${entityName?uncap_first}Service.editById(${entityName?uncap_first});
|
||||||
return Result.OK("操作成功!");
|
return Results.OK("操作成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,12 +117,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||||
@PostMapping(value = "/delete")
|
@PostMapping(value = "/delete")
|
||||||
public Result<?> delete(@RequestBody Map<String, String> map) {
|
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||||
return Result.error("请选择数据!");
|
return Results.error("请选择数据!");
|
||||||
}
|
}
|
||||||
${entityName?uncap_first}Service.deleteById(map.get("id"));
|
${entityName?uncap_first}Service.deleteById(map.get("id"));
|
||||||
return Result.OK("删除成功!");
|
return Results.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,12 +134,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||||
@PostMapping(value = "/deleteBatch")
|
@PostMapping(value = "/deleteBatch")
|
||||||
public Result<?> deleteBatch(@RequestBody Map<String, String> map) {
|
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||||
return Result.error("请选择数据!");
|
return Results.error("请选择数据!");
|
||||||
}
|
}
|
||||||
this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||||
return Result.OK("批量删除成功!");
|
return Results.OK("批量删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,12 +151,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||||
@GetMapping(value = "/queryById")
|
@GetMapping(value = "/queryById")
|
||||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
public Results<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
|
||||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.queryById(id);
|
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.queryById(id);
|
||||||
if(${entityName?uncap_first}==null) {
|
if(${entityName?uncap_first}==null) {
|
||||||
return Result.error("未找到对应数据");
|
return Results.error("未找到对应数据");
|
||||||
}
|
}
|
||||||
return Result.OK(${entityName?uncap_first});
|
return Results.OK(${entityName?uncap_first});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,7 +178,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
public Results<${entityName}> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
return super.importExcel(request, response, ${entityName}.class);
|
return super.importExcel(request, response, ${entityName}.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-18
@@ -33,6 +33,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: ${tableVo.ftlDescription}
|
* @Description: ${tableVo.ftlDescription}
|
||||||
@@ -60,12 +61,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||||
@GetMapping(value = "/page")
|
@GetMapping(value = "/page")
|
||||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
|
public Results<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.queryPage(${entityName?uncap_first}, pageNo, pageSize, req);
|
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.queryPage(${entityName?uncap_first}, pageNo, pageSize, req);
|
||||||
return Result.OK(pageList);
|
return Results.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,9 +79,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-列表查询")
|
@AutoLog(value = "${tableVo.ftlDescription}-列表查询")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-列表查询", notes="${tableVo.ftlDescription}-列表查询")
|
@ApiOperation(value="${tableVo.ftlDescription}-列表查询", notes="${tableVo.ftlDescription}-列表查询")
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<List<${entityName}>> queryList(${entityName} ${entityName?uncap_first}, HttpServletRequest req) {
|
public Results<List<${entityName}>> queryList(${entityName} ${entityName?uncap_first}, HttpServletRequest req) {
|
||||||
List<?> list = ${entityName?uncap_first}Service.queryList(${entityName?uncap_first},req);
|
List<${entityName}> list = ${entityName?uncap_first}Service.queryList(${entityName?uncap_first},req);
|
||||||
return Result.OK(list);
|
return Results.OK(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,9 +93,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
public Results<T> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||||
${entityName?uncap_first}Service.add(${entityName?uncap_first});
|
${entityName?uncap_first}Service.add(${entityName?uncap_first});
|
||||||
return Result.OK("操作成功!");
|
return Results.OK("操作成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,9 +107,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||||
@PostMapping(value = "/edit")
|
@PostMapping(value = "/edit")
|
||||||
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
public Results<T> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||||
${entityName?uncap_first}Service.editById(${entityName?uncap_first});
|
${entityName?uncap_first}Service.editById(${entityName?uncap_first});
|
||||||
return Result.OK("操作成功!");
|
return Results.OK("操作成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,12 +121,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||||
@PostMapping(value = "/delete")
|
@PostMapping(value = "/delete")
|
||||||
public Result<?> delete(@RequestBody Map<String, String> map) {
|
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||||
return Result.error("请选择数据!");
|
return Results.error("请选择数据!");
|
||||||
}
|
}
|
||||||
${entityName?uncap_first}Service.deleteById(map.get("id"));
|
${entityName?uncap_first}Service.deleteById(map.get("id"));
|
||||||
return Result.OK("删除成功!");
|
return Results.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,12 +138,12 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||||
@PostMapping(value = "/deleteBatch")
|
@PostMapping(value = "/deleteBatch")
|
||||||
public Result<?> deleteBatch(@RequestBody Map<String, String> map) {
|
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||||
return Result.error("请选择数据!");
|
return Results.error("请选择数据!");
|
||||||
}
|
}
|
||||||
this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
this.${entityName?uncap_first}Service.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||||
return Result.OK("批量删除成功!");
|
return Results.OK("批量删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,9 +155,9 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||||
@GetMapping(value = "/queryById")
|
@GetMapping(value = "/queryById")
|
||||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
public Results<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
|
||||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.queryById(id);
|
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.queryById(id);
|
||||||
return Result.OK(${entityName?uncap_first});
|
return Results.OK(${entityName?uncap_first});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,7 +179,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
public Results<${entityName}> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
return super.importExcel(request, response, ${entityName}.class);
|
return super.importExcel(request, response, ${entityName}.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user