c3f592e6144bbb5b555a67e246e42f1de432f459.svn-base 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**
  2. *
  3. */
  4. package com.sinosoft.am.org.dept.indept.busi;
  5. import java.util.ArrayList;
  6. import net.sf.json.JSONObject;
  7. import org.apache.log4j.Logger;
  8. import com.sinosoft.am.org.dept.indept.dao.PlanGlOrgDao;
  9. import com.sinosoft.am.org.dept.indept.vo.PlanGlOrgVo;
  10. import com.sinosoft.lz.system.right.role.busi.RoleBean;
  11. /**
  12. * @author 徐威
  13. * 2015-09-19
  14. * tel:13811395647
  15. */
  16. public class PlanGlOrgBean{
  17. private Logger log = Logger.getLogger(RoleBean.class);
  18. private PlanGlOrgDao dao = new PlanGlOrgDao();
  19. /**
  20. *
  21. * @param sql
  22. * 查询语句
  23. * @return
  24. * @throws ClassNotFoundException
  25. */
  26. public ArrayList<PlanGlOrgVo> getInDeptVo(String sql) throws ClassNotFoundException {
  27. return dao.getDeptList(sql);
  28. }
  29. public ArrayList<PlanGlOrgVo> getInDeptVoById(String id) throws ClassNotFoundException {
  30. return dao.getDeptTreeNodesById(id);
  31. }
  32. public ArrayList<PlanGlOrgVo> getInDeptVoByIdAsync(String id) throws ClassNotFoundException {
  33. return dao.getNextLevelTreeById(id);
  34. }
  35. public PlanGlOrgVo getDeptRootById(String id) throws ClassNotFoundException {
  36. return dao.getInDeptVoById(id);
  37. }
  38. public boolean shamDeleteOrgInDept(String deptId){
  39. return dao.shamDeleteOrgInDept(deptId);
  40. }
  41. public boolean updateOrgInDeptName(String deptId, String deptName){
  42. return dao.updateOrgInDeptName(deptId, deptName);
  43. }
  44. public boolean addOrgInDept(String deptId, String parentId, String deptName){
  45. return dao .addOrgInDept(deptId, parentId, deptName);
  46. }
  47. /**
  48. * @param comp_id
  49. * @return
  50. */
  51. @SuppressWarnings("unused")
  52. public String getInOrgDoubleTreeRoot(String comp_id) {
  53. StringBuffer json = new StringBuffer();
  54. PlanGlOrgVo vo1 = new PlanGlOrgVo();
  55. vo1 = dao.getInOrgDoubleTreeRoot(comp_id);
  56. String deptId = vo1.getID();
  57. String deptName = vo1.getNAME();
  58. String parentId = vo1.getPARENT_ID();
  59. json.append("{\"fromList\":[");
  60. json.append("{");
  61. json.append(" id:'"+deptId+"', parentId:'0', ");
  62. json.append(" objectId:'000', ");
  63. json.append(" name:'"+deptName+"', ");
  64. json.append(" type:'unit',menuType:'nonLeafMenu',");
  65. json.append(" drag:'false', ");
  66. json.append(" open:true, ");
  67. json.append(" icon:'/nwyj/scripts/qui/libs/icons/home.gif'");
  68. json.append("},");
  69. if(dao.hasChildNode(comp_id)){
  70. };
  71. if(dao.hasStaff(comp_id)){
  72. }
  73. if (json.lastIndexOf(",") > -1) {
  74. json.deleteCharAt(json.lastIndexOf(","));
  75. }
  76. json.append("],\"toList\":[]}");
  77. log.info("json==="+json);
  78. return JSONObject.fromObject(json.toString()).toString();
  79. }
  80. }