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 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 get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspHystRgstr bisInspHystRgstr = bisInspHystRgstrService.get(id); //返回小水电列表 BisInspHystInfoParam bisInspHystInfoParam = new BisInspHystInfoParam(); bisInspHystInfoParam.setRgstrId(id); List list = bisInspHystInfoService.findList(bisInspHystInfoParam); bisInspHystRgstr.setHtstList(list); return buildSuccessResponse(bisInspHystRgstr); } @ApiOperation(value = "获取小水电县级督查登记表(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "bisInspHystRgstrParam", value = "bisInspHystRgstrParam", required = true) @RequestBody BisInspHystRgstrParam bisInspHystRgstrParam) { List bisInspHystRgstrList = bisInspHystRgstrService.findList(bisInspHystRgstrParam); return buildSuccessResponse(bisInspHystRgstrList); } @ApiOperation(value = "获取小水电县级督查登记表(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "bisInspHystRgstrParam", value = "bisInspHystRgstrParam", required = true) @RequestBody BisInspHystRgstrParam bisInspHystRgstrParam) { PageInfo bisInspHystRgstrList = bisInspHystRgstrService.findPageInfo(bisInspHystRgstrParam); return buildSuccessResponse(bisInspHystRgstrList); } @ApiOperation(value = "获取督查登记表列表") @RequestMapping(value = "/findHystPage", method = RequestMethod.POST) public BaseResponse> findHystPage(@RequestBody TypeParam param) { return buildSuccessResponse(bisInspHystRgstrService.findHystPage(param)); } }