Browse Source

业务流程关联

guarantee-lsq 6 months ago
parent
commit
151f8008b3

+ 83 - 0
platform-dao/src/main/java/com/platform/dao/dto/custom/CustomWorkflowRelationDTO.java

@@ -0,0 +1,83 @@
+package com.platform.dao.dto.custom;
+
+import com.platform.common.bean.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @Description 流程业务关联DTO
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class CustomWorkflowRelationDTO extends BaseDTO implements Serializable {
+
+    /**
+     * ID
+     */
+    private String id;
+    /**
+     * 关联类型
+     */
+    private String linkType;
+    /**
+     * 流程ID
+     */
+    private String flowId;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 添加时间
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 添加时间开始
+     */
+    private LocalDateTime createdTimeStart;
+    /**
+     * 添加时间结束
+     */
+    private LocalDateTime createdTimeEnd;
+    /**
+     * 添加人ID
+     */
+    private String createdUserId;
+    /**
+     * 添加人
+     */
+    private String createdUserName;
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 更新时间开始
+     */
+    private LocalDateTime updateTimeStart;
+    /**
+     * 更新时间结束
+     */
+    private LocalDateTime updateTimeEnd;
+    /**
+     * 更新人ID
+     */
+    private String updateUserId;
+    /**
+     * 更新人
+     */
+    private String updateUserName;
+    /**
+     * 关键字
+     */
+    private String keyword;
+
+}

+ 72 - 0
platform-dao/src/main/java/com/platform/dao/entity/custom/CustomWorkflowRelation.java

@@ -0,0 +1,72 @@
+package com.platform.dao.entity.custom;
+
+import com.platform.common.bean.DataScope;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @Description 流程业务关联实体类
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@Table(name = "t_custom_workflow_relation")
+public class CustomWorkflowRelation implements Serializable {
+
+    /**
+     * ID
+     */
+    @Id
+    private String id;
+    /**
+     * 关联类型
+     */
+    private String linkType;
+    /**
+     * 流程ID
+     */
+    private String flowId;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 添加时间
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 添加人ID
+     */
+    private String createdUserId;
+    /**
+     * 添加人
+     */
+    private String createdUserName;
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 更新人ID
+     */
+    private String updateUserId;
+    /**
+     * 更新人
+     */
+    private String updateUserName;
+
+    /**
+     * 数据权限
+     */
+    @Transient
+    private DataScope dataScope;
+
+}

+ 26 - 0
platform-dao/src/main/java/com/platform/dao/mapper/custom/CustomWorkflowRelationMapper.java

@@ -0,0 +1,26 @@
+package com.platform.dao.mapper.custom;
+
+import com.platform.dao.dto.custom.CustomWorkflowRelationDTO;
+import com.platform.dao.config.MyMapper;
+import com.platform.dao.entity.custom.CustomWorkflowRelation;
+import com.platform.dao.vo.query.custom.CustomWorkflowRelationVO;
+import org.springframework.stereotype.Component;
+import java.util.List;
+
+
+/**
+ * @Description 流程业务关联 mapper
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Component
+public interface CustomWorkflowRelationMapper extends MyMapper<CustomWorkflowRelation> {
+    /**
+     * 分页查询
+     * @param dto
+     * @return
+     */
+    List<CustomWorkflowRelationVO> selectList(CustomWorkflowRelationDTO dto);
+
+}

+ 81 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/custom/ExportCustomWorkflowRelationVO.java

