| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- package cn.com.goldenwater.dcproj.controller.hyst;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.dto.BisInspHystRgstrDto;
- import cn.com.goldenwater.dcproj.model.BisInspHystInfo;
- import cn.com.goldenwater.dcproj.model.BisInspHystRgstr;
- import cn.com.goldenwater.dcproj.param.BisInspHystInfoParam;
- import cn.com.goldenwater.dcproj.param.BisInspHystRgstrParam;
- import cn.com.goldenwater.dcproj.param.TypeParam;
- import cn.com.goldenwater.dcproj.service.BisInspHystInfoService;
- import cn.com.goldenwater.dcproj.service.BisInspHystRgstrService;
- 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.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2021-3-2
- */
- @Api(value = "BIS 小水电县级督查登记表管理", tags = "BIS 小水电县级督查登记表管理")
- @RestController
- @RequestMapping("/bis/insp/hyst/rgstr")
- public class BisInspHystRgstrController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspHystRgstrService bisInspHystRgstrService;
- @Autowired
- private BisInspHystInfoService bisInspHystInfoService;
- @ApiOperation(value = "添加/修改小水电县级督查登记表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspHystRgstr> insert(@ApiParam(name = "bisInspHystRgstr", value = "BisInspHystRgstr", required = true) @RequestBody BisInspHystRgstr bisInspHystRgstr) {
- if (StringUtils.isBlank(bisInspHystRgstr.getId())) {
- // 生成uuid
- String uuid = UuidUtil.uuid();
- bisInspHystRgstr.setId(uuid);
- bisInspHystRgstr.setIntm(new Date());
- bisInspHystRgstrService.insert(bisInspHystRgstr);
- } else {
- bisInspHystRgstr.setUptm(new Date());
- bisInspHystRgstrService.update(bisInspHystRgstr);
- }
- //更新注册表状态
- return buildSuccessResponse(bisInspHystRgstr);
- }
- @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 = bisInspHystRgstrService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取小水电县级督查登记表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspHystRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspHystRgstr bisInspHystRgstr = bisInspHystRgstrService.get(id);
- //返回小水电列表
- BisInspHystInfoParam bisInspHystInfoParam = new BisInspHystInfoParam();
- bisInspHystInfoParam.setRgstrId(id);
- List<BisInspHystInfo> list = bisInspHystInfoService.findList(bisInspHystInfoParam);
- bisInspHystRgstr.setHtstList(list);
- return buildSuccessResponse(bisInspHystRgstr);
- }
- @ApiOperation(value = "获取小水电县级督查登记表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspHystRgstr>> list(@ApiParam(name = "bisInspHystRgstrParam", value = "bisInspHystRgstrParam", required = true) @RequestBody BisInspHystRgstrParam bisInspHystRgstrParam) {
- List<BisInspHystRgstr> bisInspHystRgstrList = bisInspHystRgstrService.findList(bisInspHystRgstrParam);
- return buildSuccessResponse(bisInspHystRgstrList);
- }
- @ApiOperation(value = "获取小水电县级督查登记表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspHystRgstr>> page(@ApiParam(name = "bisInspHystRgstrParam", value = "bisInspHystRgstrParam", required = true) @RequestBody BisInspHystRgstrParam bisInspHystRgstrParam) {
- PageInfo<BisInspHystRgstr> bisInspHystRgstrList = bisInspHystRgstrService.findPageInfo(bisInspHystRgstrParam);
- return buildSuccessResponse(bisInspHystRgstrList);
- }
- @ApiOperation(value = "获取督查登记表列表")
- @RequestMapping(value = "/findHystPage", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspHystRgstrDto>> findHystPage(@RequestBody TypeParam param) {
- return buildSuccessResponse(bisInspHystRgstrService.findHystPage(param));
- }
- }
|