Commit 08e379c0 by huangjinxin

Merge remote-tracking branch 'origin/develop' into develop

2 parents 112e27de 0f7f122e
......@@ -6,6 +6,8 @@ import com.dituhui.pea.order.dto.BusinessServiceBlockAddReqDTO;
import com.dituhui.pea.order.dto.BusinessServiceBlockRemoveReqDTO;
import com.dituhui.pea.order.dto.BusinessServiceBlockUpdateReqDTO;
import com.dituhui.pea.order.service.BusinessBlockService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -26,16 +28,29 @@ public class BusinessBlockController {
* @param size 分页-页大小
* @param layerId 图层ID(筛选项)
* @param teamId 小队ID(筛选项)
* @param orderBy 排序字段 默认"teamId"
* @param direction 排序方向 desc降序/asc升序 默认"asc"
* @return
*/
@GetMapping("/business/service/block/list")
public Result<?> businessSeverBlocks(@RequestParam String levelType, @RequestParam String levelValue,
@RequestParam int page, @RequestParam int size,
@RequestParam(required = false) String layerId,
@RequestParam(required = false) String teamId) {
@RequestParam(required = false) String teamId,
@RequestParam(required = false) String orderBy,
@RequestParam(required = false) String direction
) {
if (StringUtils.isEmpty(teamId)) {
teamId = "teamId";
}
if (StringUtils.isEmpty(direction)) {
direction = "asc";
}
Result<?> res = null;
try {
res = businessBlockService.businessServerBlocks(levelType, levelValue, page, size, layerId, teamId);
res = businessBlockService.businessServerBlocks(levelType, levelValue, page, size, layerId, teamId, orderBy,
direction);
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
......
......@@ -4,7 +4,7 @@ import com.dituhui.pea.common.Result;
public interface BusinessBlockService {
Result<?> businessServerBlocks(String levelType, String levelValue, int page, int size, String layerId, String teamId);
Result<?> businessServerBlocks(String levelType, String levelValue, int page, int size, String layerId, String teamId, String orderBy, String direction);
Result<?> businessServiceBlockAdd(String layerId, String teamId);
......
......@@ -62,7 +62,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
private EncryptionUtil encryptionUtil;
@Override
public Result<?> businessServerBlocks(String levelType, String levelValue, int page, int size, String layerId, String teamId) {
public Result<?> businessServerBlocks(String levelType, String levelValue, int page, int size, String layerId, String teamId, String orderBy, String direction) {
BusinessServerBlocksRespDTO resp = new BusinessServerBlocksRespDTO();
List<OrgTeamEntity> teams = new ArrayList<>();
......@@ -116,7 +116,19 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
}
return criteriaBuilder.and(statusPredicate, teamIdPredicate, layerIdPredicate);
};
Sort sort = Sort.by(Sort.Order.asc("teamId"));
Sort sort = null;
switch (direction) {
case "asc":
case "ASC":
case "Asc":
sort = Sort.by(Sort.Order.asc(orderBy));
break;
case "desc":
case "DESC":
case "Desc":
sort = Sort.by(Sort.Order.desc(orderBy));
break;
}
PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
Page<MapBlockInfoEntity> pg = mapBlockInfoDao.findAll(specification, pageRequest);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!