db88b06c881c23ee2efd553f370d178cc4fc9468.svn-base 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package cn.com.goldenwater.dcproj.controller.safety;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.AttSafetyBase;
  5. import cn.com.goldenwater.dcproj.service.AttSafetyBaseService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import io.swagger.annotations.ApiParam;
  9. import org.apache.commons.lang.StringUtils;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. /**
  15. * @author lhc
  16. * @date 2021-3-11
  17. */
  18. @Api(value = "xxx管理", tags = "xxx管理")
  19. @RestController
  20. @RequestMapping("/att/safety/base")
  21. public class AttSafetyBaseController extends BaseController {
  22. private Logger logger = LoggerFactory.getLogger(getClass());
  23. @Autowired
  24. private AttSafetyBaseService attSafetyBaseService;
  25. @ApiOperation(value = "修改xxx")
  26. @RequestMapping(value = "", method = RequestMethod.POST)
  27. public BaseResponse<AttSafetyBase> insert(@ApiParam(name = "attSafetyBase", value = "AttSafetyBase", required = true) @RequestBody AttSafetyBase attSafetyBase) {
  28. int ret = 0;
  29. if (StringUtils.isBlank(attSafetyBase.getId())) {
  30. ret = attSafetyBaseService.insert(attSafetyBase);
  31. } else {
  32. ret = attSafetyBaseService.update(attSafetyBase);
  33. }
  34. return buildSuccessResponse(attSafetyBase);
  35. }
  36. @ApiOperation(value = "根据ID删除xxx")
  37. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  38. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  39. int ret = attSafetyBaseService.delete(id);
  40. return buildSuccessResponse();
  41. }
  42. @ApiOperation(value = "根据ID获取xxx(单表)")
  43. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  44. public BaseResponse<AttSafetyBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  45. AttSafetyBase attSafetyBase = attSafetyBaseService.get(id);
  46. return buildSuccessResponse(attSafetyBase);
  47. }
  48. @ApiOperation(value = "根据 objId 获取基本信息(单表)")
  49. @RequestMapping(value = "/getObjId/{objId}", method = {RequestMethod.GET, RequestMethod.POST})
  50. public BaseResponse<AttSafetyBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true)
  51. @PathVariable String objId) {
  52. return buildSuccessResponse(attSafetyBaseService.getObjId(objId));
  53. }
  54. }