package cn.com.ty.lift.ud.shopping.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.com.ty.lift.ud.shopping.mapper.ShoppingMapper;
import cn.com.ty.lift.ud.shopping.mapper.entity.ShoppingEntity;
import cn.com.ty.lift.ud.shopping.service.IShoppingService;

/**
 * 商城 -ServiceImpl
 *
 * @author Xson
 * @date 2020-04-23
 */
@Service
@Transactional
public class ShoppingServiceImpl extends ServiceImpl<ShoppingMapper, ShoppingEntity> implements IShoppingService {

    @Autowired
    private ShoppingMapper shoppingMapper;

    @Override
    public void updateByIds(List<Long> ids, Integer status) {
        for (Long id : ids) {
            ShoppingEntity bit = new ShoppingEntity();
            bit.setId(id);
            bit.setStatuz(status);
            shoppingMapper.updateById(bit);
        }
    }

    @Override
    public void updateHotFlagByIds(List<Long> ids, Integer status) {
        for (Long id : ids) {
            ShoppingEntity bit = new ShoppingEntity();
            bit.setId(id);
            bit.setHotFlag(status);
            shoppingMapper.updateById(bit);
        }
    }

    @Override
    public void updateBrowseNum(Long id) {
        shoppingMapper.updateBrowseNum(id);
    }

}
