| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- 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.TacInspBatch;
- import cn.com.goldenwater.dcproj.param.TacInspBatchParam;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.service.TacInspBatchService;
- 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-6
- */
- @Api(value = "TAC 稽察批次字典表管理", tags = "TAC 稽察批次字典表管理")
- @RestController
- @RequestMapping("/tac/insp/batch")
- public class TacInspBatchController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private TacInspBatchService tacInspBatchService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "添加/修改稽察批次字典表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<TacInspBatch> insert(@ApiParam(name = "tacInspBatch", value = "TacInspBatch", required = true) @RequestBody TacInspBatch tacInspBatch) {
- tacInspBatch.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- if (StringUtils.isBlank(tacInspBatch.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- tacInspBatch.setId(uuid);
- tacInspBatchService.insert(tacInspBatch);
- } else {
- tacInspBatchService.update(tacInspBatch);
- }
- return buildSuccessResponse(tacInspBatch);
- }
- @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 = tacInspBatchService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取稽察批次字典表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<TacInspBatch> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- TacInspBatch tacInspBatch = tacInspBatchService.get(id);
- return buildSuccessResponse(tacInspBatch);
- }
- @ApiOperation(value = "获取稽察批次字典表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<TacInspBatch>> list(@ApiParam(name = "tacInspBatchParam", value = "tacInspBatchParam", required = true) @RequestBody TacInspBatchParam tacInspBatchParam) {
- tacInspBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- List<TacInspBatch> tacInspBatchList = tacInspBatchService.findList(tacInspBatchParam);
- return buildSuccessResponse(tacInspBatchList);
- }
- @ApiOperation(value = "获取稽察批次字典表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<TacInspBatch>> page(@ApiParam(name = "tacInspBatchParam", value = "tacInspBatchParam", required = true) @RequestBody TacInspBatchParam tacInspBatchParam) {
- tacInspBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- PageInfo<TacInspBatch> tacInspBatchList = tacInspBatchService.findPageInfo(tacInspBatchParam);
- return buildSuccessResponse(tacInspBatchList);
- }
- @ApiOperation(value = "根据年度获取稽察批次列表")
- @RequestMapping(value = "/getBatchListByYear", method = RequestMethod.POST)
- public BaseResponse<List<TacInspBatch>> getBatchListByYear(@RequestBody TacInspBatchParam tacInspBatchParam) {
- tacInspBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- List<TacInspBatch> list = tacInspBatchService.getBatchListByYear(tacInspBatchParam);
- return buildSuccessResponse(list);
- }
- }
|