| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- 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.constValue.SplitValue;
- import cn.com.goldenwater.dcproj.model.TacObjSubject;
- import cn.com.goldenwater.dcproj.param.TacObjSubjectParam;
- import cn.com.goldenwater.dcproj.service.TacObjSubjectService;
- import cn.com.goldenwater.dcproj.utils.InspUtils;
- 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.util.Assert;
- import org.springframework.web.bind.annotation.*;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2019-6-19
- */
- @Api(value = "TAC 稽察单位责任主体性质列表管理", tags = "TAC 稽察单位责任主体性质列表管理")
- @RestController
- @RequestMapping("/tac/obj/subject")
- public class TacObjSubjectController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private TacObjSubjectService tacObjSubjectService;
- @ApiOperation(value = "添加/修改稽察单位责任主体性质")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<TacObjSubject> insert(@ApiParam(name = "tacObjSubject", value = "TacObjSubject", required = true) @RequestBody TacObjSubject tacObjSubject) {
- if (StringUtils.isNotBlank(tacObjSubject.getId())) {
- tacObjSubjectService.update(tacObjSubject);
- } else {
- String uuid = tacObjSubjectService.selectCount();
- tacObjSubject.setId(uuid);
- tacObjSubject.setIntm(new Date());
- int ret = tacObjSubjectService.insert(tacObjSubject);
- }
- return buildSuccessResponse(tacObjSubject);
- }
- @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 = tacObjSubjectService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "更新稽察单位责任主体性质信息")
- @RequestMapping(value = "/update", method = RequestMethod.POST)
- public BaseResponse<TacObjSubject> update(@ApiParam(name = "tacObjSubject", value = "TacObjSubject", required = true) @RequestBody TacObjSubject tacObjSubject) {
- Assert.notNull(tacObjSubject.getId(), "主键id为必填参数");
- int ret = tacObjSubjectService.update(tacObjSubject);
- return buildSuccessResponse(tacObjSubject);
- }
- @ApiOperation(value = "根据ID获取稽察单位责任主体性质(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<TacObjSubject> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- TacObjSubject tacObjSubject = tacObjSubjectService.get(id);
- return buildSuccessResponse(tacObjSubject);
- }
- @ApiOperation(value = "获取最大ID序号")
- @RequestMapping(value = "/selectmax", method = RequestMethod.GET)
- public BaseResponse<String> selectmax() {
- String id = tacObjSubjectService.selectCount();
- return buildSuccessResponse(id);
- }
- @ApiOperation(value = "获取稽察单位责任主体性质(列表)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<TacObjSubject>> list(@RequestBody TacObjSubjectParam objSubjectParam) {
- if (StringUtils.isNotBlank(objSubjectParam.getNote())) {
- objSubjectParam.setNote(InspUtils.getPblmType(objSubjectParam.getNote()) + SplitValue.DOUHAO_SPLIT);
- }
- List<TacObjSubject> tacObjSubject = tacObjSubjectService.findList(objSubjectParam);
- return buildSuccessResponse(tacObjSubject);
- }
- @ApiOperation(value = "获取稽察单位责任主体性质所属类型(列表)")
- @RequestMapping(value = "/listType", method = RequestMethod.GET)
- public BaseResponse<List<TacObjSubject>> listType() {
- List<TacObjSubject> objSubjects = tacObjSubjectService.listType();
- return buildSuccessResponse(objSubjects);
- }
- }
|