首页 > 代码库 > mybetis中的代理模式
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>
mybetis中的代理模式