From f9501db5a27184c54ec25832f4dffc356e961bfe Mon Sep 17 00:00:00 2001
From: lige <bestlige@outlook.com>
Date: 星期二, 21 五月 2024 16:56:37 +0800
Subject: [PATCH] exe文件上传

---
 ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java           |    1 
 ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java           |   63 ++++
 ltkj-common/src/main/java/com/ltkj/common/utils/file/FileUploadUtils.java            |   15 +
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysAttachmentController.java |   98 ++++++
 ltkj-common/src/main/java/com/ltkj/common/utils/SnowFlake.java                       |  137 +++++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysAttachmentMapper.java                |   61 ++++
 ltkj-hosp/src/main/resources/mapper/hosp/SysAttachmentMapper.xml                     |  157 ++++++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysAttachmentServiceImpl.java     |   86 +++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysAttachment.java                      |  164 ++++++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/ISysAttachmentService.java             |   61 ++++
 10 files changed, 842 insertions(+), 1 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java b/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java
index a881d73..a480f19 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java
@@ -3,12 +3,20 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ltkj.common.core.domain.R;
+import com.ltkj.common.core.domain.entity.SysDictData;
+import com.ltkj.common.utils.SnowFlake;
 import com.ltkj.common.utils.uuid.UUID;
+import com.ltkj.hosp.domain.SysAttachment;
+import com.ltkj.hosp.service.ISysAttachmentService;
+import com.ltkj.system.service.ISysDictDataService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -51,6 +59,10 @@
 
     @Value("${ltkj.profile}")
     String path;
+    @Autowired
+    private ISysAttachmentService sysAttachmentService;
+    @Autowired
+    private ISysDictDataService sysDictDataService;
 
 
     /**
@@ -107,7 +119,7 @@
         ajax.put("originalFilename", file.getOriginalFilename());
         return ajax;
     }
-    
+
     /**
      * 閫氱敤涓婁紶璇锋眰锛堝崟涓級
      */
@@ -132,6 +144,55 @@
         }
     }
 
