Commit b6fbf201 authored by Quxl's avatar Quxl

xxx

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