ChannelRiskDataMapper.xml 4.42 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.datariskcon.modules.mapper.ChannelRiskDataMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.datariskcon.modules.entity.ChannelRiskData">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="workorder_no" jdbcType="VARCHAR" property="workorder_no"/>
        <result column="owner_name" jdbcType="VARCHAR" property="owner_name"/>
        <result column="vin" jdbcType="VARCHAR" property="vin"/>
        <result column="sn" jdbcType="VARCHAR" property="sn"/>
        <result column="active_date" jdbcType="TIMESTAMP" property="active_date"/>
        <result column="dev_type" jdbcType="INTEGER" property="dev_type"/>
        <result column="gps_time" jdbcType="TIMESTAMP" property="gps_time"/>
        <result column="lng" jdbcType="DOUBLE" property="lng"/>
        <result column="lat" jdbcType="DOUBLE" property="lat"/>
        <result column="prov" jdbcType="VARCHAR" property="prov"/>
        <result column="city" jdbcType="VARCHAR" property="city"/>
        <result column="zone" jdbcType="VARCHAR" property="zone"/>
        <result column="address" jdbcType="VARCHAR" property="address"/>
        <result column="shop_name" jdbcType="VARCHAR" property="shop_name"/>
        <result column="labels" jdbcType="VARCHAR" property="labels"/>
        <result column="type" jdbcType="INTEGER" property="type"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, workorder_no, owner_name,vin, sn, active_date, dev_type,gps_time, lng,
        lat, prov,city,zone,address,shop_name,labels,type
    </sql>

    <select id="findChannelAllRiskData" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        FROM t_channel_risk_data
        <if test="isExcep == 'true'">
            where type=1
        </if>
        <if test="isExcep == 'false'">
            where type=0
        </if>
    </select>
    <select id="findProInstallSheet" resultType="java.util.Map">
        select
        prov as xAxis,count(prov) as value
        from t_channel_risk_data
        where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
        and type=0
        group by prov
    </select>
    <select id="findCityInstallSheet" resultType="java.util.Map">
        select
        city as xAxis,count(city) as value
        from t_channel_risk_data
        where prov=#{proviceName} and gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
        and type=0
        group by city
    </select>
    <select id="findZoneInstallSheet" resultType="java.util.Map">
        select
        zone as xAxis,count(zone) as value
        from t_channel_risk_data
        where city=#{cityName} and gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
        and type=0
        group by zone
    </select>
    <select id="findTimeInstallSheet" resultType="java.util.Map">
        select
        concat(DATE_FORMAT(gps_time,'%m'),'月') as xAxis,
        count(id) as value
        from t_channel_risk_data
        where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
        and type=0
        group by xAxis
    </select>
    <select id="findProTimeInstallSheet" resultType="java.util.Map">
        select
        concat(DATE_FORMAT(gps_time,'%m'),'月') as xAxis,
        count(id) as value
        from t_channel_risk_data
        where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
        and type=0
        and prov=#{proviceName}
        group by xAxis
    </select>
    <select id="findCityTimeInstallSheet" resultType="java.util.Map">
        select
        concat(DATE_FORMAT(gps_time,'%m'),'月') as xAxis,
        count(id) as value
        from t_channel_risk_data
        where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH,'%Y-%m')
        and type=0
        and city=#{cityName}
        group by xAxis
    </select>
    <select id="findOutletsData" resultType="java.util.Map">
        select
        shop_name,address,count(shop_name) as orderCount
        FROM  t_channel_risk_data
        where type=1
        group by shop_name
    </select>
    <select id="findOutletsDataDetail" resultMap="BaseResultMap">
        select active_date,owner_name,vin,sn,address
        from t_channel_risk_data
        where type=1 and shop_name=#{shopname}
    </select>

</mapper>