|
|
@@ -0,0 +1,126 @@
|
|
|
+
|
|
|
+package org.sky.scientific.controller;
|
|
|
+
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import jakarta.validation.Valid;
|
|
|
+
|
|
|
+import org.sky.core.excel.util.ExcelUtil;
|
|
|
+import org.sky.core.mp.support.Condition;
|
|
|
+import org.sky.core.mp.support.Query;
|
|
|
+import org.sky.core.secure.KdUser;
|
|
|
+import org.sky.core.secure.annotation.IsAdmin;
|
|
|
+import org.sky.core.tool.api.R;
|
|
|
+import org.sky.core.tool.utils.DateUtil;
|
|
|
+import org.sky.core.tool.utils.Func;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import org.sky.scientific.pojo.entity.SalaryEntity;
|
|
|
+import org.sky.scientific.pojo.vo.SalaryVO;
|
|
|
+import org.sky.scientific.excel.SalaryExcel;
|
|
|
+import org.sky.scientific.wrapper.SalaryWrapper;
|
|
|
+import org.sky.scientific.service.ISalaryService;
|
|
|
+import org.sky.core.boot.ctrl.KdController;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.List;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 技术人员工资表 控制器
|
|
|
+ *
|
|
|
+ * @author Kd
|
|
|
+ * @since 2025-06-19
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/salary")
|
|
|
+@Tag(name = "技术人员工资表", description = "技术人员工资表接口")
|
|
|
+public class SalaryController extends KdController {
|
|
|
+
|
|
|
+ private final ISalaryService salaryService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 技术人员工资表 详情
|
|
|
+ */
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @Operation(summary = "详情", description = "传入salary")
|
|
|
+ public R<SalaryVO> detail(SalaryEntity salary) {
|
|
|
+ SalaryEntity detail = salaryService.getOne(Condition.getQueryWrapper(salary));
|
|
|
+ return R.data(SalaryWrapper.build().entityVO(detail));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 技术人员工资表 自定义分页
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @Operation(summary = "分页", description = "传入salary")
|
|
|
+ public R<IPage<SalaryVO>> page(SalaryVO salary, Query query) {
|
|
|
+ IPage<SalaryVO> pages = salaryService.selectSalaryPage(Condition.getPage(query), salary);
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 技术人员工资表 新增
|
|
|
+ */
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @Operation(summary = "新增", description = "传入salary")
|
|
|
+ public R save(@Valid @RequestBody SalaryEntity salary) {
|
|
|
+ return R.status(salaryService.saveSalary(salary));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 技术人员工资表 修改
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @Operation(summary = "修改", description = "传入salary")
|
|
|
+ public R update(@Valid @RequestBody SalaryEntity salary) {
|
|
|
+ return R.status(salaryService.updateById(salary));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 技术人员工资表 新增或修改
|
|
|
+ */
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @Operation(summary = "新增或修改", description = "传入salary")
|
|
|
+ public R submit(@Valid @RequestBody SalaryEntity salary) {
|
|
|
+ return R.status(salaryService.saveOrUpdate(salary));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 技术人员工资表 删除
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
+ @Operation(summary = "逻辑删除", description = "传入ids")
|
|
|
+ public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ return R.status(salaryService.deleteLogic(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出数据
|
|
|
+ */
|
|
|
+ @IsAdmin
|
|
|
+ @GetMapping("/export-salary")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @Operation(summary = "导出数据", description = "传入salary")
|
|
|
+ public void exportSalary(@Parameter(hidden = true) @RequestParam Map<String, Object> salary, KdUser kdUser, HttpServletResponse response) {
|
|
|
+ QueryWrapper<SalaryEntity> queryWrapper = Condition.getQueryWrapper(salary, SalaryEntity.class);
|
|
|
+ //if (!AuthUtil.isAdministrator()) {
|
|
|
+ // queryWrapper.lambda().eq(Salary::getTenantId, kdUser.getTenantId());
|
|
|
+ //}
|
|
|
+ //queryWrapper.lambda().eq(SalaryEntity::getIsDeleted, KdConstant.DB_NOT_DELETED);
|
|
|
+ List<SalaryExcel> list = salaryService.exportSalary(queryWrapper);
|
|
|
+ ExcelUtil.export(response, "技术人员工资表数据" + DateUtil.time(), "技术人员工资表数据表", list, SalaryExcel.class);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|