修改商品

This commit is contained in:
fengxiaohang 2025-06-26 10:28:35 +08:00
parent 9e2fa2ed16
commit 53fcafde65
24 changed files with 369 additions and 35 deletions

View File

@ -98,4 +98,18 @@ public interface VlogMapper extends BaseMapper<Vlog> {
@Select("SELECT COUNT(*) FROM t_vlog where status = 0")
Object countVlog();
@Select("SELECT " +
" DATE_FORMAT(create_time, '%Y-%m') AS month, " +
" COUNT(*) AS vlog_count " +
"FROM " +
" t_vlog " +
"WHERE " +
" status = 1 " +
"GROUP BY " +
" DATE_FORMAT(create_time, '%Y-%m') " +
"ORDER BY " +
" DATE_FORMAT(create_time, '%Y-%m')")
List<Map<String, Object>> getMonthlyVlog();
}

View File

@ -1,5 +1,6 @@
package com.wzj.soopin.goods.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wzj.soopin.goods.convert.SkuConvert;
import com.wzj.soopin.goods.domain.bo.ProductBo;
@ -38,12 +39,10 @@ public class SkuController extends BaseController {
@Autowired
private SkuConvert convert;
@Tag(name ="查询商品信息列表")
@PostMapping("list")
public R<Page<SkuVO>> list(@RequestBody SkuBo query, Page<Sku> page) {
Page<Sku> skuPage = service.page(page,query.toWrapper());
return R.ok(convert.toVO(skuPage));
public R<IPage<SkuVO>> list(@RequestBody SkuBo query, Page<Sku> page) {
return R.ok(service.getList(query,page));
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wzj.soopin.goods.domain.entity.Sku;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.common.excel.annotation.Excel;
import java.math.BigDecimal;
@ -27,6 +28,9 @@ public class SkuBo {
@Schema(description = "商品销售属性json格式 精确匹配")
private String spData;
@Schema(description = "商品名称")
private String productName;
public Wrapper<Sku> toWrapper() {
LambdaQueryWrapper<Sku> queryWrapper = new LambdaQueryWrapper<>();

View File

@ -115,7 +115,7 @@ public class ProductVO extends BaseAudit {
@Schema(description = "店铺id")
private String tenantId;
@Schema(description = "审核状态")
@Schema(description = "审核状态 1.待审核、2.审核通过、3.审核驳回")
private String authFlag;
@Schema(description = "销量")
@ -127,4 +127,10 @@ public class ProductVO extends BaseAudit {
@Schema(description = "配送方式 1->到店核销2->自提;3->配送;")
private Integer distribution;
@Schema(description = "描述")
private String describe;
@Schema(description = "优惠金额")
private BigDecimal discountPrice;
}

View File

@ -47,4 +47,8 @@ public class SkuVO extends BaseAudit {
@Schema(description = "库存数")
@Excel(name = "库存数")
private Integer stock;
@Schema(description = "商品名称")
@Excel(name = "商品名称")
private String productName;
}

View File

@ -36,6 +36,15 @@ public interface ProductMapper extends BaseMapper<Product> {
"FROM pms_product")
Map<String, Object> countProduct();
@Select("SELECT " +
"name, " +
"sales, " +
"sales * price AS total_amount " +
"FROM pms_product " +
"ORDER BY total_amount DESC " +
"LIMIT 20")
List<Map<String, Object>> getTop20Product();
// @Select("SELECT COUNT(*) FROM pms_product WHERE auth_flag = 1")
// Object AuditProduct();
}

View File

@ -1,7 +1,11 @@
package com.wzj.soopin.goods.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wzj.soopin.goods.domain.bo.SkuBo;
import com.wzj.soopin.goods.domain.entity.Sku;
import com.wzj.soopin.goods.domain.vo.SkuVO;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
@ -22,4 +26,6 @@ public interface SkuMapper extends BaseMapper<Sku> {
List<Sku> selectByEntity(Sku sku);
int updateStockById(@Param("skuId")Long skuId, @Param("optDate")LocalDateTime optDate, @Param("quantity")Integer quantity);
IPage<SkuVO> getlist(@Param("page") Page<Sku> page,@Param("query") SkuBo query);
}

View File

@ -1,9 +1,14 @@
package com.wzj.soopin.goods.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.goods.domain.bo.SkuBo;
import com.wzj.soopin.goods.domain.entity.Sku;
import com.wzj.soopin.goods.domain.query.SkuQuery;
import com.wzj.soopin.goods.domain.vo.ProductVO;
import com.wzj.soopin.goods.domain.vo.SkuVO;
import com.wzj.soopin.goods.mapper.SkuMapper;
import com.wzj.soopin.goods.service.SkuService;
import org.apache.commons.lang3.StringUtils;
@ -101,4 +106,9 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
public int deleteById(Long id) {
return skuMapper.deleteById(id);
}
public IPage<SkuVO> getList(SkuBo query, Page<Sku> page) {
IPage<SkuVO> resultPage = skuMapper.getlist(page,query);
return resultPage;
}
}

View File

@ -61,19 +61,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.*,
b.name AS brandName,
b.logo AS brandLogo,
t.contact_user_name AS contactUserName,
t.company_name AS contactUserName,
t.contact_phone AS contactPhone,
o.distribution AS distribution
o.distribution AS distribution,
pc.name AS productCategoryName
FROM
pms_product p
LEFT JOIN
pms_brand b ON p.brand_id = b.id
LEFT JOIN
sys_tenant t ON p.tenant_id = t.tenant_id
LEFT JOIN
oms_order_item oi ON p.id = oi.product_id
LEFT JOIN
oms_order o ON oi.order_id = o.id
LEFT JOIN pms_brand b ON p.brand_id = b.id
LEFT JOIN sys_tenant t ON p.tenant_id = t.tenant_id
LEFT JOIN oms_order_item oi ON p.id = oi.product_id
LEFT JOIN oms_order o ON oi.order_id = o.id
LEFT JOIN pms_product_category pc ON p.category_id = pc.id
WHERE 1=1
<if test="query.contactPhone != null and query.contactPhone != ''">
AND t.contact_phone LIKE '%${query.contactPhone}%'

View File

@ -43,4 +43,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spData != null and spData != ''"> and sp_data = #{spData}</if>
</where>
</select>
<select id="getlist" resultType="SkuVO">
SELECT
s.*,
p.name AS productName
FROM
pms_sku s
LEFT JOIN
pms_product p ON s.product_id = p.id
<where>
<if test="query.productName != null and query.productName != ''">
AND p.name LIKE CONCAT('%', #{query.productName}, '%')
</if>
<if test="query.outSkuId != null and query.outSkuId != ''">
AND s.out_sku_id LIKE CONCAT('%', #{query.outSkuId}, '%')
</if>
<if test="query.price != null and query.price != ''">
AND s.price LIKE CONCAT('%', #{query.price}, '%')
</if>
<if test="query.pic != null and query.pic != ''">
AND s.pic LIKE CONCAT('%', #{query.pic}, '%')
</if>
</where>
ORDER BY
s.create_time DESC
</select>
</mapper>

View File

@ -56,7 +56,7 @@ public class OrderController extends BaseController {
@Tag(name ="查询订单列表")
@PostMapping("/list")
public R<IPage<OrderVO>> list1(@RequestBody OrderBo query, Page<Order> page){
public R<IPage<OrderVO>> list(@RequestBody OrderBo query, Page<Order> page){
return R.ok(orderService.getlist(page,query));
}

View File

@ -1,13 +1,12 @@
package com.wzj.soopin.order.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wzj.soopin.order.domain.bo.OrderBo;
import com.wzj.soopin.order.domain.entity.Order;
import com.wzj.soopin.order.domain.entity.SystemStatistics;
import org.dromara.system.domain.SystemStatistics;
import com.wzj.soopin.order.domain.form.ManagerOrderQueryForm;
import com.wzj.soopin.order.domain.vo.*;
import org.apache.ibatis.annotations.Param;

View File

@ -44,8 +44,10 @@ import org.dromara.common.core.domain.event.Constants;
import org.dromara.common.core.utils.PhoneUtils;
import org.dromara.common.core.utils.SecurityUtils;
import org.dromara.system.domain.SysTenant;
import org.dromara.system.mapper.SysIntegralHistoryMapper;
import org.dromara.system.mapper.SysOperLogMapper;
import org.dromara.system.mapper.SysTenantMapper;
import org.dromara.system.mapper.SystemStatisticsMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
@ -120,6 +122,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Autowired
private WithdrawServiceImpl withdrawService;
@Autowired
private SystemStatisticsMapper systemStatisticsMapper;
@Autowired
private SysIntegralHistoryMapper sysIntegralHistoryMapper;
/**
@ -596,7 +604,6 @@ public Map<String, Object> getCount() {
QueryWrapper<Feedback> FeedbackWrapper = new QueryWrapper<>();
FeedbackWrapper.eq("status", 0);
result.put("feedbackCount", feedbackService.count(FeedbackWrapper));
// 待审核提现统计
QueryWrapper<Withdraw> withdrawQueryWrapper = new QueryWrapper<>();
withdrawQueryWrapper.eq("audit_status", 0);
@ -617,6 +624,25 @@ public Map<String, Object> getCount() {
result.put("orderCount", OrderCounts.get("count1"));
result.put("orderAudit", OrderCounts.get("count2"));
// 店铺TOP20
List<Map<String, Object>> top20Stores = sysTenantMapper.getTop20Stores();
result.put("top20Stores", top20Stores);
// 商品TOP20
List<Map<String, Object>> top20Product = productMapper.getTop20Product();
result.put("top20Product", top20Product);
// 分月用户量统计
List<Map<String, Object>> monthlyUserVolume = systemStatisticsMapper.getMonthlyUserVolume();
result.put("monthlyUserVolume", monthlyUserVolume);
// 分月短视频统计
List<Map<String, Object>> monthlyVlog = vlogMapper.getMonthlyVlog();
result.put("monthlyVlog", monthlyVlog);
// 分月收入支出统计
List<Map<String, Object>> monthlyIncomeExpense = sysIntegralHistoryMapper.getIncomeExpense();
result.put("monthlyIncomeExpense", monthlyIncomeExpense);
@ -624,12 +650,5 @@ public Map<String, Object> getCount() {
}
}
// @Override
// public IPage<OrderVO> getlist(PageVO pageVO, OrderBo query) {
// IPage<OrderVO> resultPage = orderMapper.getlist(PageUtil.initPage(pageVO),query);
// return resultPage;
// }

View File

@ -248,7 +248,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from oms_order
where create_time between #{startTime} and #{endTime}
</select>
<select id="statNewAndDeal" resultType="com.wzj.soopin.order.domain.entity.SystemStatistics">
<select id="statNewAndDeal" resultType="org.dromara.system.domain.SystemStatistics">
select
IFNULL(count(distinct member_id), 0) createOrderMemberCount,
IFNULL(count(id), 0) orderCount,

View File

@ -0,0 +1,38 @@
package org.dromara.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@TableName("act_integral_history")
public class SysIntegralHistory {
@Schema(description = "ID")
private Long id;
@Schema(description = "用户ID")
private Long memberId;
@Schema(description = "变动金额")
private BigDecimal amount;
@Schema(description = "类型 1.收入 2.支出 3.其他")
private Integer opType;
@Schema(description = "子类型 11签到 12消费获得 21退款扣除积分 22 兑换优惠卷")
private Integer subOpType;
@Schema(description = "订单金额")
private BigDecimal orderAmount;
@Schema(description = "订单ID")
private Long orderId;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -1,4 +1,4 @@
package com.wzj.soopin.order.domain.entity;
package org.dromara.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -0,0 +1,20 @@
package org.dromara.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.system.domain.SysIntegralHistory;
import java.util.List;
import java.util.Map;
public interface SysIntegralHistoryMapper extends BaseMapper<SysIntegralHistory> {
@Select("SELECT " +
"DATE_FORMAT(create_time, '%Y-%m') AS month, " +
"SUM(CASE WHEN op_type = 1 THEN amount ELSE 0 END) AS income_amount, " +
"SUM(CASE WHEN op_type = 2 THEN amount ELSE 0 END) AS expense_amount " +
"FROM act_integral_history " +
"GROUP BY DATE_FORMAT(create_time, '%Y-%m') " +
"ORDER BY DATE_FORMAT(create_time, '%Y-%m')")
List<Map<String, Object>> getIncomeExpense();
}

View File

@ -5,6 +5,7 @@ import org.dromara.system.domain.SysTenant;
import org.dromara.system.domain.vo.SysTenantVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
import java.util.Map;
/**
@ -22,4 +23,17 @@ public interface SysTenantMapper extends BaseMapperPlus<SysTenant, SysTenantVo>
"SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) AS count2 " +
"FROM sys_tenant")
Map<String, Object> countProduct();
@Select("SELECT " +
"t.company_name, " +
"COALESCE(p.sales, 0) AS sales, " +
"COALESCE(SUM(p.sales * p.price), 0) AS total_amount " +
"FROM sys_tenant t " +
"LEFT JOIN pms_product p ON t.tenant_id = p.tenant_id " +
"GROUP BY t.tenant_id, t.company_name " +
"ORDER BY total_amount DESC " +
"LIMIT 20")
List<Map<String, Object>> getTop20Stores();
}

View File

@ -0,0 +1,25 @@
package org.dromara.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.system.domain.SystemStatistics;
import java.util.List;
import java.util.Map;
public interface SystemStatisticsMapper extends BaseMapper<SystemStatistics> {
@Select("SELECT " +
"DATE_FORMAT(date, '%Y-%m') AS month, " +
"SUM(login_member_count) AS loginMemberCount, " +
"SUM(register_member_count) AS registerMemberCount, " +
"SUM(add_cart_member_count) AS addCartMemberCount, " +
"SUM(deal_member_count) AS dealMemberCount " +
"FROM aws_system_statistics " +
"GROUP BY DATE_FORMAT(date, '%Y-%m') " +
"ORDER BY DATE_FORMAT(date, '%Y-%m')")
List<Map<String, Object>> getMonthlyUserVolume();
}

View File

@ -0,0 +1,7 @@
package org.dromara.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.system.domain.SysIntegralHistory;
public interface ISysIntegralHistoryService extends IService<SysIntegralHistory> {
}

View File

@ -0,0 +1,7 @@
package org.dromara.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.system.domain.SystemStatistics;
public interface ISystemStatisticsService extends IService<SystemStatistics> {
}

View File

@ -0,0 +1,11 @@
package org.dromara.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.system.domain.SysIntegralHistory;
import org.dromara.system.mapper.SysIntegralHistoryMapper;
import org.dromara.system.service.ISysIntegralHistoryService;
import org.springframework.stereotype.Service;
@Service
public class ISysIntegralHistoryServiceImpl extends ServiceImpl<SysIntegralHistoryMapper, SysIntegralHistory> implements ISysIntegralHistoryService {
}

View File

@ -0,0 +1,11 @@
package org.dromara.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.system.domain.SystemStatistics;
import org.dromara.system.mapper.SystemStatisticsMapper;
import org.dromara.system.service.ISystemStatisticsService;
import org.springframework.stereotype.Service;
@Service
public class SystemStatisticsImpl extends ServiceImpl<SystemStatisticsMapper, SystemStatistics> implements ISystemStatisticsService {
}

View File

@ -4,4 +4,109 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.system.mapper.SysConfigMapper">
<resultMap type="SysConfig" id="SysConfigResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="configType" column="config_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND config_type = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="SysConfig">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateConfig" parameterType="SysConfig">
update sys_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete from sys_config where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>