瀏覽代碼

广告位置改为多选

yh 4 天之前
父節點
當前提交
291cd6581b

+ 2 - 0
fs-service/src/main/java/com/fs/his/domain/FsAdv.java

@@ -61,4 +61,6 @@ public class FsAdv extends BaseEntity
     /** 跳转小程序原始id **/
     private String originalId;
 
+    private String advTypes;
+
 }

+ 3 - 1
fs-service/src/main/java/com/fs/his/mapper/FsAdvMapper.java

@@ -3,6 +3,7 @@ package com.fs.his.mapper;
 import java.util.List;
 import com.fs.his.domain.FsAdv;
 import com.fs.his.param.FsAdvUParam;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 /**
@@ -27,7 +28,8 @@ public interface FsAdvMapper
      * @param fsAdv 广告
      * @return 广告集合
      */
-    public List<FsAdv> selectFsAdvList(FsAdv fsAdv);
+    List<FsAdv> selectFsAdvList(@Param("fsAdv") FsAdv fsAdv, @Param("types") String[] types);
+
 
     /**
      * 新增广告

+ 6 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsAdvServiceImpl.java

@@ -3,6 +3,7 @@ package com.fs.his.service.impl;
 import java.util.Collections;
 import java.util.List;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.his.param.FsAdvUParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -43,7 +44,11 @@ public class FsAdvServiceImpl implements IFsAdvService
     @Override
     public List<FsAdv> selectFsAdvList(FsAdv fsAdv)
     {
-        return fsAdvMapper.selectFsAdvList(fsAdv);
+        String[] types = null;
+        if (StringUtils.isNotEmpty(fsAdv.getAdvTypes())){
+            types = fsAdv.getAdvTypes().split(",");
+        }
+        return fsAdvMapper.selectFsAdvList(fsAdv,types);
     }
 
     /**

+ 15 - 10
fs-service/src/main/resources/mapper/his/FsAdvMapper.xml

@@ -26,18 +26,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                adv_type, show_type, active_id,original_id from fs_adv
     </sql>
 
-    <select id="selectFsAdvList" parameterType="FsAdv" resultMap="FsAdvResult">
+    <select id="selectFsAdvList" resultMap="FsAdvResult">
         <include refid="selectFsAdvVo"/>
         <where>
-            <if test="advTitle != null  and advTitle != ''"> adv_title like concat('%', #{advTitle}, '%')</if>
-            <if test="imageUrl != null  and imageUrl != ''"> and image_url = #{imageUrl}</if>
-            <if test="advUrl != null  and advUrl != ''"> and adv_url = #{advUrl}</if>
-            <if test="content != null  and content != ''"> and content = #{content}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
-            <if test="sort != null  and sort != ''"> and sort = #{sort}</if>
-            <if test="advType != null "> and adv_type = #{advType}</if>
-            <if test="showType != null "> and show_type = #{showType}</if>
-            <if test="originalId != null and originalId != ''"> and original_id = #{originalId}</if>
+            <if test="fsAdv.advTitle != null  and fsAdv.advTitle != ''"> adv_title like concat('%', #{fsAdv.advTitle}, '%')</if>
+            <if test="fsAdv.imageUrl != null  and fsAdv.imageUrl != ''"> and image_url = #{fsAdv.imageUrl}</if>
+            <if test="fsAdv.advUrl != null  and fsAdv.advUrl != ''"> and adv_url = #{fsAdv.advUrl}</if>
+            <if test="fsAdv.content != null  and fsAdv.content != ''"> and content = #{fsAdv.content}</if>
+            <if test="fsAdv.status != null  and fsAdv.status != ''"> and status = #{fsAdv.status}</if>
+            <if test="fsAdv.sort != null  and fsAdv.sort != ''"> and sort = #{fsAdv.sort}</if>
+            <if test="fsAdv.showType != null "> and show_type = #{fsAdv.showType}</if>
+            <if test="fsAdv.originalId != null and fsAdv.originalId != ''"> and original_id = #{fsAdv.originalId}</if>
+            <if test="types != null and types.length > 0">
+                and adv_type in
+                <foreach collection="types" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         order by status desc,sort,adv_id desc
     </select>