Commit b6fbf201 authored by Quxl's avatar Quxl

xxx

parent 8a431caf
...@@ -40,7 +40,7 @@ public class AdminFirstController { ...@@ -40,7 +40,7 @@ public class AdminFirstController {
@ApiOperation("管理员分页查询") @ApiOperation("管理员分页查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"), @ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"),
@ApiImplicitParam(paramType="query", dataType="integer", required=false, name="state", value="状态"), @ApiImplicitParam(paramType="query", dataType="integer", required=false, name="apply_state", value="状态"),
@ApiImplicitParam(paramType="query", dataType="integer", required=false, name="film_type", value="影片类型"), @ApiImplicitParam(paramType="query", dataType="integer", required=false, name="film_type", value="影片类型"),
@ApiImplicitParam(paramType="query", dataType="integer", required=false, name="enroll_type", value="影片性质"), @ApiImplicitParam(paramType="query", dataType="integer", required=false, name="enroll_type", value="影片性质"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"), @ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"),
......
...@@ -35,15 +35,15 @@ public class AdminAuthServiceImpl implements AdminAuthService { ...@@ -35,15 +35,15 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override @Override
public List<Map<String, Object>> queryGroupList(String keyword, Page page) { public List<Map<String, Object>> queryGroupList(String keyword, Page page) {
SqlWhere argEdit = new SqlWhere().like("group_name", keyword); SqlWhere argEdit = new SqlWhere().like("group_name", keyword);
String sql = "select * from fc_admin_group" + StringUtil.join(" and ", " where ", "", "", argEdit.getArgs()); String sql = "select * from fc_admin_group" + StringUtil.join(" and ", " where ", "", "", argEdit.getStringList());
return jdbcTemplate.limit(sql, page, argEdit.getObjs()); return jdbcTemplate.limit(sql, page, argEdit.getObjectList());
} }
@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().olike(new String[]{"realname", "username"}, keyword).eq("group_id", group_id); SqlWhere argEdit = new SqlWhere().olike(new String[]{"realname", "username"}, keyword).eq("group_id", group_id);
String sql = "select * from fc_admin" + StringUtil.join(" and ", " where ", "", "", argEdit.getArgs()); String sql = "select * from fc_admin" + StringUtil.join(" and ", " where ", "", "", argEdit.getStringList());
return jdbcTemplate.limit(sql, page, argEdit.getObjs()); return jdbcTemplate.limit(sql, page, argEdit.getObjectList());
} }
@Override @Override
......
...@@ -21,8 +21,8 @@ public class AdminUserServiceImpl implements AdminUserService { ...@@ -21,8 +21,8 @@ public class AdminUserServiceImpl implements AdminUserService {
@Override @Override
public List<Map<String, Object>> queryGroupList(String keyword, Page page) { public List<Map<String, Object>> queryGroupList(String keyword, Page page) {
SqlWhere argEdit = new SqlWhere().like("group_name", keyword); SqlWhere argEdit = new SqlWhere().like("group_name", keyword);
String sql = "select * from fc_user_group" + StringUtil.join(" and ", " where ", "", "", argEdit.getArgs()); String sql = "select * from fc_user_group" + StringUtil.join(" and ", " where ", "", "", argEdit.getStringList());
return jdbcTemplate.limit(sql, page, argEdit.getObjs()); return jdbcTemplate.limit(sql, page, argEdit.getObjectList());
} }
} }
...@@ -496,11 +496,11 @@ public class MemberServiceImpl implements MemberService { ...@@ -496,11 +496,11 @@ public class MemberServiceImpl implements MemberService {
} }
@Override @Override
public List<Map<String, Object>> queryChuShenList(String keyword, Integer state, String film_type, String enroll_type, Page page) { public List<Map<String, Object>> queryChuShenList(String keyword, Integer apply_state, String film_type, String enroll_type, Page page) {
String sql = "select * from fc_member_film"; SqlWhere where = new SqlWhere().olike(new String[]{"en_name", "cn_name"}, keyword).eq("state", 2).eq("apply_state", apply_state).eq("film_type", film_type).eq("enroll_type", enroll_type);
new SqlWhere().like(name, obj) String sql = "select * from fc_member_film" + StringUtil.join(" and ", " where ", "", "", where.getStringList());
Object[] objs = where.getObjectList();
return null; return jdbcTemplate.limit(sql, page, objs);
} }
} }
...@@ -7,58 +7,58 @@ import com.egolm.common.StringUtil; ...@@ -7,58 +7,58 @@ import com.egolm.common.StringUtil;
public class SqlWhere { public class SqlWhere {
private List<String> args; private List<String> strList;
private List<Object> objs; private List<Object> objList;
public SqlWhere() { public SqlWhere() {
this.args = new ArrayList<String>(); this.strList = new ArrayList<String>();
this.objs = new ArrayList<Object>(); this.objList = new ArrayList<Object>();
} }
public SqlWhere eq(String name, Object obj) { public SqlWhere eq(String name, Object obj) {
if(StringUtil.isNotBlank(obj)) { if(StringUtil.isNotBlank(obj)) {
this.args.add(name + " = ?"); this.strList.add(name + " = ?");
this.objs.add(obj); this.objList.add(obj);
} }
return this; return this;
} }
public SqlWhere gt(String name, Object obj) { public SqlWhere gt(String name, Object obj) {
if(StringUtil.isNotBlank(obj)) { if(StringUtil.isNotBlank(obj)) {
this.args.add(name + " > ?"); this.strList.add(name + " > ?");
this.objs.add(obj); this.objList.add(obj);
} }
return this; return this;
} }
public SqlWhere lt(String name, Object obj) { public SqlWhere lt(String name, Object obj) {
if(StringUtil.isNotBlank(obj)) { if(StringUtil.isNotBlank(obj)) {
this.args.add(name + " < ?"); this.strList.add(name + " < ?");
this.objs.add(obj); this.objList.add(obj);
} }
return this; return this;
} }
public SqlWhere gtq(String name, Object obj) { public SqlWhere gtq(String name, Object obj) {
if(StringUtil.isNotBlank(obj)) { if(StringUtil.isNotBlank(obj)) {
this.args.add(name + " >= ?"); this.strList.add(name + " >= ?");
this.objs.add(obj); this.objList.add(obj);
} }
return this; return this;
} }
public SqlWhere ltq(String name, Object obj) { public SqlWhere ltq(String name, Object obj) {
if(StringUtil.isNotBlank(obj)) { if(StringUtil.isNotBlank(obj)) {
this.args.add(name + " <= ?"); this.strList.add(name + " <= ?");
this.objs.add(obj); this.objList.add(obj);
} }
return this; return this;
} }
public SqlWhere like(String name, Object obj) { public SqlWhere like(String name, Object obj) {
if(StringUtil.isNotBlank(obj)) { if(StringUtil.isNotBlank(obj)) {
this.args.add(name + " like ?"); this.strList.add(name + " like ?");
this.objs.add("%" + obj + "%"); this.objList.add("%" + obj + "%");
} }
return this; return this;
} }
...@@ -74,7 +74,7 @@ public class SqlWhere { ...@@ -74,7 +74,7 @@ public class SqlWhere {
sb.append(name + " like '%" + obj + "%'"); sb.append(name + " like '%" + obj + "%'");
} }
sb.append(")"); sb.append(")");
this.args.add(sb.toString()); this.strList.add(sb.toString());
} }
return this; return this;
} }
...@@ -87,20 +87,20 @@ public class SqlWhere { ...@@ -87,20 +87,20 @@ public class SqlWhere {
str += ", "; str += ", ";
} }
str += "?"; str += "?";
this.objs.add(obj[i]); this.objList.add(obj[i]);
} }
str += ")"; str += ")";
this.args.add(name + " in (" + str + ")"); this.strList.add(name + " in (" + str + ")");
} }
return this; return this;
} }
public List<String> getArgs() { public List<String> getStringList() {
return args; return strList;
} }
public Object[] getObjs() { public Object[] getObjectList() {
return objs.toArray(); return objList.toArray();
} }
} }
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