中控信息

This commit is contained in:
yanglei 2025-10-31 17:02:53 +08:00
parent c1142f711d
commit 2ffd81991e
14 changed files with 580 additions and 56 deletions

View File

@ -30,21 +30,6 @@ public class FeignEbikeEcuInfoVo {
*/
private String ecuCode;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
/**
* 删除状态
*/
private Boolean isDeleted;
/**
* 中控SN码
*/
@ -60,8 +45,23 @@ public class FeignEbikeEcuInfoVo {
*/
private Long createdBy;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 修改人
*/
private Long updateBy;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
/**
* 删除状态
*/
private Boolean isDeleted;
}

View File

@ -1,7 +1,18 @@
package com.cdzy.user.component;
import com.cdzy.common.model.CMDMsg;
import com.cdzy.user.mapper.EbikeCmdMapper;
import com.cdzy.user.mapper.EbikeParamMapper;
import com.cdzy.user.mapper.EbikeParamValueMapper;
import com.cdzy.user.model.entity.EbikeCmd;
import com.cdzy.user.model.entity.EbikeParam;
import com.cdzy.user.model.entity.EbikeParamValue;
import com.ebike.feign.model.vo.FeignEbikeEcuInfoVo;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.*;
/**
@ -23,11 +34,11 @@ public class EbikeCoreHandler {
* @param ebikeEcuInfo 中控信息
* @return 一致性返回
*/
// public CompletableFuture<String> executeCommand(FeignEbikeEcuInfo ebikeEcuInfo, String cmdCode, Long bikeId, String userId) {
// public CompletableFuture<String> executeCommand(FeignEbikeEcuInfoVo ebikeEcuInfo, String cmdCode, Long bikeId, String userId) {
// CompletableFuture<String> future = new CompletableFuture<>();
// CMDMsg cmdMsg = new CMDMsg();
// cmdMsg.setDeviceId(ebikeEcuInfo.getEcuSn());
// cmdMsg.setGroup(ebikeEcuInfo.getOperatorCode());
// cmdMsg.setOperatorId(ebikeEcuInfo.getOperatorId());
// String tid = UUID.randomUUID().toString().replace("-", "");
// String command = getCommand(cmdCode, tid);
// cmdMsg.setCommand(command);
@ -46,5 +57,33 @@ public class EbikeCoreHandler {
// }, 5, TimeUnit.SECONDS);
// return future;
// }
//
//
// /**
// * 获取命令
// *
// * @param cmdCode 命令标识
// * @param tid 任务id
// * @return 命令json字符串
// */
// String getCommand(String cmdCode, String tid) {
// EbikeCmdMapper cmdMapper = SpringContextHolder.getBean(EbikeCmdMapper.class);
// EbikeParamMapper paramMapper = SpringContextHolder.getBean(EbikeParamMapper.class);
// EbikeParamValueMapper paramValueMapper = SpringContextHolder.getBean(EbikeParamValueMapper.class);
// QueryWrapper queryWrapper = QueryWrapper.create()
// .where(EBIKE_CMD.CMD_CODE.eq(cmdCode));
// EbikeCmd ebikeCmd = cmdMapper.selectOneByQuery(queryWrapper);
//
// queryWrapper.clear();
// queryWrapper.where(EBIKE_PARAM.CMD_ID.eq(ebikeCmd.getCmdId()))
// .orderBy(EBIKE_PARAM.PARAM_NAME, false);
// List<EbikeParam> ebikeParams = paramMapper.selectListByQuery(queryWrapper);
// List<Long> list = ebikeParams.stream().map(EbikeParam::getParamId).toList();
// queryWrapper.clear();
// queryWrapper.where(EBIKE_PARAM_VALUE.PARAM_ID.in(list));
// List<EbikeParamValue> ebikeParamValues = paramValueMapper.selectListByQuery(queryWrapper);
// return montageCommand(ebikeParams, ebikeParamValues, tid);
// }
}

View File

@ -0,0 +1,25 @@
package com.cdzy.user.component;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* @author attiya
* @since 2025-03-18
*/
@Component
public class SpringContextHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
SpringContextHolder.applicationContext = applicationContext;
}
public static <T> T getBean(Class<T> beanClass) {
return applicationContext.getBean(beanClass);
}
}

View File

