zoukankan      html  css  js  c++  java
  • mbatis xml文件写法

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
    <mapper namespace="com.bill99.acs.fmp.base.org.seashell.technical.dao.IBatchDao">
       <resultMap id="batchEo" type="com.bill99.acs.fmp.base.org.seashell.technical.model.BatchEo">
          <result property="batchId" column="BATCH_ID" />
          <result property="batchType" column="BATCH_TYPE" />
          <result property="jobId" column="JOB_ID" />
          <result property="ruleId" column="RULE_ID" />
          <result property="batchName" column="BATCH_NAME" />
          <result property="batchCode" column="BATCH_CODE" />
          <result property="totalNum" column="TOTAL_NUM" />
          <result property="totalAmount" column="TOTAL_AMOUNT" />
          <result property="memo" column="MEMO" />
          <result property="crtTime" column="CRT_TIME" />
          <result property="updTime" column="UPD_TIME" />
          <result property="channelCode" column="CHANNEL_CODE" />
       </resultMap>
    
    <!-- 全部列名 -->
        <sql id="allColumns">
        BATCH_ID,
        BATCH_TYPE,
        JOB_ID,
        RULE_ID,
        BATCH_NAME,
        BATCH_CODE,
        TOTAL_NUM,
        TOTAL_AMOUNT,
        MEMO,
        CRT_TIME,
        UPD_TIME,
        CHANNEL_CODE
        </sql>
    
    
        <!-- 公共查询条件  分页+明细 -->
        <sql id="query_where_condition">
            FROM SEASHELL.T_FMP_BATCH
            <where>
                <if test="batchId != null"> and BATCH_ID = #{batchId} </if>
                <if test="beginCrtDateTime != null">AND CRT_TIME &gt;= to_date(#{beginCrtDateTime},'yyyy-mm-dd hh24:mi:ss')</if>
                <if test="endCrtDateTime != null">AND CRT_TIME &lt;= to_date(#{endCrtDateTime},'yyyy-mm-dd hh24:mi:ss')</if>
                <if test="batchType != null"> and BATCH_TYPE = #{batchType} </if>
                <if test="jobId != null"> and JOB_ID = #{jobId} </if>
                <if test="ruleId != null"> and RULE_ID = #{ruleId} </if>
                <if test="batchName != null"> and BATCH_NAME = #{batchName} </if>
                <if test="vagueBatchName != null and vagueBatchName != ''">AND BATCH_NAME like CONCAT(CONCAT('%',#{vagueBatchName}),'%')</if>
                <if test="batchCode != null"> and BATCH_CODE = #{batchCode} </if>
                <if test="totalNum != null"> and TOTAL_NUM = #{totalNum} </if>
                <if test="totalAmount != null"> and TOTAL_AMOUNT = #{totalAmount} </if>
                <if test="memo != null"> and MEMO = #{memo} </if>
                <if test="beginCrtTime != null">AND CRT_TIME &gt;= to_date(#{beginCrtTime},'yyyy-mm-dd')</if>
                <if test="endCrtTime != null">AND CRT_TIME &lt;= to_date(#{endCrtTime},'yyyy-mm-dd')</if>
                <if test="beginUpdTime != null">AND UPD_TIME &gt;= to_date(#{beginUpdTime},'yyyy-mm-dd')</if>
                <if test="endUpdTime != null">AND UPD_TIME &lt;= to_date(#{endUpdTime},'yyyy-mm-dd')</if>
                <if test="channelCode != null"> and CHANNEL_CODE = #{channelCode} </if>
                <if test="vagueChannelCode != null and vagueChannelCode != ''"> AND CHANNEL_CODE like CONCAT(CONCAT('%',#{vagueChannelCode}),'%')</if>
                <if test="batchIds !=null and batchIds.size() !=0">
                    and BATCH_ID in
                    <foreach collection="batchIds" item="item"
                        separator="," open="(" close=")">
                        #{item}
                    </foreach>
                </if>
            </where>
        </sql>
    
        <select id="query"
            parameterType="com.bill99.acs.fmp.base.org.seashell.domain.query.BatchForQuery"
            resultMap="batchEo">
            select
            <include refid="allColumns" />
            <include refid="query_where_condition" />
            
            <if test="page!=null and page.orderField != null"> ORDER BY ${page.orderField} </if>
            <if test="page!=null and page.orderDirection != null"> ${page.orderDirection} </if>
        </select>
    </mapper>
  • 相关阅读:
    Pytorch——张量 Tensors
    Pytorch——cuda的使用
    神经网络训练模型的两种写法
    Pytorch——torch.nn.init 中实现的初始化函数
    线性回归的简洁实现
    Pytorch——net.parameters()参数获取
    Tensor和NumPy相互转换
    Codeforces Round #600 (Div. 2) A、B
    2020-2021 ACM-ICPC, Asia Seoul Regional Contest G. Mobile Robot
    大组合数模板
  • 原文地址:https://www.cnblogs.com/wsy0202/p/13898905.html
Copyright © 2011-2022 走看看