63 lines
2.1 KiB
Java
63 lines
2.1 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.HrmContractBo;
|
||
|
|
import com.klp.hrm.domain.vo.HrmContractVo;
|
||
|
|
import com.klp.hrm.service.IHrmContractService;
|
||
|
|
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/contract")
|
||
|
|
public class HrmContractController extends BaseController {
|
||
|
|
|
||
|
|
private final IHrmContractService service;
|
||
|
|
|
||
|
|
@GetMapping("/list")
|
||
|
|
public TableDataInfo<HrmContractVo> list(HrmContractBo bo, PageQuery pageQuery) {
|
||
|
|
return service.queryPageList(bo, pageQuery);
|
||
|
|
}
|
||
|
|
|
||
|
|
@GetMapping("/{contractId}")
|
||
|
|
public R<HrmContractVo> getInfo(@PathVariable @NotNull Long contractId) {
|
||
|
|
return R.ok(service.queryById(contractId));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Log(title = "劳动合同", businessType = BusinessType.INSERT)
|
||
|
|
@PostMapping
|
||
|
|
public R<Void> add(@Validated @RequestBody HrmContractBo bo) {
|
||
|
|
return toAjax(service.insertByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Log(title = "劳动合同", businessType = BusinessType.UPDATE)
|
||
|
|
@PutMapping
|
||
|
|
public R<Void> edit(@Validated @RequestBody HrmContractBo bo) {
|
||
|
|
return toAjax(service.updateByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Log(title = "劳动合同", businessType = BusinessType.DELETE)
|
||
|
|
@DeleteMapping("/{contractIds}")
|
||
|
|
public R<Void> remove(@PathVariable @NotEmpty Long[] contractIds) {
|
||
|
|
return toAjax(service.deleteWithValidByIds(Arrays.asList(contractIds), true));
|
||
|
|
}
|
||
|
|
|
||
|
|
@GetMapping("/all")
|
||
|
|
public R<List<HrmContractVo>> all(HrmContractBo bo) {
|
||
|
|
return R.ok(service.queryList(bo));
|
||
|
|
}
|
||
|
|
}
|