- 在IWmsEmployeeTransferService中新增employeeTransfer方法 - 在WmsEmployeeTransferController中添加transfer接口 - 实现WmsEmployeeTransferServiceImpl中的员工转岗业务逻辑 - 添加事务注解确保数据一致性 - 在查询方法中关联员工信息表获取完整数据 - 验证员工状态确保在职员工才能转岗 - 记录转岗前后的部门和岗位信息 - 更新WmsEmployeeTransferVo以包含员工信息字段
110 lines
3.6 KiB
Java
110 lines
3.6 KiB
Java
package com.klp.controller;
|
|
|
|
import java.util.List;
|
|
import java.util.Arrays;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|
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.validate.AddGroup;
|
|
import com.klp.common.core.validate.EditGroup;
|
|
import com.klp.common.enums.BusinessType;
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
|
import com.klp.domain.vo.WmsEmployeeTransferVo;
|
|
import com.klp.domain.bo.WmsEmployeeTransferBo;
|
|
import com.klp.service.IWmsEmployeeTransferService;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* 员工转岗记录
|
|
*
|
|
* @author klp
|
|
* @date 2026-03-18
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/wms/employeeTransfer")
|
|
public class WmsEmployeeTransferController extends BaseController {
|
|
|
|
private final IWmsEmployeeTransferService iWmsEmployeeTransferService;
|
|
|
|
/**
|
|
* 查询员工转岗记录列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public TableDataInfo<WmsEmployeeTransferVo> list(WmsEmployeeTransferBo bo, PageQuery pageQuery) {
|
|
return iWmsEmployeeTransferService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出员工转岗记录列表
|
|
*/
|
|
@Log(title = "员工转岗记录", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsEmployeeTransferBo bo, HttpServletResponse response) {
|
|
List<WmsEmployeeTransferVo> list = iWmsEmployeeTransferService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "员工转岗记录", WmsEmployeeTransferVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取员工转岗记录详细信息
|
|
*
|
|
* @param transferId 主键
|
|
*/
|
|
@GetMapping("/{transferId}")
|
|
public R<WmsEmployeeTransferVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long transferId) {
|
|
return R.ok(iWmsEmployeeTransferService.queryById(transferId));
|
|
}
|
|
|
|
/**
|
|
* 新增员工转岗记录
|
|
*/
|
|
@Log(title = "员工转岗记录", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsEmployeeTransferBo bo) {
|
|
return toAjax(iWmsEmployeeTransferService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改员工转岗记录
|
|
*/
|
|
@Log(title = "员工转岗记录", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsEmployeeTransferBo bo) {
|
|
return toAjax(iWmsEmployeeTransferService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除员工转岗记录
|
|
*
|
|
* @param transferIds 主键串
|
|
*/
|
|
@Log(title = "员工转岗记录", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{transferIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] transferIds) {
|
|
return toAjax(iWmsEmployeeTransferService.deleteWithValidByIds(Arrays.asList(transferIds), true));
|
|
}
|
|
|
|
/**
|
|
* 员工转岗
|
|
*/
|
|
@Log(title = "员工转岗", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping("/transfer")
|
|
public R<Void> transfer(@Validated(AddGroup.class) @RequestBody WmsEmployeeTransferBo bo) {
|
|
return toAjax(iWmsEmployeeTransferService.employeeTransfer(bo));
|
|
}
|
|
}
|