@@ -0,0 +1,81 @@
+package com.platform.dao.vo.export.custom;
+
+import com.platform.office.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.time.LocalDate;
+
+/**
+ * @Description 流程业务关联导出VO
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+public class ExportCustomWorkflowRelationVO implements Serializable {
+
+    /**
+   * ID
+   */
+          @Excel(name = "ID", orderNum = "1")
+      private String id;
+    
+    /**
+   * 关联类型
+   */
+          @Excel(name = "关联类型", orderNum = "2")
+      private String linkType;
+    
+    /**
+   * 流程ID
+   */
+          @Excel(name = "流程ID", orderNum = "3")
+      private String flowId;
+    
+    /**
+   * 备注
+   */
+          @Excel(name = "备注", orderNum = "4")
+      private String remark;
+    
+    /**
+   * 添加时间
+   */
+          @Excel(name = "添加时间", orderNum = "5")
+      private LocalDateTime createdTime;
+    
+    /**
+   * 添加人ID
+   */
+          @Excel(name = "添加人ID", orderNum = "6")
+      private String createdUserId;
+    
+    /**
+   * 添加人
+   */
+          @Excel(name = "添加人", orderNum = "7")
+      private String createdUserName;
+    
+    /**
+   * 更新时间
+   */
+          @Excel(name = "更新时间", orderNum = "8")
+      private LocalDateTime updateTime;
+    
+    /**
+   * 更新人ID
+   */
+          @Excel(name = "更新人ID", orderNum = "9")
+      private String updateUserId;
+    
+    /**
+   * 更新人
+   */
+          @Excel(name = "更新人", orderNum = "10")
+      private String updateUserName;
+    
+  
+}

+ 64 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/custom/CustomWorkflowRelationVO.java

@@ -0,0 +1,64 @@
+package com.platform.dao.vo.query.custom;
+
+import com.platform.common.bean.BaseVO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @Description 流程业务关联VO结果类
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class CustomWorkflowRelationVO extends BaseVO implements Serializable {
+
+    /**
+     * ID
+     */
+    private String id;
+    /**
+     * 关联类型
+     */
+    private String linkType;
+    /**
+     * 流程ID
+     */
+    private String flowId;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 添加时间
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 添加人ID
+     */
+    private String createdUserId;
+    /**
+     * 添加人
+     */
+    private String createdUserName;
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 更新人ID
+     */
+    private String updateUserId;
+    /**
+     * 更新人
+     */
+    private String updateUserName;
+
+
+}

+ 58 - 0
platform-dao/src/main/resources/mapper/custom/CustomWorkflowRelationMapper.xml

