三星a8 a9 a10性能对比现在的价格是多少

温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
如果你想引入Jar包,你可以从下面的地址下载:
由于通用Mapper依赖JPA,所以还需要下载persistence-api-1.0.jar:
集成通用Mapper
3.2.0版本以后配置更简单,以前的拦截器不能继续使用。
配置方式分为Java编码方式和spring集成方式。
1). Java编码方式
MapperHelper mapperHelper = new MapperHelper();
//特殊配置
Config config = new Config();
//具体支持的参数看后面的文档
config.setXXX(XXX);
//设置配置
mapperHelper.setConfig(config);
// 注册自己项目中使用的通用Mapper接口,这里没有默认值,必须手动注册
mapperHelper.registerMapper(Mapper.class);
//配置完成后,执行下面的操作
mapperHelper.processConfiguration(session.getConfiguration());
2). 纯Spring配置方式
&bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer"&
&property name="basePackage" value="com.isea533.mybatis.mapper"/&
&property name="properties"&
mappers=tk.mon.Mapper
&/property&
你没看错,就是这么配置的,注意这里是tk.mybatis.xxx,和MyBatis的唯一区别就是org.改成了tk.,方便修改和记忆。
通用Mapper的各项属性通过properties属性进行配置,如果默认配置就是一行mappers=tk.mon.Mapper时,可以不写,就会变成:
&bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer"&
&property name="basePackage" value="com.isea533.mybatis.mapper"/&
关于MyBatis-Spring详细配置的可以查看
可配参数介绍
UUID:设置生成UUID的方法,需要用OGNL方式配置,不限制返回值,但是必须和字段类型匹配
IDENTITY:取回主键的方式,可以配置的内容看下一篇如何使用中的介绍
ORDER:&selectKey&中的order属性,可选值为BEFORE和AFTER
catalog:数据库的catalog,如果设置该值,查询的时候表名会带catalog设置的前缀
schema:同catalog,catalog优先级高于schema
seqFormat:序列的获取规则,使用{num}格式化参数,默认值为{0}.nextval,针对Oracle,可选参数一共4个,对应0,1,2,3分别为SequenceName,ColumnName, PropertyName,TableName
notEmpty:insert和update中,是否判断字符串类型!='',少数方法会用到
style:实体和表转换时的规则,默认驼峰转下划线,可选值为normal用实体名和字段名;camelhump是默认值,驼峰转下划线;uppercase转换为大写;lowercase转换为小写
enableMethodAnnotation:可以控制是否支持方法上的JPA注解,默认false。
使用Properties文件配置时使用上面的属性名,使用Config类配置时,调用相应的setter即可。
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'如何集成通用Mapper',
blogAbstract:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}Mybatis 通用 Mapper 2.1.0 发布
Mybatis通用Mapper极其方便的使用Mybatis单表的增删改查
本项目支持两种类型的通用Mapper,这两种Mapper都可以极大的方便开发人员。
为了让您更方便的了解这两种通用Mapper,这里分别贴一段代码来看实际效果。
通用Mapper
这是本项目提供的第一种通用Mapper,优点是可以缓存,全部针对单表操作,每个实体类都需要继承通用Mapper接口来获得通用方法。
示例代码: CountryMapper&mapper&=&sqlSession.getMapper(CountryMapper.class);
//查询全部
List&Country&&countryList&=&mapper.select(new&Country());
Assert.assertEquals(183,&countryList.size());
//通用Example查询
Example&example&=&new&Example(Country.class);
example.createCriteria().andGreaterThan("id",&100);
countryList&=&mapper.selectByExample(example);
Assert.assertEquals(83,&countryList.size());
//MyBatis-Generator生成的Example查询
CountryExample&example2&=&new&CountryExample();
example2.createCriteria().andIdGreaterThan(100);
countryList&=&mapper.selectByExample(example2);
Assert.assertEquals(83,&countryList.size());
CountryMapper代码如下: public&interface&CountryMapper&extends&Mapper&Country&&{
这里不说更具体的内容,如果您有兴趣,可以查看项目文档EntityMapper
这是第二种通用Mapper,EntityMapper可以像Hibernate的session一样操纵全部的实体类,由于可以操纵全部实体,因此不能使用二级缓存。EntityMapper支持通用的Example查询和MGB生成的Example查询。
示例代码: //获取CommonMapper,继而包装成EntityMapper
CommonMapper&commonMapper&=&sqlSession.getMapper(CommonMapper.class);
EntityMapper&entityMapper&=&new&EntityMapper(commonMapper);
//通用Example查询
Example&example&=&new&Example(Country.class);
//id&&&100&&&&id&&=&150
example.createCriteria().andGreaterThan("id",&100).andLessThanOrEqualTo("id",&150);
//查询总数
int&count&=&entityMapper.countByExample(example);
Assert.assertEquals(50,&count);
example&=&new&Example(Country.class);
//countryname&like&'A%'
example.createCriteria().andLike("countryname",&"A%");
//查询总数
count&=&entityMapper.countByExample(example);
Assert.assertEquals(12,&count);实体类注解
从上面效果来看也能感觉出这是一种类似hibernate的用法,因此也需要实体和表对应起来,因此使用了JPA注解。更详细的内容可以看项目文档。
Country代码: public&class&Country&{&@Id&private&Integer&&@Column&private&String&&private&String&&//省略setter和getter方法&}&可以方便的生成这些(带注解的)实体类。
最新版本2.1.0
通用Mapper接口增加Example查询方法,包括以下方法:
int selectCountByExample(Object example);
int deleteByExample(Object example);
List selectByExample(Object example);
int updateByExampleSelective(@Param("record") T record, @Param("example") Object example);
int updateByExample(@Param("record") T record, @Param("example") Object example);
通用Example增加了一个exists的参数,当true的时候如果使用的字段不存在会抛出异常,false时不抛出异常,但是不使用该字段的条件。
通用Mapper
EntityMapper(单一Mapper操作全部实体)
Mybatis 通用 Mapper 的详细介绍:
Mybatis 通用 Mapper 的下载地址:
转载请注明:文章转载自 开源中国社区
本文标题:Mybatis 通用 Mapper 2.1.0 发布
本文地址:
引用来自“Liuzh_533”的评论怎么可能存在即小于又等于的情况呢?应该是小于或等于,符号就是&=(⊙o⊙)… 是我错了
怎么可能存在即小于又等于的情况呢?应该是小于或等于,符号就是&=温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
所有的方法都按照上面的方式进行了拆分。
拆分后我需要那些方法,我就继承那些方法。你会不会觉得这样变的更麻烦了?
接口可以自定义搭配继承
接上面的问题,你会不会觉得这样变的更麻烦了?
我们看看BaseSelectMapper&T&接口:
* 通用Mapper接口,基础查询
* @param &T& 不能为空
* @author liuzh
public interface BaseSelectMapper&T& extends
SelectOneMapper&T&,
SelectMapper&T&,
SelectCountMapper&T&,
SelectByPrimaryKeyMapper&T& {
有没有发现什么,BaseSelectMapper&T&中并不包含任何方法,但是继承了4个通用的select查询方法。
如果我想使用这4种通用的查询方法,我并不需要去一个个继承这4个方法,我只需要继承BaseSelectMapper&T&即可。
如果你已经豁然开朗,你可能知道该如何使用了,如果还迷糊,再看下面的例子。
为了不影响Mapper2以前版本的使用,Mapper&T&接口和以前没什么区别,只是多了一些方法。
public interface Mapper&T& extends
BaseMapper&T&,
ExampleMapper&T&,
RowBoundsMapper&T& {
看上面代码,如果你继承Mapper&T&,那么以前使用Mapper2的项目不需要做任何改变。
总结:你完全可以自定义一个MyMapper&T&,然后继承你想要的接口方法,在你自己的项目中,继承你自己的MyMapper&T&即可。
熟悉Mapper2多接口的可能会发现一个问题,以Spring中配置Mapper的部分代码为例:
&bean class="tk.mybatis.mapper.mapperhelper.MapperInterceptor"&
&property name="properties"&
&!-- 属性一行一个,具体属性参考mybatis-config.xml中的属性 --&
mappers=tk.mon.Mapper
&/property&
在Mapper2中,如果你继承了多个通用接口,mappers需要把所有的通用接口都配置上,中间用逗号,隔开。
像Mapper3中,提供了这么多的接口,难道都要一个个配置上吗?
继承接口自动注册,只需要配置基础接口
这个标题看着不顺,举个例子说明。
如果我自己的整个项目中只用到了Mapper&T&接口,那么只配置一个mappers=tk.mon.Mapper即可。
Mapper&T&继承的所有父接口都会自动注册,因为父接口会自动注册,所以mappers配置Mapper&T&之后,所有的父接口都是可以单独用的。
也就是说我项目中的接口,可以自由搭配Mapper&T&父接口中的所有单独的接口。
如果我创建了自己的com.xxx.MyMapper&T&,并且项目中只用到了自己的com.xxx.MyMapper&T&,那么只需要配置mappers=com.xxx.MyMapper即可。
从这一点应该很容易看出来,项目中的代码和通用Mapper完全解耦,建议你自己创建一个基础接口。
个人建议创建一个自己的通用接口,方便将来的自由扩展和搭配
如果你使用的接口互相没有继承关系,那么你需要把这些接口都配置在mappers属性上,和Mapper2一样。
极其简单的扩展方式
除了Mapper2中支持的两种方式外(]
增加了一种简单的方式,看下面一个例子:
public interface InsertListMapper&T& {
* 批量插入,支持数据库自增字段,支持回写
* @param recordList
@Options(useGeneratedKeys = true, keyProperty = "id")
@InsertProvider(type = SpecialProvider.class, method = "dynamicSQL")
int insertList(List&T& recordList);
这是一个批量插入的接口,这里限制自增属性为id。
我们看看实现类SpecialProvider中的insertList(方法名必须和接口方法名一致)方法:
public String insertList(MappedStatement ms) {
final Class&?& entityClass = getSelectReturnType(ms);
//获取表的各项属性
EntityHelper.EntityTable table = EntityHelper.getEntityTable(entityClass);
//开始拼sql
StringBuilder sql = new StringBuilder();
sql.append("insert into ");
sql.append(table.getName());
sql.append("(");
boolean first = true;
for (EntityHelper.EntityColumn column : table.getEntityClassColumns()) {
if(!first) {
sql.append(",");
sql.append(column.getColumn());
first = false;
sql.append(") values ");
sql.append("&foreach collection=\"list\" item=\"record\" separator=\",\" &");
sql.append("(");
first = true;
for (EntityHelper.EntityColumn column : table.getEntityClassColumns()) {
if(!first) {
sql.append(",");
sql.append("#{record.").append(column.getProperty()).append("}");
first = false;
sql.append(")");
sql.append("&/foreach&");
return sql.toString();
从获取表的各项属性后,完全就是一个拼SQL的过程,这个过程需要注意的是,这里拼的是XML中的形式。
上面就是两次循环列,最后拼个sql,sql形式如下:
insert into 表(id,xxx,xxx,...)
&foreach collection="list" item="record" separtor=","&
(#{record.id},#{record.xxx},...)
&/foreach&
相信这种简单的拼字符串难不倒任何一个人,只要你能在xml写出来,就能在这儿拼出来。
阅读(889)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'通用Mapper3变化',
blogAbstract:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}使用mybatis完成通用dao和通用service - 有乐窝
使用通用dao和通用service可以减少代码的开发。可以将常用的增删改查放到通用dao中。对不同的or框架,基本上都有自己的实现如SpringJPA的Repository就提供了常用的增删改查方法。而MyBatis借助代码生成工具也可以生成常用方法的映射
这里只针对Mybatis。如果使用代码生成工具,会有一个问题:每个Mapper里面都有一些方法(增晒改查)。维护起来的话还好。只是在写service的时候会有一个问题。比如UserMapper里面有
insert(User user)
find(Integer id)
delete(Integer id)
等方法,则在service中也要有这些方法的实现。假设每个Mapper有5个方法。则service也需要有5个方法的实现。如果有10个实体类。mapper可以省略(由生成工具生成),但是service有50个方法。到后期肯定不好进行维护
使用通用Mapper和Service
该通用Mapper使用了Spring-mybatis。所以没有实现类,而是直接调用xml文件中的同名方法。之所以将通用Mapper抽出来主要是为了方便些通用的service
通用接口,该接口方法的名称与使用代码生成工具的名称完全相同
package cn.liuyiyou.yishop.mapper;
import java.io.Serializable;
public interface BaseMapper&T,ID extends Serializable& {
int deleteByPrimaryKey(ID id);
int insert(T record);
int insertSelective(T record);
T selectByPrimaryKey(ID id);
int updateByPrimaryKeySelective(T record);
int updateByPrimaryKeyWithBLOBs(T record);
int updateByPrimaryKey(T record);
通用service接口。为了方便,名字和通用Mapper同名,其实更倾向于命名add。edit,find这类的命名,显得更加面向对象
package cn.liuyiyou.yishop.service;
import java.io.Serializable;
public interface BaseService&T,ID extends Serializable& {
void setBaseMapper();
int deleteByPrimaryKey(ID id);
int insert(T record);
int insertSelective(T record);
T selectByPrimaryKey(ID id);
int updateByPrimaryKeySelective(T record);
int updateByPrimaryKeyWithBLOBs(T record);
int updateByPrimaryKey(T record);
通用service实现。也很简单。就是调用通用mapper里面的方法即可
package cn.liuyiyou.yishop.service.impl;
import java.io.Serializable;
import cn.liuyiyou.yishop.mapper.BaseMapper;
import cn.liuyiyou.yishop.service.BaseService;
public abstract
class AbstractService&T, ID extends Serializable& implements BaseService&T, ID& {
private BaseMapper&T, ID& baseMapper;
public void setBaseMapper(BaseMapper&T, ID& baseMapper) {
this.baseMapper = baseMapper;
public int deleteByPrimaryKey(ID id) {
return baseMapper.deleteByPrimaryKey(id);
public int insertSelective(T record) {
return baseMapper.insertSelective(record);
public T selectByPrimaryKey(ID id) {
return baseMapper.selectByPrimaryKey(id);
public int updateByPrimaryKeySelective(T record) {
return baseMapper.updateByPrimaryKey(record);
public int updateByPrimaryKeyWithBLOBs(T record) {
return baseMapper.updateByPrimaryKeyWithBLOBs(record);
public int updateByPrimaryKey(T record) {
return baseMapper.updateByPrimaryKey(record);
public int insert(T record) {
return baseMapper.insert(record);
具体的Mapper写法:
package cn.liuyiyou.yishop.mapper;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.liuyiyou.yishop.domain.ProductCategory;
@Repository
public interface ProductCategoryMapper extends BaseMapper&ProductCategory, Long&{
* 通过父id得到类目列表
* @param praentId
List&ProductCategory& selectByParent(Long parent);
具体的Servicd
package cn.liuyiyou.yishop.service.impl;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.liuyiyou.yishop.domain.Ad;
import cn.liuyiyou.yishop.domain.Product;
import cn.liuyiyou.yishop.mapper.AdMapper;
import cn.liuyiyou.yishop.mapper.ProductMapper;
import cn.liuyiyou.yishop.service.ProductService;
public class ProductServiceImpl extends AbstractService&Product,Long& implements ProductService {
@Autowired
private ProductMapper productMapper;
@Autowired
private AdMapper adMapper;
//这句必须要加上。不然会报空指针异常,因为在实际掉用的时候不是BaseMapper调用,而是这个productMapper
@Autowired
public void setBaseMapper(){
super.setBaseMapper(productMapper);
public Map&String,Object& testTwo() {
Product product = productMapper.selectByPrimaryKey(1l);
Ad ad = adMapper.selectByPrimaryKey(1l);
Map&String,Object& map = new HashMap&String,Object&();
map.put(&product&, product);
map.put(&ad&, ad);
return map;
//base-dao-service/ –这个好像有提到好坏
http://git.oschina.net/free/Mapper/blob/master/UseMapperInSpring4.md –这个看了一下,但是没有进行试验,不知道好坏与否
转自://base-mybatis-dao/
你还未登录,请先&&或者,注册

我要回帖

更多关于 a8和a9处理器的区别 的文章

 

随机推荐