删除消息

pull/451/head
starrysky 2020-02-28 22:32:48 +08:00
parent 1ef83f9e4a
commit 9a50698c4f
9 changed files with 48 additions and 6 deletions

View File

@ -41,7 +41,7 @@ public class Message implements Serializable {
private Long userIdSend;
@Column(name = "user_name_send")
private Long userNameSend;
private String userNameSend;
@Column(name = "user_id_accept")
private Long userIdAccept;

View File

@ -3,6 +3,8 @@ package me.zhengjie.modules.system.repository;
import me.zhengjie.modules.system.domain.Message;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
/**
* @author
@ -10,4 +12,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
*/
public interface MessageRepository extends JpaRepository<Message, Long>, JpaSpecificationExecutor {
@Modifying
@Query(value = "delete from meessage where id = ?1", nativeQuery = true)
void deleteMessageById(long id);
}

View File

@ -38,4 +38,13 @@ public class MessageController {
messageService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除消息")
@ApiOperation(value = "删除消息")
@DeleteMapping(value = "/messagee/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MESSAGE_ALL','MESSAGE_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
messageService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -18,14 +18,17 @@ public class MessageDTO {
// 更新时间
private Timestamp updateTime;
// 状态
private Boolean status;
private Long userIdSend;
private Long userNameSend;
private String userNameSend;
private Long userIdAccept;
/**
*
*
*/
private String messContent;
@ -39,7 +42,9 @@ public class MessageDTO {
/**
*
*/
private String moduleType;
private String moduleTypeCode;
private String moduleTypeName;
/**

View File

@ -74,7 +74,7 @@ public class MessageServiceImpl implements MessageService {
@Override
public void delete(Long id) {
messageRepository.deleteMessageById(id);;
}
@Override

View File

@ -109,6 +109,10 @@ public class CustomerOrder implements Serializable {
@Column(name = "status")
private Boolean status;
// 完成状态
@Column(name = "complete_status")
private Boolean completeStatus;
public void copy(CustomerOrder source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}

View File

@ -202,6 +202,8 @@ public class CustomerOrderServiceImpl implements CustomerOrderService {
customerOrder.setCustomerName(customerInfo.getCustomerName());
customerOrder.setCompleteStatus(false);
//插入客户订单
customerOrderRepository.save(customerOrder);
customerOrder= customerOrderRepository.findByCustomerOrderCodeAndStatusTrue(createCustomerOrderRequest.getCustomerOrderCode());
@ -245,7 +247,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService {
for(UserDTO userDTO : userDTOList){
Message message = new Message();
message.setUserIdAccept(userDTO.getId());
String messageContent = MessageModuleType.CUSTOMER_ORDER.getName() + "(" + customerOrderCode + ")";
String messageContent = MessageModuleType.CUSTOMER_ORDER.getName() + "(" + customerOrderCode + ")" + "新录入";
message.setMessContent(messageContent);
message.setModulePath(MessageModulePath.CUSTOMER_ORDER_LIST.getCode());
message.setModuleTypeName(MessageModuleType.CUSTOMER_ORDER.getCode());

17
sql/message.sql Normal file
View File

@ -0,0 +1,17 @@
DROP TABLE IF EXISTS `message`;
CREATE TABLE `message` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL COMMENT '状态',
`user_id_send` bigint(20) DEFAULT NULL COMMENT '发送方id',
`user_name_send` varchar(32) DEFAULT NULL COMMENT '发送方name',
`user_id_accept` bigint(20) DEFAULT NULL COMMENT '接收方id',
`mess_content` varchar(512) DEFAULT NULL COMMENT '消息内容',
`read_status` int(4) DEFAULT NULL COMMENT '阅读状态 0 未读 1 已读',
`module_type_code` varchar(32) DEFAULT NULL COMMENT '模块类别code',
`module_type_name` varchar(32) DEFAULT NULL COMMENT '模块类别name',
`module_path` varchar(214) DEFAULT NULL COMMENT '模块路径',
`init_code` varchar(64) DEFAULT NULL COMMENT '单据编号',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8 COMMENT='销售发货单';