package com.qmth.qrzk.repository.learnCenter.service;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qmth.qrzk.repository.common.base.BaseDao;
import com.qmth.qrzk.repository.learnCenter.model.LearnCenter;
import com.qmth.qrzk.repository.service.query.LearnCenterQueryParams;

@Service
public class LearnCenterService {
	private final static Logger log = Logger.getLogger(LearnCenterService.class);
	
	@Autowired
	private BaseDao dao;
	
	public LearnCenter getLearnCenterByCategoryCode(String categoryCode){
		return dao.get("getLearnCenterByCategoryCode", categoryCode);
	}
	
	public List<LearnCenter> queryLearnCenters(LearnCenterQueryParams params){
		return dao.getPagerList("queryLearnCenters", params);
	}
	
	public void updateHtmlContent(LearnCenter learnCenter){
		dao.update("updateLearnCenterHtmlContent", learnCenter);
	}
	
	public void updateAttachment(LearnCenter learnCenter){
		dao.update("updateLearnCenterAttachment", learnCenter);
	}
	
	public void addLearnCenter(LearnCenter learnCenter){
		dao.update("addLearnCenter", learnCenter);
	}
	
	public void delete(String ids){
		String[] idArray = ids.split(",");
		
		dao.delete("deleteLearnCenterByIds", idArray);
	}
}
