guarantee-lsq пре 10 месеци
родитељ
комит
5d7189f458

+ 89 - 0
platform-dao/src/main/java/com/platform/dao/dto/custom/CustomRelationDTO.java

@@ -0,0 +1,89 @@
+package com.platform.dao.dto.custom;
+
+import com.platform.common.bean.BaseDTO;
+import com.platform.common.validation.group.UpdateGroup;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @Description 默认关联DTO
+ * @Author lsq
+ * @Date 2024-08-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class CustomRelationDTO extends BaseDTO implements Serializable {
+
+    /**
+     * ID
+     */
+    private String id;
+    /**
+     * 模板分类
+     */
+    private String category;
+    /**
+     * 表单分类
+     */
+    private String type;
+    /**
+     * json字符串
+     */
+    private String json;
+    /**
+     * 备注
+     */
+    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;
+
+}

+ 0 - 1
platform-dao/src/main/java/com/platform/dao/entity/custom/CustomForm.java

@@ -78,5 +78,4 @@ public class CustomForm implements Serializable{
     private Integer status; // 表单状态 0 待发布 1 已发布 2 已废弃
 
     private String category; // 分类  category_type  设备 维修 采购 备件 仓库 巡检 点检  保养
-
 }

+ 76 - 0
platform-dao/src/main/java/com/platform/dao/entity/custom/CustomRelation.java

@@ -0,0 +1,76 @@
+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-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@Table(name = "t_custom_relation")
+public class CustomRelation implements Serializable {
+
+    /**
+     * ID
+     */
+    @Id
+    private String id;
+    /**
+     * 模板分类
+     */
+    private String category;
+    /**
+     * 表单分类
+     */
+    private String type;
+    /**
+     * json字符串
+     */
+    private String json;
+    /**
+     * 备注
+     */
+    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/CustomRelationMapper.java

@@ -0,0 +1,26 @@
+package com.platform.dao.mapper.custom;
+
+import com.platform.dao.dto.custom.CustomRelationDTO;
+import com.platform.dao.config.MyMapper;
+import com.platform.dao.entity.custom.CustomRelation;
+import com.platform.dao.vo.query.custom.CustomRelationVO;
+import org.springframework.stereotype.Component;
+import java.util.List;
+
+
+/**
+ * @Description 默认关联 mapper
+ * @Author lsq
+ * @Date 2024-08-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Component
+public interface CustomRelationMapper extends MyMapper<CustomRelation> {
+    /**
+     * 分页查询
+     * @param dto
+     * @return
+     */
+    List<CustomRelationVO> selectList(CustomRelationDTO dto);
+
+}

+ 87 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/custom/ExportCustomRelationVO.java

@@ -0,0 +1,87 @@
+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-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+public class ExportCustomRelationVO implements Serializable {
+
+    /**
+   * ID
+   */
+          @Excel(name = "ID", orderNum = "1")
+      private String id;
+    
+    /**
+   * 模板分类
+   */
+          @Excel(name = "模板分类", orderNum = "2")
+      private String category;
+    
+    /**
+   * 表单分类
+   */
+          @Excel(name = "表单分类", orderNum = "3")
+      private String type;
+    
+    /**
+   * json字符串
+   */
+          @Excel(name = "json字符串", orderNum = "4")
+      private String json;
+    
+    /**
+   * 备注
+   */
+          @Excel(name = "备注", orderNum = "5")
+      private String remark;
+    
+    /**
+   * 添加时间
+   */
+          @Excel(name = "添加时间", orderNum = "6")
+      private LocalDateTime createdTime;
+    
+    /**
+   * 添加人ID
+   */
+          @Excel(name = "添加人ID", orderNum = "7")
+      private String createdUserId;
+    
+    /**
+   * 添加人
+   */
+          @Excel(name = "添加人", orderNum = "8")
+      private String createdUserName;
+    
+    /**
+   * 更新时间
+   */
+          @Excel(name = "更新时间", orderNum = "9")
+      private LocalDateTime updateTime;
+    
+    /**
+   * 更新人ID
+   */
+          @Excel(name = "更新人ID", orderNum = "10")
+      private String updateUserId;
+    
+    /**
+   * 更新人
+   */
+          @Excel(name = "更新人", orderNum = "11")
+      private String updateUserName;
+    
+  
+}

+ 67 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/custom/CustomRelationVO.java

