package com.miaxis.app.school.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.miaxis.app.school.domain.SchoolRegion;
import com.miaxis.app.school.dto.SchoolRegionDTO;
import com.miaxis.app.school.dto.SchoolRegionVO;
import com.miaxis.app.school.mapper.SchoolRegionMapper;
import com.miaxis.app.school.domain.SchoolRegion;
import com.miaxis.app.school.service.ISchoolRegionService;
import com.miaxis.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 驾校训练场Service业务层处理
 *
 * @author zhangbin
 * @date 2020-12-28
 */
@Service
public class SchoolRegionServiceImpl extends ServiceImpl<SchoolRegionMapper, SchoolRegion> implements ISchoolRegionService {
    @Autowired
    private SchoolRegionMapper schoolRegionMapper;

    /**
     * 查询驾校训练场
     *
     * @param id 驾校训练场ID
     * @return 驾校训练场
     */
    @Override
    public SchoolRegion selectSchoolRegionById(Long id){
        return schoolRegionMapper.selectSchoolRegionById(id);
    }

    /**
     * 查询驾校训练场列表
     *
     * @param schoolRegion 驾校训练场
     * @return 驾校训练场
     */
    @Override
    public List<SchoolRegion> selectSchoolRegionList(SchoolRegion schoolRegion){
        return schoolRegionMapper.selectSchoolRegionList(schoolRegion);
    }

    /**
     * 新增驾校训练场
     *
     * @param schoolRegion 驾校训练场
     * @return 结果
     */
    @Override
    public int insertSchoolRegion(SchoolRegion schoolRegion){
        schoolRegion.setCreateTime(DateUtils.getNowDate());
        return schoolRegionMapper.insertSchoolRegion(schoolRegion);
    }

    /**
     * 修改驾校训练场
     *
     * @param schoolRegion 驾校训练场
     * @return 结果
     */
    @Override
    public int updateSchoolRegion(SchoolRegion schoolRegion){
        schoolRegion.setUpdateTime(DateUtils.getNowDate());
        return schoolRegionMapper.updateSchoolRegion(schoolRegion);
    }

    /**
     * 批量删除驾校训练场
     *
     * @param ids 需要删除的驾校训练场ID
     * @return 结果
     */
    @Override
    public int deleteSchoolRegionByIds(Long[] ids){
        return schoolRegionMapper.deleteSchoolRegionByIds(ids);
    }

    /**
     * 删除驾校训练场信息
     *
     * @param id 驾校训练场ID
     * @return 结果
     */
    @Override
    public int deleteSchoolRegionById(Long id){
        return schoolRegionMapper.deleteSchoolRegionById(id);
    }

    /**
     * 查询驾校训练场列表(图片距离)
     * @param schoolRegionDTO
     * @return
     */
    @Override
    public List<SchoolRegionVO> selectSchoolRegionUrlList(SchoolRegionDTO schoolRegionDTO) {
        return schoolRegionMapper.selectSchoolRegionUrlList(schoolRegionDTO);
    }
}
