1. update Mall
This commit is contained in:
2026-02-05 20:51:50 +08:00
parent c4bd46747a
commit d3211af9ae
15 changed files with 59 additions and 510 deletions

View File

@@ -11,7 +11,7 @@ import java.util.List;
@MappedJdbcTypes(JdbcType.ARRAY) @MappedJdbcTypes(JdbcType.ARRAY)
@MappedTypes(List.class) @MappedTypes(List.class)
public class PgBigIntArrayToListTypeHandler extends BaseTypeHandler<List<Long>> { public class PgLongArrayToListTypeHandler extends BaseTypeHandler<List<Long>> {
@Override @Override
public void setNonNullParameter(PreparedStatement ps, int i, List<Long> parameter, JdbcType jdbcType) throws SQLException { public void setNonNullParameter(PreparedStatement ps, int i, List<Long> parameter, JdbcType jdbcType) throws SQLException {

View File

@@ -32,27 +32,18 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import jakarta.validation.Valid; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.mall.pojo.entity.MallCategoryEntity; import org.springblade.modules.mall.pojo.entity.MallCategoryEntity;
import org.springblade.modules.mall.pojo.vo.MallCategoryVO; import org.springblade.modules.mall.pojo.vo.MallCategoryVO;
import org.springblade.modules.mall.excel.MallCategoryExcel;
import org.springblade.modules.mall.wrapper.MallCategoryWrapper; import org.springblade.modules.mall.wrapper.MallCategoryWrapper;
import org.springblade.modules.mall.service.IMallCategoryService; import org.springblade.modules.mall.service.IMallCategoryService;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.tool.constant.BladeConstant;
import java.util.Map; import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/** /**
* 商品分类 控制器 * 商品分类 控制器
@@ -146,31 +137,13 @@ public class MallCategoryController extends BladeController {
} }
/** // @GetMapping("/select-parent")
* 导出数据 // @ApiOperationSupport(order = 2)
*/ // @Operation(summary = "分页", description = "传入mallCategory")
@IsAdmin // public R<List<MallCategoryVO>> list() {
@GetMapping("/export-mallCategory") // List<MallCategoryEntity> pages = mallCategoryService.selectParent();
@ApiOperationSupport(order = 9) // return R.data(MallCategoryWrapper.build().listVO(pages));
@Operation(summary = "导出数据", description = "传入mallCategory")
public void exportMallCategory(@Parameter(hidden = true) @RequestParam Map<String, Object> mallCategory, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<MallCategoryEntity> queryWrapper = Condition.getQueryWrapper(mallCategory, MallCategoryEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(MallCategory::getTenantId, bladeUser.getTenantId());
// } // }
//queryWrapper.lambda().eq(MallCategoryEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<MallCategoryExcel> list = mallCategoryService.exportMallCategory(queryWrapper);
ExcelUtil.export(response, "商品分类数据" + DateUtil.time(), "商品分类数据表", list, MallCategoryExcel.class);
}
@GetMapping("/select-parent")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入mallCategory")
public R<List<MallCategoryVO>> list() {
List<MallCategoryEntity> pages = mallCategoryService.selectParent();
return R.data(MallCategoryWrapper.build().listVO(pages));
}

View File

@@ -32,27 +32,18 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import jakarta.validation.Valid; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.mall.pojo.entity.MallProductEntity; import org.springblade.modules.mall.pojo.entity.MallProductEntity;
import org.springblade.modules.mall.pojo.vo.MallProductVO; import org.springblade.modules.mall.pojo.vo.MallProductVO;
import org.springblade.modules.mall.excel.MallProductExcel;
import org.springblade.modules.mall.wrapper.MallProductWrapper; import org.springblade.modules.mall.wrapper.MallProductWrapper;
import org.springblade.modules.mall.service.IMallProductService; import org.springblade.modules.mall.service.IMallProductService;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.tool.constant.BladeConstant;
import java.util.Map; import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/** /**
* 商城商品 控制器 * 商城商品 控制器
@@ -140,22 +131,4 @@ public class MallProductController extends BladeController {
return R.status(mallProductService.deleteLogic(Func.toLongList(ids))); return R.status(mallProductService.deleteLogic(Func.toLongList(ids)));
} }
/**
* 导出数据
*/
@IsAdmin
@GetMapping("/export-mallProduct")
@ApiOperationSupport(order = 9)
@Operation(summary = "导出数据", description = "传入mallProduct")
public void exportMallProduct(@Parameter(hidden = true) @RequestParam Map<String, Object> mallProduct, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<MallProductEntity> queryWrapper = Condition.getQueryWrapper(mallProduct, MallProductEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(MallProduct::getTenantId, bladeUser.getTenantId());
//}
//queryWrapper.lambda().eq(MallProductEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<MallProductExcel> list = mallProductService.exportMallProduct(queryWrapper);
ExcelUtil.export(response, "商城商品数据" + DateUtil.time(), "商城商品数据表", list, MallProductExcel.class);
}
} }

View File

@@ -1,92 +0,0 @@
/**
* 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.mall.excel;
import lombok.Data;
import java.util.Date;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import java.io.Serializable;
import java.io.Serial;
/**
* 商品分类 Excel实体类
*
* @author BladeX
* @since 2026-02-05
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class MallCategoryExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ColumnWidth(20)
@ExcelProperty("主键")
private Long id;
/**
* 分类名称
*/
@ColumnWidth(20)
@ExcelProperty("分类名称")
private String cname;
/**
* 图片
*/
@ColumnWidth(20)
@ExcelProperty("图片")
private String img;
/**
* pid
*/
@ColumnWidth(20)
@ExcelProperty("pid")
private Long pid;
/**
* level
*/
@ColumnWidth(20)
@ExcelProperty("level")
private Integer level;
/**
* 是否已删除
*/
@ColumnWidth(20)
@ExcelProperty("是否已删除")
private Integer isDeleted;
}

View File

@@ -1,165 +0,0 @@
/**
* 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.mall.excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import java.io.Serializable;
import java.io.Serial;
/**
* 商城商品 Excel实体类
*
* @author BladeX
* @since 2026-02-05
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class MallProductExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ColumnWidth(20)
@ExcelProperty("主键")
private Long id;
/**
* 商品编码
*/
@ColumnWidth(20)
@ExcelProperty("商品编码")
private String spuSn;
/**
* 商品名称
*/
@ColumnWidth(20)
@ExcelProperty("商品名称")
private String spuName;
/**
* 主图
*/
@ColumnWidth(20)
@ExcelProperty("主图")
private String mainImg;
/**
* 详情图(多图,逗号分割)
*/
@ColumnWidth(20)
@ExcelProperty("详情图(多图,逗号分割)")
private String detailImg;
/**
* 顶图(多图,逗号分割)
*/
@ColumnWidth(20)
@ExcelProperty("顶图(多图,逗号分割)")
private String topImg;
/**
* 规格详情
*/
@ColumnWidth(20)
@ExcelProperty("规格详情")
private String attribute;
/**
* 单位
*/
@ColumnWidth(20)
@ExcelProperty("单位")
private String unit;
/**
* cate_id分类
*/
@ColumnWidth(20)
@ExcelProperty("cate_id分类")
private String categoryId;
/**
* cate_id分类
*/
@ColumnWidth(20)
@ExcelProperty("cate_id分类")
private String categoryIds;
/**
* 成本价
*/
@ColumnWidth(20)
@ExcelProperty("成本价")
private BigDecimal costPrice;
/**
* 原价
*/
@ColumnWidth(20)
@ExcelProperty("原价")
private BigDecimal originalPrice;
/**
* 销售价
*/
@ColumnWidth(20)
@ExcelProperty("销售价")
private BigDecimal retailPrice;
/**
* 利润
*/
@ColumnWidth(20)
@ExcelProperty("利润")
private BigDecimal profit;
/**
* 销量
*/
@ColumnWidth(20)
@ExcelProperty("销量")
private Integer sales;
/**
* 库存
*/
@ColumnWidth(20)
@ExcelProperty("库存")
private Integer spuQty;
/**
* 标签(多标签,逗号分割 )
*/
@ColumnWidth(20)
@ExcelProperty("标签(多标签,逗号分割 )")
private String tags;
/**
* 是否已删除
*/
@ColumnWidth(20)
@ExcelProperty("是否已删除")
private Integer isDeleted;
}

View File

@@ -27,11 +27,8 @@ package org.springblade.modules.mall.mapper;
import org.springblade.modules.mall.pojo.entity.MallCategoryEntity; import org.springblade.modules.mall.pojo.entity.MallCategoryEntity;
import org.springblade.modules.mall.pojo.vo.MallCategoryVO; import org.springblade.modules.mall.pojo.vo.MallCategoryVO;
import org.springblade.modules.mall.excel.MallCategoryExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
@@ -51,13 +48,4 @@ public interface MallCategoryMapper extends BaseMapper<MallCategoryEntity> {
*/ */
List<MallCategoryVO> selectMallCategoryPage(IPage page, MallCategoryVO mallCategory); List<MallCategoryVO> selectMallCategoryPage(IPage page, MallCategoryVO mallCategory);
/**
* 获取导出数据
*
* @param queryWrapper 查询条件
* @return List<MallCategoryExcel>
*/
List<MallCategoryExcel> exportMallCategory(@Param("ew") Wrapper<MallCategoryEntity> queryWrapper);
} }

View File

@@ -5,10 +5,11 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="mallCategoryResultMap" type="org.springblade.modules.mall.pojo.entity.MallCategoryEntity"> <resultMap id="mallCategoryResultMap" type="org.springblade.modules.mall.pojo.entity.MallCategoryEntity">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="cname" property="cname"/> <result column="category_name" property="categoryName"/>
<result column="img" property="img"/> <result column="image_url" property="imageUrl"/>
<result column="pid" property="pid"/> <result column="pid" property="pid"/>
<result column="level" property="level"/> <result column="level" property="level"/>
<result column="sort" property="sort"/>
<result column="is_deleted" property="isDeleted"/> <result column="is_deleted" property="isDeleted"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="create_user" property="createUser"/> <result column="create_user" property="createUser"/>
@@ -23,9 +24,4 @@
select * from mall_category where is_deleted = 0 select * from mall_category where is_deleted = 0
</select> </select>
<select id="exportMallCategory" resultType="org.springblade.modules.mall.excel.MallCategoryExcel">
SELECT * FROM mall_category ${ew.customSqlSegment}
</select>
</mapper> </mapper>

View File

@@ -27,11 +27,8 @@ package org.springblade.modules.mall.mapper;
import org.springblade.modules.mall.pojo.entity.MallProductEntity; import org.springblade.modules.mall.pojo.entity.MallProductEntity;
import org.springblade.modules.mall.pojo.vo.MallProductVO; import org.springblade.modules.mall.pojo.vo.MallProductVO;
import org.springblade.modules.mall.excel.MallProductExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
@@ -52,12 +49,4 @@ public interface MallProductMapper extends BaseMapper<MallProductEntity> {
List<MallProductVO> selectMallProductPage(IPage page, MallProductVO mallProduct); List<MallProductVO> selectMallProductPage(IPage page, MallProductVO mallProduct);
/**
* 获取导出数据
*
* @param queryWrapper 查询条件
* @return List<MallProductExcel>
*/
List<MallProductExcel> exportMallProduct(@Param("ew") Wrapper<MallProductEntity> queryWrapper);
} }

