XMTT 7 anos atrás
pai
commit
6e7bd82f5d

+ 9 - 0
src/main/java/com/ekexiu/console/system/dao/ArticleDao.java

10
import org.jfw.apt.orm.annotation.dao.method.Where;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
11
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
11
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
12
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
12
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
13
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
14
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
14
import org.jfw.apt.orm.annotation.dao.param.*;
15
import org.jfw.apt.orm.annotation.dao.param.*;
15
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
16
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
24
@DAO
25
@DAO
25
public interface ArticleDao {
26
public interface ArticleDao {
26
27
28
    @Nullable
29
    @SelectOne
30
    Article query(Connection con, String articleId) throws SQLException;
31
27
    @Nullable
32
    @Nullable
28
    @QueryVal
33
    @QueryVal
29
    @Column(handlerClass = StringHandler.class, value = "article_title")
34
    @Column(handlerClass = StringHandler.class, value = "article_title")
43
    @UpdateWith
48
    @UpdateWith
44
    @From(Article.class)
49
    @From(Article.class)
45
    int updateStatus(Connection con,String articleId,@Set String status) throws SQLException;
50
    int updateStatus(Connection con,String articleId,@Set String status) throws SQLException;
51
52
    @UpdateWith
53
    @From(Article.class)
54
    int updateSortNum(Connection con, String articleId, @Set long sortNum) throws SQLException;
46
}
55
}

+ 9 - 0
src/main/java/com/ekexiu/console/system/po/Article.java

