2 Commit-ok 4713be59b7 ... 6e56ce0c09

Szerző SHA1 Üzenet Dátum
  zyf12 6e56ce0c09 搜索接口 2 éve
  zyf12 8aa095ccf3 单独查询公告详情接口 2 éve

+ 51 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PostNoticeController.java

@@ -3,9 +3,11 @@ package com.ruoyi.web.controller.system;
 
 
 import java.util.List;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
 
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -51,6 +53,44 @@ public class PostNoticeController extends BaseController
         List<PostNotice> list = postNoticeService.selectPostNoticeList(postNotice);
         List<PostNotice> list = postNoticeService.selectPostNoticeList(postNotice);
         return getDataTable(list);
         return getDataTable(list);
     }
     }
+    /*@ApiOperation("搜索公告")
+    @PreAuthorize("@ss.hasPermi('system:notice:queryNotice')")
+    @GetMapping("/queryNotice")
+    public AjaxResult queryByTitleOrTime(String noticeTitle, Date noticeTimeLeft,Date noticeTimeRight){
+        if(noticeTitle!=null){
+            if(noticeTimeLeft!=null&&noticeTimeRight!=null) {
+                List<PostNotice> list = postNoticeService.selectPostNoticeListByTitleOrNoticeTime(noticeTitle, noticeTimeLeft,noticeTimeRight);
+                return success(list);
+            }
+            return error("请输入完整时间范围");
+        }
+        return error("未找到相应数据");
+    }*/
+
+    @ApiOperation("搜索公告列表")
+    @PreAuthorize("@ss.hasPermi('system:notice:queryNotice')")
+    @GetMapping("/queryNotice")
+    public TableDataInfo list(PostNotice postNotice, String title, Date noticeTimeLeft, Date noticeTimeRight)
+    {
+        startPage();
+        List<PostNotice> list=null;
+        if(title!=null){
+            //标题不为空则判断时间
+            if(noticeTimeLeft!=null&&noticeTimeRight!=null&&noticeTimeLeft.before(noticeTimeRight)) {
+                //时间不为空
+                list = postNoticeService.selectPostNoticeListByTitleOrNoticeTime(title, noticeTimeLeft,noticeTimeRight);
+            }
+        }else{
+            //标题为空
+            if(noticeTimeLeft!=null&&noticeTimeRight!=null&&noticeTimeLeft.before(noticeTimeRight)) {
+                //时间不为空
+                //list = postNoticeService.selectPostNoticeListOnlyByTitleOrNoticeTime(noticeTimeLeft,noticeTimeRight);
+            }else {
+                list = postNoticeService.selectPostNoticeList(postNotice);
+            }
+        }
+        return getDataTable(list);
+    }
 
 
     /**
     /**
      * 导出公告列表
      * 导出公告列表
@@ -77,6 +117,17 @@ public class PostNoticeController extends BaseController
         return success(postNoticeService.selectPostNoticeByNoticeId(noticeId));
         return success(postNoticeService.selectPostNoticeByNoticeId(noticeId));
     }
     }
 
 
+    /**
+     * 单独获取公告详细信息
+     * @param noticeId
+     * @return
+     */
+    @ApiOperation("单独获取公告详细信息")
+    @PreAuthorize("@ss.hasPermi('system:notice:queryDetail')")
+    @GetMapping(value = "/{/detail/noticeId}")
+    public AjaxResult getDetail(@PathVariable("noticeId")Long noticeId){
+        return success(postNoticeService.selectDetailByNoticeId(noticeId));
+    }
     /**
     /**
      * 新增公告
      * 新增公告
      */
      */

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PostNoticeMapper.java

@@ -27,6 +27,13 @@ public interface PostNoticeMapper
      */
      */
     public List<PostNotice> selectPostNoticeList(PostNotice postNotice);
     public List<PostNotice> selectPostNoticeList(PostNotice postNotice);
 
 
+    /**
+     * 查询公告详情
+     * @param noticeId
+     * @return
+     */
+    public String selectDetailByNoticeId(Long noticeId);
+
     /**
     /**
      * 新增公告
      * 新增公告
      *
      *
@@ -58,4 +65,5 @@ public interface PostNoticeMapper
      * @return 结果
      * @return 结果
      */
      */
     public int deletePostNoticeByNoticeIds(Long[] noticeIds);
     public int deletePostNoticeByNoticeIds(Long[] noticeIds);
+
 }
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IPostNoticeService.java

@@ -58,4 +58,12 @@ public interface IPostNoticeService
      * @return 结果
      * @return 结果
      */
      */
     public int deletePostNoticeByNoticeId(Long noticeId);
     public int deletePostNoticeByNoticeId(Long noticeId);
+
+    /**
+     * 查询公告详情
+     *
+     * @param noticeId
+     * @return
+     */
+    public String selectDetailByNoticeId(Long noticeId);
 }
 }

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PostNoticeServiceImpl.java

@@ -44,6 +44,12 @@ public class PostNoticeServiceImpl implements IPostNoticeService
         return postNoticeMapper.selectPostNoticeList(postNotice);
         return postNoticeMapper.selectPostNoticeList(postNotice);
     }
     }
 
 
+
+    @Override
+    public String selectDetailByNoticeId(Long noticeId) {
+        return postNoticeMapper.selectDetailByNoticeId(noticeId);
+    }
+
     /**
     /**
      * 新增公告
      * 新增公告
      *
      *
@@ -93,4 +99,5 @@ public class PostNoticeServiceImpl implements IPostNoticeService
     {
     {
         return postNoticeMapper.deletePostNoticeByNoticeId(noticeId);
         return postNoticeMapper.deletePostNoticeByNoticeId(noticeId);
     }
     }
+
 }
 }

+ 4 - 0
ruoyi-system/src/main/resources/mapper/system/PostNoticeMapper.xml

@@ -32,6 +32,10 @@
         <include refid="selectPostNoticeVo"/>
         <include refid="selectPostNoticeVo"/>
         where notice_id = #{noticeId}
         where notice_id = #{noticeId}
     </select>
     </select>
+    <select id="selectDetailByNoticeId" resultType="String">
+        select detail_detail from post_notice
+        where notice_id = #{noticeId}
+    </select>
 
 
     <insert id="insertPostNotice" parameterType="PostNotice" useGeneratedKeys="true" keyProperty="noticeId">
     <insert id="insertPostNotice" parameterType="PostNotice" useGeneratedKeys="true" keyProperty="noticeId">
         insert into post_notice
         insert into post_notice