jiapeng 6 gadi atpakaļ
vecāks
revīzija
54452abf65

+ 10 - 1
src/main/java/com/ekexiu/project/bridge/system/dao/BridgeDao.java

5
import org.jfw.apt.orm.annotation.dao.DAO;
5
import org.jfw.apt.orm.annotation.dao.DAO;
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.IncludeFixSet;
7
import org.jfw.apt.orm.annotation.dao.method.IncludeFixSet;
8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
9
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
14
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
15
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
15
import org.jfw.apt.orm.annotation.dao.param.Like;
16
import org.jfw.apt.orm.annotation.dao.param.Like;
16
import org.jfw.apt.orm.annotation.dao.param.Set;
17
import org.jfw.apt.orm.annotation.dao.param.Set;
18
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
19
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
17
import org.jfw.util.PageQueryResult;
20
import org.jfw.util.PageQueryResult;
18
21
19
import java.sql.Connection;
22
import java.sql.Connection;
30
33
31
    @UpdateWith
34
    @UpdateWith
32
    @From(Bridge.class)
35
    @From(Bridge.class)
33
    @SetSentence("active = false")
36
    @SetSentence("active = '0'")
34
    @IncludeFixSet("modifyTime")
37
    @IncludeFixSet("modifyTime")
35
    int logicDelete(Connection con, @Set String modifier, String id) throws SQLException;
38
    int logicDelete(Connection con, @Set String modifier, String id) throws SQLException;
36
39
42
    Bridge query(Connection con, String id) throws SQLException;
45
    Bridge query(Connection con, String id) throws SQLException;
43
46
44
    @PageSelect
47
    @PageSelect
48
    @OrderBy("ORDER BY CODE")
45
    @Where("active = '1'")
49
    @Where("active = '1'")
46
    PageQueryResult<Bridge> pageQuery(Connection con, @Nullable @Like String name, @Nullable String code, int pageSize, int pageNo) throws SQLException;
50
    PageQueryResult<Bridge> pageQuery(Connection con, @Nullable @Like String name, @Nullable String code, int pageSize, int pageNo) throws SQLException;
51
    
52
    @PageSelect
53
    @OrderBy("ORDER BY CODE")
54
    PageQueryResult<Bridge> pageQuery(Connection con,@Nullable Boolean active,@SqlColumn(handlerClass = StringHandler.class,value="ID IN(SELECT BCODE FROM USER_BRIDGE WHERE UID=?)") String uid, int pageSize, int pageNo) throws SQLException;
55
    
47
56
48
}
57
}

+ 1 - 1
src/main/java/com/ekexiu/project/bridge/system/dao/UserDao.java

52
52
53
    @PageSelect
53
    @PageSelect
54
    @Where("active = '1'")
54
    @Where("active = '1'")
55
    PageQueryResult<User> pageQuery(Connection con, @Nullable @Like String account, @Nullable @Like String name, @Nullable @Like String comp, int pageSize, int pageNo) throws SQLException;
55
    PageQueryResult<User> pageQuery(Connection con, @Nullable String account, @Nullable @Like String name, @Nullable @Like String comp, int pageSize, int pageNo) throws SQLException;
56
56
57
    @UpdateWith
57
    @UpdateWith
58
    @From(User.class)
58
    @From(User.class)

+ 27 - 6
src/main/java/com/ekexiu/project/bridge/system/service/SysService.java

12
import com.ekexiu.project.bridge.system.po.User;
12
import com.ekexiu.project.bridge.system.po.User;
13
import com.ekexiu.project.bridge.system.vo.SessionUser;
13
import com.ekexiu.project.bridge.system.vo.SessionUser;
14
import org.jfw.apt.annotation.Autowrie;
14
import org.jfw.apt.annotation.Autowrie;
15
import org.jfw.apt.annotation.DefaultValue;
15
import org.jfw.apt.annotation.Nullable;
16
import org.jfw.apt.annotation.Nullable;
16
import org.jfw.apt.web.annotation.LoginUser;
17
import org.jfw.apt.web.annotation.LoginUser;
17
import org.jfw.apt.web.annotation.Path;
18
import org.jfw.apt.web.annotation.Path;
20
import org.jfw.apt.web.annotation.operate.Get;
21
import org.jfw.apt.web.annotation.operate.Get;
21
import org.jfw.apt.web.annotation.operate.Post;
22
import org.jfw.apt.web.annotation.operate.Post;
22
import org.jfw.apt.web.annotation.param.JdbcConn;
23
import org.jfw.apt.web.annotation.param.JdbcConn;
24
import org.jfw.apt.web.annotation.param.SessionVal;
23
import org.jfw.apt.web.annotation.param.Upload;
25
import org.jfw.apt.web.annotation.param.Upload;
24
import org.jfw.util.PageQueryResult;
26
import org.jfw.util.PageQueryResult;
25
import org.jfw.util.StringUtil;
27
import org.jfw.util.StringUtil;
160
    @SetSession("JFW_SESSION_LOGIN_USER=result")
