XMTT 6 lat temu
rodzic
commit
ca5b67164d

+ 17 - 17
src/main/java/com/ekexiu/project/platform/system/dao/UserDao.java

46
46
47
    @Nullable
47
    @Nullable
48
    @SelectOne
48
    @SelectOne
49
    User queryByLoginPhone(Connection con, String loginPhone, Boolean active) throws SQLException;
49
    User queryByLoginPhone(Connection con, String loginPhone, Boolean actived) throws SQLException;
50
50
51
    @Nullable
51
    @Nullable
52
    @SelectOne
52
    @SelectOne
63
    int updateLoginLog(Connection con, String id, @Set String lastLoginTime) throws SQLException;
63
    int updateLoginLog(Connection con, String id, @Set String lastLoginTime) throws SQLException;
64
64
65
    @Update
65
    @Update
66
    @Exclude({"passwd", "active", "loginPhone"})
66
    @Exclude({"passwd", "actived", "loginPhone"})
67
    int update(Connection con, User user) throws SQLException;
67
    int update(Connection con, User user) throws SQLException;
68
68
69
    @UpdateWith
69
    @UpdateWith
76
76
77
    @UpdateWith
77
    @UpdateWith
78
    @From(User.class)
78
    @From(User.class)
79
    @Where("ACTIVE = '1'")
80
    @SetSentence("ACTIVE = '0'")
79
    @Where("ACTIVED = '1'")
80
    @SetSentence("ACTIVED = '0'")
81
    int invalid(Connection con, String id) throws SQLException;
81
    int invalid(Connection con, String id) throws SQLException;
82
82
83
    @UpdateWith
83
    @UpdateWith
84
    @From(User.class)
84
    @From(User.class)
85
    @Where("ACTIVE = '0'")
86
    @SetSentence("ACTIVE = '1'")
85
    @Where("ACTIVED = '0'")
86
    @SetSentence("ACTIVED = '1'")
87
    int valid(Connection con, String id) throws SQLException;
87
    int valid(Connection con, String id) throws SQLException;
88
88
89
    @Insert
89
    @Insert
94
    int validUser(Connection con, String id) throws SQLException;
94
    int validUser(Connection con, String id) throws SQLException;
95
95
96
    @PageSelect
96
    @PageSelect
97
    @Where("ACTIVE ='1'")
97
    @Where("ACTIVED ='1'")
98
    @OrderBy("ORDER BY CREATE_TIME DESC")
98
    @OrderBy("ORDER BY CREATE_TIME DESC")
99
    PageQueryResult<User> pageQuery(Connection con, @GroupSqlColumn(handlerClass = StringHandler.class, value = {"ACCOUNT LIKE ?", "LOGIN_PHONE LIKE ?"}, isAnd = false) @Nullable String key, int pageSize, int pageNo) throws SQLException;
99
    PageQueryResult<User> pageQuery(Connection con, @GroupSqlColumn(handlerClass = StringHandler.class, value = {"ACCOUNT LIKE ?", "LOGIN_PHONE LIKE ?"}, isAnd = false) @Nullable String key, int pageSize, int pageNo) throws SQLException;
100
100
101
    @PageSelect
101
    @PageSelect
102
    @OrderBy("ORDER BY INVALID_TIME DESC")
102
    @OrderBy("ORDER BY INVALID_TIME DESC")
103
    PageQueryResult<InvalidUser> pageQueryInvalidUser(Connection con,@GroupSqlColumn(handlerClass = StringHandler.class, value = {"ACCOUNT LIKE ?", "LOGIN_PHONE LIKE ?"}, isAnd = false) @Nullable String key, int pageSize, int pageNo) throws SQLException;
103
    PageQueryResult<InvalidUser> pageQueryInvalidUser(Connection con, @GroupSqlColumn(handlerClass = StringHandler.class, value = {"ACCOUNT LIKE ?", "LOGIN_PHONE LIKE ?"}, isAnd = false) @Nullable String key, int pageSize, int pageNo) throws SQLException;
104
104
105
    @Nullable
105
    @Nullable
106
    @SelectOne
106
    @SelectOne
122
122
123
123
124
    @Update
124
    @Update
125
    @Where("ACTIVE ='1'")
125
    @Where("ACTIVED ='1'")
126
    @IncludeFixSet
126
    @IncludeFixSet
127
    @Exclude(value = {"invalidTime", "invalidOperator", "passwd", "active"})
127
    @Exclude(value = {"invalidTime", "invalidOperator", "passwd", "actived"})
128
    int update(Connection con, Manager user) throws SQLException;
128
    int update(Connection con, Manager user) throws SQLException;
129
129
130
    @UpdateWith
130
    @UpdateWith
131
    @From(Manager.class)
131
    @From(Manager.class)
132
    @Where("ACTIVE ='1'")
133
    @SetSentence("ACTIVE='0',INVALID_TIME=TO_CHAR(NOW(),'YYYYMMDDHH24MISS')")
