Skip to content

Commit 9bc6b38

Browse files
committed
完善core包
1 parent c4fa55b commit 9bc6b38

File tree

5 files changed

+28
-36
lines changed

5 files changed

+28
-36
lines changed

aries/src/main/java/info/xiaomo/aries/controller/UserController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public Result<UserModel> findByName(@PathVariable String name) {
6767
@ApiOperation(value = "根据名字删除数据", notes = "根据名字删除数据", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
6868
@Override
6969
public Result<Boolean> delByName(@PathVariable String name) {
70-
boolean b = service.delByName(name);
70+
boolean b = service.deleteByName(name);
7171
return new Result<>(b);
7272
}
7373

7474
@RequestMapping(value = "delById/{id}", method = RequestMethod.GET)
7575
@ApiOperation(value = "根据id删除数据", notes = "根据id删除数据", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
7676
@Override
7777
public Result<Boolean> delById(@PathVariable Long id) {
78-
boolean b = service.delById(id);
78+
boolean b = service.deleteById(id);
7979
return new Result<>(b);
8080
}
8181

@@ -100,7 +100,7 @@ public Result<Boolean> update(@RequestBody UserModel model) {
100100
@ApiOperation(value = "根据ids批量删除数据", notes = "根据ids批量删除数据", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
101101
@Override
102102
public Result<Boolean> delByIds(@PathVariable List<Long> ids) {
103-
boolean b = service.delByIds(ids);
103+
boolean b = service.deleteByIds(ids);
104104
return new Result<>(b);
105105
}
106106

aries/src/main/java/info/xiaomo/aries/service/impl/UserServiceImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public Page<UserModel> findAll(int start, int pageSize) {
5151
}
5252

5353
@Override
54-
public boolean delById(Long id) {
54+
public boolean deleteById(Long id) {
5555
try {
5656
userDao.delete(id);
5757
} catch (Exception e) {
@@ -61,7 +61,7 @@ public boolean delById(Long id) {
6161
}
6262

6363
@Override
64-
public boolean delByName(String name) {
64+
public boolean deleteByName(String name) {
6565
return userDao.deleteByName(name);
6666
}
6767

@@ -99,7 +99,7 @@ public boolean update(UserModel model) {
9999
}
100100

101101
@Override
102-
public boolean delByIds(List<Long> ids) {
102+
public boolean deleteByIds(List<Long> ids) {
103103
for (Long id : ids) {
104104
userDao.delete(id);
105105
}

core/src/main/java/info/xiaomo/core/base/BaseService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public interface BaseService<T> {
2020

2121
Page<T> findAll(int start, int pageSize);
2222

23-
boolean delById(Long id);
23+
boolean deleteById(Long id);
2424

25-
boolean delByName(String name);
25+
boolean deleteByName(String name);
2626

2727
boolean add(T model);
2828

2929
boolean update(T model);
3030

31-
boolean delByIds(List<Long> ids);
31+
boolean deleteByIds(List<Long> ids);
3232
}

readerApplication/src/main/java/info/xiaomo/reader/controller/UserController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public Result<Boolean> update(@RequestBody UserModel user) {
211211
*/
212212
@Override
213213
public Result<Boolean> delByIds(@PathVariable List<Long> ids) {
214-
Boolean aBoolean = service.delByIds(ids);
214+
Boolean aBoolean = service.deleteByIds(ids);
215215
return new Result<>(aBoolean);
216216
}
217217

@@ -256,7 +256,7 @@ public Result<Page<UserModel>> findAll(@PathVariable int start, @PathVariable in
256256
@ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"),
257257
})
258258
public Result<Boolean> deleteUserById(@PathVariable("id") Long id) throws UserNotFoundException {
259-
boolean userModel = service.delById(id);
259+
boolean userModel = service.deleteById(id);
260260
if (!userModel) {
261261
return new Result<>(Code.USER_NOT_FOUND.getResultCode(), Code.USER_NOT_FOUND.getMessage());
262262
}

readerApplication/src/main/java/info/xiaomo/reader/service/impl/UserServiceImpl.java

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,58 +61,50 @@ public UserModel updateUser(UserModel model) throws UserNotFoundException {
6161
}
6262

6363
@Override
64-
public Page<UserModel> findAll(int start, int pageSize) {
65-
Sort sort = new Sort(Sort.Direction.DESC, "createTime");
66-
return dao.findAll(new PageRequest(start - 1, pageSize, sort));
64+
public UserModel findById(Long id) {
65+
return null;
6766
}
6867

6968
@Override
70-
public boolean delById(Long id) {
71-
return false;
69+
public UserModel findByName(String name) {
70+
return null;
7271
}
7372

7473
@Override
75-
public boolean delByName(String name) {
76-
return false;
74+
public List<UserModel> findAll() {
75+
return null;
7776
}
7877

7978
@Override
80-
public boolean add(UserModel model) {
81-
return false;
79+
public Page<UserModel> findAll(int start, int pageSize) {
80+
Sort sort = new Sort(Sort.Direction.DESC, "createTime");
81+
return dao.findAll(new PageRequest(start - 1, pageSize, sort));
8282
}
8383

8484
@Override
85-
public boolean update(UserModel model) {
85+
public boolean deleteById(Long id) {
8686
return false;
8787
}
8888

8989
@Override
90-
public boolean delByIds(List<Long> ids) {
90+
public boolean deleteByName(String name) {
9191
return false;
9292
}
9393

9494
@Override
95-
public UserModel findById(Long id) {
96-
return null;
95+
public boolean add(UserModel model) {
96+
return false;
9797
}
9898

9999
@Override
100-
public UserModel findByName(String name) {
101-
return null;
100+
public boolean update(UserModel model) {
101+
return false;
102102
}
103103

104104
@Override
105-
public List<UserModel> findAll() {
106-
return dao.findAll();
105+
public boolean deleteByIds(List<Long> ids) {
106+
return false;
107107
}
108108

109-
public UserModel deleteUserById(Long id) throws UserNotFoundException {
110-
UserModel userModel = dao.findOne(id);
111-
if (userModel == null) {
112-
throw new UserNotFoundException();
113-
}
114-
dao.delete(userModel.getId());
115-
return userModel;
116-
}
117109

118110
}

0 commit comments

Comments
 (0)