JgyDutyCommandContController.java 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.ruoyi.web.controller.zhdd;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import java.util.concurrent.TimeUnit;
  5. import lombok.RequiredArgsConstructor;
  6. import javax.servlet.http.HttpServletResponse;
  7. import javax.validation.constraints.*;
  8. import org.springframework.security.access.prepost.PreAuthorize;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import org.springframework.validation.annotation.Validated;
  12. import com.ruoyi.common.annotation.RepeatSubmit;
  13. import com.ruoyi.common.annotation.Log;
  14. import com.ruoyi.common.core.controller.BaseController;
  15. import com.ruoyi.common.core.domain.AjaxResult;
  16. import com.ruoyi.common.core.validate.AddGroup;
  17. import com.ruoyi.common.core.validate.EditGroup;
  18. import com.ruoyi.common.core.validate.QueryGroup;
  19. import com.ruoyi.common.enums.BusinessType;
  20. import com.ruoyi.common.utils.poi.ExcelUtil;
  21. import com.ruoyi.zhdd.domain.vo.JgyDutyCommandContVo;
  22. import com.ruoyi.zhdd.domain.bo.JgyDutyCommandContBo;
  23. import com.ruoyi.zhdd.service.IJgyDutyCommandContService;
  24. import com.ruoyi.common.core.page.TableDataInfo;
  25. import io.swagger.annotations.Api;
  26. import io.swagger.annotations.ApiOperation;
  27. /**
  28. * 日常值班登记Controller
  29. *
  30. * @author ruoyi
  31. * @date 2021-09-22
  32. */
  33. @Validated
  34. @Api(value = "日常值班登记控制器", tags = {"日常值班登记管理"})
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/zhdd/dutyCommandCont")
  38. public class JgyDutyCommandContController extends BaseController {
  39. private final IJgyDutyCommandContService iJgyDutyCommandContService;
  40. /**
  41. * 查询日常值班登记列表
  42. */
  43. @ApiOperation("查询日常值班登记列表")
  44. @PreAuthorize("@ss.hasPermi('zhdd:dutyCommandCont:list')")
  45. @GetMapping("/list")
  46. public TableDataInfo<JgyDutyCommandContVo> list(@Validated(QueryGroup.class) JgyDutyCommandContBo bo) {
  47. return iJgyDutyCommandContService.queryPageList(bo);
  48. }
  49. /**
  50. * 导出日常值班登记列表
  51. */
  52. @ApiOperation("导出日常值班登记列表")
  53. @PreAuthorize("@ss.hasPermi('zhdd:dutyCommandCont:export')")
  54. @Log(title = "日常值班登记", businessType = BusinessType.EXPORT)
  55. @GetMapping("/export")
  56. public void export(@Validated JgyDutyCommandContBo bo, HttpServletResponse response) {
  57. List<JgyDutyCommandContVo> list = iJgyDutyCommandContService.queryList(bo);
  58. ExcelUtil.exportExcel(list, "日常值班登记", JgyDutyCommandContVo.class, response);
  59. }
  60. /**
  61. * 获取日常值班登记详细信息
  62. */
  63. @ApiOperation("获取日常值班登记详细信息")
  64. @PreAuthorize("@ss.hasPermi('zhdd:dutyCommandCont:query')")
  65. @GetMapping("/{duId}")
  66. public AjaxResult<JgyDutyCommandContVo> getInfo(@NotNull(message = "主键不能为空")
  67. @PathVariable("duId") Long duId) {
  68. return AjaxResult.success(iJgyDutyCommandContService.queryById(duId));
  69. }
  70. /**
  71. * 新增日常值班登记
  72. */
  73. @ApiOperation("新增日常值班登记")
  74. @PreAuthorize("@ss.hasPermi('zhdd:dutyCommandCont:add')")
  75. @Log(title = "日常值班登记", businessType = BusinessType.INSERT)
  76. @RepeatSubmit()
  77. @PostMapping()
  78. public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody JgyDutyCommandContBo bo) {
  79. return toAjax(iJgyDutyCommandContService.insertByBo(bo) ? 1 : 0);
  80. }
  81. /**
  82. * 修改日常值班登记
  83. */
  84. @ApiOperation("修改日常值班登记")
  85. @PreAuthorize("@ss.hasPermi('zhdd:dutyCommandCont:edit')")
  86. @Log(title = "日常值班登记", businessType = BusinessType.UPDATE)
  87. @RepeatSubmit()
  88. @PutMapping()
  89. public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody JgyDutyCommandContBo bo) {
  90. return toAjax(iJgyDutyCommandContService.updateByBo(bo) ? 1 : 0);
  91. }
  92. /**
  93. * 删除日常值班登记
  94. */
  95. @ApiOperation("删除日常值班登记")
  96. @PreAuthorize("@ss.hasPermi('zhdd:dutyCommandCont:remove')")
  97. @Log(title = "日常值班登记" , businessType = BusinessType.DELETE)
  98. @DeleteMapping("/{duIds}")
  99. public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
  100. @PathVariable Long[] duIds) {
  101. return toAjax(iJgyDutyCommandContService.deleteWithValidByIds(Arrays.asList(duIds), true) ? 1 : 0);
  102. }
  103. }