Commit 9c5afbc1 by liushuangwu

fix

1 parent f24b5258
...@@ -28,4 +28,6 @@ public interface PainDao { ...@@ -28,4 +28,6 @@ public interface PainDao {
List<Pain> findBackIndex(@Param(value = "index") Integer index, @Param(value = "limit") int limit); List<Pain> findBackIndex(@Param(value = "index") Integer index, @Param(value = "limit") int limit);
void deleteAllByFloor(int floor); void deleteAllByFloor(int floor);
List<Pain> findAllByFloor(int floor);
} }
package com.pipihelper.project.feishu.service; package com.pipihelper.project.feishu.service;
import cn.hutool.core.collection.CollectionUtil;
import com.pipihelper.project.feishu.dao.PainDao; import com.pipihelper.project.feishu.dao.PainDao;
import com.pipihelper.project.feishu.entity.Pain; import com.pipihelper.project.feishu.entity.Pain;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
@Service @Service
...@@ -37,6 +40,15 @@ public class PainService { ...@@ -37,6 +40,15 @@ public class PainService {
return painDao.findAll(); return painDao.findAll();
} }
public List<Pain> findAllReorderByFloor(int floor) {
List<Pain> painList = painDao.findAllByFloor(floor);
if (CollectionUtil.isEmpty(painList)) {
return new ArrayList<>();
}
painList.stream().sorted(Comparator.comparing(Pain::getIndex));
return new ArrayList<>();
}
public void waitPain(String openId) { public void waitPain(String openId) {
Pain pain = new Pain(); Pain pain = new Pain();
pain.setOpenId(openId); pain.setOpenId(openId);
...@@ -49,8 +61,8 @@ public class PainService { ...@@ -49,8 +61,8 @@ public class PainService {
return painDao.findListAsc(limit); return painDao.findListAsc(limit);
} }
public List<Pain> findBackIndex(Integer index,int limit) { public List<Pain> findBackIndex(Integer index, int limit) {
return painDao.findBackIndex(index,limit); return painDao.findBackIndex(index, limit);
} }
public void deleteAllByFloor(int floor) { public void deleteAllByFloor(int floor) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!