zhangherong
2025-04-17 ed3f8ade77cdb06c2d58a6fbe1ce5cd05fdbe746
art: 设备管理-设备台账-设备文档接口添加
已添加7个文件
已修改3个文件
784 ■■■■■ 文件已修改
db/数据库产品化设计.pdma.json 406 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentAttachmentController.java 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentAttachment.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentAttachmentMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentAttachmentMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentAttachmentRequest.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentAttachmentService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentAttachmentServiceImpl.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_config.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_database.properties 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
db/Êý¾Ý¿â²úÆ·»¯Éè¼Æ.pdma.json
@@ -4,7 +4,7 @@
  "avatar": "",
  "version": "4.9.2",
  "createdTime": "2025-3-10 16:38:19",
  "updatedTime": "2025-4-15 16:12:47",
  "updatedTime": "2025-4-16 17:11:07",
  "dbConns": [],
  "profile": {
    "default": {
@@ -16163,8 +16163,8 @@
          "codeRoot": ""
        }
      },
      "defKey": "eam_sys_files",
      "defName": "设备管理附件表",
      "defKey": "eam_equipment_attachment",
      "defName": "设备文档",
      "comment": "",
      "properties": {
        "partitioned by": "(date string)",
@@ -16414,6 +16414,24 @@
          "id": "AE037CD2-F1D7-43A9-8AA7-0B6556CABB47"
        },
        {
          "defKey": "equipment_id",
          "defName": "设备ID",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": "",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
          "id": "F0AA43F9-BB17-41C9-B5A3-9946067055FC"
        },
        {
          "defKey": "file_encode_name",
          "defName": "文件加密名",
          "comment": "",
@@ -16478,7 +16496,7 @@
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "hideInGraph": true,
          "refDict": "",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
@@ -16520,6 +16538,385 @@
          "extProps": {},
          "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573",
          "id": "5B36A3AD-359D-446C-87AD-338A4C6C0069"
        }
      ],
      "correlations": [],
      "indexes": [],
      "type": "P"
    },
    {
      "id": "9D0C5472-CECA-4676-8F92-5AD1D03EE367",
      "env": {
        "base": {
          "nameSpace": "",
          "codeRoot": ""
        }
      },
      "defKey": "eam_sys_files1",
      "defName": "设备管理附件表",
      "comment": "",
      "properties": {
        "partitioned by": "(date string)",
        "row format delimited": "",
        "fields terminated by ','": "",
        "collection items terminated by '-'": "",
        "map keys terminated by ':'": "",
        "store as textfile;": ""
      },
      "sysProps": {
        "nameTemplate": "{defKey}[{defName}]"
      },
      "notes": {},
      "headers": [
        {
          "refKey": "hideInGraph",
          "hideInGraph": true
        },
        {
          "refKey": "defKey",
          "freeze": false,
          "hideInGraph": false
        },
        {
          "refKey": "defName",
          "freeze": false,
          "hideInGraph": false
        },
        {
          "refKey": "primaryKey",
          "freeze": false,
          "hideInGraph": false
        },
        {
          "refKey": "notNull",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "autoIncrement",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "domain",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "type",
          "freeze": false,
          "hideInGraph": false
        },
        {
          "refKey": "len",
          "freeze": false,
          "hideInGraph": false
        },
        {
          "refKey": "scale",
          "freeze": false,
          "hideInGraph": false
        },
        {
          "refKey": "comment",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "refDict",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "defaultValue",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "isStandard",
          "freeze": false,
          "hideInGraph": false
        },
        {
          "refKey": "uiHint",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "extProps",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr1",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr2",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr3",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr4",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr5",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr6",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr7",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr8",
          "freeze": false,
          "hideInGraph": true
        },
        {
          "refKey": "attr9",
          "freeze": false,
          "hideInGraph": true
        }
      ],
      "fields": [
        {
          "defKey": "id",
          "defName": "主键",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": true,
          "notNull": true,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
          "id": "3699A3C0-B0E2-4461-BD22-F00D9CCDF981",
          "uiHint": null
        },
        {
          "defKey": "create_by",
          "defName": "创建人",
          "comment": "",
          "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": true,
          "refDict": null,
          "uiHint": null,
          "id": "66AAE852-A01A-45C5-86FD-CBDAC090207B",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64"
        },
        {
          "defKey": "create_time",
          "defName": "创建时间",
          "comment": "",
          "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": true,
          "refDict": null,
          "uiHint": null,
          "id": "E5DF786B-CDF8-4C7C-9000-F9DF66EB0B61",
          "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098"
        },
        {
          "defKey": "update_by",
          "defName": "更新人",
          "comment": "",
          "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": true,
          "refDict": null,
          "uiHint": null,
          "id": "71FE4281-BBF4-498D-9575-B86D7FBFE279",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64"
        },
        {
          "defKey": "update_time",
          "defName": "更新时间",
          "comment": "",
          "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": true,
          "refDict": null,
          "uiHint": null,
          "id": "52F980A8-0036-4FA4-AC68-3B207A828060",
          "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098"
        },
        {
          "defKey": "del_flag",
          "defName": "删除标记",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "1D764C4A-6F9F-421E-B11A-6F3E23B51811",
          "extProps": {},
          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
          "id": "E05B0E7B-556F-47E0-912A-074924FE90EF",
          "uiHint": null
        },
        {
          "defKey": "file_encode_name",
          "defName": "文件加密名",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "BE09D493-E183-402D-ACC4-EEA21EB35B8E",
          "id": "01499664-437B-40BF-A2D1-9D931D731984",
          "uiHint": null
        },
        {
          "defKey": "file_name",
          "defName": "文件名称",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "BE09D493-E183-402D-ACC4-EEA21EB35B8E",
          "id": "A3FD9D88-56A8-43D4-94EF-12E2F73DA4E1",
          "uiHint": null
        },
        {
          "defKey": "file_path",
          "defName": "文件保存路径",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573",
          "id": "D3320083-11F8-4A4C-B03D-24E7EB18A527",
          "uiHint": null
        },
        {
          "defKey": "file_suffix",
          "defName": "文件后缀名",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6",
          "id": "2232DE73-B928-4576-A3F7-99DAC095ABD2",
          "uiHint": null
        },
        {
          "defKey": "file_size",
          "defName": "文件大小",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "A48A12F5-2E10-4F0A-8449-60887F0D30E0",
          "extProps": {},
          "domain": "2E60DFAE-915E-4328-AEE2-6ED5FB43BAF5",
          "id": "07C7567D-6B96-432A-BE2C-54AFA4293E9F",
          "uiHint": null
        },
        {
          "defKey": "description",
          "defName": "描述",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": null,
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573",
          "id": "D9B55620-8B6D-48E0-A284-0BD9BF4B062F",
          "uiHint": null
        }
      ],
      "correlations": [],
@@ -17974,6 +18371,7 @@
      "refEntities": [
        "74D17B8E-6DA8-477B-810C-EC8B3FBF53F2",
        "B2E5D0C4-4FF7-4221-8366-FC7B31B7411A",
        "9D0C5472-CECA-4676-8F92-5AD1D03EE367",
        "257DC169-B593-4D03-8FE4-6AF75C335A93",
        "B9F80758-3E0D-4350-9DA0-C2D82DC2912A",
        "759CE3A5-4823-4215-B14F-5D26B6FA0B58",
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentAttachmentController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,158 @@
package org.jeecg.modules.eam.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.eam.entity.EamEquipmentAttachment;
import org.jeecg.modules.eam.request.EamEquipmentAttachmentRequest;
import org.jeecg.modules.eam.service.IEamEquipmentAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
 * @Description: è®¾å¤‡æ–‡æ¡£å°è´¦ä½¿ç”¨
 * @Author: jeecg-boot
 * @Date:   2025-04-16
 * @Version: V1.0
 */
@Slf4j
@Api(tags="设备文档台账使用")
@RestController
@RequestMapping("/eam/equipmentAttachment")
public class EamEquipmentAttachmentController extends JeecgController<EamEquipmentAttachment, IEamEquipmentAttachmentService> {
    @Autowired
    private IEamEquipmentAttachmentService eamEquipmentAttachmentService;
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param eamEquipmentAttachment
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @AutoLog(value = "设备文档台账使用-分页列表查询")
    @ApiOperation(value="设备文档台账使用-分页列表查询", notes="设备文档台账使用-分页列表查询")
    @GetMapping(value = "/list")
    public Result<?> queryPageList(EamEquipmentAttachment eamEquipmentAttachment,
                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                   HttpServletRequest req) {
        Page<EamEquipmentAttachment> page = new Page<>(pageNo, pageSize);
        if(StringUtils.isBlank(eamEquipmentAttachment.getEquipmentId())) {
            return Result.OK(page);
        }
        //只保留设备id
        EamEquipmentAttachment query = new EamEquipmentAttachment();
        query.setEquipmentId(eamEquipmentAttachment.getEquipmentId());
        QueryWrapper<EamEquipmentAttachment> queryWrapper = QueryGenerator.initQueryWrapper(eamEquipmentAttachment, req.getParameterMap());
        queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0);
        IPage<EamEquipmentAttachment> pageList = eamEquipmentAttachmentService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
    /**
     * æ·»åŠ 
     *
     * @param request
     * @return
     */
    @AutoLog(value = "设备文档台账使用-添加")
    @ApiOperation(value="设备文档台账使用-添加", notes="设备文档台账使用-添加")
    @PostMapping(value = "/add")
    public Result<?> add(@RequestBody EamEquipmentAttachmentRequest request) {
        boolean b = eamEquipmentAttachmentService.saveEntity(request);
        if(!b) {
            return Result.OK("操作失败!");
        }
        return Result.OK("添加成功!");
    }
    /**
     * ç¼–辑
     *
     * @param eamEquipmentAttachment
     * @return
     */
    @AutoLog(value = "设备文档台账使用-编辑")
    @ApiOperation(value="设备文档台账使用-编辑", notes="设备文档台账使用-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
    public Result<?> edit(@RequestBody EamEquipmentAttachment eamEquipmentAttachment) {
        eamEquipmentAttachmentService.updateById(eamEquipmentAttachment);
        return Result.OK("编辑成功!");
    }
    /**
     * é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "设备文档台账使用-通过id删除")
    @ApiOperation(value="设备文档台账使用-通过id删除", notes="设备文档台账使用-通过id删除")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestParam(name="id",required=true) String id) {
        EamEquipmentAttachment entity = eamEquipmentAttachmentService.getById(id);
        if(entity != null) {
            entity.setDelFlag(CommonConstant.DEL_FLAG_1);
            eamEquipmentAttachmentService.updateById(entity);
        }
        return Result.OK("删除成功!");
    }
    /**
     * æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "设备文档台账使用-批量删除")
    @ApiOperation(value="设备文档台账使用-批量删除", notes="设备文档台账使用-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
        List<String> list = Arrays.asList(ids.split(","));
        list.forEach(id -> {
            EamEquipmentAttachment entity = eamEquipmentAttachmentService.getById(id);
            if(entity != null) {
                entity.setDelFlag(CommonConstant.DEL_FLAG_1);
                eamEquipmentAttachmentService.updateById(entity);
            }
        });
        return Result.OK("批量删除成功!");
    }
    /**
     * é€šè¿‡id查询
     *
     * @param id
     * @return
     */
    @AutoLog(value = "设备文档台账使用-通过id查询")
    @ApiOperation(value="设备文档台账使用-通过id查询", notes="设备文档台账使用-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
        EamEquipmentAttachment eamEquipmentAttachment = eamEquipmentAttachmentService.getById(id);
        return Result.OK(eamEquipmentAttachment);
    }
     @GetMapping("/downloadFile")
     public void downloadFile(@RequestParam("id") String id, HttpServletResponse response) {
         eamEquipmentAttachmentService.downloadFile(response, eamEquipmentAttachmentService.getById(id));
     }
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentAttachment.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
package org.jeecg.modules.eam.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
 * @Description: è®¾å¤‡æ–‡æ¡£å°è´¦ä½¿ç”¨
 * @Author: jeecg-boot
 * @Date:   2025-04-16
 * @Version: V1.0
 */
@Data
@TableName("eam_equipment_attachment")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="eam_equipment_attachment对象", description="设备文档台账使用")
public class EamEquipmentAttachment implements Serializable {
    /**主键*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
    /**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**创建时间*/
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**更新时间*/
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    /**删除标记*/
    @ApiModelProperty(value = "删除标记")
    private Integer delFlag;
    /**文件加密名*/
    @ApiModelProperty(value = "设备ID")
    private String equipmentId;
    /**文件加密名*/
    @ApiModelProperty(value = "文件加密名")
    private String fileEncodeName;
    /**文件名称*/
    @ApiModelProperty(value = "文件名称")
    private String fileName;
    /**文件保存路径*/
    @ApiModelProperty(value = "文件保存路径")
    private String filePath;
    /**文件后缀名*/
    @ApiModelProperty(value = "文件后缀名")
    private String fileSuffix;
    /**文件大小*/
    @ApiModelProperty(value = "文件大小")
    private Long fileSize;
    /**描述*/
    @ApiModelProperty(value = "描述")
    private String description;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentAttachmentMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package org.jeecg.modules.eam.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.eam.entity.EamEquipmentAttachment;
/**
 * @Description: è®¾å¤‡æ–‡æ¡£å°è´¦ä½¿ç”¨
 * @Author: jeecg-boot
 * @Date:   2025-04-16
 * @Version: V1.0
 */
public interface EamEquipmentAttachmentMapper extends BaseMapper<EamEquipmentAttachment> {
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentAttachmentMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
<?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.jeecg.modules.eam.mapper.EamEquipmentAttachmentMapper">
</mapper>
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentAttachmentRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
package org.jeecg.modules.eam.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.api.vo.FileUploadResult;
import java.io.Serializable;
import java.util.List;
/**
 * @Description: è®¾å¤‡é™„件管理
 * @Author: jeecg-boot
 * @Date:   2025-03-17
 * @Version: V1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="请求对象", description="设备附件管理")
public class EamEquipmentAttachmentRequest implements Serializable {
    /**描述*/
    @ApiModelProperty(value = "描述")
    private String description;
    /**描述*/
    @ApiModelProperty(value = "设备ID")
    private String equipmentId;
    /**上传文件对系*/
    @ApiModelProperty(value = "上传文件对系")
    private List<FileUploadResult> fileList;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentAttachmentService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
package org.jeecg.modules.eam.service;
import org.jeecg.modules.eam.entity.EamEquipmentAttachment;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.eam.request.EamEquipmentAttachmentRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * @Description: è®¾å¤‡æ–‡æ¡£å°è´¦ä½¿ç”¨
 * @Author: jeecg-boot
 * @Date:   2025-04-16
 * @Version: V1.0
 */
public interface IEamEquipmentAttachmentService extends IService<EamEquipmentAttachment> {
    /**
     *
     * @param response
     * @param byId
     */
    void downloadFile(HttpServletResponse response, EamEquipmentAttachment byId);
    /**
     * ä¿å­˜å¯¹è±¡
     * @param request
     * @return
     */
    boolean saveEntity(EamEquipmentAttachmentRequest request);
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentAttachmentServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
package org.jeecg.modules.eam.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.FileUploadResult;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.FileUtil;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamEquipmentAttachment;
import org.jeecg.modules.eam.mapper.EamEquipmentAttachmentMapper;
import org.jeecg.modules.eam.request.EamEquipmentAttachmentRequest;
import org.jeecg.modules.eam.service.IEamEquipmentAttachmentService;
import org.jeecg.modules.eam.service.IEamEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
 * @Description: è®¾å¤‡æ–‡æ¡£å°è´¦ä½¿ç”¨
 * @Author: jeecg-boot
 * @Date:   2025-04-16
 * @Version: V1.0
 */
@Service
public class EamEquipmentAttachmentServiceImpl extends ServiceImpl<EamEquipmentAttachmentMapper, EamEquipmentAttachment> implements IEamEquipmentAttachmentService {
    @Autowired
    private IEamEquipmentService eamEquipmentService;
    @Override
    public void downloadFile(HttpServletResponse response, EamEquipmentAttachment entity) {
        FileUtil.downLoadFile(response, entity.getFilePath(), entity.getFileName());
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean saveEntity(EamEquipmentAttachmentRequest request) {
        if(request == null || CollectionUtil.isEmpty(request.getFileList())){
            return false;
        }
        EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId());
        if(equipment == null){
            throw new JeecgBootException("请先选择设备再上传文档");
        }
        List<EamEquipmentAttachment> resultList = new ArrayList<>();
        for (FileUploadResult fileUploadResult : request.getFileList()) {
            EamEquipmentAttachment entity = new EamEquipmentAttachment();
            entity.setFilePath(fileUploadResult.getFilePath());
            entity.setFileName(fileUploadResult.getFileName());
            entity.setFileEncodeName(fileUploadResult.getFileEncodeName());
            entity.setFileSize(fileUploadResult.getFileSize());
            entity.setFileSuffix(fileUploadResult.getFileSuffix());
            entity.setDescription(request.getDescription());
            entity.setDelFlag(CommonConstant.DEL_FLAG_0);
            entity.setEquipmentId(request.getEquipmentId());
            resultList.add(entity);
        }
        return this.saveBatch(resultList);
    }
}
lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_config.properties
@@ -1,5 +1,5 @@
#code_generate_project_path
project_path=F:\\java_workspace
project_path=D:\\java_workspace
#bussi_package[User defined]
bussi_package=org.jeecg.modules
lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_database.properties
@@ -21,7 +21,7 @@
#SQLServer2005\u4ee5\u4e0a
diver_name=org.hibernate.dialect.SQLServerDialect
url=jdbc:sqlserver://192.168.1.118:1433;DatabaseName=LXZN_TEST_HANGYU
url=jdbc:sqlserver://192.168.1.118:1433;DatabaseName=LXZN_TEST_WK
username=sa
password=123
database_name=LXZN_TEST_HANGYU
database_name=LXZN_TEST_WK