新增isPublic 字段

This commit is contained in:
tianfeng 2026-01-14 16:00:06 +08:00
parent c21aad6d72
commit 708f473140
6 changed files with 17 additions and 0 deletions

View File

@ -63,6 +63,7 @@ public class SendLoveLetterCmdExe {
letter.setReceiverId(receiverId); letter.setReceiverId(receiverId);
letter.setContent(cmd.getContent()); letter.setContent(cmd.getContent());
letter.setStatus(0); letter.setStatus(0);
letter.setIsPublic(cmd.getIsPublic() != null ? cmd.getIsPublic() : 1);
letter.setCostGold(LOVE_LETTER_COST); letter.setCostGold(LOVE_LETTER_COST);
letter.setCreateTime(TimestampUtils.now()); letter.setCreateTime(TimestampUtils.now());
letter.setUpdateTime(TimestampUtils.now()); letter.setUpdateTime(TimestampUtils.now());

View File

@ -23,4 +23,6 @@ public class SendLoveLetterCmd extends AppExtCommand {
@NotBlank(message = "告白内容不能为空") @NotBlank(message = "告白内容不能为空")
@Size(max = 80, message = "告白内容不能超过80字符") @Size(max = 80, message = "告白内容不能超过80字符")
private String content; private String content;
private Integer isPublic;
} }

View File

@ -21,6 +21,8 @@ public class CpLoveLetterDomain {
private Integer status; private Integer status;
private Integer isPublic;
private Long costGold; private Long costGold;
private Timestamp createTime; private Timestamp createTime;
@ -40,4 +42,11 @@ public class CpLoveLetterDomain {
public void markAsRead() { public void markAsRead() {
this.status = 1; this.status = 1;
} }
/**
* 是否公开
*/
public boolean isPublic() {
return isPublic != null && isPublic == 1;
}
} }

View File

@ -26,6 +26,8 @@ public class CpLoveLetter {
private Integer status; private Integer status;
private Integer isPublic;
private Long costGold; private Long costGold;
@TableLogic @TableLogic

View File

@ -60,6 +60,7 @@ public class CpLoveLetterGatewayImpl implements CpLoveLetterGateway {
entity.setReceiverId(domain.getReceiverId()); entity.setReceiverId(domain.getReceiverId());
entity.setContent(domain.getContent()); entity.setContent(domain.getContent());
entity.setStatus(domain.getStatus()); entity.setStatus(domain.getStatus());
entity.setIsPublic(domain.getIsPublic());
entity.setCostGold(domain.getCostGold()); entity.setCostGold(domain.getCostGold());
entity.setCreateTime(domain.getCreateTime().toLocalDateTime()); entity.setCreateTime(domain.getCreateTime().toLocalDateTime());
entity.setUpdateTime(domain.getUpdateTime().toLocalDateTime()); entity.setUpdateTime(domain.getUpdateTime().toLocalDateTime());
@ -76,6 +77,7 @@ public class CpLoveLetterGatewayImpl implements CpLoveLetterGateway {
domain.setReceiverId(entity.getReceiverId()); domain.setReceiverId(entity.getReceiverId());
domain.setContent(entity.getContent()); domain.setContent(entity.getContent());
domain.setStatus(entity.getStatus()); domain.setStatus(entity.getStatus());
domain.setIsPublic(entity.getIsPublic());
domain.setCostGold(entity.getCostGold()); domain.setCostGold(entity.getCostGold());
domain.setCreateTime(Timestamp.valueOf(entity.getCreateTime())); domain.setCreateTime(Timestamp.valueOf(entity.getCreateTime()));
domain.setUpdateTime(Timestamp.valueOf(entity.getUpdateTime())); domain.setUpdateTime(Timestamp.valueOf(entity.getUpdateTime()));

View File

@ -6,6 +6,7 @@
<select id="listLatestLetters" resultType="com.red.circle.other.infra.database.rds.entity.user.user.CpLoveLetter"> <select id="listLatestLetters" resultType="com.red.circle.other.infra.database.rds.entity.user.user.CpLoveLetter">
SELECT * FROM cp_love_letter SELECT * FROM cp_love_letter
WHERE is_deleted = 0 WHERE is_deleted = 0
AND is_public = 1
ORDER BY create_time DESC ORDER BY create_time DESC
LIMIT #{limit} LIMIT #{limit}
</select> </select>