|
|
@@ -1,6 +1,8 @@
|
|
|
package com.izouma.zhirongip.web;
|
|
|
|
|
|
+import com.izouma.zhirongip.domain.Information;
|
|
|
import com.izouma.zhirongip.domain.Message;
|
|
|
+import com.izouma.zhirongip.repo.InformationRepo;
|
|
|
import com.izouma.zhirongip.service.MessageService;
|
|
|
import com.izouma.zhirongip.dto.PageQuery;
|
|
|
import com.izouma.zhirongip.exception.BusinessException;
|
|
|
@@ -22,8 +24,9 @@ import java.util.List;
|
|
|
@RequestMapping("/message")
|
|
|
@AllArgsConstructor
|
|
|
public class MessageController extends BaseController {
|
|
|
- private final MessageService messageService;
|
|
|
- private final MessageRepo messageRepo;
|
|
|
+ private final MessageService messageService;
|
|
|
+ private final MessageRepo messageRepo;
|
|
|
+ private final InformationRepo informationRepo;
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
|
@@ -35,7 +38,13 @@ public class MessageController extends BaseController {
|
|
|
return messageRepo.save(orig);
|
|
|
}
|
|
|
record.setUserId(userId);
|
|
|
- return messageRepo.save(record);
|
|
|
+ record = messageRepo.save(record);
|
|
|
+ informationRepo.save(Information.builder()
|
|
|
+ .messageId(record.getId())
|
|
|
+ .receiveUserId(userId)
|
|
|
+ .content("已收到您的留言" + record.getTitle() + ",请耐心等待回复!")
|
|
|
+ .build());
|
|
|
+ return record;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -53,6 +62,8 @@ public class MessageController extends BaseController {
|
|
|
@PostMapping("/del/{id}")
|
|
|
public void del(@PathVariable Long id) {
|
|
|
messageRepo.softDelete(id);
|
|
|
+ //删除相关留言消息
|
|
|
+ informationRepo.batchSoftDeleteByMessageId(id);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/excel")
|