Blame view

src/com/fh/service/system/user/impl/UserService.java 3.89 KB
ad5081d3   孙向锦   初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  package com.fh.service.system.user.impl;
  
  import java.util.List;
  
  import javax.annotation.Resource;
  
  import org.springframework.stereotype.Service;
  
  import com.fh.dao.DaoSupport;
  import com.fh.entity.Page;
  import com.fh.entity.system.User;
  import com.fh.service.system.user.UserManager;
  import com.fh.util.PageData;
  
  
ad5081d3   孙向锦   初始化项目
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
  @Service("userService")
  public class UserService implements UserManager{
  
  	@Resource(name = "daoSupport")
  	private DaoSupport dao;
  	
  	/**登录判断
  	 * @param pd
  	 * @return
  	 * @throws Exception
  	 */
  	public PageData getUserByNameAndPwd(PageData pd)throws Exception{
  		return (PageData)dao.findForObject("UserMapper.getUserInfo", pd);
  	}
  	
  	/**更新登录时间
  	 * @param pd
  	 * @throws Exception
  	 */
  	public void updateLastLogin(PageData pd)throws Exception{
  		dao.update("UserMapper.updateLastLogin", pd);
  	}
  	
  	/**通过用户ID获取用户信息和角色信息
  	 * @param USER_ID
  	 * @return
  	 * @throws Exception
  	 */
  	public User getUserAndRoleById(String USER_ID) throws Exception {
  		return (User) dao.findForObject("UserMapper.getUserAndRoleById", USER_ID);
  	}
  	
  	/**通过USERNAEME获取数据
  	 * @param pd
  	 * @return
  	 * @throws Exception
  	 */
  	public PageData findByUsername(PageData pd)throws Exception{
  		return (PageData)dao.findForObject("UserMapper.findByUsername", pd);
  	}
  	
  	/**列出某角色下的所有用户
  	 * @param pd
  	 * @return
  	 * @throws Exception
  	 */
  	@SuppressWarnings("unchecked")
  	public List<PageData> listAllUserByRoldId(PageData pd) throws Exception {
  		return (List<PageData>) dao.findForList("UserMapper.listAllUserByRoldId", pd);
  		
  	}
  	
  	/**保存用户IP
  	 * @param pd
  	 * @throws Exception
  	 */
  	public void saveIP(PageData pd)throws Exception{
  		dao.update("UserMapper.saveIP", pd);
  	}
  	
  	/**用户列表
  	 * @param page
  	 * @return
  	 * @throws Exception
  	 */
  	@SuppressWarnings("unchecked")
  	public List<PageData> listUsers(Page page)throws Exception{
  		return (List<PageData>) dao.findForList("UserMapper.userlistPage", page);
  	}
  	
  	/**用户列表(弹窗选择用)
  	 * @param page
  	 * @return
  	 * @throws Exception
  	 */
  	@SuppressWarnings("unchecked")
  	public List<PageData> listUsersBystaff(Page page)throws Exception{
  		return (List<PageData>) dao.findForList("UserMapper.userBystafflistPage", page);
  	}
  	
  	/**通过邮箱获取数据
  	 * @param pd
  	 * @return
  	 * @throws Exception
  	 */
  	public PageData findByUE(PageData pd)throws Exception{
  		return (PageData)dao.findForObject("UserMapper.findByUE", pd);
  	}
  	
  	/**通过编号获取数据
  	 * @param pd
  	 * @return
  	 * @throws Exception
  	 */
  	public PageData findByUN(PageData pd)throws Exception{
  		return (PageData)dao.findForObject("UserMapper.findByUN", pd);
  	}
  	
  	/**通过id获取数据
  	 * @param pd
  	 * @return
  	 * @throws Exception
  	 */
  	public PageData findById(PageData pd)throws Exception{
  		return (PageData)dao.findForObject("UserMapper.findById", pd);
  	}
  	
  	/**保存用户
  	 * @param pd
  	 * @throws Exception
  	 */
  	public void saveU(PageData pd)throws Exception{
  		dao.save("UserMapper.saveU", pd);
  	}
  	 
  	/**修改用户
  	 * @param pd
  	 * @throws Exception
  	 */
  	public void editU(PageData pd)throws Exception{
  		dao.update("UserMapper.editU", pd);
  	}
  	
  	/**删除用户
  	 * @param pd
  	 * @throws Exception
  	 */
  	public void deleteU(PageData pd)throws Exception{
  		dao.delete("UserMapper.deleteU", pd);
  	}
  	
  	/**批量删除用户
  	 * @param USER_IDS
  	 * @throws Exception
  	 */
  	public void deleteAllU(String[] USER_IDS)throws Exception{
  		dao.delete("UserMapper.deleteAllU", USER_IDS);
  	}
  	
  	/**用户列表(全部)
  	 * @param USER_IDS
  	 * @throws Exception
  	 */
  	@SuppressWarnings("unchecked")
  	public List<PageData> listAllUser(PageData pd)throws Exception{
  		return (List<PageData>) dao.findForList("UserMapper.listAllUser", pd);
  	}
  	
  	/**获取总数
  	 * @param pd
  	 * @throws Exception
  	 */
  	public PageData getUserCount(String value)throws Exception{
  		return (PageData)dao.findForObject("UserMapper.getUserCount", value);
  	}
  	
  }