feat(wms): 添加岗位和岗位职责管理功能
- 创建岗位实体类 WmsPost 和岗位职责实体类 WmsPostDuty - 实现岗位和岗位职责的业务对象 BO 和视图对象 VO - 开发岗位和岗位职责的服务接口及实现类 - 添加岗位和岗位职责的控制器提供 REST API 接口 - 配置 MyBatis Plus 的 Mapper 接口和 XML 映射文件 - 实现岗位和岗位职责的增删改查、分页查询和导出功能 - 添加数据验证、日志记录和防止重复提交功能
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
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.WmsPostDutyVo;
|
||||
import com.klp.domain.bo.WmsPostDutyBo;
|
||||
import com.klp.service.IWmsPostDutyService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 岗位职责
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-15
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/postDuty")
|
||||
public class WmsPostDutyController extends BaseController {
|
||||
|
||||
private final IWmsPostDutyService iWmsPostDutyService;
|
||||
|
||||
/**
|
||||
* 查询岗位职责列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsPostDutyVo> list(WmsPostDutyBo bo, PageQuery pageQuery) {
|
||||
return iWmsPostDutyService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出岗位职责列表
|
||||
*/
|
||||
@Log(title = "岗位职责", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsPostDutyBo bo, HttpServletResponse response) {
|
||||
List<WmsPostDutyVo> list = iWmsPostDutyService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "岗位职责", WmsPostDutyVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位职责详细信息
|
||||
*
|
||||
* @param dutyId 主键
|
||||
*/
|
||||
@GetMapping("/{dutyId}")
|
||||
public R<WmsPostDutyVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long dutyId) {
|
||||
return R.ok(iWmsPostDutyService.queryById(dutyId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位职责
|
||||
*/
|
||||
@Log(title = "岗位职责", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsPostDutyBo bo) {
|
||||
return toAjax(iWmsPostDutyService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位职责
|
||||
*/
|
||||
@Log(title = "岗位职责", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsPostDutyBo bo) {
|
||||
return toAjax(iWmsPostDutyService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位职责
|
||||
*
|
||||
* @param dutyIds 主键串
|
||||
*/
|
||||
@Log(title = "岗位职责", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dutyIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] dutyIds) {
|
||||
return toAjax(iWmsPostDutyService.deleteWithValidByIds(Arrays.asList(dutyIds), true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user