From 042b07f18720af7559f30f5c0b50b770df4a85f6 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 06 十二月 2024 16:41:13 +0800
Subject: [PATCH] 1

---
 src/main/resources/mapper/sys/AttachMapper.xml |   87 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 72 insertions(+), 15 deletions(-)

diff --git a/src/main/resources/mapper/sys/AttachMapper.xml b/src/main/resources/mapper/sys/AttachMapper.xml
index c89f886..67949d2 100644
--- a/src/main/resources/mapper/sys/AttachMapper.xml
+++ b/src/main/resources/mapper/sys/AttachMapper.xml
@@ -1,11 +1,11 @@
 <?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.lf.server.mapper.sys.AttachMapper">
-    <select id="selectCount" resultType="java.lang.Integer" parameterType="java.lang.String">
+    <select id="selectCount" resultType="java.lang.Integer">
         select count(*) from lf.sys_attach
         <where>
             <if test="name != null">
-                name like #{name}
+                upper(name) like #{name}
             </if>
         </where>
     </select>
@@ -14,34 +14,66 @@
         select * from lf.sys_attach
         <where>
             <if test="name != null">
-                name like #{name}
+                upper(name) like #{name}
             </if>
         </where>
-        order by id
+        order by id desc
         limit #{limit} offset #{offset}
     </select>
 
     <select id="selectAll" resultType="com.lf.server.entity.sys.AttachEntity">
-        select * from lf.sys_attach order by id;
+        select * from lf.sys_attach order by id desc;
     </select>
 
     <select id="selectById" resultType="com.lf.server.entity.sys.AttachEntity">
         select * from lf.sys_attach where id = #{id}
     </select>
 
+    <select id="selectByGuid" resultType="com.lf.server.entity.sys.AttachEntity">
+        select * from lf.sys_attach where guid = #{guid} limit 1
+    </select>
+
+    <select id="selectByGuids" resultType="com.lf.server.entity.sys.AttachEntity">
+        select * from lf.sys_attach where guid in
+        <foreach item="guid" collection="guids" index="index" open="(" separator="," close=")">
+            #{guid}
+        </foreach>
+    </select>
+
+    <select id="selectByTabAndGuid" resultType="com.lf.server.entity.sys.AttachEntity">
+        select * from lf.sys_attach where tab = #{tab} and tab_guid = #{tabGuid} and guid = #{guid} limit 1
+    </select>
+
+    <select id="selectByTabGuids" resultType="com.lf.server.entity.sys.AttachEntity">
+        select * from lf.sys_attach
+        <where>
+            tab = #{tab}
+            <if test="guids != null">
+                and tab_guid in
+                <foreach item="guid" collection="guids" index="index" open="(" separator="," close=")">
+                    #{guid}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="selectByTab" resultType="com.lf.server.entity.sys.AttachEntity">
+        select * from lf.sys_attach where tab = #{tab} and tab_guid = #{guid}
+    </select>
+
     <insert id="insert" parameterType="com.lf.server.entity.sys.AttachEntity">
        insert into lf.sys_attach
-       (name,tab,guid,path,create_user,create_time)
+       (name,tab,tab_guid,guid,path,sizes,create_user,create_time)
        values
-       (#{name},#{tab},#{guid},#{path},#{createUser},now())
+       (#{name},#{tab},#{tabGuid},#{guid},#{path},#{sizes},#{createUser},now())
     </insert>
 
     <insert id="inserts">
         insert into lf.sys_attach
-        (name,tab,guid,path,create_user,create_time)
+        (name,tab,tab_guid,guid,path,sizes,create_user,create_time)
         values
         <foreach collection="list" item="item" index="index" separator=",">
-            (#{item.name},#{item.tab},#{item.guid},#{item.path},#{item.createUser},now())
+            (#{item.name},#{item.tab},#{item.tabGuid},#{item.guid},#{item.path},#{item.sizes},#{item.createUser},now())
         </foreach>
     </insert>
 
@@ -51,24 +83,49 @@
 
     <delete id="deletes">
         delete from lf.sys_attach where id in
-        <foreach item="ids" collection="list" index="index" open="(" separator="," close=")">
-            #{ids}
+        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
+            #{id}
         </foreach>
     </delete>
 
     <update id="update">
-    update lf.sys_attach
-    set name=#{name},tab=#{tab},guid=#{guid},path=#{path},update_user=#{updateUser},update_time=now()
-    where id=#{id}
+        update lf.sys_attach
+        set name=#{name},tab=#{tab},tab_guid=#{tabGuid},guid=#{guid},path=#{path},sizes=#{sizes},update_user=#{updateUser},update_time=now()
+        where id=#{id}
     </update>
 
     <update id="updates">
         <foreach collection="list" item="item" index="index" separator=";">
             update lf.sys_attach
             <set>
-                name=#{item.name},tab=#{item.tab},guid=#{item.guid},path=#{item.path},update_user=#{item.updateUser},update_time=now()
+                name=#{item.name},tab=#{item.tab},tab_guid=#{item.tabGuid},guid=#{item.guid},path=#{item.path},sizes=#{item.sizes},update_user=#{item.updateUser},update_time=now()
             </set>
             where id = #{item.id}
         </foreach>
     </update>
+
+    <!-- where count > 0 and update_time is null and create_time > now()::timestamp + '-5 min' and position(tcdm in '${tabs}') > 0; -->
+    <select id="selectFmeLogs" resultType="com.lf.server.entity.data.FmeLogEntity">
+        select * from lf.sys_fme_log
+        where count > 0 and update_time is null and position(tcdm in '${tabs}') > 0;
+    </select>
+
+    <update id="updateFmeLog">
+        update lf.sys_fme_log set update_time = now() where id = #{id};
+    </update>
+
+    <!-- and create_time > now()::timestamp + '-15 min' -->
+    <insert id="insertAttachByMeta">
+        insert into lf.sys_attach (name, guid, path, sizes, create_user, tab, tab_guid)
+		select name, guid, path, sizes, create_user, #{tab}, #{tabGuid}
+		from lf.sys_meta
+		<where>
+            name = #{metaName}
+            <if test="dirid != null">
+                and dircode like #{dirid}
+            </if>
+        </where>
+		order by id desc
+		limit 1;
+    </insert>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3