This commit is contained in:
雷欧(林平凡)
2025-08-06 18:04:37 +08:00
parent 7edb6013c8
commit 8638187ced
13 changed files with 431 additions and 93 deletions

View File

@@ -20,7 +20,7 @@ public class RuoYiApplication
ConfigurableApplicationContext context = SpringApplication.run(RuoYiApplication.class, args);
Environment env =context.getEnvironment();
System.out.println("实际加载的端口:" + env.getProperty("server.port"));
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n");
}
}

View File

@@ -1,12 +1,11 @@
package com.ruoyi.web.controller.jarvis;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.jarvis.domain.SuperAdmin;
import com.ruoyi.jarvis.service.SuperAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
@@ -31,6 +30,9 @@ public class OrderRowsController extends BaseController
@Autowired
private IOrderRowsService orderRowsService;
@Autowired
private SuperAdminService superAdminService;
/**
* 查询京粉订单列表
*/
@@ -42,21 +44,36 @@ public class OrderRowsController extends BaseController
return getDataTable(list);
}
/**
/**
* 导出京粉订单列表
*/
@Log(title = "京粉订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OrderRows orderRows)
public void export(HttpServletResponse response, OrderRows orderRows) throws IOException
{
// 判断是否需要分页
PageDomain pageDomain = TableSupport.buildPageRequest();
if (pageDomain.getPageNum() != null && pageDomain.getPageSize() != null) {
startPage();
}
String fileName = "京粉订单数据";
List<OrderRows> list = orderRowsService.selectOrderRowsList(orderRows);
if (!list.isEmpty()){
Long unionId = list.get(0).getUnionId();
SuperAdmin superAdmin = superAdminService.selectSuperAdminByUnionId(unionId);
if (superAdmin != null && superAdmin.getName() != null) {
String name = superAdmin.getName();
String unionIdStr = String.valueOf(superAdmin.getUnionId());
fileName = name + "-" + unionIdStr + "-订单";
}
}
// 设置响应头,指定文件名
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
String encodedFileName = java.net.URLEncoder.encode(fileName + ".xlsx", "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=" + encodedFileName);
// 添加download-filename响应头以支持前端工具类
response.setHeader("download-filename", encodedFileName);
ExcelUtil<OrderRows> util = new ExcelUtil<OrderRows>(OrderRows.class);
util.exportExcel(response, list, "京粉订单数据");
util.exportExcel(response, list, fileName);
}
@@ -107,4 +124,130 @@ public class OrderRowsController extends BaseController
List<Map<String, Object>> options = ValidCodeConverter.getAllValidCodeOptions();
return AjaxResult.success(options);
}
/**
* 根据联盟ID或日期范围统计订单数据按validCode分组
*/
@GetMapping("/statistics")
public AjaxResult getStatistics(OrderRows orderRows, Date beginTime, Date endTime) {
Map<String, Object> result = new HashMap<>();
// 获取superAdminList筛选出isCount = 0的unionId
List<Long> excludeUnionIds = new ArrayList<>();
List<SuperAdmin> superAdminList = superAdminService.selectSuperAdminList(null);
logger.info("superAdminList.size: {}", superAdminList.size());
for (SuperAdmin superAdmin : superAdminList) {
if (superAdmin.getIsCount() != null && superAdmin.getIsCount() == 0 && superAdmin.getUnionId() != null) {
try {
excludeUnionIds.add(Long.parseLong(superAdmin.getUnionId()));
} catch (NumberFormatException e) {
// 忽略无法解析的unionId
}
}
}
logger.info("excludeUnionIds: {}", excludeUnionIds.size());
// 使用新的查询方法直接在SQL中完成日期过滤和unionId排除
List<OrderRows> filteredList = orderRowsService.selectOrderRowsListWithFilter(orderRows, beginTime, endTime, excludeUnionIds);
// 定义分组
Map<String, Object> groups = new HashMap<>();
groups.put("cancel", Arrays.asList("3"));
groups.put("invalid", Arrays.asList("2","4","5","6","7","8","9","10","11","14","19","20","21","22","23","29","30","31","32","33","34"));
groups.put("pending", Arrays.asList("15"));
groups.put("paid", Arrays.asList("16"));
groups.put("finished", Arrays.asList("17"));
groups.put("deposit", Arrays.asList("24"));
groups.put("illegal", Arrays.asList("25","26","27","28"));
// 初始化统计结果
Map<String, Map<String, Object>> groupStats = new HashMap<>();
groupStats.put("cancel", createGroupStat("取消", "cancel"));
groupStats.put("invalid", createGroupStat("无效", "invalid"));
groupStats.put("pending", createGroupStat("待付款", "pending"));
groupStats.put("paid", createGroupStat("已付款", "paid"));
groupStats.put("finished", createGroupStat("已完成", "finished"));
groupStats.put("deposit", createGroupStat("已付定金", "deposit"));
groupStats.put("illegal", createGroupStat("违规", "illegal"));
// 总统计数据
int totalOrders = 0;
double totalCommission = 0;
double totalActualFee = 0;
long totalSkuNum = 0;
// 违规订单统计
long violationOrders = 0;
double violationCommission = 0.0;
// 按分组统计
for (OrderRows row : filteredList) {
totalOrders++;
if (row.getEstimateFee() != null) {
totalCommission += row.getEstimateFee();
}
if (row.getActualFee() != null) {
totalActualFee += row.getActualFee();
}
if (row.getSkuNum() != null) {
totalSkuNum += row.getSkuNum();
}
// 按validCode分组统计
if (row.getValidCode() != null) {
String validCode = String.valueOf(row.getValidCode());
for (Map.Entry<String, Object> group : groups.entrySet()) {
List<String> codes = (List<String>) group.getValue();
if (codes.contains(validCode)) {
Map<String, Object> stat = groupStats.get(group.getKey());
stat.put("count", (Integer) stat.get("count") + 1);
stat.put("commission", (Double) stat.get("commission") + (row.getEstimateFee() != null ? row.getEstimateFee() : 0));
stat.put("actualFee", (Double) stat.get("actualFee") + (row.getActualFee() != null ? row.getActualFee() : 0));
if (row.getSkuNum() != null) {
stat.put("skuNum", (Long) stat.get("skuNum") + row.getSkuNum());
}
// 统计违规订单
if ("illegal".equals(group.getKey())) {
violationOrders++;
// 违规订单佣金计算方式:实际价格 * 佣金比例
if (row.getActualCosPrice() != null && row.getCommissionRate() != null) {
violationCommission += row.getActualCosPrice() * row.getCommissionRate() * 0.01;
} else if (row.getEstimateFee() != null) {
// 如果无法计算,使用预估佣金
violationCommission += row.getEstimateFee();
}
}
break;
}
}
}
}
result.put("totalOrders", totalOrders);
result.put("totalCommission", totalCommission);
result.put("totalActualFee", totalActualFee);
result.put("totalSkuNum", totalSkuNum);
result.put("violationOrders", violationOrders);
result.put("violationCommission", violationCommission);
result.put("groupStats", groupStats);
return AjaxResult.success(result);
}
/**
* 创建分组统计对象
*/
private Map<String, Object> createGroupStat(String label, String value) {
Map<String, Object> stat = new HashMap<>();
stat.put("label", label);
stat.put("value", value);
stat.put("count", 0);
stat.put("commission", 0.0);
stat.put("actualFee", 0.0);
stat.put("skuNum", 0L);
return stat;
}
}

