From 61c5deee6619789d3a2711684ea14cc51b061cdf Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期三, 25 六月 2025 10:48:23 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoGoods.java | 4 framework/src/main/java/cn/lili/modules/lmk/domain/entity/News.java | 44 ++++ manager-api/src/main/java/cn/lili/controller/lmk/NewsController.java | 77 +++++++ framework/src/main/java/cn/lili/modules/lmk/domain/query/NewsQuery.java | 23 ++ framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsPublishVO.java | 3 framework/src/main/java/cn/lili/modules/lmk/mapper/NewsMapper.java | 29 ++ framework/src/main/java/cn/lili/modules/lmk/service/NewsService.java | 61 +++++ framework/src/main/java/cn/lili/modules/lmk/service/impl/NewsServiceImpl.java | 108 +++++++++ framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java | 2 /dev/null | 32 -- buyer-api/src/main/java/cn/lili/controller/lmk/NewsController.java | 77 +++++++ framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsDetailVO.java | 3 framework/src/main/resources/mapper/lmk/VideoMapper.xml | 5 framework/src/main/java/cn/lili/modules/lmk/domain/form/NewsForm.java | 55 +++++ framework/src/main/resources/mapper/lmk/NewsMapper.xml | 44 ++++ framework/src/main/java/cn/lili/modules/lmk/domain/vo/NewsVO.java | 49 ++++ 16 files changed, 584 insertions(+), 32 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/NewsController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/NewsController.java new file mode 100644 index 0000000..c30b3a8 --- /dev/null +++ b/buyer-api/src/main/java/cn/lili/controller/lmk/NewsController.java @@ -0,0 +1,77 @@ +package cn.lili.controller.lmk; +import cn.lili.base.Result; +import cn.lili.group.Add; +import cn.lili.group.Update; +import cn.lili.modules.lmk.domain.form.ActivityForm; +import cn.lili.modules.lmk.domain.form.NewsForm; +import cn.lili.modules.lmk.domain.query.ActivityQuery; +import cn.lili.modules.lmk.domain.query.NewsQuery; +import cn.lili.modules.lmk.service.NewsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + + +/** + * lmk-shop-java + * 鐢ㄦ埛绔柊闂� + * + * @author : zxl + * @date : 2025-06-23 18:39 + **/ +@Validated +@RequiredArgsConstructor +@Api(value = "鏂伴椈", tags = "鏂伴椈") +@RestController +@RequestMapping("/buyer/lmk/news") +public class NewsController { + private final NewsService newsService; + + @PostMapping + @ApiOperation(value = "娣诲姞", notes = "娣诲姞") + public Result add(@RequestBody @Validated(Add.class) NewsForm form) { + return newsService.add(form); + } + + @PutMapping + @ApiOperation(value = "淇敼", notes = "淇敼") + public Result update(@RequestBody @Validated(Update.class) NewsForm form) { + return newsService.update(form); + } + + @DeleteMapping("/{id}") + @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎") + public Result removeById(@PathVariable("id") String id) { + return newsService.removeById(id); + } + + @DeleteMapping("/batch") + @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎") + public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) { + return newsService.remove(ids); + } + + @GetMapping("/page") + @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉") + public Result page(NewsQuery query) { + return newsService.page(query); + } + + @GetMapping("/{id}") + @ApiOperation(value = "璇︽儏", notes = "璇︽儏") + public Result detail(@PathVariable("id") String id) { + return newsService.detail(id); + } + + @PutMapping("/publish/{id}") + public Result publish(@PathVariable("id") String id){ + return newsService.publish(id); + } + +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/News.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/News.java new file mode 100644 index 0000000..26097b8 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/News.java @@ -0,0 +1,44 @@ +package cn.lili.modules.lmk.domain.entity; + +import cn.lili.mybatis.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * 鏂伴椈 + * + */ +@Data +@TableName("lmk_news") +public class News extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 鏍囬 + */ + @TableField("title") + private String title; + + /** + * 鏄惁鍙戝竷 + */ + @TableField("publish") + private Boolean publish; + + /** + * 鍐呭 + */ + @TableField("content") + private String content; + + /** + * 鍙戝竷鏃ユ湡 + */ + @TableField("publish_date") + private Date publishDate; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoGoods.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoGoods.java index 1993606..8187ff4 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoGoods.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoGoods.java @@ -31,6 +31,10 @@ /** 鍟嗗搧id */ private String goodsId; + @TableField("goods_sku_id") + /** 鍟嗗搧sku id */ + private String goodsSkuId; + @TableField("order_num") /** 鎺掑簭 */ private Integer orderNum; diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/NewsForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/NewsForm.java new file mode 100644 index 0000000..dc05302 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/NewsForm.java @@ -0,0 +1,55 @@ +package cn.lili.modules.lmk.domain.form; + +import cn.lili.base.AbsForm; +import cn.lili.group.Add; +import cn.lili.group.Update; +import cn.lili.modules.lmk.domain.entity.News; +import cn.lili.modules.lmk.domain.entity.ShareClickRecord; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.beans.BeanUtils; +import org.springframework.lang.NonNull; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 鏂伴椈琛ㄥ崟 + * + * @author zxl + * @since 2025-06-20 + */ +@Data +@ApiModel(value = "NewsForm琛ㄥ崟", description = "鏂伴椈琛ㄥ崟") +public class NewsForm extends AbsForm { + /** + * 鏍囬 + */ + @NotBlank(message = "鏍囬涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鏍囬") + private String title; + + /** + * 鏄惁鍙戝竷 + */ + @NotNull(message = "鍙戝竷鐘舵�佷笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("鏄惁鍙戝竷") + private Boolean publish; + + /** + * 鍐呭 + */ + @NotBlank(message = "鍐呭涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鍐呭") + private String content; + + public static News getEntityByForm(@NonNull NewsForm form, News entity) { + if(entity == null) { + entity = new News(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/NewsQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/NewsQuery.java new file mode 100644 index 0000000..8fb0382 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/NewsQuery.java @@ -0,0 +1,23 @@ +package cn.lili.modules.lmk.domain.query; + +import cn.lili.base.AbsQuery; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * 鏂伴椈鏌ヨ鍙傛暟 + * + * @author zxl + * @since 2025-06-20 + */ +@Data +@ApiModel(value = "鏂伴椈鏌ヨ鍙傛暟", description = "鏂伴椈鏌ヨ鍙傛暟") +public class NewsQuery extends AbsQuery { + + /** + * 鏍囬 + */ + private String title; + + private String publish; +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/NewsVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/NewsVO.java new file mode 100644 index 0000000..545831b --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/NewsVO.java @@ -0,0 +1,49 @@ +package cn.lili.modules.lmk.domain.vo; + + +import cn.lili.base.AbsVo; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * lmk-shop-java + * 鏂伴椈vo + * + * @author : zxl + * @date : 2025-06-20 14:43 + **/ +@Data +@ApiModel(value = "NewsVO鍝嶅簲鏁版嵁", description = "鍝嶅簲鏁版嵁") +public class NewsVO extends AbsVo { + /** + * 鏍囬 + */ + @ApiModelProperty(value = "鏍囬") + private String title; + + /** + * 鏄惁鍙戝竷 + */ + @ApiModelProperty(value = "鏄惁鍙戝竷") + private Boolean publish; + + /** + * 鍐呭 + */ + @ApiModelProperty(value = "鍐呭") + private String content; + + /** + * 鍙戝竷鏃ユ湡 + */ + @ApiModelProperty(value = "鍙戝竷鏃ユ湡") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date publishDate; +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsDetailVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsDetailVO.java index e765747..a98f5dc 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsDetailVO.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsDetailVO.java @@ -16,6 +16,9 @@ @ApiModelProperty("鍟嗗搧id") private String goodsId; + @ApiModelProperty("鍟嗗搧skuid") + private String id; + @ApiModelProperty("鍟嗗搧鍚嶇О") private String goodsName; diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsPublishVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsPublishVO.java index 3d970f2..1d8cd03 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsPublishVO.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsPublishVO.java @@ -15,6 +15,9 @@ @ApiModelProperty("鍟嗗搧id") private String goodsId; + @ApiModelProperty("sku") + private String goodsSkuId; + @ApiModelProperty("鍟嗗搧鏁伴噺") private Integer goodsNum; diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsVO.java deleted file mode 100644 index 8f7488d..0000000 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.lili.modules.lmk.domain.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 瑙嗛鎮寕鍟嗗搧淇℃伅 - * - * @author锛歺p - * @date锛�2025/5/22 14:17 - */ -@Data -public class VideoGoodsVO { - - private String id; - - @ApiModelProperty("鍥剧墖鍦板潃") - private String imageUrl = "https://picsum.photos/200/200?random=2"; - - @ApiModelProperty("鍟嗗搧鍚嶇О") - private String name = "鎺ㄦ祦"; - - @ApiModelProperty("浠锋牸") - private String price = "10"; - - @ApiModelProperty("鍘熶环") - private String originalPrice = "48.9"; - - @ApiModelProperty("宸插敭鏁伴噺") - private Long saleNum = 125L; - -} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/NewsMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/NewsMapper.java new file mode 100644 index 0000000..c3c5a77 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/NewsMapper.java @@ -0,0 +1,29 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.News; +import cn.lili.modules.lmk.domain.query.ActivityQuery; +import cn.lili.modules.lmk.domain.query.NewsQuery; +import cn.lili.modules.lmk.domain.vo.ActivityVO; +import cn.lili.modules.lmk.domain.vo.NewsVO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 鏂伴椈鎺ュ彛 + */ +@Mapper +public interface NewsMapper extends BaseMapper<News> { + /** + * id鏌ユ壘鏂伴椈璇︽儏 + * @param id + * @return + */ + NewsVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") NewsQuery query); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/NewsService.java b/framework/src/main/java/cn/lili/modules/lmk/service/NewsService.java new file mode 100644 index 0000000..de84b83 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/NewsService.java @@ -0,0 +1,61 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.entity.MySubscribe; +import cn.lili.modules.lmk.domain.entity.News; +import cn.lili.modules.lmk.domain.form.NewsForm; +import cn.lili.modules.lmk.domain.query.NewsQuery; +import com.baomidou.mybatisplus.extension.service.IService; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * 鏂伴椈 鏈嶅姟绫� + */ +public interface NewsService extends IService<News> { + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(NewsForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(NewsForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(NewsQuery query); + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + Result detail(String id); + + Result publish(String id); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/NewsServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/NewsServiceImpl.java new file mode 100644 index 0000000..92011fc --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/NewsServiceImpl.java @@ -0,0 +1,108 @@ +package cn.lili.modules.lmk.service.impl; + + +import cn.lili.base.Result; +import cn.lili.common.enums.ActivityCoverTypeEnum; +import cn.lili.modules.lmk.domain.entity.Activity; +import cn.lili.modules.lmk.domain.entity.MySubscribe; +import cn.lili.modules.lmk.domain.entity.News; +import cn.lili.modules.lmk.domain.form.ActivityForm; +import cn.lili.modules.lmk.domain.form.NewsForm; +import cn.lili.modules.lmk.domain.query.NewsQuery; +import cn.lili.modules.lmk.domain.vo.ActivityVO; +import cn.lili.modules.lmk.domain.vo.NewsVO; +import cn.lili.modules.lmk.mapper.NewsMapper; +import cn.lili.modules.lmk.service.NewsService; +import cn.lili.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.util.*; +import java.util.function.Function; + +/** + * lmk-shop-java + * 鏂伴椈鏈嶅姟瀹炵幇绫� + * + * @author : zxl + * @date : 2025-06-20 14:55 + **/ +@Service +@RequiredArgsConstructor +public class NewsServiceImpl extends ServiceImpl<NewsMapper, News> implements NewsService { + + private final NewsMapper newsMapper; + @Override + public Result add(NewsForm form) { + News entity = NewsForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + @Override + public Result update(NewsForm form) { + News entity = baseMapper.selectById(form.getId()); + + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + BeanUtils.copyProperties(form, entity); + + baseMapper.updateById(entity); + + + return Result.ok("淇敼鎴愬姛"); + } + + @Override + public Result remove(List<String> ids) { + baseMapper.deleteBatchIds(ids); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + @Override + public Result removeById(String id) { + //鍒ゆ柇鏄惁鍙戝竷鍙戝竷鍒欐彁绀哄厛涓嬫灦锛屽啀鍒犻櫎 + News entity = baseMapper.selectById(id); + if(entity.getPublish()){ + throw new RuntimeException("璇ユ柊闂诲凡鍙戝竷"); + } + + baseMapper.deleteById(id); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + @Override + public Result page(NewsQuery query) { + IPage<NewsVO> page = PageUtil.getPage(query, NewsVO.class); + + baseMapper.getPage(page, query); + + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + @Override + public Result detail(String id) { + NewsVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + @Override + public Result publish(String id) { + News entity = baseMapper.selectById(id); + if (!entity.getPublish()) { + entity.setPublishDate(new Date()); + }else { + entity.setPublishDate(null); + } + entity.setPublish(!entity.getPublish()); + baseMapper.updateById(entity); + return Result.ok("鎴愬姛"); + } + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java index 0a734f9..ca75179 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java @@ -197,6 +197,7 @@ VideoGoods e = new VideoGoods(); e.setVideoId(video.getId()); e.setGoodsId(form.getGoodsList().get(i).getGoodsId()); + e.setGoodsSkuId(form.getGoodsList().get(i).getGoodsSkuId()); e.setGoodsNum(form.getGoodsList().get(i).getGoodsNum()); e.setOrderNum(i); videoGoods.add(e); @@ -260,6 +261,7 @@ VideoGoods e = new VideoGoods(); e.setVideoId(video.getId()); e.setGoodsId(form.getGoodsList().get(i).getGoodsId()); + e.setGoodsSkuId(form.getGoodsList().get(i).getGoodsSkuId()); e.setGoodsNum(form.getGoodsList().get(i).getGoodsNum()); e.setOrderNum(i); videoGoods.add(e); diff --git a/framework/src/main/resources/mapper/lmk/NewsMapper.xml b/framework/src/main/resources/mapper/lmk/NewsMapper.xml new file mode 100644 index 0000000..52e26c3 --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/NewsMapper.xml @@ -0,0 +1,44 @@ +<?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="cn.lili.modules.lmk.mapper.NewsMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.NewsVO"> + <result column="title" property="title" /> + <result column="content" property="content"/> + <result column="publish" property="publish" /> + <result column="publishDate" property="publish_date" /> + + </resultMap> + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LN.id, + LN.publish, + LN.publish_date, + LN.content, + LN.title + FROM + lmk_news LN + WHERE + LN.id = #{id} AND LN.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LN.id, + LN.publish, + LN.publish_date, + LN.content, + LN.title + FROM + lmk_news LN + WHERE + LN.delete_flag = 0 + <if test="query.title != null and query.title != ''">AND LN.title LIKE CONCAT('%', #{query.title}, '%')</if> + <if test="query.publish != null and query.publish != ''">AND LN.publish = #{query.publish}</if> + </select> + + +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml index d4ce727..248411a 100644 --- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml +++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml @@ -28,6 +28,7 @@ <resultMap id="VideoGoodsMap" type="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"> <result column="goods_id" property="goodsId"/> + <result column="goods_sku_id" property="id"/> <result column="goods_num" property="goodsNum"/> <result column="goods_name" property="goodsName"/> <result column="thumbnail" property="thumbnail"/> @@ -37,6 +38,7 @@ <select id="getVideoGoods" parameterType="string" resultMap="VideoGoodsMap"> SELECT LVG.goods_id, + LVG.goods_sku_id, LVG.goods_num, LVG.order_num, LG.goods_name, @@ -219,6 +221,7 @@ LV.weight, LV.audit_pass_time, LV.update_time, + LV.create_time, LV.video_content_type, LV.video_type, LV.video_imgs, @@ -230,6 +233,8 @@ LEFT JOIN li_member LM ON LV.author_id = LM.id WHERE LV.delete_flag = 0 AND LV.status = '1' AND LV.video_type = #{query.videoType} + ORDER BY + LV.create_time DESC </select> <select id="recommendHealthVideo" resultMap="WxResultMap"> SELECT diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/NewsController.java b/manager-api/src/main/java/cn/lili/controller/lmk/NewsController.java new file mode 100644 index 0000000..703546c --- /dev/null +++ b/manager-api/src/main/java/cn/lili/controller/lmk/NewsController.java @@ -0,0 +1,77 @@ +package cn.lili.controller.lmk; + + +import cn.lili.base.Result; +import cn.lili.group.Add; +import cn.lili.group.Update; +import cn.lili.modules.lmk.domain.form.ActivityForm; +import cn.lili.modules.lmk.domain.form.NewsForm; +import cn.lili.modules.lmk.domain.query.ActivityQuery; +import cn.lili.modules.lmk.domain.query.NewsQuery; +import cn.lili.modules.lmk.service.NewsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * lmk-shop-java + * 鏂伴椈 + * + * @author : zxl + * @date : 2025-06-20 15:41 + **/ +@Validated +@RequiredArgsConstructor +@Api(value = "鏂伴椈", tags = "鏂伴椈") +@RestController +@RequestMapping("/manager/news") +public class NewsController { + private final NewsService newsService; + + @PostMapping + @ApiOperation(value = "娣诲姞", notes = "娣诲姞") + public Result add(@RequestBody @Validated(Add.class) NewsForm form) { + return newsService.add(form); + } + + @PutMapping + @ApiOperation(value = "淇敼", notes = "淇敼") + public Result update(@RequestBody @Validated(Update.class) NewsForm form) { + return newsService.update(form); + } + + @DeleteMapping("/{id}") + @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎") + public Result removeById(@PathVariable("id") String id) { + return newsService.removeById(id); + } + + @DeleteMapping("/batch") + @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎") + public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) { + return newsService.remove(ids); + } + + @GetMapping("/page") + @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉") + public Result page(NewsQuery query) { + return newsService.page(query); + } + + @GetMapping("/{id}") + @ApiOperation(value = "璇︽儏", notes = "璇︽儏") + public Result detail(@PathVariable("id") String id) { + return newsService.detail(id); + } + + @PutMapping("/publish/{id}") + public Result publish(@PathVariable("id") String id){ + return newsService.publish(id); + } + +} -- Gitblit v1.8.0