fetch:我的板块bug
This commit is contained in:
@@ -247,6 +247,7 @@ public class SarMenuServiceImpl extends ServiceImpl<SarMenuDao, SarMenu> impleme
|
||||
if(menuIds!=null&&menuIds.size()>0){
|
||||
QueryWrapper<SarMenu> sarMenuQueryWrapper=new QueryWrapper<>();
|
||||
sarMenuQueryWrapper.in("id",menuIds);
|
||||
sarMenuQueryWrapper.isNull("parent_id");
|
||||
return dao.selectList(sarMenuQueryWrapper);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
|
||||
+3
@@ -118,7 +118,10 @@ public class SarUserPersonalMenuServiceImpl extends ServiceImpl<SarUserPersonalM
|
||||
List<String> userIds=tsUserService.getUserIdsByRoleId(roleId);
|
||||
for(String userId:userIds){
|
||||
List<SarMenu> menus=tsUserService.getMenusByUserId(userId);
|
||||
System.out.println("我的板块");
|
||||
System.out.println(menus);
|
||||
updateUserPersonalMenuForRole(menus,userId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarUrl.controller;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarUrl.entity.OrderUrlVO;
|
||||
import com.adc.da.slrs.sarUrl.entity.TsUrl;
|
||||
import com.adc.da.slrs.sarUrl.service.ITsUrlService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -50,6 +51,8 @@ public class TsUrlController{
|
||||
@ApiOperation(value="第三方链接-添加", notes="第三方链接-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseMessage<?> add(@RequestBody TsUrl tsUrl) {
|
||||
int orderBy=tsUrlService.getMaxOrderBy();
|
||||
tsUrl.setOrderBy(orderBy+1);
|
||||
tsUrlService.save(tsUrl);
|
||||
return Result.success();
|
||||
}
|
||||
@@ -110,4 +113,9 @@ public class TsUrlController{
|
||||
return Result.success(tsUrl);
|
||||
}
|
||||
|
||||
@ApiOperation("排序")
|
||||
@PostMapping("/order")
|
||||
public ResponseMessage<Object> orderUrl(@RequestBody List<OrderUrlVO> orderUrlVOList){
|
||||
return tsUrlService.orderUrl(orderUrlVOList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarUrl.dao;
|
||||
|
||||
import com.adc.da.slrs.sarUrl.entity.TsUrl;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @Description: 第三方链接
|
||||
@@ -12,4 +13,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface TsUrlDao extends BaseMapper<TsUrl> {
|
||||
|
||||
/**
|
||||
* 获取最大排序号
|
||||
* @return int
|
||||
*/
|
||||
@Select("select max(order_by) from ts_url")
|
||||
int getMaxOrderBy();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.adc.da.slrs.sarUrl.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderUrlVO {
|
||||
private String urlId;
|
||||
private Integer orderBy;
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.adc.da.slrs.sarUrl.service;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.sarUrl.entity.OrderUrlVO;
|
||||
import com.adc.da.slrs.sarUrl.entity.TsUrl;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 第三方链接
|
||||
* @Author: jeecg-boot
|
||||
@@ -12,4 +16,16 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface ITsUrlService extends IService<TsUrl> {
|
||||
|
||||
/**
|
||||
* 获取最大排序号
|
||||
* @return int
|
||||
*/
|
||||
int getMaxOrderBy();
|
||||
|
||||
/**
|
||||
* 排序
|
||||
* @param orderUrlVOList:id和orderBy
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
ResponseMessage<Object> orderUrl(List<OrderUrlVO> orderUrlVOList);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
package com.adc.da.slrs.sarUrl.service.impl;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarUrl.dao.TsUrlDao;
|
||||
import com.adc.da.slrs.sarUrl.entity.OrderUrlVO;
|
||||
import com.adc.da.slrs.sarUrl.entity.TsUrl;
|
||||
import com.adc.da.slrs.sarUrl.service.ITsUrlService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 第三方链接
|
||||
* @Author: jeecg-boot
|
||||
@@ -15,5 +23,40 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class TsUrlServiceImpl extends ServiceImpl<TsUrlDao, TsUrl> implements ITsUrlService {
|
||||
@Autowired
|
||||
private TsUrlDao tsUrlDao;
|
||||
|
||||
/**
|
||||
* 获取最大排序号
|
||||
* @return int
|
||||
*/
|
||||
@Override
|
||||
public int getMaxOrderBy() {
|
||||
return tsUrlDao.getMaxOrderBy();
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序
|
||||
* @param orderUrlVOList:id和orderBy
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<Object> orderUrl(List<OrderUrlVO> orderUrlVOList) {
|
||||
List<TsUrl> tsUrls=tsUrlDao.selectList(new QueryWrapper<>());
|
||||
if(orderUrlVOList.size()!=tsUrls.size()){
|
||||
return Result.error("请传入所有数据");
|
||||
}
|
||||
orderUrlVOList.sort(Comparator.comparing(OrderUrlVO::getUrlId));
|
||||
tsUrls.sort(Comparator.comparing(TsUrl::getId));
|
||||
for(int i=0;i<orderUrlVOList.size();i++){
|
||||
if(!orderUrlVOList.get(i).getOrderBy().equals(tsUrls.get(i).getOrderBy())){
|
||||
TsUrl tsUrl=tsUrls.get(i);
|
||||
tsUrl.setOrderBy(orderUrlVOList.get(i).getOrderBy());
|
||||
tsUrlDao.updateById(tsUrl);
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user