| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) {
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long cid,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | if (pageSize == null)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | if (cid != null && cid == 0) {
|
| | | cid = null; // 查询全部
|
| | | }
|
| | | |
| | | List<HelpCenter> helpCenterList =
|
| | | helpCenterService.queryIdAndTitle((pageIndex - 1) * pageSize, pageSize, key, null);
|
| | | helpCenterService.queryIdAndTitle((pageIndex - 1) * pageSize, pageSize, key, cid);
|
| | |
|
| | | if (helpCenterList == null || helpCenterList.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = helpCenterService.countQuery(key, null);
|
| | | long count = helpCenterService.countQuery(key, cid);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
| | | AND ht.h_title like '%${key}%' |
| | | </if> |
| | | <if test='cid != null'> |
| | | AND ht.h_cid = cid |
| | | AND ht.h_cid = #{cid} |
| | | </if> |
| | | |
| | | <if test='orderMode == 1'> |
| | |
| | | AND h_title like '%${key}%' |
| | | </if> |
| | | <if test='cid != null'> |
| | | AND h_cid = cid |
| | | AND h_cid = #{cid} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="queryIdAndTitle" resultMap="BaseResultMap"> |
| | | <!-- 根据条件查询所有标签 --> |
| | | SELECT h_id, h_title FROM yeshi_ec_help_center |
| | | WHERE <![CDATA[1>0]]> |
| | | WHERE 1=1 |
| | | <if test='key != null and key != ""'> |
| | | AND h_title like '%${key}%' |
| | | </if> |
| | | <if test='cid != null'> |
| | | AND h_cid = cid |
| | | AND h_cid = #{cid} |
| | | </if> |
| | | ORDER BY h_weight DESC, h_createtime |
| | | |