package com.ssj.service.sys.schoolmatecircle.service.impl;

import com.ssj.bean.sys.schoolmatecircle.domain.SchoolmateCircle;
import com.ssj.dao.sys.schoolmatecircle.dao.SchoolmateCircleDao;
import com.ssj.dao.sys.schoolmatecircle.dao.SchoolmateCircleQueryDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.sys.schoolmatecircle.service.SchoolmateCircleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * @author Mount Liu
 * @date 2018/8/15
 */
@Service
@Transactional
public class SchoolmateCircleServiceImpl extends BaseServiceImpl<SchoolmateCircle, String> implements SchoolmateCircleService {

    private   Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SchoolmateCircleDao dao;

    @Autowired
    private SchoolmateCircleQueryDao schoolmateCircleQueryDao;

    @Override
    public PagingAndSortingRepository<SchoolmateCircle, String> getDao() {
        return dao;
    }

    @Override
    public Map<String, Object> findCircleById(String id, String userId) {
        return schoolmateCircleQueryDao.findCircleById(id, userId);
    }

    @Override
    public Page<Map<String, Object>> findByPage(Map<String, Object> params, Pageable sp) {
        return schoolmateCircleQueryDao.findCircleByPage(params,sp);
    }

    @Override
    public void acceptSolution(String commentId) {
      //  dao.acceptSolution(commentId);
        dao.acceptSolutionV1(commentId);
        dao.acceptSolutionV2(commentId);
    }
}
