浏览代码

成果 index search

XMTT 5 年之前
父节点
当前提交
7ed8061188

+ 8 - 0
src/main/java/com/ekexiu/portal/resResult/ResearchResultDao.java

6
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.DAO;
7
import org.jfw.apt.orm.annotation.dao.method.Exclude;
7
import org.jfw.apt.orm.annotation.dao.method.Exclude;
8
import org.jfw.apt.orm.annotation.dao.method.From;
8
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.LimitColumn;
9
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
11
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
11
import org.jfw.apt.orm.annotation.dao.method.Where;
12
import org.jfw.apt.orm.annotation.dao.method.Where;
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.LimitSelect;
13
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
15
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
14
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
16
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
17
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
83
85
84
    @SelectList
86
    @SelectList
85
    List<ResearchResult> query(Connection con, @In String[] id) throws SQLException;
87
    List<ResearchResult> query(Connection con, @In String[] id) throws SQLException;
88
89
    @LimitSelect
90
    @Where("STATUS='1'")
91
    @OrderBy(cols = { @LimitColumn(value = "createTime", asc = false),
92
            @LimitColumn(value = "id", asc = false) }, value = "")
93
    List<ResearchResult> indexSearch(Connection con, @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, String createTime, String id, int rows) throws SQLException;
86
}
94
}

+ 11 - 0
src/main/java/com/ekexiu/portal/resResult/ResearchResultService.java

4
import com.ekexiu.portal.dao.WatchDao;
4
import com.ekexiu.portal.dao.WatchDao;
5
import com.ekexiu.portal.service.KeyWordService;
5
import com.ekexiu.portal.service.KeyWordService;
6
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.annotation.DefaultValue;
7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Get;
10
import org.jfw.apt.web.annotation.operate.Get;
255
        return researchResultDao.query(con, id);
256
        return researchResultDao.query(con, id);
256
    }
257
    }
257
258
259
    @Get
260
    @Path("/index/search")
261
    public List<ResearchResult> indexSeach(@JdbcConn Connection con, @Nullable String key,
262
                                 @DefaultValue("\"9\"") String time, @DefaultValue("\"G\"") String id, int rows) throws SQLException {
263
        if (key != null) {
264
            key = "%" + key + "%";
265
        }
266
        return researchResultDao.indexSearch(con, key, time, id, rows);
267
    }
268
258
269
259
270
260
    /**
271
    /**