package com.casic.missiles.modular.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.casic.missiles.core.application.context.AbstractPermissionContext;
import com.casic.missiles.core.datascope.DataScope;
import com.casic.missiles.modular.system.dao.AlarmNowViewMapper;
import com.casic.missiles.modular.system.dto.AlarmNowView;
import com.casic.missiles.modular.system.service.IAlarmNowViewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author casic123
 * @since 2019-05-17
 */
@Service
public class AlarmNowViewServiceImpl extends ServiceImpl<AlarmNowViewMapper, AlarmNowView> implements IAlarmNowViewService {

    @Resource
    private AbstractPermissionContext permissionService;

    @Override
    public List<AlarmNowView> getNowAlarmRecords(DataScope dataScope) {
        List<AlarmNowView> alarmNowViewList = this.baseMapper.getNowAlarmRecords(dataScope);
        for (AlarmNowView alarmNowView : alarmNowViewList) {
            alarmNowView.setWellTypeName(permissionService.getDictNameByCode("sluicewellType",alarmNowView.getWellType()));
        }
        return alarmNowViewList;
    }

    @Override
    public List<AlarmNowView> getAlarmsByWell(Long id) {
        return this.baseMapper.getAlarmsByWell(id);
    }


}
