码表
This commit is contained in:
parent
08da7c2895
commit
3e1c4eec0f
@ -5,6 +5,8 @@ import com.cdzy.common.enums.Code;
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.common.model.PageParam;
|
||||
import com.cdzy.ebikeoperate.enums.EbikeRegionInOperation;
|
||||
import com.cdzy.ebikeoperate.enums.RegionLevelType;
|
||||
import com.cdzy.ebikeoperate.mapper.EbikeRegionLevelMapper;
|
||||
import com.cdzy.ebikeoperate.mapper.EbikeRegionoperationMapper;
|
||||
import com.cdzy.ebikeoperate.mapper.EbikeSiteTypeMapper;
|
||||
import com.cdzy.ebikeoperate.model.dto.request.ReqAuthorizeOperationDto;
|
||||
@ -34,6 +36,7 @@ import java.util.Objects;
|
||||
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeAdministrationZoneTableDef.EBIKE_ADMINISTRATION_ZONE;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeOperationRegionTableDef.EBIKE_OPERATION_REGION;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeRegionLevelTableDef.EBIKE_REGION_LEVEL;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeSiteRegionTableDef.EBIKE_SITE_REGION;
|
||||
|
||||
/**
|
||||
@ -66,6 +69,9 @@ public class EbikeRegionController {
|
||||
@Resource
|
||||
private EbikeSiteTypeMapper siteTypeMapper;
|
||||
|
||||
@Resource
|
||||
private EbikeRegionLevelMapper levelMapper;
|
||||
|
||||
/**
|
||||
* 添加运营区。
|
||||
*
|
||||
@ -195,6 +201,8 @@ public class EbikeRegionController {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.leftJoin(EBIKE_OPERATION_REGION).on(EBIKE_OPERATION_REGION.OPERATION_REGION_ID.eq(EBIKE_SITE_REGION.OPERATION_REGION_ID))
|
||||
.leftJoin(EBIKE_ADMINISTRATION_ZONE).on(EBIKE_ADMINISTRATION_ZONE.ID.eq(EBIKE_OPERATION_REGION.ZONE_ID))
|
||||
// .leftJoin(EBIKE_REGION_LEVEL).on(EBIKE_REGION_LEVEL.LEVEL_VALUE.eq(EBIKE_SITE_REGION.SITE_LEVEL))
|
||||
// .where(EBIKE_REGION_LEVEL.LEVEL_TYPE.eq(RegionLevelType.SITE))
|
||||
.where(EBIKE_ADMINISTRATION_ZONE.ID.eq(zoneId,StringUtil.hasText(zoneId)))
|
||||
.where(EBIKE_SITE_REGION.SITE_NAME.like(siteName, StringUtil.hasText(siteName)))
|
||||
.where(EBIKE_OPERATION_REGION.OPERATION_REGION_ID.eq(operationRegionDId, Objects.nonNull(operationRegionDId)));
|
||||
@ -357,4 +365,31 @@ public class EbikeRegionController {
|
||||
}
|
||||
return JsonResult.success(regions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取运营区等级列表
|
||||
*
|
||||
* @return 等级列表
|
||||
*/
|
||||
@GetMapping("operationLevelList")
|
||||
public JsonResult<?> operationLevelList() {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_REGION_LEVEL.LEVEL_TYPE.eq(RegionLevelType.OPERATION));
|
||||
List<EbikeRegionLevel> levels = levelMapper.selectListByQuery(queryWrapper);
|
||||
return JsonResult.success(levels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运站点等级列表
|
||||
*
|
||||
* @return 等级列表
|
||||
*/
|
||||
@GetMapping("siteLevelList")
|
||||
public JsonResult<?> siteLevelList() {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_REGION_LEVEL.LEVEL_TYPE.eq(RegionLevelType.SITE));
|
||||
List<EbikeRegionLevel> levels = levelMapper.selectListByQuery(queryWrapper);
|
||||
return JsonResult.success(levels);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.cdzy.ebikeoperate.enums;
|
||||
|
||||
/**
|
||||
* @author attiya
|
||||
* @since 2025-05-07
|
||||
*/
|
||||
public interface RegionLevelType {
|
||||
int OPERATION = 1;
|
||||
int SITE = 2;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cdzy.ebikeoperate.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cdzy.ebikeoperate.model.pojo.EbikeRegionLevel;
|
||||
|
||||
/**
|
||||
* 映射层。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-05-07
|
||||
*/
|
||||
public interface EbikeRegionLevelMapper extends BaseMapper<EbikeRegionLevel> {
|
||||
|
||||
}
|
||||
@ -78,5 +78,7 @@ public class EbikeOperationRegionPageDto {
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
private Integer level;
|
||||
private Integer operationLevel;
|
||||
|
||||
private String levelName;
|
||||
}
|
||||
|
||||
@ -87,6 +87,8 @@ public class ResOperationRegionInfo {
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
private Integer level;
|
||||
private Integer operationLevel;
|
||||
|
||||
private String levelName;
|
||||
|
||||
}
|
||||
|
||||
@ -89,6 +89,7 @@ public class EbikeOperationRegion implements Serializable {
|
||||
/**
|
||||
* 运营区是否运营中:1-是,0-否
|
||||
*/
|
||||
@Column(onInsertValue = "1")
|
||||
private Integer inOperation;
|
||||
|
||||
/**
|
||||
@ -100,6 +101,6 @@ public class EbikeOperationRegion implements Serializable {
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
private Integer level;
|
||||
private Integer operationLevel;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.cdzy.ebikeoperate.model.pojo;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 实体类。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-05-07
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("ebike_region_level")
|
||||
public class EbikeRegionLevel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 等级id
|
||||
*/
|
||||
@Id
|
||||
private Long levelId;
|
||||
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
private String levelName;
|
||||
|
||||
/**
|
||||
* 等级值
|
||||
*/
|
||||
private Integer levelValue;
|
||||
|
||||
/**
|
||||
* 等级类型:1、运营区等级 2、站点等级
|
||||
*/
|
||||
private Integer levelType;
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.common.model.PageParam;
|
||||
import com.cdzy.ebikeoperate.enums.EbikeRegionInOperation;
|
||||
import com.cdzy.ebikeoperate.enums.RegionLevelType;
|
||||
import com.cdzy.ebikeoperate.mapper.EbikeAdministrationZoneMapper;
|
||||
import com.cdzy.ebikeoperate.mapper.EbikeOperationRegionMapper;
|
||||
import com.cdzy.ebikeoperate.mapper.EbikePointMapper;
|
||||
@ -42,6 +43,7 @@ import java.util.*;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeAdministrationZoneTableDef.EBIKE_ADMINISTRATION_ZONE;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeOperationRegionTableDef.EBIKE_OPERATION_REGION;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikePointTableDef.EBIKE_POINT;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeRegionLevelTableDef.EBIKE_REGION_LEVEL;
|
||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeStaffRegionTableDef.EBIKE_STAFF_REGION;
|
||||
|
||||
/**
|
||||
@ -91,8 +93,10 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
@Override
|
||||
public Page<EbikeOperationRegionPageDto> pageOperationRegion(PageParam pageParam, String simpleName, String regionName, Integer inOperation) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(EBIKE_OPERATION_REGION.ALL_COLUMNS,EBIKE_ADMINISTRATION_ZONE.NAME.as(ResOperationRegionInfo::getZoneName))
|
||||
.select(EBIKE_OPERATION_REGION.ALL_COLUMNS,EBIKE_ADMINISTRATION_ZONE.NAME.as(ResOperationRegionInfo::getZoneName),EBIKE_REGION_LEVEL.LEVEL_NAME)
|
||||
.leftJoin(EBIKE_REGION_LEVEL).on(EBIKE_REGION_LEVEL.LEVEL_VALUE.eq(EBIKE_OPERATION_REGION.OPERATION_LEVEL))
|
||||
.leftJoin(EBIKE_ADMINISTRATION_ZONE).on(EBIKE_ADMINISTRATION_ZONE.ID.eq(EBIKE_OPERATION_REGION.ZONE_ID))
|
||||
.where(EBIKE_REGION_LEVEL.LEVEL_TYPE.eq(RegionLevelType.OPERATION))
|
||||
.where(EBIKE_OPERATION_REGION.SIMPLE_NAME.eq(simpleName, StringUtils.hasText(simpleName)))
|
||||
.where(EBIKE_OPERATION_REGION.OPERATION_REGION_NAME.eq(regionName, StringUtils.hasText(regionName)))
|
||||
.where(EBIKE_OPERATION_REGION.IN_OPERATION.eq(inOperation, Objects::nonNull));
|
||||
@ -102,9 +106,11 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
@Override
|
||||
public ResOperationRegionInfo operationRegionInfo(Long regionId) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(EBIKE_OPERATION_REGION.ALL_COLUMNS,EBIKE_ADMINISTRATION_ZONE.NAME.as(ResOperationRegionInfo::getZoneName))
|
||||
.select(EBIKE_OPERATION_REGION.ALL_COLUMNS,EBIKE_ADMINISTRATION_ZONE.NAME.as(ResOperationRegionInfo::getZoneName),EBIKE_REGION_LEVEL.LEVEL_NAME)
|
||||
.leftJoin(EBIKE_ADMINISTRATION_ZONE).on(EBIKE_ADMINISTRATION_ZONE.ID.eq(EBIKE_OPERATION_REGION.ZONE_ID))
|
||||
.where(EBIKE_OPERATION_REGION.OPERATION_REGION_ID.eq(regionId));
|
||||
.leftJoin(EBIKE_REGION_LEVEL).on(EBIKE_REGION_LEVEL.LEVEL_VALUE.eq(EBIKE_OPERATION_REGION.OPERATION_LEVEL))
|
||||
.where(EBIKE_OPERATION_REGION.OPERATION_REGION_ID.eq(regionId))
|
||||
.where(EBIKE_REGION_LEVEL.LEVEL_TYPE.eq(RegionLevelType.OPERATION));
|
||||
return this.mapper.selectOneWithRelationsByQueryAs(queryWrapper, ResOperationRegionInfo.class);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user