package com.hp.teach.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hp.teach.mapper.SchoolMapper;
import com.hp.teach.domain.School;
import com.hp.teach.service.ISchoolService;
import com.hp.common.support.Convert;

/**
 * 校区 服务层实现
 * 
 * @author hp
 * @date 2019-02-12
 */
@Service
public class SchoolServiceImpl implements ISchoolService 
{
	@Autowired
	private SchoolMapper schoolMapper;

	/**
     * 查询校区信息
     * 
     * @param schoolId 校区ID
     * @return 校区信息
     */
    @Override
	public School selectSchoolById(Integer schoolId)
	{
	    return schoolMapper.selectSchoolById(schoolId);
	}
	
	/**
     * 查询校区列表
     * 
     * @param school 校区信息
     * @return 校区集合
     */
	@Override
	public List<School> selectSchoolList(School school)
	{
	    return schoolMapper.selectSchoolList(school);
	}

    /**
     * 新增校区
     * 
     * @param school 校区信息
     * @return 结果
     */
	@Override
	public int insertSchool(School school)
	{
		school.setDatetime(new Date());
	    return schoolMapper.insertSchool(school);
	}
	
	/**
     * 修改校区
     * 
     * @param school 校区信息
     * @return 结果
     */
	@Override
	public int updateSchool(School school)
	{
	    return schoolMapper.updateSchool(school);
	}

	/**
     * 删除校区对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteSchoolByIds(String ids)
	{
		return schoolMapper.deleteSchoolByIds(Convert.toStrArray(ids));
	}
	
}
