超市接口

This commit is contained in:
zjf committed 2025-01-07 19:01:30 +08:00
1 parent 7d4e7e5a0d
commit b5ac643785
11 files changed
+261 -4

No files matched your search

@@ -44,7 +44,7 @@ public interface RemoteSupermarketSpuService {
* @return R
*/
@PostMapping("/supermarketSpu/ad/selectListAll")
R getSupermarketSpu(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO);
R getSupermarketSpuScope(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO);
@@ -64,4 +64,15 @@ public interface RemoteSupermarketSpuService {
*/
@PostMapping("/supermarketSpu/ad/updateSpuStock")
R getSupermarketSpu(@RequestBody SupermarketSpuUpdateStockReqDTO updateStockReqDTO);
/**
* 查询所有的超市spu列表信息,根据条件
* @return R
*/
@PostMapping("/supermarketSpu/app/selectListAll")
R getSupermarketSpu(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO);
}
@@ -44,4 +44,11 @@ public class SupermarketSpuQueryDTO {
*/
@Schema(description="商品性质(字典)")
private String productNature;
/**
* 商户id
*/
@Schema(description="商户id")
private Long merchantId;
}
@@ -100,4 +100,11 @@ public class SupermarketBrandEntity extends Model<SupermarketBrandEntity> {
*/
@Schema(description="租户编号")
private Long tenantId;
/**
* 商户id
*/
@Schema(description="商户id")
private Long merchantId;
}
@@ -106,4 +106,10 @@ public class SupermarketCategoryEntity extends Model<SupermarketCategoryEntity>
*/
@Schema(description="租户编号")
private Long tenantId;
/**
* 商户id
*/
@Schema(description="商户id")
private Long merchantId;
}
@@ -0,0 +1,165 @@
package com.bsd.pjcloud.supermarket.vo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
@Schema(description="app Spuvo")
public class SupermarketAppSpuVo {
/**
* 商品 SPU 编号,自增
*/
@Schema(description="商品 SPU 编号,自增")
private Long id;
/**
* 货号
*/
@Schema(description="货号")
private String productCode;
/**
* 自编码/条码
*/
@Schema(description="自编码/条码")
private String barcode;
/**
* 商品名称
*/
@Schema(description="商品名称")
private String productName;
/**
* 单位
*/
@Schema(description="单位")
private String unit;
/**
* 商品简介
*/
@Schema(description="商品简介")
private String introduction;
/**
* 商品详情
*/
@Schema(description="商品详情")
private String description;
/**
* 商品分类编号
*/
@Schema(description="商品分类编号")
private Long categoryId;
/**
* 商品封面图
*/
@Schema(description="商品封面图")
private String picUrl;
/**
* 商品轮播图地址
数组,以逗号分隔
最多上传15张
*/
@Schema(description="商品轮播图地址")
private String sliderPicUrls;
/**
* 库存
*/
@Schema(description="总库存")
private Integer stock;
/**
* 赠送积分
*/
@Schema(description="赠送积分")
private Integer giveIntegral;
/**
* 商户编号
*/
@Schema(description="商户编号")
private Long merchantId;
/**
* 产地
*/
@Schema(description="产地")
private String origin;
/**
* 商品性质(字典)
*/
@Schema(description="商品性质(字典)")
private String productNature;
/**
* 品牌id
*/
@Schema(description="品牌id")
private Long brandId;
/**
* 货商id
*/
@Schema(description="货商id")
private Long supplierId;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
@Schema(description = "销量")
private Integer salesCount;
@Schema(description = "辅助条码集合")
private List<SupermarketAuxiliaryCodeVo> supermarketAuxiliaryCodeEntityList;
@Schema(description = "包装对象集合")
private List<SupermarketUnitVo> supermarketUnitEntityList;
}
@@ -128,8 +128,25 @@ public class SupermarketCategoryController {
@Operation(summary = "下拉查询")
@GetMapping("/simpleAll")
public R getSimpleAll() {
List<SupermarketCategoryEntity> list = supermarketCategoryService.list();
List<SupermarketCategoryEntity> list = supermarketCategoryService.listScope();
List<SupermarketCategorySimpleVo> bean = BeanUtils.toBean(list, SupermarketCategorySimpleVo.class);
return R.ok(bean);
}
// --------------APP-------------------
/**
* 获取商户下所有分类
* @return
*/
@Operation(summary = "APP分类查询",description = "通过商户id获取该商户下的分类")
@GetMapping("/app/simpleAll")
public R getAppSimpleAll(@RequestParam("merchantId")Long merchantId) {
List<SupermarketCategoryEntity> list = supermarketCategoryService.
list(new LambdaQueryWrapper<SupermarketCategoryEntity>().eq(SupermarketCategoryEntity::getMerchantId, merchantId));
List<SupermarketCategorySimpleVo> bean = BeanUtils.toBean(list, SupermarketCategorySimpleVo.class);
return R.ok(bean);
}
}
@@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
@@ -17,6 +18,7 @@ import com.bsd.pjcloud.supermarket.entity.SupermarketUnitEntity;
import com.bsd.pjcloud.supermarket.service.SupermarketAuxiliaryCodeService;
import com.bsd.pjcloud.supermarket.service.SupermarketSpuService;
import com.bsd.pjcloud.supermarket.service.SupermarketUnitService;
import com.bsd.pjcloud.supermarket.vo.SupermarketAppSpuVo;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -25,6 +27,7 @@ import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -149,10 +152,10 @@ public class SupermarketSpuController {
* @param supermarketSpuQueryDTO 商品spu
* @return
*/
@Operation(summary = "条件查询所有" , description = "条件查询所有" )
@Operation(summary = "安卓机条件查询所有" , description = "安卓机条件查询所有" )
@PostMapping("/ad/selectListAll" )
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
public R getSupermarketSpu(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO) {
public R getSupermarketSpuByScope(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO) {
return R.ok(supermarketSpuService.selectListAllScope(supermarketSpuQueryDTO));
}
@@ -178,4 +181,26 @@ public class SupermarketSpuController {
/**
* 条件查询spu单表 列表信息
* @param supermarketSpuQueryDTO 商品spu
* @return
*/
@Operation(summary = "APP机条件查询所有SPU" , description = "APP条件查询所有" )
@PostMapping("/app/selectListAll" )
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
public R getSupermarketSpu(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO) {
LambdaQueryWrapper<SupermarketSpuEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(supermarketSpuQueryDTO.getMerchantId() != null, SupermarketSpuEntity::getMerchantId, supermarketSpuQueryDTO.getMerchantId());
wrapper.eq(StrUtil.isNotBlank(supermarketSpuQueryDTO.getProductCode()), SupermarketSpuEntity::getProductCode, supermarketSpuQueryDTO.getProductCode());
wrapper.eq(StrUtil.isNotBlank(supermarketSpuQueryDTO.getBarcode()), SupermarketSpuEntity::getBarcode, supermarketSpuQueryDTO.getBarcode());
wrapper.like(StrUtil.isNotBlank(supermarketSpuQueryDTO.getProductName()), SupermarketSpuEntity::getProductName, supermarketSpuQueryDTO.getProductName());
List<SupermarketSpuEntity> list = supermarketSpuService.list(wrapper);
List<SupermarketAppSpuVo> bean = BeanUtils.toBean(list, SupermarketAppSpuVo.class);
return R.ok(bean);
}
}
@@ -3,6 +3,14 @@ package com.bsd.pjcloud.supermarket.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.supermarket.entity.SupermarketCategoryEntity;
import java.util.List;
public interface SupermarketCategoryService extends IService<SupermarketCategoryEntity> {
/**
* 下拉查询
* @return
*/
List<SupermarketCategoryEntity> listScope();
}
@@ -1,10 +1,15 @@
package com.bsd.pjcloud.supermarket.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.supermarket.entity.SupermarketCategoryEntity;
import com.bsd.pjcloud.supermarket.mapper.SupermarketCategoryMapper;
import com.bsd.pjcloud.supermarket.service.SupermarketCategoryService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 商品分类
*
@@ -13,4 +18,8 @@ import org.springframework.stereotype.Service;
*/
@Service
public class SupermarketCategoryServiceImpl extends ServiceImpl<SupermarketCategoryMapper, SupermarketCategoryEntity> implements SupermarketCategoryService {
@Override
public List<SupermarketCategoryEntity> listScope() {
return baseMapper.selectListByScope(new LambdaQueryWrapper<SupermarketCategoryEntity>(), DataScope.of());
}
}
@@ -16,5 +16,6 @@
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
<result property="merchantId" column="merchant_id"/>
</resultMap>
</mapper>
@@ -17,5 +17,6 @@
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
<result property="merchantId" column="merchant_id"/>
</resultMap>
</mapper>