zoukankan      html  css  js  c++  java
  • mybatis 判断参数有没有传入

     <!--审核展示列表-->
        <select id="auditResList" resultType="java.util.HashMap">
            <include refid="auditRes"/>
        </select>
        <!--审核展示 一条-->
        <select id="auditResInfo" resultType="java.util.HashMap">
            <include refid="auditRes"/>
        </select>
        <sql id="auditRes">
            SELECT
            r.id AS resId,
            r.res_desc,
            r.res_type,
            r.res_state,
            r.expires_date,
            r.res_pic_path,
            ra.id as applyId,
            ra.reason,
            ra.apply_note,
            ra.company_id,
            ra.state,
            r.res_name,
            c.companyName,
            c.shopName
            FROM resource r
            inner JOIN resource_apply ra
            ON r.id = ra.res_id
            left JOIN company c
            on ra.company_id = c.companyId
            <where>
                r.res_state = 1
                <if test="resType != null">
                    and r.res_type = #{resType}
                </if>
                <if test="_parameter.containsKey('applyId') and applyId != null">
                    and ra.id = #{applyId}
                </if>
                <if test=" _parameter.containsKey('state') and state != null">
                    and ra.state = #{state}
                </if>
                <if test=" _parameter.containsKey('resName') and resName != null and resName != ''">
                    and r.res_name like CONCAT('%', #{resName}, '%')
                </if>
                <if test=" _parameter.containsKey('companyName') and companyName != null and companyName != ''">
                    and c.companyName like CONCAT('%', #{companyName}, '%')
                </if>
                <if test=" _parameter.containsKey('shopName') and shopName != null and shopName != ''">
                    and c.shopName like CONCAT('%', #{shopName}, '%')
                </if>
            </where>
        </sql>
    
    
        /**
         * 审核展示列表
         *
         * @param resType
         * @return
         */
        List<HashMap> auditResList(@Param("resType") Integer resType,
                                   @Param("companyName") String companyName,
                                   @Param("shopName") String shopName,
                                   @Param("state") Integer state,
                                   @Param("resName") String resName);
    
        /**
         * 审核展示 一条
         *
         * @param resType
         * @param applyId
         * @return
         */
        HashMap auditResInfo(@Param("resType") Integer resType, @Param("applyId") Integer applyId);
    

      

  • 相关阅读:
    BZOJ 3506 机械排序臂 splay
    BZOJ 2843 LCT
    BZOJ 3669 魔法森林
    BZOJ 2049 LCT
    BZOJ 3223 文艺平衡树 splay
    BZOJ 1433 假期的宿舍 二分图匹配
    BZOJ 1051 受欢迎的牛 强连通块
    BZOJ 1503 郁闷的出纳员 treap
    BZOJ 1096 ZJOI2007 仓库设计 斜率优化dp
    BZOJ 1396: 识别子串( 后缀数组 + 线段树 )
  • 原文地址:https://www.cnblogs.com/jwlfpzj/p/9162540.html
Copyright © 2011-2022 走看看