View File

@@ -5,22 +5,20 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="mallProductResultMap" type="org.springblade.modules.mall.pojo.entity.MallProductEntity"> <resultMap id="mallProductResultMap" type="org.springblade.modules.mall.pojo.entity.MallProductEntity">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="spu_sn" property="spuSn"/> <result column="serial_number" property="serialNumber"/>
<result column="spu_name" property="spuName"/> <result column="product_name" property="productName"/>
<result column="main_img" property="mainImg"/> <result column="main_image_urls" property="mainImageUrls" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/>
<result column="detail_img" property="detailImg" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/> <result column="detail_image_urls" property="detailImageUrls" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/>
<result column="top_img" property="topImg" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/> <result column="thumb_image_url" property="thumbImageUrl"/>
<result column="attribute" property="attribute" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/> <result column="specs" property="specs"/>
<result column="unit" property="unit"/> <result column="unit" property="unit"/>
<result column="category_id" property="categoryId"/> <result column="category_id" property="categoryId"/>
<result column="category_ids" property="categoryIds" typeHandler="org.springblade.common.handler.PgBigIntArrayToListTypeHandler"/> <result column="category_path" property="categoryPath" typeHandler="org.springblade.common.handler.PgLongArrayToListTypeHandler"/>
<result column="cost_price" property="costPrice"/>
<result column="original_price" property="originalPrice"/> <result column="original_price" property="originalPrice"/>
<result column="retail_price" property="retailPrice"/> <result column="retail_price" property="retailPrice"/>
<result column="profit" property="profit"/>
<result column="sales" property="sales"/> <result column="sales" property="sales"/>
<result column="spu_qty" property="spuQty"/> <result column="stock" property="stock"/>
<result column="tags" property="tags" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/> <result column="tags" property="tags"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="create_user" property="createUser"/> <result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/> <result column="create_dept" property="createDept"/>
@@ -35,9 +33,4 @@
select * from mall_product where is_deleted = 0 select * from mall_product where is_deleted = 0
</select> </select>
<select id="exportMallProduct" resultType="org.springblade.modules.mall.excel.MallProductExcel">
SELECT * FROM mall_product ${ew.customSqlSegment}
</select>
</mapper> </mapper>

View File

@@ -51,12 +51,12 @@ public class MallCategoryEntity extends BaseEntity {
* 分类名称 * 分类名称
*/ */
@Schema(description = "分类名称") @Schema(description = "分类名称")
private String cname; private String categoryName;
/** /**
* 图片 * 图片
*/ */
@Schema(description = "图片") @Schema(description = "图片")
private String img; private String imageUrl;
/** /**
* pid * pid
*/ */
@@ -65,7 +65,12 @@ public class MallCategoryEntity extends BaseEntity {
/** /**
* level * level
*/ */
@Schema(description = "level") @Schema(description = "层级:1-一级分类,2-二级分类,3-三级分类")
private Integer level; private Integer level;
/**
* sort
*/
@Schema(description = "排序值,越小越靠前")
private Integer sort;
} }

View File

@@ -31,11 +31,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.common.handler.PgBigIntArrayToListTypeHandler; import org.springblade.common.handler.PgLongArrayToListTypeHandler;
import org.springblade.common.handler.PgStringArrayToListTypeHandler; import org.springblade.common.handler.PgStringArrayToListTypeHandler;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial; import java.io.Serial;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 商城商品 实体类 * 商城商品 实体类
@@ -56,56 +57,50 @@ public class MallProductEntity extends BaseEntity {
* 商品编码 * 商品编码
*/ */
@Schema(description = "商品编码") @Schema(description = "商品编码")
private String spuSn; private String serialNumber;
/** /**
* 商品名称 * 商品名称
*/ */
@Schema(description = "商品名称") @Schema(description = "商品名称")
private String spuName; private String productName;
/** /**
* 主图 * 主图
*/ */
@TableField(typeHandler = PgStringArrayToListTypeHandler.class)
@Schema(description = "主图") @Schema(description = "主图")
private String mainImg; private List<String> mainImageUrls;
/** /**
* 详情图(多图,逗号分割) * 详情图
*/ */
@TableField(typeHandler = PgStringArrayToListTypeHandler.class) @TableField(typeHandler = PgStringArrayToListTypeHandler.class)
@Schema(description = "详情图") @Schema(description = "详情图")
private List<String> detailImg; private List<String> detailImageUrls;
/** /**
* 顶图(多图,逗号分割) * 缩略图
*/ */
@TableField(typeHandler = PgStringArrayToListTypeHandler.class) @Schema(description = "缩略图")
@Schema(description = "详情页顶图") private String thumbImageUrl;
private List<String> topImg;
/** /**
* 规格详情 * 规格详情,JSONB数组 [{"attr":"颜色","value":"红"}]
*/ */
@TableField(typeHandler = PgStringArrayToListTypeHandler.class)
@Schema(description = "规格详情") @Schema(description = "规格详情")
private List<String> attribute; private List<Map<String, Object>> specs;
/** /**
* 单位 * 单位
*/ */
@Schema(description = "单位") @Schema(description = "单位")
private String unit; private String unit;
/** /**
* cate_id分类 * 分类
*/ */
@Schema(description = "cate_id分类") @Schema(description = "分类")
private Long categoryId; private Long categoryId;
/** /**
* cate_id分类 * 分类路径
*/ */
@TableField(typeHandler = PgBigIntArrayToListTypeHandler.class) @TableField(typeHandler = PgLongArrayToListTypeHandler.class)
@Schema(description = "cate_id分类") @Schema(description = "分类路径ID数组,如 [1,5,23]")
private List<Long> categoryIds; private List<Long> categoryPath;
/**
* 成本价
*/
@Schema(description = "成本价")
private BigDecimal costPrice;
/** /**
* 原价 * 原价
*/ */
@@ -116,11 +111,6 @@ public class MallProductEntity extends BaseEntity {
*/ */
@Schema(description = "销售价") @Schema(description = "销售价")
private BigDecimal retailPrice; private BigDecimal retailPrice;
/**
* 利润
*/
@Schema(description = "利润")
private BigDecimal profit;
/** /**
* 销量 * 销量
*/ */
@@ -130,11 +120,10 @@ public class MallProductEntity extends BaseEntity {
* 库存 * 库存
*/ */
@Schema(description = "库存") @Schema(description = "库存")
private Integer spuQty; private Integer stock;
/** /**
* 标签(多标签,逗号分割 ) * 标签列表,JSONB数组格式,如 ["热销","包邮"]
*/ */
@TableField(typeHandler = PgStringArrayToListTypeHandler.class)
@Schema(description = "标签") @Schema(description = "标签")
private List<String> tags; private List<String> tags;

View File

@@ -25,13 +25,10 @@
*/ */
package org.springblade.modules.mall.service; package org.springblade.modules.mall.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.modules.mall.pojo.entity.MallCategoryEntity; import org.springblade.modules.mall.pojo.entity.MallCategoryEntity;
import org.springblade.modules.mall.pojo.vo.MallCategoryVO; import org.springblade.modules.mall.pojo.vo.MallCategoryVO;
import org.springblade.modules.mall.excel.MallCategoryExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.List;
/** /**
* 商品分类 服务类 * 商品分类 服务类
@@ -49,14 +46,4 @@ public interface IMallCategoryService extends BaseService<MallCategoryEntity> {
*/ */
IPage<MallCategoryVO> selectMallCategoryPage(IPage<MallCategoryVO> page, MallCategoryVO mallCategory); IPage<MallCategoryVO> selectMallCategoryPage(IPage<MallCategoryVO> page, MallCategoryVO mallCategory);
/**
* 导出数据
*
* @param queryWrapper 查询条件
* @return List<MallCategoryExcel>
*/
List<MallCategoryExcel> exportMallCategory(Wrapper<MallCategoryEntity> queryWrapper);
List<MallCategoryEntity> selectParent();
} }

View File

@@ -1,37 +1,9 @@
/**
* 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.mall.service; package org.springblade.modules.mall.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.modules.mall.pojo.entity.MallProductEntity; import org.springblade.modules.mall.pojo.entity.MallProductEntity;
import org.springblade.modules.mall.pojo.vo.MallProductVO; import org.springblade.modules.mall.pojo.vo.MallProductVO;
import org.springblade.modules.mall.excel.MallProductExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.List;
/** /**
* 商城商品 服务类 * 商城商品 服务类
@@ -50,12 +22,4 @@ public interface IMallProductService extends BaseService<MallProductEntity> {
IPage<MallProductVO> selectMallProductPage(IPage<MallProductVO> page, MallProductVO mallProduct); IPage<MallProductVO> selectMallProductPage(IPage<MallProductVO> page, MallProductVO mallProduct);
/**
* 导出数据
*
* @param queryWrapper 查询条件
* @return List<MallProductExcel>
*/
List<MallProductExcel> exportMallProduct(Wrapper<MallProductEntity> queryWrapper);
} }

