Commit 5b1af547 authored by Quxl's avatar Quxl

修改审片列表检索条件

parent b65fb839
......@@ -61,7 +61,7 @@ public class UserReviewController {
LoginToken loginToken = tokenService.getToken();
Long user_id = (Long)loginToken.getId();
Page page = new Page(index, limit, limitKey);
List<Map<String, Object>> list = reviewService.limitReviewList(user_id, page);
List<Map<String, Object>> list = reviewService.limitReviewList(user_id, page, start_time, end_time, film_type_name, keyword);
return Rjx.jsonOk().setData(list).setPage(page);
}
......@@ -82,7 +82,7 @@ public class UserReviewController {
LoginToken loginToken = tokenService.getToken();
Long user_id = (Long)loginToken.getId();
Page page = new Page(index, limit, limitKey);
List<Map<String, Object>> list = reviewService.limitUnviewList(user_id, page);
List<Map<String, Object>> list = reviewService.limitUnviewList(user_id, page, start_time, end_time, film_type_name, keyword);
return Rjx.jsonOk().setData(list).setPage(page);
}
......
package com.egolm.film.api.user.service;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -11,9 +12,9 @@ import com.egolm.film.bean.Fc_film_review;
public interface UserReviewService {
List<Map<String, Object>> limitReviewList(Long user_id, Page page);
List<Map<String, Object>> limitReviewList(Long user_id, Page page, Date start_time, Date end_time, String film_type_name, String keyword);
List<Map<String, Object>> limitUnviewList(Long user_id, Page page);
List<Map<String, Object>> limitUnviewList(Long user_id, Page page, Date start_time, Date end_time, String film_type_name, String keyword);
Long queryMemberFilmIdByFilmId(Long film_id);
......
package com.egolm.film.api.user.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
......@@ -24,7 +28,35 @@ public class UserReviewServiceImpl implements UserReviewService {
private JdbcTemplate jdbcTemplate;
@Override
public List<Map<String, Object>> limitReviewList(Long user_id, Page page) {
public List<Map<String, Object>> limitReviewList(
Long user_id,
Page page,
Date start_time,
Date end_time,
String film_type_name,
String keyword) {
List<Object> args = new ArrayList<Object>();
List<String> strs = new ArrayList<String>();
args.add(user_id);
if(start_time != null) {
strs.add("allot.push_time >= ?");
args.add(start_time);
}
if(end_time != null) {
strs.add("allot.push_time < ?");
args.add(DateUtil.day(end_time, 1));
}
if(film_type_name != null && film_type_name.trim().length() > 0) {
strs.add("film.film_type_name = ?");
args.add(film_type_name);
}
if(keyword != null && keyword.trim().length() > 0) {
strs.add("(film.en_name like ? or film.cn_name like ?)");
args.add("%" + keyword + "%");
args.add("%" + keyword + "%");
}
String sql = ""
+ " select "
+ "film.*, "
......@@ -40,12 +72,40 @@ public class UserReviewServiceImpl implements UserReviewService {
+ "left join fc_film_review review on review.film_id = allot.film_id and review.uid = allot.uid and review.round = allot.review_round "
+ "where "
+ "allot.uid = ? "
+ "and review.state > 0";
return jdbcTemplate.limit(sql, page, user_id);
+ "and review.state > 0" + StringUtil.join(" and ", " ", "", "", strs);
return jdbcTemplate.limit(sql, page, args.toArray());
}
@Override
public List<Map<String, Object>> limitUnviewList(Long user_id, Page page) {
public List<Map<String, Object>> limitUnviewList(
Long user_id,
Page page,
Date start_time,
Date end_time,
String film_type_name,
String keyword) {
List<Object> args = new ArrayList<Object>();
List<String> strs = new ArrayList<String>();
args.add(user_id);
if(start_time != null) {
strs.add("allot.push_time >= ?");
args.add(start_time);
}
if(end_time != null) {
strs.add("allot.push_time < ?");
args.add(DateUtil.day(end_time, 1));
}
if(film_type_name != null && film_type_name.trim().length() > 0) {
strs.add("film.film_type_name = ?");
args.add(film_type_name);
}
if(keyword != null && keyword.trim().length() > 0) {
strs.add("(film.en_name like ? or film.cn_name like ?)");
args.add("%" + keyword + "%");
args.add("%" + keyword + "%");
}
String sql = ""
+ " select "
+ "film.*, "
......@@ -61,8 +121,8 @@ public class UserReviewServiceImpl implements UserReviewService {
+ "left join fc_film_review review on review.film_id = allot.film_id and review.uid = allot.uid and review.round = allot.review_round "
+ "where "
+ "allot.uid = ? "
+ "and review.state is null";
return jdbcTemplate.limit(sql, page, user_id);
+ "and review.state is null" + StringUtil.join(" and ", " ", "", "", strs);
return jdbcTemplate.limit(sql, page, args.toArray());
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment