Browse Source

#mybatis-plus不支持分页参数为-1

zhongwei
yang_shj 5 months ago
parent
commit
54c7e81473
  1. 13
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmModelController.java
  2. 15
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/ClockTypeController.java
  3. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java
  4. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectUserService.java
  5. 34
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
  6. 58
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java
  7. 17
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java
  8. 12
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectUserController.java
  9. 12
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/RouteController.java
  10. 3
      hzims-service/weather/src/main/java/com/hnac/hzims/weather/service/impl/StationServiceImpl.java

13
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmModelController.java

@ -18,6 +18,7 @@ import springfox.documentation.annotations.ApiIgnore;
import com.hnac.hzims.equipment.entity.EmModelEntity;
import com.hnac.hzims.equipment.service.IEmModelService;
import java.util.List;
import java.util.Map;
/**
@ -58,6 +59,18 @@ public class EmModelController extends BladeController {
return R.data(pages);
}
/**
* 分页 代码自定义代号
*/
@GetMapping("/models")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查询列表", notes = "传入em_model")
public R<List<EmModelEntity>> models(@RequestParam Map<String,Object> em_model) {
QueryWrapper<EmModelEntity> queryWrapper = Condition.getQueryWrapper( em_model, EmModelEntity.class);
return R.data(em_modelService.list(queryWrapper));
}
/**
* 新增 代码自定义代号
*/

15
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/ClockTypeController.java

@ -20,6 +20,7 @@ import springfox.documentation.annotations.ApiIgnore;
import com.hnac.hzinfo.inspect.ai.entity.ClockTypeEntity;
import com.hnac.hzinfo.inspect.ai.service.IClockTypeService;
import java.util.List;
import java.util.Map;
/**
@ -64,6 +65,20 @@ public class ClockTypeController extends BladeController {
return R.data(pages);
}
@GetMapping("/clockTypes")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "查询表盘类型列表", notes = "传入st_clock_type")
@ApiImplicitParams({
})
@OperationAnnotation(moduleName = "巡检管理", title = "智能巡检配置",
operatorType = OperatorType.MOBILE,
businessType = BusinessType.GENCODE,
action = "查询表盘类型列表")
public R<List<ClockTypeEntity>> clockTypes(@ApiIgnore @RequestParam Map<String,Object> st_clock_type) {
QueryWrapper<ClockTypeEntity> queryWrapper = Condition.getQueryWrapper( st_clock_type, ClockTypeEntity.class);
return R.data(st_clock_typeService.list(queryWrapper));
}
/**
* 新增 代码自定义代号
*/

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java

@ -57,4 +57,6 @@ public interface ObjectService extends IService<ObjectEntity> {
* @return
*/
Boolean submit(ObjectEntity object);
List<ObjectEntity> objects(ObjectEntity entity);
}

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectUserService.java

@ -3,6 +3,7 @@ package com.hnac.hzinfo.inspect.obj.services;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity;
import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListQuery;
import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListVO;
import java.util.List;
@ -15,4 +16,6 @@ import java.util.List;
public interface ObjectUserService extends IService<ObjectUserEntity> {
List<ObjectUserListQuery> getPageList(ObjectUserListQuery user);
List<ObjectUserListVO> users(ObjectUserListQuery content);
}

34
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java

@ -3,28 +3,29 @@ package com.hnac.hzinfo.inspect.obj.services.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.google.zxing.BarcodeFormat;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzinfo.inspect.Constants;
import com.hnac.hzinfo.inspect.obj.ObjectConstants;
import com.hnac.hzinfo.inspect.obj.entity.*;
import com.hnac.hzinfo.inspect.obj.mapper.InspectObjectMapper;
import com.hnac.hzinfo.inspect.obj.services.*;
import com.hnac.hzinfo.inspect.obj.utils.CodeUtils;
import com.hnac.hzinfo.inspect.obj.vo.*;
import com.hnac.hzinfo.inspect.obj.vo.ObjectDto;
import com.hnac.hzinfo.inspect.obj.vo.ObjectExcelInputVo;
import com.hnac.hzinfo.inspect.obj.vo.ObjectOfflineVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectContentDto;
import com.hnac.hzinfo.inspect.plan.PlanContants;
import com.hnac.hzinfo.inspect.utils.HtmlModule;
import com.hnac.hzinfo.inspect.utils.HtmltoPdf;
import com.hnac.hzinfo.inspect.utils.ZxingGenCode;
import org.springblade.core.log.exception.ServiceException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.hnac.hzinfo.inspect.obj.mapper.InspectObjectMapper;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@ -242,6 +243,29 @@ public class ObjectServiceImpl extends ServiceImpl<InspectObjectMapper, ObjectEn
}
/**
* 查询列表数据
* @param entity
* @return
*/
@Override
public List<ObjectEntity> objects(ObjectEntity entity) {
List<ObjectDto> objects = this.baseMapper.getList(entity);
if(CollectionUtil.isEmpty(objects)){
return new ArrayList<>();
}
return objects.stream().map(object ->{
ObjectEntity vo = BeanUtil.copy(object, ObjectEntity.class);
if(Func.isNotEmpty(object.getRealId())){
vo.setName(object.getOtherName());
vo.setAddress(Optional.ofNullable(object.getOtherAddress()).orElse(vo.getAddress()));
vo.setLgtd(Optional.ofNullable(object.getOtherLgtd()).orElse(vo.getLgtd()));
vo.setLttd(Optional.ofNullable(object.getOtherLttd()).orElse(vo.getLttd()));
}
return vo;
}).collect(Collectors.toList());
}
/**
* 根据巡检对象生成一条同名巡检模板
* @param object 巡检对象
*/

58
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java

@ -1,13 +1,26 @@
package com.hnac.hzinfo.inspect.obj.services.impl;
import com.hnac.hzinfo.inspect.obj.mapper.ObjectUserMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity;
import com.hnac.hzinfo.inspect.obj.mapper.ObjectUserMapper;
import com.hnac.hzinfo.inspect.obj.services.ObjectUserService;
import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListQuery;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListVO;
import lombok.RequiredArgsConstructor;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 服务实现类
@ -15,10 +28,51 @@ import java.util.List;
* @author Chill
*/
@Service
@RequiredArgsConstructor
public class ObjectUserServiceImpl extends ServiceImpl<ObjectUserMapper, ObjectUserEntity> implements ObjectUserService {
private final IUserClient userClient;
@Override
public List<ObjectUserListQuery> getPageList(ObjectUserListQuery user){
return this.baseMapper.getPageList(user);
}
/**
* 查询列表
* @param content
* @return
*/
@Override
public List<ObjectUserListVO> users(ObjectUserListQuery content) {
if(!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)){
content.setTenantId(AuthUtil.getTenantId());
}
List<ObjectUserListQuery> objectUsers = this.getPageList(content);
if(objectUsers.isEmpty()){
return new ArrayList<>();
}
R<List<User>> users = userClient.userListByCodeAndNameAndAccount(AuthUtil.getTenantId(),content.getUserCode(),content.getUserName(),content.getLoginName());
if(!users.isSuccess() || CollectionUtil.isEmpty(users.getData())){
return new ArrayList<>();
}
Map<Long,User> userMap = users.getData().stream().collect(Collectors.toMap(User::getId, Function.identity()));
return objectUsers.stream().map(objectUser->{
ObjectUserListVO builder = new ObjectUserListVO();
builder.setId(objectUser.getId());
builder.setObjCode(objectUser.getObjCode());
builder.setObjName(objectUser.getObjName());
builder.setTempCode(objectUser.getTempCode());
builder.setTempName(objectUser.getTempName());
User user = userMap.get(objectUser.getUserId());
if(ObjectUtil.isNotEmpty(user)){
builder.setUserCode(user.getCode());
builder.setUserName(user.getRealName());
builder.setLoginName(user.getAccount());
builder.setUserId(user.getId());
}
return builder;
}).collect(Collectors.toList());
}
}

17
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java

@ -100,6 +100,23 @@ public class ObjectController extends BladeController {
return R.data(pages);
}
@GetMapping("/objects")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "巡检对象列表", notes = "巡检对象列表")
@Operate(label="查询巡检对象分页列表",type = BusinessType.QUERY,ignore = false)
public R<List<ObjectEntity>> objects(ObjectListQueryVO object) {
ObjectEntity entity = new ObjectEntity();
if(!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)){
entity.setTenantId(AuthUtil.getTenantId());
}
entity.setCode(object.getCode());
entity.setName(object.getName());
entity.setStatus(object.getStatus());
entity.setCreateDept(object.getCreateDept());
entity.setSupportAutoVideo(object.getSupportAutoVideo());
return R.data(objectService.objects(entity));
}
@GetMapping("/other_list_page")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "其他巡检对象列表-分页", notes = "其他巡检对象列表,分页")

12
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectUserController.java

@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@ -105,6 +106,17 @@ public class ObjectUserController {
return R.data(resultPage);
}
@GetMapping("/users")
@OperationAnnotation(moduleName = "巡检管理", title = "巡检配置",
operatorType = OperatorType.MOBILE,
businessType = BusinessType.GENCODE,
action = "查询巡检对象人员管理列表")
@ApiOperation(value = "巡检对象用户列表", notes = "巡检对象用户列表(跨服务查询)")
public R<List<ObjectUserListVO>> users(ObjectUserListQuery content) {
return R.data(objectUserService.users(content));
}
/**
* 新增
*/

12
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/RouteController.java

@ -71,6 +71,18 @@ public class RouteController extends BladeController {
return R.data(pages);
}
@GetMapping("/routes")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查询巡检路径列表", notes = "传入st_re_route")
@ApiImplicitParams({
})
@Operate(label = "查询巡检路径列表",type = BusinessType.QUERY,ignore = false)
public R<List<RouteEntity>> list(@ApiIgnore @RequestParam Map<String, Object> st_re_route) {
QueryWrapper<RouteEntity> queryWrapper = Condition.getQueryWrapper(st_re_route, RouteEntity.class);
queryWrapper.orderByDesc("create_time", "update_time");
return R.data(st_re_routeService.list(queryWrapper));
}
/**
* 新增 代码自定义代号
*/

3
hzims-service/weather/src/main/java/com/hnac/hzims/weather/service/impl/StationServiceImpl.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.hzimsweather.entity.VStationEntity;
import com.hnac.hzims.weather.mapper.StationMapper;
import com.hnac.hzims.weather.service.IStationService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringUtil;
@ -18,6 +19,7 @@ import java.util.List;
* @author hx
*/
@Service
@Slf4j
public class StationServiceImpl extends ServiceImpl<StationMapper, VStationEntity> implements IStationService {
@Override
@ -28,6 +30,7 @@ public class StationServiceImpl extends ServiceImpl<StationMapper, VStationEntit
}
List<VStationEntity> stationEntityList = this.list(lqw);
Assert.isTrue(CollectionUtil.isNotEmpty(stationEntityList),()->{
log.error("station_enetity :{}",stationCodes);
throw new ServiceException("站点编码对应站点未找到经纬度,查询失败!");
});
return stationEntityList;

Loading…
Cancel
Save