@@ -0,0 +1,58 @@
+<?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="com.platform.dao.mapper.custom.CustomWorkflowRelationMapper">
+    <sql id="List_Condition">
+        <if test="id != null and id != ''">
+            and flowrelation.id = #{id}
+        </if>
+        <if test="linkType != null and linkType != ''">
+            and flowrelation.link_type = #{linkType}
+        </if>
+        <if test="flowId != null and flowId != ''">
+            and flowrelation.flow_id = #{flowId}
+        </if>
+        <if test="remark != null and remark != ''">
+            and flowrelation.remark = #{remark}
+        </if>
+        <if test="createdTimeStart != null">
+            and flowrelation.created_time <![CDATA[>=]]>; #{createdTimeStart}
+        </if>
+        <if test="createdTimeEnd != null">
+            and flowrelation.created_time <![CDATA[<=]]> #{createdTimeEnd}
+        </if>
+        <if test="createdTime != null">
+            and flowrelation.created_time = #{createdTime}
+        </if>
+        <if test="createdUserId != null and createdUserId != ''">
+            and flowrelation.created_user_id = #{createdUserId}
+        </if>
+        <if test="createdUserName != null and createdUserName != ''">
+            and flowrelation.created_user_name = #{createdUserName}
+        </if>
+        <if test="updateTimeStart != null">
+            and flowrelation.update_time <![CDATA[>=]]>; #{updateTimeStart}
+        </if>
+        <if test="updateTimeEnd != null">
+            and flowrelation.update_time <![CDATA[<=]]> #{updateTimeEnd}
+        </if>
+        <if test="updateTime != null">
+            and flowrelation.update_time = #{updateTime}
+        </if>
+        <if test="updateUserId != null and updateUserId != ''">
+            and flowrelation.update_user_id = #{updateUserId}
+        </if>
+        <if test="updateUserName != null and updateUserName != ''">
+            and flowrelation.update_user_name = #{updateUserName}
+        </if>
+        <if test="keyword != null and keyword != ''">
+            and flowrelation.id like concat(concat('%',#{keyword}),'%')
+        </if>
+    </sql>
+    <select id="selectList" parameterType="com.platform.dao.dto.custom.CustomWorkflowRelationDTO" resultType="com.platform.dao.vo.query.custom.CustomWorkflowRelationVO">
+        select flowrelation.*
+        from t_custom_workflow_relation as flowrelation
+        <where>
+            <include refid="List_Condition"/>
+        </where>
+    </select>
+</mapper>

+ 141 - 0
platform-rest/src/main/java/com/platform/rest/controller/custom/CustomWorkflowRelationController.java

@@ -0,0 +1,141 @@
+package com.platform.rest.controller.custom;
+
+import com.platform.common.util.R;
+import com.platform.dao.dto.custom.CustomWorkflowRelationDTO;
+import com.platform.dao.entity.custom.CustomWorkflowRelation;
+import com.platform.service.custom.CustomWorkflowRelationService;
+import com.platform.dao.util.ExcelUtil;
+import com.platform.dao.vo.export.custom.ExportCustomWorkflowRelationVO;
+import com.platform.dao.vo.query.custom.CustomWorkflowRelationVO;
+import com.platform.common.util.BeanConverterUtil;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import lombok.AllArgsConstructor;
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.rest.log.annotation.SysLog;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @Description 流程业务关联 控制器
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/custom/flowrelation")
+public class CustomWorkflowRelationController {
+
+    private final CustomWorkflowRelationService customWorkflowRelationService;
+
+    /**
+     * 通过id查询单条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R<CustomWorkflowRelation> getById(@PathVariable("id") String id) {
+        return new R<>(customWorkflowRelationService.getModelById(id));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param customWorkflowRelationDTO 流程业务关联DTO
+     * @return R
+     */
+    @SysLog("新增流程业务关联")
+    @PostMapping
+    @PreAuthorize("@pms.hasPermission('custom-flowrelation-add')")
+    public R save(@Validated({AddGroup.class}) @RequestBody CustomWorkflowRelationDTO customWorkflowRelationDTO) {
+        return new R<>(customWorkflowRelationService.saveModelByDTO(customWorkflowRelationDTO));
+    }
+
+    /**
+     * 修改记录
+     *
+     * @param customWorkflowRelationDTO 流程业务关联DTO
+     * @return R
+     */
+    @SysLog("修改流程业务关联")
+    @PutMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('custom-flowrelation-edit')")
+    public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody CustomWorkflowRelationDTO customWorkflowRelationDTO) {
+        customWorkflowRelationService.modModelByDTO(customWorkflowRelationDTO);
+        return new R<>();
+    }
+
+
+    /**
+     * 通过id删除一条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @SysLog("删除流程业务关联")
+    @DeleteMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('custom-flowrelation-del')")
+    public R removeById(@PathVariable String id) {
+        customWorkflowRelationService.deleteByPrimaryKey(id);
+        return new R<>();
+    }
+
+    /**
+     * 批量记录
+     *
+     * @param ids 主键
+     * @return R
+     */
+    @SysLog("批量删除流程业务关联")
+    @DeleteMapping("")
+    @PreAuthorize("@pms.hasPermission('custom-flowrelation-del')")
+    public R removeIds(@RequestBody List<String> ids) {
+        customWorkflowRelationService.batchDelete(ids);
+        return new R<>();
+    }
+
+    /**
+     * 获取分页
+     *
+     * @param pageNum                   当前页码
+     * @param pageSize                  每页条数
+     * @param customWorkflowRelationDTO 流程业务关联DTO
+     * @return R
+     */
+    @GetMapping("/page")
+    public R<AbstractPageResultBean<CustomWorkflowRelationVO>> query(CustomWorkflowRelationDTO customWorkflowRelationDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R<>(customWorkflowRelationService.selectPageList(customWorkflowRelationDTO, pageNum, pageSize));
+    }
+
+    /**
+     * 获取列表
+     *
+     * @param customWorkflowRelationDTO 流程业务关联DTO
+     * @return R
+     */
+    @GetMapping("")
+    public R query(CustomWorkflowRelationDTO customWorkflowRelationDTO) {
+        return new R<>(customWorkflowRelationService.getModelListByDTO(customWorkflowRelationDTO));
+    }
+
+    /**
+     * 流程业务关联导出
+     *
+     * @param customWorkflowRelationDTO 流程业务关联DTO
+     * @return R
+     */
+    @GetMapping("/export")
+    @SysLog("流程业务关联导出")
+    @PreAuthorize("@pms.hasPermission('custom-flowrelation-export')")
+    public void export(HttpServletResponse response, CustomWorkflowRelationDTO customWorkflowRelationDTO) {
+        List<CustomWorkflowRelation> list = customWorkflowRelationService.getModelListByDTO(customWorkflowRelationDTO);
+        ExcelUtil.exportResponseDict(response, ExportCustomWorkflowRelationVO.class, BeanConverterUtil.copyListProperties(list, ExportCustomWorkflowRelationVO.class), "流程业务关联");
+    }
+
+}

+ 37 - 0
platform-service/src/main/java/com/platform/service/custom/CustomWorkflowRelationService.java

@@ -0,0 +1,37 @@
+package com.platform.service.custom;
+
+import com.platform.dao.vo.query.custom.CustomWorkflowRelationVO;
+import com.platform.dao.dto.custom.CustomWorkflowRelationDTO;
+import com.platform.dao.entity.custom.CustomWorkflowRelation;
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.service.base.IBaseService;
+
+import java.util.List;
+
+/**
+ * @Description 流程业务关联 service
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+public interface CustomWorkflowRelationService extends IBaseService<CustomWorkflowRelation, CustomWorkflowRelationDTO> {
+
+    /**
+     * 批量删除
+     *
+     * @param ids :
+     * @return :
+     */
+    int batchDelete(List<String> ids);
+
+    /**
+     * 分页查询
+     *
+     * @param record
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    AbstractPageResultBean<CustomWorkflowRelationVO> selectPageList(CustomWorkflowRelationDTO record, int pageNum, int pageSize);
+
+}

+ 51 - 0
platform-service/src/main/java/com/platform/service/custom/impl/CustomWorkflowRelationServiceImpl.java

@@ -0,0 +1,51 @@
+package com.platform.service.custom.impl;
+
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.dao.bean.MyPage;
+import com.github.pagehelper.PageHelper;
+import com.platform.dao.vo.query.custom.CustomWorkflowRelationVO;
+import com.platform.dao.dto.custom.CustomWorkflowRelationDTO;
+import com.platform.dao.entity.custom.CustomWorkflowRelation;
+import com.platform.dao.mapper.custom.CustomWorkflowRelationMapper;
+import com.platform.service.custom.CustomWorkflowRelationService;
+import org.springframework.stereotype.Service;
+import com.platform.service.base.impl.BaseServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+import tk.mybatis.mapper.weekend.Weekend;
+import tk.mybatis.mapper.weekend.WeekendCriteria;
+import lombok.AllArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @Description 流程业务关联 service 实现类
+ * @Author lsq
+ * @Date 2024-08-13 09:25:27
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@AllArgsConstructor
+@Service("customWorkflowRelationService")
+public class CustomWorkflowRelationServiceImpl extends BaseServiceImpl<CustomWorkflowRelationMapper, CustomWorkflowRelation, CustomWorkflowRelationDTO> implements CustomWorkflowRelationService {
+
+    @Override
+    public int batchDelete(List<String> ids) {
+        Weekend<CustomWorkflowRelation> weekend = new Weekend<>(CustomWorkflowRelation.class);
+        WeekendCriteria<CustomWorkflowRelation, Object> weekendCriteria = weekend.weekendCriteria();
+        weekendCriteria.andIn(CustomWorkflowRelation::getId, ids);
+        mapper.deleteByExample(weekend);
+        return 1;
+    }
+
+    @Override
+    public AbstractPageResultBean<CustomWorkflowRelationVO> selectPageList(CustomWorkflowRelationDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        return new MyPage(mapper.selectList(record));
+    }
+
+    @Override
+    public AbstractPageResultBean<CustomWorkflowRelation> selectPageInfo(CustomWorkflowRelationDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        return new MyPage(mapper.selectList(record));
+    }
+
+}