@ -1,8 +1,8 @@
package com.cdzy.user.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.cdzy.common.model.request.PageParam;
import com.cdzy.common.model.response.JsonResult;
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
import com.cdzy.user.model.entity.EbikeOrder;
import com.cdzy.user.service.EbikeOrderService;
import com.ebike.feign.model.dto.FeignOrderPaymentDto;
@ -29,7 +29,7 @@ import static com.cdzy.user.model.entity.table.EbikeOrderTableDef.EBIKE_ORDER;
public class EbikeOrderController {
@Resource
private EbikeOrderService ebikeOrderTransactionService;
private EbikeOrderService ebikeOrderService;
/**
* 开始骑行生成订单开锁
@ -37,11 +37,11 @@ public class EbikeOrderController {
* @param orderDto 骑行信息
* @ {@code 200} 添加成功{@code 500} 添加失败
*/
// @PostMapping("saveRide")
// public JsonResult<?> saveRide(@RequestBody @Validated EbikeUserCyclingDto orderDto) {
// Long orderId = ebikeOrderTransactionService.saveRide(orderDto);
// return JsonResult.success(orderId);
// }
@PostMapping("saveRide")
public JsonResult<?> saveRide(@RequestBody @Validated EbikeUserCyclingDto orderDto) {
Long orderId = ebikeOrderService.saveRide(orderDto);
return JsonResult.success(orderId);
}
/**
* 查看用户是否有未完成订单
@ -51,7 +51,7 @@ public class EbikeOrderController {
*/
@GetMapping("checkHistoryOrder")
public JsonResult<?> checkHistoryOrder(@Validated @NotBlank(message = "用户id不能为空") @RequestParam("userId") Long userId) {
EbikeOrder userOrders = ebikeOrderTransactionService.checkHistoryOrder(userId);
EbikeOrder userOrders = ebikeOrderService.checkHistoryOrder(userId);
return JsonResult.success(userOrders);
}
@ -63,7 +63,7 @@ public class EbikeOrderController {
*/
@PostMapping("payment")
public JsonResult<?> payment(@RequestBody @Validated FeignOrderPaymentDto orderPaymentDto) {
ebikeOrderTransactionService.payment(orderPaymentDto);
ebikeOrderService.payment(orderPaymentDto);
return JsonResult.success();
}
@ -75,7 +75,7 @@ public class EbikeOrderController {
*/
@GetMapping("refundApply")
public JsonResult<?> refundApply(@RequestParam("orderId") Long orderId) {
ebikeOrderTransactionService.refundApply(orderId);
ebikeOrderService.refundApply(orderId);
return JsonResult.success();
}
@ -87,7 +87,7 @@ public class EbikeOrderController {
*/
@GetMapping("refund")
public JsonResult<?> refund(@RequestParam("orderId") Long orderId) {
ebikeOrderTransactionService.refund(orderId);
ebikeOrderService.refund(orderId);
return JsonResult.success();
}
@ -99,7 +99,7 @@ public class EbikeOrderController {
*/
@GetMapping("doneRefund")
public JsonResult<?> doneRefund(@RequestParam("orderId") Long orderId) {
ebikeOrderTransactionService.doneRefund(orderId);
ebikeOrderService.doneRefund(orderId);
return JsonResult.success();
}
@ -111,7 +111,7 @@ public class EbikeOrderController {
*/
@GetMapping("failRefund")
public JsonResult<?> failRefund(@RequestParam("orderId") Long orderId) {
ebikeOrderTransactionService.failRefund(orderId);
ebikeOrderService.failRefund(orderId);
return JsonResult.success();
}
@ -123,38 +123,35 @@ public class EbikeOrderController {
*/
@GetMapping("rejectRefund")
public JsonResult<?> rejectRefund(@RequestParam("orderId") Long orderId) {
ebikeOrderTransactionService.rejectRefund(orderId);
ebikeOrderService.rejectRefund(orderId);
return JsonResult.success();
}
/**
* 根据用户订单表主键获取详细信
*
* @param transactionId 用户订单表主键
* @param orderId 用户订单表主键
* @ 用户订单表详情
*/
@GetMapping("getInfo/{transactionId}")
public JsonResult<?> getInfo(@PathVariable("transactionId") Long transactionId) {
EbikeOrder userOrder = ebikeOrderTransactionService.getById(transactionId);
@GetMapping("getInfo/{orderId}")
public JsonResult<?> getInfo(@PathVariable("orderId") Long orderId) {
EbikeOrder userOrder = ebikeOrderService.getById(orderId);
return JsonResult.success(userOrder);
}
/**
* 分页查询用户用户订单
* 分页查询用户订单
*
* @param pageParam 分页对象
* @param orderStatus 订单状态
* @param pageParam 分页对象
* @ 分页对象
*/
@GetMapping("page")
public JsonResult<?> page(@Validated PageParam pageParam, @RequestParam(value = "orderStatus", required = false) Integer orderStatus) {
long userId = StpUtil.getLoginIdAsLong();
public JsonResult<?> page(@Validated PageParam pageParam, @RequestParam(value = "bikeId", required = false) Long bikeId) {
QueryWrapper queryWrapper = QueryWrapper.create()
.where(EBIKE_ORDER.USER_ID.eq(userId))
.where(EBIKE_ORDER.ORDER_STATUS.eq(orderStatus, Objects.nonNull(orderStatus)))
.orderBy(EBIKE_ORDER.CREATE_TIME, Boolean.TRUE);
Page<EbikeOrder> page = ebikeOrderTransactionService.page(pageParam.getPage(), queryWrapper);
.from(EBIKE_ORDER)
.where(EBIKE_ORDER.BIKE_ID.eq(bikeId, Objects.nonNull(bikeId)));
Page<EbikeOrder> page = ebikeOrderService.page(pageParam.getPage(), queryWrapper);
return JsonResult.success(page);
}
}

View File

@ -0,0 +1,26 @@
package com.cdzy.user.enums;
/**
* 订单支付方式 1-wechat 2-alipay 3-balance
*
* @author: yanglei
* @since: 2025-10-30 15:07
*/
public interface EbikePaymentMethod {
/**
* 微信支付
*/
int WECHAT = 1;
/**
* 阿里支付
*/
int ALIPAY = 2;
/**
* 余额支付
*/
int BALANCE = 3;
}

View File

@ -0,0 +1,14 @@
package com.cdzy.user.mapper;
import com.cdzy.user.model.entity.EbikeCmd;
import com.mybatisflex.core.BaseMapper;
/**
* 中控命令 映射层
*
* @author: yanglei
* @since: 2025-10-30 10:01
*/
public interface EbikeCmdMapper extends BaseMapper<EbikeCmd> {
}

View File

@ -0,0 +1,14 @@
package com.cdzy.user.mapper;
import com.cdzy.user.model.entity.EbikeParam;
import com.mybatisflex.core.BaseMapper;
/**
* 中控命令参数 映射层
*
* @author: yanglei
* @since: 2025-10-30 10:31
*/
public interface EbikeParamMapper extends BaseMapper<EbikeParam> {
}

View File

@ -0,0 +1,14 @@
package com.cdzy.user.mapper;
import com.cdzy.user.model.entity.EbikeParamValue;
import com.mybatisflex.core.BaseMapper;
/**
* 中控命令参数取值 映射层
*
* @author: yanglei
* @since: 2025-10-30 10:31
*/
public interface EbikeParamValueMapper extends BaseMapper<EbikeParamValue> {
}

View File

@ -0,0 +1,79 @@
package com.cdzy.user.model.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 中控命令 实体类
*
* @author: yanglei
* @since: 2025-10-30 09:58
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("ebike_cmd")
public class EbikeCmd implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@Id
private Long cmdId;
/**
* cmd命令名称
*/
private String cmdName;
/**
* cmd命令描述
*/
private String describe;
/**
* cmd命令编码
*/
private String cmdCode;
/**
* 创建人
*/
private Long createBy;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 更新人
*/
private Long updateBy;
/**
* 更新时间
*/
@Column(onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 删除状态true表示已删除
*/
private Boolean isDeleted;
}

View File

@ -0,0 +1,94 @@
package com.cdzy.user.model.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 中控命令参数 实体类
*
* @author: yanglei
* @since: 2025-10-30 10:21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("ebike_param")
public class EbikeParam implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID(参数id)
*/
@Id
private Long paramId;
/**
* 命令id
*/
private Long cmdId;
/**
* 参数名称
*/
private String paramName;
/**
* 参数描述
*/
private String paramDescribe;
/**
* 参数等级
*/
private Integer paramLevel;
/**
* 参数值类型 1从param_value表中取值2自生成3由prama子集构成json
*/
private Integer valueType;
/**
* 父级param_id
*/
private Long parentId;
/**
* 创建人
*/
private Long createBy;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 更新人
*/
private Long updateBy;
/**
* 更新时间
*/
@Column(onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 删除状态true表示已删除
*/
private Boolean isDeleted;
}

View File

@ -0,0 +1,74 @@
package com.cdzy.user.model.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 中控命令参数取值 实体类
*
* @author: yanglei
* @since: 2025-10-30 10:21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("ebike_param_value")
public class EbikeParamValue implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID(参数值id)
*/
@Id
private Long paramValueId;
/**
* 参数id
*/
private Long paramId;
/**
* 参数值
*/
private String paramValue;
/**
* 创建人
*/
private Long createBy;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 更新人
*/
private Long updateBy;
/**
* 更新时间
*/
@Column(onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 删除状态true表示已删除
*/
private Boolean isDeleted;
}

View File

@ -1,5 +1,6 @@
package com.cdzy.user.service;
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
import com.cdzy.user.model.entity.EbikeOrder;
import com.ebike.feign.model.dto.FeignOrderPaymentDto;
import com.mybatisflex.core.service.IService;
@ -19,7 +20,7 @@ public interface EbikeOrderService extends IService<EbikeOrder> {
* @param orderDto 用户骑行信息
* @return 骑行订单
*/
// Long saveRide(EbikeUserCyclingDto orderDto);
Long saveRide(EbikeUserCyclingDto orderDto);
/**
* 检查历史订单

View File

@ -4,6 +4,7 @@ import com.cdzy.common.enums.BikeUsageStatus;
import com.cdzy.common.enums.Code;
import com.cdzy.common.model.dto.ResGPSDto;
import com.cdzy.common.model.response.JsonResult;
import com.cdzy.user.component.EbikeCoreHandler;
import com.cdzy.user.enums.EbikeRegionInOperation;
import com.cdzy.user.enums.OrderStatus;
import com.cdzy.user.enums.OrderType;
@ -18,6 +19,9 @@ import com.ebike.feign.model.vo.FeignEbikeBikeInfoVo;
import com.ebike.feign.model.vo.FeignEbikeConfigurationVo;
import com.ebike.feign.model.vo.FeignEbikeEcuInfoVo;
import com.ebike.feign.model.vo.FeignEbikeRegionVo;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
@ -43,8 +47,8 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
@Resource
private RedisUtil redisUtil;
//@Resource
//private EbikeCoreHandler ebikeCoreHandler;
@Resource
private EbikeCoreHandler ebikeCoreHandler;
@Resource
private EbikeOrderMapper ebikeOrderTransactionMapper;
@ -52,8 +56,11 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
@Resource
private OperationsFeignClient operationsFeignClient;
// @Override
// public Long saveRide(EbikeUserCyclingDto orderDto) {
@Resource
private ObjectMapper objectMapper;
@Override
public Long saveRide(EbikeUserCyclingDto orderDto) {
// Long userId = orderDto.getUserId();
// // 校验用户当前是否存在订单
// EbikeOrder history = checkHistoryOrder(userId);
@ -88,8 +95,10 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
// if (configurationVo == null || Objects.equals(configurationVo.getIsOperate(), EbikeRegionInOperation.OUT)) {
// throw new RuntimeException("当前运营区已停止运营");
// }
// String jsonString = JSONObject.toJSONString(redisUtil.get(ecuInfo.getEcuSn()));
// ResGPSDto resGpsDto = JSONObject.parseObject(jsonString, ResGPSDto.class);
//
// // 使用 Jackson 替换 FastJSON
// Object redisData = redisUtil.get(ecuInfo.getEcuSn());
// ResGPSDto resGpsDto = objectMapper.convertValue(redisData, ResGPSDto.class);
// boolean pointInOperation = redisUtil.isPointInOperation(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOrgId(), regionDto.getOperationRegionId());
// if (!pointInOperation) {
// throw new RuntimeException("当前车辆在运营区外");
@ -98,10 +107,16 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
// //开锁,并且等待结果
// CompletableFuture<String> stringCompletableFuture = ebikeCoreHandler.executeCommand(ecuInfo, CmdCode.UNLOCK, Long.valueOf(bikeInfoDto.getBikeId()), userId);
// String response = stringCompletableFuture.join();
// JSONObject jsonObject = JSONObject.parseObject(response);
// if (jsonObject.getInteger("code") != 0) {
// throw new RuntimeException("开锁失败");
//
// try {
// JsonNode jsonNode = objectMapper.readTree(response);
// if (!jsonNode.has("code") || jsonNode.get("code").asInt() != 0) {
// throw new RuntimeException("开锁失败");
// }
// } catch (JsonProcessingException e) {
// throw new RuntimeException("开锁响应解析失败", e);
// }
//
// //添加借车单量
// Long siteRegionId = redisUtil.isPointInSiteWithSiteRegionId(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOperationRegionId());
// operationsFeignClient.addBorrowing(siteRegionId);
@ -112,7 +127,8 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
// ebikeOrderTransactionMapper.insert(userOrders);
// //处理车辆
// return userOrders.getOrderId();
// }
return null;
}
@Override
public EbikeOrder checkHistoryOrder(Long userId) {

View File

@ -73,6 +73,31 @@ CREATE SEQUENCE IF NOT EXISTS ebike_fault_report_report_id_seq
MAXVALUE 9223372036854775807
CACHE 1;
-- 创建 ebike_cmd_cmd_id_seq 序列
CREATE SEQUENCE IF NOT EXISTS ebike_cmd_cmd_id_seq
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
-- 创建 ebike_param_param_id_seq 序列
CREATE SEQUENCE IF NOT EXISTS ebike_param_param_id_seq
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
-- 创建 ebike_param_value_value_id_seq 序列
CREATE SEQUENCE IF NOT EXISTS ebike_param_value_value_id_seq
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
-- ----------------------------
@ -389,6 +414,88 @@ COMMENT ON COLUMN "public"."ebike_fault_report"."update_by" IS '最后修改人I
COMMENT ON COLUMN "public"."ebike_fault_report"."update_time" IS '最后修改时间';
COMMENT ON TABLE "public"."ebike_fault_report" IS '用户上报故障信息表';
-- ----------------------------
-- Table structure for ebike_cmd
-- ----------------------------
DROP TABLE IF EXISTS "public"."ebike_cmd";
CREATE TABLE "public"."ebike_cmd" (
"cmd_id" int8 NOT NULL DEFAULT nextval('ebike_cmd_cmd_id_seq'::regclass),
"cmd_name" varchar(50) COLLATE "pg_catalog"."default",
"cmd_describe" varchar(200) COLLATE "pg_catalog"."default",
"cmd_code" varchar(30) COLLATE "pg_catalog"."default",
"create_by" int8,
"create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"update_by" int8,
"update_time" timestamp(6),
"is_deleted" bool NOT NULL DEFAULT false
);
COMMENT ON COLUMN "public"."ebike_cmd"."cmd_id" IS '主键ID';
COMMENT ON COLUMN "public"."ebike_cmd"."cmd_name" IS 'cmd命令名称';
COMMENT ON COLUMN "public"."ebike_cmd"."cmd_describe" IS 'cmd命令描述';
COMMENT ON COLUMN "public"."ebike_cmd"."cmd_code" IS 'cmd命令编号';
COMMENT ON COLUMN "public"."ebike_cmd"."create_by" IS '创建人ID';
COMMENT ON COLUMN "public"."ebike_cmd"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."ebike_cmd"."update_by" IS '最后修改人ID';
COMMENT ON COLUMN "public"."ebike_cmd"."update_time" IS '最后修改时间';
COMMENT ON TABLE "public"."ebike_cmd" IS '中控命令表';
-- ----------------------------
-- Table structure for ebike_param
-- ----------------------------
DROP TABLE IF EXISTS "public"."ebike_param";
CREATE TABLE "public"."ebike_param" (
"param_id" int8 NOT NULL DEFAULT nextval('ebike_param_param_id_seq'::regclass),
"cmd_id" int8 NOT NULL,
"param_name" varchar(50) COLLATE "pg_catalog"."default",
"param_describe" varchar(200) COLLATE "pg_catalog"."default",
"param_level" int2 NOT NULL,
"value_type" int2 NOT NULL,
"parent_id" int8,
"create_by" int8,
"create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"update_by" int8,
"update_time" timestamp(6),
"is_deleted" bool NOT NULL DEFAULT false
);
COMMENT ON COLUMN "public"."ebike_param"."param_id" IS '主键ID(参数id)';
COMMENT ON COLUMN "public"."ebike_param"."cmd_id" IS 'cmd主键Id';
COMMENT ON COLUMN "public"."ebike_param"."param_name" IS '命令参数名称';
COMMENT ON COLUMN "public"."ebike_param"."param_describe" IS '命令参数描述';
COMMENT ON COLUMN "public"."ebike_param"."param_level" IS '命令参数等级';
COMMENT ON COLUMN "public"."ebike_param"."value_type" IS '命令参数类型 1、从param_value表中取值2、自生成3、由prama子集构成json';
COMMENT ON COLUMN "public"."ebike_param"."parent_id" IS '父级param_id';
COMMENT ON COLUMN "public"."ebike_param"."create_by" IS '创建人ID';
COMMENT ON COLUMN "public"."ebike_param"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."ebike_param"."update_by" IS '最后修改人ID';
COMMENT ON COLUMN "public"."ebike_param"."update_time" IS '最后修改时间';
COMMENT ON TABLE "public"."ebike_param" IS '中控命令参数表';
-- ----------------------------
-- Table structure for ebike_param_value
-- ----------------------------
DROP TABLE IF EXISTS "public"."ebike_param_value";
CREATE TABLE "public"."ebike_param_value" (
"param_value_id" int8 NOT NULL DEFAULT nextval('ebike_param_value_value_id_seq'::regclass),
"param_id" int8 NOT NULL,
"param_value" varchar(100) COLLATE "pg_catalog"."default",
"create_by" int8,
"create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"update_by" int8,
"update_time" timestamp(6),
"is_deleted" bool NOT NULL DEFAULT false
);
COMMENT ON COLUMN "public"."ebike_param_value"."param_value_id" IS '主键ID(参数值id)';
COMMENT ON COLUMN "public"."ebike_param_value"."param_id" IS '参数id';
COMMENT ON COLUMN "public"."ebike_param_value"."param_value" IS '参数值';
COMMENT ON COLUMN "public"."ebike_param_value"."create_by" IS '创建人ID';
COMMENT ON COLUMN "public"."ebike_param_value"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."ebike_param_value"."update_by" IS '最后修改人ID';
COMMENT ON COLUMN "public"."ebike_param_value"."update_time" IS '最后修改时间';
COMMENT ON TABLE "public"."ebike_param_value" IS '中控命令参数取值表';
-- ----------------------------
-- Primary Key structure for table ebike_user
-- ----------------------------
@ -465,3 +572,27 @@ ALTER TABLE "public"."ebike_fault_report" ADD CONSTRAINT "ebike_refund_report_pk
-- ----------------------------
CREATE INDEX idx_ebike_refund_report_bike_code ON public.ebike_fault_report (bike_code);
CREATE INDEX idx_ebike_refund_report_operator_id ON public.ebike_fault_report (operator_id);
-- ----------------------------
-- Primary Key structure for table ebike_cmd
-- ----------------------------
ALTER TABLE "public"."ebike_cmd" ADD CONSTRAINT "ebike_cmd_cmd_pkey" PRIMARY KEY ("cmd_id");
-- ----------------------------
-- Primary Key structure for table ebike_param
-- ----------------------------
ALTER TABLE "public"."ebike_param" ADD CONSTRAINT "ebike_param_param_pkey" PRIMARY KEY ("param_id");
-- ----------------------------
-- Index structure for table ebike_param
-- ----------------------------
CREATE INDEX idx_ebike_param_cmd_id ON public.ebike_param (cmd_id);
-- ----------------------------
-- Primary Key structure for table ebike_param_value
-- ----------------------------
ALTER TABLE "public"."ebike_param_value" ADD CONSTRAINT "ebike_param_value_value_pkey" PRIMARY KEY ("param_value_id");
-- ----------------------------
-- Index structure for table ebike_param_value
-- ----------------------------
CREATE INDEX idx_ebike_param_value_param_id ON public.ebike_param_value (param_id);