项目置顶
This commit is contained in:
+3
-1
@@ -47,7 +47,9 @@
|
||||
plb.parent_id,
|
||||
plb.project_version,
|
||||
plb.explanation,
|
||||
plb.software_version
|
||||
plb.software_version,
|
||||
plb.sort,
|
||||
plb.flag
|
||||
from project_library_base as plb
|
||||
left join project_name_info as pni on plb.project_name_id=pni.id
|
||||
left join sys_user as studiouser on plb.studio_engineer=studiouser.id
|
||||
|
||||
+11
-5
@@ -2,6 +2,7 @@ package com.jero.modules.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
@@ -981,11 +982,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
|
||||
@Override
|
||||
public void top(String id, String flag) {
|
||||
ProjectLibraryBase projectLibraryBase = this.getById(id);
|
||||
//置顶的时候将取消置顶标识传过来即:flag=1
|
||||
if(TopEnum.TOP_CANCEL.getValue().equals(flag)){
|
||||
//取消置顶
|
||||
projectLibraryBase.setSort(null);
|
||||
projectLibraryBase.setFlag(null);
|
||||
}else{
|
||||
//置顶
|
||||
LambdaQueryWrapper<ProjectLibraryBase> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.isNotNull(ProjectLibraryBase::getSort).orderByDesc(ProjectLibraryBase::getSort);
|
||||
@@ -995,11 +993,19 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
|
||||
int sortTemp = Integer.valueOf(sort) + 1;
|
||||
projectLibraryBase.setSort(String.valueOf(sortTemp));
|
||||
}else{
|
||||
//首个置顶的项目排序为1
|
||||
projectLibraryBase.setSort("1");
|
||||
}
|
||||
projectLibraryBase.setFlag(TopEnum.TOP_CANCEL.getValue());
|
||||
this.updateById(projectLibraryBase);
|
||||
|
||||
}else{
|
||||
//取消置顶
|
||||
LambdaUpdateWrapper<ProjectLibraryBase> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.in(ProjectLibraryBase::getId,id);
|
||||
updateWrapper.set(ProjectLibraryBase::getSort,null).set(ProjectLibraryBase::getFlag,null);
|
||||
this.update(projectLibraryBase,updateWrapper);
|
||||
}
|
||||
this.updateById(projectLibraryBase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user