View File

@@ -5,7 +5,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -20,7 +20,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.jarvis.domain.SuperAdmin;
import com.ruoyi.jarvis.service.ISuperAdminService;
import com.ruoyi.jarvis.service.SuperAdminService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -34,7 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
public class SuperAdminController extends BaseController
{
@Autowired
private ISuperAdminService superAdminService;
private SuperAdminService superAdminService;
/**
* 查询超级管理员列表

View File

@@ -4,6 +4,8 @@ import java.util.Date;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import org.springframework.data.annotation.Transient;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
/**
* 京粉订单对象 order_rows
@@ -16,75 +18,99 @@ public class OrderRows extends BaseEntity
private static final long serialVersionUID = 1L;
/** ID */
@Excel(name = "ID")
private String id;
/** 订单ID */
@Excel(name = "订单ID", cellType = ColumnType.STRING)
private Long orderId;
/** 父订单ID */
@Excel(name = "父订单ID", cellType = ColumnType.STRING)
private Long parentId;
/** 下单时间 */
@Excel(name = "下单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
/** 完成时间 */
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date finishTime;
/** 修改时间 */
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
/** 订单类型 */
@Excel(name = "订单类型")
private Integer orderEmt;
/** 是否PLUS会员 */
@Excel(name = "是否PLUS会员", readConverterExp = "0=否,1=是")
private Integer plus;
/** 联盟ID */
@Excel(name = "联盟ID", cellType = ColumnType.STRING)
private Long unionId;
/** SKU ID */
@Excel(name = "SKU ID", cellType = ColumnType.STRING)
private Long skuId;
/** SKU名称 */
@Excel(name = "SKU名称")
private String skuName;
/** SKU数量 */
@Excel(name = "SKU数量")
private Integer skuNum;
/** SKU退货数量 */
@Excel(name = "SKU退货数量")
private Integer skuReturnNum;
/** SKU冻结数量 */
@Excel(name = "SKU冻结数量")
private Integer skuFrozenNum;
/** 价格 */
@Excel(name = "价格")
private Double price;
/** 佣金比例 */
@Excel(name = "佣金比例")
private Double commissionRate;
/** 子边比例 */
@Excel(name = "子边比例")
private Double subSideRate;
/** 补贴比例 */
@Excel(name = "补贴比例")
private Double subsidyRate;
/** 最终比例 */
@Excel(name = "最终比例")
private Double finalRate;
/** 预估成本价 */
@Excel(name = "预估成本价")
private Double estimateCosPrice;
/** 预估佣金 */
@Excel(name = "预估佣金")
private Double estimateFee;
/** 实际成本价 */
@Excel(name = "实际成本价")
private Double actualCosPrice;
/** 实际佣金 */
@Excel(name = "实际佣金")
private Double actualFee;
/** 有效性 */
@Excel(name = "有效性")
private Integer validCode;
/** 有效性多选值 */
@@ -92,87 +118,115 @@ public class OrderRows extends BaseEntity
private Integer[] validCodes;
/** 跟踪类型 */
@Excel(name = "跟踪类型")
private Integer traceType;
/** 位置ID */
@Excel(name = "位置ID", cellType = ColumnType.STRING)
private Long positionId;
/** 站点ID */
@Excel(name = "站点ID", cellType = ColumnType.STRING)
private Long siteId;
/** 联盟别名 */
@Excel(name = "联盟别名")
private String unionAlias;
/** PID */
@Excel(name = "PID")
private String pid;
/** 一级分类ID */
@Excel(name = "一级分类ID", cellType = ColumnType.NUMERIC)
private Long cid1;
/** 二级分类ID */
@Excel(name = "二级分类ID", cellType = ColumnType.NUMERIC)
private Long cid2;
/** 三级分类ID */
@Excel(name = "三级分类ID", cellType = ColumnType.NUMERIC)
private Long cid3;
/** 子联盟ID */
@Excel(name = "子联盟ID")
private String subUnionId;
/** 联盟标签 */
@Excel(name = "联盟标签")
private String unionTag;
/** POP ID */
@Excel(name = "POP ID", cellType = ColumnType.STRING)
private Long popId;
/** 扩展字段1 */
@Excel(name = "扩展字段1")
private String ext1;
/** 支付月份 */
@Excel(name = "支付月份")
private String payMonth;
/** 活动ID */
@Excel(name = "活动ID", cellType = ColumnType.STRING)
private Long cpActId;
/** 联盟角色 */
@Excel(name = "联盟角色")
private Integer unionRole;
/** 礼品券OCS金额 */
@Excel(name = "礼品券OCS金额")
private Double giftCouponOcsAmount;
/** 礼品券KEY */
@Excel(name = "礼品券KEY")
private String giftCouponKey;
/** 余额扩展 */
@Excel(name = "余额扩展")
private String balanceExt;
/** 签名 */
@Excel(name = "签名")
private String sign;
/** 促销价格金额 */
@Excel(name = "促销价格金额")
private Double proPriceAmount;
/** RID */
@Excel(name = "RID", cellType = ColumnType.STRING)
private Long rid;
/** 商品信息ID */
@Excel(name = "商品信息ID", cellType = ColumnType.STRING)
private Long goodsInfoId;
/** 快递状态 */
@Excel(name = "快递状态")
private Integer expressStatus;
/** 渠道ID */
@Excel(name = "渠道ID", cellType = ColumnType.STRING)
private Long channelId;
/** SKU标签 */
@Excel(name = "SKU标签")
private String skuTag;
/** 商品ID */
@Excel(name = "商品ID")
private String itemId;
/** 调用方商品ID */
@Excel(name = "调用方商品ID")
private String callerItemId;
/** 订单标签 */
@Excel(name = "订单标签")
private String orderTag;
}

View File

@@ -40,6 +40,10 @@ public class SuperAdmin extends BaseEntity
@Excel(name = "是否激活", readConverterExp = "0=否,1=是")
private Integer isActive;
/** 是否删除: 0-否, 1-是 */
@Excel(name = "是否参与订单统计", readConverterExp = "0=否,1=是")
private Integer isCount;
/** 创建时间 */
@Excel(name = "创建时间")
private Date createdAt;
@@ -137,4 +141,14 @@ public class SuperAdmin extends BaseEntity
{
this.updatedAt = updatedAt;
}
public Integer getIsCount()
{
return isCount;
}
public void setIsCount(Integer isCount)
{
this.isCount = isCount;
}
}

