xieb
2023-12-12 18cc57f3c9c33a740b55718e3d5bc0e1d7ac7a5f
考核权重-部门
1 files modified
10 files added
657 ■■■■■ changed files
src/main/java/org/springblade/modules/assessment/controller/AssessmentSetDeptController.java 151 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/dto/AssessmentSetDeptDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/entity/AssessmentSetDeptEntity.java 60 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/excel/AssessmentSetDeptExcel.java 81 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/mapper/AssessmentSetDeptMapper.java 54 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/mapper/AssessmentSetDeptMapper.xml 32 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/service/IAssessmentSetDeptService.java 52 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/service/impl/AssessmentSetDeptServiceImpl.java 54 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/vo/AssessmentSetDeptVO.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetDeptWrapper.java 94 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetWrapper.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/assessment/controller/AssessmentSetDeptController.java
New file
@@ -0,0 +1,151 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.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.springblade.modules.assessment.entity.AssessmentSetDeptEntity;
import org.springblade.modules.assessment.vo.AssessmentSetDeptVO;
import org.springblade.modules.assessment.excel.AssessmentSetDeptExcel;
import org.springblade.modules.assessment.wrapper.AssessmentSetDeptWrapper;
import org.springblade.modules.assessment.service.IAssessmentSetDeptService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.tool.constant.BladeConstant;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
/**
 * 考核权重-部门 控制器
 *
 * @author aix
 * @since 2023-12-12
 */
