EquipmentInfoSMapper.xml 3.48 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.EquipmentInfoSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.clouds.api.dto.charge.dto.EquipmentInfoDTO">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="equipment_id" jdbcType="VARCHAR" property="equipmentId" />
    <result column="station_id" jdbcType="VARCHAR" property="stationId" />
    <result column="operator_id" jdbcType="VARCHAR" property="operatorId" />
    <result column="manufacturer_id" jdbcType="VARCHAR" property="manufacturerId" />
    <result column="manufacturer_name" jdbcType="VARCHAR" property="manufacturerName" />
    <result column="equipment_model" jdbcType="VARCHAR" property="equipmentModel" />
    <result column="production_date" jdbcType="VARCHAR" property="productionDate" />
    <result column="equipment_type" jdbcType="INTEGER" property="equipmentType" />
    <result column="equipment_lng" jdbcType="DECIMAL" property="equipmentLng" />
    <result column="equipment_lat" jdbcType="DECIMAL" property="equipmentLat" />
    <result column="power" jdbcType="DECIMAL" property="power" />
    <result column="equipment_name" jdbcType="VARCHAR" property="equipmentName" />
    <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" />
    <result column="station_name" jdbcType="VARCHAR" property="stationName" />

  </resultMap>

  <sql id="Base_Column_List">
    s.id,s.equipment_id,s.station_id,s.operator_id,s.manufacturer_id,s.manufacturer_name,s.equipment_model,s.
    production_date,s.equipment_type,s.equipment_lng,s.equipment_lat,s.power,s.equipment_name,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,sta.station_name
  </sql>
  <select id="queryEquipmentInfo" parameterType="com.zteits.clouds.api.dto.charge.param.QueryEquipmentInfoRequest" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from equipment_info s join operator_info o on s.operator_id = o.operator_id join station_info sta on s.station_id = sta.station_id
    where s.data_state = 1 and o.data_state = 1 and sta.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 sta.station_name like  concat ('%',#{stationName},'%')
    </if>
    <if test="orgId != null">
      and s.org_id = #{orgId,jdbcType=BIGINT}
    </if>
  </select>

</mapper>