63 lines
2.0 KiB
Java
63 lines
2.0 KiB
Java
package com.klp.hrm.controller;
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import com.klp.common.annotation.Log;
|
|
import com.klp.common.core.controller.BaseController;
|
|
import com.klp.common.core.domain.PageQuery;
|
|
import com.klp.common.core.domain.R;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
import com.klp.common.enums.BusinessType;
|
|
import com.klp.hrm.domain.bo.HrmShiftBo;
|
|
import com.klp.hrm.domain.vo.HrmShiftVo;
|
|
import com.klp.hrm.service.IHrmShiftService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
import javax.validation.constraints.NotNull;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/hrm/shift")
|
|
public class HrmShiftController extends BaseController {
|
|
|
|
private final IHrmShiftService service;
|
|
|
|
@GetMapping("/list")
|
|
public TableDataInfo<HrmShiftVo> list(HrmShiftBo bo, PageQuery pageQuery) {
|
|
return service.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
@GetMapping("/{shiftId}")
|
|
public R<HrmShiftVo> getInfo(@PathVariable @NotNull Long shiftId) {
|
|
return R.ok(service.queryById(shiftId));
|
|
}
|
|
|
|
@Log(title = "班次", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
public R<Void> add(@Validated @RequestBody HrmShiftBo bo) {
|
|
return toAjax(service.insertByBo(bo));
|
|
}
|
|
|
|
@Log(title = "班次", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
public R<Void> edit(@Validated @RequestBody HrmShiftBo bo) {
|
|
return toAjax(service.updateByBo(bo));
|
|
}
|
|
|
|
@Log(title = "班次", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{shiftIds}")
|
|
public R<Void> remove(@PathVariable @NotEmpty Long[] shiftIds) {
|
|
return toAjax(service.deleteWithValidByIds(Arrays.asList(shiftIds), true));
|
|
}
|
|
|
|
@GetMapping("/all")
|
|
public R<List<HrmShiftVo>> all(HrmShiftBo bo) {
|
|
return R.ok(service.queryList(bo));
|
|
}
|
|
}
|