|
@@ -48,7 +48,7 @@ public class ExpertServiceImpl extends IBaseServiceImpl<ExpertEntity, Long> impl
|
|
|
typeMap.put("2", "2");
|
|
|
typeMap.put("3", "3");
|
|
|
typeMap.put("4", "4");
|
|
|
- typeMap.put("5", "4");
|
|
|
+ typeMap.put("5", "5");
|
|
|
typeMap.put("loyal_1", "1");
|
|
|
typeMap.put("loyal_2", "2");
|
|
|
}
|
|
@@ -85,70 +85,28 @@ public class ExpertServiceImpl extends IBaseServiceImpl<ExpertEntity, Long> impl
|
|
|
entityMapper.addVisit(id);
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// public Result<ExpertEntity> webList(String type) {
|
|
|
-// List<ExpertEntity> all = this.findAll();
|
|
|
-//
|
|
|
-// List<ExpertEntity> levle_1 = new ArrayList<>();
|
|
|
-// List<ExpertEntity> levle_2 = new ArrayList<>();
|
|
|
-// List<ExpertEntity> levle_3 = new ArrayList<>();
|
|
|
-// List<ExpertEntity> levle_4 = new ArrayList<>();
|
|
|
-// List<ExpertEntity> levle_5 = new ArrayList<>();
|
|
|
-// // 忠诚力量
|
|
|
-// List<ExpertEntity> loyal_1 = new ArrayList<>();
|
|
|
-// List<ExpertEntity> loyal_2 = new ArrayList<>();
|
|
|
-// for (ExpertEntity entity : all) {
|
|
|
-// Integer level = entity.getLevel();
|
|
|
-// String type = entity.getType();
|
|
|
-// if (level == 1) {
|
|
|
-// levle_1.add(entity);
|
|
|
-// } else if (level == 2) {
|
|
|
-// levle_2.add(entity);
|
|
|
-// } else if (level == 3) {
|
|
|
-// levle_3.add(entity);
|
|
|
-// }else if (level == 4) {
|
|
|
-// levle_4.add(entity);
|
|
|
-// }else if (level == 5) {
|
|
|
-// levle_5.add(entity);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 添加 忠诚力量
|
|
|
-// if (StringUtils.isNotBlank(type)) {
|
|
|
-// if ("1".equals(type)){
|
|
|
-// loyal_1.add(entity);
|
|
|
-// } else {
|
|
|
-// loyal_2.add(entity);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// HashMap<Object, Object> result = new HashMap<>();
|
|
|
-// result.put("level_1", levle_1);
|
|
|
-// result.put("level_2", levle_2);
|
|
|
-// result.put("level_3", levle_3);
|
|
|
-// result.put("level_4", levle_4);
|
|
|
-// result.put("level_5", levle_5);
|
|
|
-// result.put("loyal_1", loyal_1);
|
|
|
-// result.put("loyal_2", loyal_2);
|
|
|
-//
|
|
|
-// return Result.success(result);
|
|
|
-// }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Result<ExpertEntity> webList(ExpertWebDto param) {
|
|
|
+ startPage(param);
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
sql.append("select * from tb_expert where is_delete = '0' and display=1 ");
|
|
|
- @NotBlank(message = "类型不能为空") String type = param.getType();
|
|
|
- String [] typeCheck = {"1","2","3","4","5","loyal_1","loyal_2"};
|
|
|
- if (!Arrays.asList(typeCheck).contains(type)) {
|
|
|
- return Result.failure("非法类型");
|
|
|
- }
|
|
|
- String key = typeMap.get(type);
|
|
|
- if (type.startsWith("loyal_")){
|
|
|
- sql.append(" and type='").append(key).append("'");
|
|
|
- } else {
|
|
|
- sql.append(" and level=").append(key);
|
|
|
+ String type = param.getType();
|
|
|
+ if (StringUtils.isNotBlank(type)){
|
|
|
+ String [] typeCheck = {"1","2","3","4","5","loyal_1","loyal_2"};
|
|
|
+ if (!Arrays.asList(typeCheck).contains(type)) {
|
|
|
+ return Result.failure("非法类型");
|
|
|
+ }
|
|
|
+ String key = typeMap.get(type);
|
|
|
+ if (type.startsWith("loyal_")){
|
|
|
+ sql.append(" and type='").append(key).append("'");
|
|
|
+ } else {
|
|
|
+ sql.append(" and level=").append(key);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
String searchKey = param.getSearchKey();
|
|
|
if (StringUtils.isNotBlank(searchKey)){
|
|
|
searchKey = RegexUtil.sqlReplaceSpecialStr(searchKey);
|
|
@@ -158,8 +116,9 @@ public class ExpertServiceImpl extends IBaseServiceImpl<ExpertEntity, Long> impl
|
|
|
sql.append(" order by sort, create_time desc");
|
|
|
log.info("sql: {}", sql.toString());
|
|
|
|
|
|
+ List<ExpertEntity> expertEntities = entityMapper.expertSql(sql.toString());
|
|
|
|
|
|
- return Result.success(entityMapper.expertSql(sql.toString()));
|
|
|
+ return Result.success(new PageInfo<>(expertEntities));
|
|
|
}
|
|
|
|
|
|
|