|
|
@@ -34,6 +34,7 @@ import com.thmodel.page.Page;
|
|
|
import com.thmodel.service.MemberinfoService;
|
|
|
import com.thmodel.service.impl.MemberinfoServiceImpl;
|
|
|
import net.sf.json.JSONObject;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.jooq.*;
|
|
|
import org.jooq.impl.DSL;
|
|
|
|
|
|
@@ -574,11 +575,18 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> findModelInfoByName(int memberpk, String likeName, int index, int size) {
|
|
|
+ public Map<String, Object> findModelInfoByName(int memberpk, String likeName, int index, int size, String area) {
|
|
|
String whereSql = null;
|
|
|
if (likeName != null && !likeName.equals("")) {
|
|
|
whereSql = " (b.pet like '%" + likeName + "%' or m.Stage like '%" + likeName + "%')";
|
|
|
}
|
|
|
+ if ("烟台".equals(area)) {
|
|
|
+ if (StringUtils.isNotEmpty(whereSql)) {
|
|
|
+ whereSql += " and b.Area=80 ";
|
|
|
+ } else {
|
|
|
+ whereSql = " b.Area=80 ";
|
|
|
+ }
|
|
|
+ }
|
|
|
List<ModelInfo> list = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
|
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
|
@@ -904,11 +912,19 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> findDataTypeInfoByPkOrTypeName(int memberpk, String pks, String typeName, int index, int size) {
|
|
|
+ public Map<String, Object> findDataTypeInfoByPkOrTypeName(int memberpk, String pks, String typeName, String area, int index, int size) {
|
|
|
try {
|
|
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
|
String whereSql = " m.pk in(select distinct modelpk from modelprice where skillpk in (" + pks + ")) ";
|
|
|
|
|
|
+ if ("烟台".equals(area)) {
|
|
|
+ if (StringUtils.isNotEmpty(whereSql)) {
|
|
|
+ whereSql += " and b.Area=80' ";
|
|
|
+ } else {
|
|
|
+ whereSql = " b.Area=80' ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<ModelInfo> modelInfoList = modelInfoAndPhotoInfoList(memberpk, whereSql, true, index, size);
|
|
|
|
|
|
//获取总数量
|
|
|
@@ -1850,17 +1866,17 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
|
|
|
|
|
|
Result<Record4<Integer, String, String, Serializable>> result =
|
|
|
ctx.select(MEMBERINFO.PK.as("pk"), MEMBERINFO.PET.as("name"), MEMBERINFO.HPHOTO.as("avatar"), sumField)
|
|
|
- .from(MODELINFO)
|
|
|
- .innerJoin(MEMBERINFO)
|
|
|
- .on(MODELINFO.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
- .leftJoin(ACCOUNTRECORD)
|
|
|
- .on(ACCOUNTRECORD.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
- .and(ACCOUNTRECORD.ADATE.greaterOrEqual(Timestamp.valueOf(LocalDateTime.now().minusDays(day))))
|
|
|
- .and(ACCOUNTRECORD.ATYPE.in(AccountConstants.ACCOUNTRECORD_INCOME_TYPES))
|
|
|
- .groupBy(MEMBERINFO.PK)
|
|
|
- .orderBy(sumField.desc())
|
|
|
- .limit(20)
|
|
|
- .fetch();
|
|
|
+ .from(MODELINFO)
|
|
|
+ .innerJoin(MEMBERINFO)
|
|
|
+ .on(MODELINFO.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
+ .leftJoin(ACCOUNTRECORD)
|
|
|
+ .on(ACCOUNTRECORD.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
+ .and(ACCOUNTRECORD.ADATE.greaterOrEqual(Timestamp.valueOf(LocalDateTime.now().minusDays(day))))
|
|
|
+ .and(ACCOUNTRECORD.ATYPE.in(AccountConstants.ACCOUNTRECORD_INCOME_TYPES))
|
|
|
+ .groupBy(MEMBERINFO.PK)
|
|
|
+ .orderBy(sumField.desc())
|
|
|
+ .limit(20)
|
|
|
+ .fetch();
|
|
|
for (int i = 0; i < result.size(); i++) {
|
|
|
JSONObject jsonObject = DBRecordsPack.Pack(result.get(i));
|
|
|
jsonObject.put("rank", i + 1);
|
|
|
@@ -1870,18 +1886,18 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
|
|
|
|
|
|
Field<Object> f =
|
|
|
ctx.select(ifnull(sum(ACCOUNTRECORD.COIN), 0))
|
|
|
- .from(ACCOUNTRECORD)
|
|
|
- .where(ACCOUNTRECORD.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
- .and((ACCOUNTRECORD.ADATE.greaterOrEqual(Timestamp.valueOf(LocalDateTime.now().minusDays(day)))))
|
|
|
- .and(ACCOUNTRECORD.ATYPE.in(AccountConstants.ACCOUNTRECORD_INCOME_TYPES))
|
|
|
- .asField("coin");
|
|
|
+ .from(ACCOUNTRECORD)
|
|
|
+ .where(ACCOUNTRECORD.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
+ .and((ACCOUNTRECORD.ADATE.greaterOrEqual(Timestamp.valueOf(LocalDateTime.now().minusDays(day)))))
|
|
|
+ .and(ACCOUNTRECORD.ATYPE.in(AccountConstants.ACCOUNTRECORD_INCOME_TYPES))
|
|
|
+ .asField("coin");
|
|
|
Record4<Integer, String, String, Object> record =
|
|
|
ctx.select(MEMBERINFO.PK.as("pk"), MEMBERINFO.PET.as("name"), MEMBERINFO.HPHOTO.as("avatar"), f)
|
|
|
- .from(MODELINFO)
|
|
|
- .innerJoin(MEMBERINFO)
|
|
|
- .on(MODELINFO.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
- .where(MODELINFO.MEMBERPK.equal(memberpk))
|
|
|
- .fetchOne();
|
|
|
+ .from(MODELINFO)
|
|
|
+ .innerJoin(MEMBERINFO)
|
|
|
+ .on(MODELINFO.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
+ .where(MODELINFO.MEMBERPK.equal(memberpk))
|
|
|
+ .fetchOne();
|
|
|
if (record != null) {
|
|
|
map.put("myRank", DBRecordsPack.Pack(record));
|
|
|
}
|
|
|
@@ -1893,9 +1909,9 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
|
|
|
public boolean setOnline(int modelpk, int state) {
|
|
|
DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
|
|
|
int num = ctx.update(MODELINFO)
|
|
|
- .set(MODELINFO.IS_A, state)
|
|
|
- .where(MODELINFO.PK.equal(modelpk))
|
|
|
- .execute();
|
|
|
+ .set(MODELINFO.IS_A, state)
|
|
|
+ .where(MODELINFO.PK.equal(modelpk))
|
|
|
+ .execute();
|
|
|
ctx.close();
|
|
|
return num > 0;
|
|
|
}
|
|
|
@@ -1904,8 +1920,8 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
|
|
|
public boolean applyRecommend(int modelpk) {
|
|
|
DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
|
|
|
int num = ctx.insertInto(RECOMMEND_APPLY, RECOMMEND_APPLY.MODELPK)
|
|
|
- .values(modelpk)
|
|
|
- .execute();
|
|
|
+ .values(modelpk)
|
|
|
+ .execute();
|
|
|
ctx.close();
|
|
|
return num > 0;
|
|
|
}
|
|
|
@@ -1922,13 +1938,13 @@ public class ModelInfoDaoImpl implements ModelInfoDao {
|
|
|
public List<JSONObject> fans(int modelPK, int page, int size) {
|
|
|
DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
|
|
|
List<JSONObject> list = DBRecordsPack.Pack(ctx.select(MEMBERINFO.fields())
|
|
|
- .from(MODELFAN)
|
|
|
- .join(MEMBERINFO)
|
|
|
- .on(MODELFAN.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
- .where(MODELFAN.MODELPK.equal(modelPK))
|
|
|
- .orderBy(MODELFAN.PK.desc())
|
|
|
- .limit((page - 1) * size, size)
|
|
|
- .fetch());
|
|
|
+ .from(MODELFAN)
|
|
|
+ .join(MEMBERINFO)
|
|
|
+ .on(MODELFAN.MEMBERPK.equal(MEMBERINFO.PK))
|
|
|
+ .where(MODELFAN.MODELPK.equal(modelPK))
|
|
|
+ .orderBy(MODELFAN.PK.desc())
|
|
|
+ .limit((page - 1) * size, size)
|
|
|
+ .fetch());
|
|
|
ctx.close();
|
|
|
return list;
|
|
|
}
|