src/main/java/org/springblade/assessmentTask/controller/AssessmentTaskController.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.assessmentTask.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.assessmentTask.entity.AssessmentTaskEntity; import org.springblade.assessmentTask.vo.AssessmentTaskVO; import org.springblade.assessmentTask.excel.AssessmentTaskExcel; import org.springblade.assessmentTask.wrapper.AssessmentTaskWrapper; import org.springblade.assessmentTask.service.IAssessmentTaskService; 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-07 */ @RestController @AllArgsConstructor @RequestMapping("assessmentTask/assessmentTask") @Api(value = "考核任务表", tags = "考核任务表接口") public class AssessmentTaskController extends BladeController { private final IAssessmentTaskService assessmentTaskService; /** * 考核任务表 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入assessmentTask") public R<AssessmentTaskVO> detail(AssessmentTaskEntity assessmentTask) { AssessmentTaskEntity detail = assessmentTaskService.getOne(Condition.getQueryWrapper(assessmentTask)); return R.data(AssessmentTaskWrapper.build().entityVO(detail)); } /** * 考核任务表 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入assessmentTask") public R<IPage<AssessmentTaskVO>> list(@ApiIgnore @RequestParam Map<String, Object> assessmentTask, Query query) { IPage<AssessmentTaskEntity> pages = assessmentTaskService.page(Condition.getPage(query), Condition.getQueryWrapper(assessmentTask, AssessmentTaskEntity.class)); return R.data(AssessmentTaskWrapper.build().pageVO(pages)); } /** * 考核任务表 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入assessmentTask") public R<IPage<AssessmentTaskVO>> page(AssessmentTaskVO assessmentTask, Query query) { IPage<AssessmentTaskVO> pages = assessmentTaskService.selectAssessmentTaskPage(Condition.getPage(query), assessmentTask); return R.data(pages); } /** * 考核任务表 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入assessmentTask") public R save(@Valid @RequestBody AssessmentTaskEntity assessmentTask) { return R.status(assessmentTaskService.save(assessmentTask)); } /** * 考核任务表 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入assessmentTask") public R update(@Valid @RequestBody AssessmentTaskEntity assessmentTask) { return R.status(assessmentTaskService.updateById(assessmentTask)); } /** * 考核任务表 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入assessmentTask") public R submit(@Valid @RequestBody AssessmentTaskEntity assessmentTask) { return R.status(assessmentTaskService.saveOrUpdate(assessmentTask)); } /** * 考核任务表 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(assessmentTaskService.deleteLogic(Func.toLongList(ids))); } /** * 导出数据 */ @GetMapping("/export-assessmentTask") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入assessmentTask") public void exportAssessmentTask(@ApiIgnore @RequestParam Map<String, Object> assessmentTask, BladeUser bladeUser, HttpServletResponse response) { QueryWrapper<AssessmentTaskEntity> queryWrapper = Condition.getQueryWrapper(assessmentTask, AssessmentTaskEntity.class); //if (!AuthUtil.isAdministrator()) { // queryWrapper.lambda().eq(AssessmentTask::getTenantId, bladeUser.getTenantId()); //} queryWrapper.lambda().eq(AssessmentTaskEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); List<AssessmentTaskExcel> list = assessmentTaskService.exportAssessmentTask(queryWrapper); ExcelUtil.export(response, "考核任务表数据" + DateUtil.time(), "考核任务表数据表", list, AssessmentTaskExcel.class); } } src/main/java/org/springblade/assessmentTask/dto/AssessmentTaskDTO.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.assessmentTask.dto; import org.springblade.assessmentTask.entity.AssessmentTaskEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * 考核任务表 数据传输对象实体类 * * @author aix * @since 2023-12-07 */ @Data @EqualsAndHashCode(callSuper = true) public class AssessmentTaskDTO extends AssessmentTaskEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/assessmentTask/entity/AssessmentTaskEntity.java
New file @@ -0,0 +1,65 @@ /* * 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.assessmentTask.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-07 */ @Data @TableName("yw_assessment_task") @ApiModel(value = "AssessmentTask对象", description = "考核任务表") @EqualsAndHashCode(callSuper = true) public class AssessmentTaskEntity extends TenantEntity { /** * 考核编号 */ @ApiModelProperty(value = "考核编号") private String assessmentNo; /** * 考核目的 */ @ApiModelProperty(value = "考核目的") private String assessmentPurpose; /** * 开始时间 */ @ApiModelProperty(value = "开始时间") private Date startTime; /** * 结束时间 */ @ApiModelProperty(value = "结束时间") private Date endTime; /** * 备注 */ @ApiModelProperty(value = "备注") private String remark; } src/main/java/org/springblade/assessmentTask/excel/AssessmentTaskExcel.java
New file @@ -0,0 +1,87 @@ /* * 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.assessmentTask.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-07 */ @Data @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) public class AssessmentTaskExcel implements Serializable { private static final long serialVersionUID = 1L; /** * 租户ID */ @ColumnWidth(20) @ExcelProperty("租户ID") private String tenantId; /** * 考核编号 */ @ColumnWidth(20) @ExcelProperty("考核编号") private String assessmentNo; /** * 考核目的 */ @ColumnWidth(20) @ExcelProperty("考核目的") private String assessmentPurpose; /** * 开始时间 */ @ColumnWidth(20) @ExcelProperty("开始时间") private Date startTime; /** * 结束时间 */ @ColumnWidth(20) @ExcelProperty("结束时间") private Date endTime; /** * 备注 */ @ColumnWidth(20) @ExcelProperty("备注") private String remark; /** * 是否已删除 */ @ColumnWidth(20) @ExcelProperty("是否已删除") private Integer isDeleted; } src/main/java/org/springblade/assessmentTask/mapper/AssessmentTaskMapper.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.assessmentTask.mapper; import org.springblade.assessmentTask.entity.AssessmentTaskEntity; import org.springblade.assessmentTask.vo.AssessmentTaskVO; import org.springblade.assessmentTask.excel.AssessmentTaskExcel; 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-07 */ public interface AssessmentTaskMapper extends BaseMapper<AssessmentTaskEntity> { /** * 自定义分页 * * @param page * @param assessmentTask * @return */ List<AssessmentTaskVO> selectAssessmentTaskPage(IPage page, AssessmentTaskVO assessmentTask); /** * 获取导出数据 * * @param queryWrapper * @return */ List<AssessmentTaskExcel> exportAssessmentTask(@Param("ew") Wrapper<AssessmentTaskEntity> queryWrapper); } src/main/java/org/springblade/assessmentTask/mapper/AssessmentTaskMapper.xml
New file @@ -0,0 +1,33 @@ <?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.assessmentTask.mapper.AssessmentTaskMapper"> <!-- 通用查询映射结果 --> <resultMap id="assessmentTaskResultMap" type="org.springblade.assessmentTask.entity.AssessmentTaskEntity"> <result column="id" property="id"/> <result column="tenant_id" property="tenantId"/> <result column="assessment_no" property="assessmentNo"/> <result column="assessment_purpose" property="assessmentPurpose"/> <result column="start_time" property="startTime"/> <result column="end_time" property="endTime"/> <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="selectAssessmentTaskPage" resultMap="assessmentTaskResultMap"> select * from yw_assessment_task where is_deleted = 0 </select> <select id="exportAssessmentTask" resultType="org.springblade.assessmentTask.excel.AssessmentTaskExcel"> SELECT * FROM yw_assessment_task ${ew.customSqlSegment} </select> </mapper> src/main/java/org/springblade/assessmentTask/service/IAssessmentTaskService.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.assessmentTask.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.springblade.assessmentTask.entity.AssessmentTaskEntity; import org.springblade.assessmentTask.vo.AssessmentTaskVO; import org.springblade.assessmentTask.excel.AssessmentTaskExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; import java.util.List; /** * 考核任务表 服务类 * * @author aix * @since 2023-12-07 */ public interface IAssessmentTaskService extends BaseService<AssessmentTaskEntity> { /** * 自定义分页 * * @param page * @param assessmentTask * @return */ IPage<AssessmentTaskVO> selectAssessmentTaskPage(IPage<AssessmentTaskVO> page, AssessmentTaskVO assessmentTask); /** * 导出数据 * * @param queryWrapper * @return */ List<AssessmentTaskExcel> exportAssessmentTask(Wrapper<AssessmentTaskEntity> queryWrapper); } src/main/java/org/springblade/assessmentTask/service/impl/AssessmentTaskServiceImpl.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.assessmentTask.service.impl; import org.springblade.assessmentTask.entity.AssessmentTaskEntity; import org.springblade.assessmentTask.vo.AssessmentTaskVO; import org.springblade.assessmentTask.excel.AssessmentTaskExcel; import org.springblade.assessmentTask.mapper.AssessmentTaskMapper; import org.springblade.assessmentTask.service.IAssessmentTaskService; 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-07 */ @Service public class AssessmentTaskServiceImpl extends BaseServiceImpl<AssessmentTaskMapper, AssessmentTaskEntity> implements IAssessmentTaskService { @Override public IPage<AssessmentTaskVO> selectAssessmentTaskPage(IPage<AssessmentTaskVO> page, AssessmentTaskVO assessmentTask) { return page.setRecords(baseMapper.selectAssessmentTaskPage(page, assessmentTask)); } @Override public List<AssessmentTaskExcel> exportAssessmentTask(Wrapper<AssessmentTaskEntity> queryWrapper) { List<AssessmentTaskExcel> assessmentTaskList = baseMapper.exportAssessmentTask(queryWrapper); //assessmentTaskList.forEach(assessmentTask -> { // assessmentTask.setTypeName(DictCache.getValue(DictEnum.YES_NO, AssessmentTask.getType())); //}); return assessmentTaskList; } } src/main/java/org/springblade/assessmentTask/vo/AssessmentTaskVO.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.assessmentTask.vo; import org.springblade.assessmentTask.entity.AssessmentTaskEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; /** * 考核任务表 视图实体类 * * @author aix * @since 2023-12-07 */ @Data @EqualsAndHashCode(callSuper = true) public class AssessmentTaskVO extends AssessmentTaskEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/assessmentTask/wrapper/AssessmentTaskWrapper.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.assessmentTask.wrapper; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.assessmentTask.entity.AssessmentTaskEntity; import org.springblade.assessmentTask.vo.AssessmentTaskVO; import java.util.Objects; /** * 考核任务表 包装类,返回视图层所需的字段 * * @author aix * @since 2023-12-07 */ public class AssessmentTaskWrapper extends BaseEntityWrapper<AssessmentTaskEntity, AssessmentTaskVO> { public static AssessmentTaskWrapper build() { return new AssessmentTaskWrapper(); } @Override public AssessmentTaskVO entityVO(AssessmentTaskEntity assessmentTask) { AssessmentTaskVO assessmentTaskVO = Objects.requireNonNull(BeanUtil.copy(assessmentTask, AssessmentTaskVO.class)); //User createUser = UserCache.getUser(assessmentTask.getCreateUser()); //User updateUser = UserCache.getUser(assessmentTask.getUpdateUser()); //assessmentTaskVO.setCreateUserName(createUser.getName()); //assessmentTaskVO.setUpdateUserName(updateUser.getName()); return assessmentTaskVO; } } src/main/resources/application-prod.yml
@@ -4,7 +4,7 @@ ##redis 单机环境配置 ##将docker脚本部署的redis服务映射为宿主机ip ##生产环境推荐使用阿里云高可用redis服务并设置密码 host: 127.0.0.1 host: 192.168.145.130 port: 6379 password: database: 0 @@ -14,9 +14,9 @@ # nodes: 127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003 # commandTimeout: 5000 datasource: url: jdbc:mysql://localhost:3306/bladex_boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true url: jdbc:mysql://182.106.212.58:3308/ztzh?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true username: root password: root password: yshb@123 #第三方登陆 social: