liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.common.persistence;
 
import java.util.List;
 
import org.apache.ibatis.annotations.Param;
 
/**
 * DAO支持类实现
 * @author jeeplus
 * @version 2014-05-16
 * @param <T>
 */
public interface CrudDao<T> extends BaseDao {
 
    /**
     * 获取单条数据
     * @param id
     * @return
     */
    public T get(String id);
    
    /**
     * 获取单条数据
     * @param entity
     * @return
     */
    public T get(T entity);
    
    /**
     * 根据实体名称和字段名称和字段值获取唯一记录
     * 
     * @param <T>
     * @param entityClass
     * @param propertyName
     * @param value
     * @return
     */
    public  T findUniqueByProperty(@Param(value="propertyName")String propertyName, @Param(value="value")Object value);
 
    
    /**
     * 查询数据列表,如果需要分页,请设置分页对象,如:entity.setPage(new Page<T>());
     * @param entity
     * @return
     */
    public List<T> findList(T entity);
    
    /**
     * 查询所有数据列表
     * @param entity
     * @return
     */
    public List<T> findAllList(T entity);
    
    /**
     * 查询所有数据列表
     * @see public List<T> findAllList(T entity)
     * @return
     */
    @Deprecated
    public List<T> findAllList();
    
    /**
     * 插入数据
     * @param entity
     * @return
     */
    public int insert(T entity);
    
    /**
     * 更新数据
     * @param entity
     * @return
     */
    public int update(T entity);
    
    /**
     * 删除数据(物理删除,从数据库中彻底删除)
     * @param id
     * @see public int delete(T entity)
     * @return
     */
    @Deprecated
    public int delete(String id);
    
    /**
     * 删除数据(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
     * @param id
     * @see public int delete(T entity)
     * @return
     */
    @Deprecated
    public int deleteByLogic(String id);
    
    /**
     * 删除数据(物理删除,从数据库中彻底删除)
     * @param entity
     * @return
     */
    public int delete(T entity);
    
    /**
     * 删除数据(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
     * @param entity
     * @return
     */
    public int deleteByLogic(T entity);
    
}