|
|
@@ -20,11 +20,8 @@
|
|
|
<%@ page import="constants.Constants" %>
|
|
|
<%@ page import="dbconnection.DbConnection" %>
|
|
|
<%@ page import="org.apache.commons.lang.StringUtils" %>
|
|
|
-<%@ page import="static jooq.Tables.CASHRECORD" %>
|
|
|
-<%@ page import="constants.PayConstants" %>
|
|
|
-<%@ page import="static jooq.Tables.RECOMMEND_APPLY" %>
|
|
|
-<%@ page import="static jooq.Tables.*" %>
|
|
|
<%@ page import="org.jooq.*" %>
|
|
|
+<%@ page import="jooq.tables.Memberinfo" %>
|
|
|
<jsp:useBean id="db" class="dbconnection.DbConnection"/>
|
|
|
<%
|
|
|
|
|
|
@@ -33,31 +30,54 @@
|
|
|
out.clear();
|
|
|
if (operator.equals("query")) {
|
|
|
String paramPage = request.getParameter("page");
|
|
|
- int pageIndex = 1;
|
|
|
+ Integer type = Integer.valueOf(request.getParameter("type"));
|
|
|
+ int pageIndex = 1;
|
|
|
if (StringUtils.isNotEmpty(paramPage)) {
|
|
|
pageIndex = Integer.valueOf(paramPage);
|
|
|
}
|
|
|
+ String introducerType, introduceType;
|
|
|
+ switch (type) {
|
|
|
+ case 1:
|
|
|
+ introducerType = thmodel.MEMTYPE_Model;
|
|
|
+ introduceType = thmodel.MEMTYPE_HuiYuan;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ introducerType = thmodel.MEMTYPE_Model;
|
|
|
+ introduceType = thmodel.MEMTYPE_Model;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ introducerType = thmodel.MEMTYPE_HuiYuan;
|
|
|
+ introduceType = thmodel.MEMTYPE_HuiYuan;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ introducerType = thmodel.MEMTYPE_Model;
|
|
|
+ introduceType = thmodel.MEMTYPE_HuiYuan;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ Memberinfo a = MEMBERINFO.as("a");
|
|
|
+ Memberinfo b = MEMBERINFO.as("b");
|
|
|
+ Field<Integer> count = ctx.selectCount().from(b).where(b.INTRODUCERPK.equal(a.PK)).and(b.MEMBTYPE.equal(Integer.valueOf(introduceType))).asField("count");
|
|
|
+ List<Field> fields = new ArrayList<>(Arrays.asList(a.fields()));
|
|
|
+ fields.add(count);
|
|
|
+ Result<Record> records = ctx.select(fields.stream().toArray(Field[]::new))
|
|
|
+ .from(a)
|
|
|
+ .where(a.MEMBTYPE.equal(Integer.valueOf(introducerType)))
|
|
|
+ .orderBy(count.desc())
|
|
|
+ .limit((pageIndex - 1) * 10, 10)
|
|
|
+ .fetch();
|
|
|
+
|
|
|
+ Record totalResult = ctx.select(ctx.selectCount().from(MEMBERINFO).where(MEMBERINFO.MEMBTYPE.equal(Integer.valueOf(introducerType))).asField("total"))
|
|
|
+ .fetchOne();
|
|
|
|
|
|
- String sql = "select count(a.IntroducerPK) as num, a.IntroducerPK, b.* " +
|
|
|
- "from memberinfo a " +
|
|
|
- "join memberinfo b on b.PK = a.IntroducerPK " +
|
|
|
- "where a.IntroducerPK is not null " +
|
|
|
- "group by a.IntroducerPK order by num desc"
|
|
|
- + " limit " + (pageIndex - 1) * 10 + " ,10";
|
|
|
- String countSql = "select count(*) as total " +
|
|
|
- "from (select count(*)\n" +
|
|
|
- " from memberinfo a\n" +
|
|
|
- " join memberinfo b on b.PK = a.IntroducerPK\n" +
|
|
|
- " where a.IntroducerPK is not null\n" +
|
|
|
- " group by a.IntroducerPK) a";
|
|
|
- List<JSONObject> jsonList = DBRecordsPack.Pack(db, sql);
|
|
|
- int total = DBRecordsPack.Pack(db, countSql).get(0).getInt("total");
|
|
|
- JSONObject res = new JSONObject();
|
|
|
+ List<JSONObject> jsonList = DBRecordsPack.Pack(records);
|
|
|
+ JSONObject res = new JSONObject();
|
|
|
res.put("data", jsonList);
|
|
|
- res.put("total", total);
|
|
|
+ res.put("total", DBRecordsPack.Pack(totalResult).getInt("total"));
|
|
|
+ ctx.close();
|
|
|
response.setContentType("application/json");
|
|
|
out.print(res.toString());
|
|
|
return;
|
|
|
+
|
|
|
}
|
|
|
%>
|
|
|
<!DOCTYPE html>
|
|
|
@@ -69,10 +89,16 @@
|
|
|
</head>
|
|
|
<body>
|
|
|
<div id="app">
|
|
|
+ <el-radio-group v-model="type">
|
|
|
+ <el-radio :label="1">模特邀请用户</el-radio>
|
|
|
+ <el-radio :label="2">模特邀请模特</el-radio>
|
|
|
+ <el-radio :label="3">用户邀请用户</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+
|
|
|
<el-table :data="tableData">
|
|
|
- <el-table-column prop="pet" label="姓名"></el-table-column>
|
|
|
- <el-table-column prop="tel" label="账号"></el-table-column>
|
|
|
- <el-table-column prop="num" label="邀请数量"></el-table-column>
|
|
|
+ <el-table-column prop="Pet" label="姓名"></el-table-column>
|
|
|
+ <el-table-column prop="Tel" label="账号"></el-table-column>
|
|
|
+ <el-table-column prop="count" label="邀请数量"></el-table-column>
|
|
|
</el-table>
|
|
|
<el-pagination
|
|
|
background
|
|
|
@@ -95,7 +121,8 @@
|
|
|
loading: false,
|
|
|
tableData: [],
|
|
|
page: 1,
|
|
|
- total: 0
|
|
|
+ total: 0,
|
|
|
+ type: 1
|
|
|
},
|
|
|
methods: {
|
|
|
getData: function () {
|
|
|
@@ -104,7 +131,8 @@
|
|
|
url: "${pageContext.request.contextPath}${pageContext.request.servletPath}",
|
|
|
data: {
|
|
|
operator: 'query',
|
|
|
- page: this.page
|
|
|
+ page: this.page,
|
|
|
+ type: this.type
|
|
|
},
|
|
|
success: function (res) {
|
|
|
this.loading = false;
|
|
|
@@ -122,6 +150,11 @@
|
|
|
this.page = page;
|
|
|
this.getData();
|
|
|
}
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ type: function () {
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
</script>
|