DictionariesService.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package com.zhcs.dt.service.system.dictionaries.impl;
  2. import java.util.List;
  3. import javax.annotation.Resource;
  4. import org.springframework.stereotype.Service;
  5. import com.zhcs.dt.dao.DaoSupport;
  6. import com.zhcs.dt.entity.Page;
  7. import com.zhcs.dt.entity.system.Dictionaries;
  8. import com.zhcs.dt.service.system.dictionaries.DictionariesManager;
  9. import com.zhcs.dt.util.PageData;
  10. /**
  11. * 说明: 数据字典
  12. * 创建人:FH Q313596790
  13. * 创建时间:2015-12-16
  14. * @version
  15. */
  16. @Service("dictionariesService")
  17. public class DictionariesService implements DictionariesManager{
  18. @Resource(name = "daoSupport")
  19. private DaoSupport dao;
  20. /**新增
  21. * @param pd
  22. * @throws Exception
  23. */
  24. public void save(PageData pd)throws Exception{
  25. dao.save("DictionariesMapper.save", pd);
  26. }
  27. /**删除
  28. * @param pd
  29. * @throws Exception
  30. */
  31. public void delete(PageData pd)throws Exception{
  32. dao.delete("DictionariesMapper.delete", pd);
  33. }
  34. /**修改
  35. * @param pd
  36. * @throws Exception
  37. */
  38. public void edit(PageData pd)throws Exception{
  39. dao.update("DictionariesMapper.edit", pd);
  40. }
  41. /**列表
  42. * @param page
  43. * @throws Exception
  44. */
  45. @SuppressWarnings("unchecked")
  46. public List<PageData> list(Page page)throws Exception{
  47. return (List<PageData>)dao.findForList("DictionariesMapper.datalistPage", page);
  48. }
  49. /**通过id获取数据
  50. * @param pd
  51. * @throws Exception
  52. */
  53. public PageData findById(PageData pd)throws Exception{
  54. return (PageData)dao.findForObject("DictionariesMapper.findById", pd);
  55. }
  56. /**通过编码获取数据
  57. * @param pd
  58. * @throws Exception
  59. */
  60. public PageData findByBianma(PageData pd)throws Exception{
  61. return (PageData)dao.findForObject("DictionariesMapper.findByBianma", pd);
  62. }
  63. /**
  64. * 通过ID获取其子级列表
  65. * @param parentId
  66. * @return
  67. * @throws Exception
  68. */
  69. @SuppressWarnings("unchecked")
  70. public List<Dictionaries> listSubDictByParentId(String parentId) throws Exception {
  71. return (List<Dictionaries>) dao.findForList("DictionariesMapper.listSubDictByParentId", parentId);
  72. }
  73. /**
  74. * 获取所有数据并填充每条数据的子级列表(递归处理)
  75. * @param MENU_ID
  76. * @return
  77. * @throws Exception
  78. */
  79. public List<Dictionaries> listAllDict(String parentId) throws Exception {
  80. List<Dictionaries> dictList = this.listSubDictByParentId(parentId);
  81. for(Dictionaries dict : dictList){
  82. dict.setTreeurl("dictionaries/list.do?DICTIONARIES_ID="+dict.getDICTIONARIES_ID());
  83. dict.setSubDict(this.listAllDict(dict.getDICTIONARIES_ID()));
  84. dict.setTarget("treeFrame");
  85. }
  86. return dictList;
  87. }
  88. /**
  89. * 获取所有数据并填充每条数据的子级列表(递归处理)用于代码生成器引用数据字典
  90. * @param MENU_ID
  91. * @return
  92. * @throws Exception
  93. */
  94. public List<Dictionaries> listAllDictToCreateCode(String parentId) throws Exception {
  95. List<Dictionaries> dictList = this.listSubDictByParentId(parentId);
  96. for(Dictionaries dict : dictList){
  97. dict.setTreeurl("javascript:setDID(\""+dict.getDICTIONARIES_ID()+"\");");
  98. dict.setSubDict(this.listAllDictToCreateCode(dict.getDICTIONARIES_ID()));
  99. dict.setTarget("treeFrame");
  100. }
  101. return dictList;
  102. }
  103. /**排查表检查是否被占用
  104. * @param pd
  105. * @throws Exception
  106. */
  107. public PageData findFromTbs(PageData pd)throws Exception{
  108. return (PageData)dao.findForObject("DictionariesMapper.findFromTbs", pd);
  109. }
  110. }