Browse Source

Merge remote-tracking branch 'origin/yellow' into yellow

# Conflicts:
#	ruoyi-system/src/main/java/com/ruoyi/system/mapper/PostCollectionsSystemMapper.java
#	ruoyi-system/src/main/java/com/ruoyi/system/service/IPostCollectionsSystemService.java
#	ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PostCollectionsSystemServiceImpl.java
#	ruoyi-system/src/main/resources/mapper/system/PostCollectionsSystemMapper.xml
zyf12 2 years ago
parent
commit
38462a6722

+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PostCollectionsSystemController.java

@@ -96,6 +96,12 @@ public class PostCollectionsSystemController extends BaseController
         if (postCollectionsSystem.getEndTime().before(DateUtils.getNowDate())){
             return warn("请设置正确的套系时间");
         }
+
+        //判断套系名称是否重复
+        if (postCollectionsSystemService.selectPostCollectionsSystemByName(postCollectionsSystem) > 0){
+            return warn("该套系名称已存在");
+        }
+
         return toAjax(postCollectionsSystemService.insertPostCollectionsSystem(postCollectionsSystem));
     }
 

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

@@ -65,8 +65,6 @@ public interface PostCollectionsSystemMapper
     List<PostCollectionsSystem> selectPostListByTitleOrTime(@Param("title") String title,
                                                             @Param("timeLeft") Date timeLeft,
                                                             @Param("timeRight") Date timeRight);
-    //获取藏品数量
-    Integer getCopiesById(Long id);
 
-    Long selectPostCollectionsSystemId(PostCollectionsSystem postCollectionsSystem);
+    Integer getCopiesById(Long id);
 }

+ 9 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/IPostCollectionsSystemService.java

@@ -2,8 +2,9 @@ package com.ruoyi.system.service;
 
 import java.util.Date;
 import java.util.List;
+
+import com.ruoyi.system.domain.PostCollections;
 import com.ruoyi.system.domain.PostCollectionsSystem;
-import com.ruoyi.system.domain.vo.CollectionsVo;
 
 /**
  * 藏品套系Service接口
@@ -61,9 +62,12 @@ public interface IPostCollectionsSystemService
      */
     public int deletePostCollectionsSystemById(Long id);
     //搜索功能
-    List<PostCollectionsSystem> selectByTitleAndTime(String title, Date timeLeft, Date timeRight);
-
-    int getCopies(Long id);
+    public List<PostCollectionsSystem> selectByTitleAndTime(String title, Date timeLeft, Date timeRight);
 
-    List<CollectionsVo> selectPostCollectionsSystemListPage(PostCollectionsSystem postCollectionsSystem);
+    /**
+     *  获取藏品数量
+     * @param postCollections
+     * @return 该套系下藏品数量
+     */
+    public int getCopies(Long id);
 }

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

@@ -1,13 +1,8 @@
 package com.ruoyi.system.service.impl;
 
-import java.util.Collections;
 import java.util.Date;
 import java.util.List;
-import java.util.stream.Collectors;
-
 import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.system.domain.vo.CollectionsVo;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.PostCollectionsSystemMapper;
@@ -171,19 +166,4 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
     public int getCopies(Long id) {
         return postCollectionsSystemMapper.getCopiesById(id);
     }
-
-    @Override
-    public List<CollectionsVo> selectPostCollectionsSystemListPage(PostCollectionsSystem postCollectionsSystem) {
-        List<PostCollectionsSystem> list = postCollectionsSystemMapper.selectPostCollectionsSystemList(postCollectionsSystem);
-        List<CollectionsVo> collectionsVos=list.stream().map((item)->{
-            Long id=postCollectionsSystemMapper.selectPostCollectionsSystemId(postCollectionsSystem);
-            CollectionsVo collectionsVo=new CollectionsVo();
-            BeanUtils.copyProperties(item,collectionsVo);
-            Integer list1= postCollectionsSystemMapper.getCopiesById(id);
-            collectionsVo.setCopies(list1);
-            return collectionsVo;
-        }).collect(Collectors.toList());
-        return collectionsVos;
-    }
-
 }

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

@@ -120,20 +120,4 @@
     <select id="getCopiesById" parameterType="Long" resultType="Integer">
        SELECT SUM(collections_number) 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="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
-            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
-            and del_flag = '0'
-        </where>
-    </select>
 </mapper>