- 修改所有实体类中的ID字段类型从String改为Long - 更新所有服务接口和实现类的方法参数类型 - 调整控制器中的路径变量类型以匹配新的ID类型 - 修正查询条件判断逻辑,从字符串非空检查改为数值非空检查 - 更新数据传输对象中的ID字段类型保持一致性
100 lines
3.1 KiB
Java
100 lines
3.1 KiB
Java
package com.klp.perf.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.perf.domain.vo.PerfSalaryVo;
|
|
import com.klp.perf.domain.bo.PerfSalaryBo;
|
|
import com.klp.perf.service.IPerfSalaryService;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* 月度薪资计算记录
|
|
*
|
|
* @author klp
|
|
* @date 2026-07-07
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/perf/salary")
|
|
public class PerfSalaryController extends BaseController {
|
|
|
|
private final IPerfSalaryService iPerfSalaryService;
|
|
|
|
/**
|
|
* 查询月度薪资计算记录列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public TableDataInfo<PerfSalaryVo> list(PerfSalaryBo bo, PageQuery pageQuery) {
|
|
return iPerfSalaryService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出月度薪资计算记录列表
|
|
*/
|
|
@Log(title = "月度薪资计算记录", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(PerfSalaryBo bo, HttpServletResponse response) {
|
|
List<PerfSalaryVo> list = iPerfSalaryService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "月度薪资计算记录", PerfSalaryVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取月度薪资计算记录详细信息
|
|
*
|
|
* @param id 主键
|
|
*/
|
|
@GetMapping("/{id}")
|
|
public R<PerfSalaryVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long id) {
|
|
return R.ok(iPerfSalaryService.queryById(id));
|
|
}
|
|
|
|
/**
|
|
* 新增月度薪资计算记录
|
|
*/
|
|
@Log(title = "月度薪资计算记录", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody PerfSalaryBo bo) {
|
|
return toAjax(iPerfSalaryService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改月度薪资计算记录
|
|
*/
|
|
@Log(title = "月度薪资计算记录", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PerfSalaryBo bo) {
|
|
return toAjax(iPerfSalaryService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除月度薪资计算记录
|
|
*
|
|
* @param ids 主键串
|
|
*/
|
|
@Log(title = "月度薪资计算记录", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{ids}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] ids) {
|
|
return toAjax(iPerfSalaryService.deleteWithValidByIds(Arrays.asList(ids), true));
|
|
}
|
|
}
|