yangyb преди 1 месец
родител
ревизия
886c9d8054

+ 942 - 0
mall-api/src/main/java/com/txz/mall/dto/StoreProductDTO.java

@@ -0,0 +1,942 @@
+/*
+ *
+ * StoreProductDTO.java
+ * Copyright(C) 2017-2020 fendo公司
+ * @date 2025-07-10
+ */
+package com.txz.mall.dto;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class StoreProductDTO implements Serializable {
+    /**
+     * m_store_product
+     */
+    private static final long serialVersionUID = 1L;
+    /**
+     * 商品id
+     */
+    private Long id;
+    /**
+     * 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     */
+    private Byte merId;
+    /**
+     * 商品图片
+     */
+    private String image;
+    /**
+     * 轮播图
+     */
+    private String sliderImage;
+    /**
+     * 商品名称
+     */
+    private String storeName;
+    /**
+     * 商品简介
+     */
+    private String storeInfo;
+    /**
+     * 关键字
+     */
+    private String keyword;
+    /**
+     * 分类id
+     */
+    private String cateId;
+    /**
+     * 商品价格
+     */
+    private BigDecimal price;
+    /**
+     * 会员价格
+     */
+    private BigDecimal vipPrice;
+    /**
+     * 市场价
+     */
+    private BigDecimal otPrice;
+    /**
+     * 邮费
+     */
+    private BigDecimal postage;
+    /**
+     * 单位名
+     */
+    private String unitName;
+    /**
+     * 排序
+     */
+    private Short sort;
+    /**
+     * 销量
+     */
+    private Integer sales;
+    /**
+     * 库存
+     */
+    private Integer stock;
+    /**
+     * 状态(0:未上架,1:上架)
+     */
+    private Boolean isShow;
+    /**
+     * 是否热卖
+     */
+    private Boolean isHot;
+    /**
+     * 是否优惠
+     */
+    private Boolean isBenefit;
+    /**
+     * 是否精品
+     */
+    private Boolean isBest;
+    /**
+     * 是否新品
+     */
+    private Boolean isNew;
+    /**
+     * 添加时间
+     */
+    private Integer addTime;
+    /**
+     * 是否包邮
+     */
+    private Byte isPostage;
+    /**
+     * 是否删除
+     */
+    private Byte isDelete;
+    /**
+     * 获得积分
+     */
+    private Integer giveIntegral;
+    /**
+     * 成本价
+     */
+    private BigDecimal cost;
+    /**
+     * 秒杀状态 0 未开启 1已开启
+     */
+    private Byte isSeckill;
+    /**
+     * 砍价状态 0未开启 1开启
+     */
+    private Byte isBargain;
+    /**
+     * 是否优品推荐
+     */
+    private Boolean isGood;
+    /**
+     * 是否单独分佣
+     */
+    private Boolean isSub;
+    /**
+     * 虚拟销量
+     */
+    private Integer ficti;
+    /**
+     * 浏览量
+     */
+    private Integer browse;
+    /**
+     * 主图视频链接
+     */
+    private String videoLink;
+    /**
+     * 运费模板ID
+     */
+    private Integer tempId;
+    /**
+     * 规格 0单 1多
+     */
+    private Boolean specType;
+    /**
+     * 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     */
+    private String activity;
+    /**
+     * 展示图
+     */
+    private String flatPattern;
+    /**
+     * 是否回收站
+     */
+    private Boolean isRecycle;
+    /**
+     * 创建人id
+     */
+    private Long createUserId;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 更新人id
+     */
+    private Long updateUserId;
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 商品id
+     *
+     * @return id 商品id
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 商品id
+     *
+     * @param id 商品id
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     *
+     * @return mer_id 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     */
+    public Byte getMerId() {
+        return merId;
+    }
+
+    /**
+     * 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     *
+     * @param merId 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     */
+    public void setMerId(Byte merId) {
+        this.merId = merId;
+    }
+
+    /**
+     * 商品图片
+     *
+     * @return image 商品图片
+     */
+    public String getImage() {
+        return image;
+    }
+
+    /**
+     * 商品图片
+     *
+     * @param image 商品图片
+     */
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    /**
+     * 轮播图
+     *
+     * @return slider_image 轮播图
+     */
+    public String getSliderImage() {
+        return sliderImage;
+    }
+
+    /**
+     * 轮播图
+     *
+     * @param sliderImage 轮播图
+     */
+    public void setSliderImage(String sliderImage) {
+        this.sliderImage = sliderImage;
+    }
+
+    /**
+     * 商品名称
+     *
+     * @return store_name 商品名称
+     */
+    public String getStoreName() {
+        return storeName;
+    }
+
+    /**
+     * 商品名称
+     *
+     * @param storeName 商品名称
+     */
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+
+    /**
+     * 商品简介
+     *
+     * @return store_info 商品简介
+     */
+    public String getStoreInfo() {
+        return storeInfo;
+    }
+
+    /**
+     * 商品简介
+     *
+     * @param storeInfo 商品简介
+     */
+    public void setStoreInfo(String storeInfo) {
+        this.storeInfo = storeInfo;
+    }
+
+    /**
+     * 关键字
+     *
+     * @return keyword 关键字
+     */
+    public String getKeyword() {
+        return keyword;
+    }
+
+    /**
+     * 关键字
+     *
+     * @param keyword 关键字
+     */
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+
+    /**
+     * 分类id
+     *
+     * @return cate_id 分类id
+     */
+    public String getCateId() {
+        return cateId;
+    }
+
+    /**
+     * 分类id
+     *
+     * @param cateId 分类id
+     */
+    public void setCateId(String cateId) {
+        this.cateId = cateId;
+    }
+
+    /**
+     * 商品价格
+     *
+     * @return price 商品价格
+     */
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    /**
+     * 商品价格
+     *
+     * @param price 商品价格
+     */
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    /**
+     * 会员价格
+     *
+     * @return vip_price 会员价格
+     */
+    public BigDecimal getVipPrice() {
+        return vipPrice;
+    }
+
+    /**
+     * 会员价格
+     *
+     * @param vipPrice 会员价格
+     */
+    public void setVipPrice(BigDecimal vipPrice) {
+        this.vipPrice = vipPrice;
+    }
+
+    /**
+     * 市场价
+     *
+     * @return ot_price 市场价
+     */
+    public BigDecimal getOtPrice() {
+        return otPrice;
+    }
+
+    /**
+     * 市场价
+     *
+     * @param otPrice 市场价
+     */
+    public void setOtPrice(BigDecimal otPrice) {
+        this.otPrice = otPrice;
+    }
+
+    /**
+     * 邮费
+     *
+     * @return postage 邮费
+     */
+    public BigDecimal getPostage() {
+        return postage;
+    }
+
+    /**
+     * 邮费
+     *
+     * @param postage 邮费
+     */
+    public void setPostage(BigDecimal postage) {
+        this.postage = postage;
+    }
+
+    /**
+     * 单位名
+     *
+     * @return unit_name 单位名
+     */
+    public String getUnitName() {
+        return unitName;
+    }
+
+    /**
+     * 单位名
+     *
+     * @param unitName 单位名
+     */
+    public void setUnitName(String unitName) {
+        this.unitName = unitName;
+    }
+
+    /**
+     * 排序
+     *
+     * @return sort 排序
+     */
+    public Short getSort() {
+        return sort;
+    }
+
+    /**
+     * 排序
+     *
+     * @param sort 排序
+     */
+    public void setSort(Short sort) {
+        this.sort = sort;
+    }
+
+    /**
+     * 销量
+     *
+     * @return sales 销量
+     */
+    public Integer getSales() {
+        return sales;
+    }
+
+    /**
+     * 销量
+     *
+     * @param sales 销量
+     */
+    public void setSales(Integer sales) {
+        this.sales = sales;
+    }
+
+    /**
+     * 库存
+     *
+     * @return stock 库存
+     */
+    public Integer getStock() {
+        return stock;
+    }
+
+    /**
+     * 库存
+     *
+     * @param stock 库存
+     */
+    public void setStock(Integer stock) {
+        this.stock = stock;
+    }
+
+    /**
+     * 状态(0:未上架,1:上架)
+     *
+     * @return is_show 状态(0:未上架,1:上架)
+     */
+    public Boolean getIsShow() {
+        return isShow;
+    }
+
+    /**
+     * 状态(0:未上架,1:上架)
+     *
+     * @param isShow 状态(0:未上架,1:上架)
+     */
+    public void setIsShow(Boolean isShow) {
+        this.isShow = isShow;
+    }
+
+    /**
+     * 是否热卖
+     *
+     * @return is_hot 是否热卖
+     */
+    public Boolean getIsHot() {
+        return isHot;
+    }
+
+    /**
+     * 是否热卖
+     *
+     * @param isHot 是否热卖
+     */
+    public void setIsHot(Boolean isHot) {
+        this.isHot = isHot;
+    }
+
+    /**
+     * 是否优惠
+     *
+     * @return is_benefit 是否优惠
+     */
+    public Boolean getIsBenefit() {
+        return isBenefit;
+    }
+
+    /**
+     * 是否优惠
+     *
+     * @param isBenefit 是否优惠
+     */
+    public void setIsBenefit(Boolean isBenefit) {
+        this.isBenefit = isBenefit;
+    }
+
+    /**
+     * 是否精品
+     *
+     * @return is_best 是否精品
+     */
+    public Boolean getIsBest() {
+        return isBest;
+    }
+
+    /**
+     * 是否精品
+     *
+     * @param isBest 是否精品
+     */
+    public void setIsBest(Boolean isBest) {
+        this.isBest = isBest;
+    }
+
+    /**
+     * 是否新品
+     *
+     * @return is_new 是否新品
+     */
+    public Boolean getIsNew() {
+        return isNew;
+    }
+
+    /**
+     * 是否新品
+     *
+     * @param isNew 是否新品
+     */
+    public void setIsNew(Boolean isNew) {
+        this.isNew = isNew;
+    }
+
+    /**
+     * 添加时间
+     *
+     * @return add_time 添加时间
+     */
+    public Integer getAddTime() {
+        return addTime;
+    }
+
+    /**
+     * 添加时间
+     *
+     * @param addTime 添加时间
+     */
+    public void setAddTime(Integer addTime) {
+        this.addTime = addTime;
+    }
+
+    /**
+     * 是否包邮
+     *
+     * @return is_postage 是否包邮
+     */
+    public Byte getIsPostage() {
+        return isPostage;
+    }
+
+    /**
+     * 是否包邮
+     *
+     * @param isPostage 是否包邮
+     */
+    public void setIsPostage(Byte isPostage) {
+        this.isPostage = isPostage;
+    }
+
+    /**
+     * 是否删除
+     *
+     * @return is_delete 是否删除
+     */
+    public Byte getIsDelete() {
+        return isDelete;
+    }
+
+    /**
+     * 是否删除
+     *
+     * @param isDelete 是否删除
+     */
+    public void setIsDelete(Byte isDelete) {
+        this.isDelete = isDelete;
+    }
+
+    /**
+     * 获得积分
+     *
+     * @return give_integral 获得积分
+     */
+    public Integer getGiveIntegral() {
+        return giveIntegral;
+    }
+
+    /**
+     * 获得积分
+     *
+     * @param giveIntegral 获得积分
+     */
+    public void setGiveIntegral(Integer giveIntegral) {
+        this.giveIntegral = giveIntegral;
+    }
+
+    /**
+     * 成本价
+     *
+     * @return cost 成本价
+     */
+    public BigDecimal getCost() {
+        return cost;
+    }
+
+    /**
+     * 成本价
+     *
+     * @param cost 成本价
+     */
+    public void setCost(BigDecimal cost) {
+        this.cost = cost;
+    }
+
+    /**
+     * 秒杀状态 0 未开启 1已开启
+     *
+     * @return is_seckill 秒杀状态 0 未开启 1已开启
+     */
+    public Byte getIsSeckill() {
+        return isSeckill;
+    }
+
+    /**
+     * 秒杀状态 0 未开启 1已开启
+     *
+     * @param isSeckill 秒杀状态 0 未开启 1已开启
+     */
+    public void setIsSeckill(Byte isSeckill) {
+        this.isSeckill = isSeckill;
+    }
+
+    /**
+     * 砍价状态 0未开启 1开启
+     *
+     * @return is_bargain 砍价状态 0未开启 1开启
+     */
+    public Byte getIsBargain() {
+        return isBargain;
+    }
+
+    /**
+     * 砍价状态 0未开启 1开启
+     *
+     * @param isBargain 砍价状态 0未开启 1开启
+     */
+    public void setIsBargain(Byte isBargain) {
+        this.isBargain = isBargain;
+    }
+
+    /**
+     * 是否优品推荐
+     *
+     * @return is_good 是否优品推荐
+     */
+    public Boolean getIsGood() {
+        return isGood;
+    }
+
+    /**
+     * 是否优品推荐
+     *
+     * @param isGood 是否优品推荐
+     */
+    public void setIsGood(Boolean isGood) {
+        this.isGood = isGood;
+    }
+
+    /**
+     * 是否单独分佣
+     *
+     * @return is_sub 是否单独分佣
+     */
+    public Boolean getIsSub() {
+        return isSub;
+    }
+
+    /**
+     * 是否单独分佣
+     *
+     * @param isSub 是否单独分佣
+     */
+    public void setIsSub(Boolean isSub) {
+        this.isSub = isSub;
+    }
+
+    /**
+     * 虚拟销量
+     *
+     * @return ficti 虚拟销量
+     */
+    public Integer getFicti() {
+        return ficti;
+    }
+
+    /**
+     * 虚拟销量
+     *
+     * @param ficti 虚拟销量
+     */
+    public void setFicti(Integer ficti) {
+        this.ficti = ficti;
+    }
+
+    /**
+     * 浏览量
+     *
+     * @return browse 浏览量
+     */
+    public Integer getBrowse() {
+        return browse;
+    }
+
+    /**
+     * 浏览量
+     *
+     * @param browse 浏览量
+     */
+    public void setBrowse(Integer browse) {
+        this.browse = browse;
+    }
+
+    /**
+     * 主图视频链接
+     *
+     * @return video_link 主图视频链接
+     */
+    public String getVideoLink() {
+        return videoLink;
+    }
+
+    /**
+     * 主图视频链接
+     *
+     * @param videoLink 主图视频链接
+     */
+    public void setVideoLink(String videoLink) {
+        this.videoLink = videoLink;
+    }
+
+    /**
+     * 运费模板ID
+     *
+     * @return temp_id 运费模板ID
+     */
+    public Integer getTempId() {
+        return tempId;
+    }
+
+    /**
+     * 运费模板ID
+     *
+     * @param tempId 运费模板ID
+     */
+    public void setTempId(Integer tempId) {
+        this.tempId = tempId;
+    }
+
+    /**
+     * 规格 0单 1多
+     *
+     * @return spec_type 规格 0单 1多
+     */
+    public Boolean getSpecType() {
+        return specType;
+    }
+
+    /**
+     * 规格 0单 1多
+     *
+     * @param specType 规格 0单 1多
+     */
+    public void setSpecType(Boolean specType) {
+        this.specType = specType;
+    }
+
+    /**
+     * 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     *
+     * @return activity 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     */
+    public String getActivity() {
+        return activity;
+    }
+
+    /**
+     * 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     *
+     * @param activity 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     */
+    public void setActivity(String activity) {
+        this.activity = activity;
+    }
+
+    /**
+     * 展示图
+     *
+     * @return flat_pattern 展示图
+     */
+    public String getFlatPattern() {
+        return flatPattern;
+    }
+
+    /**
+     * 展示图
+     *
+     * @param flatPattern 展示图
+     */
+    public void setFlatPattern(String flatPattern) {
+        this.flatPattern = flatPattern;
+    }
+
+    /**
+     * 是否回收站
+     *
+     * @return is_recycle 是否回收站
+     */
+    public Boolean getIsRecycle() {
+        return isRecycle;
+    }
+
+    /**
+     * 是否回收站
+     *
+     * @param isRecycle 是否回收站
+     */
+    public void setIsRecycle(Boolean isRecycle) {
+        this.isRecycle = isRecycle;
+    }
+
+    /**
+     * 创建人id
+     *
+     * @return create_user_id 创建人id
+     */
+    public Long getCreateUserId() {
+        return createUserId;
+    }
+
+    /**
+     * 创建人id
+     *
+     * @param createUserId 创建人id
+     */
+    public void setCreateUserId(Long createUserId) {
+        this.createUserId = createUserId;
+    }
+
+    /**
+     * 创建时间
+     *
+     * @return create_time 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 创建时间
+     *
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 更新人id
+     *
+     * @return update_user_id 更新人id
+     */
+    public Long getUpdateUserId() {
+        return updateUserId;
+    }
+
+    /**
+     * 更新人id
+     *
+     * @param updateUserId 更新人id
+     */
+    public void setUpdateUserId(Long updateUserId) {
+        this.updateUserId = updateUserId;
+    }
+
+    /**
+     * 更新时间
+     *
+     * @return update_time 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 更新时间
+     *
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 27 - 0
mall-interface/src/main/java/com/txz/mall/service/StoreProductServiceClient.java

@@ -0,0 +1,27 @@
+package com.txz.mall.service;
+
+
+import com.txz.mall.dto.*;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+
+
+@FeignClient("mall")
+public interface StoreProductServiceClient {
+
+	@RequestMapping( value = {"/store/product/add"}, method = {RequestMethod.POST} )
+    public Result add(@RequestBody StoreProductDPO storeProduct,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/store/product/delete"}, method = {RequestMethod.POST} )
+	public Result delete(@RequestParam("id") Integer id,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/store/product/update"}, method = {RequestMethod.POST} )
+	public Result update(@RequestBody StoreProductDPO storeProduct,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/store/product/detail"}, method = {RequestMethod.POST} )
+	public Result<StoreProductDPO> detail(@RequestParam("id") Integer id,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/store/product/list"}, method = {RequestMethod.POST} )
+	public Result<List<StoreProductDPO>> list(@RequestBody StoreProductDPO storeProduct, @RequestParam("page") Integer page, @RequestParam("size") Integer size,@RequestParam("userId") Long userId);
+}

+ 182 - 0
mall-service/src/main/java/com/txz/mall/controller/StoreProductController.java

@@ -0,0 +1,182 @@
+package com.txz.mall.controller;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.txz.mall.core.Result;
+import com.txz.mall.core.ResultCode;
+import com.txz.mall.model.StoreProduct;
+import com.txz.mall.service.StoreProductService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import tk.mybatis.mapper.entity.Condition;
+import tk.mybatis.mapper.entity.Example.Criteria;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by CodeGenerator on 2025/07/10.
+ */
+@Api(tags = "[后台]storeProduct管理")
+@RestController
+@RequestMapping("/store/product")
+public class StoreProductController {
+
+    private static Logger log = LoggerFactory.getLogger(StoreProductController.class);
+
+    @Resource
+    private StoreProductService storeProductService;
+
+    @PostMapping("/add")
+    @ApiOperation(value = "storeProduct新增", httpMethod = "POST")
+    public Result add(@RequestBody StoreProduct storeProduct, Long userId) {
+        if (storeProduct == null) {
+            return Result.fail(ResultCode.OBJECT_IS_NULL);
+        }
+        if (userId == null) {
+            return Result.fail(ResultCode.USERID_IS_NULL);
+        }
+        try {
+            storeProduct.setCreateTime(new Date());
+            storeProduct.setCreateUserId(userId);
+            storeProductService.save(storeProduct);
+        } catch (Exception e) {
+            log.error("新增对象操作异常e:{}", e);
+            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+        }
+        return Result.success();
+    }
+
+    @PostMapping("/delete")
+    @ApiOperation(value = "storeProduct删除", httpMethod = "POST")
+    public Result delete(@RequestParam Long id, Long userId) {
+        if (id == null) {
+            return Result.fail(ResultCode.ID_IS_NULL);
+        }
+        if (userId == null) {
+            return Result.fail(ResultCode.USERID_IS_NULL);
+        }
+        try {
+            StoreProduct storeProduct = new StoreProduct();
+            storeProduct.setIsDelete(1);
+            storeProductService.update(storeProduct);
+        } catch (Exception e) {
+            log.error("删除对象操作异常e:{}", e);
+            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+        }
+        return Result.success();
+    }
+
+    @PostMapping("/update")
+    @ApiOperation(value = "storeProduct更新", httpMethod = "POST")
+    public Result update(@RequestBody StoreProduct storeProduct, Long userId) {
+        if (storeProduct == null) {
+            return Result.fail(ResultCode.OBJECT_IS_NULL);
+        }
+        if (storeProduct.getId() == null) {
+            return Result.fail(ResultCode.ID_IS_NULL);
+        }
+        if (userId == null) {
+            return Result.fail(ResultCode.USERID_IS_NULL);
+        }
+        try {
+            storeProduct.setUpdateTime(new Date());
+            storeProduct.setUpdateUserId(userId);
+            storeProductService.update(storeProduct);
+        } catch (Exception e) {
+            log.error("更新对象操作异常e:{}", e);
+            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+        }
+        return Result.success();
+    }
+
+    @PostMapping("/updateShowStatus")
+    @ApiOperation(value = "storeProduct上下架", httpMethod = "POST")
+    public Result updateShowStatus(@RequestParam Long id, @RequestParam Boolean ShowStatus, Long userId) {
+        if (ShowStatus == null) {
+            return Result.fail(ResultCode.OBJECT_IS_NULL);
+        }
+        if (id == null) {
+            return Result.fail(ResultCode.ID_IS_NULL);
+        }
+        if (userId == null) {
+            return Result.fail(ResultCode.USERID_IS_NULL);
+        }
+        try {
+            StoreProduct storeProduct = new StoreProduct();
+            storeProduct.setUpdateTime(new Date());
+            storeProduct.setUpdateUserId(userId);
+            storeProduct.setIsShow(ShowStatus);
+            storeProductService.update(storeProduct);
+        } catch (Exception e) {
+            log.error("更新对象操作异常e:{}", e);
+            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+        }
+        return Result.success();
+    }
+
+    @PostMapping("/detail")
+    @ApiOperation(value = "storeProduct获取详情", httpMethod = "POST")
+    public Result<StoreProduct> detail(@RequestParam Long id, Long userId) {
+        if (id == null) {
+            return Result.fail(ResultCode.ID_IS_NULL);
+        }
+        if (userId == null) {
+            return Result.fail(ResultCode.USERID_IS_NULL);
+        }
+        StoreProduct storeProduct = null;
+        try {
+            storeProduct = storeProductService.findById(id);
+        } catch (Exception e) {
+            log.error("查询对象操作异常e:{}", e);
+            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+        }
+        return Result.success(storeProduct);
+    }
+
+    @PostMapping("/list")
+    @ApiOperation(value = "storeProduct获取列表", httpMethod = "POST")
+    public Result<List<StoreProduct>> list(@RequestBody StoreProduct storeProduct, @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, Long userId) {
+        if (userId == null) {
+            return Result.fail(ResultCode.USERID_IS_NULL);
+        }
+        PageHelper.startPage(page, size);
+
+        Condition condition = new Condition(storeProduct.getClass());
+        Criteria criteria = condition.createCriteria();
+        criteria.andEqualTo("is_delete", 1);
+        PageInfo pageInfo = null;
+        try {
+            List<StoreProduct> list = storeProductService.findByCondition(condition);
+            pageInfo = new PageInfo(list);
+        } catch (Exception e) {
+            log.error("查询对象操作异常e:{}", e);
+            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+        }
+        return Result.success(pageInfo);
+    }
+
+
+    @ApiOperation("storeProduct导入")
+    @PostMapping("/import")
+    public Result importFile(@JSONField(serialize = false) @RequestParam("file") MultipartFile file) {
+        storeProductService.importFile(file);
+        return Result.success();
+    }
+
+    @ApiOperation("storeProduct模版")
+    @PostMapping("/export")
+    public Result exportFile(HttpServletResponse response) {
+        storeProductService.exportFile(response);
+        return Result.success();
+    }
+
+
+}

+ 7 - 0
mall-service/src/main/java/com/txz/mall/dao/StoreProductMapper.java

@@ -0,0 +1,7 @@
+package com.txz.mall.dao;
+
+import com.txz.mall.core.Mapper;
+import com.txz.mall.model.StoreProduct;
+
+public interface StoreProductMapper extends Mapper<StoreProduct> {
+}

+ 1006 - 0
mall-service/src/main/java/com/txz/mall/model/StoreProduct.java

@@ -0,0 +1,1006 @@
+package com.txz.mall.model;
+
+import javax.persistence.*;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Table(name = "m_store_product")
+public class StoreProduct {
+    /**
+     * 商品id
+     */
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    /**
+     * 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     */
+    @Column(name = "mer_id")
+    private Integer merId;
+
+    /**
+     * 商品图片
+     */
+    private String image;
+
+    /**
+     * 轮播图
+     */
+    @Column(name = "slider_image")
+    private String sliderImage;
+
+    /**
+     * 商品名称
+     */
+    @Column(name = "store_name")
+    private String storeName;
+
+    /**
+     * 商品简介
+     */
+    @Column(name = "store_info")
+    private String storeInfo;
+
+    /**
+     * 关键字
+     */
+    private String keyword;
+
+    /**
+     * 分类id
+     */
+    @Column(name = "cate_id")
+    private String cateId;
+
+    /**
+     * 商品价格
+     */
+    private BigDecimal price;
+
+    /**
+     * 会员价格
+     */
+    @Column(name = "vip_price")
+    private BigDecimal vipPrice;
+
+    /**
+     * 市场价
+     */
+    @Column(name = "ot_price")
+    private BigDecimal otPrice;
+
+    /**
+     * 邮费
+     */
+    private BigDecimal postage;
+
+    /**
+     * 单位名
+     */
+    @Column(name = "unit_name")
+    private String unitName;
+
+    /**
+     * 排序
+     */
+    private Short sort;
+
+    /**
+     * 销量
+     */
+    private Integer sales;
+
+    /**
+     * 库存
+     */
+    private Integer stock;
+
+    /**
+     * 状态(0:未上架,1:上架)
+     */
+    @Column(name = "is_show")
+    private Boolean isShow;
+
+    /**
+     * 是否热卖
+     */
+    @Column(name = "is_hot")
+    private Boolean isHot;
+
+    /**
+     * 是否优惠
+     */
+    @Column(name = "is_benefit")
+    private Boolean isBenefit;
+
+    /**
+     * 是否精品
+     */
+    @Column(name = "is_best")
+    private Boolean isBest;
+
+    /**
+     * 是否新品
+     */
+    @Column(name = "is_new")
+    private Boolean isNew;
+
+    /**
+     * 添加时间
+     */
+    @Column(name = "add_time")
+    private Integer addTime;
+
+    /**
+     * 是否包邮
+     */
+    @Column(name = "is_postage")
+    private Integer isPostage;
+
+    /**
+     * 是否删除
+     */
+    @Column(name = "is_delete")
+    private Integer isDelete;
+
+    /**
+     * 获得积分
+     */
+    @Column(name = "give_integral")
+    private Integer giveIntegral;
+
+    /**
+     * 成本价
+     */
+    private BigDecimal cost;
+
+    /**
+     * 秒杀状态 0 未开启 1已开启
+     */
+    @Column(name = "is_seckill")
+    private Integer isSeckill;
+
+    /**
+     * 砍价状态 0未开启 1开启
+     */
+    @Column(name = "is_bargain")
+    private Integer isBargain;
+
+    /**
+     * 是否优品推荐
+     */
+    @Column(name = "is_good")
+    private Boolean isGood;
+
+    /**
+     * 是否单独分佣
+     */
+    @Column(name = "is_sub")
+    private Boolean isSub;
+
+    /**
+     * 虚拟销量
+     */
+    private Integer ficti;
+
+    /**
+     * 浏览量
+     */
+    private Integer browse;
+
+    /**
+     * 主图视频链接
+     */
+    @Column(name = "video_link")
+    private String videoLink;
+
+    /**
+     * 运费模板ID
+     */
+    @Column(name = "temp_id")
+    private Integer tempId;
+
+    /**
+     * 规格 0单 1多
+     */
+    @Column(name = "spec_type")
+    private Boolean specType;
+
+    /**
+     * 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     */
+    private String activity;
+
+    /**
+     * 展示图
+     */
+    @Column(name = "flat_pattern")
+    private String flatPattern;
+
+    /**
+     * 是否回收站
+     */
+    @Column(name = "is_recycle")
+    private Boolean isRecycle;
+
+    /**
+     * 创建人id
+     */
+    @Column(name = "create_user_id")
+    private Long createUserId;
+
+    /**
+     * 创建时间
+     */
+    @Column(name = "create_time")
+    private Date createTime;
+
+    /**
+     * 更新人id
+     */
+    @Column(name = "update_user_id")
+    private Long updateUserId;
+
+    /**
+     * 更新时间
+     */
+    @Column(name = "update_time")
+    private Date updateTime;
+
+    /**
+     * 获取商品id
+     *
+     * @return id - 商品id
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 设置商品id
+     *
+     * @param id 商品id
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     *
+     * @return mer_id - 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     */
+    public Integer getMerId() {
+        return merId;
+    }
+
+    /**
+     * 设置商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     *
+     * @param merId 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
+     */
+    public void setMerId(Integer merId) {
+        this.merId = merId;
+    }
+
+    /**
+     * 获取商品图片
+     *
+     * @return image - 商品图片
+     */
+    public String getImage() {
+        return image;
+    }
+
+    /**
+     * 设置商品图片
+     *
+     * @param image 商品图片
+     */
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    /**
+     * 获取轮播图
+     *
+     * @return slider_image - 轮播图
+     */
+    public String getSliderImage() {
+        return sliderImage;
+    }
+
+    /**
+     * 设置轮播图
+     *
+     * @param sliderImage 轮播图
+     */
+    public void setSliderImage(String sliderImage) {
+        this.sliderImage = sliderImage;
+    }
+
+    /**
+     * 获取商品名称
+     *
+     * @return store_name - 商品名称
+     */
+    public String getStoreName() {
+        return storeName;
+    }
+
+    /**
+     * 设置商品名称
+     *
+     * @param storeName 商品名称
+     */
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+
+    /**
+     * 获取商品简介
+     *
+     * @return store_info - 商品简介
+     */
+    public String getStoreInfo() {
+        return storeInfo;
+    }
+
+    /**
+     * 设置商品简介
+     *
+     * @param storeInfo 商品简介
+     */
+    public void setStoreInfo(String storeInfo) {
+        this.storeInfo = storeInfo;
+    }
+
+    /**
+     * 获取关键字
+     *
+     * @return keyword - 关键字
+     */
+    public String getKeyword() {
+        return keyword;
+    }
+
+    /**
+     * 设置关键字
+     *
+     * @param keyword 关键字
+     */
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+
+    /**
+     * 获取分类id
+     *
+     * @return cate_id - 分类id
+     */
+    public String getCateId() {
+        return cateId;
+    }
+
+    /**
+     * 设置分类id
+     *
+     * @param cateId 分类id
+     */
+    public void setCateId(String cateId) {
+        this.cateId = cateId;
+    }
+
+    /**
+     * 获取商品价格
+     *
+     * @return price - 商品价格
+     */
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    /**
+     * 设置商品价格
+     *
+     * @param price 商品价格
+     */
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    /**
+     * 获取会员价格
+     *
+     * @return vip_price - 会员价格
+     */
+    public BigDecimal getVipPrice() {
+        return vipPrice;
+    }
+
+    /**
+     * 设置会员价格
+     *
+     * @param vipPrice 会员价格
+     */
+    public void setVipPrice(BigDecimal vipPrice) {
+        this.vipPrice = vipPrice;
+    }
+
+    /**
+     * 获取市场价
+     *
+     * @return ot_price - 市场价
+     */
+    public BigDecimal getOtPrice() {
+        return otPrice;
+    }
+
+    /**
+     * 设置市场价
+     *
+     * @param otPrice 市场价
+     */
+    public void setOtPrice(BigDecimal otPrice) {
+        this.otPrice = otPrice;
+    }
+
+    /**
+     * 获取邮费
+     *
+     * @return postage - 邮费
+     */
+    public BigDecimal getPostage() {
+        return postage;
+    }
+
+    /**
+     * 设置邮费
+     *
+     * @param postage 邮费
+     */
+    public void setPostage(BigDecimal postage) {
+        this.postage = postage;
+    }
+
+    /**
+     * 获取单位名
+     *
+     * @return unit_name - 单位名
+     */
+    public String getUnitName() {
+        return unitName;
+    }
+
+    /**
+     * 设置单位名
+     *
+     * @param unitName 单位名
+     */
+    public void setUnitName(String unitName) {
+        this.unitName = unitName;
+    }
+
+    /**
+     * 获取排序
+     *
+     * @return sort - 排序
+     */
+    public Short getSort() {
+        return sort;
+    }
+
+    /**
+     * 设置排序
+     *
+     * @param sort 排序
+     */
+    public void setSort(Short sort) {
+        this.sort = sort;
+    }
+
+    /**
+     * 获取销量
+     *
+     * @return sales - 销量
+     */
+    public Integer getSales() {
+        return sales;
+    }
+
+    /**
+     * 设置销量
+     *
+     * @param sales 销量
+     */
+    public void setSales(Integer sales) {
+        this.sales = sales;
+    }
+
+    /**
+     * 获取库存
+     *
+     * @return stock - 库存
+     */
+    public Integer getStock() {
+        return stock;
+    }
+
+    /**
+     * 设置库存
+     *
+     * @param stock 库存
+     */
+    public void setStock(Integer stock) {
+        this.stock = stock;
+    }
+
+    /**
+     * 获取状态(0:未上架,1:上架)
+     *
+     * @return is_show - 状态(0:未上架,1:上架)
+     */
+    public Boolean getIsShow() {
+        return isShow;
+    }
+
+    /**
+     * 设置状态(0:未上架,1:上架)
+     *
+     * @param isShow 状态(0:未上架,1:上架)
+     */
+    public void setIsShow(Boolean isShow) {
+        this.isShow = isShow;
+    }
+
+    /**
+     * 获取是否热卖
+     *
+     * @return is_hot - 是否热卖
+     */
+    public Boolean getIsHot() {
+        return isHot;
+    }
+
+    /**
+     * 设置是否热卖
+     *
+     * @param isHot 是否热卖
+     */
+    public void setIsHot(Boolean isHot) {
+        this.isHot = isHot;
+    }
+
+    /**
+     * 获取是否优惠
+     *
+     * @return is_benefit - 是否优惠
+     */
+    public Boolean getIsBenefit() {
+        return isBenefit;
+    }
+
+    /**
+     * 设置是否优惠
+     *
+     * @param isBenefit 是否优惠
+     */
+    public void setIsBenefit(Boolean isBenefit) {
+        this.isBenefit = isBenefit;
+    }
+
+    /**
+     * 获取是否精品
+     *
+     * @return is_best - 是否精品
+     */
+    public Boolean getIsBest() {
+        return isBest;
+    }
+
+    /**
+     * 设置是否精品
+     *
+     * @param isBest 是否精品
+     */
+    public void setIsBest(Boolean isBest) {
+        this.isBest = isBest;
+    }
+
+    /**
+     * 获取是否新品
+     *
+     * @return is_new - 是否新品
+     */
+    public Boolean getIsNew() {
+        return isNew;
+    }
+
+    /**
+     * 设置是否新品
+     *
+     * @param isNew 是否新品
+     */
+    public void setIsNew(Boolean isNew) {
+        this.isNew = isNew;
+    }
+
+    /**
+     * 获取添加时间
+     *
+     * @return add_time - 添加时间
+     */
+    public Integer getAddTime() {
+        return addTime;
+    }
+
+    /**
+     * 设置添加时间
+     *
+     * @param addTime 添加时间
+     */
+    public void setAddTime(Integer addTime) {
+        this.addTime = addTime;
+    }
+
+    /**
+     * 获取是否包邮
+     *
+     * @return is_postage - 是否包邮
+     */
+    public Integer getIsPostage() {
+        return isPostage;
+    }
+
+    /**
+     * 设置是否包邮
+     *
+     * @param isPostage 是否包邮
+     */
+    public void setIsPostage(Integer isPostage) {
+        this.isPostage = isPostage;
+    }
+
+    /**
+     * 获取是否删除
+     *
+     * @return is_delete - 是否删除
+     */
+    public Integer getIsDelete() {
+        return isDelete;
+    }
+
+    /**
+     * 设置是否删除
+     *
+     * @param isDelete 是否删除
+     */
+    public void setIsDelete(Integer isDelete) {
+        this.isDelete = isDelete;
+    }
+
+    /**
+     * 获取获得积分
+     *
+     * @return give_integral - 获得积分
+     */
+    public Integer getGiveIntegral() {
+        return giveIntegral;
+    }
+
+    /**
+     * 设置获得积分
+     *
+     * @param giveIntegral 获得积分
+     */
+    public void setGiveIntegral(Integer giveIntegral) {
+        this.giveIntegral = giveIntegral;
+    }
+
+    /**
+     * 获取成本价
+     *
+     * @return cost - 成本价
+     */
+    public BigDecimal getCost() {
+        return cost;
+    }
+
+    /**
+     * 设置成本价
+     *
+     * @param cost 成本价
+     */
+    public void setCost(BigDecimal cost) {
+        this.cost = cost;
+    }
+
+    /**
+     * 获取秒杀状态 0 未开启 1已开启
+     *
+     * @return is_seckill - 秒杀状态 0 未开启 1已开启
+     */
+    public Integer getIsSeckill() {
+        return isSeckill;
+    }
+
+    /**
+     * 设置秒杀状态 0 未开启 1已开启
+     *
+     * @param isSeckill 秒杀状态 0 未开启 1已开启
+     */
+    public void setIsSeckill(Integer isSeckill) {
+        this.isSeckill = isSeckill;
+    }
+
+    /**
+     * 获取砍价状态 0未开启 1开启
+     *
+     * @return is_bargain - 砍价状态 0未开启 1开启
+     */
+    public Integer getIsBargain() {
+        return isBargain;
+    }
+
+    /**
+     * 设置砍价状态 0未开启 1开启
+     *
+     * @param isBargain 砍价状态 0未开启 1开启
+     */
+    public void setIsBargain(Integer isBargain) {
+        this.isBargain = isBargain;
+    }
+
+    /**
+     * 获取是否优品推荐
+     *
+     * @return is_good - 是否优品推荐
+     */
+    public Boolean getIsGood() {
+        return isGood;
+    }
+
+    /**
+     * 设置是否优品推荐
+     *
+     * @param isGood 是否优品推荐
+     */
+    public void setIsGood(Boolean isGood) {
+        this.isGood = isGood;
+    }
+
+    /**
+     * 获取是否单独分佣
+     *
+     * @return is_sub - 是否单独分佣
+     */
+    public Boolean getIsSub() {
+        return isSub;
+    }
+
+    /**
+     * 设置是否单独分佣
+     *
+     * @param isSub 是否单独分佣
+     */
+    public void setIsSub(Boolean isSub) {
+        this.isSub = isSub;
+    }
+
+    /**
+     * 获取虚拟销量
+     *
+     * @return ficti - 虚拟销量
+     */
+    public Integer getFicti() {
+        return ficti;
+    }
+
+    /**
+     * 设置虚拟销量
+     *
+     * @param ficti 虚拟销量
+     */
+    public void setFicti(Integer ficti) {
+        this.ficti = ficti;
+    }
+
+    /**
+     * 获取浏览量
+     *
+     * @return browse - 浏览量
+     */
+    public Integer getBrowse() {
+        return browse;
+    }
+
+    /**
+     * 设置浏览量
+     *
+     * @param browse 浏览量
+     */
+    public void setBrowse(Integer browse) {
+        this.browse = browse;
+    }
+
+    /**
+     * 获取主图视频链接
+     *
+     * @return video_link - 主图视频链接
+     */
+    public String getVideoLink() {
+        return videoLink;
+    }
+
+    /**
+     * 设置主图视频链接
+     *
+     * @param videoLink 主图视频链接
+     */
+    public void setVideoLink(String videoLink) {
+        this.videoLink = videoLink;
+    }
+
+    /**
+     * 获取运费模板ID
+     *
+     * @return temp_id - 运费模板ID
+     */
+    public Integer getTempId() {
+        return tempId;
+    }
+
+    /**
+     * 设置运费模板ID
+     *
+     * @param tempId 运费模板ID
+     */
+    public void setTempId(Integer tempId) {
+        this.tempId = tempId;
+    }
+
+    /**
+     * 获取规格 0单 1多
+     *
+     * @return spec_type - 规格 0单 1多
+     */
+    public Boolean getSpecType() {
+        return specType;
+    }
+
+    /**
+     * 设置规格 0单 1多
+     *
+     * @param specType 规格 0单 1多
+     */
+    public void setSpecType(Boolean specType) {
+        this.specType = specType;
+    }
+
+    /**
+     * 获取活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     *
+     * @return activity - 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     */
+    public String getActivity() {
+        return activity;
+    }
+
+    /**
+     * 设置活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     *
+     * @param activity 活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团
+     */
+    public void setActivity(String activity) {
+        this.activity = activity;
+    }
+
+    /**
+     * 获取展示图
+     *
+     * @return flat_pattern - 展示图
+     */
+    public String getFlatPattern() {
+        return flatPattern;
+    }
+
+    /**
+     * 设置展示图
+     *
+     * @param flatPattern 展示图
+     */
+    public void setFlatPattern(String flatPattern) {
+        this.flatPattern = flatPattern;
+    }
+
+    /**
+     * 获取是否回收站
+     *
+     * @return is_recycle - 是否回收站
+     */
+    public Boolean getIsRecycle() {
+        return isRecycle;
+    }
+
+    /**
+     * 设置是否回收站
+     *
+     * @param isRecycle 是否回收站
+     */
+    public void setIsRecycle(Boolean isRecycle) {
+        this.isRecycle = isRecycle;
+    }
+
+    /**
+     * 获取创建人id
+     *
+     * @return create_user_id - 创建人id
+     */
+    public Long getCreateUserId() {
+        return createUserId;
+    }
+
+    /**
+     * 设置创建人id
+     *
+     * @param createUserId 创建人id
+     */
+    public void setCreateUserId(Long createUserId) {
+        this.createUserId = createUserId;
+    }
+
+    /**
+     * 获取创建时间
+     *
+     * @return create_time - 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 设置创建时间
+     *
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取更新人id
+     *
+     * @return update_user_id - 更新人id
+     */
+    public Long getUpdateUserId() {
+        return updateUserId;
+    }
+
+    /**
+     * 设置更新人id
+     *
+     * @param updateUserId 更新人id
+     */
+    public void setUpdateUserId(Long updateUserId) {
+        this.updateUserId = updateUserId;
+    }
+
+    /**
+     * 获取更新时间
+     *
+     * @return update_time - 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 设置更新时间
+     *
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 28 - 0
mall-service/src/main/java/com/txz/mall/service/StoreProductService.java

@@ -0,0 +1,28 @@
+package com.txz.mall.service;
+
+import com.txz.mall.core.Service;
+import com.txz.mall.model.StoreProduct;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * Created by CodeGenerator on 2025/07/10.
+ */
+public interface StoreProductService extends Service<StoreProduct> {
+
+    /**
+     * 导入商品列表
+     *
+     * @param file 流
+     */
+    void importFile(MultipartFile file);
+
+    /**
+     * 导出商品模版
+     *
+     * @param response 响应
+     */
+    void exportFile(HttpServletResponse response);
+}

+ 68 - 0
mall-service/src/main/java/com/txz/mall/service/impl/StoreProductServiceImpl.java

@@ -0,0 +1,68 @@
+package com.txz.mall.service.impl;
+
+import cn.hutool.core.io.FileUtil;
+import com.txz.mall.core.AbstractService;
+import com.txz.mall.core.ServiceException;
+import com.txz.mall.dao.StoreProductMapper;
+import com.txz.mall.model.StoreProduct;
+import com.txz.mall.service.StoreProductService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Created by CodeGenerator on 2025/07/10.
+ */
+@Service
+@Transactional
+@Slf4j
+public class StoreProductServiceImpl extends AbstractService<StoreProduct> implements StoreProductService {
+    @Resource
+    private StoreProductMapper storeProductMapper;
+
+    @Override
+    public void importFile(MultipartFile file) {
+        String name = file.getOriginalFilename();
+        String suffix = FileUtil.extName(name);
+        log.info("获取到的文件名为----->{},后缀为----->{},入参------->{}", name, suffix);
+        if ("xlsx".equals(suffix) || "xls".equals(suffix)) {
+            throw new ServiceException("请传入xlsx或xls文档格式文件");
+        }
+        try {
+//            List<StoreProduct> list = EasyExcelUtil.syncReadModel(file.getInputStream(), StoreProduct.class, 0, 1);
+//            if (CollectionUtils.isEmpty(list)) {
+//                throw new ServiceException("请填写内容后再提交!");
+//            }
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void exportFile(HttpServletResponse response) {
+        OutputStream outputStream = null;
+        try {
+            outputStream = response.getOutputStream();
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            String fileName = URLEncoder.encode("商品导出模板", "UTF-8").replaceAll("\\+", "%20");
+            response.setHeader(
+                    "Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+            List<StoreProduct> list = new ArrayList<>();
+//            EasyExcel.write(outputStream, StoreProduct.class).sheet("商品导出模板").doWrite(list);
+        } catch (Exception e) {
+            log.error("模板下载失败", e);
+            throw new ServiceException("模板下载失败, 请联系管理员");
+        }
+    }
+}

+ 475 - 0
mall-service/src/main/java/com/txz/mall/util/EasyExcelUtil.java

@@ -0,0 +1,475 @@
+//package com.txz.mall.util;
+//
+//import com.alibaba.excel.EasyExcel;
+//import com.alibaba.excel.EasyExcelFactory;
+//import com.alibaba.excel.context.AnalysisContext;
+//import com.alibaba.excel.event.AnalysisEventListener;
+//import com.alibaba.excel.exception.ExcelDataConvertException;
+//import com.alibaba.excel.write.handler.WriteHandler;
+//import com.alibaba.fastjson.JSON;
+//import com.txz.mall.util.factory.EasyExcelWriterFactory;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.poi.ss.formula.functions.T;
+//
+//import javax.servlet.http.HttpServletResponse;
+//import java.io.File;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.io.OutputStream;
+//import java.net.URLEncoder;
+//import java.util.ArrayList;
+//import java.util.List;
+//import java.util.Map;
+//import java.util.Set;
+//
+//;
+//
+///**
+// * @author: admin
+// * @date: 2022/10/28
+// * @time: 17:07
+// * @description: EasyExcel工具类
+// */
+//@Slf4j
+//public class EasyExcelUtil {
+//
+//    /**
+//     * 同步无模型读(默认读取sheet0,从第2行开始读)
+//     * @param filePath
+//     * @return
+//     */
+//    public static List<Map<Integer, String>> syncRead(String filePath) {
+//        return EasyExcelFactory.read(filePath).sheet().doReadSync();
+//    }
+//
+//    /**
+//     * 同步无模型读(默认表头占一行,从第2行开始读)
+//     *
+//     * @param filePath
+//     * @param sheetNo  sheet页号,从0开始
+//     * @return
+//     */
+//    public static List<Map<Integer, String>> syncRead(String filePath, Integer sheetNo) {
+//        return EasyExcelFactory.read(filePath).sheet(sheetNo).doReadSync();
+//    }
+//
+//    /**
+//     * 同步无模型读(指定sheet和表头占的行数)
+//     * @param inputStream
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return List<Map < colNum, cellValue>>
+//     */
+//    public static List<Map<Integer, String>> syncRead(InputStream inputStream, Integer sheetNo, Integer headRowNum) {
+//        return EasyExcelFactory.read(inputStream).sheet(sheetNo).headRowNumber(headRowNum).doReadSync();
+//    }
+//
+//    /**
+//     * 同步无模型读(指定sheet和表头占的行数)
+//     * @param file
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return List<Map < colNum, cellValue>>
+//     */
+//    public static List<Map<Integer, String>> syncRead(File file, Integer sheetNo, Integer headRowNum) {
+//        return EasyExcelFactory.read(file).sheet(sheetNo).headRowNumber(headRowNum).doReadSync();
+//    }
+//
+//    /**
+//     * 同步无模型读(指定sheet和表头占的行数)
+//     * @param filePath
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return List<Map < colNum, cellValue>>
+//     */
+//    public static List<Map<Integer, String>> syncRead(String filePath, Integer sheetNo, Integer headRowNum) {
+//        return EasyExcelFactory.read(filePath).sheet(sheetNo).headRowNumber(headRowNum).doReadSync();
+//    }
+//
+//    /**
+//     * 同步按模型读(默认读取sheet0,从第2行开始读)
+//     * @param filePath
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @return
+//     */
+//    public static List<T> syncReadModel(String filePath, Class clazz) {
+//        return EasyExcelFactory.read(filePath).sheet().head(clazz).doReadSync();
+//    }
+//
+//    /**
+//     * 同步按模型读(默认表头占一行,从第2行开始读)
+//     * @param filePath
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo sheet页号,从0开始
+//     * @return
+//     */
+//    public static List<T> syncReadModel(String filePath, Class clazz, Integer sheetNo) {
+//        return EasyExcelFactory.read(filePath).sheet(sheetNo).head(clazz).doReadSync();
+//    }
+//
+//    /**
+//     * 同步按模型读(指定sheet和表头占的行数)
+//     * @param inputStream
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return
+//     */
+//    public static <T> List<T> syncReadModel(InputStream inputStream, Class<T> clazz, Integer sheetNo, Integer headRowNum) {
+//        return EasyExcelFactory.read(inputStream).sheet(sheetNo).headRowNumber(headRowNum).head(clazz).doReadSync();
+//    }
+//
+//    /**
+//     * 同步按模型读(指定sheet和表头占的行数)
+//     * @param file
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return
+//     */
+//    public static <T> List<T> syncReadModel(File file, Class<T> clazz, Integer sheetNo, Integer headRowNum) {
+//        return EasyExcelFactory.read(file).sheet(sheetNo).headRowNumber(headRowNum).head(clazz).doReadSync();
+//    }
+//
+//    /**
+//     * 同步按模型读(指定sheet和表头占的行数)
+//     * @param filePath
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return
+//     */
+//    public static List<T> syncReadModel(String filePath, Class clazz, Integer sheetNo, Integer headRowNum) {
+//        return EasyExcelFactory.read(filePath).sheet(sheetNo).headRowNumber(headRowNum).head(clazz).doReadSync();
+//    }
+//
+//    /**
+//     * 异步无模型读(默认读取sheet0,从第2行开始读)
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param filePath 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return
+//     */
+//    public static void asyncRead(String filePath, AnalysisEventListener<T> excelListener) {
+//        EasyExcelFactory.read(filePath, excelListener).sheet().doRead();
+//    }
+//
+//    /**
+//     * 异步无模型读(默认表头占一行,从第2行开始读)
+//     * @param filePath 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param sheetNo sheet页号,从0开始
+//     * @return
+//     */
+//    public static void asyncRead(String filePath, AnalysisEventListener<T> excelListener, Integer sheetNo) {
+//        EasyExcelFactory.read(filePath, excelListener).sheet(sheetNo).doRead();
+//    }
+//
+//    /**
+//     * 异步无模型读(指定sheet和表头占的行数)
+//     * @param inputStream
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return
+//     */
+//    public static void asyncRead(InputStream inputStream, AnalysisEventListener<T> excelListener, Integer sheetNo, Integer headRowNum) {
+//        EasyExcelFactory.read(inputStream, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();
+//    }
+//
+//    /**
+//     * 异步无模型读(指定sheet和表头占的行数)
+//     * @param file
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return
+//     */
+//    public static void asyncRead(File file, AnalysisEventListener<T> excelListener, Integer sheetNo, Integer headRowNum) {
+//        EasyExcelFactory.read(file, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();
+//    }
+//
+//    /**
+//     * 异步无模型读(指定sheet和表头占的行数)
+//     * @param filePath
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param sheetNo sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     * @return
+//     */
+//    public static void asyncRead(String filePath, AnalysisEventListener<T> excelListener, Integer sheetNo, Integer headRowNum) {
+//        EasyExcelFactory.read(filePath, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();
+//    }
+//
+//    /**
+//     * 异步按模型读取(默认读取sheet0,从第2行开始读)
+//     * @param filePath
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     */
+//    public static void asyncReadModel(String filePath, AnalysisEventListener<T> excelListener, Class clazz) {
+//        EasyExcelFactory.read(filePath, clazz, excelListener).sheet().doRead();
+//    }
+//
+//    /**
+//     * 异步按模型读取(默认表头占一行,从第2行开始读)
+//     * @param filePath
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo  sheet页号,从0开始
+//     */
+//    public static void asyncReadModel(String filePath, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo) {
+//        EasyExcelFactory.read(filePath, clazz, excelListener).sheet(sheetNo).doRead();
+//    }
+//
+//    /**
+//     * 异步按模型读取
+//     * @param inputStream
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo  sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     */
+//    public static void asyncReadModel(InputStream inputStream, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo, Integer headRowNum) {
+//        EasyExcelFactory.read(inputStream, clazz, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();
+//    }
+//
+//    /**
+//     * 异步按模型读取
+//     * @param file
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo  sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     */
+//    public static void asyncReadModel(File file, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo, Integer headRowNum) {
+//        EasyExcelFactory.read(file, clazz, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();
+//    }
+//
+//    /**
+//     * 异步按模型读取
+//     * @param filePath
+//     * @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等
+//     * @param clazz 模型的类类型(excel数据会按该类型转换成对象)
+//     * @param sheetNo  sheet页号,从0开始
+//     * @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)
+//     */
+//    public static void asyncReadModel(String filePath, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo, Integer headRowNum) {
+//        EasyExcelFactory.read(filePath, clazz, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();
+//    }
+//
+//    /**
+//     * 无模板写文件
+//     * @param filePath
+//     * @param head 表头数据
+//     * @param data 表内容数据
+//     */
+//    public static void write(String filePath, List<List<String>> head, List<List<Object>> data) {
+//        EasyExcel.write(filePath).head(head).sheet().doWrite(data);
+//    }
+//
+//    /**
+//     * 无模板写文件
+//     * @param filePath
+//     * @param head 表头数据
+//     * @param data 表内容数据
+//     * @param sheetNo sheet页号,从0开始
+//     * @param sheetName sheet名称
+//     */
+//    public static void write(String filePath, List<List<String>> head, List<List<Object>> data, Integer sheetNo, String sheetName) {
+//        EasyExcel.write(filePath).head(head).sheet(sheetNo, sheetName).doWrite(data);
+//    }
+//
+//    /**
+//     * 根据excel模板文件写入文件
+//     * @param filePath
+//     * @param templateFileName
+//     * @param headClazz
+//     * @param data
+//     */
+//    public static void writeTemplate(String filePath, String templateFileName, Class headClazz, List data) {
+//        EasyExcel.write(filePath, headClazz).withTemplate(templateFileName).sheet().doWrite(data);
+//    }
+//
+//    /**
+//     * 根据excel模板文件写入文件
+//     * @param filePath
+//     * @param templateFileName
+//     * @param data
+//     */
+//    public static void writeTemplate(String filePath, String templateFileName, List data) {
+//        EasyExcel.write(filePath).withTemplate(templateFileName).sheet().doWrite(data);
+//    }
+//
+//    /**
+//     * 按模板写文件
+//     * @param filePath
+//     * @param headClazz 表头模板
+//     * @param data 数据
+//     */
+//    public static void write(String filePath, Class headClazz, List data) {
+//        EasyExcel.write(filePath, headClazz).sheet().doWrite(data);
+//    }
+//
+//    /**
+//     * 按模板写文件
+//     * @param filePath
+//     * @param headClazz 表头模板
+//     * @param data 数据
+//     * @param sheetNo sheet页号,从0开始
+//     * @param sheetName sheet名称
+//     */
+//    public static void write(String filePath, Class headClazz, List data, Integer sheetNo, String sheetName) {
+//        EasyExcel.write(filePath, headClazz).sheet(sheetNo, sheetName).doWrite(data);
+//    }
+//
+//    /**
+//     * 按模板写文件
+//     * @param filePath
+//     * @param headClazz 表头模板
+//     * @param data 数据
+//     * @param writeHandler 自定义的处理器,比如设置table样式,设置超链接、单元格下拉框等等功能都可以通过这个实现(需要注册多个则自己通过链式去调用)
+//     * @param sheetNo sheet页号,从0开始
+//     * @param sheetName sheet名称
+//     */
+//    public static void write(String filePath, Class headClazz, List data, WriteHandler writeHandler, Integer sheetNo, String sheetName) {
+//        EasyExcel.write(filePath, headClazz).registerWriteHandler(writeHandler).sheet(sheetNo, sheetName).doWrite(data);
+//    }
+//
+//    /**
+//     * 按模板写文件(包含某些字段)
+//     * @param filePath
+//     * @param headClazz 表头模板
+//     * @param data 数据
+//     * @param includeCols 过滤包含的字段,根据字段名称过滤
+//     * @param sheetNo sheet页号,从0开始
+//     * @param sheetName sheet名称
+//     */
+//    public static void writeInclude(String filePath, Class headClazz, List data, Set<String> includeCols, Integer sheetNo, String sheetName) {
+//        EasyExcel.write(filePath, headClazz).includeColumnFiledNames(includeCols).sheet(sheetNo, sheetName).doWrite(data);
+//    }
+//
+//    /**
+//     * 按模板写文件(排除某些字段)
+//     * @param filePath
+//     * @param headClazz 表头模板
+//     * @param data 数据
+//     * @param excludeCols 过滤排除的字段,根据字段名称过滤
+//     * @param sheetNo sheet页号,从0开始
+//     * @param sheetName sheet名称
+//     */
+//    public static void writeExclude(String filePath, Class headClazz, List data, Set<String> excludeCols, Integer sheetNo, String sheetName) {
+//        EasyExcel.write(filePath, headClazz).excludeColumnFiledNames(excludeCols).sheet(sheetNo, sheetName).doWrite(data);
+//    }
+//
+//    /**
+//     * 多个sheet页的数据链式写入
+//     * ExcelUtil.writeWithSheets(outputStream)
+//     *                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")
+//     *                 .write(headData, data,"sheetName2")
+//     *                 .finish();
+//     * @param outputStream
+//     * @return
+//     */
+//    public static EasyExcelWriterFactory writeWithSheets(OutputStream outputStream) {
+//        EasyExcelWriterFactory excelWriter = new EasyExcelWriterFactory(outputStream);
+//        return excelWriter;
+//    }
+//
+//    /**
+//     * 多个sheet页的数据链式写入
+//     * ExcelUtil.writeWithSheets(file)
+//     *                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")
+//     *                 .write(headData, data,"sheetName2")
+//     *                 .finish();
+//     * @param file
+//     * @return
+//     */
+//    public static EasyExcelWriterFactory writeWithSheets(File file) {
+//        EasyExcelWriterFactory excelWriter = new EasyExcelWriterFactory(file);
+//        return excelWriter;
+//    }
+//
+//    /**
+//     * 多个sheet页的数据链式写入
+//     * ExcelUtil.writeWithSheets(filePath)
+//     *                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")
+//     *                 .write(headData, data,"sheetName2")
+//     *                 .finish();
+//     * @param filePath
+//     * @return
+//     */
+//    public static EasyExcelWriterFactory writeWithSheets(String filePath) {
+//        EasyExcelWriterFactory excelWriter = new EasyExcelWriterFactory(filePath);
+//        return excelWriter;
+//    }
+//
+//    /**
+//     * 多个sheet页的数据链式写入(失败了会返回一个有部分数据的Excel)
+//     * ExcelUtil.writeWithSheets(response, exportFileName)
+//     *                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")
+//     *                 .write(headData, data,"sheetName2")
+//     *                 .finish();
+//     * @param response
+//     * @param exportFileName 导出的文件名称
+//     * @return
+//     */
+//    public static EasyExcelWriterFactory writeWithSheetsWeb(HttpServletResponse response, String exportFileName) throws IOException, IOException {
+//        response.setContentType("application/vnd.ms-excel");
+////        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+//        response.setCharacterEncoding("utf-8");
+//        // 这里URLEncoder.encode可以防止中文乱码
+//        String fileName = URLEncoder.encode(exportFileName, "UTF-8");
+//        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+//        return new EasyExcelWriterFactory(response.getOutputStream());
+//    }
+//
+//
+//
+//}
+//
+///**
+// * 默认按模型读取的监听器
+// * @param <T>
+// */
+//@Slf4j
+//class DefaultExcelListener<T> extends AnalysisEventListener<T> {
+//    private final List<T> rows = new ArrayList();
+//
+//    @Override
+//    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
+//        log.info("解析到一条头数据:{}", JSON.toJSONString(headMap));
+//    }
+//
+//    @Override
+//    public void invoke(T object, AnalysisContext context) {
+//        rows.add(object);
+//        // 实际数据量比较大时,rows里的数据可以存到一定量之后进行批量处理(比如存到数据库),
+//        // 然后清空列表,以防止内存占用过多造成OOM
+//    }
+//
+//    @Override
+//    public void doAfterAllAnalysed(AnalysisContext context) {
+//        log.info("read {} rows", rows.size());
+//    }
+//
+//    /**
+//     * 在转换异常 获取其他异常下会调用本接口。抛出异常则停止读取。如果这里不抛出异常则 继续读取下一行。
+//     *
+//     * @param exception
+//     * @param context
+//     * @throws Exception
+//     */
+//    @Override
+//    public void onException(Exception exception, AnalysisContext context) {
+//        log.error("解析失败,但是继续解析下一行:{}", exception.getMessage());
+//        if (exception instanceof ExcelDataConvertException) {
+//            ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
+//            log.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex(),
+//                    excelDataConvertException.getColumnIndex(), excelDataConvertException.getCellData());
+//        }
+//    }
+//
+//    public List<T> getRows() {
+//        return rows;
+//    }
+//}

+ 78 - 0
mall-service/src/main/java/com/txz/mall/util/factory/EasyExcelWriterFactory.java

@@ -0,0 +1,78 @@
+//package com.txz.mall.util.factory;
+//
+//import com.alibaba.excel.EasyExcel;
+//import com.alibaba.excel.ExcelWriter;
+//
+//import java.io.File;
+//import java.io.OutputStream;
+//import java.util.List;
+//
+///**
+// * @author: admin
+// * @date: 2022/10/28
+// * @time: 17:12
+// * @description: 自定义EasyExcel写工厂
+// */
+//public class EasyExcelWriterFactory {
+//    private int sheetNo = 0;
+//    private ExcelWriter excelWriter = null;
+//
+//    public EasyExcelWriterFactory(OutputStream outputStream) {
+//        excelWriter = EasyExcel.write(outputStream).build();
+//    }
+//
+//    public EasyExcelWriterFactory(File file) {
+//        excelWriter = EasyExcel.write(file).build();
+//    }
+//
+//    public EasyExcelWriterFactory(String filePath) {
+//        excelWriter = EasyExcel.write(filePath).build();
+//    }
+//
+//    /**
+//     * 链式模板表头写入
+//     *
+//     * @param headClazz 表头格式
+//     * @param data      数据 List<ExcelModel> 或者List<List<Object>>
+//     * @return
+//     */
+//    public EasyExcelWriterFactory writeModel(Class headClazz, List data, String sheetName) {
+//        excelWriter.write(data, EasyExcel.writerSheet(this.sheetNo++, sheetName).head(headClazz).build());
+//        return this;
+//    }
+//
+//    /**
+//     * 链式模板表头写入
+//     * @param obj 动态表头格式
+//     * @param data 数据 List<ExcelModel> 或者 List<List<Object>>
+//     * @param sheetName
+//     * @return
+//     */
+//    public EasyExcelWriterFactory writeModel(Object obj, List data, String sheetName) {
+//        excelWriter.write(data, EasyExcel.writerSheet(this.sheetNo++, sheetName).head(getObjectClass(obj)).build());
+//        return this;
+//
+//    }
+//
+//    private Class getObjectClass(Object object) {
+//        Class<?> objectClass = object.getClass();
+//        return objectClass;
+//    }
+//
+//    /**
+//     * 链式自定义表头写入
+//     * @param head 自定义表头格式
+//     * @param data 数据 List<ExcelModel> 或者List<List<Object>>
+//     * @param sheetName
+//     * @return
+//     */
+//    public EasyExcelWriterFactory write(List<List<String>> head, List data, String sheetName) {
+//        excelWriter.write(data, EasyExcel.writerSheet(this.sheetNo++, sheetName).head(head).build());
+//        return this;
+//    }
+//
+//    public void finish() {
+//        excelWriter.finish();
+//    }
+//
+//}

+ 51 - 0
mall-service/src/main/resources/mapper/StoreProductMapper.xml

@@ -0,0 +1,51 @@
+<?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.txz.mall.dao.StoreProductMapper">
+    <resultMap id="BaseResultMap" type="com.txz.mall.model.StoreProduct">
+        <!--
+          WARNING - @mbg.generated
+        -->
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <id column="mer_id" jdbcType="TINYINT" property="merId"/>
+        <result column="image" jdbcType="VARCHAR" property="image"/>
+        <result column="slider_image" jdbcType="VARCHAR" property="sliderImage"/>
+        <result column="store_name" jdbcType="VARCHAR" property="storeName"/>
+        <result column="store_info" jdbcType="VARCHAR" property="storeInfo"/>
+        <result column="keyword" jdbcType="VARCHAR" property="keyword"/>
+        <result column="cate_id" jdbcType="VARCHAR" property="cateId"/>
+        <result column="price" jdbcType="DECIMAL" property="price"/>
+        <result column="vip_price" jdbcType="DECIMAL" property="vipPrice"/>
+        <result column="ot_price" jdbcType="DECIMAL" property="otPrice"/>
+        <result column="postage" jdbcType="DECIMAL" property="postage"/>
+        <result column="unit_name" jdbcType="VARCHAR" property="unitName"/>
+        <result column="sort" jdbcType="SMALLINT" property="sort"/>
+        <result column="sales" jdbcType="INTEGER" property="sales"/>
+        <result column="stock" jdbcType="INTEGER" property="stock"/>
+        <result column="is_show" jdbcType="INTEGER" property="isShow"/>
+        <result column="is_hot" jdbcType="INTEGER" property="isHot"/>
+        <result column="is_benefit" jdbcType="INTEGER" property="isBenefit"/>
+        <result column="is_best" jdbcType="INTEGER" property="isBest"/>
+        <result column="is_new" jdbcType="INTEGER" property="isNew"/>
+        <result column="add_time" jdbcType="INTEGER" property="addTime"/>
+        <result column="is_postage" jdbcType="TINYINT" property="isPostage"/>
+        <result column="is_delete" jdbcType="TINYINT" property="isDelete"/>
+        <result column="give_integral" jdbcType="INTEGER" property="giveIntegral"/>
+        <result column="cost" jdbcType="DECIMAL" property="cost"/>
+        <result column="is_seckill" jdbcType="TINYINT" property="isSeckill"/>
+        <result column="is_bargain" jdbcType="TINYINT" property="isBargain"/>
+        <result column="is_good" jdbcType="INTEGER" property="isGood"/>
+        <result column="is_sub" jdbcType="INTEGER" property="isSub"/>
+        <result column="ficti" jdbcType="INTEGER" property="ficti"/>
+        <result column="browse" jdbcType="INTEGER" property="browse"/>
+        <result column="video_link" jdbcType="VARCHAR" property="videoLink"/>
+        <result column="temp_id" jdbcType="INTEGER" property="tempId"/>
+        <result column="spec_type" jdbcType="INTEGER" property="specType"/>
+        <result column="activity" jdbcType="VARCHAR" property="activity"/>
+        <result column="flat_pattern" jdbcType="VARCHAR" property="flatPattern"/>
+        <result column="is_recycle" jdbcType="INTEGER" property="isRecycle"/>
+        <result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+    </resultMap>
+</mapper>

+ 1 - 2
mall-service/src/test/java/CodeGenerator.java

@@ -387,8 +387,7 @@ public class CodeGenerator {
 			if (!file.getParentFile().exists()) {
 				file.getParentFile().mkdirs();
 			}
-			// cfg.getTemplate("controller-restful.ftl").process(data, new
-			// FileWriter(file));
+			// cfg.getTemplate("controller-restful.ftl").process(data, newFileWriter(file));
 			cfg.getTemplate("controller.ftl").process(data, new FileWriter(file));
 
 			System.out.println(modelNameUpperCamel + "Controller.java 生成成功");

+ 7 - 7
mall-service/src/test/resources/generator/template/controller-restful.ftl

@@ -24,25 +24,25 @@ public class ${modelNameUpperCamel}Controller {
     @PostMapping
     public Result add(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel}) {
         ${modelNameLowerCamel}Service.save(${modelNameLowerCamel});
-        return ResultGenerator.genSuccessResult();
+return Result.success();
     }
 
     @DeleteMapping("/{id}")
-    public Result delete(@PathVariable Integer id) {
+public Result delete(@PathVariable Long id) {
         ${modelNameLowerCamel}Service.deleteById(id);
-        return ResultGenerator.genSuccessResult();
+return Result.success();
     }
 
     @PutMapping
     public Result update(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel}) {
         ${modelNameLowerCamel}Service.update(${modelNameLowerCamel});
-        return ResultGenerator.genSuccessResult();
+return Result.success();
     }
 
     @GetMapping("/{id}")
-    public Result detail(@PathVariable Integer id) {
+public Result detail(@PathVariable Long id) {
         ${modelNameUpperCamel} ${modelNameLowerCamel} = ${modelNameLowerCamel}Service.findById(id);
-        return ResultGenerator.genSuccessResult(${modelNameLowerCamel});
+return Result.success(${modelNameLowerCamel});
     }
 
     @GetMapping
@@ -50,6 +50,6 @@ public class ${modelNameUpperCamel}Controller {
         PageHelper.startPage(page, size);
         List<${modelNameUpperCamel}> list = ${modelNameLowerCamel}Service.findAll();
         PageInfo pageInfo = new PageInfo(list);
-        return ResultGenerator.genSuccessResult(pageInfo);
+return Result.success(pageInfo);
     }
 }

+ 3 - 1
mall-service/src/test/resources/generator/template/controller.ftl

@@ -67,7 +67,9 @@ public class ${modelNameUpperCamel}Controller {
     		return Result.fail(ResultCode.USERID_IS_NULL);
     	}
     	try {
-    		${modelNameLowerCamel}Service.deleteById(id);
+${modelNameUpperCamel} ${modelNameLowerCamel} = new ${modelNameUpperCamel};
+${modelNameLowerCamel}.setIsDelete(1);
+${modelNameLowerCamel}Service.update(${modelNameLowerCamel});
 		} catch (Exception e) {
 			log.error("删除对象操作异常e:{}",e);
 			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);