+    @PostMapping("/uploadImgExe")
+    @ApiOperation(value = "EXE绋嬪簭寰幆璇诲彇鍥剧墖涓婁紶")
+    public AjaxResult uploadImgExe(@RequestPart("file") MultipartFile file,@RequestParam("val")String dictVal,@RequestParam("ip")String ip){
+        try {
+            // 涓婁紶鏂囦欢璺緞
+            String filePath = ltkjConfig.getUploadPath();
+            // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+            String fileName = FileUploadUtils.upload(filePath, file);
+            String url = serverConfig.getUrl() + fileName;
+            AjaxResult ajax = AjaxResult.success();
+            ajax.put("url", url);
+            //ajax.put("filePath", path+fileName);
+            ajax.put("fileName", fileName);
+            final String newFileName = FileUtils.getName(fileName);
+            ajax.put("newFileName", newFileName);
+            ajax.put("originalFilename", file.getOriginalFilename());
+            SysAttachment sysAttachment = new SysAttachment();
+            sysAttachment.setId(SnowFlake.getInstance().nextId());
+            sysAttachment.setFileName(newFileName);
+            sysAttachment.setFilePath(fileName);
+            sysAttachment.setUrl(url);
+            sysAttachment.setSysDictVal(dictVal);
+            sysAttachment.setIp(ip);
+            final Map<String, String> map = FileUploadUtils.getFileSize(file);
+            sysAttachment.setFileSize(map.get("fileSizeBytes"));
+            sysAttachment.setFileSizeMb(map.get("fileSizeMB"));
+            sysAttachment.setFileSizeGb(map.get("fileSizeGB"));
+            sysAttachmentService.insertSysAttachment(sysAttachment);
+            return ajax;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.error(e.getMessage());
+        }
+    }
+
+    @GetMapping("/listExeVal")
+    public AjaxResult listExeDictVal(){
+        LambdaQueryWrapper<SysDictData> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(SysDictData::getDictType,"sys_exe_img_type");
+        final List<SysDictData> list = sysDictDataService.list(queryWrapper);
+        ArrayList<HashMap<String, String>> hashMaps = new ArrayList<>();
+        for (SysDictData sysDictData : list) {
+            HashMap<String, String> hashMap = new HashMap<>();
+            hashMap.put("label",sysDictData.getDictLabel());
+            hashMap.put("value",sysDictData.getDictValue());
+            hashMaps.add(hashMap);
+        }
+        return AjaxResult.success().put("data",hashMaps);
+    }
 
     @GetMapping("/uploadFile")
     @ApiOperation(value = "閫氱敤鏂囦欢涓婁紶base64")
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysAttachmentController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysAttachmentController.java
new file mode 100644
index 0000000..4c0d1da
--- /dev/null
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysAttachmentController.java
@@ -0,0 +1,98 @@
+package com.ltkj.web.controller.system;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ltkj.hosp.service.ISysAttachmentService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ltkj.common.annotation.Log;
+import com.ltkj.common.core.controller.BaseController;
+import com.ltkj.common.core.domain.AjaxResult;
+import com.ltkj.common.enums.BusinessType;
+import com.ltkj.hosp.domain.SysAttachment;
+import com.ltkj.common.utils.poi.ExcelUtil;
+import com.ltkj.common.core.page.TableDataInfo;
+
+/**
+ * 鏂囦欢涓婁紶璁板綍Controller
+ *
+ * @author ltkj_璧典匠璞�&鏉庢牸
+ * @date 2024-05-21
+ */
+@RestController
+@RequestMapping("/attachment/attachment")
+public class SysAttachmentController extends BaseController {
+    @Autowired
+    private ISysAttachmentService sysAttachmentService;
+
+/**
+ * 鏌ヨ鏂囦欢涓婁紶璁板綍鍒楄〃
+ */
+@PreAuthorize("@ss.hasPermi('attachment:attachment:list')")
+@GetMapping("/list")
+    public TableDataInfo list(SysAttachment sysAttachment) {
+        startPage();
+        List<SysAttachment> list = sysAttachmentService.selectSysAttachmentList(sysAttachment);
+        return getDataTable(list);
+    }
+
+    /**
+     * 瀵煎嚭鏂囦欢涓婁紶璁板綍鍒楄〃
+     */
+    @PreAuthorize("@ss.hasPermi('attachment:attachment:export')")
+    @Log(title = "鏂囦欢涓婁紶璁板綍", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, SysAttachment sysAttachment) {
+        List<SysAttachment> list = sysAttachmentService.selectSysAttachmentList(sysAttachment);
+        ExcelUtil<SysAttachment> util = new ExcelUtil<SysAttachment>(SysAttachment. class);
+        util.exportExcel(response, list, "鏂囦欢涓婁紶璁板綍鏁版嵁");
+    }
+
+    /**
+     * 鑾峰彇鏂囦欢涓婁紶璁板綍璇︾粏淇℃伅
+     */
+    @PreAuthorize("@ss.hasPermi('attachment:attachment:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(sysAttachmentService.selectSysAttachmentById(id));
+    }
+
+    /**
+     * 鏂板鏂囦欢涓婁紶璁板綍
+     */
+    @PreAuthorize("@ss.hasPermi('attachment:attachment:add')")
+    @Log(title = "鏂囦欢涓婁紶璁板綍", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysAttachment sysAttachment) {
+        return toAjax(sysAttachmentService.insertSysAttachment(sysAttachment));
+    }
+
+    /**
+     * 淇敼鏂囦欢涓婁紶璁板綍
+     */
+    @PreAuthorize("@ss.hasPermi('attachment:attachment:edit')")
+    @Log(title = "鏂囦欢涓婁紶璁板綍", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysAttachment sysAttachment) {
+        return toAjax(sysAttachmentService.updateSysAttachment(sysAttachment));
+    }
+
+    /**
+     * 鍒犻櫎鏂囦欢涓婁紶璁板綍
+     */
+    @PreAuthorize("@ss.hasPermi('attachment:attachment:remove')")
+    @Log(title = "鏂囦欢涓婁紶璁板綍", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(sysAttachmentService.deleteSysAttachmentByIds(ids));
+    }
+}
diff --git a/ltkj-common/src/main/java/com/ltkj/common/utils/SnowFlake.java b/ltkj-common/src/main/java/com/ltkj/common/utils/SnowFlake.java
new file mode 100644
index 0000000..283302e
--- /dev/null
+++ b/ltkj-common/src/main/java/com/ltkj/common/utils/SnowFlake.java
@@ -0,0 +1,137 @@
+package com.ltkj.common.utils;
+
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * 	鎻忚堪: Twitter鐨勫垎甯冨紡鑷ID闆姳绠楁硶snowflake (Java鐗�)
+ * * Twitter_Snowflake<br>
+ * SnowFlake鐨勭粨鏋勫涓�(姣忛儴鍒嗙敤-鍒嗗紑):<br>
+ * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
+ * 1浣嶆爣璇嗭紝鐢变簬long鍩烘湰绫诲瀷鍦↗ava涓槸甯︾鍙风殑锛屾渶楂樹綅鏄鍙蜂綅锛屾鏁版槸0锛岃礋鏁版槸1锛屾墍浠d涓�鑸槸姝f暟锛屾渶楂樹綅鏄�0<br>
+ * 41浣嶆椂闂存埅(姣绾�)锛屾敞鎰忥紝41浣嶆椂闂存埅涓嶆槸瀛樺偍褰撳墠鏃堕棿鐨勬椂闂存埅锛岃�屾槸瀛樺偍鏃堕棿鎴殑宸�硷紙褰撳墠鏃堕棿鎴� - 寮�濮嬫椂闂存埅)
+ * 寰楀埌鐨勫�硷級锛岃繖閲岀殑鐨勫紑濮嬫椂闂存埅锛屼竴鑸槸鎴戜滑鐨刬d鐢熸垚鍣ㄥ紑濮嬩娇鐢ㄧ殑鏃堕棿锛岀敱鎴戜滑绋嬪簭鏉ユ寚瀹氱殑锛堝涓嬩笅闈㈢▼搴廔dWorker绫荤殑startTime灞炴�э級銆�41浣嶇殑鏃堕棿鎴紝鍙互浣跨敤69骞达紝骞碩 = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
+ * 10浣嶇殑鏁版嵁鏈哄櫒浣嶏紝鍙互閮ㄧ讲鍦�1024涓妭鐐癸紝鍖呮嫭5浣峝atacenterId鍜�5浣峸orkerId<br>
+ * 12浣嶅簭鍒楋紝姣鍐呯殑璁℃暟锛�12浣嶇殑璁℃暟椤哄簭鍙锋敮鎸佹瘡涓妭鐐规瘡姣(鍚屼竴鏈哄櫒锛屽悓涓�鏃堕棿鎴�)浜х敓4096涓狪D搴忓彿<br>
+ * 鍔犺捣鏉ュ垰濂�64浣嶏紝涓轰竴涓狶ong鍨嬨��<br>
+ * SnowFlake鐨勪紭鐐规槸锛屾暣浣撲笂鎸夌収鏃堕棿鑷鎺掑簭锛屽苟涓旀暣涓垎甯冨紡绯荤粺鍐呬笉浼氫骇鐢烮D纰版挒(鐢辨暟鎹腑蹇僆D鍜屾満鍣↖D浣滃尯鍒�)锛屽苟涓旀晥鐜囪緝楂橈紝缁忔祴璇曪紝SnowFlake姣忕鑳藉浜х敓26涓嘔D宸﹀彸銆�
+ * @author Administrator
+ *
+ */
+public class SnowFlake {
+
+
+
+	private static SnowFlake snowFlake;
+	private static ReentrantLock lock = new ReentrantLock();
+
+	public static SnowFlake getInstance() {
+		if (snowFlake == null) {
+			lock.lock();
+			if (snowFlake == null) {;
+				datacenterId = Long.valueOf(StringUtils.nvl(null, "1"));
+				machineId = Long.valueOf(StringUtils.nvl(null, "1"));
+				snowFlake = new SnowFlake(datacenterId,machineId);
+			}
+			lock.unlock();
+		}
+		return snowFlake;
+	}
+    /**
+     * 璧峰鐨勬椂闂存埑
+     */
+    private final static long START_STMP = 1480166465631L;
+
+    /**
+     * 姣忎竴閮ㄥ垎鍗犵敤鐨勪綅鏁�
+     */
+    private final static long SEQUENCE_BIT = 12; //搴忓垪鍙峰崰鐢ㄧ殑浣嶆暟
+    private final static long MACHINE_BIT = 5;   //鏈哄櫒鏍囪瘑鍗犵敤鐨勪綅鏁�
+    private final static long DATACENTER_BIT = 5;//鏁版嵁涓績鍗犵敤鐨勪綅鏁�
+
+    /**
+     * 姣忎竴閮ㄥ垎鐨勬渶澶у��
+     */
+    private final static long MAX_DATACENTER_NUM = -1L ^ (-1L << DATACENTER_BIT);
+    private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT);
+    private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT);
+
+    /**
+     * 姣忎竴閮ㄥ垎鍚戝乏鐨勪綅绉�
+     */
+    private final static long MACHINE_LEFT = SEQUENCE_BIT;
+    private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT;
+    private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT;
+
+    private static long machineId; //鏈哄櫒鏍囪瘑(0~31)
+    private static long datacenterId; //鏁版嵁涓績(0~31)
+    private long sequence = 0L; //搴忓垪鍙�
+    private long lastStmp = -1L;//涓婁竴娆℃椂闂存埑
+
+    public SnowFlake(long datacenterId, long machineId) {
+        if (datacenterId > MAX_DATACENTER_NUM || datacenterId < 0) {
+            throw new IllegalArgumentException("datacenterId can't be greater than MAX_DATACENTER_NUM or less than 0");
+        }
+        if (machineId > MAX_MACHINE_NUM || machineId < 0) {
+            throw new IllegalArgumentException("machineId can't be greater than MAX_MACHINE_NUM or less than 0");
+        }
+        SnowFlake.datacenterId = datacenterId;
+        SnowFlake.machineId = machineId;
+    }
+
+    /**
+     * 浜х敓涓嬩竴涓狪D
+     *
+     * @return
+     */
+    public synchronized long nextId() {
+        long currStmp = getNewstmp();
+      //濡傛灉褰撳墠鏃堕棿灏忎簬涓婁竴娆D鐢熸垚鐨勬椂闂存埑锛岃鏄庣郴缁熸椂閽熷洖閫�杩囪繖涓椂鍊欏簲褰撴姏鍑哄紓甯�
+        if (currStmp < lastStmp) {
+            throw new RuntimeException("Clock moved backwards.  Refusing to generate id");
+        }
+      //濡傛灉鏄悓涓�鏃堕棿鐢熸垚鐨勶紝鍒欒繘琛屾绉掑唴搴忓垪
+        if (currStmp == lastStmp) {
+            //鐩稿悓姣鍐咃紝搴忓垪鍙疯嚜澧�
+            sequence = (sequence + 1) & MAX_SEQUENCE;
+            //鍚屼竴姣鐨勫簭鍒楁暟宸茬粡杈惧埌鏈�澶�
+            if (sequence == 0L) {
+                currStmp = getNextMill();
+            }
+        } else {
+            //涓嶅悓姣鍐咃紝搴忓垪鍙风疆涓�0
+            sequence = 0L;
+        }
+      //涓婃鐢熸垚ID鐨勬椂闂存埅
+        lastStmp = currStmp;
+      //绉讳綅骞堕�氳繃鎴栬繍绠楁嫾鍒颁竴璧风粍鎴�64浣嶇殑ID
+        return (currStmp - START_STMP) << TIMESTMP_LEFT //鏃堕棿鎴抽儴鍒�
+                | datacenterId << DATACENTER_LEFT       //鏁版嵁涓績閮ㄥ垎
+                | machineId << MACHINE_LEFT             //鏈哄櫒鏍囪瘑閮ㄥ垎
+                | sequence;                             //搴忓垪鍙烽儴鍒�
+    }
+
+    private long getNextMill() {
+        long mill = getNewstmp();
+        while (mill <= lastStmp) {
+            mill = getNewstmp();
+        }
+        return mill;
+    }
+
+    private long getNewstmp() {
+        return System.currentTimeMillis();
+    }
+
+    public static void main(String[] args) {
+        SnowFlake snowFlake = new SnowFlake(1, 1);
+
+        long start = System.currentTimeMillis();
+        for (int i = 0; i < 10; i++) {
+            System.out.println(snowFlake.nextId());
+        }
+
+        System.out.println(System.currentTimeMillis() - start);
+
+
+    }
+}
diff --git a/ltkj-common/src/main/java/com/ltkj/common/utils/file/FileUploadUtils.java b/ltkj-common/src/main/java/com/ltkj/common/utils/file/FileUploadUtils.java
index 746ff21..12be581 100644
--- a/ltkj-common/src/main/java/com/ltkj/common/utils/file/FileUploadUtils.java
+++ b/ltkj-common/src/main/java/com/ltkj/common/utils/file/FileUploadUtils.java
@@ -3,6 +3,8 @@
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Objects;
 
 import com.ltkj.common.config.ltkjConfig;