@RestController
@AllArgsConstructor
@RequestMapping("assessment/assessmentSetDept")
@Api(value = "考核权重-部门", tags = "考核权重-部门接口")
public class AssessmentSetDeptController extends BladeController {
    private final IAssessmentSetDeptService assessmentSetDeptService;
    /**
     * 考核权重-部门 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入assessmentSetDept")
    public R<AssessmentSetDeptVO> detail(AssessmentSetDeptEntity assessmentSetDept) {
        AssessmentSetDeptEntity detail = assessmentSetDeptService.getOne(Condition.getQueryWrapper(assessmentSetDept));
        return R.data(AssessmentSetDeptWrapper.build().entityVO(detail));
    }
    /**
     * 考核权重-部门 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入assessmentSetDept")
    public R<IPage<AssessmentSetDeptVO>> list(@ApiIgnore @RequestParam Map<String, Object> assessmentSetDept, Query query) {
        IPage<AssessmentSetDeptEntity> pages = assessmentSetDeptService.page(Condition.getPage(query), Condition.getQueryWrapper(assessmentSetDept, AssessmentSetDeptEntity.class));
        return R.data(AssessmentSetDeptWrapper.build().pageVO(pages));
    }
    /**
     * 考核权重-部门 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入assessmentSetDept")
    public R<IPage<AssessmentSetDeptVO>> page(AssessmentSetDeptVO assessmentSetDept, Query query) {
        IPage<AssessmentSetDeptVO> pages = assessmentSetDeptService.selectAssessmentSetDeptPage(Condition.getPage(query), assessmentSetDept);
        return R.data(pages);
    }
    /**
     * 考核权重-部门 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入assessmentSetDept")
    public R save(@Valid @RequestBody AssessmentSetDeptEntity assessmentSetDept) {
        return R.status(assessmentSetDeptService.save(assessmentSetDept));
    }
    /**
     * 考核权重-部门 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入assessmentSetDept")
    public R update(@Valid @RequestBody AssessmentSetDeptEntity assessmentSetDept) {
        return R.status(assessmentSetDeptService.updateById(assessmentSetDept));
    }
    /**
     * 考核权重-部门 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入assessmentSetDept")
    public R submit(@Valid @RequestBody AssessmentSetDeptEntity assessmentSetDept) {
        return R.status(assessmentSetDeptService.saveOrUpdate(assessmentSetDept));
    }
    /**
     * 考核权重-部门 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(assessmentSetDeptService.deleteLogic(Func.toLongList(ids)));
    }
    /**
     * 导出数据
     */
    @GetMapping("/export-assessmentSetDept")
    @ApiOperationSupport(order = 9)
    @ApiOperation(value = "导出数据", notes = "传入assessmentSetDept")
    public void exportAssessmentSetDept(@ApiIgnore @RequestParam Map<String, Object> assessmentSetDept, BladeUser bladeUser, HttpServletResponse response) {
        QueryWrapper<AssessmentSetDeptEntity> queryWrapper = Condition.getQueryWrapper(assessmentSetDept, AssessmentSetDeptEntity.class);
        //if (!AuthUtil.isAdministrator()) {
        //    queryWrapper.lambda().eq(AssessmentSetDept::getTenantId, bladeUser.getTenantId());
        //}
        queryWrapper.lambda().eq(AssessmentSetDeptEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
        List<AssessmentSetDeptExcel> list = assessmentSetDeptService.exportAssessmentSetDept(queryWrapper);
        ExcelUtil.export(response, "考核权重-部门数据" + DateUtil.time(), "考核权重-部门数据表", list, AssessmentSetDeptExcel.class);
    }
}
src/main/java/org/springblade/modules/assessment/dto/AssessmentSetDeptDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.dto;
import org.springblade.modules.assessment.entity.AssessmentSetDeptEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 考核权重-部门 数据传输对象实体类
 *
 * @author aix
 * @since 2023-12-12
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AssessmentSetDeptDTO extends AssessmentSetDeptEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/assessment/entity/AssessmentSetDeptEntity.java
New file
@@ -0,0 +1,60 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
 * 考核权重-部门 实体类
 *
 * @author aix
 * @since 2023-12-12
 */
@Data
@TableName("yw_assessment_set_dept")
@ApiModel(value = "AssessmentSetDept对象", description = "考核权重-部门")
@EqualsAndHashCode(callSuper = true)
public class AssessmentSetDeptEntity extends TenantEntity {
    /**
     * 被考核人
     */
    @ApiModelProperty(value = "被考核部门")
    private Long deptId;
    /**
     * 考核人
     */
    @ApiModelProperty(value = "考核人")
    private Long toUserId;
    /**
     * 权值
     */
    @ApiModelProperty(value = "权值")
    private Integer weight;
    /**
     * 范围
     */
    @ApiModelProperty(value = "范围")
    private Integer rangeVal;
}
src/main/java/org/springblade/modules/assessment/excel/AssessmentSetDeptExcel.java
New file
@@ -0,0 +1,81 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.excel;
import lombok.Data;
import java.util.Date;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import java.io.Serializable;
/**
 * 考核权重-部门 Excel实体类
 *
 * @author aix
 * @since 2023-12-12
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class AssessmentSetDeptExcel implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 租户ID
     */
    @ColumnWidth(20)
    @ExcelProperty("租户ID")
    private String tenantId;
    /**
     * 被考核人
     */
    @ColumnWidth(20)
    @ExcelProperty("被考核人")
    private Long deptId;
    /**
     * 考核人
     */
    @ColumnWidth(20)
    @ExcelProperty("考核人")
    private Long toUserId;
    /**
     * 权值
     */
    @ColumnWidth(20)
    @ExcelProperty("权值")
    private Integer weight;
    /**
     * 范围
     */
    @ColumnWidth(20)
    @ExcelProperty("范围")
    private Integer rangeVal;
    /**
     * 是否已删除
     */
    @ColumnWidth(20)
    @ExcelProperty("是否已删除")
    private Integer isDeleted;
}
src/main/java/org/springblade/modules/assessment/mapper/AssessmentSetDeptMapper.java
New file
@@ -0,0 +1,54 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.mapper;
import org.springblade.modules.assessment.entity.AssessmentSetDeptEntity;
import org.springblade.modules.assessment.vo.AssessmentSetDeptVO;
import org.springblade.modules.assessment.excel.AssessmentSetDeptExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * 考核权重-部门 Mapper 接口
 *
 * @author aix
 * @since 2023-12-12
 */
