StationInfoSMapper.xml 5.58 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="com.zteits.charge.mapper.smapper.StationInfoSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.clouds.api.dto.charge.dto.StationInfoDTO">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="station_id" jdbcType="VARCHAR" property="stationId" />
    <result column="operator_id" jdbcType="VARCHAR" property="operatorId" />
    <result column="equipment_owner_id" jdbcType="VARCHAR" property="equipmentOwnerId" />
    <result column="station_name" jdbcType="VARCHAR" property="stationName" />
    <result column="country_code" jdbcType="VARCHAR" property="countryCode" />
    <result column="area_code" jdbcType="VARCHAR" property="areaCode" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="station_tel" jdbcType="VARCHAR" property="stationTel" />
    <result column="service_tel" jdbcType="VARCHAR" property="serviceTel" />
    <result column="station_type" jdbcType="INTEGER" property="stationType" />
    <result column="station_status" jdbcType="INTEGER" property="stationStatus" />
    <result column="park_nums" jdbcType="INTEGER" property="parkNums" />
    <result column="station_lng" jdbcType="DECIMAL" property="stationLng" />
    <result column="station_lat" jdbcType="DECIMAL" property="stationLat" />
    <result column="site_guide" jdbcType="VARCHAR" property="siteGuide" />
    <result column="construction" jdbcType="INTEGER" property="construction" />
    <result column="pictures" jdbcType="VARCHAR" property="pictures" />
    <result column="match_cars" jdbcType="VARCHAR" property="matchCars" />
    <result column="park_info" jdbcType="VARCHAR" property="parkInfo" />
    <result column="busine_hours" jdbcType="VARCHAR" property="busineHours" />
    <result column="electricity_fee" jdbcType="VARCHAR" property="electricityFee" />
    <result column="service_fee" jdbcType="VARCHAR" property="serviceFee" />
    <result column="park_fee" jdbcType="VARCHAR" property="parkFee" />
    <result column="payment" jdbcType="VARCHAR" property="payment" />
    <result column="support_order" jdbcType="INTEGER" property="supportOrder" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
    <result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="modify_emp_id" jdbcType="VARCHAR" property="modifyEmpId" />
    <result column="modify_emp_name" jdbcType="VARCHAR" property="modifyEmpName" />
    <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />

    <result column="operator_name" jdbcType="VARCHAR" property="operatorName" />

  </resultMap>

  <sql id="Base_Column_List">
    s.id,s.station_id,s.operator_id,s.equipment_owner_id,s.station_name,s.country_code,s.area_code,
    s.address,s.station_tel,s.service_tel,s.station_type,s.station_status,s.park_nums,s.station_lng,
    s.station_lat,s.site_guide,s.construction,s.pictures,s.match_cars,s.park_info,s.busine_hours,
    s.electricity_fee,s.service_fee,s.park_fee,s.payment,s.support_order,s.remark,s.data_state,
    s.create_emp_id,s.create_emp_name,s.create_time,s.modify_emp_id,s.modify_emp_name,s.modify_time,
    s.org_id,o.operator_name
  </sql>
  <select id="queryStationInfo" parameterType="com.zteits.clouds.api.dto.charge.param.QueryStationInfoRequest" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from station_info s join operator_info o on s.operator_id = o.operator_id
    where s.data_state = 1 and o.data_state = 1
    <if test="stationId != null and stationId != ''">
      and s.station_id = #{stationId,jdbcType=VARCHAR}
    </if>
    <if test="operatorId != null and operatorId != ''">
      and s.operator_id = #{operatorId,jdbcType=VARCHAR}
    </if>
    <if test="operatorName != null and operatorName != ''">
      and o.operator_name like  concat ('%',#{operatorName},'%')
    </if>
    <if test="stationName != null and stationName != ''">
      and s.station_name like  concat ('%',#{stationName},'%')
    </if>
    <if test="stationType != null and stationType != ''">
      and s.station_type = #{stationType,jdbcType=VARCHAR}
    </if>
    <if test="stationStatus != null and stationStatus != ''">
      and s.station_status = #{stationStatus,jdbcType=VARCHAR}
    </if>
    <if test="orgId != null">
      and s.org_id = #{orgId,jdbcType=BIGINT}
    </if>
  </select>

    <select id="queryStationInfoList" parameterType="com.zteits.clouds.api.dto.charge.param.StationInfoQueryRequest"
            resultType="com.zteits.clouds.api.dto.charge.dto.StationConnectorInfoDTO">
      select
      s.station_id stationId,
      s.operator_id operatorId,
      o.operator_name operatorName,
      s.station_name stationName,
      s.address address,
      ci.connector_code connectorCode,
      ci.connector_id connectorId
      from station_info s left join operator_info o on s.operator_id = o.operator_id,
      connector_info ci
      where s.data_state = 1 and ci.data_state = 1
      and s.operator_id = ci.operator_id and ci.station_id = s.station_id
      and ci.connector_code  in
      <foreach collection="connectorCodes" separator="or" item="connectorCode" open="(" close=")" >
           #{connectorCode}
      </foreach>
    </select>

</mapper>