其他SQL

queryTrending

@Param("endTime") Date endTime, @Param("regionOrg") String regionOrg, @Param("repOffice") String repOffice);
<select id="queryTrending" resultType="com.huawei.it.regioc.bean.model.Trending">
    (
    select base_val baseVal,update_time updateTime
    from dm_scm_rel_ioc_country_probe dsricp
    where update_time > #{startTime} and #{endTime} > update_time
    and probe_id = #{probeId}
    <if test="regionOrg == null or regionOrg ==''">
        and region_org_id = 'ALL'
    </if>
    <if test="regionOrg !=null and regionOrg !=''">
        and region_org_id = #{regionOrg}

        <if test="repOffice == null or repOffice == ''">
            and office_id = 'ALL'
        </if>
        <if test="repOffice !=null and repOffice != ''">
            and office_id = #{repOffice}
        </if>
    </if>
    order by update_time desc
    )
    union all
    (
    select base_val baseVal,update_time updateTime
    from dm_scm_rel_ioc_country_probe dsricp
    where #{startTime} > update_time
    and probe_id = #{probeId}
    <if test="regionOrg == null or regionOrg ==''">
        and region_org_id = 'ALL'
    </if>
    <if test="regionOrg !=null and regionOrg !=''">
        and region_org_id = #{regionOrg}
        <if test="repOffice == null or repOffice == ''">
            and office_id = 'ALL'
        </if>
        <if test="repOffice !=null and repOffice != ''">
            and office_id = #{repOffice}
        </if>
    </if>
    order by update_time desc limit 1
    )
</select>

queryTaskLink

List<WarningDetails> queryTaskLink(@Param("list") List<WarningDetailsParam> params);
<select id="queryTaskLink" parameterType="java.util.List"
    resultType="com.huawei.it.regioc.bean.result.WarningDetails">
    select probe_id probeId,project_id projectId,plink_task_id pLinkTaskId from dm_scm_rel_ioc_task where 1 = 1
    and probe_id in
    <foreach collection="list" item="param" open="(" separator="," close=")">
        #{param.probeId}
    </foreach>
    and project_id in
    <foreach collection="list" item="param" open="(" separator="," close=")">
        #{param.projectId}
    </foreach>
</select>

queryFilterRiskIds

List<String> queryFilterRiskIds(List<String> commonNoList);
<select id="queryFilterRiskIds" parameterType="java.util.List" resultType="String">
    select risk_id
    from dm_scm_rel_ioc_risk_task
    where
    risk_id in
    <foreach collection="list" item="commonNo" separator="," open="(" close=")">
        #{commonNo}
    </foreach>
    AND close_time is not null
    and NOW()- close_time <![CDATA[ < ]]> interval '7 day'
</select>

queryProbeCriterion

ProbeCriterion queryProbeCriterion(@Param("regionOrg") String regionOrg, @Param("repOffice") String repOffice,@Param("probeId") String probeId);
<select id="queryProbeCriterion" resultType="com.huawei.it.regioc.bean.config.porbecriterion.ProbeCriterion">
    select probe_id probeId,
    threshold_val thresholdVal,
    base_val baseVal,
    target_val targetVal
    from dm_scm_rel_ioc_country_probe rel
    where probe_id = #{probeId}
    <if test="regionOrg != null and regionOrg != ''">
        and region_org_id = #{regionOrg}
    </if>
    <if test="regionOrg == null and regionOrg == ''">
        and region_org_id = 'total'
    </if>
    <if test="repOffice != null and repOffice != ''">
        and office_id = #{repOffice}
    </if>
    <if test="repOffice == null or repOffice == ''">
        and office_id = 'total'
    </if>
    order by update_time desc limit 1
</select>

updateCloseTime

void updateCloseTime(String commonNo);
<update id="updateCloseTime" parameterType="string">
    UPDATE dm_scm_rel_ioc_risk_task
    SET close_time = NOW()
    WHERE risk_id = #{commonNo}
</update>

 

posted @ 2022-12-14 19:40  MING5135  阅读(16)  评论(0编辑  收藏  举报