Ver código fonte

咨询信息标题增加模糊查询

lujie 5 meses atrás
pai
commit
7a33507413

+ 7 - 8
ruoyi-abuwx/src/main/java/com/ruoyi/abuwx/service/impl/BannerInfoServiceImpl.java

@@ -1,19 +1,18 @@
 package com.ruoyi.abuwx.service.impl;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
+import com.ruoyi.abuwx.domain.BannerInfo;
 import com.ruoyi.abuwx.domain.InfoContent;
+import com.ruoyi.abuwx.mapper.BannerInfoMapper;
 import com.ruoyi.abuwx.mapper.InfoContentMapper;
+import com.ruoyi.abuwx.service.IBannerInfoService;
 import com.ruoyi.abuwx.vo.BannerInfoVo;
 import com.ruoyi.common.utils.DateUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.abuwx.mapper.BannerInfoMapper;
-import com.ruoyi.abuwx.domain.BannerInfo;
-import com.ruoyi.abuwx.service.IBannerInfoService;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 轮播图管理Service业务层处理
@@ -105,7 +104,7 @@ public class BannerInfoServiceImpl implements IBannerInfoService
 
     @Override
     public List<BannerInfoVo> selectBannerInfoVoList(BannerInfo bannerInfo) {
-        List<BannerInfoVo> bannerInfoVoList = new ArrayList<BannerInfoVo>();
+        List<BannerInfoVo> bannerInfoVoList = new ArrayList<>();
         List<BannerInfo> list = bannerInfoMapper.selectBannerInfoList(bannerInfo);
         list.forEach(item->{
             Long infoId = item.getInfoId();

+ 6 - 0
ruoyi-abuwx/src/main/resources/mapper/abuwx/InfoCategoryMapper.xml

@@ -24,6 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="sort != null  and sort != ''"> and sort = #{sort}</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
+            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+                and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+            </if>
+            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+                and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+            </if>
         </where>
     </select>
     

+ 13 - 1
ruoyi-abuwx/src/main/resources/mapper/abuwx/InfoContentMapper.xml

@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         a.create_by as createBy, a.update_by as updateBy, a.cancel_time as cancelTime, b.name as categoryName
         from info_content a left join info_category b on a.category_id = b.id
         <where>
-            <if test="title != null  and title != ''"> and a.title = #{title}</if>
+            <if test="title != null  and title != ''"> and a.title like concat('%',#{title},'%')</if>
             <if test="categoryId != null "> and a.category_id = #{categoryId}</if>
             <if test="source != null  and source != ''"> and a.source = #{source}</if>
             <if test="checkStatus != null  and checkStatus != ''"> and a.check_status = #{checkStatus}</if>
@@ -65,6 +65,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="content != null  and content != ''"> and a.content = #{content}</if>
             <if test="banner != null  and banner != ''"> and a.banner = #{banner}</if>
             <if test="cancelTime != null "> and a.cancel_time = #{cancelTime}</if>
+            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+                and date_format(a.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+            </if>
+            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+                and date_format(a.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+            </if>
+            <if test="params.beginupdateTime != null and params.beginupdateTime != ''"><!-- 开始时间检索 -->
+                and date_format(a.update_time,'%y%m%d') &gt;= date_format(#{params.beginupdateTime},'%y%m%d')
+            </if>
+            <if test="params.endupdateTime != null and params.endupdateTime != ''"><!-- 结束时间检索 -->
+                and date_format(a.update_time,'%y%m%d') &lt;= date_format(#{params.endupdateTime},'%y%m%d')
+            </if>
         </where>
     </select>
 

+ 13 - 1
ruoyi-abuwx/src/main/resources/mapper/banner/BannerInfoMapper.xml

@@ -26,12 +26,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectBannerInfoList" parameterType="BannerInfo" resultMap="BannerInfoResult">
         <include refid="selectBannerInfoVo"/>
         <where>  
-            <if test="title != null  and title != ''"> and title = #{title}</if>
+            <if test="title != null  and title != ''"> and title like concat('%', #{title}, '%')</if>
             <if test="infoId != null "> and info_id = #{infoId}</if>
             <if test="img != null  and img != ''"> and img = #{img}</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
             <if test="deleteFlag != null  and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
             <if test="sort != null  and sort != ''"> and sort = #{sort}</if>
+            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+                and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+            </if>
+            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+                and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+            </if>
+            <if test="params.beginupdateTime != null and params.beginupdateTime != ''"><!-- 开始时间检索 -->
+                and date_format(update_time,'%y%m%d') &gt;= date_format(#{params.beginupdateTime},'%y%m%d')
+            </if>
+            <if test="params.endupdateTime != null and params.endupdateTime != ''"><!-- 结束时间检索 -->
+                and date_format(update_time,'%y%m%d') &lt;= date_format(#{params.endupdateTime},'%y%m%d')
+            </if>
         </where>
     </select>