FuzzParamsServiceImpl.java 1.64 KB
package com.example.fuzzControll.service.impl;


import com.example.fuzzControll.domain.bo.FuzzParams;
import com.example.fuzzControll.mapper.FuzzParamsMapper;
import com.example.fuzzControll.service.FuzzParamsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service("FuzzParamsService")
public class FuzzParamsServiceImpl implements FuzzParamsService {
    @Autowired
    FuzzParamsMapper fuzzParamsMapper;

    @Override
    public List<FuzzParams> getFuzzParamsList() {
        List<FuzzParams> list = null;
        try {
           list = fuzzParamsMapper.getFuzzParamsList();
        } catch (Exception e) {
            log.error("FuzzParamsService.getFuzzParamsList error:{}",e.getMessage());
            throw new RuntimeException(e);
        }
        return list;
    }

    @Override
    public FuzzParams getFuzzParamById(int missionId) {
        FuzzParams fuzzParams = null;
        try {
            fuzzParams = fuzzParamsMapper.getFuzzParamsById(missionId);
        } catch (Exception e) {
            log.error("FuzzParamsService.getFuzzParamById error:{}",e.getMessage());
            throw new RuntimeException(e);
        }
        return fuzzParams;
    }

    @Override
    public boolean saveFuzzParams(FuzzParams fuzzParams) {
        return fuzzParamsMapper.saveFuzzParams(fuzzParams);
    }

    @Override
    public boolean editFuzzParams(FuzzParams fuzzParams) {
        return fuzzParamsMapper.editFuzzParams(fuzzParams.getId(),fuzzParams.getParams(),fuzzParams.getProtocol());
    }
}