小程序 页面修改
分享配置 轮播图配置
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.market.dto.MkCarouselDTO;
|
||||
import com.czg.market.entity.MkCarousel;
|
||||
import com.czg.market.service.MkCarouselService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 轮播图配置
|
||||
*
|
||||
* @author ww
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/carousel")
|
||||
public class ACarouselController {
|
||||
|
||||
@Resource
|
||||
private MkCarouselService mkCarouselService;
|
||||
|
||||
/**
|
||||
* 轮播图配置
|
||||
*/
|
||||
@GetMapping
|
||||
@SaAdminCheckPermission(parentName = "轮播图配置", value = "carousel:config", name = "轮播图-列表")
|
||||
public CzgResult<List<MkCarousel>> getCarousels(MkCarouselDTO carouselDTO) {
|
||||
carouselDTO.setShopId(StpKit.USER.getShopId());
|
||||
return CzgResult.success(mkCarouselService.getCarousels(carouselDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮播图配置:新增/修改
|
||||
*/
|
||||
@PostMapping
|
||||
@SaAdminCheckPermission(parentName = "轮播图配置", value = "carousel:up", name = "轮播图-新增/修改")
|
||||
public CzgResult<Boolean> editCarousel(@RequestBody @Validated MkCarousel carousel) {
|
||||
carousel.setShopId(StpKit.USER.getShopId());
|
||||
if (carousel.getId() == null) {
|
||||
return CzgResult.success(mkCarouselService.save(carousel));
|
||||
} else {
|
||||
return CzgResult.success(mkCarouselService.updateById(carousel, false));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮播图配置:删除
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@SaAdminCheckPermission(parentName = "轮播图配置", value = "carousel:up", name = "轮播图-新增/修改")
|
||||
public CzgResult<Boolean> deleteCarousel(@PathVariable("id") Long id) {
|
||||
return CzgResult.success(mkCarouselService.remove(QueryWrapper.create().eq(MkCarousel::getId, id).eq(MkCarousel::getShopId, StpKit.USER.getShopId())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.market.entity.MkShareBase;
|
||||
import com.czg.market.service.MkShareBaseService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 分享奖励基础
|
||||
*
|
||||
* @author ww
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/shareBase")
|
||||
public class AShareBaseController {
|
||||
|
||||
@Resource
|
||||
private MkShareBaseService mkShareBaseService;
|
||||
|
||||
/**
|
||||
* 分享奖励基础
|
||||
*/
|
||||
@GetMapping
|
||||
@SaAdminCheckPermission(parentName = "分享奖励基础", value = "share:config", name = "分享-配置")
|
||||
public CzgResult<MkShareBase> getShareBase() {
|
||||
return CzgResult.success(mkShareBaseService.getShareBase(StpKit.USER.getShopId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享奖励基础:新增/修改
|
||||
*/
|
||||
@PostMapping
|
||||
@SaAdminCheckPermission(parentName = "分享奖励基础", value = "share:up", name = "分享-新增/修改")
|
||||
public CzgResult<Boolean> editShareBase(@RequestBody MkShareBase shareBase) {
|
||||
shareBase.setShopId(StpKit.USER.getShopId());
|
||||
MkShareBase share = mkShareBaseService.getById(shareBase.getShopId());
|
||||
if (share == null) {
|
||||
return CzgResult.success(mkShareBaseService.save(shareBase));
|
||||
} else {
|
||||
return CzgResult.success(mkShareBaseService.updateById(shareBase, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.market.dto.MkCarouselDTO;
|
||||
import com.czg.market.entity.MkCarousel;
|
||||
import com.czg.market.service.MkCarouselService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 轮播图配置
|
||||
*
|
||||
* @author ww
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/carousel")
|
||||
public class UCarouselController {
|
||||
|
||||
@Resource
|
||||
private MkCarouselService mkCarouselService;
|
||||
|
||||
/**
|
||||
* 轮播图配置
|
||||
*/
|
||||
@GetMapping
|
||||
@SaAdminCheckPermission(parentName = "轮播图配置", value = "carousel:config", name = "轮播图-列表")
|
||||
public CzgResult<List<MkCarousel>> getCarousels(MkCarouselDTO carouselDTO) {
|
||||
carouselDTO.setShopId(StpKit.USER.getShopId());
|
||||
return CzgResult.success(mkCarouselService.getCarousels(carouselDTO));
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class MiniAppPagesController {
|
||||
* @param status 小程序页面状态 -1 查全部 1 启用 0 禁用
|
||||
*/
|
||||
@GetMapping("page")
|
||||
@SaAdminCheckPermission(parentName = "小程序页面",value = "miniAppPages:page", name = "小程序页面分页")
|
||||
// @SaAdminCheckPermission(parentName = "小程序页面",value = "miniAppPages:page", name = "小程序页面分页")
|
||||
public CzgResult<Page<MiniAppPagesDTO>> getMiniAppPage(String name, String path, Integer status) {
|
||||
return miniAppPageService.getMiniAppPage(name, path, status);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
package com.czg.market.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 轮播图配置表 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class MkCarouselDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 轮播图名称(20字内)
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 是否可分享 1=开启 0=关闭
|
||||
*/
|
||||
private Integer isShareable;
|
||||
|
||||
/**
|
||||
* 启用状态 1=启用 0=禁用
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.czg.market.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 轮播图配置表 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mk_carousel")
|
||||
public class MkCarousel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private BigInteger id;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 轮播图名称(20字内)
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 轮播图片地址
|
||||
*/
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 是否可分享 1=开启 0=关闭
|
||||
*/
|
||||
private Integer isShareable;
|
||||
|
||||
/**
|
||||
* 跳转页面 tb_mini_app_pages的 id
|
||||
*/
|
||||
private Long jumpPageId;
|
||||
/**
|
||||
* 跳转页面路径
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private String jumpPagePath;
|
||||
|
||||
/**
|
||||
* 扩展参数
|
||||
*/
|
||||
private String extendParam;
|
||||
|
||||
/**
|
||||
* 排序值,值越大越靠前
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 启用状态 1=启用 0=禁用
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.czg.market.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 分享奖励基础配置 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mk_share_base")
|
||||
public class MkShareBase implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
@Id
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 功能开启状态 1=开启 0=关闭
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 可获得奖励的分享页面,用逗号分隔,
|
||||
* 店铺首页 index
|
||||
* 我的 dine
|
||||
* 点餐页 eat
|
||||
* 点餐页 eat-detail
|
||||
* 套餐推广-列表 pp-list
|
||||
* 套餐推广-详情 pp-detail
|
||||
* 商品拼团-列表 gb-list
|
||||
* 商品拼团-详情 gb-detail
|
||||
* 全民股东 dis
|
||||
*/
|
||||
private String rewardSharePages;
|
||||
|
||||
/**
|
||||
* 分享人奖励的优惠券ID,关联优惠券表
|
||||
*/
|
||||
private Long sharerCouponId;
|
||||
/**
|
||||
* 分享人奖励的优惠券名称
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private String sharerCouponName;
|
||||
|
||||
/**
|
||||
* 分享人单次获得优惠券数量
|
||||
*/
|
||||
private Integer sharerCouponNum;
|
||||
|
||||
/**
|
||||
* 可获得奖励次数 1=仅1次 2=每次分享成功
|
||||
*/
|
||||
private Integer rewardTimesType;
|
||||
|
||||
/**
|
||||
* 被分享人奖励的优惠券ID,关联优惠券表(可选)
|
||||
*/
|
||||
private Long sharedUserCouponId;
|
||||
/**
|
||||
* 被分享人奖励的优惠券名称
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private String sharedUserCouponName;
|
||||
|
||||
/**
|
||||
* 被分享人单次获得优惠券数量(可选)
|
||||
*/
|
||||
private Integer sharedUserCouponNum;
|
||||
|
||||
/**
|
||||
* 被分享人弹窗开关 1=开启 0=关闭
|
||||
*/
|
||||
private Integer isSharedUserPopup;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.czg.market.service;
|
||||
|
||||
import com.czg.market.dto.MkCarouselDTO;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.MkCarousel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 轮播图配置表 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
public interface MkCarouselService extends IService<MkCarousel> {
|
||||
|
||||
List<MkCarousel> getCarousels(MkCarouselDTO mkCarouselDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.czg.market.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.MkShareBase;
|
||||
|
||||
/**
|
||||
* 分享奖励基础配置 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
public interface MkShareBaseService extends IService<MkShareBase> {
|
||||
|
||||
MkShareBase getShareBase(Long shopId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.service.market.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.market.entity.MkCarousel;
|
||||
|
||||
/**
|
||||
* 轮播图配置表 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
public interface MkCarouselMapper extends BaseMapper<MkCarousel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.service.market.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.market.entity.MkShareBase;
|
||||
|
||||
/**
|
||||
* 分享奖励基础配置 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
public interface MkShareBaseMapper extends BaseMapper<MkShareBase> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.market.dto.MkCarouselDTO;
|
||||
import com.czg.system.entity.MiniAppPages;
|
||||
import com.czg.system.service.MiniAppPageService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkCarousel;
|
||||
import com.czg.market.service.MkCarouselService;
|
||||
import com.czg.service.market.mapper.MkCarouselMapper;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 轮播图配置表 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Service
|
||||
public class MkCarouselServiceImpl extends ServiceImpl<MkCarouselMapper, MkCarousel> implements MkCarouselService {
|
||||
@DubboReference
|
||||
private MiniAppPageService miniAppPageService;
|
||||
|
||||
@Override
|
||||
public List<MkCarousel> getCarousels(MkCarouselDTO mkCarouselDTO) {
|
||||
QueryWrapper queryWrapper = query().eq(MkCarousel::getShopId, mkCarouselDTO.getShopId())
|
||||
.eq(MkCarousel::getIsEnabled, mkCarouselDTO.getIsEnabled())
|
||||
.eq(MkCarousel::getIsShareable, mkCarouselDTO.getIsShareable())
|
||||
.orderBy(MkCarousel::getSort, false);
|
||||
if (StrUtil.isNotBlank(mkCarouselDTO.getName())) {
|
||||
queryWrapper.like(MkCarousel::getName, mkCarouselDTO.getName());
|
||||
}
|
||||
List<MkCarousel> list = list(queryWrapper);
|
||||
list.forEach(mkCarousel -> {
|
||||
MiniAppPages miniAppPages = miniAppPageService.getById(mkCarousel.getJumpPageId());
|
||||
if (miniAppPages != null) {
|
||||
mkCarousel.setJumpPagePath(miniAppPages.getPath());
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import com.czg.market.dto.ShopCouponDTO;
|
||||
import com.czg.market.service.ShopCouponService;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkShareBase;
|
||||
import com.czg.market.service.MkShareBaseService;
|
||||
import com.czg.service.market.mapper.MkShareBaseMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 分享奖励基础配置 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Service
|
||||
public class MkShareBaseServiceImpl extends ServiceImpl<MkShareBaseMapper, MkShareBase> implements MkShareBaseService {
|
||||
|
||||
@Resource
|
||||
private ShopCouponService shopCouponService;
|
||||
|
||||
@Override
|
||||
public MkShareBase getShareBase(Long shopId) {
|
||||
MkShareBase shareBase = getById(shopId);
|
||||
if (shareBase != null) {
|
||||
if (shareBase.getSharerCouponId() != null) {
|
||||
ShopCouponDTO sharerCoupon = shopCouponService.getCouponById(shareBase.getSharerCouponId());
|
||||
if (sharerCoupon != null) {
|
||||
shareBase.setSharerCouponName(sharerCoupon.getTitle());
|
||||
}
|
||||
}
|
||||
if (shareBase.getSharedUserCouponId() != null) {
|
||||
ShopCouponDTO shareUserCoupon = shopCouponService.getCouponById(shareBase.getSharedUserCouponId());
|
||||
if (shareUserCoupon != null) {
|
||||
shareBase.setSharedUserCouponName(shareUserCoupon.getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
return shareBase;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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="com.czg.service.market.mapper.MkCarouselMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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="com.czg.service.market.mapper.MkShareBaseMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -12,7 +12,7 @@ import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.system.mapper.MiniAppPagesMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
/**
|
||||
* 小程序页面路径 服务层实现。
|
||||
@@ -20,7 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
* @author mac
|
||||
* @since 2025-02-12
|
||||
*/
|
||||
@Service
|
||||
@DubboService
|
||||
public class MiniAppPagesServiceImpl extends ServiceImpl<MiniAppPagesMapper, MiniAppPages> implements MiniAppPageService {
|
||||
|
||||
@Override
|
||||
@@ -46,6 +46,7 @@ public class MiniAppPagesServiceImpl extends ServiceImpl<MiniAppPagesMapper, Min
|
||||
|
||||
pages.setIcon(pagesDTO.getIcon());
|
||||
pages.setName(pagesDTO.getName());
|
||||
pages.setPath(pagesDTO.getPath());
|
||||
pages.setStatus(pagesDTO.getStatus());
|
||||
pages.setDescription(pagesDTO.getDescription());
|
||||
pages.setStatus(pagesDTO.getStatus());
|
||||
|
||||
Reference in New Issue
Block a user