TdGGuideScreenSMapper.xml 13.2 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.TdGGuideScreenSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.park.domain.TdGGuideScreen">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="guide_no" jdbcType="VARCHAR" property="guideNo" />
        <result column="guide_name" jdbcType="VARCHAR" property="guideName" />
        <result column="guide_type" jdbcType="INTEGER" property="guideType" />
        <result column="province_id" jdbcType="BIGINT" property="provinceId" />
        <result column="province_name" jdbcType="VARCHAR" property="provinceName" />
        <result column="city_id" jdbcType="BIGINT" property="cityId" />
        <result column="city_name" jdbcType="VARCHAR" property="cityName" />
        <result column="country_id" jdbcType="BIGINT" property="countryId" />
        <result column="country_name" jdbcType="VARCHAR" property="countryName" />
        <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
        <result column="pl_name" jdbcType="VARCHAR" property="plName" />
        <result column="parking_num" jdbcType="INTEGER" property="parkingNum" />
        <result column="address" jdbcType="VARCHAR" property="address" />
        <result column="lon_id" jdbcType="DECIMAL" property="lonId" />
        <result column="lat_id" jdbcType="DECIMAL" property="latId" />
        <result column="level" jdbcType="INTEGER" property="level" />
        <result column="eqp_code" jdbcType="VARCHAR" property="eqpCode" />
        <result column="eqp_ip" jdbcType="VARCHAR" property="eqpIp" />
        <result column="eqp_imei" jdbcType="VARCHAR" property="eqpImei" />
        <result column="eqp_port" jdbcType="VARCHAR" property="eqpPort" />
        <result column="echo_type" jdbcType="INTEGER" property="echoType" />
        <result column="light_band_ip" jdbcType="VARCHAR" property="lightBandIp" />
        <result column="picture_path" jdbcType="VARCHAR" property="picturePath" />
        <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="TIMESTAMP" property="modifyTime" />
        <result column="install_date" jdbcType="TIMESTAMP" property="installDate" />
        <result column="modify_op" jdbcType="VARCHAR" property="modifyOp" />
        <result column="last_update_date" jdbcType="TIMESTAMP" property="lastUpdateDate" />
        <result column="org_id" jdbcType="BIGINT" property="orgId" />
        <result column="led_device_status" jdbcType="INTEGER" property="ledDeviceStatus" />
        <result column="led_screen_status" jdbcType="INTEGER" property="ledScreenStatus" />
    </resultMap>
    <sql id="Example_Where_Clause">
        <where>
            <foreach collection="oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
    <sql id="Update_By_Example_Where_Clause">
        <where>
            <foreach collection="example.oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
    <sql id="Base_Column_List">
        id, guide_no, guide_name, guide_type, province_id, province_name, city_id, city_name,
        country_id, country_name, pl_no, pl_name, parking_num, address, lon_id, lat_id, level,
        eqp_code, eqp_ip, eqp_imei, eqp_port, echo_type, light_band_ip, picture_path, data_status,
        create_time, create_op, modify_time, install_date, modify_op, last_update_date, org_id,
        led_device_status, led_screen_status
    </sql>


    <select id="listGuideScreenByAreaCodes" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM td_g_guide_screen
        <where>
            1=1
            <if test="queryStr !=null and queryStr !=''">
                AND (address LIKE CONCAT('%',#{queryStr},'%') OR guide_name LIKE CONCAT('%',#{queryStr},'%'))
            </if>
            <if test="nameOrNo !=null and nameOrNo !=''">
                AND (guide_no LIKE CONCAT('%',#{nameOrNo},'%') OR guide_name LIKE CONCAT('%',#{nameOrNo},'%'))
            </if>
			<if test="guideName !=null and guideName !=''">
                AND guide_name LIKE CONCAT('%',#{guideName},'%')
            </if>
			<if test="guideNo !=null and guideNo !=''">
                AND guide_no LIKE CONCAT('%',#{guideNo},'%')
            </if>
            <if test="dataState !=null">
                AND data_status = #{dataState}
            </if>
            <if test="ledDeviceStatus !=null">
                AND led_device_status = #{ledDeviceStatus}
            </if>
            <if test="ledScreenStatus !=null">
                AND led_screen_status = #{ledScreenStatus}
            </if>
            <if test="orgId !=null">
                AND org_id = #{orgId}
            </if>
            <if test="areaCodes !=null and areaCodes.size>0">
                AND country_id IN
                <foreach collection="areaCodes" item="code" separator="," open="(" close=")" index="index">
                    #{code}
                </foreach>
            </if>
            <if test="levels !=null and levels.size>0">
                AND level IN
                <foreach collection="levels" item="level" separator="," open="(" close=")" index="index">
                    #{level}
                </foreach>
            </if>
            <if test="modifyTimeBegin !=null and modifyTimeEnd != null ">
	            AND (last_update_date between #{modifyTimeBegin} and #{modifyTimeEnd})
	            AND (led_device_status = 2  OR led_screen_status = 2)
	        </if>
        </where>

    </select>

    <select id="statisticsGuideScreenLevelByAreaCodes" resultType="com.zteits.park.domain.GuideScreenLevelStatistics">
        SELECT level,count(level) as num FROM td_g_guide_screen
        <where>
            1=1
            <if test="dataState !=null">
                AND data_status = #{dataState}
            </if>
             <if test="cityId !=null">
                AND city_id = #{cityId}
            </if>
            <if test="areaCodes !=null and areaCodes.size>0">
                AND country_id IN
                <foreach collection="areaCodes" item="code" separator="," open="(" close=")" index="index">
                    #{code}
                </foreach>
            </if>

             <if test="orgId !=null">
                AND org_id = #{orgId}
            </if>
        </where>
        GROUP BY level ORDER BY level;

    </select>


    <select id="listGuideScreenGeo" resultType="com.zteits.park.domain.GuideScreenGeo"
            parameterType="com.zteits.clouds.api.dto.park.param.GuideScreenListGeoRequest">
        SELECT
        id,
        guide_name as guideName,
        guide_no as guideNo,
        guide_type as guideType,
        level,
        lon_id as lonId,
        lat_id as latId,
        eqp_ip      as eqpIp,
        eqp_imei       as eqpImei,
        eqp_port       as eqpPort,
        led_screen_status       as ledScreenStatus,
        led_device_status ledDeviceStatus
        FROM td_g_guide_screen
        <where>
            1=1
            <if test="dataState !=null">
                AND data_status = #{dataState}
            </if>
            <if test="areaCodes !=null and areaCodes.size>0">
                AND country_id IN
                <foreach collection="areaCodes" item="code" separator="," open="(" close=")" index="index">
                    #{code}
                </foreach>
            </if>
            <if test="levels !=null and levels.size>0">
                AND level IN
                <foreach collection="levels" item="level" separator="," open="(" close=")" index="index">
                    #{level}
                </foreach>
            </if>

                AND pl_no IN
            <foreach collection="plNos" item="parkNo" separator="," open="(" close=")" index="index">
                #{parkNo}
            </foreach>


            <if test="orgId !=null">
                AND org_id = #{orgId}
            </if>
            <if test="guideName !=null and guideName !=''">
                AND guide_name LIKE CONCAT('%',#{guideName},'%')
            </if>
            <if test="ledDeviceStatus !=null">
                AND led_device_status = #{ledDeviceStatus}
            </if>
        </where>

    </select>

    <select id="getBaseGuideScreenInfo" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM td_g_guide_screen
        <where>
            guide_no = #{guideNo}
            <if test="dataState !=null">
                AND data_status = #{dataState}
            </if>

        </where>

    </select>

	<insert id="bathInsertGuideScreens" parameterType="java.util.List">
        insert into td_g_guide_screen (guide_no, guide_name, guide_type,
	      province_id, province_name, city_id,
	      city_name, country_id, country_name,
	      address, lon_id, lat_id,
	      level, eqp_code, eqp_ip,
	      eqp_imei, eqp_port, echo_type,
	      light_band_ip, parking_num, picture_path,
	      data_status, create_time, create_op,
	      modify_time, install_date,
	      modify_op, last_update_date, org_id, led_device_status, led_screen_status
	      )
	    values
        <foreach collection="tdGGuideScreens" index="index" item="item" separator=",">
            (#{item.guideNo,jdbcType=VARCHAR}, #{item.guideName,jdbcType=VARCHAR}, #{item.guideType,jdbcType=INTEGER},
		      #{item.provinceId,jdbcType=BIGINT}, #{item.provinceName,jdbcType=VARCHAR}, #{item.cityId,jdbcType=BIGINT},
		      #{item.cityName,jdbcType=VARCHAR}, #{item.countryId,jdbcType=BIGINT}, #{item.countryName,jdbcType=VARCHAR},
		      #{item.address,jdbcType=VARCHAR}, #{item.lonId,jdbcType=DECIMAL}, #{item.latId,jdbcType=DECIMAL},
		      #{item.level,jdbcType=INTEGER}, #{item.eqpCode,jdbcType=VARCHAR}, #{item.eqpIp,jdbcType=VARCHAR},
		      #{item.eqpImei,jdbcType=VARCHAR}, #{item.eqpPort,jdbcType=VARCHAR}, #{item.echoType,jdbcType=INTEGER},
		      #{item.lightBandIp,jdbcType=VARCHAR}, #{item.parkingNum,jdbcType=INTEGER}, #{item.picturePath,jdbcType=VARCHAR},
		      #{item.dataStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.createOp,jdbcType=BIGINT},
		      #{item.modifyTime,jdbcType=TIMESTAMP}, #{item.installDate,jdbcType=TIMESTAMP},
		      #{item.modifyOp,jdbcType=VARCHAR}, #{item.lastUpdateDate,jdbcType=TIMESTAMP}, #{item.orgId,jdbcType=BIGINT},
		      #{item.ledDeviceStatus,jdbcType=INTEGER}, #{item.ledScreenStatus,jdbcType=INTEGER}
		      )
        </foreach>
    </insert>

</mapper>