68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
package ${package_name}.controller;
|
|
|
|
import ${package_name}.domain.${entity};
|
|
import ${package_name}.domain.vo.${entity?lower_case}.*;
|
|
import ${package_name}.service.I${entity}Service;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* 描述:
|
|
* author: ${author}
|
|
* date: ${date}
|
|
*/
|
|
@RestController
|
|
@RequestMapping(value="/${entity?lower_case}")
|
|
@Api(tags = {""})
|
|
public class ${entity}Controller {
|
|
|
|
@Autowired
|
|
private I${entity}Service ${entity?uncap_first}Service;
|
|
|
|
@PostMapping(value="/add")
|
|
@ApiOperation("新增信息")
|
|
public ResponseMsg add(@RequestBody ${entity}CreateInputVo vo){
|
|
return ${entity?uncap_first}Service.add(vo);
|
|
}
|
|
|
|
|
|
@PutMapping(value="/edit")
|
|
@AutoLog(value = "更新", operationType = OperationTypeEnum.UPDATE, module = "")
|
|
@ApiOperation("更改信息")
|
|
public boolean update(@RequestBody ${entity}UpdateInputVo vo}){
|
|
return ${entity?uncap_first}Service.update(inputVo);
|
|
}
|
|
|
|
|
|
@GetMapping("/getInfo")
|
|
@ApiOperation("获取单个信息")
|
|
public ${entity}ModelVo getInfo(String key) {
|
|
return ${entity?uncap_first}Service.getInfo(key);
|
|
}
|
|
|
|
@DeleteMapping(value="/remove")
|
|
@AutoLog(value = "删除信息", operationType = OperationTypeEnum.DELETE, module = "")
|
|
public boolean delete(String key){
|
|
if(StringUtils.isNotBlank(key)){
|
|
return ${entity?uncap_first}Service.remove(key);
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@GetMapping("/getList")
|
|
@ApiOperation("获取列表")
|
|
public List<${entity}ViewVo> getList(SearchInputVo vo) {
|
|
return ${entity?uncap_first}Service.getList(vo);
|
|
}
|
|
} |