132
    @Where("ACTIVED ='1'")
133
    @SetSentence("ACTIVED ='0',INVALID_TIME=TO_CHAR(NOW(),'YYYYMMDDHH24MISS')")
134
    int disable(Connection con, String id, @Set String invalidOperator) throws SQLException;
134
    int disable(Connection con, String id, @Set String invalidOperator) throws SQLException;
135
135
136
    @UpdateWith
136
    @UpdateWith
137
    @From(Manager.class)
137
    @From(Manager.class)
138
    @Where("ACTIVE ='0'")
139
    @SetSentence("ACTIVE='1'")
138
    @Where("ACTIVED ='0'")
139
    @SetSentence("ACTIVED ='1'")
140
    int enable(Connection con, String id) throws SQLException;
140
    int enable(Connection con, String id) throws SQLException;
141
141
142
    @Nullable
142
    @Nullable
152
152
153
    @Nullable
153
    @Nullable
154
    @SelectOne
154
    @SelectOne
155
    Manager queryManagerByLoginPhone(Connection con, String account,@Nullable Boolean actived) throws SQLException;
155
    Manager queryManagerByLoginPhone(Connection con, String account) throws SQLException;
156
156
157
    @UpdateWith
157
    @UpdateWith
158
    @From(Manager.class)
158
    @From(Manager.class)
159
    int changeManagerPasswd(Connection con, String id,@Set String passwd) throws SQLException;
159
    int changeManagerPasswd(Connection con, String id, @Set String passwd) throws SQLException;
160
160
161
    @UpdateWith
161
    @UpdateWith
162
    @From(Manager.class)
162
    @From(Manager.class)
165
    @PageQuery
165
    @PageQuery
166
    @From(Manager.class)
166
    @From(Manager.class)
167
    @OrderBy("ORDER BY CREATE_TIME DESC")
167
    @OrderBy("ORDER BY CREATE_TIME DESC")
168
    PageQueryResult<ManagerInfo> managerPageQuery(Connection con,@UnEquals String id, boolean actived, int pageSize, int pageNo) throws SQLException;
168
    PageQueryResult<ManagerInfo> managerPageQuery(Connection con, @UnEquals String id, boolean actived, int pageSize, int pageNo) throws SQLException;
169
169
170
    @Nullable
170
    @Nullable
171
    @QueryOne
171
    @QueryOne

+ 3 - 0
src/main/java/com/ekexiu/project/platform/system/po/Manager.java

3
import org.jfw.apt.orm.annotation.entry.Column;
3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.annotation.entry.Unique;
7
import org.jfw.apt.orm.annotation.entry.Uniques;
6
import org.jfw.apt.orm.core.enums.DE;
8
import org.jfw.apt.orm.core.enums.DE;
7

9

8
import com.ekexiu.project.platform.base.po.ManagedBaseTable;
10
import com.ekexiu.project.platform.base.po.ManagedBaseTable;
9

11

