diff --git a/src/main/java/com/yupi/springbootinit/controller/CommonController.java b/src/main/java/com/yupi/springbootinit/controller/CommonController.java index 3416869..8b84bd7 100644 --- a/src/main/java/com/yupi/springbootinit/controller/CommonController.java +++ b/src/main/java/com/yupi/springbootinit/controller/CommonController.java @@ -10,6 +10,8 @@ import com.yupi.springbootinit.service.AiCommentService; import com.yupi.springbootinit.service.AiTemplateService; import com.yupi.springbootinit.service.CommonService; import com.yupi.springbootinit.service.CountryInfoService; +import com.yupi.springbootinit.service.SystemNoticeService; +import com.yupi.springbootinit.model.entity.SystemNotice; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; @@ -39,6 +41,9 @@ public class CommonController { @Resource private AiCommentService aiCommentService; + @Resource + private SystemNoticeService systemNoticeService; + @PostMapping("country_info") public BaseResponse> countryInfo() { @@ -74,4 +79,11 @@ public class CommonController { public BaseResponse health(){ return ResultUtils.success("ok"); } + + @GetMapping("notice") + public BaseResponse> getActiveNotice(){ + return ResultUtils.success(systemNoticeService.getActiveNoticeList()); + } + + } diff --git a/src/main/java/com/yupi/springbootinit/mapper/SystemNoticeMapper.java b/src/main/java/com/yupi/springbootinit/mapper/SystemNoticeMapper.java new file mode 100644 index 0000000..179b495 --- /dev/null +++ b/src/main/java/com/yupi/springbootinit/mapper/SystemNoticeMapper.java @@ -0,0 +1,12 @@ +package com.yupi.springbootinit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yupi.springbootinit.model.entity.SystemNotice; + +/* +* @author: ziin +* @date: 2026/2/10 20:25 +*/ + +public interface SystemNoticeMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/yupi/springbootinit/model/entity/SystemNotice.java b/src/main/java/com/yupi/springbootinit/model/entity/SystemNotice.java new file mode 100644 index 0000000..395132c --- /dev/null +++ b/src/main/java/com/yupi/springbootinit/model/entity/SystemNotice.java @@ -0,0 +1,107 @@ +package com.yupi.springbootinit.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import lombok.Data; + +/* +* @author: ziin +* @date: 2026/2/10 20:25 +*/ + +/** + * 通知公告表 + */ +@ApiModel(description="通知公告表") +@Data +@TableName(value = "system_notice") +public class SystemNotice { + /** + * 公告ID + */ + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty(value="公告ID") + private Long id; + + /** + * 公告标题 + */ + @TableField(value = "title") + @ApiModelProperty(value="公告标题") + private String title; + + /** + * 公告内容 + */ + @TableField(value = "content") + @ApiModelProperty(value="公告内容") + private String content; + + /** + * 公告类型(1通知 2公告) + */ + @TableField(value = "`type`") + @ApiModelProperty(value="公告类型(1通知 2公告)") + private Byte type; + + /** + * 公告状态(0正常 1关闭) + */ + @TableField(value = "`status`") + @ApiModelProperty(value="公告状态(0正常 1关闭)") + private Byte status; + + /** + * 创建者 + */ + @TableField(value = "creator") + @ApiModelProperty(value="创建者") + private String creator; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @ApiModelProperty(value="创建时间") + private Date createTime; + + /** + * 更新者 + */ + @TableField(value = "updater") + @ApiModelProperty(value="更新者") + private String updater; + + /** + * 更新时间 + */ + @TableField(value = "update_time") + @ApiModelProperty(value="更新时间") + private Date updateTime; + + /** + * 是否删除 + */ + @TableField(value = "deleted") + @ApiModelProperty(value="是否删除") + private Boolean deleted; + + /** + * 租户编号 + */ + @TableField(value = "tenant_id") + @ApiModelProperty(value="租户编号") + private Long tenantId; + + /** + * 分类 + */ + @TableField(value = "category") + @ApiModelProperty(value="分类") + private String category; +} \ No newline at end of file diff --git a/src/main/java/com/yupi/springbootinit/service/SystemNoticeService.java b/src/main/java/com/yupi/springbootinit/service/SystemNoticeService.java new file mode 100644 index 0000000..5a7aedd --- /dev/null +++ b/src/main/java/com/yupi/springbootinit/service/SystemNoticeService.java @@ -0,0 +1,20 @@ +package com.yupi.springbootinit.service; + +import com.yupi.springbootinit.model.entity.SystemNotice; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + + /* +* @author: ziin +* @date: 2026/2/10 20:25 +*/ + +public interface SystemNoticeService extends IService{ + + /** + * 查询当前状态为开启的公告列表 + */ + List getActiveNoticeList(); + +} diff --git a/src/main/java/com/yupi/springbootinit/service/impl/SystemNoticeServiceImpl.java b/src/main/java/com/yupi/springbootinit/service/impl/SystemNoticeServiceImpl.java new file mode 100644 index 0000000..e1f1adf --- /dev/null +++ b/src/main/java/com/yupi/springbootinit/service/impl/SystemNoticeServiceImpl.java @@ -0,0 +1,25 @@ +package com.yupi.springbootinit.service.impl; + +import org.springframework.stereotype.Service; +import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yupi.springbootinit.model.entity.SystemNotice; +import com.yupi.springbootinit.mapper.SystemNoticeMapper; +import com.yupi.springbootinit.service.SystemNoticeService; +/* +* @author: ziin +* @date: 2026/2/10 20:25 +*/ + +@Service +public class SystemNoticeServiceImpl extends ServiceImpl implements SystemNoticeService{ + + @Override + public List getActiveNoticeList() { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SystemNotice::getStatus, 0); + return this.list(queryWrapper); + } + +} diff --git a/src/main/resources/mapper/SystemNoticeMapper.xml b/src/main/resources/mapper/SystemNoticeMapper.xml new file mode 100644 index 0000000..e79b693 --- /dev/null +++ b/src/main/resources/mapper/SystemNoticeMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + id, title, content, `type`, `status`, creator, create_time, updater, update_time, + deleted, tenant_id, category + + \ No newline at end of file diff --git a/tk-data-user.2026-02-10.0.gz b/tk-data-user.2026-02-10.0.gz new file mode 100644 index 0000000..afe1765 Binary files /dev/null and b/tk-data-user.2026-02-10.0.gz differ