Commit f38b6bea authored by Quxl's avatar Quxl

x

parent 886d9d38
...@@ -368,8 +368,8 @@ public class FilmServiceImpl implements FilmService { ...@@ -368,8 +368,8 @@ public class FilmServiceImpl implements FilmService {
@Override @Override
public List<Map<String, Object>> queryChuShenList(String keyword, Integer state, Integer apply_state, Integer film_type, Integer enroll_type, String film_country, Page page) { public List<Map<String, Object>> queryChuShenList(String keyword, Integer state, Integer apply_state, Integer film_type, Integer enroll_type, String film_country, Page page) {
SqlWhere where = new SqlWhere().eq("rv.enroll_type_id", enroll_type).lk(new String[]{"mf.en_name", "mf.cn_name"}, keyword).eq("mf.state", state).eq("mf.apply_state", apply_state).eq("mf.film_type_name", film_type).eq("mf.film_country", film_country); SqlWhere where = new SqlWhere().lk(new String[]{"mf.en_name", "mf.cn_name"}, keyword).eq("mf.state", state).eq("mf.apply_state", apply_state).lk("mf.enroll_type_name", enroll_type).eq("mf.film_type_name", film_type).eq("mf.film_country", film_country);
String sql = "select mf.*, ifnull(rv.review_state, 0) review_state, (select GROUP_CONCAT(mfd.playactor_name) from fc_member_film_playactor mfd where mfd.film_id = mf.id and mfd.playactor_type = 'director') director_name from fc_member_film mf, fc_review rv where rv.film_id = mf.id" + StringUtil.join(" and ", " and ", "", "", where.getStringList()); String sql = "select mf.*, ifnull(rv.review_state, 0) review_state, (select GROUP_CONCAT(mfd.playactor_name) from fc_member_film_playactor mfd where mfd.film_id = mf.id and mfd.playactor_type = 'director') director_name from fc_member_film mf left join fc_review rv on rv.film_id = mf.id" + StringUtil.join(" and ", " where ", "", "", where.getStringList());
Object[] objs = where.getObjectList(); Object[] objs = where.getObjectList();
return jdbcTemplate.limit(sql, page, objs); return jdbcTemplate.limit(sql, page, objs);
} }
......
...@@ -18,8 +18,10 @@ public class SqlWhere { ...@@ -18,8 +18,10 @@ public class SqlWhere {
public SqlWhere where(String where, Object[] obj) { public SqlWhere where(String where, Object[] obj) {
if(StringUtil.isNotBlank(where)) { if(StringUtil.isNotBlank(where)) {
this.strList.add(where); this.strList.add(where);
for(Object o : obj) { if(obj != null){
this.objList.add(o); for(Object o : obj) {
this.objList.add(o);
}
} }
} }
return this; return this;
......
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