@@ -0,0 +1,67 @@
+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-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class CustomRelationVO extends BaseVO implements Serializable {
+
+    /**
+     * ID
+     */
+    private String id;
+    /**
+     * 模板分类
+     */
+    private String category;
+    /**
+     * 表单分类
+     */
+    private String type;
+    /**
+     * json字符串
+     */
+    private String json;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 添加时间
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 添加人ID
+     */
+    private String createdUserId;
+    /**
+     * 添加人
+     */
+    private String createdUserName;
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 更新人ID
+     */
+    private String updateUserId;
+    /**
+     * 更新人
+     */
+    private String updateUserName;
+
+}

+ 61 - 0
platform-dao/src/main/resources/mapper/custom/CustomRelationMapper.xml

@@ -0,0 +1,61 @@
+<?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.CustomRelationMapper">
+    <sql id="List_Condition">
+        <if test="id != null and id != ''">
+            and relation.id = #{id}
+        </if>
+        <if test="category != null and category != ''">
+            and relation.category = #{category}
+        </if>
+        <if test="type != null and type != ''">
+            and relation.type = #{type}
+        </if>
+        <if test="json != null">
+            and relation.json = #{json}
+        </if>
+        <if test="remark != null and remark != ''">
+            and relation.remark = #{remark}
+        </if>
+        <if test="createdTimeStart != null">
+            and relation.created_time <![CDATA[>=]]>; #{createdTimeStart}
+        </if>
+        <if test="createdTimeEnd != null">
+            and relation.created_time <![CDATA[<=]]> #{createdTimeEnd}
+        </if>
+        <if test="createdTime != null">
+            and relation.created_time = #{createdTime}
+        </if>
+        <if test="createdUserId != null and createdUserId != ''">
+            and relation.created_user_id = #{createdUserId}
+        </if>
+        <if test="createdUserName != null and createdUserName != ''">
+            and relation.created_user_name = #{createdUserName}
+        </if>
+        <if test="updateTimeStart != null">
+            and relation.update_time <![CDATA[>=]]>; #{updateTimeStart}
+        </if>
+        <if test="updateTimeEnd != null">
+            and relation.update_time <![CDATA[<=]]> #{updateTimeEnd}
+        </if>
+        <if test="updateTime != null">
+            and relation.update_time = #{updateTime}
+        </if>
+        <if test="updateUserId != null and updateUserId != ''">
+            and relation.update_user_id = #{updateUserId}
+        </if>
+        <if test="updateUserName != null and updateUserName != ''">
+            and relation.update_user_name = #{updateUserName}
+        </if>
+        <if test="keyword != null and keyword != ''">
+            and relation.id like concat(concat('%',#{keyword}),'%')
+        </if>
+    </sql>
+    <select id="selectList" parameterType="com.platform.dao.dto.custom.CustomRelationDTO" resultType="com.platform.dao.vo.query.custom.CustomRelationVO">
+        select relation.*
+        from t_custom_relation as relation
+        <where>
+            <include refid="List_Condition"/>
+        </where>
+    </select>
+</mapper>

+ 135 - 0
platform-rest/src/main/java/com/platform/rest/controller/custom/CustomRelationController.java

@@ -0,0 +1,135 @@
+package com.platform.rest.controller.custom;
+
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.common.util.BeanConverterUtil;
+import com.platform.common.util.R;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.dto.custom.CustomRelationDTO;
+import com.platform.dao.entity.custom.CustomRelation;
+import com.platform.dao.util.ExcelUtil;
+import com.platform.dao.vo.export.custom.ExportCustomRelationVO;
+import com.platform.dao.vo.query.custom.CustomRelationVO;
+import com.platform.rest.log.annotation.SysLog;
+import com.platform.service.custom.CustomRelationService;
+import lombok.AllArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * @Description 默认关联 控制器
+ * @Author lsq
+ * @Date 2024-08-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/custom/relation")
+public class CustomRelationController {
+
+    private final CustomRelationService customRelationService;
+
+    /**
+     * 通过id查询单条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R<CustomRelation> getById(@PathVariable("id") String id) {
+        return new R<>(customRelationService.getModelById(id));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param customRelationDTO 默认关联DTO
+     * @return R
+     */
+    @SysLog("新增默认关联")
+    @PostMapping
+    public R save(@Validated({AddGroup.class}) @RequestBody CustomRelationDTO customRelationDTO) {
+        return new R<>(customRelationService.saveModelByDTO(customRelationDTO));
+    }
+
+    /**
+     * 修改记录
+     *
+     * @param customRelationDTO 默认关联DTO
+     * @return R
+     */
+    @SysLog("修改默认关联")
+    @PutMapping("/{id}")
+    public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody CustomRelationDTO customRelationDTO) {
+        customRelationService.modModelByDTO(customRelationDTO);
+        return new R<>();
+    }
+
+
+    /**
+     * 通过id删除一条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @SysLog("删除默认关联")
+    @DeleteMapping("/{id}")
+    public R removeById(@PathVariable String id) {
+        customRelationService.deleteByPrimaryKey(id);
+        return new R<>();
+    }
+
+    /**
+     * 批量记录
+     *
+     * @param ids 主键
+     * @return R
+     */
+    @SysLog("批量删除默认关联")
+    @DeleteMapping("")
+    public R removeIds(@RequestBody List<String> ids) {
+        customRelationService.batchDelete(ids);
+        return new R<>();
+    }
+
+    /**
+     * 获取分页
+     *
+     * @param pageNum           当前页码
+     * @param pageSize          每页条数
+     * @param customRelationDTO 默认关联DTO
+     * @return R
+     */
+    @GetMapping("/page")
+    public R<AbstractPageResultBean<CustomRelationVO>> query(CustomRelationDTO customRelationDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R<>(customRelationService.selectPageList(customRelationDTO, pageNum, pageSize));
+    }
+
+    /**
+     * 获取列表
+     *
+     * @param customRelationDTO 默认关联DTO
+     * @return R
+     */
+    @GetMapping("")
+    public R query(CustomRelationDTO customRelationDTO) {
+        return new R<>(customRelationService.getModelListByDTO(customRelationDTO));
+    }
+
+    /**
+     * 默认关联导出
+     *
+     * @param customRelationDTO 默认关联DTO
+     * @return R
+     */
+    @GetMapping("/export")
+    @SysLog("默认关联导出")
+    public void export(HttpServletResponse response, CustomRelationDTO customRelationDTO) {
+        List<CustomRelation> list = customRelationService.getModelListByDTO(customRelationDTO);
+        ExcelUtil.exportResponseDict(response, ExportCustomRelationVO.class, BeanConverterUtil.copyListProperties(list, ExportCustomRelationVO.class), "默认关联");
+    }
+
+}

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

@@ -0,0 +1,37 @@
+package com.platform.service.custom;
+
+import com.platform.dao.vo.query.custom.CustomRelationVO;
+import com.platform.dao.dto.custom.CustomRelationDTO;
+import com.platform.dao.entity.custom.CustomRelation;
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.service.base.IBaseService;
+
+import java.util.List;
+
+/**
+ * @Description 默认关联 service
+ * @Author lsq
+ * @Date 2024-08-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+public interface CustomRelationService extends IBaseService<CustomRelation, CustomRelationDTO> {
+
+    /**
+     * 批量删除
+     *
+     * @param ids :
+     * @return :
+     */
+    int batchDelete(List<String> ids);
+
+    /**
+     * 分页查询
+     *
+     * @param record
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    AbstractPageResultBean<CustomRelationVO> selectPageList(CustomRelationDTO record, int pageNum, int pageSize);
+
+}

+ 51 - 0
platform-service/src/main/java/com/platform/service/custom/impl/CustomRelationServiceImpl.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.CustomRelationVO;
+import com.platform.dao.dto.custom.CustomRelationDTO;
+import com.platform.dao.entity.custom.CustomRelation;
+import com.platform.dao.mapper.custom.CustomRelationMapper;
+import com.platform.service.custom.CustomRelationService;
+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-06 15:54:26
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@AllArgsConstructor
+@Service("customRelationService")
+public class CustomRelationServiceImpl extends BaseServiceImpl<CustomRelationMapper, CustomRelation, CustomRelationDTO> implements CustomRelationService {
+
+    @Override
+    public int batchDelete(List<String> ids) {
+        Weekend<CustomRelation> weekend = new Weekend<>(CustomRelation.class);
+        WeekendCriteria<CustomRelation, Object> weekendCriteria = weekend.weekendCriteria();
+        weekendCriteria.andIn(CustomRelation::getId, ids);
+        mapper.deleteByExample(weekend);
+        return 1;
+    }
+
+    @Override
+    public AbstractPageResultBean<CustomRelationVO> selectPageList(CustomRelationDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        return new MyPage(mapper.selectList(record));
+    }
+
+    @Override
+    public AbstractPageResultBean<CustomRelation> selectPageInfo(CustomRelationDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        return new MyPage(mapper.selectList(record));
+    }
+
+}