From 0d5ce03a7e150d034fadc7f864ee659cf4c6150f Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期五, 08 八月 2025 17:23:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsBannerServiceImpl.java | 143 ++++++++++++++ buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java | 9 framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java | 1 lmk-job/src/main/java/cn/lili/handler/impl/order/OrderEveryDayTaskExecute.java | 1 framework/src/main/java/cn/lili/modules/lmk/domain/query/GoodsBannerQuery.java | 22 ++ framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsBannerVO.java | 61 ++++++ framework/src/main/resources/mapper/lmk/GoodsBannerMapper.xml | 71 +++++++ framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsBanner.java | 42 ++++ framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java | 4 framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsBannerForm.java | 55 +++++ framework/src/main/java/cn/lili/modules/lmk/service/GoodsBannerService.java | 67 ++++++ manager-api/src/main/java/cn/lili/controller/lmk/GoodsBannerController.java | 76 +++++++ framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsBannerMapper.java | 37 +++ 13 files changed, 587 insertions(+), 2 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java index f2f3ede..c53850b 100644 --- a/buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java @@ -14,7 +14,9 @@ import cn.lili.modules.goods.entity.vos.GoodsVO; import cn.lili.modules.goods.service.GoodsService; import cn.lili.modules.goods.service.GoodsSkuService; +import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; import cn.lili.modules.lmk.domain.query.VideoGoodsEsQuery; +import cn.lili.modules.lmk.service.GoodsBannerService; import cn.lili.modules.search.entity.dos.EsGoodsIndex; import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo; import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO; @@ -74,6 +76,8 @@ @Autowired private COSUtil cosUtil; + @Autowired + private GoodsBannerService goodsBannerService; @ApiOperation(value = "閫氳繃id鑾峰彇鍟嗗搧淇℃伅") @ApiImplicitParam(name = "goodsId", value = "鍟嗗搧ID", required = true, paramType = "path", dataType = "Long") @@ -139,6 +143,11 @@ }); return ResultUtil.data(ePage); } + @ApiOperation(value = "鑾峰彇鎺ㄥ箍淇℃伅") + @GetMapping("/getBannerList") + public Result getBannerList(GoodsBannerQuery query) { + return goodsBannerService.getBannerList(query); + } @ApiOperation(value = "鍟嗗搧鍒嗛〉-鍙戝竷瑙嗛鏃跺叧鑱斿晢鍝�") @GetMapping("/video/es") diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsBanner.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsBanner.java new file mode 100644 index 0000000..0565172 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsBanner.java @@ -0,0 +1,42 @@ +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 java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘 + * + * @author peng + * @since 2025-08-07 + */ +@Data +@TableName("lmk_goods_banner") +public class GoodsBanner extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("goods_id") + /** 鍟嗗搧id */ + private Long goodsId; + + @TableField("sku_id") + /** skuId */ + private Long skuId; + + @TableField("sort") + private Integer sort; + + @TableField("can_show") + private Boolean canShow; + + @TableField("banner_url") + /** banner鍥剧墖 */ + private String bannerUrl; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsBannerForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsBannerForm.java new file mode 100644 index 0000000..583aa3c --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsBannerForm.java @@ -0,0 +1,55 @@ +package cn.lili.modules.lmk.domain.form; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import cn.lili.base.AbsForm; +import cn.lili.modules.lmk.domain.entity.GoodsBanner; +import org.springframework.beans.BeanUtils; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.lang.NonNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘琛ㄥ崟 + * + * @author peng + * @since 2025-08-07 + */ +@Data +@ApiModel(value = "GoodsBanner琛ㄥ崟", description = "鍟嗗搧骞垮満鎺ㄨ崘琛ㄥ崟") +public class GoodsBannerForm extends AbsForm { + + @NotNull(message = "鍟嗗搧id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鍟嗗搧id") + private Long goodsId; + + @NotNull(message = "skuId涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("skuId") + private Long skuId; + + + @ApiModelProperty("sort") + private Integer sort; + + + @ApiModelProperty("canShow") + @NotNull(message = "鏄惁鏄剧ず涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + private Boolean canShow; + + @NotBlank(message = "banner鍥剧墖涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("banner鍥剧墖") + private String bannerUrl; + + public static GoodsBanner getEntityByForm(@NonNull GoodsBannerForm form, GoodsBanner entity) { + if(entity == null) { + entity = new GoodsBanner(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/GoodsBannerQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/GoodsBannerQuery.java new file mode 100644 index 0000000..1589bf8 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/GoodsBannerQuery.java @@ -0,0 +1,22 @@ +package cn.lili.modules.lmk.domain.query; + +import cn.lili.base.AbsQuery; +import java.util.List; +import org.springframework.lang.NonNull; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘鏌ヨ + * + * @author peng + * @since 2025-08-07 + */ +@Data +@ApiModel(value = "GoodsBanner鏌ヨ鍙傛暟", description = "鍟嗗搧骞垮満鎺ㄨ崘鏌ヨ鍙傛暟") +public class GoodsBannerQuery extends AbsQuery { +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsBannerVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsBannerVO.java new file mode 100644 index 0000000..74df429 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsBannerVO.java @@ -0,0 +1,61 @@ +package cn.lili.modules.lmk.domain.vo; + +import cn.lili.base.AbsVo; +import cn.lili.group.Add; +import cn.lili.group.Update; +import cn.lili.modules.lmk.domain.entity.GoodsBanner; +import java.util.List; +import org.springframework.lang.NonNull; +import org.springframework.beans.BeanUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘灞曠ず + * + * @author peng + * @since 2025-08-07 + */ +@Data +@ApiModel(value = "鍟嗗搧骞垮満鎺ㄨ崘鍝嶅簲鏁版嵁", description = "鍟嗗搧骞垮満鎺ㄨ崘鍝嶅簲鏁版嵁") +public class GoodsBannerVO extends AbsVo { + + /** 鍟嗗搧id */ + @ApiModelProperty("鍟嗗搧id") + private String goodsId; + + /** skuId */ + @ApiModelProperty("skuId") + private String skuId; + + /** banner鍥剧墖 */ + @ApiModelProperty("banner鍥剧墖") + private String bannerUrl; + + /** banner鍥剧墖 */ + @ApiModelProperty("banner鍥剧墖") + private String showBannerUrl; + + @ApiModelProperty("sort") + private Integer sort; + + private String goodsName; + private String price; + private String thumbnail; + + @ApiModelProperty("canShow") + private Boolean canShow; + + public static GoodsBannerVO getVoByEntity(@NonNull GoodsBanner entity, GoodsBannerVO vo) { + if(vo == null) { + vo = new GoodsBannerVO(); + } + BeanUtils.copyProperties(entity, vo); + return vo; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsBannerMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsBannerMapper.java new file mode 100644 index 0000000..1bca94d --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsBannerMapper.java @@ -0,0 +1,37 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.GoodsBanner; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.lili.modules.lmk.domain.vo.GoodsBannerVO; +import cn.lili.modules.lmk.domain.form.GoodsBannerForm; +import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘 Mapper 鎺ュ彛 + * + * @author peng + * @since 2025-08-07 + */ +@Mapper +public interface GoodsBannerMapper extends BaseMapper<GoodsBanner> { + + /** + * id鏌ユ壘鍟嗗搧骞垮満鎺ㄨ崘 + * @param id + * @return + */ + GoodsBannerVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") GoodsBannerQuery query); + + List<GoodsBannerVO> getBannerList(@Param("query") GoodsBannerQuery query); + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/GoodsBannerService.java b/framework/src/main/java/cn/lili/modules/lmk/service/GoodsBannerService.java new file mode 100644 index 0000000..c0a2b3b --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/GoodsBannerService.java @@ -0,0 +1,67 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.modules.lmk.domain.entity.GoodsBanner; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.GoodsBannerForm; +import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; +import java.util.List; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘 鏈嶅姟绫� + * + * @author peng + * @since 2025-08-07 + */ +public interface GoodsBannerService extends IService<GoodsBanner> { + + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(GoodsBannerForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(GoodsBannerForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(GoodsBannerQuery query); + + Result getBannerList(GoodsBannerQuery query); + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + Result detail(String id); + + /** + * 鍒楄〃 + * @return + */ + Result all(); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsBannerServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsBannerServiceImpl.java new file mode 100644 index 0000000..82d1d37 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsBannerServiceImpl.java @@ -0,0 +1,143 @@ +package cn.lili.modules.lmk.service.impl; + +import cn.lili.common.utils.StringUtils; +import cn.lili.utils.COSUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.lili.modules.lmk.domain.entity.GoodsBanner; +import cn.lili.modules.lmk.mapper.GoodsBannerMapper; +import cn.lili.modules.lmk.service.GoodsBannerService; +import cn.lili.base.Result; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.lili.modules.lmk.domain.form.GoodsBannerForm; +import cn.lili.modules.lmk.domain.vo.GoodsBannerVO; +import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; +import org.springframework.stereotype.Service; +import lombok.RequiredArgsConstructor; +import cn.lili.utils.PageUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘 鏈嶅姟瀹炵幇绫� + * + * @author peng + * @since 2025-08-07 + */ +@Service +@RequiredArgsConstructor +public class GoodsBannerServiceImpl extends ServiceImpl<GoodsBannerMapper, GoodsBanner> implements GoodsBannerService { + + private final GoodsBannerMapper goodsBannerMapper; + private final COSUtil cosUtil; + /** + * 娣诲姞 + * @param form + * @return + */ + @Override + public Result add(GoodsBannerForm form) { + GoodsBanner entity = GoodsBannerForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * @param form + * @return + */ + @Override + public Result update(GoodsBannerForm form) { + GoodsBanner entity = baseMapper.selectById(form.getId()); + + // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + BeanUtils.copyProperties(form, entity); + baseMapper.updateById(entity); + return Result.ok("淇敼鎴愬姛"); + } + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + @Override + public Result remove(List<String> ids) { + baseMapper.deleteBatchIds(ids); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * id鍒犻櫎 + * @param id + * @return + */ + @Override + public Result removeById(String id) { + baseMapper.deleteById(id); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + @Override + public Result page(GoodsBannerQuery query) { + IPage<GoodsBannerVO> page = PageUtil.getPage(query, GoodsBannerVO.class); + baseMapper.getPage(page, query); + page.getRecords().stream().forEach(item -> { + String bannerUrl = item.getBannerUrl(); + if (StringUtils.isNotEmpty(bannerUrl)&&!bannerUrl.contains("http")) { + item.setShowBannerUrl(cosUtil.getPreviewUrl(bannerUrl)); + }else { + item.setShowBannerUrl(bannerUrl); + } + }); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + @Override + public Result getBannerList(GoodsBannerQuery query) { + List<GoodsBannerVO> bannerList = baseMapper.getBannerList(query); + bannerList.forEach(item -> { + String bannerUrl = item.getBannerUrl(); + if (StringUtils.isNotEmpty(bannerUrl)&&!bannerUrl.contains("http")) { + item.setShowBannerUrl(cosUtil.getPreviewUrl(bannerUrl)); + }else { + item.setShowBannerUrl(bannerUrl); + } + }); + return Result.ok().data(bannerList); + } + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + @Override + public Result detail(String id) { + GoodsBannerVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + /** + * 鍒楄〃 + * @return + */ + @Override + public Result all() { + List<GoodsBanner> entities = baseMapper.selectList(null); + List<GoodsBannerVO> vos = entities.stream() + .map(entity -> GoodsBannerVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } +} diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java index a94ecee..a283a48 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java @@ -96,7 +96,9 @@ AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser()); if (StringUtils.isNotBlank(currentUser.getId())){ List<String> ids = list.stream().map(CouponVO::getId).collect(Collectors.toList()); - + if (!(ids.size() >1)){ + return; + } //鑾峰緱鍒嗛〉浼樻儬鍔靛悗鐨勭粨鏋滃悗锛屽垽鏂璞℃槸鍚﹁鐢ㄦ埛鑾峰緱杩囥�� List<MemberCoupon> userCouponVOS = new LambdaQueryChainWrapper<>(memberCouponMapper) .in(MemberCoupon::getCouponId,ids) diff --git a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java index 7924f31..3fcfaf2 100644 --- a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java +++ b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java @@ -297,6 +297,7 @@ @ApiModelProperty("鍟嗗搧淇冮攢娲诲姩闆嗗悎JSON锛宬ey 涓� 淇冮攢娲诲姩绫诲瀷锛寁alue 涓� 淇冮攢娲诲姩瀹炰綋淇℃伅 ") private String promotionMapJson; @ApiModelProperty(value = "鍟嗗搧鎺掑簭") + @Field(type = FieldType.Long) private Integer goodsSort; public EsGoodsIndex(GoodsSku sku) { diff --git a/framework/src/main/resources/mapper/lmk/GoodsBannerMapper.xml b/framework/src/main/resources/mapper/lmk/GoodsBannerMapper.xml new file mode 100644 index 0000000..0f5f022 --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/GoodsBannerMapper.xml @@ -0,0 +1,71 @@ +<?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.GoodsBannerMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.GoodsBannerVO"> + <id column="id" property="id"/> + <result column="goods_id" property="goodsId" /> + <result column="sku_id" property="skuId" /> + <result column="banner_url" property="bannerUrl" /> + <result column="sort" property="sort" /> + <result column="can_show" property="canShow" /> + <result property="goodsName" column="goods_name"/> + <result property="price" column="price"/> + <result property="thumbnail" column="thumbnail"/> + </resultMap> + + + + + + + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LGB.goods_id, + LGB.sku_id, + LGB.banner_url, + LGB.id + FROM + lmk_goods_banner LGB + WHERE + LGB.id = #{id} AND LGB.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LGB.goods_id, + LGB.sku_id, + LGB.banner_url, + LGB.id, + LGB.sort, + LGB.can_show, + LGS.goods_name, + LGS.price, + LGS.thumbnail + FROM + lmk_goods_banner LGB + JOIN li_goods_sku LGS ON LGS.id = LGB.sku_id + AND LGS.delete_flag = 0 + WHERE + LGB.delete_flag = 0 + </select> + <select id="getBannerList" resultMap="BaseResultMap"> + SELECT + LGB.id, + LGB.goods_id, + LGB.sku_id, + LGB.banner_url + FROM + lmk_goods_banner LGB + JOIN li_goods_sku LGS ON LGS.id = LGB.sku_id + AND LGS.delete_flag = 0 + AND LGB.can_show = 1 + WHERE + LGB.delete_flag = 0 + order by LGB.sort asc + </select> + +</mapper> diff --git a/lmk-job/src/main/java/cn/lili/handler/impl/order/OrderEveryDayTaskExecute.java b/lmk-job/src/main/java/cn/lili/handler/impl/order/OrderEveryDayTaskExecute.java index 3474af1..85a590a 100644 --- a/lmk-job/src/main/java/cn/lili/handler/impl/order/OrderEveryDayTaskExecute.java +++ b/lmk-job/src/main/java/cn/lili/handler/impl/order/OrderEveryDayTaskExecute.java @@ -89,7 +89,6 @@ */ @Override public void execute() { - Setting setting = settingService.get(SettingEnum.ORDER_SETTING.name()); //璁㈠崟璁剧疆 OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class); diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/GoodsBannerController.java b/manager-api/src/main/java/cn/lili/controller/lmk/GoodsBannerController.java new file mode 100644 index 0000000..b9e539c --- /dev/null +++ b/manager-api/src/main/java/cn/lili/controller/lmk/GoodsBannerController.java @@ -0,0 +1,76 @@ +package cn.lili.controller.lmk; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import lombok.RequiredArgsConstructor; +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotEmpty; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import cn.lili.modules.lmk.service.GoodsBannerService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.GoodsBannerForm; +import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + * 鍟嗗搧骞垮満鎺ㄨ崘 鍓嶇鎺у埗鍣� + * + * @author peng + * @since 2025-08-07 + */ +@Validated +@RequiredArgsConstructor +@Api(value = "鍟嗗搧骞垮満鎺ㄨ崘", tags = "鍟嗗搧骞垮満鎺ㄨ崘绠$悊") +@RestController +@RequestMapping("/manager/lmk/goods-banner") +public class GoodsBannerController { + + private final GoodsBannerService goodsBannerService; + + @PostMapping + @ApiOperation(value = "娣诲姞", notes = "娣诲姞") + public Result add(@RequestBody @Validated(Add.class) GoodsBannerForm form) { + return goodsBannerService.add(form); + } + + @PutMapping + @ApiOperation(value = "淇敼", notes = "淇敼") + public Result update(@RequestBody @Validated(Update.class) GoodsBannerForm form) { + return goodsBannerService.update(form); + } + + @DeleteMapping("/{id}") + @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎") + public Result removeById(@PathVariable("id") String id) { + return goodsBannerService.removeById(id); + } + + @DeleteMapping("/batch") + @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎") + public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) { + return goodsBannerService.remove(ids); + } + + @GetMapping("/page") + @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉") + public Result page(GoodsBannerQuery query) { + return goodsBannerService.page(query); + } + + @GetMapping("/{id}") + @ApiOperation(value = "璇︽儏", notes = "璇︽儏") + public Result detail(@PathVariable("id") String id) { + return goodsBannerService.detail(id); + } + + @GetMapping("/list") + @ApiOperation(value = "鍒楄〃", notes = "鍒楄〃") + public Result list() { + return goodsBannerService.all(); + } +} -- Gitblit v1.8.0