xiebin
2022-09-20 baf71566dc4e6ae1e7a0c66fc764acda298557ed
增加巡检计划功能
11 files added
536 ■■■■■ changed files
src/main/java/org/springblade/common/constant/NoConstant.java 22 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/controller/TaskinfoPlanController.java 126 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/dto/TaskinfoPlanDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/entity/TaskinfoPlanEntity.java 75 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/mapper/TaskinfoPlanMapper.java 47 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/mapper/TaskinfoPlanMapper.xml 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/service/ITaskinfoPlanService.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/service/impl/TaskinfoPlanServiceImpl.java 60 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/vo/TaskinfoPlanVO.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskinfo/wrapper/TaskinfoPlanWrapper.java 50 ●●●●● patch | view | raw | blame | history
src/main/java/sql/taskinfoplan.menu.sql 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/constant/NoConstant.java
New file
@@ -0,0 +1,22 @@
package org.springblade.common.constant;
/**
 * @ClassName NoConstant
 * @Description TODO
 * @Author aix
 * @Date 2022/9/20 17:12
 * @Version 1.0
 */
public interface NoConstant {
    /**
     * 维修管理编号生成前缀
      */
    String WXGL_PREFIX_NO = "WXGD";
    /**
     * 巡检计划编号生成前缀
     */
    String XJJH__PREFIX_NO = "XJJH";
}
src/main/java/org/springblade/modules/taskinfo/controller/TaskinfoPlanController.java
New file
@@ -0,0 +1,126 @@
/*
 *      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.taskinfo.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.metadata.IPage;
import org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity;
import org.springblade.modules.taskinfo.vo.TaskinfoPlanVO;
import org.springblade.modules.taskinfo.wrapper.TaskinfoPlanWrapper;
import org.springblade.modules.taskinfo.service.ITaskinfoPlanService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 巡检计划 控制器
 *
 * @author aix
 * @since 2022-09-20
 */
