Newer
Older
huludao / src / main / resources / mapper / ReturnGoodsMapper.xml
<?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.newfiber.api.pc.dao.ReturnGoodsMapper">

    <resultMap id="houtSiteReturnMap" type="com.newfiber.api.pc.model.vo.HoutSiteReturnVo">
            <id  column="h_id"  property="hId" />
            <result property="houeName" column="site_name"/>
            <collection property="supVo" ofType="com.newfiber.api.pc.model.vo.SuppliesReturnVo">
                <id column="sup_id" property="supId"/>
                <result column="sup_name" property="supName"/>
                <result column="sup_count" property="supCount"/>
            </collection>
    </resultMap>

    <resultMap id="AlertStatisticsVo" type="com.newfiber.api.pc.model.vo.AlertStatisticsVo">
        <result property="alertTypeId" column="alert_type_id"/>
        <result property="alertType" column="alert_type"/>
        <result property="count" column="count"/>
    </resultMap>

    <select id="selectReturnGoods" resultMap="houtSiteReturnMap" parameterType="list">
        SELECT
        hs.h_id,hs.site_name,hss.sup_id,hss.sup_name,hss.sup_count
        FROM
        house_site hs
        LEFT JOIN
        house_site_supplies hss
        ON hs.h_id = hss.h_id
        where hs.h_id in
        <foreach collection="hIds" item="hId" separator="," open="(" close=")">
            #{hId}
        </foreach>
        and hss.sup_id in
        <foreach collection="supIds" item="supId" separator="," open="(" close=")">
            #{supId}
        </foreach>
        ORDER BY hss.h_id
    </select>


    <select id="alertStatistics" resultMap="AlertStatisticsVo">
        SELECT
        alert_type_id,alert_type,COUNT(alert_type_id) `count`
        from meet_alter
        where  1 = 1
        <if test="alertTypeId != null and alertTypeId != ''">
            and alert_type_id = #{alertTypeId}
        </if>
        <if test="serchTime != null and serchTime != ''">
            ${serchTime}
        </if>
        GROUP BY alert_type_id
        LIMIT #{current},#{size}

    </select>
    <select id="alertStatisticsCount" resultType="long">
        SELECT
        COUNT(DISTINCT alert_type_id)
        from meet_alter
        where 1 = 1
        <if test="alertTypeId != null and alertTypeId != ''">
            and alert_type_id = #{alertTypeId}
        </if>
        <if test="serchTime != null and serchTime != ''">
            ${serchTime}
        </if>
    </select>
</mapper>