View File

@@ -1,41 +1,13 @@
/**
* 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.mall.service.impl; package org.springblade.modules.mall.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.modules.mall.pojo.entity.MallCategoryEntity; import org.springblade.modules.mall.pojo.entity.MallCategoryEntity;
import org.springblade.modules.mall.pojo.vo.MallCategoryVO; import org.springblade.modules.mall.pojo.vo.MallCategoryVO;
import org.springblade.modules.mall.excel.MallCategoryExcel;
import org.springblade.modules.mall.mapper.MallCategoryMapper; import org.springblade.modules.mall.mapper.MallCategoryMapper;
import org.springblade.modules.mall.service.IMallCategoryService; import org.springblade.modules.mall.service.IMallCategoryService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import java.util.List;
/** /**
* 商品分类 服务实现类 * 商品分类 服务实现类
@@ -51,24 +23,14 @@ public class MallCategoryServiceImpl extends BaseServiceImpl<MallCategoryMapper,
return page.setRecords(baseMapper.selectMallCategoryPage(page, mallCategory)); return page.setRecords(baseMapper.selectMallCategoryPage(page, mallCategory));
} }
// @Override
@Override // public List<MallCategoryEntity> selectParent() {
public List<MallCategoryExcel> exportMallCategory(Wrapper<MallCategoryEntity> queryWrapper) { //
List<MallCategoryExcel> mallCategoryList = baseMapper.exportMallCategory(queryWrapper); // return list(
//mallCategoryList.forEach(mallCategory -> { // Wrappers.lambdaQuery(MallCategoryEntity.class)
// mallCategory.setTypeName(DictCache.getValue(DictEnum.YES_NO, MallCategory.getType())); // .eq(MallCategoryEntity::getLevel, 1)
//}); // .orderByDesc(MallCategoryEntity::getId)
return mallCategoryList; // );
} // }
@Override
public List<MallCategoryEntity> selectParent() {
return list(
Wrappers.lambdaQuery(MallCategoryEntity.class)
.eq(MallCategoryEntity::getLevel, 1)
.orderByDesc(MallCategoryEntity::getId)
);
}
} }

View File

@@ -27,14 +27,11 @@ package org.springblade.modules.mall.service.impl;
import org.springblade.modules.mall.pojo.entity.MallProductEntity; import org.springblade.modules.mall.pojo.entity.MallProductEntity;
import org.springblade.modules.mall.pojo.vo.MallProductVO; import org.springblade.modules.mall.pojo.vo.MallProductVO;
import org.springblade.modules.mall.excel.MallProductExcel;
import org.springblade.modules.mall.mapper.MallProductMapper; import org.springblade.modules.mall.mapper.MallProductMapper;
import org.springblade.modules.mall.service.IMallProductService; import org.springblade.modules.mall.service.IMallProductService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import java.util.List;
/** /**
* 商城商品 服务实现类 * 商城商品 服务实现类
@@ -50,14 +47,4 @@ public class MallProductServiceImpl extends BaseServiceImpl<MallProductMapper, M
return page.setRecords(baseMapper.selectMallProductPage(page, mallProduct)); return page.setRecords(baseMapper.selectMallProductPage(page, mallProduct));
} }
@Override
public List<MallProductExcel> exportMallProduct(Wrapper<MallProductEntity> queryWrapper) {
List<MallProductExcel> mallProductList = baseMapper.exportMallProduct(queryWrapper);
//mallProductList.forEach(mallProduct -> {
// mallProduct.setTypeName(DictCache.getValue(DictEnum.YES_NO, MallProduct.getType()));
//});
return mallProductList;
}
} }