From ed3f8ade77cdb06c2d58a6fbe1ce5cd05fdbe746 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 17 四月 2025 10:29:39 +0800 Subject: [PATCH] art: 设备管理-设备台账-设备文档接口添加 --- db/数据库产品化设计.pdma.json | 406 ++++++++++++++++++++++++++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentAttachmentService.java | 30 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentAttachment.java | 67 ++++ lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_config.properties | 2 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentAttachmentServiceImpl.java | 65 ++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentAttachmentController.java | 158 +++++++++++ lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_database.properties | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentAttachmentMapper.java | 14 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentAttachmentMapper.xml | 5 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentAttachmentRequest.java | 33 ++ 10 files changed, 777 insertions(+), 7 deletions(-) diff --git "a/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.pdma.json" "b/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.pdma.json" index 6fe6cc7..03f6c01 100644 --- "a/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.pdma.json" +++ "b/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.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", diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentAttachmentController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentAttachmentController.java new file mode 100644 index 0000000..5ec3396 --- /dev/null +++ b/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); + } + //鍙繚鐣欒澶噄d + 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)); + } +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentAttachment.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentAttachment.java new file mode 100644 index 0000000..7135feb --- /dev/null +++ b/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; +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentAttachmentMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentAttachmentMapper.java new file mode 100644 index 0000000..ca99a69 --- /dev/null +++ b/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> { + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentAttachmentMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentAttachmentMapper.xml new file mode 100644 index 0000000..ec5ca50 --- /dev/null +++ b/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> \ No newline at end of file diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentAttachmentRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentAttachmentRequest.java new file mode 100644 index 0000000..e1552f3 --- /dev/null +++ b/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; +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentAttachmentService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentAttachmentService.java new file mode 100644 index 0000000..fc4c18f --- /dev/null +++ b/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); +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentAttachmentServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentAttachmentServiceImpl.java new file mode 100644 index 0000000..2dbbe82 --- /dev/null +++ b/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); + } +} diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_config.properties b/lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_config.properties index 36d6f12..07aa3da 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_config.properties +++ b/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 diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_database.properties b/lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_database.properties index b62a034..b3e5517 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/jeecg/jeecg_database.properties +++ b/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 \ No newline at end of file +database_name=LXZN_TEST_WK \ No newline at end of file -- Gitblit v1.9.3