TpPNetworkCardSMapper.xml 5.12 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.TpPNetworkCardSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.park.domain.TpPNetworkCard">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="operator_type" jdbcType="INTEGER" property="operatorType" />
        <result column="operator_name" jdbcType="VARCHAR" property="operatorName" />
        <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
        <result column="card_no" jdbcType="VARCHAR" property="cardNo" />
        <result column="rate_plan" jdbcType="VARCHAR" property="ratePlan" />
        <result column="status" jdbcType="VARCHAR" property="status" />
        <result column="is_online" jdbcType="INTEGER" property="isOnline" />
        <result column="mobile_data_total" jdbcType="BIGINT" property="mobileDataTotal" />
        <result column="mobile_data_use" jdbcType="BIGINT" property="mobileDataUse" />
        <result column="mobile_data_limit_reached" jdbcType="INTEGER" property="mobileDataLimitReached" />
        <result column="eqp_type" jdbcType="INTEGER" property="eqpType" />
        <result column="eqp_no" jdbcType="VARCHAR" property="eqpNo" />
        <result column="eqp_name" jdbcType="VARCHAR" property="eqpName" />
        <result column="eqp_imei" jdbcType="VARCHAR" property="eqpImei" />
        <result column="remark" jdbcType="VARCHAR" property="remark" />
        <result column="org_id" jdbcType="BIGINT" property="orgId" />
        <result column="data_state" jdbcType="INTEGER" property="dataState" />
        <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
        <result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
        <result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
        <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
        <result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
        <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
    </resultMap>

    <sql id="Base_Column_List">
    id, operator_type, operator_name, pl_no, card_no, rate_plan, status, is_online, mobile_data_total,
    mobile_data_use, mobile_data_limit_reached, eqp_type, eqp_no, eqp_name, eqp_imei,
    remark, org_id, data_state, create_date, create_emp_id, create_emp_name, modfiy_date,
    modfiy_emp_id, modfiy_emp_name
  </sql>
 
    <!-- 物联网卡分页查询 -->
    <select id="queryTpPNetworkCardForPage" parameterType="com.zteits.clouds.api.dto.park.param.TpPNetworkCardRequest"
            resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from tp_p_network_card
        where data_state = 1
        <if test="cardNo != null and cardNo != ''">
            and card_no = #{cardNo,jdbcType=VARCHAR}
        </if>
        <if test="isOnline != null">
            and is_online = #{isOnline,jdbcType=INTEGER}
        </if>
        <if test="mobileDataLimitReached != null">
            and mobile_data_limit_reached = #{mobileDataLimitReached,jdbcType=INTEGER}
        </if>
        <if test="eqpType != null">
            and eqp_type = #{eqpType,jdbcType=INTEGER}
        </if>
        <if test="orgId != null">
            and org_id = #{orgId,jdbcType=BIGINT}
        </if>

    </select>
    <!-- 物联网卡分页查询 -->
    <select id="queryTpPNetworkCardStatistic" parameterType="com.zteits.clouds.api.dto.park.param.TpPNetworkCardRequest"
            resultType="com.zteits.clouds.api.dto.park.dto.networkcard.TpPNetworkCardStatisticDTO">
        select sum(1) totalNum,
            sum(case when mobile_data_limit_reached = 1 then 1 else 0 end) dataOverNum,
            sum(case when mobile_data_limit_reached = 0 then 1 else 0 end) dataNoOverNum,
            sum(case when is_online = 1 then 1 else 0 end) onlineNum,
            sum(case when is_online = 0 then 1 else 0 end) noOnlineNum,
            sum(case when eqp_type = 1 || eqp_type = 2 || eqp_type = 3 || eqp_type = 9 then mobile_data_use else 0 end) roadData,
            sum(case when eqp_type = 10 then mobile_data_use else 0 end) closeParkData,
            sum(case when eqp_type = 11 || eqp_type = 12 || eqp_type = 13 then mobile_data_use else 0 end) guideData,
            sum(case when eqp_type is null then mobile_data_use else 0 end) ortherData,
            sum(mobile_data_use) totalData
        from tp_p_network_card
        where data_state = 1
        <if test="cardNo != null and cardNo != ''">
            and card_no = #{cardNo,jdbcType=VARCHAR}
        </if>
        <if test="isOnline != null">
            and is_online = #{isOnline,jdbcType=INTEGER}
        </if>
        <if test="mobileDataLimitReached != null">
            and mobile_data_limit_reached = #{mobileDataLimitReached,jdbcType=INTEGER}
        </if>
        <if test="eqpType != null">
            and eqp_type = #{eqpType,jdbcType=INTEGER}
        </if>
        <if test="orgId != null">
            and org_id = #{orgId,jdbcType=BIGINT}
        </if>

    </select>
</mapper>