View File

@@ -1,7 +1,9 @@
package com.ruoyi.jarvis.mapper;
import com.ruoyi.jarvis.domain.OrderRows;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
@@ -27,6 +29,17 @@ public interface OrderRowsMapper
*/
public List<OrderRows> selectOrderRowsList(OrderRows orderRows);
/**
* 查询京粉订单列表支持日期范围过滤和排除特定unionId
*
* @param orderRows 京粉订单
* @param beginTime 开始时间
* @param endTime 结束时间
* @param excludeUnionIds 排除的unionId列表
* @return 京粉订单集合
*/
public List<OrderRows> selectOrderRowsListWithFilter(@Param("orderRows") OrderRows orderRows, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime, @Param("excludeUnionIds") List<Long> excludeUnionIds);
/**
* 新增京粉订单
*

View File

@@ -18,6 +18,14 @@ public interface SuperAdminMapper
*/
public SuperAdmin selectSuperAdminById(Long id);
/**
* 根据联盟ID查询超级管理员
*
* @param unionId 联盟ID
* @return 超级管理员
*/
public SuperAdmin selectSuperAdminByUnionId(Long unionId);
/**
* 查询超级管理员列表
*

View File

@@ -2,6 +2,7 @@ package com.ruoyi.jarvis.service;
import com.ruoyi.jarvis.domain.OrderRows;
import java.util.Date;
import java.util.List;
/**
@@ -27,6 +28,17 @@ public interface IOrderRowsService
*/
public List<OrderRows> selectOrderRowsList(OrderRows orderRows);
/**
* 查询京粉订单列表支持日期范围过滤和排除特定unionId
*
* @param orderRows 京粉订单
* @param beginTime 开始时间
* @param endTime 结束时间
* @param excludeUnionIds 排除的unionId列表
* @return 京粉订单集合
*/
public List<OrderRows> selectOrderRowsListWithFilter(OrderRows orderRows, Date beginTime, Date endTime, List<Long> excludeUnionIds);
/**
* 新增京粉订单
*

View File

@@ -8,7 +8,7 @@ import com.ruoyi.jarvis.domain.SuperAdmin;
*
* @author ruoyi
*/
public interface ISuperAdminService
public interface SuperAdminService
{
/**
* 查询超级管理员
@@ -57,4 +57,6 @@ public interface ISuperAdminService
* @return 结果
*/
public int deleteSuperAdminById(Long id);
SuperAdmin selectSuperAdminByUnionId(Long unionId);
}

