package com.dic.prm.dm.tc.service.impl;
import java.util.Vector;
import org.jdom.Document;
import com.bsp.base.tools.XmlTranser;
import com.dic.framework.base.BaseServiceImpl;
import com.dic.prm.dm.tc.dao.DeptTreeDao;
import com.dic.prm.dm.tc.dto.DeptTreeDto;
import com.dic.prm.dm.tc.service.CreateDpTreeXmlHTMLService;
import com.dic.prm.pub.dto.UserInfoDto;
import com.dic.prm.pub.util.PrmConstants;
public class CreateDpTreeXmlHTMLServiceImpl extends BaseServiceImpl implements
CreateDpTreeXmlHTMLService {
private DeptTreeDao deptTreeDao;
public DeptTreeDao getDeptTreeDao() {
return deptTreeDao;
}
public void setDeptTreeDao(DeptTreeDao deptTreeDao) {
this.deptTreeDao = deptTreeDao;
}
public DeptTreeDto initDeptTree(DeptTreeDto dto, UserInfoDto userDto) {
String dept_parent = dto.getDeptTree().getdeptParent();
String oper_no = userDto.getOper_no();
StringBuffer sql = new StringBuffer();
Vector result = new Vector();
if (dept_parent != null && !"".equals(dept_parent)) {
/* 根据上级部门查询部门列表树 */
sql.append(" select a.dept_no,a.parent_dept_no,a.dept_type,a.dept_name,a.local_net,a.area_id,a.flag ");
sql.append(" from "+PrmConstants.DB_ULP_USER_NAME+".info_dept a ");
sql.append(" where a.parent_dept_no = '" + dept_parent + "' ");
sql.append(" order by a.flag,a.dept_name, a.dept_no");
System.out.println(sql);
} else {
/* 根据用户查询部门列表树 */
sql.append(" select dept_no,parent_dept_no,dept_type,dept_name,local_net,area_id,flag ");
sql.append(" from "+PrmConstants.DB_ULP_USER_NAME+".info_dept");
sql.append(" where dept_no in (select dept_no from "+PrmConstants.DB_ULP_USER_NAME+".info_oper where oper_no='"
+ oper_no + "'");
sql.append(" union");
sql.append(" select dept_no from "+PrmConstants.DB_ULP_USER_NAME+".rule_oper_control_dept where oper_no='"
+ oper_no + "')");
sql.append(" order by flag,dept_name,dept_no");
System.out.println(sql);
}
// 查询数据存入Vector或数组
result = deptTreeDao.findVectorBySQL(sql.toString()