|
@@ -10,7 +10,7 @@ import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
-import com.xjrsoft.common.model.result.R;
|
|
|
+import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.${outputArea}.dto.Add${entityClass}Dto;
|
|
|
import com.xjrsoft.module.${outputArea}.dto.Update${entityClass}Dto;
|
|
@@ -80,9 +80,9 @@ public class ${className}Controller {
|
|
|
|
|
|
<#if !isPage>
|
|
|
@GetMapping(value = "/list")
|
|
|
- @ApiOperation(value="${entityClass}列表(不分页)")
|
|
|
+ @ApiOperation(value="${tableComment}列表(不分页)")
|
|
|
@SaCheckPermission("${className?lower_case}:detail")
|
|
|
- public R list(@Valid ${entityClass}ListDto dto){
|
|
|
+ public RT<List<${entityClass}ListVo>> list(@Valid ${entityClass}ListDto dto){
|
|
|
|
|
|
LambdaQueryWrapper<${entityClass}> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper
|
|
@@ -113,13 +113,13 @@ public class ${className}Controller {
|
|
|
|
|
|
List<${entityClass}> list = ${className?uncap_first}Service.list(queryWrapper);
|
|
|
List<${entityClass}ListVo> listVos = BeanUtil.copyToList(list, ${entityClass}ListVo.class);
|
|
|
- return R.ok(listVos);
|
|
|
+ return RT.ok(listVos);
|
|
|
}
|
|
|
<#else>
|
|
|
@GetMapping(value = "/page")
|
|
|
- @ApiOperation(value="${entityClass}列表(分页)")
|
|
|
+ @ApiOperation(value="${tableComment}列表(分页)")
|
|
|
@SaCheckPermission("${className?lower_case}:detail")
|
|
|
- public R page(@Valid ${entityClass}PageDto dto){
|
|
|
+ public RT<PageOutput<${entityClass}PageVo>> page(@Valid ${entityClass}PageDto dto){
|
|
|
|
|
|
LambdaQueryWrapper<${entityClass}> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper
|
|
@@ -147,26 +147,26 @@ public class ${className}Controller {
|
|
|
.select(${entityClass}.class,x -> VoToColumnUtil.fieldsToColumns(${entityClass}PageVo.class).contains(x.getProperty()));
|
|
|
IPage<${entityClass}> page = ${className?uncap_first}Service.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
PageOutput<${entityClass}PageVo> pageOutput = ConventPage.getPageOutput(page, ${entityClass}PageVo.class);
|
|
|
- return R.ok(pageOutput);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
}
|
|
|
</#if>
|
|
|
|
|
|
@GetMapping(value = "/info")
|
|
|
- @ApiOperation(value="根据id查询${entityClass}信息")
|
|
|
+ @ApiOperation(value="根据id查询${tableComment}信息")
|
|
|
@SaCheckPermission("${className?lower_case}:detail")
|
|
|
- public R info(@RequestParam Long id){
|
|
|
+ public RT<${entityClass}Vo> info(@RequestParam Long id){
|
|
|
${entityClass} ${entityClass?uncap_first} = ${className?uncap_first}Service.${isMulti?string("getByIdDeep","getById")}(id);
|
|
|
if (${entityClass?uncap_first} == null) {
|
|
|
- return R.error("找不到此数据!");
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
}
|
|
|
- return R.ok(BeanUtil.toBean(${entityClass?uncap_first}, ${entityClass}Vo.class));
|
|
|
+ return RT.ok(BeanUtil.toBean(${entityClass?uncap_first}, ${entityClass}Vo.class));
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
- @ApiOperation(value = "新增${entityClass}")
|
|
|
+ @ApiOperation(value = "新增${tableComment}")
|
|
|
@SaCheckPermission("${className?lower_case}:add")
|
|
|
- public R add(@Valid @RequestBody Add${entityClass}Dto dto){
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody Add${entityClass}Dto dto){
|
|
|
<#if isMulti>
|
|
|
${entityClass} ${entityClass?uncap_first} = BeanUtil.toBean(dto, ${entityClass}.class);
|
|
|
boolean isSuccess = ${className?uncap_first}Service.add(${entityClass?uncap_first});
|
|
@@ -177,32 +177,32 @@ public class ${className}Controller {
|
|
|
<#if codeRules != "">
|
|
|
codeRuleService.useEncode("${codeRules}");
|
|
|
</#if>
|
|
|
- return R.ok(isSuccess);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
}
|
|
|
|
|
|
@PutMapping
|
|
|
- @ApiOperation(value = "修改${entityClass}")
|
|
|
+ @ApiOperation(value = "修改${tableComment}")
|
|
|
@SaCheckPermission("${className?lower_case}:edit")
|
|
|
- public R update(@Valid @RequestBody Update${entityClass}Dto dto){
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody Update${entityClass}Dto dto){
|
|
|
|
|
|
<#if isMulti>
|
|
|
${entityClass} ${entityClass?uncap_first} = BeanUtil.toBean(dto, ${entityClass}.class);
|
|
|
- return R.ok(${className?uncap_first}Service.update(${entityClass?uncap_first}));
|
|
|
+ return RT.ok(${className?uncap_first}Service.update(${entityClass?uncap_first}));
|
|
|
<#else >
|
|
|
${entityClass} ${entityClass?uncap_first} = BeanUtil.toBean(dto, ${entityClass}.class);
|
|
|
- return R.ok(${className?uncap_first}Service.updateById(${entityClass?uncap_first}));
|
|
|
+ return RT.ok(${className?uncap_first}Service.updateById(${entityClass?uncap_first}));
|
|
|
</#if>
|
|
|
|
|
|
}
|
|
|
|
|
|
@DeleteMapping
|
|
|
- @ApiOperation(value = "删除")
|
|
|
+ @ApiOperation(value = "删除${tableComment}")
|
|
|
@SaCheckPermission("${className?lower_case}:delete")
|
|
|
- public R delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
<#if isMulti>
|
|
|
- return R.ok(${className?uncap_first}Service.delete(ids));
|
|
|
+ return RT.ok(${className?uncap_first}Service.delete(ids));
|
|
|
<#else >
|
|
|
- return R.ok(${className?uncap_first}Service.removeBatchByIds(ids));
|
|
|
+ return RT.ok(${className?uncap_first}Service.removeBatchByIds(ids));
|
|
|
</#if>
|
|
|
|
|
|
}
|
|
@@ -214,10 +214,10 @@ public class ${className}Controller {
|
|
|
<#if isImport>
|
|
|
@PostMapping("/import")
|
|
|
@ApiOperation(value = "导入")
|
|
|
- public R importData(@RequestParam MultipartFile file) throws IOException {
|
|
|
+ public RT<Boolean> importData(@RequestParam MultipartFile file) throws IOException {
|
|
|
List<${importClass}Vo> savedDataList = EasyExcel.read(file.getInputStream()).head(${importClass}Vo.class).sheet().doReadSync();
|
|
|
- ${className?uncap_first}Service.saveBatch(BeanUtil.copyToList(savedDataList, ${entityClass}.class));
|
|
|
- return R.ok();
|
|
|
+ Boolean result = ${className?uncap_first}Service.saveBatch(BeanUtil.copyToList(savedDataList, ${entityClass}.class));
|
|
|
+ return RT.ok(result);
|
|
|
}
|
|
|
</#if>
|
|
|
|
|
@@ -233,13 +233,13 @@ public class ${className}Controller {
|
|
|
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
|
EasyExcel.write(bot, ${importClass}Vo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
|
|
|
|
|
|
- return R.fileStream(bot.toByteArray(), "${className}" + ExcelTypeEnum.XLSX.getValue());
|
|
|
+ return RT.fileStream(bot.toByteArray(), "${className}" + ExcelTypeEnum.XLSX.getValue());
|
|
|
}
|
|
|
</#if>
|
|
|
<#if isDataAuth>
|
|
|
@PutMapping("/data-auth")
|
|
|
@ApiOperation(value = "批量设置权限所属人")
|
|
|
- public R setDataAUth(@RequestBody BatchSetDataAuthDto dto){
|
|
|
+ public RT setDataAUth(@RequestBody BatchSetDataAuthDto dto){
|
|
|
List<${entityClass}> toUpdateList = new ArrayList<>();
|
|
|
<#-- String userIdStr = dto.getUserIdList().stream().collect(Collectors.joining(StringPool.COMMA));-->
|
|
|
for (Long dataId : dto.getDataIdList()) {
|
|
@@ -248,7 +248,7 @@ public class ${className}Controller {
|
|
|
${entityClass?uncap_first}.setRuleUserId(dto.getUserIdList().get(0));
|
|
|
toUpdateList.add(${entityClass?uncap_first});
|
|
|
}
|
|
|
- return R.ok(${className?uncap_first}Service.updateBatchById(toUpdateList));
|
|
|
+ return RT.ok(${className?uncap_first}Service.updateBatchById(toUpdateList));
|
|
|
}
|
|
|
</#if>
|
|
|
}
|