xuefei
2020-12-10 eeeb7233935ea9b10e99043bdbf740ef86c9bf20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ${entity.controllerPackage};
 
import BaseController;
import PageUtil;
import ResultUtil;
import PageVo;
import Result;
import SearchVo;
import ${entity.entityPackage}.${entity.className};
import ${entity.servicePackage}.${entity.className}Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import org.springframework.transaction.annotation.Transactional;
 
/**
 * @author ${entity.author}
 */
@Slf4j
@RestController
@Api(description = "${entity.description}管理接口")
@RequestMapping("/platform/${entity.classNameLowerCase}")
@Transactional
public class ${entity.className}Controller extends BaseController<${entity.className}, ${entity.primaryKeyType}> {
 
    @Autowired
    private ${entity.className}Service ${entity.classNameLowerCase}Service;
 
    @Override
    public ${entity.className}Service getService() {
        return ${entity.classNameLowerCase}Service;
    }
 
    @RequestMapping(value = "/getByCondition", method = RequestMethod.GET)
    @ApiOperation(value = "多条件分页获取")
    public Result<Page<${entity.className}>> getByCondition(${entity.className} ${entity.classNameLowerCase},
                                                            SearchVo searchVo,
                                                            PageVo pageVo){
 
        Page<${entity.className}> page = ${entity.classNameLowerCase}Service.findByCondition(${entity.classNameLowerCase}, searchVo, PageUtil.initPage(pageVo));
        return new ResultUtil<Page<${entity.className}>>().setData(page);
    }
}