|
@@ -11,6 +11,7 @@ import com.jeeplus.calendar.service.dto.MyCalendarDTO;
|
|
|
import com.jeeplus.calendar.service.mapstruct.MyCalendarWrapper;
|
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
import com.jeeplus.logging.annotation.ApiLog;
|
|
|
+import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -46,7 +47,8 @@ public class MyCalendarController {
|
|
|
@ApiLog("查询日历")
|
|
|
@GetMapping("queryById")
|
|
|
public ResponseEntity queryById(String id) {
|
|
|
- return ResponseEntity.ok ( myCalendarService.getById ( id ) );
|
|
|
+ MyCalendar myCalendar = myCalendarService.queryById(id);
|
|
|
+ return ResponseEntity.ok ( myCalendar );
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -74,6 +76,11 @@ public class MyCalendarController {
|
|
|
@PostMapping("save")
|
|
|
public ResponseEntity save(@Valid @RequestBody MyCalendarDTO myCalendarDTO) {
|
|
|
myCalendarDTO.setUserDTO ( UserUtils.getCurrentUserDTO ( ) );
|
|
|
+ if (null == myCalendarDTO.getUserDTO()) {
|
|
|
+ UserDTO userDTO = new UserDTO();
|
|
|
+ userDTO.setId(myCalendarDTO.getUserId());
|
|
|
+ myCalendarDTO.setUserDTO(userDTO);
|
|
|
+ }
|
|
|
myCalendarService.saveOrUpdate ( myCalendarWrapper.toEntity ( myCalendarDTO ) );
|
|
|
return ResponseEntity.ok ( "保存成功!" );
|
|
|
}
|