package com.ssm.manage.service.impl;

import com.github.pagehelper.PageInfo;
import com.ssm.core.service.impl.BaseServiceImpl;
import com.ssm.core.utils.AESUtils;
import com.ssm.manage.dao.SsmRoutingDao;
import com.ssm.manage.entity.BaseStaff;
import com.ssm.manage.entity.Routing;
import com.ssm.manage.entity.SmsException;
import com.ssm.manage.query.RoutingListRequest;
import com.ssm.manage.response.StaffResponse;
import com.ssm.manage.service.SsmRoutingService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;


@Service
@Slf4j
public class SsmRoutingServiceImpl extends BaseServiceImpl<Routing> implements SsmRoutingService {

    @Autowired
    private SsmRoutingDao dao;

    /*@Autowired
    private RedisClient<StaffResponse> redisClient;*/

    @Override
    public PageInfo<Routing> selectPage(RoutingListRequest routingListRequest) {
        return dao.selectPage(routingListRequest);
    }


    @Override
    public int add(RoutingListRequest routingListRequest) throws SmsException {
        //routingListRequest.setStaffPhone(AESUtils.encrypt(routingListRequest.getStaffPhone()));
        int i=0;
        return i=dao.add(routingListRequest);
    }


    @Override
    public int update(RoutingListRequest routingListRequest) throws SmsException {
        routingListRequest.setStaffPhone(AESUtils.encrypt(routingListRequest.getStaffPhone()));
        int i=0;
        return i=dao.updateId(routingListRequest);
    }

    @Override
    public int delete(RoutingListRequest routingListRequest) throws SmsException {
        int i=0;
        return i=dao.delete(routingListRequest);
    }


    @Override
    public SsmRoutingDao getDao() {
        return dao;
    }
}
