Skip to content

Commit 4c4e526

Browse files
committed
update
1 parent 4df6ecb commit 4c4e526

File tree

2 files changed

+62
-51
lines changed

2 files changed

+62
-51
lines changed

core/src/main/java/lazy/fast/code/core/orm/BaseService.java

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,75 +15,86 @@ public interface BaseService<T extends BaseEntity> {
1515
/**
1616
* 保存一个实体,null的属性不会保存,会使用数据库默认值
1717
*
18-
* @param record
19-
* @return
18+
* @param entity
19+
* 实体对象
20+
* @return 保存成功记录数
2021
*/
21-
int save(T record);
22+
int save(T entity);
2223

2324
/**
2425
* 根据主键更新属性不为null的值
2526
*
26-
* @param record
27-
* @return
27+
* @param entity
28+
* 实体对象
29+
* @return 删除成功记录数
2830
*/
29-
int update(T record);
31+
int update(T entity);
3032

3133
/**
3234
* 根据主键字段进行删除
3335
*
34-
* @param key
35-
* @return
36+
* @param id
37+
* 数据主键
38+
* @return 删除成功记录数
3639
*/
37-
int remove(Serializable key);
40+
int remove(Serializable id);
3841

3942
/**
4043
* 根据实体属性作为条件进行删除
4144
*
42-
* @param record
43-
* @return
45+
* @param entity
46+
* 实体对象
47+
* @return 删除成功记录数
4448
*/
45-
int remove(T record);
49+
int remove(T entity);
4650

4751
/**
48-
* 根据主键字段进行查询
52+
* 根据主键查询一个实体
4953
*
50-
* @param key
51-
* @return
54+
* @param id
55+
* 数据主键
56+
* @return 实体
5257
*/
53-
T get(Serializable key);
58+
T get(Serializable id);
5459

5560
/**
56-
* 根据实体中的属性进行查询,只能有一个返回值,有多个结果是抛出异常
61+
* 根据实体中的属性查询一个实体
5762
*
58-
* @param record
59-
* @return
63+
* @param entity
64+
* 实体对象
65+
* @return 实体
6066
*/
61-
T get(T record);
67+
T get(T entity);
6268

6369
/**
64-
* 根据实体中的属性值进行查询
70+
* 根据实体中的属性值查询实体集合
6571
*
66-
* @param record
67-
* @return
72+
* @param entity
73+
* 实体对象
74+
* @return 实体集合
6875
*/
69-
List<T> list(T record);
76+
List<T> list(T entity);
7077

7178
/**
72-
* 根据实体属性和RowBounds进行分页查询
79+
* 根据实体中的属性值查询实体分页集合
7380
*
74-
* @param record
81+
* @param entity
82+
* 实体对象
7583
* @param offset
84+
* offset
7685
* @param limit
77-
* @return
86+
* limit
87+
* @return 实体集合
7888
*/
79-
List<T> listPage(T record, int offset, int limit);
89+
List<T> listPage(T entity, int offset, int limit);
8090

8191
/**
8292
* 根据实体中的属性查询总数
8393
*
84-
* @param record
85-
* @return
94+
* @param entity
95+
* 实体对象
96+
* @return 总数
8697
*/
87-
int count(T record);
98+
int count(T entity);
8899

89100
}

core/src/main/java/lazy/fast/code/core/orm/BaseServiceImpl.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,50 @@ protected BaseRepository<T> getBaseRepository() {
3535
}
3636

3737
@Override
38-
public int save(T record) {
39-
return this.getBaseRepository().insertSelective(record);
38+
public int save(T entity) {
39+
return this.getBaseRepository().insertSelective(entity);
4040
}
4141

4242
@Override
43-
public int update(T record) {
44-
Assert.notNull(record.getId(), "primary-key must be not null");
45-
return this.getBaseRepository().updateByPrimaryKeySelective(record);
43+
public int update(T entity) {
44+
Assert.notNull(entity.getId(), "id must be not null");
45+
return this.getBaseRepository().updateByPrimaryKeySelective(entity);
4646
}
4747

4848
@Override
49-
public int remove(Serializable key) {
50-
Assert.notNull(key, "primary-key must be not null");
51-
return this.getBaseRepository().deleteByPrimaryKey(key);
49+
public int remove(Serializable id) {
50+
Assert.notNull(id, "id must be not null");
51+
return this.getBaseRepository().deleteByPrimaryKey(id);
5252
}
5353

5454
@Override
55-
public int remove(T record) {
56-
return this.getBaseRepository().delete(record);
55+
public int remove(T entity) {
56+
return this.getBaseRepository().delete(entity);
5757
}
5858

5959
@Override
60-
public T get(Serializable key) {
61-
return this.getBaseRepository().selectByPrimaryKey(key);
60+
public T get(Serializable id) {
61+
return this.getBaseRepository().selectByPrimaryKey(id);
6262
}
6363

6464
@Override
65-
public T get(T record) {
66-
return this.getBaseRepository().selectOne(record);
65+
public T get(T entity) {
66+
return this.getBaseRepository().selectOne(entity);
6767
}
6868

6969
@Override
70-
public List<T> list(T record) {
71-
return this.getBaseRepository().select(record);
70+
public List<T> list(T entity) {
71+
return this.getBaseRepository().select(entity);
7272
}
7373

7474
@Override
75-
public List<T> listPage(T record, int offset, int limit) {
76-
return this.getBaseRepository().selectByRowBounds(record, new RowBounds(offset, limit));
75+
public List<T> listPage(T entity, int offset, int limit) {
76+
return this.getBaseRepository().selectByRowBounds(entity, new RowBounds(offset, limit));
7777
}
7878

7979
@Override
80-
public int count(T record) {
81-
return this.getBaseRepository().selectCount(record);
80+
public int count(T entity) {
81+
return this.getBaseRepository().selectCount(entity);
8282
}
8383

8484
}

0 commit comments

Comments
 (0)