在查询记录集合跟查询记录总记录数的时候,我们需要所写的SQL要一样,那么可以都引用同一个SQL。写法如下:

<sqlMap namespace="Server">
    <sql id="sql_select_BeneficiaryUmInfo">
        select id_beneficiary, id_um, remark from sibrms_beneficiary_um
        <dynamic prepend="where">
            <isNotEmpty prepend="and" property="id_beneficiary">
                id_beneficiary = #id_beneficiary#
            </isNotEmpty>
            <isNotEmpty prepend="and" property="id_um">
                id_um = #id_um#
            </isNotEmpty>
        </dynamic>
    </sql>
    <!-- 查询数据集合 -->
    <select id="select_BeneficiaryUmInfo"
        parameterClass="java.util.HashMap"
        resultClass="server.report.model.BeneficiaryUmInfo">
        <include refid="sql_select_BeneficiaryUmInfo" />        
    </select>
    <!-- 查询数据集合总记录数 -->
    <select id="select_BeneficiaryUmInfo_count"
        parameterClass="java.util.Map" resultClass="java.lang.Integer">
        select count(0) from(
        <include refid="sql_select_BeneficiaryUmInfo" />
        )
    </select></sqlMap>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2021-07-04
  • 2021-10-01
  • 2022-12-23
  • 2021-12-04
  • 2021-07-08
相关资源
相似解决方案