个人桩启动充电

This commit is contained in:
Guoqs
2024-06-20 16:36:25 +08:00
parent c6aa654052
commit 58710aedf3
16 changed files with 213 additions and 83 deletions

View File

@@ -9,13 +9,9 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.CreateReservedDTO;
import com.jsowell.pile.dto.PileReservedDTO;
import com.jsowell.pile.dto.PileMemberBindingDTO;
import com.jsowell.pile.dto.QueryPersonPileDTO;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.service.PileBasicInfoService;
import com.jsowell.pile.service.PileMerchantInfoService;
import com.jsowell.pile.vo.PileReservedVO;
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
import com.jsowell.pile.vo.uniapp.PersonPileRealTimeVO;
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
@@ -252,7 +248,27 @@ public class PersonPileController extends BaseController {
/**
* 个人桩启动充电
* http://localhost:8080/uniapp/personalPile/startPersonalPileCharging
*/
@PostMapping("/startPersonalPileCharging")
public RestApiResponse<?> startPersonalPileCharging(HttpServletRequest request, @RequestBody StartPersonPileDTO dto) {
RestApiResponse<?> response = null;
try {
String memberId = getMemberIdByAuthorization(request);
dto.setMemberId(memberId);
String orderCode = pileService.startPersonalPileCharging(dto);
response = new RestApiResponse<>(ImmutableMap.of("orderCode", orderCode));
} catch (BusinessException e) {
logger.error("个人桩启动充电error, params:{}", dto, e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("个人桩启动充电error, params:{}", dto, e);
response = new RestApiResponse<>(ReturnCodeEnum.CODE_CREATE_RESERVED_ERROR);
}
logger.info("个人桩启动充电params:{}, result:{}", dto, response);
return response;
}
/**
* 添加预约充电
@@ -283,7 +299,7 @@ public class PersonPileController extends BaseController {
* http://localhost:8080/uniapp/personalPile/queryReservedList
*/
@PostMapping("/queryReservedList")
public RestApiResponse<?> queryReservedList(HttpServletRequest request, @RequestBody PileReservedDTO dto) {
public RestApiResponse<?> queryReservedList(HttpServletRequest request, @RequestBody PileReservationDTO dto) {
// logger.info("修改预约充电状态params:{}", dto);
RestApiResponse<?> response = null;
try {
@@ -307,7 +323,7 @@ public class PersonPileController extends BaseController {
* http://localhost:8080/uniapp/personalPile/updateReservedStatus
*/
@PostMapping("/updateReservedStatus")
public RestApiResponse<?> updateReservedStatus(HttpServletRequest request, @RequestBody PileReservedDTO dto) {
public RestApiResponse<?> updateReservedStatus(HttpServletRequest request, @RequestBody PileReservationDTO dto) {
// logger.info("修改预约充电状态params:{}", dto);
RestApiResponse<?> response = null;
try {
@@ -326,5 +342,29 @@ public class PersonPileController extends BaseController {
return response;
}
/**
* 删除预约
* http://localhost:8080/uniapp/personalPile/deleteReservation
*/
@PostMapping("/deleteReservation")
public RestApiResponse<?> deleteReservation(HttpServletRequest request, @RequestBody PileReservationDTO dto) {
// logger.info("修改预约充电状态params:{}", dto);
RestApiResponse<?> response = null;
try {
String memberId = getMemberIdByAuthorization(request);
dto.setMemberId(memberId);
pileService.deleteReservation(dto);
response = new RestApiResponse<>();
} catch (BusinessException e) {
logger.error("修改预约充电状态error, params:{}", dto, e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("修改预约充电状态error, params:{}", dto, e);
response = new RestApiResponse<>(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_ERROR);
}
logger.info("修改预约充电状态params:{}, result:{}", dto, response);
return response;
}
}

View File

@@ -4,17 +4,15 @@ import com.alibaba.fastjson2.JSON;
import com.jsowell.adapay.dto.BalancePaymentRequestDTO;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.DateUtils;
import com.jsowell.pile.domain.AdapayMemberAccount;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.ykcCommond.ReservedChargingCommand;
import com.jsowell.pile.domain.ykcCommond.ReservationChargingCommand;
import com.jsowell.pile.dto.ApplyRefundDTO;
import com.jsowell.pile.dto.CarVinDTO;
import com.jsowell.pile.dto.QueryOrderDTO;
@@ -81,12 +79,12 @@ public class TempController extends BaseController {
* http://localhost:8080/temp/reservedChargingTest
*/
@PostMapping("reservedChargingTest")
public RestApiResponse<?> reservedChargingTest(@RequestBody ReservedChargingCommand command) {
public RestApiResponse<?> reservedChargingTest(@RequestBody ReservationChargingCommand command) {
logger.info("发送预约充电指令, command:{}", JSON.toJSONString(command));
RestApiResponse<?> response = null;
try {
// 发送预约充电指令
pileRemoteService.reservedCharging(command);
pileRemoteService.reservationCharging(command);
response = new RestApiResponse<>(ReturnCodeEnum.CODE_SUCCESS);
} catch (BusinessException e) {
logger.warn("预约充电测试warn", e);

View File

@@ -561,7 +561,7 @@ public class PileService {
* 修改预约充电状态
* @param dto
*/
public void updateReservedStatus(PileReservedDTO dto) {
public void updateReservedStatus(PileReservationDTO dto) {
if (StringUtils.equals(dto.getStatus(), Constants.ZERO)) {
// 停用
pileReservationInfoService.deactivateReserved(dto);
@@ -582,10 +582,10 @@ public class PileService {
// reservedInfo.setEndTime(DateUtils.parseDate(dto.getEndTime()));
reservedInfo.setEndTime(Time.valueOf(dto.getEndTime()));
if (StringUtils.isNotBlank(dto.getFreq())) {
reservedInfo.setReservedType("recurring");
reservedInfo.setReservationType("recurring");
reservedInfo.setFreq(dto.getFreq());
} else {
reservedInfo.setReservedType("single");
reservedInfo.setReservationType("single");
reservedInfo.setFreq(null);
}
reservedInfo.setCreateBy(dto.getMemberId());
@@ -593,7 +593,7 @@ public class PileService {
return reservedInfo.getId();
}
public PageResponse queryReservedList(PileReservedDTO dto) {
public PageResponse queryReservedList(PileReservationDTO dto) {
int pageNo = dto.getPageNo() == null ? Constants.one : dto.getPageNo();
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
PageHelper.startPage(pageNo, pageSize);
@@ -622,4 +622,18 @@ public class PileService {
pageResponse.setList(resultList);
return pageResponse;
}
public void deleteReservation(PileReservationDTO dto) {
pileReservationInfoService.deleteReservation(dto);
}
/**
* 个人桩启动充电
* @param dto
* @return
*/
public String startPersonalPileCharging(StartPersonPileDTO dto) {
String orderCode = "";
return orderCode;
}
}

View File

@@ -45,7 +45,7 @@ public class PileReservationInfo {
/**
* 预约类型,单次 (single) 或周期性 (recurring)
*/
private String reservedType;
private String reservationType;
/**
* 预约开始时间

View File

@@ -17,7 +17,7 @@ import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ReservedChargingCommand {
public class ReservationChargingCommand {
/**
* 交易流水号
*/

View File

@@ -7,7 +7,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@Getter
@Setter
public class PileReservedDTO {
public class PileReservationDTO {
/**
* 会员id
*/

View File

@@ -1,6 +1,8 @@
package com.jsowell.pile.dto;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 查询个人桩相关信息DTO
@@ -34,4 +36,15 @@ public class QueryPersonPileDTO {
private Integer pageNum;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("memberId", memberId)
.append("pileConnectorCode", pileConnectorCode)
.append("startTime", startTime)
.append("endTime", endTime)
.append("pageSize", pageSize)
.append("pageNum", pageNum)
.toString();
}
}

View File

@@ -0,0 +1,24 @@
package com.jsowell.pile.dto;
import lombok.Data;
@Data
public class StartPersonPileDTO {
/**
* 充电桩枪口编号
*/
private String pileConnectorCode;
/**
* 启动类型
* @see com.jsowell.common.enums.ykc.StartTypeEnum
*/
private String startType;
private String memberId;
private String startTime;
private String endTime;
}

View File

@@ -32,4 +32,6 @@ public interface PileReservationInfoMapper {
List<PileReservationInfo> findByMemberIdAndPileSnAndStatus(@Param("memberId") String memberId, @Param("pileSn") String pileSn, @Param("status") String status);
List<PileReservationInfo> findByMemberIdAndPileSn(@Param("memberId") String memberId, @Param("pileSn") String pileSn);
PileReservationInfo selectActiveReservationByPileConnectorCode(String pileConnectorCode);
}

View File

@@ -2,7 +2,6 @@ package com.jsowell.pile.service;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
@@ -290,7 +289,7 @@ public class PileRemoteService {
/**
* 预约充电指令
*/
public void reservedCharging(ReservedChargingCommand command) {
ykcPushCommandService.pushReservedChargingCommand(command);
public void reservationCharging(ReservationChargingCommand command) {
ykcPushCommandService.pushReservationChargingCommand(command);
}
}

View File

@@ -2,7 +2,7 @@ package com.jsowell.pile.service;
import java.util.List;
import com.jsowell.pile.dto.PileReservedDTO;
import com.jsowell.pile.dto.PileReservationDTO;
import com.jsowell.pile.domain.PileReservationInfo;
public interface PileReservationInfoService {
@@ -34,13 +34,13 @@ public interface PileReservationInfoService {
* 启动预约
* @param dto
*/
void activateReserved(PileReservedDTO dto);
void activateReserved(PileReservationDTO dto);
/**
* 关闭预约
* @param dto
*/
void deactivateReserved(PileReservedDTO dto);
void deactivateReserved(PileReservationDTO dto);
/**
* 根据充电枪口编号发送预约指令
@@ -53,5 +53,7 @@ public interface PileReservationInfoService {
* @param pileConnectorCode
*/
void cancelOneTimeReservation(String pileConnectorCode);
void deleteReservation(PileReservationDTO dto);
}

View File

@@ -82,5 +82,5 @@ public interface YKCPushCommandService {
* 发送预约充电命令
* @param command
*/
void pushReservedChargingCommand(ReservedChargingCommand command);
void pushReservationChargingCommand(ReservationChargingCommand command);
}

View File

@@ -37,7 +37,7 @@ import com.jsowell.common.util.bean.BeanUtils;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.domain.ykcCommond.ReservedChargingCommand;
import com.jsowell.pile.domain.ykcCommond.ReservationChargingCommand;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
@@ -3118,7 +3118,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
* 异步发送预约充电指令
*/
if (StringUtils.equals(orderInfo.getStartType(), StartTypeEnum.RESERVED.getValue())) {
ReservedChargingCommand command = ReservedChargingCommand.builder()
ReservationChargingCommand command = ReservationChargingCommand.builder()
.transactionCode(orderInfo.getTransactionCode())
.pileSn(orderInfo.getPileSn())
.connectorCode(orderInfo.getConnectorCode())
@@ -3129,7 +3129,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
.build();
// 发送预约充电指令
logger.info("订单:{}支付成功, 发送预约充电指令, command:{}", dto.getOrderCode(), JSON.toJSONString(command));
pileRemoteService.reservedCharging(command);
pileRemoteService.reservationCharging(command);
}
if (OrderStatusEnum.STAY_RETROACTIVE_AMOUNT.getValue().equals(orderInfo.getOrderStatus())) {

View File

@@ -1,27 +1,36 @@
package com.jsowell.pile.service.impl;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.enums.DelFlagEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.PileReservedDTO;
import com.jsowell.pile.dto.PileReservationDTO;
import com.jsowell.pile.service.PileRemoteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.sql.Time;
import java.time.LocalTime;
import java.util.List;
import java.util.Objects;
import com.jsowell.pile.mapper.PileReservationInfoMapper;
import com.jsowell.pile.domain.PileReservationInfo;
import com.jsowell.pile.service.PileReservationInfoService;
@Slf4j
@Service
public class PileReservationInfoServiceImpl implements PileReservationInfoService {
@Resource
private PileReservationInfoMapper pileReservationInfoMapper;
@Autowired
private PileRemoteService pileRemoteService;
@Override
public int deleteByPrimaryKey(Integer id) {
return pileReservationInfoMapper.deleteByPrimaryKey(id);
@@ -86,7 +95,7 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
* 启用预约
*/
@Override
public void activateReserved(PileReservedDTO dto) {
public void activateReserved(PileReservationDTO dto) {
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPrimaryKey(Integer.parseInt(dto.getReservedId()));
if (pileReservationInfo == null) {
return;
@@ -103,7 +112,7 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
* 禁用预约
*/
@Override
public void deactivateReserved(PileReservedDTO dto) {
public void deactivateReserved(PileReservationDTO dto) {
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPrimaryKey(Integer.parseInt(dto.getReservedId()));
if (pileReservationInfo == null) {
return;
@@ -159,6 +168,12 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
@Override
public void pushReservedByPileConnectorCode(String pileConnectorCode) {
// 根据充电枪口编号查询正在生效中的预约
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectActiveReservationByPileConnectorCode(pileConnectorCode);
if (Objects.isNull(pileReservationInfo)) {
return;
}
// 生成个人桩订单
}
/**
@@ -169,5 +184,18 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
public void cancelOneTimeReservation(String pileConnectorCode) {
// 根据充电枪口编号查询仅一次正在生效中的预约
}
@Override
public void deleteReservation(PileReservationDTO dto) {
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPrimaryKey(Integer.valueOf(dto.getReservedId()));
if (Objects.isNull(pileReservationInfo)) {
return;
}
if (!StringUtils.equals(pileReservationInfo.getMemberId(), dto.getMemberId())) {
return;
}
pileReservationInfo.setDelFlag(DelFlagEnum.DELETE.getValue());
pileReservationInfoMapper.updateByPrimaryKey(pileReservationInfo);
}
}

View File

@@ -482,7 +482,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
* @param command
*/
@Override
public void pushReservedChargingCommand(ReservedChargingCommand command) {
public void pushReservationChargingCommand(ReservationChargingCommand command) {
// 交易流水号
String transactionCode = command.getTransactionCode();
byte[] transactionCodeArr = BytesUtil.str2Bcd(transactionCode);

View File

@@ -9,7 +9,7 @@
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" />
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="reserved_type" jdbcType="VARCHAR" property="reservedType" />
<result column="reservation_type" jdbcType="VARCHAR" property="reservationType" />
<result column="start_time" jdbcType="TIME" property="startTime" />
<result column="end_time" jdbcType="TIME" property="endTime" />
<result column="freq" jdbcType="VARCHAR" property="freq" />
@@ -21,7 +21,7 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time,
id, member_id, pile_sn, pile_connector_code, `status`, reservation_type, start_time,
end_time, freq, create_by, create_time, update_by, update_time, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@@ -38,16 +38,16 @@
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservationInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into pile_reservation_info (member_id, pile_sn, pile_connector_code,
`status`, reserved_type, start_time,
end_time, freq, create_by,
create_time, update_by, update_time,
del_flag)
values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{pileConnectorCode,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{reservedType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME},
#{endTime,jdbcType=TIME}, #{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=CHAR})
insert into pile_reservation_info (member_id, pile_sn, pile_connector_code,
`status`, reservation_type, start_time,
end_time, freq, create_by,
create_time, update_by, update_time,
del_flag)
values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{pileConnectorCode,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{reservationType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME},
#{endTime,jdbcType=TIME}, #{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=CHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservationInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
@@ -65,8 +65,8 @@
<if test="status != null">
`status`,
</if>
<if test="reservedType != null">
reserved_type,
<if test="reservationType != null">
reservation_type,
</if>
<if test="startTime != null">
start_time,
@@ -106,8 +106,8 @@
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="reservedType != null">
#{reservedType,jdbcType=VARCHAR},
<if test="reservationType != null">
#{reservationType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIME},
@@ -151,8 +151,8 @@
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="reservedType != null">
reserved_type = #{reservedType,jdbcType=VARCHAR},
<if test="reservationType != null">
reservation_type = #{reservationType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIME},
@@ -185,18 +185,18 @@
<!--@mbg.generated-->
update pile_reservation_info
set member_id = #{memberId,jdbcType=VARCHAR},
pile_sn = #{pileSn,jdbcType=VARCHAR},
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
reserved_type = #{reservedType,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIME},
end_time = #{endTime,jdbcType=TIME},
freq = #{freq,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=CHAR}
pile_sn = #{pileSn,jdbcType=VARCHAR},
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
reservation_type = #{reservationType,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIME},
end_time = #{endTime,jdbcType=TIME},
freq = #{freq,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=CHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
@@ -223,9 +223,9 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="reserved_type = case" suffix="end,">
<trim prefix="reservation_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.reservedType,jdbcType=VARCHAR}
when id = #{item.id,jdbcType=INTEGER} then #{item.reservationType,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="start_time = case" suffix="end,">
@@ -306,10 +306,10 @@
</if>
</foreach>
</trim>
<trim prefix="reserved_type = case" suffix="end,">
<trim prefix="reservation_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.reservedType != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.reservedType,jdbcType=VARCHAR}
<if test="item.reservationType != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.reservationType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
@@ -378,15 +378,15 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into pile_reservation_info
(member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time, end_time,
(member_id, pile_sn, pile_connector_code, `status`, reservation_type, start_time, end_time,
freq, create_by, create_time, update_by, update_time, del_flag)
values
<foreach collection="list" item="item" separator=",">
(#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR}, #{item.reservedType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME},
#{item.endTime,jdbcType=TIME}, #{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
#{item.delFlag,jdbcType=CHAR})
(#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR}, #{item.reservationType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME},
#{item.endTime,jdbcType=TIME}, #{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
#{item.delFlag,jdbcType=CHAR})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservationInfo" useGeneratedKeys="true">
@@ -400,7 +400,7 @@
pile_sn,
pile_connector_code,
`status`,
reserved_type,
reservation_type,
start_time,
end_time,
freq,
@@ -419,7 +419,7 @@
#{pileSn,jdbcType=VARCHAR},
#{pileConnectorCode,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR},
#{reservedType,jdbcType=VARCHAR},
#{reservationType,jdbcType=VARCHAR},
#{startTime,jdbcType=TIME},
#{endTime,jdbcType=TIME},
#{freq,jdbcType=VARCHAR},
@@ -438,7 +438,7 @@
pile_sn = #{pileSn,jdbcType=VARCHAR},
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
reserved_type = #{reservedType,jdbcType=VARCHAR},
reservation_type = #{reservationType,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIME},
end_time = #{endTime,jdbcType=TIME},
freq = #{freq,jdbcType=VARCHAR},
@@ -468,8 +468,8 @@
<if test="status != null">
`status`,
</if>
<if test="reservedType != null">
reserved_type,
<if test="reservationType != null">
reservation_type,
</if>
<if test="startTime != null">
start_time,
@@ -513,8 +513,8 @@
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="reservedType != null">
#{reservedType,jdbcType=VARCHAR},
<if test="reservationType != null">
#{reservationType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIME},
@@ -558,8 +558,8 @@
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="reservedType != null">
reserved_type = #{reservedType,jdbcType=VARCHAR},
<if test="reservationType != null">
reservation_type = #{reservationType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIME},
@@ -606,4 +606,14 @@
and member_id = #{memberId,jdbcType=VARCHAR}
and pile_sn = #{pileSn,jdbcType=VARCHAR}
</select>
<select id="selectActiveReservationByPileConnectorCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from pile_reservation_info
where del_flag = '0'
and reservation_type = 'single'
and status = '1'
and pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
</select>
</mapper>