mybatis

2017-06-12  本文已影响0人  张三的张

mybatis 高级映射

<association property="adposition" column="ad_position_id" select="com.huixin.dao.AdpositionMapper.selectByPrimaryKey"/>
<collection property="skuList" column="material_id" select="com.huixin.dao.MaterialSkuMapper.getMaterialSkuByMaterialId" />

mybatis generator 的使用

//例如: name like '%张三%' or nike_name like zhangsan and status=0 这种查询
ShopExample example = new ShopExample();
Criteria where = example.createCriteria();
where.addCriterion( " ( company_type=" + companyType + " or company_type=" + companyType1 +")" );
where.andStatusEqualTo( status );

但是需要将 xxxExample 类的对应方法的访问修饰符改为public

上一篇 下一篇

猜你喜欢

热点阅读