图书分类可不选,添加图书分类时书只能是普通
This commit is contained in:
@@ -254,13 +254,15 @@ public class BookController {
|
||||
public R save(@RequestBody BookEntity book) {
|
||||
bookService.save(book);
|
||||
//添加图书类型关系表
|
||||
String[] types = book.getMedicaldesBookType().split(",");
|
||||
if (types.length > 0) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
MedicaldesBook medicaldesBook = new MedicaldesBook();
|
||||
medicaldesBook.setBookId(book.getId());
|
||||
medicaldesBook.setTypeId(Integer.parseInt(types[i]));
|
||||
medicaldesBookService.save(medicaldesBook);
|
||||
if (StringUtils.isNotEmpty(book.getMedicaldesBookType())){
|
||||
String[] types = book.getMedicaldesBookType().split(",");
|
||||
if (types.length > 0) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
MedicaldesBook medicaldesBook = new MedicaldesBook();
|
||||
medicaldesBook.setBookId(book.getId());
|
||||
medicaldesBook.setTypeId(Integer.parseInt(types[i]));
|
||||
medicaldesBookService.save(medicaldesBook);
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
@@ -314,7 +316,7 @@ public class BookController {
|
||||
}
|
||||
}
|
||||
//再添加
|
||||
if (book.getMedicaldesBookType()!=null){
|
||||
if (StringUtils.isNotEmpty(book.getMedicaldesBookType())){
|
||||
String[] types = book.getMedicaldesBookType().split(",");
|
||||
if (types.length > 0) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user