package com.community.huiju.service.impl;

import com.community.commom.mode.ResponseBean;
import com.community.commom.session.UserElement;
import com.community.huiju.dao.TaAgreementMapper;
import com.community.huiju.dao.TpannouncementTelMapper;
import com.community.huiju.model.TaAgreement;
import com.community.huiju.model.TpannouncementTel;
import com.community.huiju.service.AgreementServicel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("agreementService")
public class AgreementServiceimpl implements AgreementServicel {

    @Autowired
    private TaAgreementMapper agreementMapper;

    @Autowired
    private TpannouncementTelMapper tpannouncementTelMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return agreementMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TaAgreement record) {
        return agreementMapper.insert(record);
    }

    @Override
    public int insertSelective(TaAgreement record) {
        return agreementMapper.insertSelective(record);
    }

    @Override
    public TaAgreement selectByPrimaryKey(Integer id) {
        return agreementMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TaAgreement record) {
        return agreementMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TaAgreement record) {
        return agreementMapper.updateByPrimaryKey(record);
    }

    /**
     * @return
     */
    @Override
    public TaAgreement getAgreement() {
        return agreementMapper.getAgreement();
    }

    @Override
    public ResponseBean getTpAnnouncementTel(UserElement userElement) {
        ResponseBean responseBody = new ResponseBean();
        List<TpannouncementTel> tt = tpannouncementTelMapper.getTpannouncementTel(userElement.getCommunityId());
        responseBody.addSuccess(tt);
        return responseBody;
    }
}