public interface AssessmentSetDeptMapper extends BaseMapper<AssessmentSetDeptEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param assessmentSetDept
     * @return
     */
    List<AssessmentSetDeptVO> selectAssessmentSetDeptPage(IPage page, AssessmentSetDeptVO assessmentSetDept);
    /**
     * 获取导出数据
     *
     * @param queryWrapper
     * @return
     */
    List<AssessmentSetDeptExcel> exportAssessmentSetDept(@Param("ew") Wrapper<AssessmentSetDeptEntity> queryWrapper);
}
src/main/java/org/springblade/modules/assessment/mapper/AssessmentSetDeptMapper.xml
New file
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.assessment.mapper.AssessmentSetDeptMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="assessmentSetDeptResultMap" type="org.springblade.modules.assessment.entity.AssessmentSetDeptEntity">
        <result column="id" property="id"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="dept_id" property="deptId"/>
        <result column="to_user_id" property="toUserId"/>
        <result column="weight" property="weight"/>
        <result column="range_val" property="rangeVal"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <select id="selectAssessmentSetDeptPage" resultMap="assessmentSetDeptResultMap">
        select * from yw_assessment_set_dept where is_deleted = 0
    </select>
    <select id="exportAssessmentSetDept" resultType="org.springblade.modules.assessment.excel.AssessmentSetDeptExcel">
        SELECT * FROM yw_assessment_set_dept ${ew.customSqlSegment}
    </select>
</mapper>
src/main/java/org/springblade/modules/assessment/service/IAssessmentSetDeptService.java
New file
@@ -0,0 +1,52 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.modules.assessment.entity.AssessmentSetDeptEntity;
import org.springblade.modules.assessment.vo.AssessmentSetDeptVO;
import org.springblade.modules.assessment.excel.AssessmentSetDeptExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
 * 考核权重-部门 服务类
 *
 * @author aix
 * @since 2023-12-12
 */
public interface IAssessmentSetDeptService extends BaseService<AssessmentSetDeptEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param assessmentSetDept
     * @return
     */
    IPage<AssessmentSetDeptVO> selectAssessmentSetDeptPage(IPage<AssessmentSetDeptVO> page, AssessmentSetDeptVO assessmentSetDept);
    /**
     * 导出数据
     *
     * @param queryWrapper
     * @return
     */
    List<AssessmentSetDeptExcel> exportAssessmentSetDept(Wrapper<AssessmentSetDeptEntity> queryWrapper);
}
src/main/java/org/springblade/modules/assessment/service/impl/AssessmentSetDeptServiceImpl.java
New file
@@ -0,0 +1,54 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.service.impl;
import org.springblade.modules.assessment.entity.AssessmentSetDeptEntity;
import org.springblade.modules.assessment.vo.AssessmentSetDeptVO;
import org.springblade.modules.assessment.excel.AssessmentSetDeptExcel;
import org.springblade.modules.assessment.mapper.AssessmentSetDeptMapper;
import org.springblade.modules.assessment.service.IAssessmentSetDeptService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.util.List;
/**
 * 考核权重-部门 服务实现类
 *
 * @author aix
 * @since 2023-12-12
 */
