从数据库获取数据并生成xml文档



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()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值