162
    @SetSession("JFW_SESSION_LOGIN_USER=result")
161
    @Path("/user/login")
163
    @Path("/user/login")
162
    @Post
164
    @Post
163
    public SessionUser login(@JdbcConn Connection con, String account, String pw) throws SQLException {
164
        User user = userDao.login(con, account, StringUtil.md5(pw));
165
    public SessionUser login(@JdbcConn Connection con, String account, String pw,String vc,@Nullable @SessionVal("PIC_LOGIN") String code,@DefaultValue("0") @SessionVal("TIMEOUT_PIC_LOGIN") long timeout) throws SQLException {
166
       if(code ==null){
167
    	   return null;
168
       }
169
       if(!vc.equals(code)){
170
    	   return null;
171
       }
172
       if(System.currentTimeMillis()>timeout){
173
    	   return null;
174
       }
175
    	User user = userDao.login(con, account, StringUtil.md5(pw));
165
        if (user != null) {
176
        if (user != null) {
166
            return makeSessionUser(user);
177
            return makeSessionUser(user);
167
        }
178
        }
214
    @Get
225
    @Get
215
    @Path("/user/pq")
226
    @Path("/user/pq")
216
    public PageQueryResult<SessionUser> pageQuery(@JdbcConn Connection con, @Nullable String account, @Nullable String name, @Nullable String comp, int pageSize, int pageNo) throws SQLException {
227
    public PageQueryResult<SessionUser> pageQuery(@JdbcConn Connection con, @Nullable String account, @Nullable String name, @Nullable String comp, int pageSize, int pageNo) throws SQLException {
217
        PageQueryResult<User> pageQueryResult = this.userDao.pageQuery(con, account == null ? null : "%" + account + "%", name == null ? null : "%" + name + "%", comp == null ? null : "%" + comp + "%", pageSize, pageNo);
228
        PageQueryResult<User> pageQueryResult = this.userDao.pageQuery(con, account, name == null ? null : "%" + name + "%", comp == null ? null : "%" + comp + "%", pageSize, pageNo);
218
        List<User> users = pageQueryResult.getData();
229
        List<User> users = pageQueryResult.getData();
219
        List<SessionUser> sessionUsers = new ArrayList<>();
230
        List<SessionUser> sessionUsers = new ArrayList<>();
220
        if (!users.isEmpty()) {
231
        if (!users.isEmpty()) {
221
            for (User user : users) {
232
            for (User user : users) {
222
                sessionUsers.add(makeSessionUser(user));
233
                sessionUsers.add(makeSessionUser(user));
223
            }
234
            }
224
            PageQueryResult<SessionUser> pageQueryResult1 = new PageQueryResult<>();
225
            pageQueryResult1.setData(sessionUsers);
226
            return pageQueryResult1;
235
            PageQueryResult<SessionUser> ret = new PageQueryResult<>();
236
            ret.setPageNo(pageQueryResult.getPageNo());
237
            ret.setPageSize(pageQueryResult.getPageSize());
238
            ret.setTotal(pageQueryResult.getTotal());
239
            
240
            ret.setData(sessionUsers);
241
            return ret;
227
        }
242
        }
228
        return null;
243
        return null;
229
    }
244
    }
257
        return id;
272
        return id;
258
    }
273
    }
259
274
275
    @Get
276
    @Path("/bridge/byUser")
277
    public PageQueryResult<Bridge> query(@JdbcConn Connection con,String uid,@Nullable Boolean active,int pageSize,int pageNo)throws SQLException{
278
    	return this.bridgeDao.pageQuery(con, active, uid, pageSize, pageNo);
279
    }
280
    
260
    @Get
281
    @Get
261
    @Path("/bridge/qo")
282
    @Path("/bridge/qo")
262
    public Bridge queryBridge(@JdbcConn Connection con, String id) throws SQLException {
283
    public Bridge queryBridge(@JdbcConn Connection con, String id) throws SQLException {