XMTT 6 jaren geleden
bovenliggende
commit
4e602f89d1

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

@ -6,6 +6,7 @@ import org.jfw.apt.orm.annotation.dao.DAO;
6 6
import org.jfw.apt.orm.annotation.dao.method.From;
7 7
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8 8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
9 10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
10 11
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
11 12
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
@ -28,6 +29,10 @@ public interface StorageDao {
28 29
    @SetSentence("active = '0'")
29 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 36
    @PageSelect
32 37
    @OrderBy("ORDER BY CREATE_TIME DESC")
33 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,6 +51,14 @@ public class StorageService {
51 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 62
    @Post
55 63
    @Path
56 64
    public String insert(@JdbcConn(true) Connection con, @LoginUser SessionUser user, @Upload UploadItemIterator it) throws Exception {
@ -117,14 +125,29 @@ public class StorageService {
117 125
        return id;
118 126
    }
119 127
128
    /**
129
     * 文件删除
130
     * @param con
131
     * @param id
132
     * @throws SQLException
133
     */
120 134
    @Get
121 135
    @Path("/delete")
122 136
    @LoginUser
123 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 151
    @Path("/pq")
129 152
    @Get
130 153
    @LoginUser

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

@ -52,6 +52,15 @@ public class SysService {
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 64
    @SetSession("JFW_SESSION_LOGIN_USER=result")
56 65
    @Path("/login")
57 66
    @Post
@ -88,18 +97,33 @@ public class SysService {
88 97
        return null;
89 98
    }
90 99
100
    /**
101
     * 当前登录用户信息
102
     * @param user
103
     * @return
104
     */
91 105
    @Get
92 106
    @Path("/user")
93 107
    public SessionUser get(@LoginUser SessionUser user) {
94 108
        return user;
95 109
    }
96 110
111
    /**
112
     * 用户退出登录
113
     */
97 114
    @Get
98 115
    @Path("/logout")
99 116
    @InvalidSession
100 117
    public void logout() {
101 118
    }
102 119
120
    /**
121
     * 新增用户
122
     * @param con
123
     * @param user
124
     * @return
125
     * @throws SQLException
126
     */
103 127
    @Post
104 128
    @Path("/insert")
105 129
    @LoginUser
@ -112,6 +136,13 @@ public class SysService {
112 136
        return id;
113 137
    }
114 138
139
    /**
140
     * 账户检查是否可用
141
     * @param con
142
     * @param account
143
     * @return
144
     * @throws SQLException
145
     */
115 146
    @Get
116 147
    @Path("/check")
117 148
    public int check(@JdbcConn Connection con, String account)throws SQLException {
@ -125,6 +156,13 @@ public class SysService {
125 156
        }
126 157
    }
127 158
159
    /**
160
     * 查询单个用户信息
161
     * @param con
162
     * @param id
163
     * @return
164
     * @throws SQLException
165
     */
128 166
    @Get
129 167
    @Path("/qo")
130 168
    @LoginUser
@ -132,6 +170,12 @@ public class SysService {
132 170
        return this.userDao.query(con, id);
133 171
    }
134 172
173
    /**
174
     * 用户信息更新
175
     * @param con
176
     * @param user
177
     * @throws SQLException
178
     */
135 179
    @Post
136 180
    @Path("/update")
137 181
    @LoginUser
@ -139,6 +183,12 @@ public class SysService {
139 183
        this.userDao.update(con, user);
140 184
    }
141 185
186
    /**
187
     * 禁用用户
188
     * @param con
189
     * @param id
190
     * @throws SQLException
191
     */
142 192
    @Get
143 193
    @Path("/ban")
144 194
    @LoginUser
@ -146,6 +196,12 @@ public class SysService {
146 196
        this.userDao.ban(con, id);
147 197
    }
148 198
199
    /**
200
     * 重新激活用户
201
     * @param con
202
     * @param id
203
     * @throws SQLException
204
     */
149 205
    @Get
150 206
    @Path("/active")
151 207
    @LoginUser
@ -153,6 +209,15 @@ public class SysService {
153 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 221
    @Get
157 222
    @Path("/pq")
158 223
    @LoginUser
@ -160,12 +225,26 @@ public class SysService {
160 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 236
    @Post
164 237
    @Path("/changePw")
165 238
    public void changePw(@JdbcConn(true) Connection con, @LoginUser SessionUser u, String newPw) throws SQLException, JfwBaseException {
166 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 248
    @Get
170 249
    @Path("/resetPw")
171 250
    @LoginUser