ChargingOrderMapper.xml 2.96 KB
<?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="cn.com.glsx.evbusiness.modules.mapper.ChargingOrderMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.evbusiness.modules.entity.ChargingOrder">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id"/>
    <result column="order_code" jdbcType="VARCHAR" property="orderCode"/>
    <result column="order_status" jdbcType="TINYINT" property="orderStatus"/>
    <result column="order_source" jdbcType="TINYINT" property="orderSource"/>
    <result column="spear_id" jdbcType="INTEGER" property="spearId"/>
    <result column="park_space_num" jdbcType="VARCHAR" property="parkSpaceNum"/>
    <result column="execute_type" jdbcType="TINYINT" property="executeType"/>
    <result column="order_amount" jdbcType="DOUBLE" property="orderAmount"/>
    <result column="car_number" jdbcType="VARCHAR" property="carNumber"/>
    <result column="charg_endtime" jdbcType="TIMESTAMP" property="chargEndtime"/>
    <result column="charg_starttime" jdbcType="TIMESTAMP" property="chargStarttime"/>
    <result column="end_type" jdbcType="TINYINT" property="endType"/>
    <result column="total_degrees" jdbcType="REAL" property="totalDegrees"/>
    <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
    <result column="stationName" jdbcType="VARCHAR" property="stationName"/>
    <result column="gunName" jdbcType="VARCHAR" property="gunName"/>
    <result column="settlement_flag" jdbcType="TINYINT" property="settlementFlag"/>
    <result column="pile_id" jdbcType="TINYINT" property="pileId"/>
    <result column="account_id" jdbcType="TINYINT" property="accountId"/>
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    id, order_code, order_status, order_source, spear_id, park_space_num, execute_type,
    order_amount, car_number, charg_endtime, charg_starttime, end_type, total_degrees,
    created_time,pile_id,settlement_flag,account_id
  </sql>

  <select id="selectList" resultMap="BaseResultMap">
    select
    t1.*,t3.name as stationName,t4.name as gunName
    from charging_order t1
    left join charging_pile t2 on t1.pile_id=t2.pile_id
    left join charging_station t3 on t3.id=t2.station_id
    left join charging_gun t4 on (t1.pile_id=t4.pile_id and t1.spear_id=t4.gun_number)
    <where>
      <if test="orderSearch.orderStatus != null">
        and t1.order_status=#{orderSearch.orderStatus}
      </if>
    </where>
  </select>

  <select id="findByOrderCode" resultMap="BaseResultMap">
    select
    t1.*,t3.name as stationName,t4.name as gunName
    from charging_order t1
    left join charging_pile t2 on t1.pile_id=t2.pile_id
    left join charging_station t3 on t3.id=t2.station_id
    left join charging_gun t4 on (t1.pile_id=t4.pile_id and t1.spear_id=t4.gun_number)
    where order_code=#{orderCode}
  </select>
</mapper>