Mybatis 中if else的写法以及oracle中 递归sql写法

<select id="listHisTeam" parameterType="hashmap" resultType="hashmap">
          SELECT t1.PK_TEAM_CHANGE_ID,
            t1.TEAM_CNPC_NAME,
            t1.PASS_DATE,
            t1.VALIDITY_DATE,
            t1.PASS_FILE,
            t1.REQBOOK_ATTR,
            code1.CODING_NAME AS REQBOOK_ATTR_TEXT,
            t1.LIMIT_CONDITION,
            t1.REMARK,
            t1.LAST_QUAL,
            t1.REF_ARCH_CHANGE_ID
        FROM CHANGE t1
        LEFT JOIN COMM_CODING_SORT_DETAIL code1
        ON t1.REQBOOK_ATTR = code1.CODING_CODE_ID and code1.bsflag = '0' 
        <choose>
            <when test="rowRefArchChangeId != null and rowRefArchChangeId != '' and rowRefArchChangeId != 'undefined'">
                start with t1.REF_ARCH_CHANGE_ID = #{rowRefArchChangeId}
                connect by prior t1.REF_ARCH_CHANGE_ID = t1.PK_TEAM_CHANGE_ID
            </when>
            <otherwise>
                WHERE  t1.PK_TEAM_CHANGE_ID = #{rowPk}
                  AND  t1.BSFLAG = '0'
            </otherwise>
        </choose>  
        ORDER BY t1.CREATE_DATE DESC
        
      </select>

 

posted @ 2019-08-21 14:14  Samuel-Leung  阅读(768)  评论(0编辑  收藏  举报