Parcourir la Source

--add operation manager interface

jiapeng 8 ans auparavant
Parent
commit
f123a7c5c9

+ 40 - 0
src/main/java/com/ekexiu/operation/service/StatistService.java

1
package com.ekexiu.operation.service;
2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.HashMap;
6
import java.util.Map;
7

8
import org.jfw.apt.annotation.Autowrie;
9
import org.jfw.apt.web.annotation.Path;
10
import org.jfw.apt.web.annotation.operate.Get;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.util.jdbc.JdbcUtil;
13

14
import com.ekexiu.portal.dao.UserDao;
15

16
@Path("/operation/statist")
17
public class StatistService {
18

19
	@Autowrie
20
	private UserDao userDao;
21

22
	public UserDao getUserDao() {
23
		return userDao;
24
	}
25

26
	public void setUserDao(UserDao userDao) {
27
		this.userDao = userDao;
28
	}
29
	
30
	@Get
31
	@Path("/user")
32
	public Map<String,Object> user(@JdbcConn Connection con)throws SQLException{
33
		Map<String,Object> map = new HashMap<String,Object>();
34
		map.put("all",this.userDao.countAll(con));
35
		map.put("actived", this.userDao.countActived(con));
36
		map.put("byRole",JdbcUtil.queryMaps(con, "select authentication code,count(1) num from professor group by code"));
37
		map.put("byType",JdbcUtil.queryMaps(con, "select auth_type code,count(1) num from professor group by code"));
38
		return map;		
39
	}
40
}

+ 17 - 1
src/main/java/com/ekexiu/portal/dao/AuthApplyDao.java

9
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.annotation.Nullable;
10
import org.jfw.apt.orm.annotation.dao.DAO;
10
import org.jfw.apt.orm.annotation.dao.DAO;
11
import org.jfw.apt.orm.annotation.dao.method.From;
11
import org.jfw.apt.orm.annotation.dao.method.From;
12
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
12
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
14
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
15
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
16
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
17
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
15
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
18
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
16
import org.jfw.apt.orm.annotation.dao.param.Set;
19
import org.jfw.apt.orm.annotation.dao.param.Set;
20
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
21
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
17

22

18
import com.ekexiu.portal.po.AuthApply;
23
import com.ekexiu.portal.po.AuthApply;
24
import com.ekexiu.portal.pojo.AuthApplyInfo;
19

25

20
@DAO
26
@DAO
21
public abstract class AuthApplyDao {
27
public abstract class AuthApplyDao {
24
	
30
	
25
	@UpdateWith
31
	@UpdateWith
26
	@From(AuthApply.class)
32
	@From(AuthApply.class)
27
	public abstract int updateSolveStatus(Connection con, @Set Integer solveStatus) throws SQLException;
33
	public abstract int updateSolveStatus(Connection con, @Set Integer solveStatus,String authApplyId) throws SQLException;
28
	
34
	
29
	@Nullable
35
	@Nullable
30
	@SelectOne
36
	@SelectOne
59
	
65
	
60
	@SelectList
66
	@SelectList
61
	public abstract List<AuthApply> query(Connection con) throws SQLException;
67
	public abstract List<AuthApply> query(Connection con) throws SQLException;
68

69
	@QueryList
70
	@OrderBy("ORDER BY a.CREATE_TIME")
71
	public abstract List<AuthApplyInfo> queryInfo(Connection con) throws SQLException;
72
	
73
	@QueryOne
74
	@Nullable
75
	public abstract AuthApplyInfo queryInfo(Connection con,String authApplyId) throws SQLException;
76
	
77

62
}
78
}

+ 19 - 0
src/main/java/com/ekexiu/portal/dao/UserDao.java

3
import java.sql.Connection;
3
import java.sql.Connection;
4
import java.sql.SQLException;
4
import java.sql.SQLException;
5
5
6
import org.jfw.apt.annotation.DefaultValue;
6
import org.jfw.apt.annotation.Nullable;
7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.orm.annotation.dao.Column;
7
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.DAO;
10
import org.jfw.apt.orm.annotation.dao.method.BySQL;
8
import org.jfw.apt.orm.annotation.dao.method.From;
11
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.Or;
12
import org.jfw.apt.orm.annotation.dao.method.Or;
13
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
14
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
11
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
15
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
16
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
17
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
13
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
18
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
14
import org.jfw.apt.orm.annotation.dao.param.Alias;
19
import org.jfw.apt.orm.annotation.dao.param.Alias;
15
import org.jfw.apt.orm.annotation.dao.param.Set;
20
import org.jfw.apt.orm.annotation.dao.param.Set;
21
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
16
22
17
import com.ekexiu.portal.po.User;
23
import com.ekexiu.portal.po.User;
18
24
58
	@UpdateWith
