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 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 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 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 selectmax() { String id = tacObjSubjectService.selectCount(); return buildSuccessResponse(id); } @ApiOperation(value = "获取稽察单位责任主体性质(列表)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@RequestBody TacObjSubjectParam objSubjectParam) { if (StringUtils.isNotBlank(objSubjectParam.getNote())) { objSubjectParam.setNote(InspUtils.getPblmType(objSubjectParam.getNote()) + SplitValue.DOUHAO_SPLIT); } List tacObjSubject = tacObjSubjectService.findList(objSubjectParam); return buildSuccessResponse(tacObjSubject); } @ApiOperation(value = "获取稽察单位责任主体性质所属类型(列表)") @RequestMapping(value = "/listType", method = RequestMethod.GET) public BaseResponse> listType() { List objSubjects = tacObjSubjectService.listType(); return buildSuccessResponse(objSubjects); } }