10
@PrimaryKey("id")
12
@PrimaryKey("id")
13
@Uniques(@Unique(clolumns = "account",name = "account_unique"))
11
@Table(descp = "后台管理用户表")
14
@Table(descp = "后台管理用户表")
12
public class Manager implements ManagedBaseTable {
15
public class Manager implements ManagedBaseTable {
13
    private String id;
16
    private String id;

+ 5 - 5
src/main/java/com/ekexiu/project/platform/system/po/User.java

28
    private String linkPhone;
28
    private String linkPhone;
29
    private String email;
29
    private String email;
30
    private String passwd;
30
    private String passwd;
31
    private boolean active;
31
    private boolean actived;
32
    private String addr;
32
    private String addr;
33
    private String head;
33
    private String head;
34

34

35

35

36
    @Column(descp = "是否可用", value = DE.boolean_de)
36
    @Column(descp = "是否可用", value = DE.boolean_de)
37
    public boolean isActive() {
38
        return active;
37
    public boolean isActived() {
38
        return actived;
39
    }
39
    }
40

40

41
    public void setActive(boolean active) {
42
        this.active = active;
41
    public void setActived(boolean actived) {
42
        this.actived = actived;
43
    }
43
    }
44

44

45
    @Column(descp = "密码(MD5)", queryable = false, handlerClass = StringHandler.class, dbType = "TEXT")
45
    @Column(descp = "密码(MD5)", queryable = false, handlerClass = StringHandler.class, dbType = "TEXT")

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

71
    @LoginUser
71
    @LoginUser
72
    @Get
72
    @Get
73
    @Path("/exists")
73
    @Path("/exists")
74
    public boolean existsManager(@JdbcConn Connection con, String account, @Nullable Boolean active) throws SQLException {
75
        return null != userDao.queryManagerByLoginPhone(con, account, active);
74
    public boolean existsManager(@JdbcConn Connection con, String account) throws SQLException {
75
        return null != userDao.queryManagerByLoginPhone(con, account);
76
    }
76
    }
77
77
78
    @Get
78
    @Get
124
124
125
    @Get
125
    @Get
126
    @Path("/pq")
126
    @Path("/pq")
127
    public PageQueryResult<SessionManager> managerPageQuery(@JdbcConn Connection con,@LoginUser SessionManager user, boolean active, int pageSize, int pageNo) throws SQLException {
128
        PageQueryResult<ManagerInfo> pageQueryResult = userDao.managerPageQuery(con,user.getId(), active, pageSize, pageNo);
127
    public PageQueryResult<SessionManager> managerPageQuery(@JdbcConn Connection con,@LoginUser SessionManager user, boolean actived, int pageSize, int pageNo) throws SQLException {
128
        PageQueryResult<ManagerInfo> pageQueryResult = userDao.managerPageQuery(con,user.getId(), actived, pageSize, pageNo);
129
        List<ManagerInfo> managers = pageQueryResult.getData();
129
        List<ManagerInfo> managers = pageQueryResult.getData();
130
        List<SessionManager> sessionManagers = new ArrayList<>();
130
        List<SessionManager> sessionManagers = new ArrayList<>();
131
        if (!managers.isEmpty()) {
131
        if (!managers.isEmpty()) {
154
154
155
    @Path("/new")
155
    @Path("/new")
156
    @Post
156
    @Post
157
    public String addUser(@JdbcConn(true) Connection con, @LoginUser SessionManager au, @RequestParam(excludeFields = {"id", "acitve", "createor"}) Manager user, String[] rightCode) throws SQLException {
157
    public String addUser(@JdbcConn(true) Connection con, @LoginUser SessionManager au, @RequestParam(excludeFields = {"id", "acitved", "createor"}) Manager user, String[] rightCode) throws SQLException {
158
        String id = StringUtil.buildUUID();
158
        String id = StringUtil.buildUUID();
159
        user.setActived(true);
159
        user.setActived(true);
160
        user.setCreator(au.getId());
160
        user.setCreator(au.getId());
330
        sessionUser.setId(user.getId());
330
        sessionUser.setId(user.getId());
331
        sessionUser.setJob(user.getJob());
331
        sessionUser.setJob(user.getJob());
332
        sessionUser.setName(user.getName());
332
        sessionUser.setName(user.getName());
333
        sessionUser.setActive(user.isActive());
333
        sessionUser.setActived(user.isActived());
334
        sessionUser.setAddr(user.getAccount());
334
        sessionUser.setAddr(user.getAccount());
335
        sessionUser.setCreateTime(user.getCreateTime());
335
        sessionUser.setCreateTime(user.getCreateTime());
336
        sessionUser.setHead(user.getHead());
336
        sessionUser.setHead(user.getHead());

+ 5 - 5
src/main/java/com/ekexiu/project/platform/system/vo/SessionUser.java

20
	private String linkPhone;
20
	private String linkPhone;
21
	private String addr;
21
	private String addr;
22
	private String head;
22
	private String head;
23
    private boolean active;
23
    private boolean actived;
24
	public String getId() {
24
	public String getId() {
25
		return id;
25
		return id;
26
	}
26
	}
99
	public void setHead(String head) {
99
	public void setHead(String head) {
100
		this.head = head;
100
		this.head = head;
101
	}
101
	}
102
	public boolean isActive() {
103
		return active;
102
	public boolean isActived() {
103
		return actived;
104
	}
104
	}
105
	public void setActive(boolean active) {
106
		this.active = active;
105
	public void setActived(boolean actived) {
106
		this.actived = actived;
107
	}
107
	}
108
	@Override
108
	@Override
109
	public boolean hasAuthority(int auth) {
109
	public boolean hasAuthority(int auth) {

+ 2 - 0
src/main/resources/database.sql

351
351
352
INSERT INTO "public"."manager" ("id", "account", "passwd", "name", "phone", "email", "job", "dep", "comp", "actived", "invalid_time", "invalid_operator","create_time","creator","modify_time","modifier") VALUES ('4733F3525B4E40719242AB154932CAA5', '18888888888', 'E10ADC3949BA59ABBE56E057F20F883E', 'admin', '18888888888', 'admin@ekexiu.com', '11', '11', '11', '1','','', '20180718091626', '4733F3525B4E40719242AB154932CAA5','20180718091626', '4733F3525B4E40719242AB154932CAA5');
352
INSERT INTO "public"."manager" ("id", "account", "passwd", "name", "phone", "email", "job", "dep", "comp", "actived", "invalid_time", "invalid_operator","create_time","creator","modify_time","modifier") VALUES ('4733F3525B4E40719242AB154932CAA5', '18888888888', 'E10ADC3949BA59ABBE56E057F20F883E', 'admin', '18888888888', 'admin@ekexiu.com', '11', '11', '11', '1','','', '20180718091626', '4733F3525B4E40719242AB154932CAA5','20180718091626', '4733F3525B4E40719242AB154932CAA5');
353
353
354
ALTER TABLE MANAGER ADD UNIQUE (ACCOUNT);
355