Search in sources :

Example 1 with BusinessLog

use of net.jeebiz.boot.api.annotation.BusinessLog in project spring-boot-starter-samples by vindell.

the class DemoController method newDemo.

/**
 * 增加逻辑实现
 */
@ApiOperation(value = "创建xxx信息", notes = "根据DemoVo创建xxx", httpMethod = "POST")
@ApiImplicitParam(name = "demoVo", value = "xxx数据传输对象", required = true, dataType = "DemoVo")
@BusinessLog(module = LogConstant.Module.N01, business = LogConstant.BUSINESS.N010001, opt = BusinessType.INSERT)
@PostMapping("new/form")
@ResponseBody
public Object newDemo(@Valid DemoVo demoVo) {
    try {
        DemoModel demoModel = new DemoModel();
        // 如果自己较少,采用手动设置方式
        demoModel.setName(demoVo.getName());
        // 如果自动较多,采用对象拷贝方式;该方式不支持文件对象拷贝
        // PropertyUtils.copyProperties(demoModel, demoVo);
        getDemoService().insert(demoModel);
        return success("I99001");
    } catch (Exception e) {
        logException(this, e);
        return fail("I99002");
    }
}
Also used : DemoModel(net.jeebiz.boot.demo.dao.entities.DemoModel) BusinessLog(net.jeebiz.boot.api.annotation.BusinessLog) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation) ApiImplicitParam(io.swagger.annotations.ApiImplicitParam) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with BusinessLog

use of net.jeebiz.boot.api.annotation.BusinessLog in project spring-boot-starter-samples by vindell.

the class DemoController method editDemo.

/**
 * 修改逻辑实现
 */
@ApiOperation(value = "修改xxx信息", notes = "修改xxx", httpMethod = "POST")
@ApiImplicitParam(name = "demoVo", value = "xxx数据传输对象", required = true, dataType = "DemoVo")
@BusinessLog(module = LogConstant.Module.N01, business = LogConstant.BUSINESS.N010001, opt = BusinessType.UPDATE)
@RequestMapping("edit/form")
@ResponseBody
public Object editDemo(@Valid DemoVo demoVo) throws Exception {
    try {
        DemoModel demoModel = new DemoModel();
        // 如果自己较少,采用手动设置方式
        demoModel.setName(demoVo.getName());
        // 如果自动较多,采用对象拷贝方式;该方式不支持文件对象拷贝
        // PropertyUtils.copyProperties(demoModel, demoVo);
        getDemoService().update(demoModel);
        return success("I99003");
    } catch (Exception e) {
        logException(this, e);
        return fail("I99004");
    }
}
Also used : DemoModel(net.jeebiz.boot.demo.dao.entities.DemoModel) BusinessLog(net.jeebiz.boot.api.annotation.BusinessLog) ApiOperation(io.swagger.annotations.ApiOperation) ApiImplicitParam(io.swagger.annotations.ApiImplicitParam) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with BusinessLog

use of net.jeebiz.boot.api.annotation.BusinessLog in project spring-boot-starter-samples by vindell.

the class DemoController method newSimple.

/**
 * 增加逻辑实现
 */
@ApiOperation(value = "创建xxx信息", notes = "根据DemoVo创建xxx", httpMethod = "POST")
@ApiImplicitParam(name = "demoVo", value = "xxx数据传输对象", required = true, dataType = "DemoVo")
@BusinessLog(module = LogConstant.Module.N01, business = LogConstant.BUSINESS.N010001, opt = BusinessType.INSERT)
@PostMapping("new/form")
@ResponseBody
public Object newSimple(@Valid DemoVo demoVo) {
    try {
        DemoModel demoModel = new DemoModel();
        // 如果自己较少,采用手动设置方式
        demoModel.setName(demoVo.getName());
        // 如果自动较多,采用对象拷贝方式;该方式不支持文件对象拷贝
        // PropertyUtils.copyProperties(demoModel, demoVo);
        getDemoService().insert(demoModel);
        return success("I99001");
    } catch (Exception e) {
        logException(this, e);
        return fail("I99002");
    }
}
Also used : DemoModel(net.jeebiz.boot.demo.dao.entities.DemoModel) BusinessLog(net.jeebiz.boot.api.annotation.BusinessLog) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation) ApiImplicitParam(io.swagger.annotations.ApiImplicitParam) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with BusinessLog

use of net.jeebiz.boot.api.annotation.BusinessLog 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)

Example 5 with BusinessLog

use of net.jeebiz.boot.api.annotation.BusinessLog in project spring-boot-starter-samples by vindell.

the class DemoController method editSimple.

/**
 * 修改逻辑实现
 */
@ApiOperation(value = "修改xxx信息", notes = "修改xxx", httpMethod = "POST")
@ApiImplicitParam(name = "demoVo", value = "xxx数据传输对象", required = true, dataType = "DemoVo")
@BusinessLog(module = LogConstant.Module.N01, business = LogConstant.BUSINESS.N010001, opt = BusinessType.UPDATE)
@RequestMapping("edit/form")
@ResponseBody
public Object editSimple(@Valid DemoVo demoVo) throws Exception {
    try {
        DemoModel demoModel = new DemoModel();
        // 如果自己较少,采用手动设置方式
        demoModel.setName(demoVo.getName());
        // 如果自动较多,采用对象拷贝方式;该方式不支持文件对象拷贝
        // PropertyUtils.copyProperties(demoModel, demoVo);
        getDemoService().update(demoModel);
        return success("I99003");
    } catch (Exception e) {
        logException(this, e);
        return fail("I99004");
    }
}
Also used : DemoModel(net.jeebiz.boot.demo.dao.entities.DemoModel) BusinessLog(net.jeebiz.boot.api.annotation.BusinessLog) ApiOperation(io.swagger.annotations.ApiOperation) ApiImplicitParam(io.swagger.annotations.ApiImplicitParam) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

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