深圳停车平台

This commit is contained in:
Guoqs
2025-02-14 17:01:48 +08:00
parent e18cd482fa
commit f7057f925f
7 changed files with 823 additions and 38 deletions

View File

@@ -0,0 +1,84 @@
package com.jsowell.pile.domain;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
/**
* 充电停车优惠表
*/
@Data
@Accessors(chain = true)
@SuperBuilder
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ChargeParkingDiscount {
/**
* 主键
*/
private Integer id;
/**
* 站点id
*/
private String stationId;
/**
* 道闸平台id
*/
private Integer parkingPlatformId;
/**
* 条件类型(1-固定电量2-固定时长)
*/
private String conditionType;
private String conditionValue;
/**
* 优惠类型(1-减时间单位分钟; 2-减金额单位元)
*/
private String discountType;
private String discountValue;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 删除标识(0-正常; 1-删除)
*/
private String delFlag;
}

View File

@@ -0,0 +1,26 @@
package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.ChargeParkingDiscount;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ChargeParkingDiscountMapper {
int deleteByPrimaryKey(Integer id);
int insertSelective(ChargeParkingDiscount record);
ChargeParkingDiscount selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ChargeParkingDiscount record);
int updateBatchSelective(List<ChargeParkingDiscount> list);
int batchInsert(@Param("list") List<ChargeParkingDiscount> list);
int insertOrUpdate(ChargeParkingDiscount record);
int insertOrUpdateSelective(ChargeParkingDiscount record);
ChargeParkingDiscount selectByStationId(String stationId);
}

View File

@@ -0,0 +1,35 @@
package com.jsowell.pile.service;
import com.jsowell.pile.domain.ChargeParkingDiscount;
import com.jsowell.pile.vo.web.ChargeParkingDiscountVO;
import java.util.List;
public interface ChargeParkingDiscountService{
int deleteByPrimaryKey(Integer id);
int insertSelective(ChargeParkingDiscount record);
ChargeParkingDiscount selectByPrimaryKey(Integer id);
/**
* 根据车场ID查询车场信息
* @param stationId
* @return
*/
ChargeParkingDiscount selectByStationId(String stationId);
ChargeParkingDiscountVO getChargeParkingDiscount(String stationId);
int updateByPrimaryKeySelective(ChargeParkingDiscount record);
int updateBatchSelective(List<ChargeParkingDiscount> list);
int batchInsert(List<ChargeParkingDiscount> list);
int insertOrUpdate(ChargeParkingDiscount record);
int insertOrUpdateSelective(ChargeParkingDiscount record);
}

View File

