Search in sources :

Example 1 with DemoVo

use of net.jeebiz.boot.demo.web.vo.DemoVo in project spring-boot-starter-samples by vindell.

the class DemoController method list.

@ApiOperation(value = "获取xxx列表", notes = "分页查询xxx信息")
@ApiImplicitParams({ @ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "Integer"), @ApiImplicitParam(name = "limit", value = "每页记录数", required = true, dataType = "Integer"), @ApiImplicitParam(name = "sortName", value = "排序字段名称", required = true, dataType = "String"), @ApiImplicitParam(name = "sortOrder", value = "排序类型 asc \\ desc", required = true, dataType = "String"), @ApiImplicitParam(name = "demoVo", value = "用户详细实体user", required = true, dataType = "UserVo") })
@ApiResponses({ @ApiResponse(code = HttpStatus.SC_OK, message = "操作成功"), @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = "请求要求身份验证"), @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = "请求资源不存在"), @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = "服务器内部异常"), @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = "权限不足") })
@BusinessLog(module = LogConstant.Module.N01, business = LogConstant.BUSINESS.N010001, opt = BusinessType.SELECT)
@PostMapping(value = "list")
@ResponseBody
public Object list(Integer pageNo, Integer limit, String sortName, String sortOrder, DemoVo demoVo, HttpServletRequest request) throws Exception {
    try {
        Page<DemoModel> pageResult = getDemoService().getPagedList(null);
        List<DemoVo> retList = new ArrayList<DemoVo>();
        for (DemoModel model : pageResult.getRecords()) {
            retList.add(getBeanMapper().map(model, DemoVo.class));
        }
        return new Result<DemoVo>(pageResult, retList);
    } catch (Exception e) {
        logException(this, e);
        return error("");
    }
}
Also used : DemoModel(net.jeebiz.boot.demo.dao.entities.DemoModel) DemoVo(net.jeebiz.boot.demo.web.vo.DemoVo) ArrayList(java.util.ArrayList) Result(net.jeebiz.boot.api.webmvc.Result) ApiImplicitParams(io.swagger.annotations.ApiImplicitParams) BusinessLog(net.jeebiz.boot.api.annotation.BusinessLog) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ApiImplicitParams (io.swagger.annotations.ApiImplicitParams)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 ArrayList (java.util.ArrayList)1 BusinessLog (net.jeebiz.boot.api.annotation.BusinessLog)1 Result (net.jeebiz.boot.api.webmvc.Result)1 DemoModel (net.jeebiz.boot.demo.dao.entities.DemoModel)1 DemoVo (net.jeebiz.boot.demo.web.vo.DemoVo)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1