345 lines
10 KiB
XML
345 lines
10 KiB
XML
<?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.car.charging.mapper.ChargingMapper">
|
|
|
|
<!-- <resultMap type="com.car.charging.common.domain.vo.ChargingMiddleTableVo" id="SysUserRoleResult">-->
|
|
<!-- <result property="userId" column="user_id" />-->
|
|
<!-- <result property="roleId" column="role_id" />-->
|
|
<!-- </resultMap>-->
|
|
|
|
|
|
|
|
<resultMap type="com.car.charging.common.domain.vo.ChargingMiddleTableVo" id="ChargingMiddleTableResultMap">
|
|
<id property="id" column="id"/>
|
|
<result property="cityId" column="city_id"/>
|
|
<result property="channelId" column="channel_id"/>
|
|
<result property="serverTypeId" column="server_type_id"/>
|
|
<result property="rankId" column="rank_id"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="userName" column="user_name"/>
|
|
<result property="availableState" column="available_state"/>
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
|
<!-- <association property="channel" javaType="com.car.charging.common.domain.Channel">-->
|
|
<!-- <id property="channelId" column="channel_id"/>–>-->
|
|
<!-- <result property="channelName" column="channel_name"/>-->
|
|
<!-- <result property="createTime" column="create_time"/>-->
|
|
<!-- <result property="createUser" column="create_user"/>-->
|
|
<!-- <result property="updTime" column="upd_time"/>-->
|
|
<!-- <result property="updUser" column="upd_user"/>-->
|
|
<!-- <result property="isDel" column="is_del"/>-->
|
|
<!-- </association>-->
|
|
|
|
<association property="channel" javaType="com.car.charging.common.domain.Channel">
|
|
<id property="channelId" column="channel_id"/>
|
|
<result property="channelName" column="channel_name"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createUser" column="create_user"/>
|
|
<result property="updTime" column="upd_time"/>
|
|
<result property="updUser" column="upd_user"/>
|
|
<result property="isDel" column="is_del"/>
|
|
</association>
|
|
|
|
|
|
<association property="city" javaType="com.car.charging.common.domain.City">
|
|
<id property="cityId" column="city_id"/>
|
|
<result property="cityName" column="city_name"/>
|
|
</association>
|
|
|
|
<association property="rank" javaType="com.car.charging.common.domain.Rank">
|
|
<id property="rankId" column="rank_id"/>
|
|
<result property="rankName" column="rank_name"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createUser" column="create_user"/>
|
|
<result property="updTime" column="upd_time"/>
|
|
<result property="updUser" column="upd_user"/>
|
|
<result property="isDel" column="is_del"/>
|
|
</association>
|
|
|
|
<association property="type" javaType="com.car.charging.common.domain.serverType">
|
|
<id property="serverTypeId" column="server_type_id"/>
|
|
<result property="typeName" column="type_name"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createUser" column="create_user"/>
|
|
<result property="updTime" column="upd_time"/>
|
|
<result property="updUser" column="upd_user"/>
|
|
<result property="isDel" column="is_del"/>
|
|
</association>
|
|
|
|
<association property="estimatedOrder" javaType="com.car.charging.common.domain.EstimatedOrder">
|
|
|
|
<id property="id" column="id"/>
|
|
<result property="cityId" column="city_id"/>
|
|
<result property="serverTypeId" column="server_type_id"/>
|
|
<result property="channelId" column="channel_id"/>
|
|
<result property="rankId" column="rank_id"/>
|
|
<result property="kilometres" column="kilometres"/>
|
|
<result property="serverTime" column="server_time"/>
|
|
<result property="mealPrice" column="meal_price"/>
|
|
<result property="basicsPrice" column="basics_price"/>
|
|
<result property="nightId" column="night_id"/>
|
|
<result property="sectionId" column="section_id"/>
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
</association>
|
|
|
|
<association property="nightServer" javaType="com.car.charging.common.domain.NightServer">
|
|
<id property="id" column="id"/>
|
|
<result property="nightServerMileagePrice" column="night_server_mileage_price"/>
|
|
<result property="nightServerTimePrice" column="night_server_time_price"/>
|
|
<result property="mileagePrice" column="mileage_price"/>
|
|
<result property="timePrice" column="time_price"/>
|
|
<result property="longWayMileage" column="long_way_mileage"/>
|
|
<result property="longWayPrice" column="long_way_price"/>
|
|
</association>
|
|
|
|
<association property="section" javaType="com.car.charging.common.domain.Section">
|
|
<id property="id" column="id"/>
|
|
<result property="startTime" column="start_time"/>
|
|
<result property="endTime" column="end_time"/>
|
|
<result property="kilometrePrice" column="kilometre_price"/>
|
|
<result property="timePrice" column="time_price"/>
|
|
</association>
|
|
|
|
|
|
|
|
</resultMap>
|
|
|
|
<resultMap type="com.car.charging.common.domain.Channel" id="ChannelMap">
|
|
<id property="channelId" column="channel_id"/>
|
|
<result property="channelName" column="channel_name"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createUser" column="create_user"/>
|
|
<result property="updTime" column="upd_time"/>
|
|
<result property="updUser" column="upd_user"/>
|
|
<result property="isDel" column="is_del"/>
|
|
|
|
</resultMap>
|
|
|
|
<resultMap type="com.car.charging.common.domain.City" id="CityMap">
|
|
<id property="cityId" column="city_id"/>
|
|
<result property="cityName" column="city_name"/>
|
|
|
|
</resultMap>
|
|
|
|
<resultMap type="com.car.charging.common.domain.Rank" id="RankMap">
|
|
<id property="rankId" column="rank_id"/>
|
|
<result property="rankName" column="rank_name"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createUser" column="create_user"/>
|
|
<result property="updTime" column="upd_time"/>
|
|
<result property="updUser" column="upd_user"/>
|
|
<result property="isDel" column="is_del"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="com.car.charging.common.domain.serverType" id="serverTypeMap">
|
|
<id property="serverTypeId" column="server_type_id"/>
|
|
<result property="typeName" column="type_name"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createUser" column="create_user"/>
|
|
<result property="updTime" column="upd_time"/>
|
|
<result property="updUser" column="upd_user"/>
|
|
<result property="isDel" column="is_del"/>
|
|
|
|
</resultMap>
|
|
|
|
<insert id="addChargingMiddleTable" >
|
|
INSERT INTO
|
|
charging_middle_table(
|
|
`city_id`,
|
|
`channel_id`,
|
|
`server_type_id`,
|
|
`rank_id`,
|
|
`estimated_id`,
|
|
`create_time`)
|
|
VALUES
|
|
( #{cityId},#{channelId},#{serverTypeId},#{rankId},#{estimatedId},#{createTime});
|
|
</insert>
|
|
|
|
<insert id="addNightServer" keyProperty="id" useGeneratedKeys="true">
|
|
INSERT INTO
|
|
`night_server`
|
|
(
|
|
`night_server_mileage_price`,
|
|
`night_server_time_price`,
|
|
`mileage_price`,
|
|
`time_price`,
|
|
`long_way_mileage`,
|
|
`long_way_price`)
|
|
VALUES
|
|
(#{nightServerMileagePrice}, #{nightServerTimePrice}, #{mileagePrice}, #{timePrice}, #{longWayMileage}, #{longWayPrice});
|
|
|
|
</insert>
|
|
<insert id="addEstimatedOrder" keyProperty="id" useGeneratedKeys="true">
|
|
INSERT INTO `estimated_order`
|
|
(
|
|
`city_id`,
|
|
`server_type_id`,
|
|
`channel_id`,
|
|
`rank_id`,
|
|
`kilometres`,
|
|
`server_time`,
|
|
`meal_price`,
|
|
`basics_price`,
|
|
`night_id`)
|
|
VALUES
|
|
(#{cityId}, #{serverTypeId}, #{channelId}, #{rankId},#{kilometres},#{serverTime}, #{mealPrice}, #{basicsPrice}, #{nightId});
|
|
|
|
</insert>
|
|
|
|
<insert id="addSection" keyProperty="id" useGeneratedKeys="true" >
|
|
INSERT INTO `tb_section`
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
`start_time`,
|
|
`end_time`,
|
|
`kilometre_price`,
|
|
`time_price`
|
|
</trim>
|
|
VALUES
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
#{startTime},
|
|
#{endTime},
|
|
#{kilometrePrice},
|
|
#{timePrice}
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updNightServer">
|
|
UPDATE
|
|
`night_server`
|
|
SET
|
|
`night_server_mileage_price` = #{nightServerMileagePrice},
|
|
`night_server_time_price` = #{nightServerTimePrice},
|
|
`mileage_price` = #{mealPrice},
|
|
`time_price` = #{timePrice},
|
|
`long_way_mileage` = #{longWayMileage},
|
|
`long_way_price` = #{longWayPrice}
|
|
WHERE
|
|
`id` = #{id};
|
|
|
|
</update>
|
|
|
|
<update id="updEstimatedOrder">
|
|
UPDATE `estimated_order`
|
|
SET
|
|
`kilometres` = #{kilometres},
|
|
`server_time` = #{serverTime},
|
|
`meal_price` = #{mealPrice},
|
|
`basics_price` = #{basicsPrice},
|
|
WHERE `id` = #{id};
|
|
|
|
</update>
|
|
|
|
<update id="updSection">
|
|
UPDATE `tb_section`
|
|
SET `start_time` = #{startTime},
|
|
`end_time` = #{endTime},
|
|
`kilometre_price` = #{kilometrePrice},
|
|
`time_price` = #{timePrice}
|
|
WHERE `id` = #{id};
|
|
|
|
</update>
|
|
|
|
<update id="updChargingMiddleTable">
|
|
|
|
</update>
|
|
|
|
|
|
<select id="list" resultMap="ChargingMiddleTableResultMap">
|
|
SELECT t.id,
|
|
c.city_id,
|
|
c.city_name,
|
|
l.channel_id,
|
|
l.channel_name,
|
|
st.server_type_id,
|
|
st.type_name,
|
|
t.rank_id,
|
|
r.rank_name,
|
|
t.update_time,
|
|
t.user_name,
|
|
t.create_time,
|
|
t.available_state,
|
|
eo.kilometres,
|
|
eo.server_time,
|
|
eo.meal_price,
|
|
eo.basics_price,
|
|
ns.night_server_mileage_price,
|
|
ns.night_server_time_price,
|
|
ns.mileage_price,
|
|
ns.time_price,
|
|
ns.long_way_mileage,
|
|
ns.long_way_price,
|
|
ts.kilometre_price,
|
|
ts.start_time,
|
|
ts.end_time,
|
|
ts.time_price
|
|
FROM charging_middle_table t
|
|
LEFT JOIN city c ON t.city_id = c.city_id
|
|
LEFT JOIN channel l ON t.channel_id = l.channel_id
|
|
LEFT JOIN server_type st ON t.server_type_id = st.server_type_id
|
|
LEFT JOIN t_rank r ON t.rank_id = r.rank_id
|
|
LEFT JOIN estimated_order eo ON t.estimated_id = eo.id
|
|
LEFT JOIN night_server ns on eo.night_id = ns.id
|
|
LEFT JOIN tb_section ts on eo.section_id = ts.id
|
|
|
|
<where>
|
|
|
|
<if test="cityId!=null">
|
|
and c.city_id = #{cityId}
|
|
</if>
|
|
|
|
<if test="channelId!=null">
|
|
and l.channel_id = #{channelId}
|
|
</if>
|
|
|
|
<if test="serverTypeId!=null">
|
|
and st.server_type_id = #{serverTypeId}
|
|
</if>
|
|
|
|
<if test="rankId!=null">
|
|
and t.rank_id = #{rankId}
|
|
</if>
|
|
|
|
<if test="availableState!=null">
|
|
and t.available_state = #{availableState}
|
|
</if>
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
|
|
|
<select id="ChannelList" resultMap="ChannelMap">
|
|
select * from channel
|
|
</select>
|
|
|
|
<select id="CityList" resultMap="CityMap">
|
|
select * from city
|
|
</select>
|
|
|
|
<select id="RankList" resultMap="RankMap">
|
|
select * from t_rank
|
|
</select>
|
|
|
|
<select id="serverTypeList" resultMap="serverTypeMap">
|
|
select * from server_type
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|