XMTT 6 years ago
parent
commit
4e602f89d1

+ 5 - 0
src/main/java/com/ekexiu/project/storage/resource/dao/StorageDao.java

6
import org.jfw.apt.orm.annotation.dao.method.From;
6
import org.jfw.apt.orm.annotation.dao.method.From;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
9
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
10
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
11
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
11
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
12
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
28
    @SetSentence("active = '0'")
29
    @SetSentence("active = '0'")
29
    int logicDelete(Connection con, String id) throws SQLException;
30
    int logicDelete(Connection con, String id) throws SQLException;
30
31
32
    @DeleteWith
33
    @From(Storage.class)
34
    int delete(Connection con, String id) throws SQLException;
35
31
    @PageSelect
36
    @PageSelect
32
    @OrderBy("ORDER BY CREATE_TIME DESC")
37
    @OrderBy("ORDER BY CREATE_TIME DESC")
33
     PageQueryResult<Storage> pageQuery(Connection con, @Nullable Boolean active, int pageSize, int pageNo) throws SQLException;
38
     PageQueryResult<Storage> pageQuery(Connection con, @Nullable Boolean active, int pageSize, int pageNo) throws SQLException;

+ 24 - 1
src/main/java/com/ekexiu/project/storage/resource/service/StorageService.java

51
        this.filePath = filePath;
51
        this.filePath = filePath;
52
    }
52
    }
53
53
54
    /**
55
     * 文件上传
56
     * @param con
57
     * @param user
58
     * @param it
59
     * @return
60
     * @throws Exception
61
     */
54
    @Post
62
    @Post
55
    @Path
63
    @Path
56
    public String insert(@JdbcConn(true) Connection con, @LoginUser SessionUser user, @Upload UploadItemIterator it) throws Exception {
64
    public String insert(@JdbcConn(true) Connection con, @LoginUser SessionUser user, @Upload UploadItemIterator it) throws Exception {
117
        return id;
125
        return id;
118
    }
126
    }
119
127
128
    /**
129
     * 文件删除
130
     * @param con
131
     * @param id
132
     * @throws SQLException
133
     */
120
    @Get
134
    @Get
121
    @Path("/delete")
135
    @Path("/delete")
122
    @LoginUser
136
    @LoginUser
123
    public void logicDelete(@JdbcConn(true) Connection con, String id) throws SQLException {
137
    public void logicDelete(@JdbcConn(true) Connection con, String id) throws SQLException {
124
        this.storageDao.logicDelete(con, id);
138
        this.storageDao.delete(con, id);
125
    }
139
    }
126
140
127
141
142
    /**
143
     * 文件分页查询
144
     * @param con
145
     * @param active
146
     * @param pageSize
147
     * @param pageNo
148
     * @return
149
     * @throws SQLException
150
     */
128
    @Path("/pq")
151
    @Path("/pq")
129
    @Get
152
    @Get
130
    @LoginUser
153
    @LoginUser

+ 79 - 0
src/main/java/com/ekexiu/project/storage/system/service/SysService.java

52
    }
52
    }
53
53
54
54
55
    /**
56
     * 用户登录
57
     * @param con
58
     * @param account
59
     * @param pw
60
     * @return
61
     * @throws SQLException
62
     * @throws JfwBaseException
63
     */
55
    @SetSession("JFW_SESSION_LOGIN_USER=result")
64
    @SetSession("JFW_SESSION_LOGIN_USER=result")
56
    @Path("/login")
65
    @Path("/login")
57
    @Post
66
    @Post
88
        return null;
97
        return null;
89
    }
98
    }
90
99
100
    /**
101
     * 当前登录用户信息
102
     * @param user
103
     * @return
104
     */
91
    @Get
105
    @Get
92
    @Path("/user")
106
    @Path("/user")
93
    public SessionUser get(@LoginUser SessionUser user) {
107
    public SessionUser get(@LoginUser SessionUser user) {
94
        return user;
108
        return user;
95
    }
109
    }
96
110
111
    /**
112
     * 用户退出登录
113
     */
97
    @Get
114
    @Get
98
    @Path("/logout")
115
    @Path("/logout")