View File

@@ -1,5 +1,6 @@
package com.ruoyi.jarvis.service.impl;
import java.util.Date;
import java.util.List;
import com.ruoyi.jarvis.domain.OrderRows;
@@ -44,6 +45,21 @@ public class OrderRowsServiceImpl implements IOrderRowsService
return orderRowsMapper.selectOrderRowsList(orderRows);
}
/**
* 查询京粉订单列表支持日期范围过滤和排除特定unionId
*
* @param orderRows 京粉订单
* @param beginTime 开始时间
* @param endTime 结束时间
* @param excludeUnionIds 排除的unionId列表
* @return 京粉订单集合
*/
@Override
public List<OrderRows> selectOrderRowsListWithFilter(OrderRows orderRows, Date beginTime, Date endTime, List<Long> excludeUnionIds)
{
return orderRowsMapper.selectOrderRowsListWithFilter(orderRows, beginTime, endTime, excludeUnionIds);
}
/**
* 新增京粉订单
*

View File

@@ -5,7 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.jarvis.mapper.SuperAdminMapper;
import com.ruoyi.jarvis.domain.SuperAdmin;
import com.ruoyi.jarvis.service.ISuperAdminService;
import com.ruoyi.jarvis.service.SuperAdminService;
/**
* 超级管理员Service业务层处理
@@ -13,7 +13,7 @@ import com.ruoyi.jarvis.service.ISuperAdminService;
* @author ruoyi
*/
@Service
public class SuperAdminServiceImpl implements ISuperAdminService
public class SuperAdminServiceImpl implements SuperAdminService
{
@Autowired
private SuperAdminMapper superAdminMapper;
@@ -89,4 +89,9 @@ public class SuperAdminServiceImpl implements ISuperAdminService
{
return superAdminMapper.deleteSuperAdminById(id);
}
@Override
public SuperAdmin selectSuperAdminByUnionId(Long unionId) {
return superAdminMapper.selectSuperAdminByUnionId(unionId);
}
}

View File

