src/main/java/org/springblade/evaluate/controller/EvaluateTaskController.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.evaluate.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.evaluate.entity.EvaluateTaskEntity; import org.springblade.evaluate.vo.EvaluateTaskVO; import org.springblade.evaluate.excel.EvaluateTaskExcel; import org.springblade.evaluate.wrapper.EvaluateTaskWrapper; import org.springblade.evaluate.service.IEvaluateTaskService; 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-08 */ @RestController @AllArgsConstructor @RequestMapping("evaluateTask/evaluateTask") @Api(value = "评优任务表", tags = "评优任务表接口") public class EvaluateTaskController extends BladeController { private final IEvaluateTaskService evaluateTaskService; /** * 评优任务表 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入evaluateTask") public R<EvaluateTaskVO> detail(EvaluateTaskEntity evaluateTask) { EvaluateTaskEntity detail = evaluateTaskService.getOne(Condition.getQueryWrapper(evaluateTask)); return R.data(EvaluateTaskWrapper.build().entityVO(detail)); } /** * 评优任务表 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入evaluateTask") public R<IPage<EvaluateTaskVO>> list(@ApiIgnore @RequestParam Map<String, Object> evaluateTask, Query query) { IPage<EvaluateTaskEntity> pages = evaluateTaskService.page(Condition.getPage(query), Condition.getQueryWrapper(evaluateTask, EvaluateTaskEntity.class)); return R.data(EvaluateTaskWrapper.build().pageVO(pages)); } /** * 评优任务表 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入evaluateTask") public R<IPage<EvaluateTaskVO>> page(EvaluateTaskVO evaluateTask, Query query) { IPage<EvaluateTaskVO> pages = evaluateTaskService.selectEvaluateTaskPage(Condition.getPage(query), evaluateTask); return R.data(pages); } /** * 评优任务表 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入evaluateTask") public R save(@Valid @RequestBody EvaluateTaskEntity evaluateTask) { return R.status(evaluateTaskService.save(evaluateTask)); } /** * 评优任务表 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入evaluateTask") public R update(@Valid @RequestBody EvaluateTaskEntity evaluateTask) { return R.status(evaluateTaskService.updateById(evaluateTask)); } /** * 评优任务表 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入evaluateTask") public R submit(@Valid @RequestBody EvaluateTaskEntity evaluateTask) { return R.status(evaluateTaskService.saveOrUpdate(evaluateTask)); } /** * 评优任务表 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(evaluateTaskService.deleteLogic(Func.toLongList(ids))); } /** * 导出数据 */ @GetMapping("/export-evaluateTask") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入evaluateTask") public void exportEvaluateTask(@ApiIgnore @RequestParam Map<String, Object> evaluateTask, BladeUser bladeUser, HttpServletResponse response) { QueryWrapper<EvaluateTaskEntity> queryWrapper = Condition.getQueryWrapper(evaluateTask, EvaluateTaskEntity.class); //if (!AuthUtil.isAdministrator()) { // queryWrapper.lambda().eq(EvaluateTask::getTenantId, bladeUser.getTenantId()); //} queryWrapper.lambda().eq(EvaluateTaskEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); List<EvaluateTaskExcel> list = evaluateTaskService.exportEvaluateTask(queryWrapper); ExcelUtil.export(response, "评优任务表数据" + DateUtil.time(), "评优任务表数据表", list, EvaluateTaskExcel.class); } } src/main/java/org/springblade/evaluate/dto/EvaluateTaskDTO.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.evaluate.dto; import org.springblade.evaluate.entity.EvaluateTaskEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * 评优任务表 数据传输对象实体类 * * @author aix * @since 2023-12-08 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateTaskDTO extends EvaluateTaskEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/evaluate/entity/EvaluateTaskEntity.java
New file @@ -0,0 +1,85 @@ /* * 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.evaluate.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-08 */ @Data @TableName("yw_evaluate_task") @ApiModel(value = "EvaluateTask对象", description = "评优任务表") @EqualsAndHashCode(callSuper = true) public class EvaluateTaskEntity extends TenantEntity { /** * 任务名称 */ @ApiModelProperty(value = "任务名称") private String taskName; /** * 任务类别 */ @ApiModelProperty(value = "任务类别") private String taskType; /** * 认定标准描述 */ @ApiModelProperty(value = "认定标准描述") private String remark; /** * 候选人数量 */ @ApiModelProperty(value = "候选人数量") private String candidateNum; /** * 候选人截止日期 */ @ApiModelProperty(value = "候选人截止日期") private Date candidateCutoffTime; /** * 候选人状态 */ @ApiModelProperty(value = "候选人状态") private Integer candidateState; /** * 评优数量 */ @ApiModelProperty(value = "评优数量") private Integer evaluateNum; /** * 候选人截止日期 */ @ApiModelProperty(value = "候选人截止日期") private Date evaluateCutoffTime; /** * 评优评选状态 */ @ApiModelProperty(value = "评优评选状态") private Integer evaluateState; } src/main/java/org/springblade/evaluate/excel/EvaluateTaskExcel.java
New file @@ -0,0 +1,111 @@ /* * 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.evaluate.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-08 */ @Data @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) public class EvaluateTaskExcel implements Serializable { private static final long serialVersionUID = 1L; /** * 租户ID */ @ColumnWidth(20) @ExcelProperty("租户ID") private String tenantId; /** * 任务名称 */ @ColumnWidth(20) @ExcelProperty("任务名称") private String taskName; /** * 任务类别 */ @ColumnWidth(20) @ExcelProperty("任务类别") private String taskType; /** * 认定标准描述 */ @ColumnWidth(20) @ExcelProperty("认定标准描述") private String remark; /** * 候选人数量 */ @ColumnWidth(20) @ExcelProperty("候选人数量") private String candidateNum; /** * 候选人截止日期 */ @ColumnWidth(20) @ExcelProperty("候选人截止日期") private Date candidateCutoffTime; /** * 候选人状态 */ @ColumnWidth(20) @ExcelProperty("候选人状态") private Integer candidateState; /** * 评优数量 */ @ColumnWidth(20) @ExcelProperty("评优数量") private Integer evaluateNum; /** * 候选人截止日期 */ @ColumnWidth(20) @ExcelProperty("候选人截止日期") private Date evaluateCutoffTime; /** * 评优评选状态 */ @ColumnWidth(20) @ExcelProperty("评优评选状态") private Integer evaluateState; /** * 是否已删除 */ @ColumnWidth(20) @ExcelProperty("是否已删除") private Integer isDeleted; } src/main/java/org/springblade/evaluate/mapper/EvaluateTaskMapper.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.evaluate.mapper; import org.springblade.evaluate.entity.EvaluateTaskEntity; import org.springblade.evaluate.vo.EvaluateTaskVO; import org.springblade.evaluate.excel.EvaluateTaskExcel; 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-08 */ public interface EvaluateTaskMapper extends BaseMapper<EvaluateTaskEntity> { /** * 自定义分页 * * @param page * @param evaluateTask * @return */ List<EvaluateTaskVO> selectEvaluateTaskPage(IPage page, EvaluateTaskVO evaluateTask); /** * 获取导出数据 * * @param queryWrapper * @return */ List<EvaluateTaskExcel> exportEvaluateTask(@Param("ew") Wrapper<EvaluateTaskEntity> queryWrapper); } src/main/java/org/springblade/evaluate/mapper/EvaluateTaskMapper.xml
New file @@ -0,0 +1,37 @@ <?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.evaluate.mapper.EvaluateTaskMapper"> <!-- 通用查询映射结果 --> <resultMap id="evaluateTaskResultMap" type="org.springblade.evaluate.entity.EvaluateTaskEntity"> <result column="id" property="id"/> <result column="tenant_id" property="tenantId"/> <result column="task_name" property="taskName"/> <result column="task_type" property="taskType"/> <result column="remark" property="remark"/> <result column="candidate_num" property="candidateNum"/> <result column="candidate_cutoff_time" property="candidateCutoffTime"/> <result column="candidate_state" property="candidateState"/> <result column="evaluate_num" property="evaluateNum"/> <result column="evaluate_cutoff_time" property="evaluateCutoffTime"/> <result column="evaluate_state" property="evaluateState"/> <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="selectEvaluateTaskPage" resultMap="evaluateTaskResultMap"> select * from yw_evaluate_task where is_deleted = 0 </select> <select id="exportEvaluateTask" resultType="org.springblade.evaluate.excel.EvaluateTaskExcel"> SELECT * FROM yw_evaluate_task ${ew.customSqlSegment} </select> </mapper> src/main/java/org/springblade/evaluate/service/IEvaluateTaskService.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.evaluate.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.springblade.evaluate.entity.EvaluateTaskEntity; import org.springblade.evaluate.vo.EvaluateTaskVO; import org.springblade.evaluate.excel.EvaluateTaskExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; import java.util.List; /** * 评优任务表 服务类 * * @author aix * @since 2023-12-08 */ public interface IEvaluateTaskService extends BaseService<EvaluateTaskEntity> { /** * 自定义分页 * * @param page * @param evaluateTask * @return */ IPage<EvaluateTaskVO> selectEvaluateTaskPage(IPage<EvaluateTaskVO> page, EvaluateTaskVO evaluateTask); /** * 导出数据 * * @param queryWrapper * @return */ List<EvaluateTaskExcel> exportEvaluateTask(Wrapper<EvaluateTaskEntity> queryWrapper); } src/main/java/org/springblade/evaluate/service/impl/EvaluateTaskServiceImpl.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.evaluate.service.impl; import org.springblade.evaluate.entity.EvaluateTaskEntity; import org.springblade.evaluate.vo.EvaluateTaskVO; import org.springblade.evaluate.excel.EvaluateTaskExcel; import org.springblade.evaluate.mapper.EvaluateTaskMapper; import org.springblade.evaluate.service.IEvaluateTaskService; 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-08 */ @Service public class EvaluateTaskServiceImpl extends BaseServiceImpl<EvaluateTaskMapper, EvaluateTaskEntity> implements IEvaluateTaskService { @Override public IPage<EvaluateTaskVO> selectEvaluateTaskPage(IPage<EvaluateTaskVO> page, EvaluateTaskVO evaluateTask) { return page.setRecords(baseMapper.selectEvaluateTaskPage(page, evaluateTask)); } @Override public List<EvaluateTaskExcel> exportEvaluateTask(Wrapper<EvaluateTaskEntity> queryWrapper) { List<EvaluateTaskExcel> evaluateTaskList = baseMapper.exportEvaluateTask(queryWrapper); //evaluateTaskList.forEach(evaluateTask -> { // evaluateTask.setTypeName(DictCache.getValue(DictEnum.YES_NO, EvaluateTask.getType())); //}); return evaluateTaskList; } } src/main/java/org/springblade/evaluate/vo/EvaluateTaskVO.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.evaluate.vo; import org.springblade.evaluate.entity.EvaluateTaskEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; /** * 评优任务表 视图实体类 * * @author aix * @since 2023-12-08 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateTaskVO extends EvaluateTaskEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/evaluate/wrapper/EvaluateTaskWrapper.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.evaluate.wrapper; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.evaluate.entity.EvaluateTaskEntity; import org.springblade.evaluate.vo.EvaluateTaskVO; import java.util.Objects; /** * 评优任务表 包装类,返回视图层所需的字段 * * @author aix * @since 2023-12-08 */ public class EvaluateTaskWrapper extends BaseEntityWrapper<EvaluateTaskEntity, EvaluateTaskVO> { public static EvaluateTaskWrapper build() { return new EvaluateTaskWrapper(); } @Override public EvaluateTaskVO entityVO(EvaluateTaskEntity evaluateTask) { EvaluateTaskVO evaluateTaskVO = Objects.requireNonNull(BeanUtil.copy(evaluateTask, EvaluateTaskVO.class)); //User createUser = UserCache.getUser(evaluateTask.getCreateUser()); //User updateUser = UserCache.getUser(evaluateTask.getUpdateUser()); //evaluateTaskVO.setCreateUserName(createUser.getName()); //evaluateTaskVO.setUpdateUserName(updateUser.getName()); return evaluateTaskVO; } }