• 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>

  • 相关阅读:
    Sublime text 2 编辑器
    SWF文件版本支持映射表
    sql SET DATEFORMAT对日期处理的影响
    关于 getQualifiedDefinitionNames() 的使用场景
    prototypephotoarchive.cs
    jQuery easyui layout布局自适应浏览器大小
    iteratorfamilytree.cs
    内存利用率
    SET LANGUAGE对日期处理的影响示例
    mbox:Unix 的入门级邮箱
  • 原文地址:https://www.cnblogs.com/joyous-day/p/6128256.html
Copyright © 2020-2023  润新知