@RestController
@AllArgsConstructor
@RequestMapping("blade-taskinfoPlan/taskinfoPlan")
@Api(value = "巡检计划", tags = "巡检计划接口")
public class TaskinfoPlanController extends BladeController {
    private final ITaskinfoPlanService taskinfoPlanService;
    /**
     * 巡检计划 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入taskinfoPlan")
    public R<TaskinfoPlanVO> detail(TaskinfoPlanEntity taskinfoPlan) {
        TaskinfoPlanEntity detail = taskinfoPlanService.getOne(Condition.getQueryWrapper(taskinfoPlan));
        return R.data(TaskinfoPlanWrapper.build().entityVO(detail));
    }
    /**
     * 巡检计划 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入taskinfoPlan")
    public R<IPage<TaskinfoPlanVO>> list(TaskinfoPlanEntity taskinfoPlan, Query query) {
        IPage<TaskinfoPlanEntity> pages = taskinfoPlanService.page(Condition.getPage(query), Condition.getQueryWrapper(taskinfoPlan));
        return R.data(TaskinfoPlanWrapper.build().pageVO(pages));
    }
    /**
     * 巡检计划 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入taskinfoPlan")
    public R<IPage<TaskinfoPlanVO>> page(TaskinfoPlanVO taskinfoPlan, Query query) {
        IPage<TaskinfoPlanVO> pages = taskinfoPlanService.selectTaskinfoPlanPage(Condition.getPage(query), taskinfoPlan);
        return R.data(pages);
    }
    /**
     * 巡检计划 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入taskinfoPlan")
    public R save(@Valid @RequestBody TaskinfoPlanEntity taskinfoPlan) {
        return R.status(taskinfoPlanService.save(taskinfoPlan));
    }
    /**
     * 巡检计划 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入taskinfoPlan")
    public R update(@Valid @RequestBody TaskinfoPlanEntity taskinfoPlan) {
        return R.status(taskinfoPlanService.updateById(taskinfoPlan));
    }
    /**
     * 巡检计划 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入taskinfoPlan")
    public R submit(@Valid @RequestBody TaskinfoPlanEntity taskinfoPlan) {
        return R.status(taskinfoPlanService.saveOrUpdate(taskinfoPlan));
    }
    /**
     * 巡检计划 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(taskinfoPlanService.deleteLogic(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/taskinfo/dto/TaskinfoPlanDTO.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.taskinfo.dto;
import org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 巡检计划 数据传输对象实体类
 *
 * @author aix
 * @since 2022-09-20
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class TaskinfoPlanDTO extends TaskinfoPlanEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/taskinfo/entity/TaskinfoPlanEntity.java
New file
@@ -0,0 +1,75 @@
/*
 *      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.taskinfo.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 2022-09-20
 */
@Data
@TableName("ins_taskinfo_plan")
@ApiModel(value = "TaskinfoPlan对象", description = "巡检计划")
@EqualsAndHashCode(callSuper = true)
public class TaskinfoPlanEntity extends TenantEntity {
    /**
     * 计划编号
     */
    @ApiModelProperty(value = "计划编号")
    private String no;
    /**
     * 计划标题
     */
    @ApiModelProperty(value = "计划标题")
    private String title;
    /**
     * 执行周期
     */
    @ApiModelProperty(value = "执行周期")
    private String type;
    /**
     * 开始时间
     */
    @ApiModelProperty(value = "开始时间")
    private Date startTime;
    /**
     * 结束时间
     */
    @ApiModelProperty(value = "结束时间")
    private Date endTime;
    /**
     * 内容
     */
    @ApiModelProperty(value = "内容")
    private String content;
    /**
     * 路线范围
     */
    @ApiModelProperty(value = "路线范围")
    private byte[] routeRange;
}
src/main/java/org/springblade/modules/taskinfo/mapper/TaskinfoPlanMapper.java
New file
@@ -0,0 +1,47 @@
/*
 *      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.taskinfo.mapper;
import org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity;
import org.springblade.modules.taskinfo.vo.TaskinfoPlanVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 巡检计划 Mapper 接口
 *
 * @author aix
 * @since 2022-09-20
 */
public interface TaskinfoPlanMapper extends BaseMapper<TaskinfoPlanEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param taskinfoPlan
     * @return
     */
    List<TaskinfoPlanVO> selectTaskinfoPlanPage(IPage page, TaskinfoPlanVO taskinfoPlan);
    /**
     * 获取最大工单编号
     * @return 最大工单编号
     */
    TaskinfoPlanVO getMaxNo();
}
src/main/java/org/springblade/modules/taskinfo/mapper/TaskinfoPlanMapper.xml
New file
@@ -0,0 +1,35 @@
<?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.taskinfo.mapper.TaskinfoPlanMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="taskinfoPlanResultMap" type="org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity">
        <result column="id" property="id"/>
        <result column="no" property="no"/>
        <result column="title" property="title"/>
        <result column="type" property="type"/>
        <result column="start_time" property="startTime"/>
        <result column="end_time" property="endTime"/>
        <result column="content" property="content"/>
        <result column="route_range" property="routeRange"/>
        <result column="create_user" property="createUser"/>
        <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"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="create_dept" property="createDept"/>
    </resultMap>
    <select id="selectTaskinfoPlanPage" resultMap="taskinfoPlanResultMap">
        select * from ins_taskinfo_plan where is_deleted = 0
    </select>
    <select id="getMaxNo" resultMap="taskinfoPlanResultMap">
        SELECT * from ins_taskinfo_plan where is_deleted = 0 ORDER BY create_time DESC LIMIT 1
    </select>
</mapper>
src/main/java/org/springblade/modules/taskinfo/service/ITaskinfoPlanService.java
New file
@@ -0,0 +1,42 @@
/*
 *      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.taskinfo.service;
import org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity;
import org.springblade.modules.taskinfo.vo.TaskinfoPlanVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 巡检计划 服务类
 *
 * @author aix
 * @since 2022-09-20
 */
