GoodsImgs

This commit is contained in:
HH 2022-03-19 11:38:09 +08:00
parent 418c0de76d
commit 543085fe48
4 changed files with 52 additions and 2 deletions

View File

@ -43,4 +43,12 @@ public interface GoodsImgsMapper {
* @return 商品的所有图片信息 * @return 商品的所有图片信息
*/ */
List<GoodsImgs> selectByGoodsId(@Param("goodsId") Long goodsId); List<GoodsImgs> selectByGoodsId(@Param("goodsId") Long goodsId);
/**
* 通过商品ID删除商品图片信息
*
* @param goodsId 商品ID
* @return
*/
int deleteByGoodsId(Long goodsId);
} }

View File

@ -11,11 +11,44 @@ import java.util.List;
*/ */
public interface GoodsImgsService { public interface GoodsImgsService {
/**
* 批量插入商品图片信息
*
* @param goodsImgs 商品图片信息
* @return
*/
int batchInsert(Collection<GoodsImgs> goodsImgs); int batchInsert(Collection<GoodsImgs> goodsImgs);
/**
* 批量编辑商品图片信息
*
* @param goodsImgs 商品图片信息
* @return
*/
int batchUpdate(Collection<GoodsImgs> goodsImgs); int batchUpdate(Collection<GoodsImgs> goodsImgs);
int delete(Collection<Long> ids); /**
* 批量删除商品图片信息
*
* @param ids 商品图片信息ID
* @return
*/
int batchDelete(Collection<Long> ids);
/**
* 通过商品ID删除商品图片信息
*
* @param goodsId 商品ID
* @return
*/
int deleteByGoodsId(@NotNull Long goodsId);
/**
* 通过商品ID查询商品图片信息
*
* @param goodsId 商品ID
* @return
*/
List<GoodsImgs> selectByGoodsId(@NotNull Long goodsId); List<GoodsImgs> selectByGoodsId(@NotNull Long goodsId);
} }

View File

@ -35,7 +35,12 @@ public class GoodsImgsServiceImpl implements GoodsImgsService {
} }
@Override @Override
public int delete(Collection<Long> ids) { public int deleteByGoodsId(@NotNull Long goodsId) {
return goodsImgsMapper.deleteByGoodsId(goodsId);
}
@Override
public int batchDelete(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) return 0; if (CollectionUtils.isEmpty(ids)) return 0;
return goodsImgsMapper.delete(ids); return goodsImgsMapper.delete(ids);
} }

View File

@ -25,6 +25,10 @@
</foreach> </foreach>
</delete> </delete>
<delete id="deleteByGoodsId">
DELETE FROM goods_imgs WHERE goods_id = #{goodsId}
</delete>
<select id="selectByGoodsId" resultType="com.ghy.goods.domain.GoodsImgs"> <select id="selectByGoodsId" resultType="com.ghy.goods.domain.GoodsImgs">
<include refid="selectGoodsImgs"/> <include refid="selectGoodsImgs"/>
<where> <where>