feat:
1. add module store favorite
This commit is contained in:
@@ -126,8 +126,8 @@ public class MarketMerchantController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 13)
|
||||
@Operation(summary = "商品分页")
|
||||
public R<IPage<MerchantProductApiVO>> list(String shop, Query query) {
|
||||
return R.data(inventoryService.selectProductInventoryPageByShop(Condition.getPage(query), shop));
|
||||
public R<IPage<MerchantProductApiVO>> list(String p, Query query) {
|
||||
return R.data(inventoryService.selectProductInventoryPage(Condition.getPage(query), p));
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@@ -193,5 +193,11 @@ public class MarketMerchantController {
|
||||
return R.status(orderService.cancelOrder(AuthUtil.getUserId(), request.getId(), request.getRemark()));
|
||||
}
|
||||
|
||||
@GetMapping("/store-favorite-list")
|
||||
@ApiOperationSupport(order = 23)
|
||||
@Operation(summary = "用户店铺收藏列表")
|
||||
public R<List<MerchantStoreFavoriteApiVO>> storeFavoriteList() {
|
||||
return R.data(inventoryService.selectStoreFavoriteList(AuthUtil.getUserId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantCatalogEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@@ -20,6 +19,8 @@ public class MerchantProductDetailApiVO implements Serializable {
|
||||
|
||||
private String shop;
|
||||
|
||||
private Boolean favorite;
|
||||
|
||||
private List<String> mainImageUrls;
|
||||
|
||||
private List<String> detailImageUrls;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class MerchantStoreFavoriteApiVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String storeName;
|
||||
|
||||
private String merchantName;
|
||||
|
||||
private String merchantAccount;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.annotation.IsAdmin;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantStoreFavoriteVO;
|
||||
import org.springblade.modules.market.service.IMerchantStoreFavoriteService;
|
||||
import org.springblade.modules.market.wrapper.MerchantStoreFavoriteWrapper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 控制器
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/store-favorite")
|
||||
@Tag(name = "自营商家店铺收藏表", description = "自营商家店铺收藏表接口")
|
||||
@PreAuth("hasAnyRole('administrator', 'admin', 'operator')")
|
||||
public class MerchantStoreFavoriteController extends BladeController {
|
||||
|
||||
private final IMerchantStoreFavoriteService storeFavoriteService;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入storeFavorite")
|
||||
public R<MerchantStoreFavoriteVO> detail(MerchantStoreFavoriteEntity storeFavorite) {
|
||||
MerchantStoreFavoriteEntity detail = storeFavoriteService.getOne(Condition.getQueryWrapper(storeFavorite));
|
||||
return R.data(MerchantStoreFavoriteWrapper.build().entityVO(detail));
|
||||
}
|
||||
/**
|
||||
* 自营商家店铺收藏表 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入storeFavorite")
|
||||
public R<IPage<MerchantStoreFavoriteVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> storeFavorite, Query query) {
|
||||
IPage<MerchantStoreFavoriteEntity> pages = storeFavoriteService.page(Condition.getPage(query), Condition.getQueryWrapper(storeFavorite, MerchantStoreFavoriteEntity.class));
|
||||
return R.data(MerchantStoreFavoriteWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入storeFavorite")
|
||||
public R<IPage<MerchantStoreFavoriteVO>> page(MerchantStoreFavoriteVO storeFavorite, Query query) {
|
||||
IPage<MerchantStoreFavoriteVO> pages = storeFavoriteService.selectStoreFavoritePage(Condition.getPage(query), storeFavorite);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入storeFavorite")
|
||||
public R save(@Valid @RequestBody MerchantStoreFavoriteEntity storeFavorite) {
|
||||
return R.status(storeFavoriteService.save(storeFavorite));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入storeFavorite")
|
||||
public R update(@Valid @RequestBody MerchantStoreFavoriteEntity storeFavorite) {
|
||||
return R.status(storeFavoriteService.updateById(storeFavorite));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入storeFavorite")
|
||||
public R submit(@Valid @RequestBody MerchantStoreFavoriteEntity storeFavorite) {
|
||||
return R.status(storeFavoriteService.saveOrUpdate(storeFavorite));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(storeFavoriteService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,19 +46,19 @@ public interface MerchantInventoryMapper extends BaseMapper<MerchantInventoryEnt
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param vo 查询参数
|
||||
* @param vo 查询参数
|
||||
* @return List<ProductInventoryVO>
|
||||
*/
|
||||
List<MerchantInventoryVO> selectProductInventoryPage(IPage page, MerchantInventoryVO vo);
|
||||
|
||||
List<MarketMerchantInventoryApiVO> selectProductInventoryApiList(Long userId);
|
||||
List<MarketMerchantInventoryApiVO> selectProductInventoryApiList(Long userId);
|
||||
|
||||
int increaseInventory(Long id, Integer num, Long userId, Integer version);
|
||||
int increaseInventory(Long id, Integer num, Long userId, Integer version);
|
||||
|
||||
int reduceInventory(Long id, Integer num, Long userId, Integer version);
|
||||
|
||||
int unlistInventory(Long id, Integer num, Long userId, Integer version);
|
||||
|
||||
List<MerchantProductApiVO> selectProductInventoryPageByShop(IPage page, String shop);
|
||||
List<MerchantProductApiVO> selectProductInventoryApiVOPage(IPage page, String query);
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
select * from merchant_product_inventory where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectProductInventoryPageByShop" resultType="org.springblade.modules.api.vo.MerchantProductApiVO">
|
||||
<select id="selectProductInventoryApiVOPage" resultType="org.springblade.modules.api.vo.MerchantProductApiVO">
|
||||
select
|
||||
id as id,
|
||||
product_name as name,
|
||||
@@ -44,8 +44,8 @@
|
||||
merchant_product_inventory
|
||||
where is_deleted = 0
|
||||
and status = 1
|
||||
<if test="shop != null">
|
||||
and store_name = #{shop}
|
||||
<if test="query != null">
|
||||
and (store_name = #{query} or product_name = #{query} or user_account = #{query})
|
||||
</if>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.mapper;
|
||||
|
||||
import org.springblade.modules.api.vo.MerchantStoreFavoriteApiVO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantStoreFavoriteVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 Mapper 接口
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
public interface MerchantStoreFavoriteMapper extends BaseMapper<MerchantStoreFavoriteEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param storeFavorite 查询参数
|
||||
* @return List<StoreFavoriteVO>
|
||||
*/
|
||||
List<MerchantStoreFavoriteVO> selectStoreFavoritePage(IPage page, MerchantStoreFavoriteVO storeFavorite);
|
||||
|
||||
|
||||
List<MerchantStoreFavoriteApiVO> selectStoreFavoriteApiVOList(Long userId);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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="org.springblade.modules.market.mapper.MerchantStoreFavoriteMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="storeFavoriteResultMap" type="org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="merchant_id" property="merchantId"/>
|
||||
<result column="store_name" property="storeName"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectStoreFavoritePage" resultMap="storeFavoriteResultMap">
|
||||
select * from merchant_store_favorite where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectStoreFavoriteApiVOList" resultType="org.springblade.modules.api.vo.MerchantStoreFavoriteApiVO">
|
||||
select msf.id, umi.store_name, umi.real_name as merchantName, bu.account
|
||||
from merchant_store_favorite msf
|
||||
left join user_market_info umi on msf.merchant_id = umi.id
|
||||
left join blade_user bu on msf.merchant_id = bu.id
|
||||
where msf.is_deleted = 0
|
||||
and msf.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.dto;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 数据传输对象实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MerchantStoreFavoriteDTO extends MerchantStoreFavoriteEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
@Data
|
||||
@TableName("merchant_store_favorite")
|
||||
@Schema(description = "StoreFavorite对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MerchantStoreFavoriteEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
@Schema(description = "商家id")
|
||||
private Long merchantId;
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
@Schema(description = "店铺名称")
|
||||
private String storeName;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MerchantStoreFavoriteVO extends MerchantStoreFavoriteEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductDetailApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantStoreFavoriteApiVO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantInventoryEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantInventoryVO;
|
||||
|
||||
@@ -64,8 +65,9 @@ public interface IMerchantInventoryService extends BaseService<MerchantInventory
|
||||
|
||||
boolean publish(Long userId, Long productId, Integer num, BigDecimal price, Integer giftType, BigDecimal giftAmount);
|
||||
|
||||
IPage<MerchantProductApiVO> selectProductInventoryPageByShop(IPage<MerchantProductApiVO> page, String shop);
|
||||
IPage<MerchantProductApiVO> selectProductInventoryPage(IPage<MerchantProductApiVO> page, String query);
|
||||
|
||||
MerchantProductDetailApiVO getDetailById(Long userId, Long id);
|
||||
|
||||
List<MerchantStoreFavoriteApiVO> selectStoreFavoriteList(Long userId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service;
|
||||
|
||||
import org.springblade.modules.api.vo.MerchantStoreFavoriteApiVO;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantStoreFavoriteVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 服务类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
public interface IMerchantStoreFavoriteService extends BaseService<MerchantStoreFavoriteEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param storeFavorite 查询参数
|
||||
* @return IPage<StoreFavoriteVO>
|
||||
*/
|
||||
IPage<MerchantStoreFavoriteVO> selectStoreFavoritePage(IPage<MerchantStoreFavoriteVO> page, MerchantStoreFavoriteVO storeFavorite);
|
||||
|
||||
Boolean hasFavorite(Long userId, Long merchantId);
|
||||
|
||||
List<MerchantStoreFavoriteApiVO> selectStoreFavoriteApiVOList(Long userId);
|
||||
|
||||
}
|
||||
@@ -32,11 +32,8 @@ import org.springblade.common.cache.MarketInfoCache;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.redis.ratelimiter.RateLimiter;
|
||||
import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductApiVO;
|
||||
import org.springblade.modules.api.vo.MerchantProductDetailApiVO;
|
||||
import org.springblade.modules.market.convert.MarketMerchantConvert;
|
||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
import org.springblade.modules.market.eums.*;
|
||||
import org.springblade.modules.market.mapper.MerchantInventoryMapper;
|
||||
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
|
||||
@@ -53,11 +50,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -82,6 +77,8 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
||||
|
||||
private final IMerchantPayoutAccountService payoutAccountService;
|
||||
|
||||
private final IMerchantStoreFavoriteService favoriteService;
|
||||
|
||||
@Override
|
||||
public IPage<MerchantInventoryVO> selectProductInventoryPage(IPage<MerchantInventoryVO> page, MerchantInventoryVO inventory) {
|
||||
return page.setRecords(baseMapper.selectProductInventoryPage(page, inventory));
|
||||
@@ -333,8 +330,8 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<MerchantProductApiVO> selectProductInventoryPageByShop(IPage<MerchantProductApiVO> page, String shop) {
|
||||
return page.setRecords(baseMapper.selectProductInventoryPageByShop(page, shop));
|
||||
public IPage<MerchantProductApiVO> selectProductInventoryPage(IPage<MerchantProductApiVO> page, String query) {
|
||||
return page.setRecords(baseMapper.selectProductInventoryApiVOPage(page, query));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -368,7 +365,25 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
||||
vo.setAmount(inventory.getUnitGiftAmount());
|
||||
vo.setType(inventory.getGiftType());
|
||||
vo.setPayoutAccountTypes(payoutAccountApiVOList.stream().map(MerchantPayoutAccountApiVO::getAccountType).filter(Objects::nonNull).distinct().toList());
|
||||
vo.setFavorite(favoriteService.hasFavorite(userId, inventory.getUserId()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantStoreFavoriteApiVO> selectStoreFavoriteList(Long userId) {
|
||||
if (Objects.isNull(userId)) {
|
||||
throw new ServiceException("无效参数");
|
||||
}
|
||||
List<MerchantStoreFavoriteApiVO> list = favoriteService.selectStoreFavoriteApiVOList(userId);
|
||||
list.forEach(v -> {
|
||||
v.setMerchantAccount(SensitiveUtil.process(v.getMerchantAccount()));
|
||||
v.setMerchantName(desensitizationByName(v.getMerchantName()));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
private String desensitizationByName(String name) {
|
||||
return name.replaceAll("^(.).*$", "$1" + "*".repeat(name.length() - 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springblade.modules.api.vo.MerchantStoreFavoriteApiVO;
|
||||
import org.springblade.modules.market.mapper.MerchantStoreFavoriteMapper;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantStoreFavoriteVO;
|
||||
import org.springblade.modules.market.service.IMerchantStoreFavoriteService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 服务实现类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
@Service
|
||||
public class MerchantStoreFavoriteServiceImpl extends BaseServiceImpl<MerchantStoreFavoriteMapper, MerchantStoreFavoriteEntity> implements IMerchantStoreFavoriteService {
|
||||
|
||||
@Override
|
||||
public IPage<MerchantStoreFavoriteVO> selectStoreFavoritePage(IPage<MerchantStoreFavoriteVO> page, MerchantStoreFavoriteVO storeFavorite) {
|
||||
return page.setRecords(baseMapper.selectStoreFavoritePage(page, storeFavorite));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean hasFavorite(Long userId, Long merchantId) {
|
||||
if (Objects.isNull(userId) || Objects.isNull(merchantId)) {
|
||||
return false;
|
||||
}
|
||||
return exists(Wrappers.lambdaQuery(MerchantStoreFavoriteEntity.class).eq(MerchantStoreFavoriteEntity::getUserId, userId).eq(MerchantStoreFavoriteEntity::getMerchantId, merchantId).eq(MerchantStoreFavoriteEntity::getIsDeleted, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantStoreFavoriteApiVO> selectStoreFavoriteApiVOList(Long userId) {
|
||||
return baseMapper.selectStoreFavoriteApiVOList(userId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.market.pojo.entity.MerchantStoreFavoriteEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MerchantStoreFavoriteVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自营商家店铺收藏表 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-05-11
|
||||
*/
|
||||
public class MerchantStoreFavoriteWrapper extends BaseEntityWrapper<MerchantStoreFavoriteEntity, MerchantStoreFavoriteVO> {
|
||||
|
||||
public static MerchantStoreFavoriteWrapper build() {
|
||||
return new MerchantStoreFavoriteWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantStoreFavoriteVO entityVO(MerchantStoreFavoriteEntity storeFavorite) {
|
||||
MerchantStoreFavoriteVO storeFavoriteVO = Objects.requireNonNull(BeanUtil.copyProperties(storeFavorite, MerchantStoreFavoriteVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(storeFavorite.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(storeFavorite.getUpdateUser());
|
||||
//storeFavoriteVO.setCreateUserName(createUser.getName());
|
||||
//storeFavoriteVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return storeFavoriteVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user