首页 > 代码库 > BME学习总结02

BME学习总结02

BME学习总结02

//查询数据库的SQL.XML
<?xml version="1.0" encoding="UTF-8"?>
<sqlmap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.huawei.com/bme/schema/namingsql">
<resultMapping id="ParamMaps"
type="com.huawei.bme.entity.EsbLogUserOperEntity">
<result property="oper_id" column="OPER_ID" />
<result property="user_name" column="USER_NAME" />
<result property="role_id" column="ROLE_ID" />
<result property="user_host" column="USER_HOST" />
<result property="oper_type" column="OPER_TYPE" />
<result property="oper_object_type" column="OPER_OBJECT_TYPE" />
<result property="oper_object_name" column="OPER_OBJECT_NAME" />
<result property="oper_context" column="OPERCCONTEXT" />
<result property="oper_time" column="OPER_TIME" />
<result property="oper_result" column="OPER_RESULT" />
</resultMapping>
<sql id="QueryEsbLogByParams" datasource="bmeDataSource"
resultMapping="ParamMaps" parameterType="com.huawei.bme.entity.EsbLogUserOperEntity">
<content>
<![CDATA[
    select * from ESB_LOG_USER_OPER t  where  <{tune1}> <{tune2}> <{tune3}> <{tune4}> <{tune5}> order by OPER_ID desc
    ]]>
</content>
<tune-table>
<tune id="tune1">
<tune-value content="t.USER_NAME like :user_name"
condition=":user_name isNotNull" prepend="and" />
</tune>

<tune id="tune2">
<tune-value content="and t.OPER_TYPE =per_type"
condition=":oper_type isNotNull" prepend="and" />
</tune>

<tune id="tune3">
<tune-value content="and t.OPER_RESULT =per_result"
condition=":oper_result isNotNull" prepend="and" />
</tune>

<tune id="tune4">
<tune-value content="and t.OPER_OBJECT_TYPE =:oper_object_type"
condition=":oper_object_type isNotNull" prepend="and" />
</tune>

<tune id="tune5">
<tune-value
content="and t.OPER_TIME between to_date(:begin_time,‘YYYY/MM/DD HH24:mi:ss‘)
and to_date(:end_time,‘YYYY/MM/DD HH24:mi:ss‘)"
condition=":begin_time isNotNull and :end_time isNotNull" prepend="and" />
</tune>

</tune-table>
</sql>
</sqlmap>