99
    @InvalidSession
116
    @InvalidSession
100
    public void logout() {
117
    public void logout() {
101
    }
118
    }
102
119
120
    /**
121
     * 新增用户
122
     * @param con
123
     * @param user
124
     * @return
125
     * @throws SQLException
126
     */
103
    @Post
127
    @Post
104
    @Path("/insert")
128
    @Path("/insert")
105
    @LoginUser
129
    @LoginUser
112
        return id;
136
        return id;
113
    }
137
    }
114
138
139
    /**
140
     * 账户检查是否可用
141
     * @param con
142
     * @param account
143
     * @return
144
     * @throws SQLException
145
     */
115
    @Get
146
    @Get
116
    @Path("/check")
147
    @Path("/check")
117
    public int check(@JdbcConn Connection con, String account)throws SQLException {
148
    public int check(@JdbcConn Connection con, String account)throws SQLException {
125
        }
156
        }
126
    }
157
    }
127
158
159
    /**
160
     * 查询单个用户信息
161
     * @param con
162
     * @param id
163
     * @return
164
     * @throws SQLException
165
     */
128
    @Get
166
    @Get
129
    @Path("/qo")
167
    @Path("/qo")
130
    @LoginUser
168
    @LoginUser
132
        return this.userDao.query(con, id);
170
        return this.userDao.query(con, id);
133
    }
171
    }
134
172
173
    /**
174
     * 用户信息更新
175
     * @param con
176
     * @param user
177
     * @throws SQLException
178
     */
135
    @Post
179
    @Post
136
    @Path("/update")
180
    @Path("/update")
137
    @LoginUser
181
    @LoginUser
139
        this.userDao.update(con, user);
183
        this.userDao.update(con, user);
140
    }
184
    }
141
185
186
    /**
187
     * 禁用用户
188
     * @param con
189
     * @param id
190
     * @throws SQLException
191
     */
142
    @Get
192
    @Get
143
    @Path("/ban")
193
    @Path("/ban")
144
    @LoginUser
194
    @LoginUser
146
        this.userDao.ban(con, id);
196
        this.userDao.ban(con, id);
147
    }
197
    }
148
198
199
    /**
200
     * 重新激活用户
201
     * @param con
202
     * @param id
203
     * @throws SQLException
204
     */
149
    @Get
205
    @Get
150
    @Path("/active")
206
    @Path("/active")
151
    @LoginUser
207
    @LoginUser
153
        this.userDao.active(con, id);
209
        this.userDao.active(con, id);
154
    }
210
    }
155
211
212
    /**
213
     * 用户列表分页查询
214
     * @param con
215
     * @param active
216
     * @param pageSize
217
     * @param pageNo
218
     * @return
219
     * @throws SQLException
220
     */
156
    @Get
221
    @Get
157
    @Path("/pq")
222
    @Path("/pq")
158
    @LoginUser
223
    @LoginUser
160
        return this.userDao.pageQuery(con, active, pageSize, pageNo);
225
        return this.userDao.pageQuery(con, active, pageSize, pageNo);
161
    }
226
    }
162
227
228
    /**
229
     * 用户修改密码
230
     * @param con
231
     * @param u
232
     * @param newPw
233
     * @throws SQLException
234
     * @throws JfwBaseException
235
     */
163
    @Post
236
    @Post
164
    @Path("/changePw")
237
    @Path("/changePw")
165
    public void changePw(@JdbcConn(true) Connection con, @LoginUser SessionUser u, String newPw) throws SQLException, JfwBaseException {
238
    public void changePw(@JdbcConn(true) Connection con, @LoginUser SessionUser u, String newPw) throws SQLException, JfwBaseException {
166
        this.userDao.changePw(con, StringUtil.md5(newPw), u.getId());
239
        this.userDao.changePw(con, StringUtil.md5(newPw), u.getId());
167
    }
240
    }
168
241
242
    /**
243
     * 用户重置密码
244
     * @param con
245
     * @param id
246
     * @throws SQLException
247
     */
169
    @Get
248
    @Get
170
    @Path("/resetPw")
249
    @Path("/resetPw")
171
    @LoginUser
250
    @LoginUser