public interface ITaskinfoPlanService extends BaseService<TaskinfoPlanEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param taskinfoPlan
     * @return
     */
    IPage<TaskinfoPlanVO> selectTaskinfoPlanPage(IPage<TaskinfoPlanVO> page, TaskinfoPlanVO taskinfoPlan);
    TaskinfoPlanVO getMaxNo();
}
src/main/java/org/springblade/modules/taskinfo/service/impl/TaskinfoPlanServiceImpl.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.taskinfo.service.impl;
import org.springblade.common.constant.NoConstant;
import org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity;
import org.springblade.modules.taskinfo.vo.TaskinfoPlanVO;
import org.springblade.modules.taskinfo.mapper.TaskinfoPlanMapper;
import org.springblade.modules.taskinfo.service.ITaskinfoPlanService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.utils.NumberUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 巡检计划 服务实现类
 *
 * @author aix
 * @since 2022-09-20
 */
@Service
public class TaskinfoPlanServiceImpl extends BaseServiceImpl<TaskinfoPlanMapper, TaskinfoPlanEntity> implements ITaskinfoPlanService {
    @Override
    public IPage<TaskinfoPlanVO> selectTaskinfoPlanPage(IPage<TaskinfoPlanVO> page, TaskinfoPlanVO taskinfoPlan) {
        return page.setRecords(baseMapper.selectTaskinfoPlanPage(page, taskinfoPlan));
    }
    @Override
    public boolean save(TaskinfoPlanEntity entity) {
        TaskinfoPlanVO vo = new TaskinfoPlanVO();
        String str = "";
        if (vo != null) {
            str = vo.getNo();
        }
        entity.setNo(NumberUtils.autoCreateNumber(NoConstant.XJJH__PREFIX_NO,str));
        return super.save(entity);
    }
    @Override
    public TaskinfoPlanVO getMaxNo() {
        return baseMapper.getMaxNo();
    }
}
src/main/java/org/springblade/modules/taskinfo/vo/TaskinfoPlanVO.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.taskinfo.vo;
import org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 巡检计划 视图实体类
 *
 * @author aix
 * @since 2022-09-20
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class TaskinfoPlanVO extends TaskinfoPlanEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/taskinfo/wrapper/TaskinfoPlanWrapper.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.taskinfo.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity;
import org.springblade.modules.taskinfo.vo.TaskinfoPlanVO;
import java.util.Objects;
/**
 * 巡检计划 包装类,返回视图层所需的字段
 *
 * @author aix
 * @since 2022-09-20
 */
public class TaskinfoPlanWrapper extends BaseEntityWrapper<TaskinfoPlanEntity, TaskinfoPlanVO>  {
    public static TaskinfoPlanWrapper build() {
        return new TaskinfoPlanWrapper();
     }
    @Override
    public TaskinfoPlanVO entityVO(TaskinfoPlanEntity taskinfoPlan) {
        TaskinfoPlanVO taskinfoPlanVO = Objects.requireNonNull(BeanUtil.copy(taskinfoPlan, TaskinfoPlanVO.class));
        //User createUser = UserCache.getUser(taskinfoPlan.getCreateUser());
        //User updateUser = UserCache.getUser(taskinfoPlan.getUpdateUser());
        //taskinfoPlanVO.setCreateUserName(createUser.getName());
        //taskinfoPlanVO.setUpdateUserName(updateUser.getName());
        return taskinfoPlanVO;
    }
}
src/main/java/sql/taskinfoplan.menu.sql
New file
@@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1572149263840104450', 1569608580767997953, 'taskinfoPlan', '巡检计划', 'menu', '/taskinfo/taskinfoPlan', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1572149263840104451', '1572149263840104450', 'taskinfoPlan_add', '新增', 'add', '/taskinfo/taskinfoPlan/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1572149263840104452', '1572149263840104450', 'taskinfoPlan_edit', '修改', 'edit', '/taskinfo/taskinfoPlan/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1572149263840104453', '1572149263840104450', 'taskinfoPlan_delete', '删除', 'delete', '/api/blade-taskinfoPlan/taskinfoPlan/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1572149263840104454', '1572149263840104450', 'taskinfoPlan_view', '查看', 'view', '/taskinfo/taskinfoPlan/view', 'file-text', 4, 2, 2, 1, NULL, 0);