ibatis 存储过程写法

<?xml version= " 1.0 " encoding= " utf-8 " ?>
<sqlMap  namespace= " DepartmentInfoModel " xmlns= " http://ibatis.apache.org/mapping " xmlns:xsi= " http://www.w3.org/2001/XMLSchema-instance "  >

  <alias>
    <typeAlias alias= " DepartmentInfoModel " type= " Dscf.Global.Employee.Model.DepartmentInfoModel,Dscf.Global " />
  </alias>

  <!--门店树 传参-->
  <parameterMaps>
    <parameterMap id= " selectMap_Dept_DeptInfo "  class= " DepartmentInfoModel ">
      <parameter property= " Idenid " column= " Idenid "/>
    </parameterMap>
  </parameterMaps>

  <resultMaps>
    <resultMap id= " selectMap_T_DepartmentInfo "  class= " DepartmentInfoModel ">
      <result property= " DepId " column= " DepId "/>
      <result property= " DepName " column= " DepName "/>
      <result property= " ParentDepId " column= " ParentDepId "/>
      <result property= " DepCode " column= " DepCode "/>
      <result property= " CustomerServicePhone " column= " CustomerServicePhone "/>
      <result property= " RevolvingLoanPhone " column= " RevolvingLoanPhone "/>
      <result property= " EarlyRepayPhone " column= " EarlyRepayPhone "/>
      <result property= " Email " column= " Email "/>
      <result property= " SignAddress " column= " SignAddress "/>
      <result property= " SignZipCode " column= " SignZipCode "/>
      <result property= " IsDeleted " column= " IsDeleted "/>
      <result property= " SignCity " column= " SignCity "/>
      <result property= " IsEnable " column= " IsEnable "/>
      <result property= " LastOperateId " column= " LastOperateId "/>
      <result property= " LastUpdateTime " column= " LastUpdateTime "/>
      <result property= " CreateTime " column= " CreateTime "/>
      <result property= " OperateId " column= " OperateId "/>
      <result property= " IsReceiveEmail " column= " IsReceiveEmail "/>
    </resultMap>

    <!--门店树 返回值 -->
    <resultMap id= " selectMap_T_DepartmentInfoTree "  class= " DepartmentInfoModel ">
      <result property= " DepId " column= " DepId "/>
      <result property= " SignZipCode " column= " SignZipCode "/>
      <result property= " IsDeleted " column= " IsDeleted "/>
      <result property= " SignCity " column= " SignCity "/>
      <result property= " IsEnable " column= " IsEnable "/>
      <result property= " LastOperateId " column= " LastOperateId "/>
      <result property= " LastUpdateTime " column= " LastUpdateTime "/>
      <result property= " CreateTime " column= " CreateTime "/>
      <result property= " OperateId " column= " OperateId "/>
      <result property= " DepName " column= " DepName "/>
      <result property= " ParentDepId " column= " ParentDepId "/>
      <result property= " DepCode " column= " DepCode "/>
      <result property= " CustomerServicePhone " column= " CustomerServicePhone "/>
      <result property= " RevolvingLoanPhone " column= " RevolvingLoanPhone "/>
      <result property= " EarlyRepayPhone " column= " EarlyRepayPhone "/>
      <result property= " Email " column= " Email "/>
      <result property= " SignAddress " column= " SignAddress "/>

      <result property= " ParentName " column= " ParentName "/>
      <result property= " sort " column= " sort "/>
      <result property= " level " column= " level "/>
      <result property= " IsReceiveEmail " column= " IsReceiveEmail "/>
    </resultMap>
  </resultMaps>


  <statements>
    <!-- 查询  需要后动修改分页时的排序字段 -->
    < select id= " select_T_DepartmentInfo " resultMap= " selectMap_T_DepartmentInfo "   resultClass= " DepartmentInfoModel "      parameterClass= " DepartmentInfoModel ">
      SELECT
      <isNotNull property= " TopNums ">
        <![CDATA[ top $TopNums$]]>
      </isNotNull>
      MAX(row_n) over(partition by  1as TotalItems, *
      FROM
      (
      <!-- ********* 必须要修改 order by a.Id ********* -->
      SELECT ROW_NUMBER() OVER ( PARTITION BY  1 ORDER BY a.DepId) AS row_n,a.DepId,a.DepName,a.ParentDepId,a.DepCode,a.CustomerServicePhone,a.RevolvingLoanPhone,a.EarlyRepayPhone,a.Email,a.SignAddress,a.SignZipCode,a.IsDeleted,a.SignCity,a.IsEnable,a.LastOperateId,a.LastUpdateTime,a.CreateTime,a.OperateId,a.IsReceiveEmail
      FROM  T_DepartmentInfo  as a
      < dynamic prepend= " where ">

        <isNotNull prepend= " and " property= " DepId ">
          <![CDATA[ a.DepId=#DepId#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " IsReceiveEmail ">
          <![CDATA[ a.IsReceiveEmail=#IsReceiveEmail#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " DepName ">
          <![CDATA[ a.DepName=#DepName#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " ParentDepId ">
          <![CDATA[ a.ParentDepId=#ParentDepId#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " DepCode ">
          <![CDATA[ a.DepCode=#DepCode#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " CustomerServicePhone ">
          <![CDATA[ a.CustomerServicePhone=#CustomerServicePhone#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " RevolvingLoanPhone ">
          <![CDATA[ a.RevolvingLoanPhone=#RevolvingLoanPhone#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " EarlyRepayPhone ">
          <![CDATA[ a.EarlyRepayPhone=#EarlyRepayPhone#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " Email ">
          <![CDATA[ a.Email=#Email#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " SignAddress ">
          <![CDATA[ a.SignAddress=#SignAddress#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " SignZipCode ">
          <![CDATA[ a.SignZipCode=#SignZipCode#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " IsDeleted ">
          <![CDATA[ a.IsDeleted=#IsDeleted#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " SignCity ">
          <![CDATA[ a.SignCity=#SignCity#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " IsEnable ">
          <![CDATA[ a.IsEnable=#IsEnable#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " LastOperateId ">
          <![CDATA[ a.LastOperateId=#LastOperateId#  ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " LastUpdateTime_B ">
          <![CDATA[ a.LastUpdateTime>=#LastUpdateTime_B# ]]>
        </isNotNull>
        <isNotNull prepend= " and " property= " LastUpdateTime_E ">
          <![CDATA[ a.LastUpdateTime<=#LastUpdateTime_E# ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " CreateTime_B ">
          <![CDATA[ a.CreateTime>=#CreateTime_B# ]]>
        </isNotNull>
        <isNotNull prepend= " and " property= " CreateTime_E ">
          <![CDATA[ a.CreateTime<=#CreateTime_E# ]]>
        </isNotNull>

        <isNotNull prepend= " and " property= " OperateId ">
          <![CDATA[ a.OperateId=#OperateId#  ]]>
        </isNotNull>

        <!-- 一个例子 -->
        <!--<isNotEmpty prepend= " and " property= " 属性名 ">
                       字段名 like  #属性名# 
               </isNotEmpty>-->
      </ dynamic>
      )  as a
      < dynamic prepend= " where ">
        <isNotNull property= " PrevPageNums ">
          <![CDATA[ a.row_n>$PrevPageNums$]]>
        </isNotNull>
      </ dynamic>


    </ select>

    <!-- 数据分析 树-->
    <procedure id= " select_T_DepartmentInfoTree " parameterMap= " selectMap_Dept_DeptInfo "  resultMap= " selectMap_T_DepartmentInfoTree " >
      Proc_LoanStorDept
    </procedure>



    <!-- 添加 -->
    <insert id= " insert_T_DepartmentInfo " parameterClass= " DepartmentInfoModel ">
      <selectKey property= " DepId " type= " post " resultClass= " int ">
        ${selectKey}
      </selectKey>
      INSERT INTO T_DepartmentInfo
      (
      DepName,ParentDepId,DepCode,CustomerServicePhone,RevolvingLoanPhone,EarlyRepayPhone,Email,SignAddress,SignZipCode,IsDeleted,SignCity,IsEnable,LastOperateId,LastUpdateTime,CreateTime,OperateId,IsReceiveEmail
      ) VALUES
      (
      #DepName#,#ParentDepId#,#DepCode#,#CustomerServicePhone#,#RevolvingLoanPhone#,#EarlyRepayPhone#,#Email#,#SignAddress#,#SignZipCode#,#IsDeleted#,#SignCity#,#IsEnable#,#LastOperateId#,#LastUpdateTime#,#CreateTime#,#OperateId#,#IsReceiveEmail#
      )

    </insert>

    <!-- 更新  -->
    <update id= " update_T_DepartmentInfo " parameterClass= " DepartmentInfoModel ">
      UPDATE T_DepartmentInfo SET

      DepName=#DepName#,
      ParentDepId=#ParentDepId#,
      DepCode=#DepCode#,
      CustomerServicePhone=#CustomerServicePhone#,
      RevolvingLoanPhone=#RevolvingLoanPhone#,
      EarlyRepayPhone=#EarlyRepayPhone#,
      Email=#Email#,
      SignAddress=#SignAddress#,
      SignZipCode=#SignZipCode#,
      IsDeleted=#IsDeleted#,
      SignCity=#SignCity#,
      IsEnable=#IsEnable#,
      LastOperateId=#LastOperateId#,
      LastUpdateTime=#LastUpdateTime#,
      CreateTime=#CreateTime#,
      OperateId=#OperateId#,
      IsReceiveEmail=#IsReceiveEmail#
      <!--  -->
      WHERE T_DepartmentInfo.DepId=#DepId#
    </update>

    <!--删除-->
    <delete id= " delete_T_DepartmentInfo " parameterClass= " DepartmentInfoModel ">
      DELETE FROM T_DepartmentInfo  where DepId=#DepId#
    </delete>

    <!-- 删除-->
    <delete id= " delete_flag_T_DepartmentInfo " parameterClass= " DepartmentInfoModel ">
      UPDATE  T_DepartmentInfo  set IsDeleted =  1  where DepId=#DepId#
    </delete>
  </statements>
</sqlMap>

 

 

 

posted on 2016-04-25 10:46  笨小孩做开发 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/dullbaby/p/5430090.html

已标记关键词 清除标记
表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
<p> <strong><span style="font-size:20px;color:#FF0000;">本课程主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的Java学习者</span></strong> </p> <p> <span style="color:#FF0000;"><strong><span style="font-size:18px;">1. 包含:<span style="color:#FFFF00;background-color:#FF0000;">项目源码、</span><span style="color:#FFFF00;background-color:#FF0000;">项目文档、数据库脚本、软件工具</span>等所有资料</span></strong></span> </p> <p> <span style="color:#FF0000;"><strong><span style="font-size:18px;">2. 手把手的带你从零开始部署运行本套系统</span></strong></span> </p> <p> <span style="color:#FF0000;"><strong><span style="font-size:18px;">3. 该项目附带的源码资料可作为毕设使用</span></strong></span> </p> <p> <span style="color:#FF0000;"><strong><span style="font-size:18px;">4. 提供技术答疑和远程协助指导</span></strong></span><strong><span style="font-size:18px;"></span></strong> </p> <p> <br /> </p> <p> <span style="font-size:18px;"><strong>项目运行截图:</strong></span> </p> <p> <strong><span style="font-size:18px;">1)系统登陆界面</span></strong> </p> <p> <strong><span style="font-size:18px;"><img src="https://img-bss.csdn.net/202002241015433522.png" alt="" /><br /> </span></strong> </p> <p> <strong><span style="font-size:18px;"><strong><span style="font-size:18px;">2)学生模块</span></strong></span></strong> </p> <p> <strong><span style="font-size:18px;"><img src="https://img-bss.csdn.net/202002241015575966.png" alt="" /></span></strong> </p> <p> <strong><span style="font-size:18px;"><strong><span style="font-size:18px;">3)教师模块</span></strong></span></strong> </p> <p> <strong><span style="font-size:18px;"><img src="https://img-bss.csdn.net/202002241016127898.png" alt="" /></span></strong> </p> <p> <strong><span style="font-size:18px;"><strong><span style="font-size:18px;">4)系统管理员</span></strong></span></strong> </p> <p> <strong><span style="font-size:18px;"><img src="https://img-bss.csdn.net/202002241016281177.png" alt="" /></span></strong> </p> <p> <strong><span style="font-size:18px;"><img src="https://img-bss.csdn.net/202002241016369884.png" alt="" /></span></strong> </p> <p> <strong><span style="font-size:18px;"><br /> </span></strong> </p> <p> <strong><span style="font-size:18px;"><strong><span style="font-size:18px;">更多Java毕设项目请关注我的毕设系列课程 <a href="https://edu.csdn.net/lecturer/2104">https://edu.csdn.net/lecturer/2104</a></span></strong></span></strong> </p> <p> <strong><span style="font-size:18px;"><br /> </span></strong> </p>
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页