zoukankan      html  css  js  c++  java
  • mybetis中的代理模式

    //mybetis中的配置

    <mappers>
    <mapper resource="cn/hd/sale/mapper/SalesbeanMapper.xml"/>

    </mappers>

    //如果对象类中的属性字段和数据库中的字段不是一致的时候,一定要用resultMap将他们一一对应起来,否则就算是中日志中取到了值也不能在代理类的Mapping中取到值

    <select id="pageModel" parameterType="cn.hd.sale.po.Salesbean" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from crm_sales
    <where>
    <if test="sCustName!=null and sCustName!=''">
    and s_cust_name like #{sCustName}
    </if>
    <if test="sOutline!=null and sOutline!=''">
    and s_outline like #{sOutline}
    </if>
    <if test="sContatcs!=null and sContatcs!=''">
    and s_contatcs like #{sContatcs}
    </if>
    </where>

    </select>

    <resultMap id="BaseResultMap" type="cn.hd.sale.po.Salesbean">
    <!-- WARNING - @mbggenerated This element is automatically generated by
    MyBatis Generator, do not modify. This element was generated on Thu Dec 01
    14:05:57 CST 2016. -->
    <id column="s_id" property="sId" jdbcType="INTEGER" />
    <result column="s_sale_no" property="sSaleNo" jdbcType="INTEGER" />
    <result column="s_cust_name" property="sCustName" jdbcType="VARCHAR" />
    <result column="s_outline" property="sOutline" jdbcType="VARCHAR" />
    <result column="s_contatcs" property="sContatcs" jdbcType="VARCHAR" />
    <result column="s_contatcs_phone" property="sContatcsPhone"
    jdbcType="VARCHAR" />
    <result column="s_create_time" property="sCreateTime" jdbcType="DATE" />
    <result column="s_creater" property="sCreater" jdbcType="VARCHAR" />
    <result column="s_opp_src" property="sOppSrc" jdbcType="VARCHAR" />
    <result column="s_succodds" property="sSuccodds" jdbcType="VARCHAR" />
    <result column="s_describe" property="sDescribe" jdbcType="VARCHAR" />
    <result column="s_assgin" property="sAssgin" jdbcType="VARCHAR" />
    <result column="s_assgin_time" property="sAssginTime" jdbcType="DATE" />
    </resultMap>

  • 相关阅读:
    Asp.Net Core 3.1 使用Autofac Aop
    Abp中的工作单元UnitOfWork的Aop是如何实现的
    Asp.Net Core 3.1 Api 集成Abp项目AutoMapper
    Asp.Net Core 3.1 Api 集成Abp项目动态WebApi
    php限制登录次数
    vbs小实例
    php导出数据到excel
    mysqli单例模式连接数据库
    微信JsApi支付
    HTML5新增表单控件
  • 原文地址:https://www.cnblogs.com/joyous-day/p/6128256.html
Copyright © 2011-2022 走看看