src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateResultController.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.evaluate.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.BladeUser; import org.springblade.core.tool.api.R; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity; import org.springblade.modules.evaluate.excel.EvaluateCandidateResultExcel; import org.springblade.modules.evaluate.service.IEvaluateCandidateResultService; import org.springblade.modules.evaluate.vo.EvaluateCandidateResultVO; import org.springblade.modules.evaluate.wrapper.EvaluateCandidateResultWrapper; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.List; import java.util.Map; /** * 评优任务候选人投票结果表 控制器 * * @author aix * @since 2024-01-09 */ @RestController @AllArgsConstructor @RequestMapping("evaluate/evaluateCandidateResult") @Api(value = "评优任务候选人投票结果表", tags = "评优任务候选人投票结果表接口") public class EvaluateCandidateResultController extends BladeController { private final IEvaluateCandidateResultService evaluateCandidateResultService; /** * 评优任务候选人投票结果表 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入evaluateCandidateResult") public R<EvaluateCandidateResultVO> detail(EvaluateCandidateResultEntity evaluateCandidateResult) { EvaluateCandidateResultEntity detail = evaluateCandidateResultService.getOne(Condition.getQueryWrapper(evaluateCandidateResult)); return R.data(EvaluateCandidateResultWrapper.build().entityVO(detail)); } /** * 评优任务候选人投票结果表 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入evaluateCandidateResult") public R<IPage<EvaluateCandidateResultVO>> list(@ApiIgnore @RequestParam Map<String, Object> evaluateCandidateResult, Query query) { IPage<EvaluateCandidateResultEntity> pages = evaluateCandidateResultService.page(Condition.getPage(query), Condition.getQueryWrapper(evaluateCandidateResult, EvaluateCandidateResultEntity.class)); return R.data(EvaluateCandidateResultWrapper.build().pageVO(pages)); } /** * 评优任务候选人投票结果表 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入evaluateCandidateResult") public R<IPage<EvaluateCandidateResultVO>> page(EvaluateCandidateResultVO evaluateCandidateResult, Query query) { IPage<EvaluateCandidateResultVO> pages = evaluateCandidateResultService.selectEvaluateCandidateResultPage(Condition.getPage(query), evaluateCandidateResult); return R.data(pages); } /** * 评优任务候选人投票结果表 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入evaluateCandidateResult") public R save(@Valid @RequestBody EvaluateCandidateResultEntity evaluateCandidateResult) { return R.status(evaluateCandidateResultService.save(evaluateCandidateResult)); } /** * 评优任务候选人投票结果表 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入evaluateCandidateResult") public R update(@Valid @RequestBody EvaluateCandidateResultEntity evaluateCandidateResult) { return R.status(evaluateCandidateResultService.updateById(evaluateCandidateResult)); } /** * 评优任务候选人投票结果表 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入evaluateCandidateResult") public R submit(@Valid @RequestBody EvaluateCandidateResultEntity evaluateCandidateResult) { return R.status(evaluateCandidateResultService.saveOrUpdate(evaluateCandidateResult)); } /** * 评优任务候选人投票结果表 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(evaluateCandidateResultService.deleteLogic(Func.toLongList(ids))); } /** * 导出数据 */ @GetMapping("/export-evaluateCandidateResult") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入evaluateCandidateResult") public void exportEvaluateCandidateResult(@ApiIgnore @RequestParam Map<String, Object> evaluateCandidateResult, BladeUser bladeUser, HttpServletResponse response) { QueryWrapper<EvaluateCandidateResultEntity> queryWrapper = Condition.getQueryWrapper(evaluateCandidateResult, EvaluateCandidateResultEntity.class); //if (!AuthUtil.isAdministrator()) { // queryWrapper.lambda().eq(EvaluateCandidateResult::getTenantId, bladeUser.getTenantId()); //} queryWrapper.lambda().eq(EvaluateCandidateResultEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); List<EvaluateCandidateResultExcel> list = evaluateCandidateResultService.exportEvaluateCandidateResult(queryWrapper); ExcelUtil.export(response, "评优任务候选人投票结果表数据" + DateUtil.time(), "评优任务候选人投票结果表数据表", list, EvaluateCandidateResultExcel.class); } } src/main/java/org/springblade/modules/evaluate/dto/EvaluateCandidateResultDTO.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.evaluate.dto; import org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * 评优任务候选人投票结果表 数据传输对象实体类 * * @author aix * @since 2024-01-09 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateCandidateResultDTO extends EvaluateCandidateResultEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/evaluate/entity/EvaluateCandidateResultEntity.java
New file @@ -0,0 +1,79 @@ /* * 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.evaluate.entity; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; /** * 评优任务候选人投票结果表 实体类 * * @author aix * @since 2024-01-09 */ @Data @TableName("yw_evaluate_candidate_result") @ApiModel(value = "EvaluateCandidateResult对象", description = "评优任务候选人投票结果表") @EqualsAndHashCode(callSuper = true) public class EvaluateCandidateResultEntity extends TenantEntity { /** * 评优任务id */ @ApiModelProperty(value = "评优任务id") private Long evaluateTaskId; /** * 评优类别id */ @ApiModelProperty(value = "评优类别id") private Long evaluateTaskCategoryId; /** * 候选人员id */ @ApiModelProperty(value = "候选人员id") private Long userId; /** * 候选人名称 */ @ApiModelProperty(value = "候选人名称") private String userName; /** * 候选人员部门id */ @ApiModelProperty(value = "候选人员部门id") private Long deptId; /** * 候选人员部门名称 */ @ApiModelProperty(value = "候选人员部门名称") private String deptName; /** * 候选人员职位名称 */ @ApiModelProperty(value = "候选人员职位名称") private String postName; /** * 推荐理由 */ @ApiModelProperty(value = "推荐理由") private String remark; } src/main/java/org/springblade/modules/evaluate/excel/EvaluateCandidateResultExcel.java
New file @@ -0,0 +1,104 @@ /* * 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.evaluate.excel; 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 lombok.Data; import java.io.Serializable; /** * 评优任务候选人投票结果表 Excel实体类 * * @author aix * @since 2024-01-09 */ @Data @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) public class EvaluateCandidateResultExcel implements Serializable { private static final long serialVersionUID = 1L; /** * 租户ID */ @ColumnWidth(20) @ExcelProperty("租户ID") private String tenantId; /** * 评优任务id */ @ColumnWidth(20) @ExcelProperty("评优任务id") private Long evaluateTaskId; /** * 评优类别id */ @ColumnWidth(20) @ExcelProperty("评优类别id") private Long evaluateTaskCategoryId; /** * 候选人员id */ @ColumnWidth(20) @ExcelProperty("候选人员id") private Long userId; /** * 候选人名称 */ @ColumnWidth(20) @ExcelProperty("候选人名称") private String userName; /** * 候选人员部门id */ @ColumnWidth(20) @ExcelProperty("候选人员部门id") private Long deptId; /** * 候选人员部门名称 */ @ColumnWidth(20) @ExcelProperty("候选人员部门名称") private String deptName; /** * 候选人员职位名称 */ @ColumnWidth(20) @ExcelProperty("候选人员职位名称") private String postName; /** * 推荐理由 */ @ColumnWidth(20) @ExcelProperty("推荐理由") private String remark; /** * 是否已删除 */ @ColumnWidth(20) @ExcelProperty("是否已删除") private Integer isDeleted; } src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateResultMapper.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.evaluate.mapper; import org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateResultVO; import org.springblade.modules.evaluate.excel.EvaluateCandidateResultExcel; 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 2024-01-09 */ public interface EvaluateCandidateResultMapper extends BaseMapper<EvaluateCandidateResultEntity> { /** * 自定义分页 * * @param page * @param evaluateCandidateResult * @return */ List<EvaluateCandidateResultVO> selectEvaluateCandidateResultPage(IPage page, EvaluateCandidateResultVO evaluateCandidateResult); /** * 获取导出数据 * * @param queryWrapper * @return */ List<EvaluateCandidateResultExcel> exportEvaluateCandidateResult(@Param("ew") Wrapper<EvaluateCandidateResultEntity> queryWrapper); } src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateResultMapper.xml
New file @@ -0,0 +1,36 @@ <?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.evaluate.mapper.EvaluateCandidateResultMapper"> <!-- 通用查询映射结果 --> <resultMap id="evaluateCandidateResultResultMap" type="org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity"> <result column="id" property="id"/> <result column="tenant_id" property="tenantId"/> <result column="evaluate_task_id" property="evaluateTaskId"/> <result column="evaluate_task_category_id" property="evaluateTaskCategoryId"/> <result column="user_id" property="userId"/> <result column="user_name" property="userName"/> <result column="dept_id" property="deptId"/> <result column="dept_name" property="deptName"/> <result column="post_name" property="postName"/> <result column="remark" property="remark"/> <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="selectEvaluateCandidateResultPage" resultMap="evaluateCandidateResultResultMap"> select * from yw_evaluate_candidate_result where is_deleted = 0 </select> <select id="exportEvaluateCandidateResult" resultType="org.springblade.modules.evaluate.excel.EvaluateCandidateResultExcel"> SELECT * FROM yw_evaluate_candidate_result ${ew.customSqlSegment} </select> </mapper> src/main/java/org/springblade/modules/evaluate/service/IEvaluateCandidateResultService.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.evaluate.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateResultVO; import org.springblade.modules.evaluate.excel.EvaluateCandidateResultExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; import java.util.List; /** * 评优任务候选人投票结果表 服务类 * * @author aix * @since 2024-01-09 */ public interface IEvaluateCandidateResultService extends BaseService<EvaluateCandidateResultEntity> { /** * 自定义分页 * * @param page * @param evaluateCandidateResult * @return */ IPage<EvaluateCandidateResultVO> selectEvaluateCandidateResultPage(IPage<EvaluateCandidateResultVO> page, EvaluateCandidateResultVO evaluateCandidateResult); /** * 导出数据 * * @param queryWrapper * @return */ List<EvaluateCandidateResultExcel> exportEvaluateCandidateResult(Wrapper<EvaluateCandidateResultEntity> queryWrapper); } src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateCandidateResultServiceImpl.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.evaluate.service.impl; import org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateResultVO; import org.springblade.modules.evaluate.excel.EvaluateCandidateResultExcel; import org.springblade.modules.evaluate.mapper.EvaluateCandidateResultMapper; import org.springblade.modules.evaluate.service.IEvaluateCandidateResultService; 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 2024-01-09 */ @Service public class EvaluateCandidateResultServiceImpl extends BaseServiceImpl<EvaluateCandidateResultMapper, EvaluateCandidateResultEntity> implements IEvaluateCandidateResultService { @Override public IPage<EvaluateCandidateResultVO> selectEvaluateCandidateResultPage(IPage<EvaluateCandidateResultVO> page, EvaluateCandidateResultVO evaluateCandidateResult) { return page.setRecords(baseMapper.selectEvaluateCandidateResultPage(page, evaluateCandidateResult)); } @Override public List<EvaluateCandidateResultExcel> exportEvaluateCandidateResult(Wrapper<EvaluateCandidateResultEntity> queryWrapper) { List<EvaluateCandidateResultExcel> evaluateCandidateResultList = baseMapper.exportEvaluateCandidateResult(queryWrapper); //evaluateCandidateResultList.forEach(evaluateCandidateResult -> { // evaluateCandidateResult.setTypeName(DictCache.getValue(DictEnum.YES_NO, EvaluateCandidateResult.getType())); //}); return evaluateCandidateResultList; } } src/main/java/org/springblade/modules/evaluate/vo/EvaluateCandidateResultVO.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.evaluate.vo; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity; /** * 评优任务候选人投票结果表 视图实体类 * * @author aix * @since 2024-01-09 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateCandidateResultVO extends EvaluateCandidateResultEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateCandidateResultWrapper.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.evaluate.wrapper; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.modules.evaluate.entity.EvaluateCandidateResultEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateResultVO; import java.util.Objects; /** * 评优任务候选人投票结果表 包装类,返回视图层所需的字段 * * @author aix * @since 2024-01-09 */ public class EvaluateCandidateResultWrapper extends BaseEntityWrapper<EvaluateCandidateResultEntity, EvaluateCandidateResultVO> { public static EvaluateCandidateResultWrapper build() { return new EvaluateCandidateResultWrapper(); } @Override public EvaluateCandidateResultVO entityVO(EvaluateCandidateResultEntity evaluateCandidateResult) { EvaluateCandidateResultVO evaluateCandidateResultVO = Objects.requireNonNull(BeanUtil.copy(evaluateCandidateResult, EvaluateCandidateResultVO.class)); //User createUser = UserCache.getUser(evaluateCandidateResult.getCreateUser()); //User updateUser = UserCache.getUser(evaluateCandidateResult.getUpdateUser()); //evaluateCandidateResultVO.setCreateUserName(createUser.getName()); //evaluateCandidateResultVO.setUpdateUserName(updateUser.getName()); return evaluateCandidateResultVO; } }