@@ -196,4 +198,17 @@
         }
         return extension;
     }
+
+    public static Map<String, String> getFileSize(MultipartFile file) throws IOException {
+        long fileSizeBytes = file.getSize();
+        double fileSizeMB = fileSizeBytes / (1024.0 * 1024.0);
+        double fileSizeGB = fileSizeBytes / (1024.0 * 1024.0 * 1024.0);
+        String fileSizeMBStr = String.format("%.2f MB", fileSizeMB);
+        String fileSizeGBStr = String.format("%.2f GB", fileSizeGB);
+        Map<String, String> result = new HashMap<>();
+        result.put("fileSizeBytes", fileSizeBytes + " Bytes");
+        result.put("fileSizeMB", fileSizeMBStr);
+        result.put("fileSizeGB", fileSizeGBStr);
+        return result;
+    }
 }
diff --git a/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java b/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java
index 71f8432..43788f2 100644
--- a/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java
+++ b/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java
@@ -109,6 +109,7 @@
                 .authorizeRequests()
                 // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶
                 .antMatchers("/login", "/register", "/captchaImage","/cus/**","/getCaptchaConfigKey","/report/jmreport/**","/sqlserver/getdata/**").permitAll()
+                .antMatchers("/common/uploadImgExe","/common/listExeVal").permitAll()
                 // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂�
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysAttachment.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysAttachment.java
new file mode 100644
index 0000000..8fdc170
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysAttachment.java
@@ -0,0 +1,164 @@
+package com.ltkj.hosp.domain;
+
+    import java.util.Date;
+    import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ltkj.common.annotation.Excel;
+    import com.ltkj.common.core.domain.BaseEntity;
+    import org.apache.commons.lang3.builder.ToStringBuilder;
+    import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 鏂囦欢涓婁紶璁板綍瀵硅薄 sys_attachment
+ *
+ * @author ltkj_璧典匠璞�&鏉庢牸
+ * @date 2024-05-21
+ */
+public class SysAttachment extends BaseEntity
+        {
+private static final long serialVersionUID=1L;
+
+    /** 缂栧彿 */
+    private Long id;
+
+    /** 瀛楀吀閿�� */
+            @Excel(name = "瀛楀吀閿��")
+    private String sysDictVal;
+
+    /** 鏂囦欢淇濆瓨璺緞 */
+            @Excel(name = "鏂囦欢淇濆瓨璺緞")
+    private String filePath;
+
+    /** 鏂囦欢鍚� */
+            @Excel(name = "鏂囦欢鍚�")
+    private String fileName;
+
+    /** 鏂囦欢澶у皬 */
+            @Excel(name = "鏂囦欢澶у皬")
+    private String fileSize;
+
+    /** 鏂囦欢澶у皬-mb */
+            @Excel(name = "鏂囦欢澶у皬-mb")
+    private String fileSizeMb;
+
+    /** 鏂囦欢澶у皬-gb */
+            @Excel(name = "鏂囦欢澶у皬-gb")
+    private String fileSizeGb;
+
+    /** 鏂囦欢涓婁紶鏃堕棿 */
+            @JsonFormat(pattern = "yyyy-MM-dd")
+            @Excel(name = "鏂囦欢涓婁紶鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date uploadTime;
+
+    /** 涓婁紶浜篿p */
+            @Excel(name = "涓婁紶浜篿p")
+    private String ip;
+    /** 涓婁紶鍚庣殑璁块棶閾炬帴 */
+    @Excel(name = "涓婁紶鍚庣殑璁块棶閾炬帴")
+    private String url;
+
+            public String getUrl() {
+                return url;
+            }
+
+            public void setUrl(String url) {
+                this.url = url;
+            }
+
+            public void setId(Long id)
+            {
+            this.id = id;
+            }
+
+    public Long getId()
+            {
+            return id;
+            }
+    public void setSysDictVal(String sysDictVal)
+            {
+            this.sysDictVal = sysDictVal;
+            }
+
+    public String getSysDictVal()
+            {
+            return sysDictVal;
+            }
+    public void setFilePath(String filePath)
+            {
+            this.filePath = filePath;
+            }
+
+    public String getFilePath()
+            {
+            return filePath;
+            }
+    public void setFileName(String fileName)
+            {
+            this.fileName = fileName;
+            }
+
+    public String getFileName()
+            {
+            return fileName;
+            }
+    public void setFileSize(String fileSize)
+            {
+            this.fileSize = fileSize;
+            }
+
+    public String getFileSize()
+            {
+            return fileSize;
+            }
+    public void setFileSizeMb(String fileSizeMb)
+            {
+            this.fileSizeMb = fileSizeMb;
+            }
+
+    public String getFileSizeMb()
+            {
+            return fileSizeMb;
+            }
+    public void setFileSizeGb(String fileSizeGb)
+            {
+            this.fileSizeGb = fileSizeGb;
+            }
+
+    public String getFileSizeGb()
+            {
+            return fileSizeGb;
+            }
+    public void setUploadTime(Date uploadTime)
+            {
+            this.uploadTime = uploadTime;
+            }
+
+    public Date getUploadTime()
+            {
+            return uploadTime;
+            }
+    public void setIp(String ip)
+            {
+            this.ip = ip;
+            }
+
+    public String getIp()
+            {
+            return ip;
+            }
+
+@Override
+public String toString(){
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+            .append("id",getId())
+            .append("sysDictVal",getSysDictVal())
+            .append("filePath",getFilePath())
+            .append("fileName",getFileName())
+            .append("fileSize",getFileSize())
+            .append("fileSizeMb",getFileSizeMb())
+            .append("fileSizeGb",getFileSizeGb())
+            .append("uploadTime",getUploadTime())
+            .append("ip",getIp())
+            .append("url",getUrl())
+        .toString();
+        }
+        }
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysAttachmentMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysAttachmentMapper.java
new file mode 100644
index 0000000..49e731d
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysAttachmentMapper.java
@@ -0,0 +1,61 @@
+package com.ltkj.hosp.mapper;
+
+import java.util.List;
+
+import com.ltkj.hosp.domain.SysAttachment;
+
+/**
+ * 鏂囦欢涓婁紶璁板綍Mapper鎺ュ彛
+ *
+ * @author ltkj_璧典匠璞�&鏉庢牸
+ * @date 2024-05-21
+ */
+public interface SysAttachmentMapper {
+    /**
+     * 鏌ヨ鏂囦欢涓婁紶璁板綍
+     *
+     * @param id 鏂囦欢涓婁紶璁板綍涓婚敭
+     * @return 鏂囦欢涓婁紶璁板綍
+     */
+    public SysAttachment selectSysAttachmentById(Long id);
+
+    /**
+     * 鏌ヨ鏂囦欢涓婁紶璁板綍鍒楄〃
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 鏂囦欢涓婁紶璁板綍闆嗗悎
+     */
+    public List<SysAttachment> selectSysAttachmentList(SysAttachment sysAttachment);
+
+    /**
+     * 鏂板鏂囦欢涓婁紶璁板綍
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 缁撴灉
+     */
+    public int insertSysAttachment(SysAttachment sysAttachment);
+
+    /**
+     * 淇敼鏂囦欢涓婁紶璁板綍
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 缁撴灉
+     */
+    public int updateSysAttachment(SysAttachment sysAttachment);
+
+    /**
+     * 鍒犻櫎鏂囦欢涓婁紶璁板綍
+     *
+     * @param id 鏂囦欢涓婁紶璁板綍涓婚敭
+     * @return 缁撴灉
+     */
+    public int deleteSysAttachmentById(Long id);
+
+    /**
+     * 鎵归噺鍒犻櫎鏂囦欢涓婁紶璁板綍
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteSysAttachmentByIds(Long[] ids);
+}
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ISysAttachmentService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ISysAttachmentService.java
new file mode 100644
index 0000000..429956c
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ISysAttachmentService.java
@@ -0,0 +1,61 @@
+package com.ltkj.hosp.service;
+
+import java.util.List;
+
+import com.ltkj.hosp.domain.SysAttachment;
+
+/**
+ * 鏂囦欢涓婁紶璁板綍Service鎺ュ彛
+ *
+ * @author ltkj_璧典匠璞�&鏉庢牸
+ * @date 2024-05-21
+ */
+public interface ISysAttachmentService {
+    /**
+     * 鏌ヨ鏂囦欢涓婁紶璁板綍
+     *
+     * @param id 鏂囦欢涓婁紶璁板綍涓婚敭
+     * @return 鏂囦欢涓婁紶璁板綍
+     */
+    public SysAttachment selectSysAttachmentById(Long id);
+
+    /**
+     * 鏌ヨ鏂囦欢涓婁紶璁板綍鍒楄〃
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 鏂囦欢涓婁紶璁板綍闆嗗悎
+     */
+    public List<SysAttachment> selectSysAttachmentList(SysAttachment sysAttachment);
+
+    /**
+     * 鏂板鏂囦欢涓婁紶璁板綍
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 缁撴灉
+     */
+    public int insertSysAttachment(SysAttachment sysAttachment);
+
+    /**
+     * 淇敼鏂囦欢涓婁紶璁板綍
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 缁撴灉
+     */
+    public int updateSysAttachment(SysAttachment sysAttachment);
+
+    /**
+     * 鎵归噺鍒犻櫎鏂囦欢涓婁紶璁板綍
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏂囦欢涓婁紶璁板綍涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteSysAttachmentByIds(Long[] ids);
+
+    /**
+     * 鍒犻櫎鏂囦欢涓婁紶璁板綍淇℃伅
+     *
+     * @param id 鏂囦欢涓婁紶璁板綍涓婚敭
+     * @return 缁撴灉
+     */
+    public int deleteSysAttachmentById(Long id);
+}
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysAttachmentServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysAttachmentServiceImpl.java
new file mode 100644
index 0000000..67a6b0a
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysAttachmentServiceImpl.java
@@ -0,0 +1,86 @@
+package com.ltkj.hosp.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ltkj.hosp.mapper.SysAttachmentMapper;
+import com.ltkj.hosp.domain.SysAttachment;
+import com.ltkj.hosp.service.ISysAttachmentService;
+
+/**
+ * 鏂囦欢涓婁紶璁板綍Service涓氬姟灞傚鐞�
+ *
+ * @author ltkj_璧典匠璞�&鏉庢牸
+ * @date 2024-05-21
+ */
+@Service
+public class SysAttachmentServiceImpl implements ISysAttachmentService {
+    @Autowired
+    private SysAttachmentMapper sysAttachmentMapper;
+
+    /**
+     * 鏌ヨ鏂囦欢涓婁紶璁板綍
+     *
+     * @param id 鏂囦欢涓婁紶璁板綍涓婚敭
+     * @return 鏂囦欢涓婁紶璁板綍
+     */
+    @Override
+    public SysAttachment selectSysAttachmentById(Long id) {
+        return sysAttachmentMapper.selectSysAttachmentById(id);
+    }
+
+    /**
+     * 鏌ヨ鏂囦欢涓婁紶璁板綍鍒楄〃
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 鏂囦欢涓婁紶璁板綍
+     */
+    @Override
+    public List<SysAttachment> selectSysAttachmentList(SysAttachment sysAttachment) {
+        return sysAttachmentMapper.selectSysAttachmentList(sysAttachment);
+    }
+
+    /**
+     * 鏂板鏂囦欢涓婁紶璁板綍
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 缁撴灉
+     */
+    @Override
+    public int insertSysAttachment(SysAttachment sysAttachment) {
+            return sysAttachmentMapper.insertSysAttachment(sysAttachment);
+    }
+
+    /**
+     * 淇敼鏂囦欢涓婁紶璁板綍
+     *
+     * @param sysAttachment 鏂囦欢涓婁紶璁板綍
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateSysAttachment(SysAttachment sysAttachment) {
+        return sysAttachmentMapper.updateSysAttachment(sysAttachment);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎鏂囦欢涓婁紶璁板綍
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏂囦欢涓婁紶璁板綍涓婚敭
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteSysAttachmentByIds(Long[] ids) {
+        return sysAttachmentMapper.deleteSysAttachmentByIds(ids);
+    }
+
+    /**
+     * 鍒犻櫎鏂囦欢涓婁紶璁板綍淇℃伅
+     *
+     * @param id 鏂囦欢涓婁紶璁板綍涓婚敭
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteSysAttachmentById(Long id) {
+        return sysAttachmentMapper.deleteSysAttachmentById(id);
+    }
+}
diff --git a/ltkj-hosp/src/main/resources/mapper/hosp/SysAttachmentMapper.xml b/ltkj-hosp/src/main/resources/mapper/hosp/SysAttachmentMapper.xml
new file mode 100644
index 0000000..d23cc15
--- /dev/null
+++ b/ltkj-hosp/src/main/resources/mapper/hosp/SysAttachmentMapper.xml
@@ -0,0 +1,157 @@
+<?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.ltkj.hosp.mapper.SysAttachmentMapper">
+
+    <resultMap type="SysAttachment" id="SysAttachmentResult">
+            <result property="id" column="id"/>
+            <result property="sysDictVal" column="sys_dict_val"/>
+            <result property="filePath" column="file_path"/>
+            <result property="fileName" column="file_name"/>
+            <result property="fileSize" column="file_size"/>
+            <result property="fileSizeMb" column="file_size_mb"/>
+            <result property="fileSizeGb" column="file_size_gb"/>
+            <result property="uploadTime" column="upload_time"/>
+            <result property="ip" column="ip"/>
+            <result property="url" column="url"/>
+    </resultMap>
+
+    <sql id="selectSysAttachmentVo">
+        select id, sys_dict_val, file_path, file_name, file_size, file_size_mb, file_size_gb, upload_time, ip,url
+        from sys_attachment
+    </sql>
+
+    <select id="selectSysAttachmentList" parameterType="SysAttachment" resultMap="SysAttachmentResult">
+        <include refid="selectSysAttachmentVo"/>
+        <where>
+                        <if test="sysDictVal != null  and sysDictVal != ''">
+                            and sys_dict_val = #{sysDictVal}
+                        </if>
+                        <if test="filePath != null  and filePath != ''">
+                            and file_path = #{filePath}
+                        </if>
+                        <if test="fileName != null  and fileName != ''">
+                            and file_name like concat('%', #{fileName}, '%')
+                        </if>
+                        <if test="fileSize != null  and fileSize != ''">
+                            and file_size = #{fileSize}
+                        </if>
+                        <if test="fileSizeMb != null  and fileSizeMb != ''">
+                            and file_size_mb = #{fileSizeMb}
+                        </if>
+                        <if test="fileSizeGb != null  and fileSizeGb != ''">
+                            and file_size_gb = #{fileSizeGb}
+                        </if>
+                        <if test="uploadTime != null ">
+                            and upload_time = #{uploadTime}
+                        </if>
+                        <if test="ip != null  and ip != ''">
+                            and ip = #{ip}
+                        </if>
+                        <if test="url != null  and url != ''">
+                            and url = #{url}
+                        </if>
+        </where>
+    </select>
+
+    <select id="selectSysAttachmentById" parameterType="Long"
+            resultMap="SysAttachmentResult">
+            <include refid="selectSysAttachmentVo"/>
+            where id = #{id}
+    </select>
+
+    <insert id="insertSysAttachment" parameterType="SysAttachment">
+        insert into sys_attachment
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="id != null">id,
+                    </if>
+                    <if test="sysDictVal != null">sys_dict_val,
+                    </if>
+                    <if test="filePath != null and filePath != ''">file_path,
+                    </if>
+                    <if test="fileName != null and fileName != ''">file_name,
+                    </if>
+                    <if test="fileSize != null and fileSize != ''">file_size,
+                    </if>
+                    <if test="fileSizeMb != null and fileSizeMb != ''">file_size_mb,
+                    </if>
+                    <if test="fileSizeGb != null and fileSizeGb != ''">file_size_gb,
+                    </if>
+                    <if test="uploadTime != null">upload_time,
+                    </if>
+                    <if test="ip != null and ip != ''">ip,
+                    </if>
+                    <if test="url != null and url != ''">url,
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="id != null">#{id},
+                    </if>
+                    <if test="sysDictVal != null">#{sysDictVal},
+                    </if>
+                    <if test="filePath != null and filePath != ''">#{filePath},
+                    </if>
+                    <if test="fileName != null and fileName != ''">#{fileName},
+                    </if>
+                    <if test="fileSize != null and fileSize != ''">#{fileSize},
+                    </if>
+                    <if test="fileSizeMb != null and fileSizeMb != ''">#{fileSizeMb},
+                    </if>
+                    <if test="fileSizeGb != null and fileSizeGb != ''">#{fileSizeGb},
+                    </if>
+                    <if test="uploadTime != null">#{uploadTime},
+                    </if>
+                    <if test="ip != null and ip != ''">#{ip},
+                    </if>
+                    <if test="url != null and url != ''">#{url},
+                    </if>
+        </trim>
+    </insert>
+
+    <update id="updateSysAttachment" parameterType="SysAttachment">
+        update sys_attachment
+        <trim prefix="SET" suffixOverrides=",">
+                    <if test="sysDictVal != null">sys_dict_val =
+                        #{sysDictVal},
+                    </if>
+                    <if test="filePath != null and filePath != ''">file_path =
+                        #{filePath},
+                    </if>
+                    <if test="fileName != null and fileName != ''">file_name =
+                        #{fileName},
+                    </if>
+                    <if test="fileSize != null and fileSize != ''">file_size =
+                        #{fileSize},
+                    </if>
+                    <if test="fileSizeMb != null and fileSizeMb != ''">file_size_mb =
+                        #{fileSizeMb},
+                    </if>
+                    <if test="fileSizeGb != null and fileSizeGb != ''">file_size_gb =
+                        #{fileSizeGb},
+                    </if>
+                    <if test="uploadTime != null">upload_time =
+                        #{uploadTime},
+                    </if>
+                    <if test="ip != null and ip != ''">ip =
+                        #{ip},
+                    </if>
+                    <if test="url != null and url != ''">ip =
+                        #{url},
+                    </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysAttachmentById" parameterType="Long">
+        delete
+        from sys_attachment where id = #{id}
+    </delete>
+
+    <delete id="deleteSysAttachmentByIds" parameterType="String">
+        delete from sys_attachment where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

--
Gitblit v1.8.0