shuhao 5 mesi fa
parent
commit
09ec68cdfe

+ 7 - 0
admin/src/main/java/com/flyer/foster/mapper/ICartoonUrlMapper.java

@@ -22,4 +22,11 @@ public interface ICartoonUrlMapper extends BaseMapper<CartoonUrl> {
      * @return
      */
     boolean deleteByIdList(@Param("cartoonIdList") List<Integer> cartoonIdList);
+
+    /**
+     * 根据漫画id查询url集合
+     * @param cartoonId
+     * @return
+     */
+    List<String> urlsByCartoonId(@Param("cartoonId") Integer cartoonId);
 }

+ 7 - 0
admin/src/main/java/com/flyer/foster/service/ICartoonUrlService.java

@@ -21,4 +21,11 @@ public interface ICartoonUrlService extends IService<CartoonUrl> {
      * @return
      */
     boolean deleteByCartoonIdList(List<Integer> idList);
+
+    /**
+     * 根据漫画id 查询图片url集合
+     * @param id
+     * @return
+     */
+    List<String> urlsByCartoonId(Integer id);
 }

+ 4 - 0
admin/src/main/java/com/flyer/foster/service/impl/CartoonServiceImpl.java

@@ -38,6 +38,7 @@ public class CartoonServiceImpl extends ServiceImpl<ICartoonMapper, Cartoon> imp
     @Autowired
     private ICartoonUrlService iCartoonUrlService;
 
+
     @Override
     public IPage<CartoonRespDTO> getPageList(IPage<Cartoon> page, CartoonQueryDTO queryDTO) {
         IPage<CartoonRespDTO> pageResult = new Page<>(page.getCurrent(), page.getSize());
@@ -53,6 +54,9 @@ public class CartoonServiceImpl extends ServiceImpl<ICartoonMapper, Cartoon> imp
             BeanUtil.copyProperties(cartoon, respDTO);
             list.add(respDTO);
         }
+        for(CartoonRespDTO bean : list) {
+            bean.setCartoonUrlList(iCartoonUrlService.urlsByCartoonId(bean.getId()));
+        }
         pageResult.setRecords(list);
         pageResult.setTotal(pageInfo.getTotal());
         return pageResult;

+ 5 - 0
admin/src/main/java/com/flyer/foster/service/impl/CartoonUrlServiceImpl.java

@@ -23,4 +23,9 @@ public class CartoonUrlServiceImpl extends ServiceImpl<ICartoonUrlMapper, Cartoo
     public boolean deleteByCartoonIdList(List<Integer> cartoonIdList) {
         return baseMapper.deleteByIdList(cartoonIdList);
     }
+
+    @Override
+    public List<String> urlsByCartoonId(Integer id) {
+        return baseMapper.urlsByCartoonId(id);
+    }
 }

+ 6 - 0
admin/src/main/resources/mapper/CartoonUrlMapper.xml

@@ -8,4 +8,10 @@
             #{id}
         </foreach>
     </delete>
+
+    <select id="urlsByCartoonId" resultType="java.lang.String">
+        select url
+        from tb_cartoon_url
+        where cartoon_id = #{cartoonId}
+    </select>
 </mapper>