@@ -61,77 +61,141 @@
select id, order_id, parent_id, order_time, finish_time, modify_time, order_emt, plus, union_id, sku_id, sku_name, sku_num, sku_return_num, sku_frozen_num, price, commission_rate, sub_side_rate, subsidy_rate, final_rate, estimate_cos_price, estimate_fee, actual_cos_price, actual_fee, valid_code, trace_type, position_id, site_id, union_alias, pid, cid1, cid2, cid3, sub_union_id, union_tag, pop_id, ext1, pay_month, cp_act_id, union_role, gift_coupon_ocs_amount, gift_coupon_key, balance_ext, sign, pro_price_amount, rid, goods_info_id, express_status, channel_id, sku_tag, item_id, caller_item_id, order_tag from order_rows
</sql>
<select id="selectOrderRowsList" parameterType="OrderRows" resultMap="OrderRowsResult">
<include refid="selectOrderRowsVo"/>
<where>
<if test="orderId != null "> and order_id = #{orderId}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="orderTime != null "> and order_time = #{orderTime}</if>
<if test="finishTime != null "> and finish_time = #{finishTime}</if>
<if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
<if test="orderEmt != null "> and order_emt = #{orderEmt}</if>
<if test="plus != null "> and plus = #{plus}</if>
<if test="unionId != null "> and union_id = #{unionId}</if>
<if test="skuId != null "> and sku_id = #{skuId}</if>
<if test="skuName != null and skuName != ''"> and sku_name like concat('%', #{skuName}, '%')</if>
<if test="skuNum != null "> and sku_num = #{skuNum}</if>
<if test="skuReturnNum != null "> and sku_return_num = #{skuReturnNum}</if>
<if test="skuFrozenNum != null "> and sku_frozen_num = #{skuFrozenNum}</if>
<if test="price != null "> and price = #{price}</if>
<if test="commissionRate != null "> and commission_rate = #{commissionRate}</if>
<if test="subSideRate != null "> and sub_side_rate = #{subSideRate}</if>
<if test="subsidyRate != null "> and subsidy_rate = #{subsidyRate}</if>
<if test="finalRate != null "> and final_rate = #{finalRate}</if>
<if test="estimateCosPrice != null "> and estimate_cos_price = #{estimateCosPrice}</if>
<if test="estimateFee != null "> and estimate_fee = #{estimateFee}</if>
<if test="actualCosPrice != null "> and actual_cos_price = #{actualCosPrice}</if>
<if test="actualFee != null "> and actual_fee = #{actualFee}</if>
<if test="validCode != null "> and valid_code = #{validCode}</if>
<!-- 支持validCode多值查询 -->
<if test="validCodes != null and validCodes.length > 0">
and valid_code in
<foreach item="item" index="index" collection="validCodes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="traceType != null "> and trace_type = #{traceType}</if>
<if test="positionId != null "> and position_id = #{positionId}</if>
<if test="siteId != null "> and site_id = #{siteId}</if>
<if test="unionAlias != null and unionAlias != ''"> and union_alias like concat('%', #{unionAlias}, '%')</if>
<if test="pid != null and pid != ''"> and pid = #{pid}</if>
<if test="cid1 != null "> and cid1 = #{cid1}</if>
<if test="cid2 != null "> and cid2 = #{cid2}</if>
<if test="cid3 != null "> and cid3 = #{cid3}</if>
<if test="subUnionId != null and subUnionId != ''"> and sub_union_id = #{subUnionId}</if>
<if test="unionTag != null and unionTag != ''"> and union_tag = #{unionTag}</if>
<if test="popId != null "> and pop_id = #{popId}</if>
<if test="ext1 != null and ext1 != ''"> and ext1 = #{ext1}</if>
<if test="payMonth != null and payMonth != ''"> and pay_month = #{payMonth}</if>
<if test="cpActId != null "> and cp_act_id = #{cpActId}</if>
<if test="unionRole != null "> and union_role = #{unionRole}</if>
<if test="giftCouponOcsAmount != null "> and gift_coupon_ocs_amount = #{giftCouponOcsAmount}</if>
<if test="giftCouponKey != null and giftCouponKey != ''"> and gift_coupon_key = #{giftCouponKey}</if>
<if test="balanceExt != null and balanceExt != ''"> and balance_ext = #{balanceExt}</if>
<if test="sign != null and sign != ''"> and sign = #{sign}</if>
<if test="proPriceAmount != null "> and pro_price_amount = #{proPriceAmount}</if>
<if test="rid != null "> and rid = #{rid}</if>
<if test="goodsInfoId != null "> and goods_info_id = #{goodsInfoId}</if>
<if test="expressStatus != null "> and express_status = #{expressStatus}</if>
<if test="channelId != null "> and channel_id = #{channelId}</if>
<if test="skuTag != null and skuTag != ''"> and sku_tag = #{skuTag}</if>
<if test="itemId != null and itemId != ''"> and item_id = #{itemId}</if>
<if test="callerItemId != null and callerItemId != ''"> and caller_item_id = #{callerItemId}</if>
<if test="orderTag != null and orderTag != ''"> and order_tag = #{orderTag}</if>
</where>
order by order_time desc
</select>
<select id="selectOrderRowsList" parameterType="OrderRows" resultMap="OrderRowsResult">
<include refid="selectOrderRowsVo"/>
<where>
<if test="orderId != null "> and order_id = #{orderId}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="orderTime != null "> and order_time = #{orderTime}</if>
<if test="finishTime != null "> and finish_time = #{finishTime}</if>
<if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
<if test="orderEmt != null "> and order_emt = #{orderEmt}</if>
<if test="plus != null "> and plus = #{plus}</if>
<if test="unionId != null "> and union_id = #{unionId}</if>
<if test="skuId != null "> and sku_id = #{skuId}</if>
<if test="skuName != null and skuName != ''"> and sku_name like concat('%', #{skuName}, '%')</if>
<if test="skuNum != null "> and sku_num = #{skuNum}</if>
<if test="skuReturnNum != null "> and sku_return_num = #{skuReturnNum}</if>
<if test="skuFrozenNum != null "> and sku_frozen_num = #{skuFrozenNum}</if>
<if test="price != null "> and price = #{price}</if>
<if test="commissionRate != null "> and commission_rate = #{commissionRate}</if>
<if test="subSideRate != null "> and sub_side_rate = #{subSideRate}</if>
<if test="subsidyRate != null "> and subsidy_rate = #{subsidyRate}</if>
<if test="finalRate != null "> and final_rate = #{finalRate}</if>
<if test="estimateCosPrice != null "> and estimate_cos_price = #{estimateCosPrice}</if>
<if test="estimateFee != null "> and estimate_fee = #{estimateFee}</if>
<if test="actualCosPrice != null "> and actual_cos_price = #{actualCosPrice}</if>
<if test="actualFee != null "> and actual_fee = #{actualFee}</if>
<if test="validCode != null "> and valid_code = #{validCode}</if>
<if test="validCodes != null and validCodes.length &gt; 0">
and valid_code in
<foreach item="item" index="index" collection="validCodes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="traceType != null "> and trace_type = #{traceType}</if>
<if test="positionId != null "> and position_id = #{positionId}</if>
<if test="siteId != null "> and site_id = #{siteId}</if>
<if test="unionAlias != null and unionAlias != ''"> and union_alias like concat('%', #{unionAlias}, '%')</if>
<if test="pid != null and pid != ''"> and pid = #{pid}</if>
<if test="cid1 != null "> and cid1 = #{cid1}</if>
<if test="cid2 != null "> and cid2 = #{cid2}</if>
<if test="cid3 != null "> and cid3 = #{cid3}</if>
<if test="subUnionId != null and subUnionId != ''"> and sub_union_id = #{subUnionId}</if>
<if test="unionTag != null and unionTag != ''"> and union_tag = #{unionTag}</if>
<if test="popId != null "> and pop_id = #{popId}</if>
<if test="ext1 != null and ext1 != ''"> and ext1 = #{ext1}</if>
<if test="payMonth != null and payMonth != ''"> and pay_month = #{payMonth}</if>
<if test="cpActId != null "> and cp_act_id = #{cpActId}</if>
<if test="unionRole != null "> and union_role = #{unionRole}</if>
<if test="giftCouponOcsAmount != null "> and gift_coupon_ocs_amount = #{giftCouponOcsAmount}</if>
<if test="giftCouponKey != null and giftCouponKey != ''"> and gift_coupon_key = #{giftCouponKey}</if>
<if test="balanceExt != null and balanceExt != ''"> and balance_ext = #{balanceExt}</if>
<if test="sign != null and sign != ''"> and sign = #{sign}</if>
<if test="proPriceAmount != null "> and pro_price_amount = #{proPriceAmount}</if>
<if test="rid != null "> and rid = #{rid}</if>
<if test="goodsInfoId != null "> and goods_info_id = #{goodsInfoId}</if>
<if test="expressStatus != null "> and express_status = #{expressStatus}</if>
<if test="channelId != null "> and channel_id = #{channelId}</if>
<if test="skuTag != null and skuTag != ''"> and sku_tag = #{skuTag}</if>
<if test="itemId != null and itemId != ''"> and item_id = #{itemId}</if>
<if test="callerItemId != null and callerItemId != ''"> and caller_item_id = #{callerItemId}</if>
<if test="orderTag != null and orderTag != ''"> and order_tag = #{orderTag}</if>
</where>
order by order_time desc
</select>
<select id="selectOrderRowsById" parameterType="String" resultMap="OrderRowsResult">
<include refid="selectOrderRowsVo"/>
where id = #{id}
</select>
<select id="selectOrderRowsListWithFilter" resultMap="OrderRowsResult">
<include refid="selectOrderRowsVo"/>
<where>
<if test="orderRows.orderId != null "> and order_id = #{orderRows.orderId}</if>
<if test="orderRows.parentId != null "> and parent_id = #{orderRows.parentId}</if>
<if test="orderRows.orderTime != null "> and order_time = #{orderRows.orderTime}</if>
<if test="orderRows.finishTime != null "> and finish_time = #{orderRows.finishTime}</if>
<if test="orderRows.modifyTime != null "> and modify_time = #{orderRows.modifyTime}</if>
<if test="orderRows.orderEmt != null "> and order_emt = #{orderRows.orderEmt}</if>
<if test="orderRows.plus != null "> and plus = #{orderRows.plus}</if>
<if test="orderRows.unionId != null "> and union_id = #{orderRows.unionId}</if>
<if test="orderRows.skuId != null "> and sku_id = #{orderRows.skuId}</if>
<if test="orderRows.skuName != null and orderRows.skuName != ''"> and sku_name like concat('%', #{orderRows.skuName}, '%')</if>
<if test="orderRows.skuNum != null "> and sku_num = #{orderRows.skuNum}</if>
<if test="orderRows.skuReturnNum != null "> and sku_return_num = #{orderRows.skuReturnNum}</if>
<if test="orderRows.skuFrozenNum != null "> and sku_frozen_num = #{orderRows.skuFrozenNum}</if>
<if test="orderRows.price != null "> and price = #{orderRows.price}</if>
<if test="orderRows.commissionRate != null "> and commission_rate = #{orderRows.commissionRate}</if>
<if test="orderRows.subSideRate != null "> and sub_side_rate = #{orderRows.subSideRate}</if>
<if test="orderRows.subsidyRate != null "> and subsidy_rate = #{orderRows.subsidyRate}</if>
<if test="orderRows.finalRate != null "> and final_rate = #{orderRows.finalRate}</if>
<if test="orderRows.estimateCosPrice != null "> and estimate_cos_price = #{orderRows.estimateCosPrice}</if>
<if test="orderRows.estimateFee != null "> and estimate_fee = #{orderRows.estimateFee}</if>
<if test="orderRows.actualCosPrice != null "> and actual_cos_price = #{orderRows.actualCosPrice}</if>
<if test="orderRows.actualFee != null "> and actual_fee = #{orderRows.actualFee}</if>
<if test="orderRows.validCode != null "> and valid_code = #{orderRows.validCode}</if>
<if test="orderRows.traceType != null "> and trace_type = #{orderRows.traceType}</if>
<if test="orderRows.positionId != null "> and position_id = #{orderRows.positionId}</if>
<if test="orderRows.siteId != null "> and site_id = #{orderRows.siteId}</if>
<if test="orderRows.unionAlias != null and orderRows.unionAlias != ''"> and union_alias like concat('%', #{orderRows.unionAlias}, '%')</if>
<if test="orderRows.pid != null and orderRows.pid != ''"> and pid = #{orderRows.pid}</if>
<if test="orderRows.cid1 != null "> and cid1 = #{orderRows.cid1}</if>
<if test="orderRows.cid2 != null "> and cid2 = #{orderRows.cid2}</if>
<if test="orderRows.cid3 != null "> and cid3 = #{orderRows.cid3}</if>
<if test="orderRows.subUnionId != null and orderRows.subUnionId != ''"> and sub_union_id = #{orderRows.subUnionId}</if>
<if test="orderRows.unionTag != null and orderRows.unionTag != ''"> and union_tag = #{orderRows.unionTag}</if>
<if test="orderRows.popId != null "> and pop_id = #{orderRows.popId}</if>
<if test="orderRows.ext1 != null and orderRows.ext1 != ''"> and ext1 = #{orderRows.ext1}</if>
<if test="orderRows.payMonth != null and orderRows.payMonth != ''"> and pay_month = #{orderRows.payMonth}</if>
<if test="orderRows.cpActId != null "> and cp_act_id = #{orderRows.cpActId}</if>
<if test="orderRows.unionRole != null "> and union_role = #{orderRows.unionRole}</if>
<if test="orderRows.giftCouponOcsAmount != null "> and gift_coupon_ocs_amount = #{orderRows.giftCouponOcsAmount}</if>
<if test="orderRows.giftCouponKey != null and orderRows.giftCouponKey != ''"> and gift_coupon_key = #{orderRows.giftCouponKey}</if>
<if test="orderRows.balanceExt != null and orderRows.balanceExt != ''"> and balance_ext = #{orderRows.balanceExt}</if>
<if test="orderRows.sign != null and orderRows.sign != ''"> and sign = #{orderRows.sign}</if>
<if test="orderRows.proPriceAmount != null "> and pro_price_amount = #{orderRows.proPriceAmount}</if>
<if test="orderRows.rid != null "> and rid = #{orderRows.rid}</if>
<if test="orderRows.goodsInfoId != null "> and goods_info_id = #{orderRows.goodsInfoId}</if>
<if test="orderRows.expressStatus != null "> and express_status = #{orderRows.expressStatus}</if>
<if test="orderRows.channelId != null "> and channel_id = #{orderRows.channelId}</if>
<if test="orderRows.skuTag != null and orderRows.skuTag != ''"> and sku_tag = #{orderRows.skuTag}</if>
<if test="orderRows.itemId != null and orderRows.itemId != ''"> and item_id = #{orderRows.itemId}</if>
<if test="orderRows.callerItemId != null and orderRows.callerItemId != ''"> and caller_item_id = #{orderRows.callerItemId}</if>
<if test="orderRows.orderTag != null and orderRows.orderTag != ''"> and order_tag = #{orderRows.orderTag}</if>
<if test="beginTime != null"> and order_time &gt;= #{beginTime}</if>
<if test="endTime != null"> and order_time &lt;= #{endTime}</if>
<if test="excludeUnionIds != null and excludeUnionIds.size() &gt; 0">
and union_id not in
<foreach item="unionId" collection="excludeUnionIds" open="(" separator="," close=")">
#{unionId}
</foreach>
</if>
</where>
order by order_time desc
</select>
<insert id="insertOrderRows" parameterType="OrderRows">
insert into order_rows
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -187,7 +251,7 @@
<if test="itemId != null and itemId != ''">item_id,</if>
<if test="callerItemId != null and callerItemId != ''">caller_item_id,</if>
<if test="orderTag != null and orderTag != ''">order_tag,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="orderId != null">#{orderId},</if>
@@ -241,7 +305,7 @@
<if test="itemId != null and itemId != ''">#{itemId},</if>
<if test="callerItemId != null and callerItemId != ''">#{callerItemId},</if>
<if test="orderTag != null and orderTag != ''">#{orderTag},</if>
</trim>
</trim>
</insert>
<update id="updateOrderRows" parameterType="OrderRows">

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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.ruoyi.jarvis.mapper.SuperAdminMapper">
@@ -10,12 +10,13 @@
<result property="appKey" column="app_key"/>
<result property="secretKey" column="secret_key"/>
<result property="isActive" column="is_active"/>
<result property="isCount" column="is_count"/>
<result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/>
</resultMap>
<sql id="selectSuperAdminVo">
select id, wxid, name, union_id, app_key, secret_key, is_active, created_at, updated_at from super_admin
select id, wxid, name, union_id, app_key, secret_key, is_active, is_count, created_at, updated_at from super_admin
</sql>
<select id="selectSuperAdminList" parameterType="SuperAdmin" resultMap="SuperAdminResult">
@@ -23,7 +24,7 @@
<where>
<if test="wxid != null and wxid != ''"> and wxid = #{wxid}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
<if test="unionId != null"> and union_id = #{unionId}</if>
<if test="appKey != null and appKey != ''"> and app_key = #{appKey}</if>
<if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey}</if>
<if test="isActive != null "> and is_active = #{isActive}</if>
@@ -36,12 +37,17 @@
where id = #{id}
</select>
<select id="selectSuperAdminByUnionId" parameterType="Long" resultMap="SuperAdminResult">
<include refid="selectSuperAdminVo"/>
where union_id = #{unionId}
</select>
<insert id="insertSuperAdmin" parameterType="SuperAdmin" useGeneratedKeys="true" keyProperty="id">
insert into super_admin
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wxid != null and wxid != ''">wxid,</if>
<if test="name != null and name != ''">name,</if>
<if test="unionId != null and unionId != ''">union_id,</if>
<if test="unionId != null">union_id,</if>
<if test="appKey != null and appKey != ''">app_key,</if>
<if test="secretKey != null and secretKey != ''">secret_key,</if>
<if test="isActive != null">is_active,</if>
@@ -51,7 +57,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wxid != null and wxid != ''">#{wxid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="unionId != null and unionId != ''">#{unionId},</if>
<if test="unionId != null">#{unionId},</if>
<if test="appKey != null and appKey != ''">#{appKey},</if>
<if test="secretKey != null and secretKey != ''">#{secretKey},</if>
<if test="isActive != null">#{isActive},</if>
@@ -65,10 +71,11 @@
<trim prefix="SET" suffixOverrides=",">
<if test="wxid != null and wxid != ''">wxid = #{wxid},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="unionId != null and unionId != ''">union_id = #{unionId},</if>
<if test="unionId != null">union_id = #{unionId},</if>
<if test="appKey != null and appKey != ''">app_key = #{appKey},</if>
<if test="secretKey != null and secretKey != ''">secret_key = #{secretKey},</if>
<if test="isActive != null">is_active = #{isActive},</if>
<if test="isCount != null">is_count = #{isCount},</if>
updated_at = now(),
</trim>
where id = #{id}