cn.gtmap.estateplat.core.support.mybatis.mapper
类 EntityMapper

java.lang.Object
  继承者 cn.gtmap.estateplat.core.support.mybatis.mapper.EntityMapper

public class EntityMapper
extends Object

封装的CommonMapper,实际上只对select方法做了处理

该类起名Mapper结尾只是为了表面上看着统一,实际上和普通的Mapper不是一类东西

作者:
zx

构造方法摘要
EntityMapper()
           
 
方法摘要
<T> void
batchSaveSelective(List<T> record)
          批量插入多个类型的实体类,其他和上面方法类似
<T> int
count(T record)
          根据参数进行查询总数,record可以是Class
<T> int
countByExample(Class<T> entityClass, Object example)
          通过Example类来查询count
<T> int
countByExample(Example example)
          通过Example类来查询count
<T> int
delete(T record)
          根据条件进行删除,条件不能为空,并且必须有至少一个条件才能删除
该方法不能直接删除全部数据
<T> int
deleteByExample(Class<T> entityClass, Object example)
          通过Example删除
<T> int
deleteByExample(Example example)
          通过Example删除
<T> int
deleteByPrimaryKey(Class<T> entityClass, Object key)
          根据主键进行删除,主键不能为null或空
 CommonMapper getCommonMapper()
           
<T> int
insert(T record)
          插入数据库,主键字段没有值的时候不会出现在sql中
如果是自增主键,会自动获取值
如果是自增主键,并且该主键属性有值,会使用主键的属性值,不会使用自增
<T> int
insertBatchSelective(List<T> record)
          批量插入非空字段,其他和上面方法类似
<T> int
insertSelective(T record)
          插入非空字段,其他和上面方法类似
<T> int
saveOrUpdate(T record, Object key)
          保存或者更新
<T> List<T>
select(T record)
          根据参数进行查询,record可以是Class
<T> List<T>
selectByExample(Class<T> entityClass, Object example)
          通过Example来查询
<T> List<T>
selectByExample(Example example)
          通过Example来查询
<T> T
selectByPrimaryKey(Class<T> entityClass, Object key)
          根据主键查询结果,主键不能为null或空
 void setCommonMapper(CommonMapper commonMapper)
           
<T> int
updateByExample(T record, Object example)
          通过Example进行更新全部字段
<T> int
updateByExampleSelective(T record, Object example)
          通过Example进行更新非空字段
<T> int
updateByPrimaryKey(T record)
          根据主键更新全部字段,空字段也会更新数据库
<T> int
updateByPrimaryKeyNull(T record)
          lst 根据主键更新全部字段,空字段也会更新数据库 null也会更新
<T> int
updateByPrimaryKeySelective(T record)
          根据主键更新非空属性字段,不能给数据库数据设置null或空
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

EntityMapper

public EntityMapper()
方法详细信息

getCommonMapper

public CommonMapper getCommonMapper()

setCommonMapper

public void setCommonMapper(CommonMapper commonMapper)

select

public <T> List<T> select(T record)
根据参数进行查询,record可以是Class类型
查询条件为属性String类型不为空,其他类型!=null时
where property = ? and property2 = ? 条件

类型参数:
T -
参数:
record -
返回:

count

public <T> int count(T record)
根据参数进行查询总数,record可以是Class类型
查询条件为属性String类型不为空,其他类型!=null时
where property = ? and property2 = ? 条件

类型参数:
T -
参数:
record -
返回:

selectByPrimaryKey

public <T> T selectByPrimaryKey(Class<T> entityClass,
                                Object key)
根据主键查询结果,主键不能为null或空

类型参数:
T -
参数:
entityClass -
key -
返回:

insert

public <T> int insert(T record)
插入数据库,主键字段没有值的时候不会出现在sql中
如果是自增主键,会自动获取值
如果是自增主键,并且该主键属性有值,会使用主键的属性值,不会使用自增

类型参数:
T -
参数:
record -
返回:

insertSelective

public <T> int insertSelective(T record)
插入非空字段,其他和上面方法类似

类型参数:
T -
参数:
record -
返回:

insertBatchSelective

public <T> int insertBatchSelective(List<T> record)
批量插入非空字段,其他和上面方法类似

类型参数:
T -
参数:
record -
返回:

batchSaveSelective

public <T> void batchSaveSelective(List<T> record)
批量插入多个类型的实体类,其他和上面方法类似

类型参数:
T -
参数:
record -

saveOrUpdate

public <T> int saveOrUpdate(T record,
                            Object key)
保存或者更新

类型参数:
T -
参数:
record -
key -
返回:

delete

public <T> int delete(T record)
根据条件进行删除,条件不能为空,并且必须有至少一个条件才能删除
该方法不能直接删除全部数据

类型参数:
T -
参数:
record -
返回:

deleteByPrimaryKey

public <T> int deleteByPrimaryKey(Class<T> entityClass,
                                  Object key)
根据主键进行删除,主键不能为null或空

类型参数:
T -
参数:
entityClass -
key -
返回:

updateByPrimaryKey

public <T> int updateByPrimaryKey(T record)
根据主键更新全部字段,空字段也会更新数据库

类型参数:
T -
参数:
record -
返回:

updateByPrimaryKeySelective

public <T> int updateByPrimaryKeySelective(T record)
根据主键更新非空属性字段,不能给数据库数据设置null或空

类型参数:
T -
参数:
record -
返回:

updateByPrimaryKeyNull

public <T> int updateByPrimaryKeyNull(T record)
lst 根据主键更新全部字段,空字段也会更新数据库 null也会更新

类型参数:
T -
参数:
record -
返回:

countByExample

public <T> int countByExample(Class<T> entityClass,
                              Object example)
通过Example类来查询count

类型参数:
T -
参数:
entityClass -
example - 可以是Mybatis生成器生成的Example类或者通用的Example类
返回:

countByExample

public <T> int countByExample(Example example)
通过Example类来查询count

类型参数:
T -
参数:
example -
返回:

deleteByExample

public <T> int deleteByExample(Class<T> entityClass,
                               Object example)
通过Example删除

类型参数:
T -
参数:
entityClass -
example - 可以是Mybatis生成器生成的Example类或者通用的Example类
返回:

deleteByExample

public <T> int deleteByExample(Example example)
通过Example删除

类型参数:
T -
参数:
example -
返回:

selectByExample

public <T> List<T> selectByExample(Class<T> entityClass,
                                   Object example)
通过Example来查询

类型参数:
T -
参数:
entityClass -
example - 可以是Mybatis生成器生成的Example类或者通用的Example类
返回:

selectByExample

public <T> List<T> selectByExample(Example example)
通过Example来查询

类型参数:
T -
参数:
example -
返回:

updateByExampleSelective

public <T> int updateByExampleSelective(T record,
                                        Object example)
通过Example进行更新非空字段

类型参数:
T -
参数:
record -
example - 可以是Mybatis生成器生成的Example类或者通用的Example类
返回:

updateByExample

public <T> int updateByExample(T record,
                               Object example)
通过Example进行更新全部字段

类型参数:
T -
参数:
record -
example - 可以是Mybatis生成器生成的Example类或者通用的Example类
返回:


Copyright © 2015–2016 cn.gtmap. All rights reserved.