portal web service

ResearchResultDao.java 3.8KB

    package com.ekexiu.portal.resResult; import org.jfw.apt.annotation.DefaultValue; import org.jfw.apt.annotation.Nullable; import org.jfw.apt.orm.annotation.dao.Column; import org.jfw.apt.orm.annotation.dao.DAO; import org.jfw.apt.orm.annotation.dao.method.Exclude; import org.jfw.apt.orm.annotation.dao.method.From; import org.jfw.apt.orm.annotation.dao.method.OrderBy; import org.jfw.apt.orm.annotation.dao.method.SetSentence; import org.jfw.apt.orm.annotation.dao.method.Where; import org.jfw.apt.orm.annotation.dao.method.operator.Insert; import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery; import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal; import org.jfw.apt.orm.annotation.dao.method.operator.SelectList; import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne; import org.jfw.apt.orm.annotation.dao.method.operator.Update; import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith; import org.jfw.apt.orm.annotation.dao.param.GroupSqlColumn; import org.jfw.apt.orm.annotation.dao.param.In; import org.jfw.apt.orm.annotation.dao.param.SqlColumn; import org.jfw.apt.orm.core.defaultImpl.LongHandler; import org.jfw.apt.orm.core.defaultImpl.StringHandler; import org.jfw.util.PageQueryResult; import java.sql.Connection; import java.sql.SQLException; import java.util.List; /** * Created by TT on 2019/07/10. */ @DAO public interface ResearchResultDao { @Insert int insert(Connection con, ResearchResult researchResult) throws SQLException; @Update @Exclude("modifyTime") int update(Connection con, ResearchResult researchResult) throws SQLException; @Nullable @SelectOne ResearchResult query(Connection con, String id) throws SQLException; @UpdateWith @From(ResearchResult.class) @Where("STATUS ='1'") @SetSentence("STATUS ='0'") int updateStatus(Connection con, String id) throws SQLException; @PageQuery @OrderBy("ORDER BY CREATE_TIME DESC") PageQueryResult<ResearchResult> pageQuery(Connection con, @Nullable @In String[] status, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {"name like ?", "ID IN (SELECT ID FROM RESEARCHER WHERE NAME LIKE ?)", "SUBJECT LIKE ?", "INDUSTRY LIKE ?"}, isAnd = false) String key, int pageSize, int pageNo) throws SQLException; @PageQuery @OrderBy("ORDER BY PAGE_VIEWS DESC") PageQueryResult<ResearchResult> pqByPageViews(Connection con, @Nullable @In String[] status, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {"name like ?", "ID IN (SELECT ID FROM RESEARCHER WHERE NAME LIKE ?)", "SUBJECT LIKE ?", "INDUSTRY LIKE ?"}, isAnd = false) String key, int pageSize, int pageNo) throws SQLException; @PageQuery @OrderBy("ORDER BY CREATE_TIME DESC") PageQueryResult<ResearchResult> pageQueryByResearcher(Connection con, @Nullable @In String[] status, @SqlColumn(handlerClass = StringHandler.class, value = "ID IN (SELECT ID FROM RESEARCHER WHERE PROFESSOR_ID = ?)") String id, int pageSize, int pageNo) throws SQLException; @PageQuery @OrderBy("ORDER BY STATUS DESC, CREATE_TIME DESC") PageQueryResult<ResearchResult> pageQueryByCreator(Connection con, @Nullable @In String[] status, String creator, int pageSize, int pageNo) throws SQLException; @DefaultValue("0") @QueryVal @Column(value = "COUNT(1)", handlerClass = LongHandler.class) @From(ResearchResult.class) @Where("status='1'") long countPublish(Connection con, @SqlColumn(handlerClass = StringHandler.class,value = "ID IN (SELECT ID FROM RESEARCHER WHERE PROFESSOR_ID = ?)") String professor) throws SQLException; @From(ResearchResult.class) @UpdateWith @SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1") int incPageViews(Connection con, String id) throws SQLException; @SelectList List<ResearchResult> query(Connection con, @In String[] id) throws SQLException; }