64
	@UpdateWith
59
	@From(User.class)
65
	@From(User.class)
60
	int updatePasswordWithMobileOrEmail(Connection con,@Set String passwd,@Alias({"email","mobilePhone"})  String key)throws SQLException;
66
	int updatePasswordWithMobileOrEmail(Connection con,@Set String passwd,@Alias({"email","mobilePhone"})  String key)throws SQLException;
67
	
68
	@QueryVal
69
	@Column(handlerClass=IntHandler.class, value = { "COUNT(1)" })
70
	@From(User.class)
71
	@DefaultValue("0")
72
	int countAll(Connection con)throws SQLException;
73
	
74
	@QueryVal
75
	@Column(handlerClass=IntHandler.class, value = { "COUNT(1)" })
76
	@From(User.class)
77
	@DefaultValue("0")
78
	@Where("PASSWD<>'11111111111111111111111111111111'")
79
	int countActived(Connection con)throws SQLException;
61
}
80
}

+ 55 - 0
src/main/java/com/ekexiu/portal/pojo/AuthApplyInfo.java

1
package com.ekexiu.portal.pojo;
2

3
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
6

7
import com.ekexiu.portal.po.AuthApply;
8

9
@ExtendView(fromSentence="auth_apply a INNER JOIN professor p on a.professor_id = p.id INNER JOIN organization o on p.org_id = o.id",tableAlias="a")
10
public class AuthApplyInfo extends AuthApply {
11
	//p.name,o.name orgName,p.office,p.title,p.authentication
12
	private String name;
13
	private String orgName;
14
	private String office;
15
	private String title;
16
	private String authentication;
17
	
18
	@CalcColumn(handlerClass=StringHandler.class,column="p.name")
19
	public String getName() {
20
		return name;
21
	}
22
	public void setName(String name) {
23
		this.name = name;
24
	}
25
	@CalcColumn(handlerClass=StringHandler.class,column="o.name")
26
	public String getOrgName() {
27
		return orgName;
28
	}
29
	public void setOrgName(String orgName) {
30
		this.orgName = orgName;
31
	}
32
	@CalcColumn(handlerClass=StringHandler.class,column="p.office")
33
	public String getOffice() {
34
		return office;
35
	}
36
	public void setOffice(String office) {
37
		this.office = office;
38
	}
39
	@CalcColumn(handlerClass=StringHandler.class,column="p.title")
40
	public String getTitle() {
41
		return title;
42
	}
43
	public void setTitle(String title) {
44
		this.title = title;
45
	}
46
	@CalcColumn(handlerClass=StringHandler.class,column="p.authentication")
47
	public String getAuthentication() {
48
		return authentication;
49
	}
50
	public void setAuthentication(String authentication) {
51
		this.authentication = authentication;
52
	}
53
	
54
	
55
}

+ 20 - 0
src/main/java/com/ekexiu/portal/service/AuthApplyService.java

2

2

3
import java.sql.Connection;
3
import java.sql.Connection;
4
import java.sql.SQLException;
4
import java.sql.SQLException;
5
import java.util.List;
5

6

6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.web.annotation.Path;
8
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Get;
8
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.operate.Post;
9
import org.jfw.apt.web.annotation.param.JdbcConn;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.apt.web.annotation.param.PathVar;
10
import org.jfw.util.StringUtil;
13
import org.jfw.util.StringUtil;
11

14

12
import com.ekexiu.portal.dao.AuthApplyDao;
15
import com.ekexiu.portal.dao.AuthApplyDao;
13
import com.ekexiu.portal.dao.ProfessorDao;
16
import com.ekexiu.portal.dao.ProfessorDao;
14
import com.ekexiu.portal.po.AuthApply;
17
import com.ekexiu.portal.po.AuthApply;
18
import com.ekexiu.portal.pojo.AuthApplyInfo;
15

19

16
@Path("/authApply")
20
@Path("/authApply")
17
public class AuthApplyService {
21
public class AuthApplyService {
55
		return authApplyId;
59
		return authApplyId;
56
	}
60
	}
57
	
61
	
62
	@Post
63
	@Path("/state")
64
	public void updateState(@JdbcConn(true) Connection con,String id,Integer state)throws SQLException{
65
		this.authApplyDao.updateSolveStatus(con,state,id);
66
	}
67
	
68
	@Get
69
	@Path()
70
	public List<AuthApplyInfo> query(@JdbcConn Connection con) throws SQLException{
71
		return this.authApplyDao.queryInfo(con);
72
	}
73
	@Get
74
	@Path("/{id}")
75
	public AuthApplyInfo query(@JdbcConn Connection con,@PathVar String id) throws SQLException{
76
		return this.authApplyDao.queryInfo(con, id);
77
	}
58
}
78
}