Java mybatis Oracle (SQL)!!!

SQL部分

 <?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.hkt.bpu.asd.noss.pcms.admin_portal.dao.pfms.AutoSRDao" >
    <resultMap id="AutoSRInfoResultMap"
               type="com.hkt.bpu.asd.noss.pcms.admin_portal.domain.pfms.SrActivity">
        <result column="SERVICE_NO" property="serviceNo" />
        <result column="CUST_REPORT_DT" property="sRReportTime" />
        <result column="SERVICE_TYPE" property="serviceType" />
        <result column="FAULT_SYM_CODE" property="faultSymCode" />
        <result column="CONTACT_NAME" property="contactName" />
        <result column="CONTACT_TEL" property="contactPhone" />
        <result column="SR_NO" property="sRNo" />
        <result column="SRC_NO" property="sRCNo" />
        <result column="SR_CREATE_TIME" property="sRCreateTime" />
        <result column="CLEARANCE_DATE" property="sRClearanceTime" />
        <result column="CLOSE_STAFF_ID" property="sRCloseStaff" />
        <result column="SRS_RETURN_VAL" property="sRSReturnCode" />
        <result column="SRS_SQL_TXT" property="sRSReturnResult" />
        <result column="ALARM_MSG1||ALARM_MSG2||ALARM_MSG3||ALARM_MSG4||ALARM_MSG5" property="alarmMessage" />
    </resultMap>
    <select id="getPagingAutoSR" resultMap="AutoSRInfoResultMap">
        SELECT a.SERVICE_NO,a.CUST_REPORT_DT,a.SERVICE_TYPE,a.FAULT_SYM_CODE,a.CONTACT_NAME,a.CONTACT_TEL,a.SR_NO,a.SRC_NO,
        a.SR_CREATE_TIME,TO_CHAR(a.CLEARANCE_DATE, 'YYYYMMDDHH24MISS'),a.CLOSE_STAFF_ID,a.SRS_RETURN_VAL,a.SRS_SQL_TXT,
        a.ALARM_MSG1 || ', ' || a.ALARM_MSG2 || ', ' || a.ALARM_MSG3 || ', ' ||a.ALARM_MSG4 || ', ' || a.ALARM_MSG5
        FROM SRACTIVITY a, CCT_SR_RULE b
        WHERE b.WORK_GROUP_ID = #{workGroupId}
        AND a.SERVICE_NO = b.SERVICE_NO
        AND a.ALARM_MSG1 != 'SR CLOSED'
        <if test="whereClause != ''">
        <![CDATA[
            ${whereClause}
        ]]>
        </if>
        <if test="pageable.sort != null">
            <foreach item="order" collection="pageable.sort" open="ORDER BY " separator=", " close="">
                ${order.property} ${order.direction}
            </foreach>
        </if>
        <if test="pageable.sort == null">
            ORDER BY a.SERVICE_NO
        </if>
    </select>
</mapper>

现在出问题是这个column,

 <result column="ALARM_MSG1||ALARM_MSG2||ALARM_MSG3||ALARM_MSG4||ALARM_MSG5" property="alarmMessage" />

SQL中对应的是

 a.ALARM_MSG1 || ', ' || a.ALARM_MSG2 || ', ' || a.ALARM_MSG3 || ', ' ||a.ALARM_MSG4 || ', ' || a.ALARM_MSG5

如果按照我这样写的,“alarmMessage”返回的值是null,在数据库查出来的是有值的。
请问这个column该怎么填?

 <result column="ALARM_MSG1||ALARM_MSG2||ALARM_MSG3||ALARM_MSG4||ALARM_MSG5" property="alarmMessage" />

1个回答

a.ALARM_MSG1 || ', ' || a.ALARM_MSG2 || ', ' || a.ALARM_MSG3 || ', ' ||a.ALARM_MSG4 || ', ' || a.ALARM_MSG5 在这后面加 as 自定义列名
在<result column="自定义列名"

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