|
@@ -22,8 +22,6 @@ import com.gis.oss.util.FileUtils;
|
|
|
import com.gis.service.DirService;
|
|
|
import com.gis.service.FodderService;
|
|
|
import com.gis.service.WorkService;
|
|
|
-import com.github.pagehelper.Page;
|
|
|
-import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -406,8 +404,9 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
|
|
|
Long dirId = param.getDirId();
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
builder.append("( ");
|
|
|
- builder.append("select id,create_time,update_time,name, null as status, IFNULL(null,'dir') as type,user_id, null as icon,null as preview_icon, " +
|
|
|
- "null as file_name, null as file_size,null as scene_code,null as dpi,null as temp_id,parent_id as dir_id, null as dirName from tb_dir where is_delete=0") ;
|
|
|
+ builder.append("select id,create_time,update_time,name, null as status, IFNULL(null,'dir') as type,user_id, null as icon,null as preview_icon, " +
|
|
|
+ "null as file_name, null as file_size,null as oss_path, null as scene_code,null as dpi,null as temp_id,parent_id as dir_id, null as dirName, " +
|
|
|
+ "IFNULL(null, 1) as sortType from tb_dir where is_delete=0") ;
|
|
|
builder.append(" and user_id='").append(userName).append("'");
|
|
|
builder.append(" and type='").append(type).append("'");
|
|
|
if (dirId != null && dirId > 1){
|
|
@@ -418,12 +417,13 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
|
|
|
searchKey = RegexUtil.sqlReplaceSpecialStr(searchKey);
|
|
|
builder.append(" and name like '%").append(searchKey).append("%'");
|
|
|
}
|
|
|
- builder.append(" order By create_time desc");
|
|
|
|
|
|
- builder.append(" ) union all ( ");
|
|
|
+ builder.append(" ) union all ( ");
|
|
|
|
|
|
+ // 字段顺序要对应
|
|
|
builder.append("select a.id,a.create_time,a.update_time,a.name, a.status,a.type,a.user_id, a.icon,a.preview_icon, a.file_name, " +
|
|
|
- "a.file_size,a.scene_code,a.dpi,a.temp_id,a.dir_id, b.name as dirName from tb_fodder a left join tb_dir b on b.id=a.dir_id where a.is_delete=0");
|
|
|
+ "a.file_size, a.oss_path, a.scene_code,a.dpi,a.temp_id, a.dir_id, b.name as dirName, if(a.id=0, 2, 2) as sortType " +
|
|
|
+ "from tb_fodder a left join tb_dir b on b.id=a.dir_id where a.is_delete=0");
|
|
|
|
|
|
|
|
|
builder.append(" and a.user_id='").append(userName).append("'");
|
|
@@ -438,10 +438,12 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
|
|
|
searchKey = RegexUtil.sqlReplaceSpecialStr(searchKey);
|
|
|
builder.append(" and a.name like '%").append(searchKey).append("%'");
|
|
|
}
|
|
|
- builder.append(" order By a.create_time desc ");
|
|
|
|
|
|
|
|
|
- builder.append(" )");
|
|
|
+ builder.append(" ) ");
|
|
|
+
|
|
|
+ // union 只对最后的order by 起作用
|
|
|
+ builder.append(" order By sortType, create_time desc ");
|
|
|
|
|
|
this.startPage(param);
|
|
|
List<FodderVo> res = entityMapper.listAndDir(builder.toString());
|