@@ -0,0 +1,85 @@
package com.jsowell.pile.service.impl;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ChargeParkingDiscount;
import com.jsowell.pile.mapper.ChargeParkingDiscountMapper;
import com.jsowell.pile.service.ChargeParkingDiscountService;
import com.jsowell.pile.vo.web.ChargeParkingDiscountVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class ChargeParkingDiscountServiceImpl implements ChargeParkingDiscountService{
@Resource
private ChargeParkingDiscountMapper chargeParkingDiscountMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return chargeParkingDiscountMapper.deleteByPrimaryKey(id);
}
@Override
public int insertSelective(ChargeParkingDiscount record) {
return chargeParkingDiscountMapper.insertSelective(record);
}
@Override
public ChargeParkingDiscount selectByPrimaryKey(Integer id) {
return chargeParkingDiscountMapper.selectByPrimaryKey(id);
}
@Override
public ChargeParkingDiscount selectByStationId(String stationId) {
return chargeParkingDiscountMapper.selectByStationId(stationId);
}
@Override
public ChargeParkingDiscountVO getChargeParkingDiscount(String stationId) {
if (StringUtils.isBlank(stationId)) {
return null;
}
ChargeParkingDiscount chargeParkingDiscount = this.selectByStationId(stationId);
if (chargeParkingDiscount == null) {
return null;
}
// 查询该站点的停车优惠信息
ChargeParkingDiscountVO discountVO = new ChargeParkingDiscountVO();
discountVO.setStationId(chargeParkingDiscount.getStationId());
discountVO.setConditionType(chargeParkingDiscount.getConditionType());
discountVO.setConditionValue(chargeParkingDiscount.getConditionValue());
discountVO.setDiscountType(chargeParkingDiscount.getDiscountType());
discountVO.setDiscountValue(chargeParkingDiscount.getDiscountValue());
discountVO.setStartTime(DateUtils.formatDateTime(chargeParkingDiscount.getStartTime()));
discountVO.setEndTime(DateUtils.formatDateTime(chargeParkingDiscount.getEndTime()));
return discountVO;
}
@Override
public int updateByPrimaryKeySelective(ChargeParkingDiscount record) {
return chargeParkingDiscountMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateBatchSelective(List<ChargeParkingDiscount> list) {
return chargeParkingDiscountMapper.updateBatchSelective(list);
}
@Override
public int batchInsert(List<ChargeParkingDiscount> list) {
return chargeParkingDiscountMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(ChargeParkingDiscount record) {
return chargeParkingDiscountMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(ChargeParkingDiscount record) {
return chargeParkingDiscountMapper.insertOrUpdateSelective(record);
}
}

View File

@@ -0,0 +1,495 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsowell.pile.mapper.ChargeParkingDiscountMapper">
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.ChargeParkingDiscount">
<!--@mbg.generated-->
<!--@Table charge_parking_discount-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="station_id" jdbcType="VARCHAR" property="stationId" />
<result column="parking_platform_id" jdbcType="INTEGER" property="parkingPlatformId" />
<result column="condition_type" jdbcType="VARCHAR" property="conditionType" />
<result column="condition_value" jdbcType="VARCHAR" property="conditionValue" />
<result column="discount_type" jdbcType="VARCHAR" property="discountType" />
<result column="discount_value" jdbcType="VARCHAR" property="discountValue" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="del_flag" jdbcType="CHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, station_id, parking_platform_id, condition_type, condition_value, discount_type,
discount_value, start_time, end_time, create_by, create_time, update_by, update_time,
del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from charge_parking_discount
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from charge_parking_discount
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ChargeParkingDiscount" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into charge_parking_discount
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stationId != null">
station_id,
</if>
<if test="parkingPlatformId != null">
parking_platform_id,
</if>
<if test="conditionType != null">
condition_type,
</if>
<if test="conditionValue != null">
condition_value,
</if>
<if test="discountType != null">
discount_type,
</if>
<if test="discountValue != null">
discount_value,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stationId != null">
#{stationId,jdbcType=VARCHAR},
</if>
<if test="parkingPlatformId != null">
#{parkingPlatformId,jdbcType=INTEGER},
</if>
<if test="conditionType != null">
#{conditionType,jdbcType=VARCHAR},
</if>
<if test="conditionValue != null">
#{conditionValue,jdbcType=VARCHAR},
</if>
<if test="discountType != null">
#{discountType,jdbcType=VARCHAR},
</if>
<if test="discountValue != null">
#{discountValue,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=CHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.jsowell.pile.domain.ChargeParkingDiscount">
<!--@mbg.generated-->
update charge_parking_discount
<set>
<if test="stationId != null">
station_id = #{stationId,jdbcType=VARCHAR},
</if>
<if test="parkingPlatformId != null">
parking_platform_id = #{parkingPlatformId,jdbcType=INTEGER},
</if>
<if test="conditionType != null">
condition_type = #{conditionType,jdbcType=VARCHAR},
</if>
<if test="conditionValue != null">
condition_value = #{conditionValue,jdbcType=VARCHAR},
</if>
<if test="discountType != null">
discount_type = #{discountType,jdbcType=VARCHAR},
</if>
<if test="discountValue != null">
discount_value = #{discountValue,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=CHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update charge_parking_discount
<trim prefix="set" suffixOverrides=",">
<trim prefix="station_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.stationId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.stationId,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="parking_platform_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.parkingPlatformId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.parkingPlatformId,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="condition_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.conditionType != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.conditionType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="condition_value = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.conditionValue != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.conditionValue,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="discount_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.discountType != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.discountType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="discount_value = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.discountValue != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.discountValue,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="start_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.startTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.startTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="end_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.endTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.endTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="del_flag = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.delFlag != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=CHAR}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into charge_parking_discount
(station_id, parking_platform_id, condition_type, condition_value, discount_type,
discount_value, start_time, end_time, create_by, create_time, update_by, update_time,
del_flag)
values
<foreach collection="list" item="item" separator=",">
(#{item.stationId,jdbcType=VARCHAR}, #{item.parkingPlatformId,jdbcType=INTEGER},
#{item.conditionType,jdbcType=VARCHAR}, #{item.conditionValue,jdbcType=VARCHAR},
#{item.discountType,jdbcType=VARCHAR}, #{item.discountValue,jdbcType=VARCHAR},
#{item.startTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIMESTAMP}, #{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.ChargeParkingDiscount" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into charge_parking_discount
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
station_id,
parking_platform_id,
condition_type,
condition_value,
discount_type,
discount_value,
start_time,
end_time,
create_by,
create_time,
update_by,
update_time,
del_flag,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{stationId,jdbcType=VARCHAR},
#{parkingPlatformId,jdbcType=INTEGER},
#{conditionType,jdbcType=VARCHAR},
#{conditionValue,jdbcType=VARCHAR},
#{discountType,jdbcType=VARCHAR},
#{discountValue,jdbcType=VARCHAR},
#{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=CHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
station_id = #{stationId,jdbcType=VARCHAR},
parking_platform_id = #{parkingPlatformId,jdbcType=INTEGER},
condition_type = #{conditionType,jdbcType=VARCHAR},
condition_value = #{conditionValue,jdbcType=VARCHAR},
discount_type = #{discountType,jdbcType=VARCHAR},
discount_value = #{discountValue,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
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},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ChargeParkingDiscount" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into charge_parking_discount
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="stationId != null">
station_id,
</if>
<if test="parkingPlatformId != null">
parking_platform_id,
</if>
<if test="conditionType != null">
condition_type,
</if>
<if test="conditionValue != null">
condition_value,
</if>
<if test="discountType != null">
discount_type,
</if>
<if test="discountValue != null">
discount_value,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="stationId != null">
#{stationId,jdbcType=VARCHAR},
</if>
<if test="parkingPlatformId != null">
#{parkingPlatformId,jdbcType=INTEGER},
</if>
<if test="conditionType != null">
#{conditionType,jdbcType=VARCHAR},
</if>
<if test="conditionValue != null">
#{conditionValue,jdbcType=VARCHAR},
</if>
<if test="discountType != null">
#{discountType,jdbcType=VARCHAR},
</if>
<if test="discountValue != null">
#{discountValue,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=CHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="stationId != null">
station_id = #{stationId,jdbcType=VARCHAR},
</if>
<if test="parkingPlatformId != null">
parking_platform_id = #{parkingPlatformId,jdbcType=INTEGER},
</if>
<if test="conditionType != null">
condition_type = #{conditionType,jdbcType=VARCHAR},
</if>
<if test="conditionValue != null">
condition_value = #{conditionValue,jdbcType=VARCHAR},
</if>
<if test="discountType != null">
discount_type = #{discountType,jdbcType=VARCHAR},
</if>
<if test="discountValue != null">
discount_value = #{discountValue,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=CHAR},
</if>
</trim>
</insert>
<select id="selectByStationId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from charge_parking_discount
where del_flag = '0'
and station_id = #{stationId,jdbcType=VARCHAR}
</select>
</mapper>