Commit f8d158f4 authored by hezhen's avatar hezhen

修改删除

parent 2fb6f866
......@@ -6,6 +6,8 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodBanner;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 商品轮播图
*
......@@ -15,4 +17,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourGoodBannerBiz extends BaseBiz<TourGoodBannerMapper,TourGoodBanner> {
//删除轮播
public void delGoodBanner(Integer goodId, List<Integer> ids){ mapper.delBanner(goodId,ids); }
}
\ No newline at end of file
......@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -108,6 +109,7 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
if(goodId>0){
List<GoodBannerDTO> bannerList=dto.getBannerDTOS();
if(bannerList.size()>0){
List<Integer> bannerIds=new ArrayList<>();
for (GoodBannerDTO bannerDTO:bannerList){
Integer bannerId=bannerDTO.getId();
TourGoodBanner goodBanner=new TourGoodBanner();
......@@ -117,11 +119,19 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
bannerBiz.insertSelective(goodBanner);
}else {
bannerBiz.updateSelectiveById(goodBanner);
bannerIds.add(bannerId);
}
}
if(bannerIds.size()>0){
bannerBiz.delGoodBanner(null,bannerIds);
}
}else{
bannerBiz.delGoodBanner(goodId,null);
}
List<GoodSiteDTO> siteDTOList=dto.getSiteDTOS();
if(siteDTOList.size()>0){
List<Integer> siteIds=new ArrayList<>();
for (GoodSiteDTO siteDTO:siteDTOList){
Integer siteId=siteDTO.getId();
TourGoodSite site=new TourGoodSite();
......@@ -131,12 +141,16 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
siteBiz.insertSelective(site);
}else {
siteBiz.updateById(site);
siteIds.add(siteId);
}
}
if(siteIds.size()>0){
siteBiz.delGoodSite(null,siteIds);
}
}
List<GoodTagDTO> tagList=dto.getTagDTOS();
if(siteDTOList.size()>0){
List<Integer> tagIds=new ArrayList<>();
for (GoodTagDTO tagDTO:tagList){
Integer tagId=tagDTO.getId();
TourGoodTag tag=new TourGoodTag();
......@@ -146,11 +160,18 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
tagBiz.insertSelective(tag);
}else {
tagBiz.updateById(tag);
tagIds.add(tagId);
}
}
if(tagIds.size()>0){
tagBiz.delGoodTag(null,tagIds);
}
}else{
tagBiz.delGoodTag(goodId,null);
}
List<GoodSpePriceDTO> priceDTOList=dto.getPriceDTOS();
if(siteDTOList.size()>0){
List<Integer> priceIds=new ArrayList<>();
for (GoodSpePriceDTO priceDTO:priceDTOList){
Integer priceId=priceDTO.getId();
TourGoodSpePrice spePrice=new TourGoodSpePrice();
......@@ -185,8 +206,12 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
speBiz.insertSelective(spePrice);
}else {
speBiz.updateById(spePrice);
priceIds.add(priceId);
}
}
if(priceIds.size()>0){
speBiz.delGoodSpe(null,priceIds);
}
}
}
} catch (IllegalAccessException e) {
......
......@@ -6,6 +6,8 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodSite;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 路线站点表
*
......@@ -15,4 +17,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourGoodSiteBiz extends BaseBiz<TourGoodSiteMapper,TourGoodSite> {
//删除站点
public void delGoodSite(Integer goodId, List<Integer> ids){ mapper.delSite(goodId,ids);}
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
/**
* 旅游商品规格表
......@@ -92,5 +93,8 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP
}
}
//删除
public void delGoodSpe(Integer goodId, List<Integer> ids){ mapper.delSpe(goodId,ids);}
}
\ No newline at end of file
......@@ -6,6 +6,8 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodTag;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 商品标签表
*
......@@ -16,4 +18,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
@Service
public class TourGoodTagBiz extends BaseBiz<TourGoodTagMapper,TourGoodTag> {
//删除标签
public void delGoodTag(Integer goodId, List<Integer> ids){ mapper.delTag(goodId,ids);}
}
\ No newline at end of file
......@@ -17,5 +17,8 @@ import java.util.List;
public interface TourGoodBannerMapper extends Mapper<TourGoodBanner> {
//查询旅游路线列表
public List<GoodBannerDTO> getBannerList(@Param("goodId")Integer goodId);
//删除Banner
public int delBanner(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -19,4 +19,7 @@ public interface TourGoodSiteMapper extends Mapper<TourGoodSite> {
public List<TourDepartVo> getlistByGoodId(@Param("goodId") Integer goodId);
//删除站点
public int delSite(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -21,6 +21,9 @@ public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
//减库存
int updStockById(@Param("id") Integer id,@Param("number") Integer number);
//删除站点
public int delSpe(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -20,6 +20,9 @@ public interface TourGoodTagMapper extends Mapper<TourGoodTag> {
//查询旅游标签
public List<GoodTagDTO> getGoodTagList(@Param("goodId") Integer goodId);
//删除站点
public int delTag(@Param("goodId")Integer goodId,@Param("list")List<Integer> ids);
}
......@@ -20,4 +20,22 @@
select * FROM tour_good_banner where good_id=#{goodId} and is_del=0
</select>
<update id="delBanner">
update tour_good_banner set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -42,6 +42,22 @@
SELECT * FROM tour_good_site
WHERE good_id=#{goodId} and is_del=0
</select>
<update id="delSite">
update tour_good_site set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -46,6 +46,24 @@
update tour_good_spe_price set stock=stock-#{number} where id=#{id}
</update>
<update id="delSpe">
update tour_good_spe_price set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -26,4 +26,22 @@
WHERE g.id=#{goodId} and tag.is_del=0
</select>
<update id="delTag">
update tour_good_tag set is_del=1
where 1=1
<if test="goodId !=null and goodId >0 ">
and good_id=#{goodId}
</if>
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
<foreach collection="list" item="id">
#{id},
</foreach>
</trim>
)
</if>
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment