Commit b5ae14ce authored by Quxl's avatar Quxl

x

parent 3e1e1e32
...@@ -35,14 +35,14 @@ public class AdminAuthServiceImpl implements AdminAuthService { ...@@ -35,14 +35,14 @@ public class AdminAuthServiceImpl implements AdminAuthService {
public List<Map<String, Object>> queryGroupList(String keyword, Page page) { public List<Map<String, Object>> queryGroupList(String keyword, Page page) {
SqlWhere argEdit = new SqlWhere().lk("ag.group_name", keyword); SqlWhere argEdit = new SqlWhere().lk("ag.group_name", keyword);
String sql = "select ag.*, (select count(adminid) from fc_admin a where a.group_id = ag.group_id) user_count from fc_admin_group ag" + StringUtil.join(" and ", " where ", "", "", argEdit.getStringList()); String sql = "select ag.*, (select count(adminid) from fc_admin a where a.group_id = ag.group_id) user_count from fc_admin_group ag" + StringUtil.join(" and ", " where ", "", "", argEdit.getStringList());
return jdbcTemplate.limit(sql, page, argEdit.getObjectList()); return jdbcTemplate.limit(sql, page, argEdit.getObjectArray());
} }
@Override @Override
public List<Map<String, Object>> queryAdminList(String keyword, Integer group_id, Page page) { public List<Map<String, Object>> queryAdminList(String keyword, Integer group_id, Page page) {
SqlWhere argEdit = new SqlWhere().lk(new String[]{"realname", "username"}, keyword).eq("group_id", group_id); SqlWhere argEdit = new SqlWhere().lk(new String[]{"realname", "username"}, keyword).eq("group_id", group_id);
String sql = "select * from fc_admin" + StringUtil.join(" and ", " where ", "", "", argEdit.getStringList()); String sql = "select * from fc_admin" + StringUtil.join(" and ", " where ", "", "", argEdit.getStringList());
return jdbcTemplate.limit(sql, page, argEdit.getObjectList()); return jdbcTemplate.limit(sql, page, argEdit.getObjectArray());
} }
@Override @Override
......
...@@ -40,7 +40,7 @@ public class AdminUserServiceImpl implements AdminUserService { ...@@ -40,7 +40,7 @@ public class AdminUserServiceImpl implements AdminUserService {
"(SELECT group_concat(uge.enroll_type_id) FROM fc_user_group_enroll uge WHERE uge.group_id = ug.group_id GROUP BY uge.group_id) enrolls " + "(SELECT group_concat(uge.enroll_type_id) FROM fc_user_group_enroll uge WHERE uge.group_id = ug.group_id GROUP BY uge.group_id) enrolls " +
"FROM " + "FROM " +
"fc_user_group ug" + StringUtil.join(" and ", " where ", " ", " ", argEdit.getStringList()) ; "fc_user_group ug" + StringUtil.join(" and ", " where ", " ", " ", argEdit.getStringList()) ;
return jdbcTemplate.limit(sql, page, argEdit.getObjectList()); return jdbcTemplate.limit(sql, page, argEdit.getObjectArray());
} }
@Override @Override
...@@ -52,7 +52,7 @@ public class AdminUserServiceImpl implements AdminUserService { ...@@ -52,7 +52,7 @@ public class AdminUserServiceImpl implements AdminUserService {
public List<Map<String, Object>> queryUserList(String keyword, Integer group_id, Page page) { public List<Map<String, Object>> queryUserList(String keyword, Integer group_id, Page page) {
SqlWhere w = new SqlWhere().lk(new String[]{"u.uid", "u.username", "u.realname"}, keyword).eq("u.group_id", group_id); SqlWhere w = new SqlWhere().lk(new String[]{"u.uid", "u.username", "u.realname"}, keyword).eq("u.group_id", group_id);
String sql = "select u.*, ug.group_name from fc_user u left join fc_user_group ug on ug.group_id = u.group_id" + StringUtil.join(" and ", " where ", "", "", w.getStringList()); String sql = "select u.*, ug.group_name from fc_user u left join fc_user_group ug on ug.group_id = u.group_id" + StringUtil.join(" and ", " where ", "", "", w.getStringList());
return jdbcTemplate.limit(sql, page, w.getObjectList()); return jdbcTemplate.limit(sql, page, w.getObjectArray());
} }
@Override @Override
......
...@@ -488,7 +488,7 @@ public class FilmServiceImpl implements FilmService { ...@@ -488,7 +488,7 @@ public class FilmServiceImpl implements FilmService {
+ "order by mf.film_no"; + "order by mf.film_no";
List<Object> objs = new ArrayList<Object>(); List<Object> objs = new ArrayList<Object>();
Object[] ary1 = where1.getObjectList(); Object[] ary1 = where1.getObjectArray();
for(Object obj : ary1) { for(Object obj : ary1) {
objs.add(obj); objs.add(obj);
} }
...@@ -501,7 +501,7 @@ public class FilmServiceImpl implements FilmService { ...@@ -501,7 +501,7 @@ public class FilmServiceImpl implements FilmService {
; ;
sql = "select t.* from (" + sql + ") t" + StringUtil.join(" and ", " where ", " ", " ", where2.getStringList()); sql = "select t.* from (" + sql + ") t" + StringUtil.join(" and ", " where ", " ", " ", where2.getStringList());
Object[] ary2 = where2.getObjectList(); Object[] ary2 = where2.getObjectArray();
for(Object obj : ary2) { for(Object obj : ary2) {
objs.add(obj); objs.add(obj);
} }
......
package com.egolm.film.api.service.impl; package com.egolm.film.api.service.impl;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -51,7 +52,6 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -51,7 +52,6 @@ public class ReviewServiceImpl implements ReviewService {
SqlWhere w1 = new SqlWhere() SqlWhere w1 = new SqlWhere()
.where("mf.film_type_name in (select agft.film_type_id from fc_admin_group_filmtype agft where agft.group_id = ?)", new Object[]{group_id}) .where("mf.film_type_name in (select agft.film_type_id from fc_admin_group_filmtype agft where agft.group_id = ?)", new Object[]{group_id})
.eq("mf.upload_state", 1) .eq("mf.upload_state", 1)
.lk(new String[]{"mf.en_name", "mf.cn_name"}, keyword)
.eq("mf.film_type_name", film_type_name) .eq("mf.film_type_name", film_type_name)
.eq("mf.film_type_name_short", film_type_name_short) .eq("mf.film_type_name_short", film_type_name_short)
.eq("mf.film_country", film_country) .eq("mf.film_country", film_country)
...@@ -115,7 +115,19 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -115,7 +115,19 @@ public class ReviewServiceImpl implements ReviewService {
+ "r.opt_state " + "r.opt_state "
; ;
return jdbcTemplate.limit(sql, page, w1.getObjectList());
SqlWhere w2 = new SqlWhere();
if(StringUtil.isNotBlank(keyword)) {
String lkstr = "%" + keyword + "%";
if(keyword.matches("\\d+")) {
w2.where("(t.film_no = ? or t.en_name like ? or t.cn_name like ? or t.playactor_name like ?)", new Object[] {Integer.valueOf(keyword), lkstr, lkstr, lkstr});
} else {
w2.lk(new String[]{"t.en_name", "t.cn_name", "t.playactor_name"}, keyword);
}
sql = "select t.* from (" + sql + ") t" + StringUtil.join(" and ", " and ", " ", " ", w2.getStringList());
w1.getObjectList().addAll(w2.getObjectList());
}
return jdbcTemplate.limit(sql, page, w1.getObjectArray());
} }
@Override @Override
...@@ -164,7 +176,7 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -164,7 +176,7 @@ public class ReviewServiceImpl implements ReviewService {
SqlWhere where = new SqlWhere().eq("t.review_state", review_state).lk(new String[] {"tt.cn_name", "tt.en_name", "tt.film_no", "tt.ext_name"}, keyword); SqlWhere where = new SqlWhere().eq("t.review_state", review_state).lk(new String[] {"tt.cn_name", "tt.en_name", "tt.film_no", "tt.ext_name"}, keyword);
sql = "select @rownum:=@rownum+1 as rownum, t.* from (" + sql + ") t, (select @rownum:=0) row order by t.ext_score_avg desc"; sql = "select @rownum:=@rownum+1 as rownum, t.* from (" + sql + ") t, (select @rownum:=0) row order by t.ext_score_avg desc";
sql = "select tt.* from (" + sql + ") tt " + StringUtil.join(" where ", " and ", "", "", where.getStringList()) + " order by tt.rownum"; sql = "select tt.* from (" + sql + ") tt " + StringUtil.join(" where ", " and ", "", "", where.getStringList()) + " order by tt.rownum";
return jdbcTemplate.limit(sql, page, where.getObjectList()); return jdbcTemplate.limit(sql, page, where.getObjectArray());
} else if(review_round.intValue() == 2) { } else if(review_round.intValue() == 2) {
throw new XRException("亚新二选榜单没有没有准备好"); throw new XRException("亚新二选榜单没有没有准备好");
...@@ -284,7 +296,7 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -284,7 +296,7 @@ public class ReviewServiceImpl implements ReviewService {
+ "and r.review_round = rr.review_round " + "and r.review_round = rr.review_round "
+ "and rr.user_id = " + user_id + "and rr.user_id = " + user_id
+ StringUtil.join(" and ", " and ", "", "", where.getStringList()); + StringUtil.join(" and ", " and ", "", "", where.getStringList());
return jdbcTemplate.limit(sql, page, where.getObjectList()); return jdbcTemplate.limit(sql, page, where.getObjectArray());
} }
@Override @Override
......
...@@ -111,8 +111,12 @@ public class SqlWhere { ...@@ -111,8 +111,12 @@ public class SqlWhere {
return strList; return strList;
} }
public Object[] getObjectList() { public Object[] getObjectArray() {
return objList.toArray(); return objList.toArray();
} }
public List<Object> getObjectList() {
return objList;
}
} }
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