sjx 2 лет назад
Родитель
Сommit
43dc31237a

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

@@ -1,17 +1,11 @@
 package com.ruoyi.web.controller.system;
 
+import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 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;
@@ -101,4 +95,6 @@ public class PostCollectionsController extends BaseController
     {
         return toAjax(postCollectionsService.deletePostCollectionsByIds(ids));
     }
+
+
 }

+ 36 - 21
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PostCollectionsSystemController.java

@@ -1,17 +1,13 @@
 package com.ruoyi.web.controller.system;
 
+import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+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;
@@ -22,20 +18,20 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
 
 /**
- * 【请填写功能名称】Controller
+ * 套系Controller
  *
  * @author ruoyi
  * @date 2023-02-14
  */
 @RestController
-@RequestMapping("/system/system")
+@RequestMapping("/system/collectionsystem")
 public class PostCollectionsSystemController extends BaseController
 {
     @Autowired
     private IPostCollectionsSystemService postCollectionsSystemService;
 
     /**
-     * 查询【请填写功能名称】列表
+     * 查询套系列表
      */
     @PreAuthorize("@ss.hasPermi('system:system:list')")
     @GetMapping("/list")
@@ -47,20 +43,20 @@ public class PostCollectionsSystemController extends BaseController
     }
 
     /**
-     * 导出【请填写功能名称】列表
+     * 导出套系列表
      */
     @PreAuthorize("@ss.hasPermi('system:system:export')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
+    @Log(title = "套系", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, PostCollectionsSystem postCollectionsSystem)
     {
         List<PostCollectionsSystem> list = postCollectionsSystemService.selectPostCollectionsSystemList(postCollectionsSystem);
         ExcelUtil<PostCollectionsSystem> util = new ExcelUtil<PostCollectionsSystem>(PostCollectionsSystem.class);
-        util.exportExcel(response, list, "【请填写功能名称】数据");
+        util.exportExcel(response, list, "套系数据");
     }
 
     /**
-     * 获取【请填写功能名称】详细信息
+     * 获取套系详细信息
      */
     @PreAuthorize("@ss.hasPermi('system:system:query')")
     @GetMapping(value = "/{id}")
@@ -70,10 +66,10 @@ public class PostCollectionsSystemController extends BaseController
     }
 
     /**
-     * 新增【请填写功能名称】
+     * 新增套系
      */
     @PreAuthorize("@ss.hasPermi('system:system:add')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
+    @Log(title = "套系", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody PostCollectionsSystem postCollectionsSystem)
     {
@@ -81,10 +77,10 @@ public class PostCollectionsSystemController extends BaseController
     }
 
     /**
-     * 修改【请填写功能名称】
+     * 修改套系
      */
     @PreAuthorize("@ss.hasPermi('system:system:edit')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
+    @Log(title = "套系", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody PostCollectionsSystem postCollectionsSystem)
     {
@@ -92,13 +88,32 @@ public class PostCollectionsSystemController extends BaseController
     }
 
     /**
-     * 删除【请填写功能名称】
+     * 删除套系
      */
     @PreAuthorize("@ss.hasPermi('system:system:remove')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
+    @Log(title = "套系", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
         return toAjax(postCollectionsSystemService.deletePostCollectionsSystemByIds(ids));
     }
+
+    /**
+     * 根据套系名称进行查询
+     * @param title
+     * @param TimeLeft
+     * @param TimeRight
+     * @return
+     */
+    @ApiOperation("根据套系名称进行查询")
+    @PreAuthorize("@ss.hasPermi('system:collections:queryCollections')")
+    @GetMapping("/queryCollections")
+    public TableDataInfo list(@RequestParam(value="title",required = false)String title,
+                              @RequestParam(value="TimeLeft",required = false) Date TimeLeft,
+                              @RequestParam(value="TimeRight",required = false) Date TimeRight)
+    {
+        startPage();
+        List<PostCollectionsSystem> list= postCollectionsSystemService.selectByTitleAndTime(title,TimeLeft,TimeRight);
+        return getDataTable(list);
+    }
 }

+ 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

@@ -111,4 +111,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>