sql/xc_mall.sql | ●●●●● patch | view | raw | blame | history | |
src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/cc/mrbird/febs/mall/controller/ApiMallNewsController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/cc/mrbird/febs/mall/entity/MallNewsInfo.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/cc/mrbird/febs/mall/mapper/MallNewsInfoMapper.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/cc/mrbird/febs/mall/service/IApiMallNewsService.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallNewsServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
src/main/resources/mapper/modules/MallNewsInfoMapper.xml | ●●●●● patch | view | raw | blame | history |
sql/xc_mall.sql
@@ -356,3 +356,18 @@ alter table mall_member add bind_phone varchar(20) null comment '绑定手机号(仅全民商城用得到)'; DROP TABLE IF EXISTS mall_news_info; CREATE TABLE mall_news_info( REVISION INT COMMENT '乐观锁' , CREATED_BY VARCHAR(32) COMMENT '创建人' , CREATED_TIME DATETIME COMMENT '创建时间' , UPDATED_BY VARCHAR(32) COMMENT '更新人' , UPDATED_TIME DATETIME COMMENT '更新时间' , ID BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键' , title VARCHAR(255) COMMENT '标题' , content TEXT COMMENT '内容' , target_id BIGINT COMMENT '跳转到目标ID' , type INT COMMENT '类型;1-文章2-跳转到产品' , PRIMARY KEY (ID) ) COMMENT = '新闻中心'; src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
@@ -22,5 +22,6 @@ registration.excludePathPatterns("/api/category/**"); registration.excludePathPatterns("/api/goods/**"); registration.excludePathPatterns("/api/pay/**"); registration.excludePathPatterns("/api/news/**"); } } src/main/java/cc/mrbird/febs/mall/controller/ApiMallNewsController.java
New file @@ -0,0 +1,45 @@ package cc.mrbird.febs.mall.controller; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.mall.entity.MallNewsInfo; import cc.mrbird.febs.mall.service.IApiMallNewsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @author wzy * @date 2021-09-28 **/ @Slf4j @RestController @RequestMapping(value = "/api/news") @RequiredArgsConstructor @Api(value = "ApiMallNewsController", tags = "新闻接口类") public class ApiMallNewsController { private final IApiMallNewsService newsService; @ApiOperation(value = "新闻列表", notes = "新闻列表") @GetMapping(value = "/findNews") public FebsResponse findNews() { return new FebsResponse().success().data(newsService.list()); } @ApiOperation(value = "新闻详情", notes = "新闻详情") @GetMapping(value = "/newsDetails/{id}") public FebsResponse newsDetails(@PathVariable("id") Long id) { MallNewsInfo news = newsService.getById(id); if (news == null) { return new FebsResponse().fail().message("新闻不存在"); } return new FebsResponse().success().data(news); } } src/main/java/cc/mrbird/febs/mall/entity/MallNewsInfo.java
New file @@ -0,0 +1,25 @@ package cc.mrbird.febs.mall.entity; import cc.mrbird.febs.common.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * @author wzy * @date 2021-09-28 **/ @Data @TableName("mall_news_info") public class MallNewsInfo extends BaseEntity { private String title; private String content; private Long targetId; /** * 1-文章2-跳转到产品 */ private Integer type; } src/main/java/cc/mrbird/febs/mall/mapper/MallNewsInfoMapper.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.mapper; import cc.mrbird.febs.mall.entity.MallNewsInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface MallNewsInfoMapper extends BaseMapper<MallNewsInfo> { } src/main/java/cc/mrbird/febs/mall/service/IApiMallNewsService.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.service; import cc.mrbird.febs.mall.entity.MallNewsInfo; import com.baomidou.mybatisplus.extension.service.IService; public interface IApiMallNewsService extends IService<MallNewsInfo> { } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallNewsServiceImpl.java
New file @@ -0,0 +1,20 @@ package cc.mrbird.febs.mall.service.impl; import cc.mrbird.febs.mall.entity.MallNewsInfo; import cc.mrbird.febs.mall.mapper.MallNewsInfoMapper; import cc.mrbird.febs.mall.service.IApiMallNewsService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; /** * @author wzy * @date 2021-09-28 **/ @Slf4j @Service @RequiredArgsConstructor public class ApiMallNewsServiceImpl extends ServiceImpl<MallNewsInfoMapper, MallNewsInfo> implements IApiMallNewsService { } src/main/resources/mapper/modules/MallNewsInfoMapper.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cc.mrbird.febs.mall.mapper.MallNewsInfoMapper"> </mapper>