首页 > 代码库 > 三个spring配置文件(包括了常用的写法)

三个spring配置文件(包括了常用的写法)

1

<?xml version="1.0" encoding="utf-8" ?><sqlMap namespace="WeiXin.DAL.SqlMaps.ContactInfo"    xmlns="http://ibatis.apache.org/mapping"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  <alias>    <typeAlias alias="ContactInfo" type="WeiXin.Model.ContactInfo,WeiXin.Model"/>  </alias>  <resultMaps>    <resultMap id="ContactInfoMap" class="ContactInfo">      <result property="Id" column="ID" dbType="varchar2"/>      <result property="CenterName" column="CENTER_NAME" dbType="varchar2"/>      <result property="Name" column="USERNAME" dbType="varchar2"/>      <result property="PhoneNumber" column="PHONE_NUMBER" dbType="varchar2"/>      <result property="Address" column="ADDRESS" dbType="varchar2"/>    </resultMap>  </resultMaps>  <statements>    <insert id="Insert" parameterClass="ContactInfo">      INSERT INTO WX_MONITOR_CONTACT (ID,CENTER_NAME,USERNAME,PHONE_NUMBER,ADDRESS)      VALUES      (#Id,dbType=varchar2#,      #CenterName,dbType=varchar2#,      #Name,dbType=varchar2#,      #PhoneNumber,dbType=varchar2#,      #Address,dbType=varchar2#)    </insert>    <select id="Query" parameterClass="ContactInfo" resultMap="ContactInfoMap">      SELECT ID,CENTER_NAME,USERNAME,PHONE_NUMBER,ADDRESS      FROM WX_MONITOR_CONTACT      <include refid="criterionFragment"></include>    </select>    <sql id="criterionFragment">      <dynamic>        <isNotEmpty property="CenterName" prepend="WHERE">          CENTER_NAME=#CenterName,dbType=varchar2#        </isNotEmpty>      </dynamic>    </sql>    <delete id="Delete" parameterClass="ContactInfo">      DELETE FROM WX_MONITOR_CONTACT      WHERE CENTER_NAME=#CenterName,dbType=varchar2#    </delete>    <update id="Update" parameterClass="ContactInfo">      UPDATE WX_MONITOR_CONTACT      SET USERNAME= #Name,dbType=varchar2#,      PHONE_NUMBER=#PhoneNumber,dbType=varchar2#,      ADDRESS= #Address,dbType=varchar2#      WHERE CENTER_NAME=#CenterName,dbType=varchar2#    </update>  </statements></sqlMap>

2

<?xml version="1.0" encoding="utf-8" ?><sqlMap namespace="WeiXin.DAL.SqlMaps.PicStatus"    xmlns="http://ibatis.apache.org/mapping"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  <alias>    <typeAlias alias="PicStatus" type="WeiXin.Model.PicStatus,WeiXin.Model" />  </alias>  <resultMaps>    <resultMap id="PicStatusMap" class="PicStatus">      <result property="Id" column="ID" dbType="varchar2" />      <result property="OpenId" column="OPENID" dbType="varchar2" />      <result property="Status" column="STATUS" dbType="varchar2" />           <result property="CreateTime" column="CREATE_TIME" dbType="DATE" />      <result property="Len" column="LEN" dbType="INT32" />    </resultMap>  </resultMaps>  <statements>    <select id="Query" parameterClass="PicStatus" resultMap="PicStatusMap">      SELECT      ID,      OPENID,      STATUS,      CREATE_TIME,      LEN      FROM WX_MONITOR_PICSTATUS      <include refid="criterionFragment"></include>      ORDER BY CREATE_TIME DESC    </select>    <sql id="criterionFragment">      <dynamic prepend="where">        <isNotEmpty property="OpenId" prepend="and">          OPENID=#OpenId,dbType=varchar2#        </isNotEmpty>        <isNotEmpty property="Status" prepend="and">          STATUS= #Status,dbType=varchar2#        </isNotEmpty>      </dynamic>    </sql>        <insert id="Insert" parameterClass="PicStatus">      INSERT INTO WX_MONITOR_PICSTATUS(      ID,      OPENID,      STATUS,      CREATE_TIME,      LEN)      VALUES      (#Id,dbType=varchar2#,      #OpenId,dbType=varchar2#,      #Status,dbType=varchar2#,      #CreateTime,dbType=Date#,      #Len,dbType=varchar2#)    </insert>    <update id="Update" parameterClass="PicStatus">      UPDATE WX_MONITOR_PICSTATUS      SET LEN=#Len,dbType=Int32#      WHERE OPENID=#OpenId,dbType=varchar2# AND STATUS=#Status,dbType=varchar2#    </update>  </statements></sqlMap>

3

<?xml version="1.0" encoding="utf-8" ?><sqlMap namespace="WeiXin.DAL.SqlMaps.ExcptionStatistic"    xmlns="http://ibatis.apache.org/mapping"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  <alias>    <typeAlias alias="ExcptionInfoByTime1" type="WeiXin.Model.ExcptionInfoByTime,WeiXin.Model" />    <typeAlias alias="ExcptionCategory" type="WeiXin.Model.ExcptionCategory,WeiXin.Model" />  </alias>  <resultMaps>    <resultMap id="ExcptionStatisticMap" class="ExcptionCategory">      <result property="TrafficJamEx" column="TrafficJamEx" dbType="Int32"/>      <result property="CarBreakDownEx" column="CarBreakDownEx" dbType="Int32"/>      <result property="AccidentEx" column="AccidentEx" dbType="Int32"/>      <result property="WeatheEx" column="WeatheEx" dbType="Int32"/>      <result property="DeliveryVehicle" column="DeliveryVehicle" dbType="Int32"/>    </resultMap>  </resultMaps>  <statements>    <select id="Query" parameterClass="ExcptionInfoByTime1" resultMap="ExcptionStatisticMap">      SELECT      sum(case when EXCEPTION_CATEGORY =‘故障上报‘ then 1 else 0 end) as CarBreakDownEx,      sum(case when EXCEPTION_CATEGORY =‘堵车上报‘ then 1 else 0 end) as TrafficJamEx,      sum(case when EXCEPTION_CATEGORY =‘事故上报‘ then 1 else 0 end) as AccidentEx,      sum(case when EXCEPTION_CATEGORY =‘天气异常上报‘ then 1 else 0 end) as WeatheEx,      sum(case when EXCEPTION_CATEGORY =‘物流车上报‘ then 1 else 0 end) as DeliveryVehicle      FROM WX_MONITOR_EXCPTION       <include refid="FRAGMENT"></include>      <!--group by EXCEPTION_CATEGORY-->    </select>    <sql id="FRAGMENT">      <dynamic prepend="WHERE">        <isNotEmpty property="StartTime" prepend="AND">          CREATE_TIME&gt;=#StartTime,dbType=DATE#        </isNotEmpty>        <isNotEmpty property="EndTime" prepend="AND">          CREATE_TIME&lt;=#EndTime,dbType=DATE#        </isNotEmpty>      </dynamic>    </sql>    <select id="QueryFirstTime" resultClass="Date">      SELECT min(CREATE_TIME)      FROM WX_MONITOR_EXCPTION    </select>    <select id="QueryLastTime"  resultClass="Date" >      SELECT max(CREATE_TIME)      FROM WX_MONITOR_EXCPTION    </select>  </statements></sqlMap>

 

三个spring配置文件(包括了常用的写法)