|
@@ -247,9 +247,12 @@ public class TextbookController {
|
|
|
@SaCheckPermission("textbook:add")
|
|
@SaCheckPermission("textbook:add")
|
|
|
public RT<Boolean> add(@Valid @RequestBody AddTextbookDto dto) throws ParseException {
|
|
public RT<Boolean> add(@Valid @RequestBody AddTextbookDto dto) throws ParseException {
|
|
|
String publishingDateStr = dto.getPublishingDate();
|
|
String publishingDateStr = dto.getPublishingDate();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
|
|
Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
|
|
|
- textbook.setPublishingDate(sdf.parse(publishingDateStr));
|
|
|
|
|
|
|
+ if(publishingDateStr != null && !"".equals(publishingDateStr)){
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
+ textbook.setPublishingDate(sdf.parse(publishingDateStr));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
boolean isSuccess = textbookService.add(textbook);
|
|
boolean isSuccess = textbookService.add(textbook);
|
|
|
return RT.ok(isSuccess);
|
|
return RT.ok(isSuccess);
|
|
|
}
|
|
}
|
|
@@ -259,9 +262,11 @@ public class TextbookController {
|
|
|
@SaCheckPermission("textbook:edit")
|
|
@SaCheckPermission("textbook:edit")
|
|
|
public RT<Boolean> update(@Valid @RequestBody UpdateTextbookDto dto) throws ParseException {
|
|
public RT<Boolean> update(@Valid @RequestBody UpdateTextbookDto dto) throws ParseException {
|
|
|
String publishingDateStr = dto.getPublishingDate();
|
|
String publishingDateStr = dto.getPublishingDate();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
|
|
Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
|
|
|
- textbook.setPublishingDate(sdf.parse(publishingDateStr ));
|
|
|
|
|
|
|
+ if(publishingDateStr != null && !"".equals(publishingDateStr)){
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
+ textbook.setPublishingDate(sdf.parse(publishingDateStr));
|
|
|
|
|
+ }
|
|
|
return RT.ok(textbookService.update(textbook));
|
|
return RT.ok(textbookService.update(textbook));
|
|
|
|
|
|
|
|
}
|
|
}
|