.gitignore
@@ -25,3 +25,6 @@ *.war *.ear /target #project *.menu.sql src/main/java/org/springblade/modules/assessment/controller/AssessmentScoreController.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.AssessmentScoreEntity; import org.springblade.modules.assessment.vo.AssessmentScoreVO; import org.springblade.modules.assessment.excel.AssessmentScoreExcel; import org.springblade.modules.assessment.wrapper.AssessmentScoreWrapper; import org.springblade.modules.assessment.service.IAssessmentScoreService; 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-13 */ @RestController @AllArgsConstructor @RequestMapping("assessmentScore/assessmentScore") @Api(value = "考核评分", tags = "考核评分接口") public class AssessmentScoreController extends BladeController { private final IAssessmentScoreService assessmentScoreService; /** * 考核评分 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入assessmentScore") public R<AssessmentScoreVO> detail(AssessmentScoreEntity assessmentScore) { AssessmentScoreEntity detail = assessmentScoreService.getOne(Condition.getQueryWrapper(assessmentScore)); return R.data(AssessmentScoreWrapper.build().entityVO(detail)); } /** * 考核评分 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入assessmentScore") public R<IPage<AssessmentScoreVO>> list(@ApiIgnore @RequestParam Map<String, Object> assessmentScore, Query query) { IPage<AssessmentScoreEntity> pages = assessmentScoreService.page(Condition.getPage(query), Condition.getQueryWrapper(assessmentScore, AssessmentScoreEntity.class)); return R.data(AssessmentScoreWrapper.build().pageVO(pages)); } /** * 考核评分 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入assessmentScore") public R<IPage<AssessmentScoreVO>> page(AssessmentScoreVO assessmentScore, Query query) { IPage<AssessmentScoreVO> pages = assessmentScoreService.selectAssessmentScorePage(Condition.getPage(query), assessmentScore); return R.data(pages); } /** * 考核评分 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入assessmentScore") public R save(@Valid @RequestBody AssessmentScoreEntity assessmentScore) { return R.status(assessmentScoreService.save(assessmentScore)); } /** * 考核评分 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入assessmentScore") public R update(@Valid @RequestBody AssessmentScoreEntity assessmentScore) { return R.status(assessmentScoreService.updateById(assessmentScore)); } /** * 考核评分 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入assessmentScore") public R submit(@Valid @RequestBody AssessmentScoreEntity assessmentScore) { return R.status(assessmentScoreService.saveOrUpdate(assessmentScore)); } /** * 考核评分 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(assessmentScoreService.deleteLogic(Func.toLongList(ids))); } /** * 导出数据 */ @GetMapping("/export-assessmentScore") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入assessmentScore") public void exportAssessmentScore(@ApiIgnore @RequestParam Map<String, Object> assessmentScore, BladeUser bladeUser, HttpServletResponse response) { QueryWrapper<AssessmentScoreEntity> queryWrapper = Condition.getQueryWrapper(assessmentScore, AssessmentScoreEntity.class); //if (!AuthUtil.isAdministrator()) { // queryWrapper.lambda().eq(AssessmentScore::getTenantId, bladeUser.getTenantId()); //} queryWrapper.lambda().eq(AssessmentScoreEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); List<AssessmentScoreExcel> list = assessmentScoreService.exportAssessmentScore(queryWrapper); ExcelUtil.export(response, "考核评分数据" + DateUtil.time(), "考核评分数据表", list, AssessmentScoreExcel.class); } } src/main/java/org/springblade/modules/assessment/dto/AssessmentScoreDTO.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.AssessmentScoreEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * 考核评分 数据传输对象实体类 * * @author aix * @since 2023-12-13 */ @Data @EqualsAndHashCode(callSuper = true) public class AssessmentScoreDTO extends AssessmentScoreEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/assessment/entity/AssessmentScoreEntity.java
New file @@ -0,0 +1,72 @@ /* * 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-13 */ @Data @TableName("yw_assessment_score") @ApiModel(value = "AssessmentScore对象", description = "考核评分") @EqualsAndHashCode(callSuper = true) public class AssessmentScoreEntity extends TenantEntity { /** * 考核任务 */ @ApiModelProperty(value = "考核任务") private Long assessmentTaskId; /** * 被评分的人/部门 */ @ApiModelProperty(value = "被评分的人/部门") private Long beId; /** * 评分人 */ @ApiModelProperty(value = "评分人") private Long scoreUserId; /** * 评分 */ @ApiModelProperty(value = "评分") private Integer scoreVal; /** * 评分说明 */ @ApiModelProperty(value = "评分说明") private String remark; /** * 类型(0:员工评分,1:部门评分) */ @ApiModelProperty(value = "类型(0:员工评分,1:部门评分)") private Integer type; } src/main/java/org/springblade/modules/assessment/excel/AssessmentScoreExcel.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-13 */ @Data @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) public class AssessmentScoreExcel implements Serializable { private static final long serialVersionUID = 1L; /** * 租户ID */ @ColumnWidth(20) @ExcelProperty("租户ID") private String tenantId; /** * 评分人 */ @ColumnWidth(20) @ExcelProperty("评分人") private Long scoreUserId; /** * 评分 */ @ColumnWidth(20) @ExcelProperty("评分") private Integer scoreVal; /** * 评分说明 */ @ColumnWidth(20) @ExcelProperty("评分说明") private String remark; /** * 类型(0:员工评分,1:部门评分) */ @ColumnWidth(20) @ExcelProperty("类型(0:员工评分,1:部门评分)") private Integer type; /** * 是否已删除 */ @ColumnWidth(20) @ExcelProperty("是否已删除") private Integer isDeleted; } src/main/java/org/springblade/modules/assessment/mapper/AssessmentScoreMapper.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.AssessmentScoreEntity; import org.springblade.modules.assessment.vo.AssessmentScoreVO; import org.springblade.modules.assessment.excel.AssessmentScoreExcel; 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-13 */ public interface AssessmentScoreMapper extends BaseMapper<AssessmentScoreEntity> { /** * 自定义分页 * * @param page * @param assessmentScore * @return */ List<AssessmentScoreVO> selectAssessmentScorePage(IPage page, AssessmentScoreVO assessmentScore); /** * 获取导出数据 * * @param queryWrapper * @return */ List<AssessmentScoreExcel> exportAssessmentScore(@Param("ew") Wrapper<AssessmentScoreEntity> queryWrapper); } src/main/java/org/springblade/modules/assessment/mapper/AssessmentScoreMapper.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.AssessmentScoreMapper"> <!-- 通用查询映射结果 --> <resultMap id="assessmentScoreResultMap" type="org.springblade.modules.assessment.entity.AssessmentScoreEntity"> <result column="id" property="id"/> <result column="tenant_id" property="tenantId"/> <result column="score_user_id" property="scoreUserId"/> <result column="score_val" property="scoreVal"/> <result column="remark" property="remark"/> <result column="type" property="type"/> <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="selectAssessmentScorePage" resultMap="assessmentScoreResultMap"> select * from yw_assessment_score where is_deleted = 0 </select> <select id="exportAssessmentScore" resultType="org.springblade.modules.assessment.excel.AssessmentScoreExcel"> SELECT * FROM yw_assessment_score ${ew.customSqlSegment} </select> </mapper> src/main/java/org/springblade/modules/assessment/service/IAssessmentScoreService.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.AssessmentScoreEntity; import org.springblade.modules.assessment.vo.AssessmentScoreVO; import org.springblade.modules.assessment.excel.AssessmentScoreExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; import java.util.List; /** * 考核评分 服务类 * * @author aix * @since 2023-12-13 */ public interface IAssessmentScoreService extends BaseService<AssessmentScoreEntity> { /** * 自定义分页 * * @param page * @param assessmentScore * @return */ IPage<AssessmentScoreVO> selectAssessmentScorePage(IPage<AssessmentScoreVO> page, AssessmentScoreVO assessmentScore); /** * 导出数据 * * @param queryWrapper * @return */ List<AssessmentScoreExcel> exportAssessmentScore(Wrapper<AssessmentScoreEntity> queryWrapper); } src/main/java/org/springblade/modules/assessment/service/impl/AssessmentScoreServiceImpl.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.AssessmentScoreEntity; import org.springblade.modules.assessment.vo.AssessmentScoreVO; import org.springblade.modules.assessment.excel.AssessmentScoreExcel; import org.springblade.modules.assessment.mapper.AssessmentScoreMapper; import org.springblade.modules.assessment.service.IAssessmentScoreService; 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-13 */ @Service public class AssessmentScoreServiceImpl extends BaseServiceImpl<AssessmentScoreMapper, AssessmentScoreEntity> implements IAssessmentScoreService { @Override public IPage<AssessmentScoreVO> selectAssessmentScorePage(IPage<AssessmentScoreVO> page, AssessmentScoreVO assessmentScore) { return page.setRecords(baseMapper.selectAssessmentScorePage(page, assessmentScore)); } @Override public List<AssessmentScoreExcel> exportAssessmentScore(Wrapper<AssessmentScoreEntity> queryWrapper) { List<AssessmentScoreExcel> assessmentScoreList = baseMapper.exportAssessmentScore(queryWrapper); //assessmentScoreList.forEach(assessmentScore -> { // assessmentScore.setTypeName(DictCache.getValue(DictEnum.YES_NO, AssessmentScore.getType())); //}); return assessmentScoreList; } } src/main/java/org/springblade/modules/assessment/vo/AssessmentScoreVO.java
New file @@ -0,0 +1,35 @@ /* * 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 org.springblade.modules.assessment.entity.AssessmentScoreEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; /** * 考核评分 视图实体类 * * @author aix * @since 2023-12-13 */ @Data @EqualsAndHashCode(callSuper = true) public class AssessmentScoreVO extends AssessmentScoreEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/assessment/wrapper/AssessmentScoreWrapper.java
New file @@ -0,0 +1,50 @@ /* * 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 org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.modules.assessment.entity.AssessmentScoreEntity; import org.springblade.modules.assessment.vo.AssessmentScoreVO; import java.util.Objects; /** * 考核评分 包装类,返回视图层所需的字段 * * @author aix * @since 2023-12-13 */ public class AssessmentScoreWrapper extends BaseEntityWrapper<AssessmentScoreEntity, AssessmentScoreVO> { public static AssessmentScoreWrapper build() { return new AssessmentScoreWrapper(); } @Override public AssessmentScoreVO entityVO(AssessmentScoreEntity assessmentScore) { AssessmentScoreVO assessmentScoreVO = Objects.requireNonNull(BeanUtil.copy(assessmentScore, AssessmentScoreVO.class)); //User createUser = UserCache.getUser(assessmentScore.getCreateUser()); //User updateUser = UserCache.getUser(assessmentScore.getUpdateUser()); //assessmentScoreVO.setCreateUserName(createUser.getName()); //assessmentScoreVO.setUpdateUserName(updateUser.getName()); return assessmentScoreVO; } }