22 changed files with 676 additions and 6 deletions
@ -0,0 +1,105 @@ |
|||
package org.dromara.platform.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.platform.domain.vo.PerformanceManagementVo; |
|||
import org.dromara.platform.domain.bo.PerformanceManagementBo; |
|||
import org.dromara.platform.service.IPerformanceManagementService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 考核管理 |
|||
* |
|||
* @author gejunhao |
|||
* @date 2025-04-21 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/platform/management") |
|||
public class PerformanceManagementController extends BaseController { |
|||
|
|||
private final IPerformanceManagementService performanceManagementService; |
|||
|
|||
/** |
|||
* 查询考核管理列表 |
|||
*/ |
|||
@SaCheckPermission("platform:management:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<PerformanceManagementVo> list(PerformanceManagementBo bo, PageQuery pageQuery) { |
|||
return performanceManagementService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出考核管理列表 |
|||
*/ |
|||
@SaCheckPermission("platform:management:export") |
|||
@Log(title = "考核管理", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(PerformanceManagementBo bo, HttpServletResponse response) { |
|||
List<PerformanceManagementVo> list = performanceManagementService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "考核管理", PerformanceManagementVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取考核管理详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("platform:management:query") |
|||
@GetMapping("/{id}") |
|||
public R<PerformanceManagementVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable String id) { |
|||
return R.ok(performanceManagementService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增考核管理 |
|||
*/ |
|||
@SaCheckPermission("platform:management:add") |
|||
@Log(title = "考核管理", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody PerformanceManagementBo bo) { |
|||
return toAjax(performanceManagementService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改考核管理 |
|||
*/ |
|||
@SaCheckPermission("platform:management:edit") |
|||
@Log(title = "考核管理", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PerformanceManagementBo bo) { |
|||
return toAjax(performanceManagementService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除考核管理 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("platform:management:remove") |
|||
@Log(title = "考核管理", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable String[] ids) { |
|||
return toAjax(performanceManagementService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
} |
@ -0,0 +1,72 @@ |
|||
package org.dromara.platform.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 考核管理对象 performance_management |
|||
* |
|||
* @author gejunhao |
|||
* @date 2025-04-21 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("performance_management") |
|||
public class PerformanceManagement extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识符 |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 评分大类 |
|||
*/ |
|||
private String largeRating; |
|||
|
|||
/** |
|||
* 评分小类 |
|||
*/ |
|||
private String smallRating; |
|||
|
|||
/** |
|||
* 分值 |
|||
*/ |
|||
private Long rating; |
|||
|
|||
/** |
|||
* 扣分标准 |
|||
*/ |
|||
private String standards; |
|||
|
|||
/** |
|||
* 考核类型 |
|||
*/ |
|||
private String checkType; |
|||
|
|||
/** |
|||
* 当前状态 |
|||
*/ |
|||
private Long status; |
|||
|
|||
/** |
|||
* 删除标志(0代表存在 2代表删除) |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
|
|||
} |
@ -0,0 +1,72 @@ |
|||
package org.dromara.platform.domain.bo; |
|||
|
|||
import org.dromara.platform.domain.PerformanceManagement; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 考核管理业务对象 performance_management |
|||
* |
|||
* @author gejunhao |
|||
* @date 2025-04-21 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = PerformanceManagement.class, reverseConvertGenerate = false) |
|||
public class PerformanceManagementBo extends BaseEntity { |
|||
|
|||
/** |
|||
* 唯一标识符 |
|||
*/ |
|||
@NotBlank(message = "唯一标识符不能为空", groups = { EditGroup.class }) |
|||
private String id; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
@NotBlank(message = "类型不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String type; |
|||
|
|||
/** |
|||
* 评分大类 |
|||
*/ |
|||
@NotBlank(message = "评分大类不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String largeRating; |
|||
|
|||
/** |
|||
* 评分小类 |
|||
*/ |
|||
@NotBlank(message = "评分小类不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String smallRating; |
|||
|
|||
/** |
|||
* 分值 |
|||
*/ |
|||
@NotNull(message = "分值不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long rating; |
|||
|
|||
/** |
|||
* 扣分标准 |
|||
*/ |
|||
@NotBlank(message = "扣分标准不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String standards; |
|||
|
|||
/** |
|||
* 考核类型 |
|||
*/ |
|||
@NotBlank(message = "考核类型不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String checkType; |
|||
|
|||
/** |
|||
* 当前状态 |
|||
*/ |
|||
@NotNull(message = "当前状态不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long status; |
|||
|
|||
|
|||
} |
@ -0,0 +1,9 @@ |
|||
package org.dromara.platform.domain.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ContractSelectVo { |
|||
private String id; |
|||
private String contractName; |
|||
} |
@ -0,0 +1,83 @@ |
|||
package org.dromara.platform.domain.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.dromara.platform.domain.PerformanceManagement; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 考核管理视图对象 performance_management |
|||
* |
|||
* @author gejunhao |
|||
* @date 2025-04-21 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = PerformanceManagement.class) |
|||
public class PerformanceManagementVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识符 |
|||
*/ |
|||
@ExcelProperty(value = "唯一标识符") |
|||
private String id; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
@ExcelProperty(value = "类型") |
|||
private String type; |
|||
|
|||
/** |
|||
* 评分大类 |
|||
*/ |
|||
@ExcelProperty(value = "评分大类") |
|||
private String largeRating; |
|||
|
|||
/** |
|||
* 评分小类 |
|||
*/ |
|||
@ExcelProperty(value = "评分小类") |
|||
private String smallRating; |
|||
|
|||
/** |
|||
* 分值 |
|||
*/ |
|||
@ExcelProperty(value = "分值") |
|||
private Long rating; |
|||
|
|||
/** |
|||
* 扣分标准 |
|||
*/ |
|||
@ExcelProperty(value = "扣分标准") |
|||
private String standards; |
|||
|
|||
/** |
|||
* 考核类型 |
|||
*/ |
|||
@ExcelProperty(value = "考核类型") |
|||
private String checkType; |
|||
|
|||
/** |
|||
* 当前状态 |
|||
*/ |
|||
@ExcelProperty(value = "当前状态") |
|||
private Long status; |
|||
|
|||
@ExcelProperty(value = "创建时间") |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
private Date createTime; |
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.platform.mapper; |
|||
|
|||
import org.dromara.platform.domain.PerformanceManagement; |
|||
import org.dromara.platform.domain.vo.PerformanceManagementVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 考核管理Mapper接口 |
|||
* |
|||
* @author gejunhao |
|||
* @date 2025-04-21 |
|||
*/ |
|||
public interface PerformanceManagementMapper extends BaseMapperPlus<PerformanceManagement, PerformanceManagementVo> { |
|||
|
|||
} |
@ -0,0 +1,68 @@ |
|||
package org.dromara.platform.service; |
|||
|
|||
import org.dromara.platform.domain.vo.PerformanceManagementVo; |
|||
import org.dromara.platform.domain.bo.PerformanceManagementBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 考核管理Service接口 |
|||
* |
|||
* @author gejunhao |
|||
* @date 2025-04-21 |
|||
*/ |
|||
public interface IPerformanceManagementService { |
|||
|
|||
/** |
|||
* 查询考核管理 |
|||
* |
|||
* @param id 主键 |
|||
* @return 考核管理 |
|||
*/ |
|||
PerformanceManagementVo queryById(String id); |
|||
|
|||
/** |
|||
* 分页查询考核管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 考核管理分页列表 |
|||
*/ |
|||
TableDataInfo<PerformanceManagementVo> queryPageList(PerformanceManagementBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的考核管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 考核管理列表 |
|||
*/ |
|||
List<PerformanceManagementVo> queryList(PerformanceManagementBo bo); |
|||
|
|||
/** |
|||
* 新增考核管理 |
|||
* |
|||
* @param bo 考核管理 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(PerformanceManagementBo bo); |
|||
|
|||
/** |
|||
* 修改考核管理 |
|||
* |
|||
* @param bo 考核管理 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(PerformanceManagementBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除考核管理信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); |
|||
} |
@ -0,0 +1,135 @@ |
|||
package org.dromara.platform.service.impl; |
|||
|
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.platform.domain.bo.PerformanceManagementBo; |
|||
import org.dromara.platform.domain.vo.PerformanceManagementVo; |
|||
import org.dromara.platform.domain.PerformanceManagement; |
|||
import org.dromara.platform.mapper.PerformanceManagementMapper; |
|||
import org.dromara.platform.service.IPerformanceManagementService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 考核管理Service业务层处理 |
|||
* |
|||
* @author gejunhao |
|||
* @date 2025-04-21 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class PerformanceManagementServiceImpl implements IPerformanceManagementService { |
|||
|
|||
private final PerformanceManagementMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询考核管理 |
|||
* |
|||
* @param id 主键 |
|||
* @return 考核管理 |
|||
*/ |
|||
@Override |
|||
public PerformanceManagementVo queryById(String id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询考核管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 考核管理分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<PerformanceManagementVo> queryPageList(PerformanceManagementBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<PerformanceManagement> lqw = buildQueryWrapper(bo); |
|||
Page<PerformanceManagementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的考核管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 考核管理列表 |
|||
*/ |
|||
@Override |
|||
public List<PerformanceManagementVo> queryList(PerformanceManagementBo bo) { |
|||
LambdaQueryWrapper<PerformanceManagement> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<PerformanceManagement> buildQueryWrapper(PerformanceManagementBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<PerformanceManagement> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getType()), PerformanceManagement::getType, bo.getType()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getLargeRating()), PerformanceManagement::getLargeRating, bo.getLargeRating()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getSmallRating()), PerformanceManagement::getSmallRating, bo.getSmallRating()); |
|||
lqw.eq(bo.getRating() != null, PerformanceManagement::getRating, bo.getRating()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getStandards()), PerformanceManagement::getStandards, bo.getStandards()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getCheckType()), PerformanceManagement::getCheckType, bo.getCheckType()); |
|||
lqw.eq(bo.getStatus() != null, PerformanceManagement::getStatus, bo.getStatus()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增考核管理 |
|||
* |
|||
* @param bo 考核管理 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(PerformanceManagementBo bo) { |
|||
PerformanceManagement add = MapstructUtils.convert(bo, PerformanceManagement.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改考核管理 |
|||
* |
|||
* @param bo 考核管理 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(PerformanceManagementBo bo) { |
|||
PerformanceManagement update = MapstructUtils.convert(bo, PerformanceManagement.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(PerformanceManagement entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除考核管理信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
} |
Loading…
Reference in new issue