ParkingLotGeoSMapper.xml 4.91 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.park.mapper.smapper.ParkingLotGeoSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.park.domain.ParkingLotGeo">
        <id column="geo_id" jdbcType="BIGINT" property="geoId"/>
        <result column="lon_id" jdbcType="DECIMAL" property="lonId"/>
        <result column="lat_id" jdbcType="DECIMAL" property="latId"/>
        <result column="geo_no" jdbcType="CHAR" property="geoNo"/>
        <result column="geo_name" jdbcType="VARCHAR" property="geoName"/>
        <result column="geo_type" jdbcType="INTEGER" property="geoType"/>
        <result column="pl_id" jdbcType="BIGINT" property="plId"/>
        <result column="pl_name" jdbcType="VARCHAR" property="plName"/>
        <result column="pl_no" jdbcType="VARCHAR" property="plNo"/>
        <result column="data_status" jdbcType="INTEGER" property="dataStatus"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="create_op" jdbcType="BIGINT" property="createOp"/>
        <result column="modify_time" jdbcType="DATE" property="modifyTime"/>
        <result column="modify_op" jdbcType="BIGINT" property="modifyOp"/>
    </resultMap>
    <sql id="Base_Column_List">
    geo_id, lon_id, lat_id, geo_no, geo_name, geo_type, pl_id, pl_name, pl_no, data_status, 
    create_time, create_op, modify_time, modify_op
  </sql>

    <!-- 停车场经纬度列表查询 -->
    <select id="queryParkingLotGeoForList" resultMap="BaseResultMap"
            parameterType="com.zteits.park.domain.ParkingLotGeo">
        select
        <include refid="Base_Column_List"/>
        from parking_lot_geo
        where 1=1
        <choose>
            <when test="parkingLotGeo.dataStatus != null">
                and data_status = #{parkingLotGeo.dataStatus,jdbcType=INTEGER}
            </when>
            <otherwise>
                and data_status =1
            </otherwise>
        </choose>
    </select>

    <insert id="batchSaveParkingLotGeo">
        insert into parking_lot_geo (lon_id, lat_id, geo_no,
        geo_name, geo_type, pl_id,
        pl_name, pl_no, data_status,
        create_time, create_op, modify_time,
        modify_op)VALUES
        <foreach collection="lotGeos" item="lotGeo" index="index" separator=",">
            (
            <trim>
                #{lotGeo.lonId,jdbcType=DECIMAL},
                #{lotGeo.latId,jdbcType=DECIMAL},
                #{lotGeo.geoNo,jdbcType=CHAR},
                #{lotGeo.geoName,jdbcType=VARCHAR},
                #{lotGeo.geoType,jdbcType=INTEGER},
                #{lotGeo.plId,jdbcType=BIGINT},
                #{lotGeo.plName,jdbcType=VARCHAR},
                #{lotGeo.plNo,jdbcType=VARCHAR},
                <choose>
                    <when test="lotGeo.dataStatus != null">
                        #{lotGeo.dataStatus,jdbcType=INTEGER},
                    </when>
                    <otherwise>
                        1,
                    </otherwise>
                </choose>
                <choose>
                    <when test="lotGeo.createTime != null">
                        #{lotGeo.createTime,jdbcType=TIMESTAMP},
                    </when>
                    <otherwise>
                        NOW(),
                    </otherwise>
                </choose>
                #{lotGeo.createOp,jdbcType=BIGINT},
                <choose>
                    <when test="lotGeo.modifyTime != null">
                        #{lotGeo.modifyTime,jdbcType=TIMESTAMP},
                    </when>
                    <otherwise>
                        NOW(),
                    </otherwise>
                </choose>
                #{lotGeo.modifyOp,jdbcType=BIGINT}
            </trim>
            )
        </foreach>

    </insert>


    <!-- 停车场经纬度查询 -->
    <select id="queryParkingLotGeoByParkNo" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from parking_lot_geo
        where data_status=1
        <if test="null != geoType">
            AND geo_type = #{geoType}
        </if>
        <if test="null != lonLatType">
            AND lon_lat_type = #{lonLatType}
        </if>
        <if test="plNo != null">
            and pl_no = #{plNo,jdbcType=VARCHAR}
        </if>
    </select>

    <!-- 停车场经纬度list查询 -->
    <select id="queryParkingLotGeoListByParkNos" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from parking_lot_geo
        where data_status=1
        <if test="null != geoType">
            AND geo_type = #{geoType}
        </if>
        <if test="null != lonLatType">
            AND lon_lat_type = #{lonLatType}
        </if>
        and pl_no in
        <foreach collection="pklNos" open="(" close=")" separator="," item="plNo">
            #{plNo}
        </foreach>
    </select>
</mapper>