7
import org.jfw.apt.orm.annotation.entry.Table;
7
import org.jfw.apt.orm.annotation.entry.Table;
8
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
8
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
9
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
9
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
10
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
10
import org.jfw.apt.orm.core.enums.DE;
11
import org.jfw.apt.orm.core.enums.DE;
11
12
12
/**
13
/**
31
    private int pageViews;
32
    private int pageViews;
32
    private String status;
33
    private String status;
33
    private long shareId;
34
    private long shareId;
35
    private long sortNum;
34
36
35
    @Column(DE.id_32)
37
    @Column(DE.id_32)
36
    public String getArticleId() {
38
    public String getArticleId() {
143
        this.shareId = shareId;
145
        this.shareId = shareId;
144
    }
146
    }
145
147
148
    @Column(handlerClass=LongHandler.class,dbType="BIGINT",fixSqlValueWithInsert="0",insertable=true,renewable=false,nullable=false,queryable=true)
149
    public long getSortNum() {
150
        return sortNum;
151
    }
146
152
153
    public void setSortNum(long sortNum) {
154
        this.sortNum = sortNum;
155
    }
147
}
156
}
148
157

+ 14 - 0
src/main/java/com/ekexiu/console/system/service/ArticleService.java

1
package com.ekexiu.console.system.service;
1
package com.ekexiu.console.system.service;
2
2
3
import com.ekexiu.console.system.dao.ArticleDao;
3
import com.ekexiu.console.system.dao.ArticleDao;
4
import com.ekexiu.console.system.po.Article;
4
import com.ekexiu.console.system.pojo.ArticleInfo;
5
import com.ekexiu.console.system.pojo.ArticleInfo;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.annotation.DefaultValue;
7
import org.jfw.apt.annotation.DefaultValue;
9
import org.jfw.apt.web.annotation.operate.Get;
10
import org.jfw.apt.web.annotation.operate.Get;
10
import org.jfw.apt.web.annotation.operate.Post;
11
import org.jfw.apt.web.annotation.operate.Post;
11
import org.jfw.apt.web.annotation.param.JdbcConn;
12
import org.jfw.apt.web.annotation.param.JdbcConn;
13
import org.jfw.apt.web.annotation.param.PathVar;
12
import org.jfw.util.PageQueryResult;
14
import org.jfw.util.PageQueryResult;
13
15
14
import java.sql.Connection;
16
import java.sql.Connection;
48
        //修改文章状态为删除
50
        //修改文章状态为删除
49
        this.articleDao.updateStatus(con, articleId, "3");
51
        this.articleDao.updateStatus(con, articleId, "3");
50
    }
52
    }
53
54
    @Post
55
    @Path("/sortNum")
56
    public void updateSortNum(@JdbcConn(true) Connection con,String articleId,long sortNum) throws SQLException{
57
        this.articleDao.updateSortNum(con, articleId, sortNum);
58
    }
59
60
    @Get
61
    @Path("/id/{id}")
62
    public Article query(@JdbcConn Connection con, @PathVar String id) throws SQLException {
63
        return this.articleDao.query(con, id);
64
    }
51
}
65
}

+ 49 - 0
src/main/java/com/ekexiu/console/system/service/ProfessorService.java

1
package com.ekexiu.console.system.service;
1
package com.ekexiu.console.system.service;
2
2
3
import com.ekexiu.console.system.dao.LuserDao;
3
import com.ekexiu.console.system.dao.OrgDao;
4
import com.ekexiu.console.system.dao.OrgDao;
4
import com.ekexiu.console.system.dao.ProfessorDao;
5
import com.ekexiu.console.system.dao.ProfessorDao;
6
import com.ekexiu.console.system.po.Luser;
5
import com.ekexiu.console.system.po.Professor;
7
import com.ekexiu.console.system.po.Professor;
6
import com.ekexiu.console.system.pojo.ProfessorInfo;
8
import com.ekexiu.console.system.pojo.ProfessorInfo;
7
import com.ekexiu.console.system.pojo.UserDetail;
9
import com.ekexiu.console.system.pojo.UserDetail;
17
import org.jfw.apt.web.annotation.param.JdbcConn;
19
import org.jfw.apt.web.annotation.param.JdbcConn;
18
import org.jfw.apt.web.annotation.param.PathVar;
20
import org.jfw.apt.web.annotation.param.PathVar;
19
import org.jfw.apt.web.annotation.param.RequestBody;
21
import org.jfw.apt.web.annotation.param.RequestBody;
22
import org.jfw.util.DateUtil;
20
import org.jfw.util.PageQueryResult;
23
import org.jfw.util.PageQueryResult;
21
import org.jfw.util.StringUtil;
24
import org.jfw.util.StringUtil;
22
25
23
import java.io.IOException;
26
import java.io.IOException;
24
import java.sql.Connection;
27
import java.sql.Connection;
25
import java.sql.SQLException;
28
import java.sql.SQLException;
29
import java.util.Random;
26
30
27
/**
31
/**
28
 * Created by TT on 2017/5/25.
32
 * Created by TT on 2017/5/25.
30
@Path("/sys/professor")
34
@Path("/sys/professor")
31
public class ProfessorService {
35
public class ProfessorService {
32
36
37
    public static final String DEFAULT_PASS_WORD = "11111111111111111111111111111111";
38
33
    @Autowrie
39
    @Autowrie
34
    private ProfessorDao professorDao;
40
    private ProfessorDao professorDao;
35
    @Autowrie
41
    @Autowrie
36
    private OrgDao orgDao;
42
    private OrgDao orgDao;
37
    @Autowrie
43
    @Autowrie
38
    private OrgService orgService;
44
    private OrgService orgService;
45
    @Autowrie
46
    private LuserDao luserDao;
39
47
40
    public OrgService getOrgService() {
48
    public OrgService getOrgService() {
41
        return orgService;
49
        return orgService;
61
        this.professorDao = professorDao;
69
        this.professorDao = professorDao;
62
    }
70
    }
63
71
72
    public LuserDao getLuserDao() {
73
        return luserDao;
74
    }
75
76
    public void setLuserDao(LuserDao luserDao) {
77
        this.luserDao = luserDao;
78
    }
79
64
    @Post
80
    @Post
65
    @Path
81
    @Path
66
    public String insert(@JdbcConn(true) Connection con, Professor professor, @Nullable String orgName)
82
    public String insert(@JdbcConn(true) Connection con, Professor professor, @Nullable String orgName)
160
    public void updateBusinessData(@JdbcConn(true) Connection con,String id,@Nullable int authentication,@Nullable int authStatus,@Nullable int authStatusExpert,int sortFirst)throws SQLException{
176
    public void updateBusinessData(@JdbcConn(true) Connection con,String id,@Nullable int authentication,@Nullable int authStatus,@Nullable int authStatusExpert,int sortFirst)throws SQLException{
161
        this.professorDao.updateBusinessData(con, id, authentication, authStatus, authStatusExpert, sortFirst);
177
        this.professorDao.updateBusinessData(con, id, authentication, authStatus, authStatusExpert, sortFirst);
162
    }
178
    }
179
180
    @Post
181
    @Path("/createAccount")
182
    public void insert(@JdbcConn(true) Connection con,String name, @Nullable String mobile,@Nullable String email)throws SQLException {
183
184
        String id = StringUtil.buildUUID();
185
        Luser luser = new Luser();
186
        luser.setId(id);
187
        luser.setEmail(email);
188
        Random rd = new Random();
189
        int code = rd.nextInt(1000000);
190
        String inviteCode = String.format("%06d", code);
191
        luser.setInviteCode(inviteCode);
192
        luser.setMobilePhone(mobile);
193
        luser.setPasswd(DEFAULT_PASS_WORD);
194
        luser.setUserType("0");
195
        luser.setCreateTime(DateUtil.formatDateTime(System.currentTimeMillis()));
196
        this.luserDao.insert(con, luser);
197
198
        Professor professor = new Professor();
199
        professor.setId(id);
200
        professor.setName(name);
201
        professor.setEmail(email);
202
        professor.setPhone(mobile);
203
        professor.setAuthType(1);
204
        professor.setAuthStatus(0);
205
        professor.setAuthStatusExpert(0);
206
        professor.setSortFirst(0);
207
        professor.setProfessorState(0);
208
        this.professorDao.insert(con, professor);
209
210
211
    }
163
}
212
}