生成模版修改
This commit is contained in:
parent
e33377724f
commit
e9809f79c5
@ -126,15 +126,7 @@ public class ${entityName}Controller {
|
|||||||
@ApiImplicitParam(name = "id", value = "${tableVo.ftlDescription}ID", paramType = "query", required = true, dataType = "Integer")
|
@ApiImplicitParam(name = "id", value = "${tableVo.ftlDescription}ID", paramType = "query", required = true, dataType = "Integer")
|
||||||
@GetMapping(value = "/queryById")
|
@GetMapping(value = "/queryById")
|
||||||
public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
|
public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
|
||||||
Result<${entityName}> result = new Result<${entityName}>();
|
return Result.success(${entityName?uncap_first}Service.queryById(id));
|
||||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
|
||||||
if(${entityName?uncap_first}==null) {
|
|
||||||
result.error500("未找到对应实体");
|
|
||||||
}else {
|
|
||||||
result.setResult(${entityName?uncap_first});
|
|
||||||
result.setSuccess(true);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,4 +23,7 @@ public interface I${entityName}Service extends IService<${entityName}> {
|
|||||||
void edit(${entityName} ${entityName?uncap_first});
|
void edit(${entityName} ${entityName?uncap_first});
|
||||||
|
|
||||||
void delete(String id);
|
void delete(String id);
|
||||||
|
|
||||||
|
${entityName} queryById(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,5 +78,13 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|||||||
baseMapper.deleteById(id);
|
baseMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ${entityName} queryById(String id) {
|
||||||
|
${entityName} entity = getById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
throw new OpenAlertException("未找到对应实体");
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user