|
@@ -0,0 +1,115 @@
|
|
|
+package com.ruoyi.web.controller.zhdd;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.ruoyi.zhdd.domain.DutyEmp;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.constraints.*;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import com.ruoyi.common.annotation.RepeatSubmit;
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.validate.AddGroup;
|
|
|
+import com.ruoyi.common.core.validate.EditGroup;
|
|
|
+import com.ruoyi.common.core.validate.QueryGroup;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import com.ruoyi.zhdd.domain.vo.DutyEmpVo;
|
|
|
+import com.ruoyi.zhdd.domain.bo.DutyEmpBo;
|
|
|
+import com.ruoyi.zhdd.service.IDutyEmpService;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 值班排班信息Controller
|
|
|
+ *
|
|
|
+ * @author xintong
|
|
|
+ * @date 2021-10-11
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@Api(value = "值班排班信息控制器", tags = {"值班排班信息管理"})
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/zhdd/dutyEmp")
|
|
|
+public class DutyEmpController extends BaseController {
|
|
|
+
|
|
|
+ private final IDutyEmpService iDutyEmpService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询值班排班信息列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询值班排班信息列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:dutyEmp:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public AjaxResult<List<DutyEmpVo>> list(@Validated(QueryGroup.class) DutyEmpBo bo) {
|
|
|
+ return AjaxResult.success(iDutyEmpService.listVo(Wrappers.<DutyEmp>lambdaQuery().orderByAsc(DutyEmp::getPeriod)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出值班排班信息列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出值班排班信息列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:dutyEmp:export')")
|
|
|
+ @Log(title = "值班排班信息", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public void export(@Validated DutyEmpBo bo, HttpServletResponse response) {
|
|
|
+ List<DutyEmpVo> list = iDutyEmpService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "值班排班信息", DutyEmpVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取值班排班信息详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取值班排班信息详细信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:dutyEmp:query')")
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public AjaxResult<DutyEmpVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable("id") Long id) {
|
|
|
+ return AjaxResult.success(iDutyEmpService.queryById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增值班排班信息
|
|
|
+ */
|
|
|
+ @ApiOperation("新增值班排班信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:dutyEmp:add')")
|
|
|
+ @Log(title = "值班排班信息", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody DutyEmpBo bo) {
|
|
|
+ return toAjax(iDutyEmpService.insertByBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改值班排班信息
|
|
|
+ */
|
|
|
+ @ApiOperation("修改值班排班信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:dutyEmp:edit')")
|
|
|
+ @Log(title = "值班排班信息", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody DutyEmpBo bo) {
|
|
|
+ return toAjax(iDutyEmpService.updateByBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除值班排班信息
|
|
|
+ */
|
|
|
+ @ApiOperation("删除值班排班信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:dutyEmp:remove')")
|
|
|
+ @Log(title = "值班排班信息" , businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable Long[] ids) {
|
|
|
+ return toAjax(iDutyEmpService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
|
|
+ }
|
|
|
+}
|