package com.mortals.xhx.module.dept.dao.ibatis;


import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.framework.model.ParamDto;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 部门DaoImpl DAO接口
 *
 * @author zxfei
 * @date 2022-01-12
 */
@Repository("deptDao")
public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity, Long> implements DeptDao {
    /**
     * @param deptQuery
     * @return
     */
    @Override
    public List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery) {
        ParamDto paramDto = this.getQueryParam(deptQuery);
        List list = this.getSqlSession().selectList(this.getSqlId(GET_DEPT_LIST_BY_BUSINESS), paramDto);
        return list;
    }

    /**
     * @param deptQuery
     * @return
     */
    @Override
    public List<DeptVo> getBusinessByDept(DeptQuery deptQuery) {
        ParamDto paramDto = this.getQueryParam(deptQuery);
        List list = this.getSqlSession().selectList(this.getSqlId(GET_BUSINESS_BY_DEPT), paramDto);
        return list;
    }

    /**
     * @return
     */
    @Override
    public List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery) {
        ParamDto paramDto = this.getQueryParam(deptQuery);
        return this.getSqlSession().selectList(this.getSqlId(GET_DEPTLIST_BY_EXISTBUSINESS),paramDto);
    }
}
