Mybatis.net sqlmap.xml简单配置

<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Org" xmlns="http://ibatis.apache.org/mapping"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <alias>
    <typeAlias alias="Org" type="GrassInfo.BMS.Model.SystemManage.Org,GrassInfo.BMS.Model.SystemManageModel"></typeAlias>
  </alias>
  <resultMaps>
    <resultMap id="Org-Result" class="Org">
      <result property="ID" column="ID"/>
      <result property="ORG_NAME" column="ORG_NAME"/>
      <result property="ORG_IP" column="ORG_IP"/>
      <result property="PARENT_ID" column="PARENT_ID"/>
      <result property="SITE_NO" column="SITE_NO"/>
      <result property="ADDRESS" column="ADDRESS"/>
      <result property="CREATE_USER" column="CREATE_USER"/>
      <result property="CREATE_TIME" column="CREATE_TIME"/>
      <result property="UPDATE_USER" column="UPDATE_USER"/>
      <result property="UPDATE_TIME" column="UPDATE_TIME"/>
      <result property="IS_VALID" column="IS_VALID"/>
    </resultMap>
  </resultMaps>
  <statements>
    <select id="GetOrg" parameterClass="int" resultMap="Org-Result">
      SELECT * FROM SYS_T_ORG WHERE ID=#id#
    </select>
    <insert id="InsertOrg" parameterClass="GrassInfo.BMS.Model.SystemManage.Org" >
      <selectKey property="ID" type="post" resultClass="int"> 
        ${selectKey}  
      </selectKey> 
      INSERT SYS_T_ORG (ORG_NAME,ORG_IP,PARENT_ID,SITE_NO,ADDRESS,CREATE_USER,CREATE_TIME,UPDATE_USER,UPDATE_TIME,IS_VALID)
      VALUES  (#ORG_NAME#,#ORG_IP#,#PARENT_ID#,#SITE_NO#,#ADDRESS#,#CREATE_USER#,#CREATE_TIME#,#UPDATE_USER#,#UPDATE_TIME#,#IS_VALID#)
    </insert>
    <!--<delete id="DeleteOrg" parameterClass="int" resultClass="int">
      DELETE FROM SYS_T_ORG WHERE ID=#id#
    </delete>-->
    <update id="UpdateOrg" parameterClass="GrassInfo.BMS.Model.SystemManage.Org" resultClass="int">
      UPDATE SYS_T_ORG SET ORG_NAME=#ORG_NAME#,ORG_IP=#ORG_IP#,PARENT_ID=#PARENT_ID#,SITE_NO=#SITE_NO#,ADDRESS=#ADDRESS#,CREATE_USER=#CREATE_USER#,CREATE_TIME=#CREATE_TIME#,UPDATE_USER=#UPDATE_USER#,UPDATE_TIME=#UPDATE_TIME#,IS_VALID=#IS_VALID# WHERE ID=#ID#
    </update>
    <update id="DeleteOrg" parameterClass="int" resultClass="int">
      UPDATE SYS_T_ORG SET IS_VALID='0' WHERE ID=#value#
    </update>
    <select id="GetAllOrgList" resultClass="List" resultMap="Org-Result">
      SELECT * FROM SYS_T_ORG WHERE IS_VALID='1'
    </select>
    <select id="GetOrgList" resultClass="List" resultMap="Org-Result" parameterClass="System.Collections.IDictionary">
      SELECT TOP (#PageSize#*#Page#) * FROM SYS_T_ORG WHERE ID NOT IN (SELECT TOP ((#PageSize#-1)*#Page#) ID FROM SYS_T_ORG WHERE IS_VALID='1' ORDER BY $Order$ $Desc$) AND IS_VALID='1' ORDER BY $Order$  $Desc$
    </select>
  </statements>
</sqlMap>

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