Browse Source

套系分页显示藏品数量bug修复1.0

sjx 2 years ago
parent
commit
05362a653e

+ 1 - 2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PostCollectionsSystemMapper.java

@@ -69,8 +69,7 @@ public interface PostCollectionsSystemMapper
     // 获取套系藏品 数量
     Integer getCopiesById(Long id);
 
-    // 获取套系全部id
-    List<Long> selectPostCollectionsSystemId(PostCollectionsSystem postCollectionsSystem);
+
 
     // 查询该套系名 数量
     int selectPostCollectionsSystemByName(PostCollectionsSystem postCollectionsSystem);

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

@@ -177,14 +177,14 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
     public List<CollectionsVo> selectPostCollectionsSystemListPage(PostCollectionsSystem postCollectionsSystem) {
         List<PostCollectionsSystem> list = postCollectionsSystemMapper.selectPostCollectionsSystemList(postCollectionsSystem);
         List<CollectionsVo> collectionsVos=list.stream().map((item)->{
-            List<Long> ids=postCollectionsSystemMapper.selectPostCollectionsSystemId(postCollectionsSystem);
+            // 创建 vo实体
             CollectionsVo collectionsVo=new CollectionsVo();
             BeanUtils.copyProperties(item,collectionsVo);
-            for (Long id: ids
-                 ) {
-                Integer list1= postCollectionsSystemMapper.getCopiesById(id);
-                collectionsVo.setCopies(list1);
-            }
+            //  获取套系id
+            Long id = item.getId();
+            //根据id 查询该套系藏品数量
+            Integer copiesById = postCollectionsSystemMapper.getCopiesById(id);
+            collectionsVo.setCopies(copiesById);
             return collectionsVo;
         }).collect(Collectors.toList());
         return collectionsVos;

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

@@ -122,21 +122,6 @@
        SELECT COUNt(system_id) FROM post_collections where system_id = #{id}
     </select>
 
-    <select id="selectPostCollectionsSystemId" parameterType="PostCollectionsSystem" resultType="Long">
-        select id from post_collections_system
-        <where>
-            <if test="type != null "> and type = #{type}</if>
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="startTime != null "> and start_time = #{startTime}</if>
-            <if test="endTime != null "> and end_time = #{endTime}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
-            <if test="image != null  and image != ''"> and image = #{image}</if>
-            <if test="giftExchange != null "> and gift_exchange = #{giftExchange}</if>
-            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
-            <if test="updateBy != null  and updateBy != ''"> and update_by = #{updateBy}</if>
-            and del_flag = '0'
-        </where>
-    </select>
 
     <!--用藏品名称进行查询数量-->
     <select id="selectPostCollectionsSystemByName" parameterType="PostCollectionsSystem" resultType="int">