@Service
public class AssessmentSetDeptServiceImpl extends BaseServiceImpl<AssessmentSetDeptMapper, AssessmentSetDeptEntity> implements IAssessmentSetDeptService {
    @Override
    public IPage<AssessmentSetDeptVO> selectAssessmentSetDeptPage(IPage<AssessmentSetDeptVO> page, AssessmentSetDeptVO assessmentSetDept) {
        return page.setRecords(baseMapper.selectAssessmentSetDeptPage(page, assessmentSetDept));
    }
    @Override
    public List<AssessmentSetDeptExcel> exportAssessmentSetDept(Wrapper<AssessmentSetDeptEntity> queryWrapper) {
        List<AssessmentSetDeptExcel> assessmentSetDeptList = baseMapper.exportAssessmentSetDept(queryWrapper);
        //assessmentSetDeptList.forEach(assessmentSetDept -> {
        //    assessmentSetDept.setTypeName(DictCache.getValue(DictEnum.YES_NO, AssessmentSetDept.getType()));
        //});
        return assessmentSetDeptList;
    }
}
src/main/java/org/springblade/modules/assessment/vo/AssessmentSetDeptVO.java
New file
@@ -0,0 +1,44 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.assessment.entity.AssessmentSetDeptEntity;
/**
 * 考核权重-部门 视图实体类
 *
 * @author aix
 * @since 2023-12-12
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AssessmentSetDeptVO extends AssessmentSetDeptEntity {
    private static final long serialVersionUID = 1L;
    private String deptName;
    private String toUserName;
    private String toDeptName;
    private String toPostName;
    private AssessmentTaskVO assessmentTaskVO;
}
src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetDeptWrapper.java
New file
@@ -0,0 +1,94 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.assessment.wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.common.cache.SysCache;
import org.springblade.common.cache.UserCache;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.modules.assessment.entity.AssessmentSetDeptEntity;
import org.springblade.modules.assessment.entity.AssessmentSetEntity;
import org.springblade.modules.assessment.entity.AssessmentTaskEntity;
import org.springblade.modules.assessment.service.IAssessmentTaskService;
import org.springblade.modules.assessment.vo.AssessmentSetDeptVO;
import org.springblade.modules.assessment.vo.AssessmentSetVO;
import org.springblade.modules.system.entity.User;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
 * 考核权重-部门 包装类,返回视图层所需的字段
 *
 * @author aix
 * @since 2023-12-12
 */
public class AssessmentSetDeptWrapper extends BaseEntityWrapper<AssessmentSetDeptEntity, AssessmentSetDeptVO>  {
    private static final IAssessmentTaskService assessmentTaskService;
    static {
        assessmentTaskService = SpringUtil.getBean(IAssessmentTaskService.class);
    }
    public static AssessmentSetDeptWrapper build() {
        return new AssessmentSetDeptWrapper();
     }
    @Override
    public AssessmentSetDeptVO entityVO(AssessmentSetDeptEntity assessmentSetDept) {
        AssessmentSetDeptVO assessmentSetDeptVO = Objects.requireNonNull(BeanUtil.copy(assessmentSetDept, AssessmentSetDeptVO.class));
        //User createUser = UserCache.getUser(assessmentSetDept.getCreateUser());
        //User updateUser = UserCache.getUser(assessmentSetDept.getUpdateUser());
        //assessmentSetDeptVO.setCreateUserName(createUser.getName());
        //assessmentSetDeptVO.setUpdateUserName(updateUser.getName());
        assessmentSetDeptVO.setDeptName(SysCache.getDeptName(Long.valueOf(assessmentSetDept.getDeptId())));
        return assessmentSetDeptVO;
    }
    @Override
    public IPage<AssessmentSetDeptVO> pageVO(IPage<AssessmentSetDeptEntity> pages) {
        List<AssessmentSetDeptVO> records = listVO(pages.getRecords());
        for (AssessmentSetDeptVO vo:records) {
            //被考核部门
            vo.setDeptName(SysCache.getDeptName(Long.valueOf(vo.getDeptId())));
            User user = UserCache.getUser(vo.getToUserId()); //考核人
            vo.setToUserName(user.getName());
            vo.setToDeptName(SysCache.getDeptName(Long.valueOf(user.getDeptId())));
            vo.setToPostName(SysCache.getPostName(Long.valueOf(user.getPostId())));
            QueryWrapper<AssessmentTaskEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("type", 1);
            wrapper.gt("end_time", LocalDateTime.now());
            vo.setAssessmentTaskVO(AssessmentTaskWrapper.build().entityVO(assessmentTaskService.list(wrapper).get(0)));
        }
        IPage<AssessmentSetDeptVO> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
        pageVo.setRecords(records);
        return pageVo;
    }
}
src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetWrapper.java
@@ -86,6 +86,7 @@
            vo.setToPostName(SysCache.getPostName(Long.valueOf(user.getPostId())));
            QueryWrapper<AssessmentTaskEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("type", 0);
            wrapper.gt("end_time", LocalDateTime.now());
            vo.setAssessmentTaskVO(AssessmentTaskWrapper.build().entityVO(assessmentTaskService.list(wrapper).get(0)));
        }