UserService.java 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. package com.zhcs.dt.service.system.user.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.User;
  8. import com.zhcs.dt.service.system.user.UserManager;
  9. import com.zhcs.dt.util.PageData;
  10. /** 系统用户
  11. * @author fh313596790qq(青苔)
  12. * 修改时间:2015.11.2
  13. */
  14. @Service("userService")
  15. public class UserService implements UserManager{
  16. @Resource(name = "daoSupport")
  17. private DaoSupport dao;
  18. /**登录判断
  19. * @param pd
  20. * @return
  21. * @throws Exception
  22. */
  23. public PageData getUserByNameAndPwd(PageData pd)throws Exception{
  24. return (PageData)dao.findForObject("UserMapper.getUserInfo", pd);
  25. }
  26. /**更新登录时间
  27. * @param pd
  28. * @throws Exception
  29. */
  30. public void updateLastLogin(PageData pd)throws Exception{
  31. dao.update("UserMapper.updateLastLogin", pd);
  32. }
  33. /**保存用户皮肤
  34. * @param pd
  35. * @throws Exception
  36. */
  37. public void saveSkin(PageData pd)throws Exception{
  38. dao.update("UserMapper.saveSkin", pd);
  39. }
  40. /**通过用户ID获取用户信息和角色信息
  41. * @param USER_ID
  42. * @return
  43. * @throws Exception
  44. */
  45. public User getUserAndRoleById(String USER_ID) throws Exception {
  46. return (User) dao.findForObject("UserMapper.getUserAndRoleById", USER_ID);
  47. }
  48. /**通过USERNAEME获取数据
  49. * @param pd
  50. * @return
  51. * @throws Exception
  52. */
  53. public PageData findByUsername(PageData pd)throws Exception{
  54. return (PageData)dao.findForObject("UserMapper.findByUsername", pd);
  55. }
  56. /**列出某角色下的所有用户
  57. * @param pd
  58. * @return
  59. * @throws Exception
  60. */
  61. @SuppressWarnings("unchecked")
  62. public List<PageData> listAllUserByRoldId(PageData pd) throws Exception {
  63. return (List<PageData>) dao.findForList("UserMapper.listAllUserByRoldId", pd);
  64. }
  65. /**保存用户IP
  66. * @param pd
  67. * @throws Exception
  68. */
  69. public void saveIP(PageData pd)throws Exception{
  70. dao.update("UserMapper.saveIP", pd);
  71. }
  72. /**用户列表
  73. * @param page
  74. * @return
  75. * @throws Exception
  76. */
  77. @SuppressWarnings("unchecked")
  78. public List<PageData> listUsers(Page page)throws Exception{
  79. return (List<PageData>) dao.findForList("UserMapper.userlistPage", page);
  80. }
  81. /**用户列表(弹窗选择用)
  82. * @param page
  83. * @return
  84. * @throws Exception
  85. */
  86. @SuppressWarnings("unchecked")
  87. public List<PageData> listUsersBystaff(Page page)throws Exception{
  88. return (List<PageData>) dao.findForList("UserMapper.userBystafflistPage", page);
  89. }
  90. /**通过邮箱获取数据
  91. * @param pd
  92. * @return
  93. * @throws Exception
  94. */
  95. public PageData findByUE(PageData pd)throws Exception{
  96. return (PageData)dao.findForObject("UserMapper.findByUE", pd);
  97. }
  98. /**通过编号获取数据
  99. * @param pd
  100. * @return
  101. * @throws Exception
  102. */
  103. public PageData findByUN(PageData pd)throws Exception{
  104. return (PageData)dao.findForObject("UserMapper.findByUN", pd);
  105. }
  106. /**通过id获取数据
  107. * @param pd
  108. * @return
  109. * @throws Exception
  110. */
  111. public PageData findById(PageData pd)throws Exception{
  112. return (PageData)dao.findForObject("UserMapper.findById", pd);
  113. }
  114. /**保存用户
  115. * @param pd
  116. * @throws Exception
  117. */
  118. public void saveU(PageData pd)throws Exception{
  119. dao.save("UserMapper.saveU", pd);
  120. }
  121. /**修改用户
  122. * @param pd
  123. * @throws Exception
  124. */
  125. public void editU(PageData pd)throws Exception{
  126. dao.update("UserMapper.editU", pd);
  127. }
  128. /**删除用户
  129. * @param pd
  130. * @throws Exception
  131. */
  132. public void deleteU(PageData pd)throws Exception{
  133. dao.delete("UserMapper.deleteU", pd);
  134. }
  135. /**批量删除用户
  136. * @param USER_IDS
  137. * @throws Exception
  138. */
  139. public void deleteAllU(String[] USER_IDS)throws Exception{
  140. dao.delete("UserMapper.deleteAllU", USER_IDS);
  141. }
  142. /**用户列表(全部)
  143. * @param USER_IDS
  144. * @throws Exception
  145. */
  146. @SuppressWarnings("unchecked")
  147. public List<PageData> listAllUser(PageData pd)throws Exception{
  148. return (List<PageData>) dao.findForList("UserMapper.listAllUser", pd);
  149. }
  150. /**获取总数
  151. * @param pd
  152. * @throws Exception
  153. */
  154. public PageData getUserCount(String value)throws Exception{
  155. return (PageData)dao.findForObject("UserMapper.getUserCount", value);
  156. }
  157. /**公司列表(全部)
  158. * @param
  159. * @throws Exception
  160. */
  161. @SuppressWarnings("unchecked")
  162. public List<String> listAllCompany() throws Exception {
  163. // TODO Auto-generated method stub
  164. return (List<String>) dao.findForList("UserMapper.listAllCompany", "");
  165. }
  166. /**获取该公司所有路段
  167. * @param company
  168. * @throws Exception
  169. */
  170. @SuppressWarnings("unchecked")
  171. public List<String> getAllRoadName(String company) throws Exception {
  172. // TODO Auto-generated method stub
  173. return (List<String>) dao.findForList("UserMapper.getAllRoadName", company);
  174. }
  175. @Override
  176. public void insertAPIUser(PageData pd) throws Exception {
  177. dao.save("UserMapper.insertAPIUser", pd);
  178. }
  179. @Override
  180. public void deleteAPIUser(PageData pd) throws Exception {
  181. dao.delete("UserMapper.deleteAPIUser", pd);
  182. }
  183. @Override
  184. public void editAPIUser(PageData pd) throws Exception {
  185. dao.update("UserMapper.editAPIUser", pd);
  186. }
  187. }