Эх сурвалжийг харах

Merge remote-tracking branch 'origin/yellow' into yellow

# Conflicts:
#	ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PostCollectionsSystemController.java
chenzhengming 2 жил өмнө
parent
commit
35f5807129

+ 4 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PostCollectionsController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.system;
 
+import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
@@ -7,14 +8,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 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 org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -111,4 +105,6 @@ public class PostCollectionsController extends BaseController
     {
         return toAjax(postCollectionsService.deletePostCollectionsByIds(ids));
     }
+
+
 }

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PostCollectionsSystemMapper.java

@@ -1,7 +1,9 @@
 package com.ruoyi.system.mapper;
 
+import java.util.Date;
 import java.util.List;
 import com.ruoyi.system.domain.PostCollectionsSystem;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 藏品套系Mapper接口
@@ -58,4 +60,9 @@ public interface PostCollectionsSystemMapper
      * @return 结果
      */
     public int deletePostCollectionsSystemByIds(Long[] ids);
+
+    //套系搜索功能
+    List<PostCollectionsSystem> selectPostListByTitleOrTime(@Param("title") String title,
+                                                            @Param("timeLeft") Date timeLeft,
+                                                            @Param("timeRight") Date timeRight);
 }

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IPostCollectionsService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+import java.util.Date;
 import java.util.List;
 import com.ruoyi.system.domain.PostCollections;
 
@@ -58,4 +59,6 @@ public interface IPostCollectionsService
      * @return 结果
      */
     public int deletePostCollectionsById(Long id);
+
+
 }

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IPostCollectionsSystemService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+import java.util.Date;
 import java.util.List;
 import com.ruoyi.system.domain.PostCollectionsSystem;
 
@@ -58,4 +59,6 @@ public interface IPostCollectionsSystemService
      * @return 结果
      */
     public int deletePostCollectionsSystemById(Long id);
+    //搜索功能
+    List<PostCollectionsSystem> selectByTitleAndTime(String title, Date timeLeft, Date timeRight);
 }

+ 36 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PostCollectionsSystemServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service.impl;
 
+import java.util.Date;
 import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -93,4 +94,39 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
     {
         return postCollectionsSystemMapper.deletePostCollectionsSystemById(id);
     }
+
+    /**
+     * 套系搜索功能
+     * @return
+     */
+    @Override
+    public List<PostCollectionsSystem> selectByTitleAndTime(String title, Date TimeLeft, Date TimeRight) {
+        if (title != null) {
+            //标题不为空则判断时间
+            if (TimeLeft != null && TimeRight != null) {
+                if( TimeLeft.before(TimeRight)) {
+                    return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
+                }else {
+                    return null;
+                }
+            }else {
+                //时间为空
+                return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
+
+            }
+        } else {
+            //标题为空
+            //确保查询到的公告为已发布的公告
+            if (TimeLeft != null && TimeRight != null) {
+                //时间不为空 ,且左时间在右时间之前
+                if( TimeLeft.before(TimeRight)) {
+                    return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
+                }else {
+                    return null;
+                }
+            }
+        }
+        PostCollectionsSystem post = new PostCollectionsSystem();
+        return postCollectionsSystemMapper.selectPostCollectionsSystemList(post);
+    }
 }

+ 10 - 0
ruoyi-system/src/main/resources/mapper/system/PostCollectionsSystemMapper.xml

@@ -110,4 +110,14 @@
             #{id}
         </foreach>
     </delete>
+
+    <!--套系搜索功能-->
+    <select id="selectPostListByTitleOrTime" resultType="PostCollectionsSystem" resultMap="PostCollectionsSystemResult">
+        <include refid="selectPostCollectionsSystemVo"/>
+        <where>
+            <if test="title != null  and title != ''"> and name LIKE '%${title}%'</if>
+            <if test="timeLeft != null and timeRight != null "> and create_time between #{timeLeft} AND #{timeRight}</if>
+        </where>
+    </select>
+
 </mapper>