| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package cn.com.goldenwater.dcproj.controller.tac;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.TacSlbLawBook;
- import cn.com.goldenwater.dcproj.param.TacSlbLawBookParam;
- import cn.com.goldenwater.dcproj.service.TacSlbLawBookService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * @author lune
- * @date 2019-9-25
- */
- @Api(value = "TAC 水利稽察法规管理", tags = "TAC 水利稽察法规管理")
- @RestController
- @RequestMapping("/tac/slb/law/book")
- public class TacSlbLawBookController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private TacSlbLawBookService tacSlbLawBookService;
- @ApiOperation(value = "添加/修改水利稽察法规")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<TacSlbLawBook> insert(@ApiParam(name = "tacSlbLawBook", value = "TacSlbLawBook", required = true) @RequestBody TacSlbLawBook tacSlbLawBook) {
- if (StringUtils.isBlank(tacSlbLawBook.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- tacSlbLawBook.setId(uuid);
- tacSlbLawBookService.insert(tacSlbLawBook);
- } else {
- tacSlbLawBookService.update(tacSlbLawBook);
- }
- return buildSuccessResponse(tacSlbLawBook);
- }
- @ApiOperation(value = "根据ID删除水利稽察法规")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = tacSlbLawBookService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取水利稽察法规(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<TacSlbLawBook> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- TacSlbLawBook tacSlbLawBook = tacSlbLawBookService.get(id);
- return buildSuccessResponse(tacSlbLawBook);
- }
- @ApiOperation(value = "获取水利稽察法规(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<TacSlbLawBook>> list(@ApiParam(name = "tacSlbLawBookParam", value = "tacSlbLawBookParam", required = true) @RequestBody TacSlbLawBookParam tacSlbLawBookParam) {
- List<TacSlbLawBook> tacSlbLawBookList = tacSlbLawBookService.findList(tacSlbLawBookParam);
- return buildSuccessResponse(tacSlbLawBookList);
- }
- @ApiOperation(value = "获取水利稽察法规(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<TacSlbLawBook>> page(@ApiParam(name = "tacSlbLawBookParam", value = "tacSlbLawBookParam", required = true) @RequestBody TacSlbLawBookParam tacSlbLawBookParam) {
- PageInfo<TacSlbLawBook> tacSlbLawBookList = tacSlbLawBookService.findPageInfo(tacSlbLawBookParam);
- return buildSuccessResponse(tacSlbLawBookList);
- }
- }
|