Sfoglia il codice sorgente

资源,专利,论文

XMTT 7 anni fa
parent
commit
f1b1970ebc

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

51
    @From(Article.class)
51
    @From(Article.class)
52
    int[] updateStatus(Connection con,@Batch String[] articleId,@Set String status) throws SQLException;
52
    int[] updateStatus(Connection con,@Batch String[] articleId,@Set String status) throws SQLException;
53
53
54
    @UpdateWith
55
    @From(Article.class)
56
    int updateStatus(Connection con,String articleId,@Set String status) throws SQLException;
57
54
    @UpdateWith
58
    @UpdateWith
55
    @From(Article.class)
59
    @From(Article.class)
56
    int updateSortNum(Connection con, String articleId, @Set long sortNum) throws SQLException;
60
    int updateSortNum(Connection con, String articleId, @Set long sortNum) throws SQLException;

+ 11 - 4
src/main/java/com/ekexiu/console/system/dao/PpaperDao.java

8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
9
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
9
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
10
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
10
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
11
import org.jfw.apt.orm.annotation.dao.param.Alias;
12
import org.jfw.apt.orm.annotation.dao.param.GtEq;
13
import org.jfw.apt.orm.annotation.dao.param.Like;
14
import org.jfw.apt.orm.annotation.dao.param.LtEq;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
12
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
13
import org.jfw.apt.orm.annotation.dao.param.*;
15
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
14
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
16
import org.jfw.util.PageQueryResult;
15
import org.jfw.util.PageQueryResult;
17
16
24
@DAO
23
@DAO
25
public interface PpaperDao {
24
public interface PpaperDao {
26
25
26
    @Nullable
27
    @SelectOne
28
    Ppaper query(Connection con, String id) throws SQLException;
29
27
    @Nullable
30
    @Nullable
28
    @QueryVal
31
    @QueryVal
29
    @Column(handlerClass = StringHandler.class, value = "name")
32
    @Column(handlerClass = StringHandler.class, value = "name")
37
    @PageQuery
40
    @PageQuery
38
    @OrderBy(" ORDER BY page_views DESC NULLS LAST")
41
    @OrderBy(" ORDER BY page_views DESC NULLS LAST")
39
    PageQueryResult<Ppaper> queryByPV(Connection con, @Nullable @Like String name,@Nullable @Like String authors, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
42
    PageQueryResult<Ppaper> queryByPV(Connection con, @Nullable @Like String name,@Nullable @Like String authors, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
43
44
    @UpdateWith
45
    @From(Ppaper.class)
46
    int updateSortNum(Connection con, String id, @Set long sortNum) throws SQLException;
40
}
47
}

+ 12 - 4
src/main/java/com/ekexiu/console/system/dao/PpatentDao.java

8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
9
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
9
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
10
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
10
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
11
import org.jfw.apt.orm.annotation.dao.param.Alias;
12
import org.jfw.apt.orm.annotation.dao.param.GtEq;
13
import org.jfw.apt.orm.annotation.dao.param.Like;
14
import org.jfw.apt.orm.annotation.dao.param.LtEq;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
12
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
13
import org.jfw.apt.orm.annotation.dao.param.*;
15
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
14
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
16
import org.jfw.util.PageQueryResult;
15
import org.jfw.util.PageQueryResult;
17
16
23
 */
22
 */
24
@DAO
23
@DAO
25
public interface PpatentDao {
24
public interface PpatentDao {
25
26
    @Nullable
27
    @SelectOne
28
    Ppatent query(Connection con, String id) throws SQLException;
29
26
    @Nullable
30
    @Nullable
27
    @QueryVal
31
    @QueryVal
28
    @Column(handlerClass = StringHandler.class, value = "name")
32
    @Column(handlerClass = StringHandler.class, value = "name")
37
    @OrderBy(" ORDER BY page_views DESC NULLS LAST")
41
    @OrderBy(" ORDER BY page_views DESC NULLS LAST")
38
    PageQueryResult<Ppatent> queryByPV(Connection con, @Nullable @Like String name,@Nullable @Like String authors, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
42
    PageQueryResult<Ppatent> queryByPV(Connection con, @Nullable @Like String name,@Nullable @Like String authors, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
39
43
44
    @UpdateWith
45
    @From(Ppatent.class)
46
    int updateSortNum(Connection con, String id, @Set long sortNum) throws SQLException;
47
40
}
48
}

+ 21 - 0
src/main/java/com/ekexiu/console/system/dao/ResourceDao.java

3
import com.ekexiu.console.system.po.Resource;
3
import com.ekexiu.console.system.po.Resource;
4
import com.ekexiu.console.system.pojo.ResourceInfo;
4
import com.ekexiu.console.system.pojo.ResourceInfo;
5
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.annotation.Nullable;
6
import org.jfw.apt.orm.annotation.dao.Batch;
6
import org.jfw.apt.orm.annotation.dao.Column;
7
import org.jfw.apt.orm.annotation.dao.Column;
7
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.From;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
11
import org.jfw.apt.orm.annotation.dao.method.Where;
11
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
12
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
12
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
13
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
15
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
13
import org.jfw.apt.orm.annotation.dao.param.*;
16
import org.jfw.apt.orm.annotation.dao.param.*;
14
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
17
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
15
import org.jfw.util.PageQueryResult;
18
import org.jfw.util.PageQueryResult;
22
 */
25
 */
23
@DAO
26
@DAO
24
public interface ResourceDao {
27
public interface ResourceDao {
28
29
    @Nullable
30
    @SelectOne
31
    Resource query(Connection con, String resourceId) throws SQLException;
32
25
    @Nullable
33
    @Nullable
26
    @QueryVal
34
    @QueryVal
27
    @Column(handlerClass = StringHandler.class, value = "resource_name")
35
    @Column(handlerClass = StringHandler.class, value = "resource_name")
37
    @OrderBy(" ORDER BY page_views DESC NULLS LAST")
45
    @OrderBy(" ORDER BY page_views DESC NULLS LAST")
38
    @Where("status='1'")
46
    @Where("status='1'")
39
    PageQueryResult<ResourceInfo> queryByPV(Connection con, @Nullable @Like String resourceName,@SqlColumn(value = {"(p.name is null or p.name like ?)", "(o.name is null or o.name like ?)"}, handlerClass = StringHandler.class) String name, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
47
    PageQueryResult<ResourceInfo> queryByPV(Connection con, @Nullable @Like String resourceName,@SqlColumn(value = {"(p.name is null or p.name like ?)", "(o.name is null or o.name like ?)"}, handlerClass = StringHandler.class) String name, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
48
49
    @Batch
50
    @UpdateWith
51
    @From(Resource.class)
52
    int[] updateStatus(Connection con,@Batch String[] resourceId,@Set String status) throws SQLException;
53
54
    @UpdateWith
55
    @From(Resource.class)
56
    int updateStatus(Connection con,String resourceId,@Set String status) throws SQLException;
57
58
    @UpdateWith
59
    @From(Resource.class)
60
    int updateSortNum(Connection con, String resourceId, @Set long sortNum) throws SQLException;
40
}
61
}

+ 9 - 0
src/main/java/com/ekexiu/console/system/po/Resource.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.defaultImpl.StringHandler;
11
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
11
import org.jfw.apt.orm.core.enums.DE;
12
import org.jfw.apt.orm.core.enums.DE;
12
13
72
    private String orgId;
73
    private String orgId;
73
74
74
    private long shareId;
75
    private long shareId;
76
    private long sortNum;
75
77
76
    @Column(DE.id_32)
78
    @Column(DE.id_32)
77
    public String getResourceId() {
79
    public String getResourceId() {
246
        this.shareId = shareId;
248
        this.shareId = shareId;
247
    }
249
    }
248
250
251
    @Column(handlerClass=LongHandler.class,dbType="BIGINT",fixSqlValueWithInsert="0",insertable=true,renewable=false,nullable=false,queryable=true)
252
    public long getSortNum() {
253
        return sortNum;
254
    }
249
255
256
    public void setSortNum(long sortNum) {
257
        this.sortNum = sortNum;
258
    }
250
}
259
}

+ 62 - 0
src/main/java/com/ekexiu/console/system/service/PaperService.java

1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.PpaperDao;
4
import com.ekexiu.console.system.po.Ppaper;
5
import com.ekexiu.console.system.po.Ppatent;
6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.annotation.DefaultValue;
8
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.web.annotation.Path;
10
import org.jfw.apt.web.annotation.operate.Get;
11
import org.jfw.apt.web.annotation.operate.Post;
12
import org.jfw.apt.web.annotation.param.JdbcConn;
13
import org.jfw.apt.web.annotation.param.PathVar;
14
import org.jfw.util.PageQueryResult;
15
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
19
/**
20
 * Created by TT on 2017/8/9.
21
 */
22
@Path("/paper")
23
public class PaperService {
24
25
    @Autowrie
26
    private PpaperDao ppaperDao;
27
28
    public PpaperDao getPpaperDao() {
29
        return ppaperDao;
30
    }
31
32
    public void setPpaperDao(PpaperDao ppaperDao) {
33
        this.ppaperDao = ppaperDao;
34
    }
35
36
    @Path("/pq")
37
    @Get
38
    public PageQueryResult<Ppaper> pageQueryResult(@JdbcConn Connection con, @Nullable String title, @Nullable String name, int orderBy, @Nullable String bt, @Nullable String et, @DefaultValue("1") int pageNo, @DefaultValue("10") int pageSize)throws SQLException {
39
        if (orderBy == 1) {
40
            return this.ppaperDao.queryByTime(con, title == null ? null : "%" + title + "%",  name == null ? "%" : "%" + name + "%", bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
41
        }
42
        if (orderBy == 2) {
43
            return this.ppaperDao.queryByPV(con, title == null ? null : "%" + title + "%",  name == null ? "%" : "%" + name + "%", bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
44
        }
45
        return null;
46
    }
47
48
    @Post
49
    @Path("/sortNum")
50
    public void updateSortNum(@JdbcConn(true) Connection con,String id,long sortNum) throws SQLException{
51
        this.ppaperDao.updateSortNum(con, id, sortNum);
52
    }
53
54
    @Get
55
    @Path("/id/{id}")
56
    public Ppaper query(@JdbcConn Connection con, @PathVar String id) throws SQLException {
57
        return this.ppaperDao.query(con, id);
58
    }
59
60
61
62
}

+ 58 - 0
src/main/java/com/ekexiu/console/system/service/PatentService.java

1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.PpatentDao;
4
import com.ekexiu.console.system.po.Ppatent;
5
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.annotation.DefaultValue;
7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Get;
10
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.PathVar;
13
import org.jfw.util.PageQueryResult;
14
15
import java.sql.Connection;
16
import java.sql.SQLException;
17
18
/**
19
 * Created by TT on 2017/8/9.
20
 */
21
@Path("/patent")
22
public class PatentService {
23
24
    @Autowrie
25
    private PpatentDao ppatentDao;
26
27
    public PpatentDao getPpatentDao() {
28
        return ppatentDao;
29
    }
30
31
    public void setPpatentDao(PpatentDao ppatentDao) {
32
        this.ppatentDao = ppatentDao;
33
    }
34
35
    @Path("/pq")
36
    @Get
37
    public PageQueryResult<Ppatent> pageQueryResult(@JdbcConn Connection con, @Nullable String title, @Nullable String name, int orderBy, @Nullable String bt, @Nullable String et, @DefaultValue("1") int pageNo, @DefaultValue("10") int pageSize)throws SQLException {
38
        if (orderBy == 1) {
39
            return this.ppatentDao.queryByTime(con, title == null ? null : "%" + title + "%",  name == null ? "%" : "%" + name + "%", bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
40
        }
41
        if (orderBy == 2) {
42
            return this.ppatentDao.queryByPV(con, title == null ? null : "%" + title + "%",  name == null ? "%" : "%" + name + "%", bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
43
        }
44
        return null;
45
    }
46
47
    @Post
48
    @Path("/sortNum")
49
    public void updateSortNum(@JdbcConn(true) Connection con,String id,long sortNum) throws SQLException{
50
        this.ppatentDao.updateSortNum(con, id, sortNum);
51
    }
52
53
    @Get
54
    @Path("/id/{id}")
55
    public Ppatent query(@JdbcConn Connection con, @PathVar String id) throws SQLException {
56
        return this.ppatentDao.query(con, id);
57
    }
58
}

+ 65 - 0
src/main/java/com/ekexiu/console/system/service/ResourceService.java

1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.ResourceDao;
4
import com.ekexiu.console.system.po.Resource;
5
import com.ekexiu.console.system.pojo.ResourceInfo;
6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.annotation.DefaultValue;
8
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.web.annotation.Path;
10
import org.jfw.apt.web.annotation.operate.Get;
11
import org.jfw.apt.web.annotation.operate.Post;
12
import org.jfw.apt.web.annotation.param.JdbcConn;
13
import org.jfw.apt.web.annotation.param.PathVar;
14
import org.jfw.util.PageQueryResult;
15
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
19
/**
20
 * Created by TT on 2017/8/9.
21
 */
22
@Path("/resource")
23
public class ResourceService {
24
    @Autowrie
25
    private ResourceDao resourceDao;
26
27
    public ResourceDao getResourceDao() {
28
        return resourceDao;
29
    }
30
31
    public void setResourceDao(ResourceDao resourceDao) {
32
        this.resourceDao = resourceDao;
33
    }
34
35
    @Path("/pq")
36
    @Get
37
    public PageQueryResult<ResourceInfo> pageQueryResult(@JdbcConn Connection con, @Nullable String title, @Nullable String name, int orderBy, @Nullable String bt, @Nullable String et, @DefaultValue("1") int pageNo, @DefaultValue("10") int pageSize)throws SQLException {
38
        if (orderBy == 1) {
39
            return this.resourceDao.queryByTime(con, title == null ? null : "%" + title + "%",  name == null ? "%" : "%" + name + "%", bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
40
        }
41
        if (orderBy == 2) {
42
            return this.resourceDao.queryByPV(con, title == null ? null : "%" + title + "%",  name == null ? "%" : "%" + name + "%", bt == null ? null : bt + "000000", et == null ? null : et + "235959", pageSize, pageNo);
43
        }
44
        return null;
45
    }
46
47
    @Post
48
    @Path("/deleteResource")
49
    public void deleteResource(@JdbcConn(true) Connection con, String[] articleIds) throws SQLException {
50
        //修改文章状态为删除
51
        this.resourceDao.updateStatus(con, articleIds, "3");
52
    }
53
54
    @Post
55
    @Path("/sortNum")
56
    public void updateSortNum(@JdbcConn(true) Connection con,String articleId,long sortNum) throws SQLException{
57
        this.resourceDao.updateSortNum(con, articleId, sortNum);
58
    }
59
60
    @Get
61
    @Path("/id/{id}")
62
    public Resource query(@JdbcConn Connection con, @PathVar String id) throws SQLException {
63
        return this.resourceDao.query(con, id);
64
    }
65
}

+ 4 - 1
src/main/resources/database.sql

56
-----begin version 1.9.1------------------------
56
-----begin version 1.9.1------------------------
57
57
58
ALTER TABLE article ADD COLUMN sort_num  int8 default 0 not null;
58
ALTER TABLE article ADD COLUMN sort_num  int8 default 0 not null;
59
COMMENT ON COLUMN article.sort_num IS '排序字段,人工权重';
59
COMMENT ON COLUMN article.sort_num IS '排序字段,人工权重';
60
61
ALTER TABLE resource ADD COLUMN sort_num  int8 default 0 not null;
62
COMMENT ON COLUMN resource.sort_num IS '排序字段,人工权重';