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

import cn.com.ty.lift.ud.templateBase.service.IMaintenanceOptionService;
import cn.com.ty.lift.ud.templateBase.mapper.MaintenanceOptionMapper;
import cn.com.ty.lift.ud.templateBase.mapper.entity.MaintenanceOptionEntity;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 维保项 -ServiceImpl
 *
 * @author Xson
 * @date 2020-04-23
 */
@Service
@Transactional
public class MaintenanceOptionServiceImpl extends ServiceImpl<MaintenanceOptionMapper, MaintenanceOptionEntity>
        implements IMaintenanceOptionService {

    @Autowired
    private MaintenanceOptionMapper maintenanceOptionMapper;

    /**
     * 批量启用或停用
     *
     * @param ids
     * @param status
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateByIds(List<Long> ids, Integer status) {
        for (Long id : ids) {
            MaintenanceOptionEntity que = new MaintenanceOptionEntity();
            que.setId(id);
            que.setStatuz(status);
            maintenanceOptionMapper.updateById(que);
        }
    }


}
