/**
 * Description: 部门数据访问实现类
 * Copyright:   Copyright (c)2016
 * Company:     江苏三六五网络股份有限公司
 *
 * @author: 江苏三六五网络股份有限公司
 * @version: 1.0
 * Create at:   2016-09-14 下午 17:27:15
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2016-09-14   江苏三六五网络股份有限公司   1.0         Initial
 */
package com.house365.ws.dao.impl;

import com.house365.beans.entity.DepartmentEntity;
import com.house365.dao.system.impl.DefaultDaoImpl;
import com.house365.ws.dao.interfaces.IDepartmentDao;
import org.springframework.stereotype.Repository;

import java.util.LinkedList;
import java.util.List;

/**
 * 部门数据访问实现类<br>
 *
 * @author 江苏三六五网络股份有限公司
 * @version 1.0, 2016-09-14
 * @see
 * @since 1.0
 */
@Repository("departmentDao")
public class DepartmentDaoImpl extends DefaultDaoImpl<DepartmentEntity> implements IDepartmentDao<DepartmentEntity> {

    @Override
    public List<DepartmentEntity> findChildrenListByPath(List<DepartmentEntity> parents) {
        List<String> paraList = new LinkedList<>();
        for (DepartmentEntity departmentEntity : parents) {
            paraList.add(departmentEntity.getUrlPath());
        }
        return (List<DepartmentEntity>) this.getReadTemplate().queryForList(getStatement(), paraList);
    }
}
