Commit 342bf56e by guanchen

添加结算相关的表

parent 45c2da63
......@@ -33,8 +33,6 @@ public class PartnerApplication extends SpringBootServletInitializer {
logger.error(e.getMessage(), e);
}
}
} catch (Exception e) {
logger.error("PartnerApplication>>服务启动失败", e);
e.printStackTrace();
......
package com.lanren.huhu.partner.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanren.huhu.partner.domain.AgentBankCard;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AgentBankCardMapper extends BaseMapper<AgentBankCard> {
int updateBatch(List<AgentBankCard> list);
int batchInsert(@Param("list") List<AgentBankCard> list);
int insertOrUpdate(AgentBankCard record);
int insertOrUpdateSelective(AgentBankCard record);
}
\ No newline at end of file
package com.lanren.huhu.partner.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanren.huhu.partner.domain.AgentSalary;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AgentSalaryMapper extends BaseMapper<AgentSalary> {
int updateBatch(List<AgentSalary> list);
int batchInsert(@Param("list") List<AgentSalary> list);
int insertOrUpdate(AgentSalary record);
int insertOrUpdateSelective(AgentSalary record);
}
\ No newline at end of file
package com.lanren.huhu.partner.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanren.huhu.partner.domain.PartnerAccountLog;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface PartnerAccountLogMapper extends BaseMapper<PartnerAccountLog> {
int updateBatch(List<PartnerAccountLog> list);
int batchInsert(@Param("list") List<PartnerAccountLog> list);
int insertOrUpdate(PartnerAccountLog record);
int insertOrUpdateSelective(PartnerAccountLog record);
}
\ No newline at end of file
package com.lanren.huhu.partner.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanren.huhu.partner.domain.PartnerReward;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface PartnerRewardMapper extends BaseMapper<PartnerReward> {
int updateBatch(List<PartnerReward> list);
int batchInsert(@Param("list") List<PartnerReward> list);
int insertOrUpdate(PartnerReward record);
int insertOrUpdateSelective(PartnerReward record);
}
\ No newline at end of file
package com.lanren.huhu.partner.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
@Data
@TableName(value = "agent_bank_card")
public class AgentBankCard implements Serializable {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 代理商id
*/
@TableField(value = "agent_id")
private Integer agentId;
/**
* 用户id
*/
@TableField(value = "user_id")
private Integer userId;
/**
* 姓名
*/
@TableField(value = "real_name")
private String realName;
/**
* 用户名称
*/
@TableField(value = "user_phone")
private String userPhone;
/**
* 币种编号 CNY人民币
*/
@TableField(value = "currency_code")
private String currencyCode;
/**
* 绑卡类型 个人or企业 10个人 20企业
*/
@TableField(value = "bank_type")
private Integer bankType;
/**
* 银行code
*/
@TableField(value = "bank_code")
private String bankCode;
/**
* 银行名称
*/
@TableField(value = "bank_name")
private String bankName;
/**
* 开户名称 个人姓名 企业 公司名称
*/
@TableField(value = "bank_account")
private String bankAccount;
/**
* 银行卡号
*/
@TableField(value = "bank_card_number")
private String bankCardNumber;
/**
* 支行名称
*/
@TableField(value = "branch_name")
private String branchName;
/**
* 银行所属省份
*/
@TableField(value = "bank_province")
private Integer bankProvince;
/**
* 银行所属城市
*/
@TableField(value = "bank_city")
private Integer bankCity;
/**
* 银行地址信息 省市
*/
@TableField(value = "bank_address")
private String bankAddress;
/**
* 银行卡状态 默认100正常 99 禁用
*/
@TableField(value = "bank_state")
private Integer bankState;
/**
* 证件号 身份证
*/
@TableField(value = "idcard_no")
private String idcardNo;
/**
* 身份证正面
*/
@TableField(value = "idcard_pic_front")
private String idcardPicFront;
/**
* 身份证反面
*/
@TableField(value = "idcard_pic_back")
private String idcardPicBack;
/**
* 营业执照或手持身份证照片
*/
@TableField(value = "business_license")
private String businessLicense;
/**
* 企业税号
*/
@TableField(value = "tax_number")
private String taxNumber;
/**
* 公司地址
*/
@TableField(value = "company_address")
private String companyAddress;
/**
* 公司联系电话
*/
@TableField(value = "company_phone")
private String companyPhone;
/**
* 税起征点 大于多少开始计算税
*/
@TableField(value = "quota_node")
private BigDecimal quotaNode;
/**
* 税率
*/
@TableField(value = "tax_rate")
private BigDecimal taxRate;
/**
* 开始使用时间
*/
@TableField(value = "start_time")
private Integer startTime;
/**
* 创建时间
*/
@TableField(value = "create_time")
private LocalDateTime createTime;
/**
* 创建时间
*/
@TableField(value = "created_at")
private Integer createdAt;
/**
* 修改时间
*/
@TableField(value = "updated_at")
private Integer updatedAt;
/**
* 删除信息
*/
@TableField(value = "deleted_at")
private Integer deletedAt;
/**
* 默认值 100 默认 99否
*/
@TableField(value = "is_default")
private Integer isDefault;
private static final long serialVersionUID = 1L;
public static final String COL_AGENT_ID = "agent_id";
public static final String COL_USER_ID = "user_id";
public static final String COL_REAL_NAME = "real_name";
public static final String COL_USER_PHONE = "user_phone";
public static final String COL_CURRENCY_CODE = "currency_code";
public static final String COL_BANK_TYPE = "bank_type";
public static final String COL_BANK_CODE = "bank_code";
public static final String COL_BANK_NAME = "bank_name";
public static final String COL_BANK_ACCOUNT = "bank_account";
public static final String COL_BANK_CARD_NUMBER = "bank_card_number";
public static final String COL_BRANCH_NAME = "branch_name";
public static final String COL_BANK_PROVINCE = "bank_province";
public static final String COL_BANK_CITY = "bank_city";
public static final String COL_BANK_ADDRESS = "bank_address";
public static final String COL_BANK_STATE = "bank_state";
public static final String COL_IDCARD_NO = "idcard_no";
public static final String COL_IDCARD_PIC_FRONT = "idcard_pic_front";
public static final String COL_IDCARD_PIC_BACK = "idcard_pic_back";
public static final String COL_BUSINESS_LICENSE = "business_license";
public static final String COL_TAX_NUMBER = "tax_number";
public static final String COL_COMPANY_ADDRESS = "company_address";
public static final String COL_COMPANY_PHONE = "company_phone";
public static final String COL_QUOTA_NODE = "quota_node";
public static final String COL_TAX_RATE = "tax_rate";
public static final String COL_START_TIME = "start_time";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_CREATED_AT = "created_at";
public static final String COL_UPDATED_AT = "updated_at";
public static final String COL_DELETED_AT = "deleted_at";
public static final String COL_IS_DEFAULT = "is_default";
}
\ No newline at end of file
package com.lanren.huhu.partner.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
@Data
@TableName(value = "agent_salary")
public class AgentSalary implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 代理商用户ID
*/
@TableField(value = "user_id")
private Integer userId;
/**
* 代理商ID
*/
@TableField(value = "agent_id")
private Integer agentId;
/**
* 月份
*/
@TableField(value = "month")
private String month;
/**
* 总金额
*/
@TableField(value = "balance")
private BigDecimal balance;
/**
* 开卡奖励金额
*/
@TableField(value = "opencard_balance")
private BigDecimal opencardBalance;
/**
* 充值奖励金额
*/
@TableField(value = "recharge_balance")
private BigDecimal rechargeBalance;
/**
* 购买VIP会员奖励金额
*/
@TableField(value = "upgrade_balance")
private BigDecimal upgradeBalance;
/**
* 购买超级VIP会员奖励金额
*/
@TableField(value = "upgrade_super_balance")
private BigDecimal upgradeSuperBalance;
/**
* 缴税金额
*/
@TableField(value = "tax_balance")
private BigDecimal taxBalance;
/**
* 姓名或许公司名称
*/
@TableField(value = "bank_account")
private String bankAccount;
/**
* 卡号
*/
@TableField(value = "bank_card_number")
private String bankCardNumber;
/**
* 银行名称
*/
@TableField(value = "bank_name")
private String bankName;
/**
* 支行名称
*/
@TableField(value = "branch_name")
private String branchName;
/**
* 关联的银行绑定id
*/
@TableField(value = "reference_id")
private Long referenceId;
/**
* 状态 10待提现 20已提现
*/
@TableField(value = "status")
private Integer status;
/**
* 创建时间
*/
@TableField(value = "create_time")
private LocalDateTime createTime;
/**
* 提现时间
*/
@TableField(value = "modify_time")
private LocalDateTime modifyTime;
@TableField(value = "created_at")
private Long createdAt;
@TableField(value = "updated_at")
private Long updatedAt;
@TableField(value = "deleted_at")
private Long deletedAt;
private static final long serialVersionUID = 1L;
public static final String COL_USER_ID = "user_id";
public static final String COL_AGENT_ID = "agent_id";
public static final String COL_MONTH = "month";
public static final String COL_BALANCE = "balance";
public static final String COL_OPENCARD_BALANCE = "opencard_balance";
public static final String COL_RECHARGE_BALANCE = "recharge_balance";
public static final String COL_UPGRADE_BALANCE = "upgrade_balance";
public static final String COL_UPGRADE_SUPER_BALANCE = "upgrade_super_balance";
public static final String COL_TAX_BALANCE = "tax_balance";
public static final String COL_BANK_ACCOUNT = "bank_account";
public static final String COL_BANK_CARD_NUMBER = "bank_card_number";
public static final String COL_BANK_NAME = "bank_name";
public static final String COL_BRANCH_NAME = "branch_name";
public static final String COL_REFERENCE_ID = "reference_id";
public static final String COL_STATUS = "status";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_MODIFY_TIME = "modify_time";
public static final String COL_CREATED_AT = "created_at";
public static final String COL_UPDATED_AT = "updated_at";
public static final String COL_DELETED_AT = "deleted_at";
}
\ No newline at end of file
package com.lanren.huhu.partner.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
@Data
@TableName(value = "partner_account_log")
public class PartnerAccountLog implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
*/
@TableField(value = "user_id")
private Integer userId;
/**
* 年份
*/
@TableField(value = "yeartime")
private Integer yeartime;
/**
* 月份
*/
@TableField(value = "monthtime")
private Integer monthtime;
/**
* 每日日期
*/
@TableField(value = "daytime")
private Integer daytime;
/**
* 变化类型 10 微信 20支付宝 30 银联 40 银行卡 、50呼呼结算、60首月奖励 、70税费、80平台服务费、90平台扣除
*/
@TableField(value = "type")
private Integer type;
/**
* 变化的金额 进账为正数 出账为负数
*/
@TableField(value = "change_num")
private BigDecimal changeNum;
/**
* 变化的之后的金额
*/
@TableField(value = "changed_amount")
private BigDecimal changedAmount;
/**
* 变更的当前时间戳 秒级
*/
@TableField(value = "change_time")
private Integer changeTime;
/**
* 状态 20是已经处理(充值后者减值,10是待处理)
*/
@TableField(value = "pay_state")
private Integer payState;
/**
* 支付平台 系统hupay、微信wxpay、支付宝 alipay 、银联支付 unionpay 、银行卡cardpay
*/
@TableField(value = "pay_platform")
private String payPlatform;
/**
* 支付类型,10充值,20消费,30提现,40退款, 50合伙人奖励,60充值奖励,70 激活现金,80提现回退,90系统赠送,100系统扣除,110呼呼按月结算,120首月奖励
*/
@TableField(value = "pay_type")
private Boolean payType;
/**
* 类型描述 与pay_type 对应
*/
@TableField(value = "pay_remark")
private String payRemark;
/**
* 文字描述
*/
@TableField(value = "pay_info")
private String payInfo;
/**
* 参考ID 就是发生变化的订单id 支付 充值 提现、奖励的主键id
*/
@TableField(value = "reference_id")
private String referenceId;
@TableField(value = "create_time")
private LocalDateTime createTime;
@TableField(value = "modify_time")
private LocalDateTime modifyTime;
private static final long serialVersionUID = 1L;
public static final String COL_USER_ID = "user_id";
public static final String COL_YEARTIME = "yeartime";
public static final String COL_MONTHTIME = "monthtime";
public static final String COL_DAYTIME = "daytime";
public static final String COL_TYPE = "type";
public static final String COL_CHANGE_NUM = "change_num";
public static final String COL_CHANGED_AMOUNT = "changed_amount";
public static final String COL_CHANGE_TIME = "change_time";
public static final String COL_PAY_STATE = "pay_state";
public static final String COL_PAY_PLATFORM = "pay_platform";
public static final String COL_PAY_TYPE = "pay_type";
public static final String COL_PAY_REMARK = "pay_remark";
public static final String COL_PAY_INFO = "pay_info";
public static final String COL_REFERENCE_ID = "reference_id";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_MODIFY_TIME = "modify_time";
}
\ No newline at end of file
package com.lanren.huhu.partner.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
@Data
@TableName(value = "partner_reward")
public class PartnerReward implements Serializable {
/**
* ID序号
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
*/
@TableField(value = "user_id")
private Integer userId;
/**
* 用户是否是超级
*/
@TableField(value = "user_is_super")
private Integer userIsSuper;
/**
* 用户合伙人级别 普通10 高级20
*/
@TableField(value = "user_partner_level")
private Integer userPartnerLevel;
/**
* 合伙人奖励类型 60 用户在线充值 70 升高开户充值,80邀请奖励,90下单奖励,100购买超级VIP会员,110购物奖励,120分享赚奖励
*/
@TableField(value = "reward_type")
private Integer rewardType;
/**
* 状态 100待结算 120 已结算
*/
@TableField(value = "reward_status")
private Integer rewardStatus;
/**
* 分红金额
*/
@TableField(value = "commission_acount")
private BigDecimal commissionAcount;
/**
* 分红比例
*/
@TableField(value = "commission_rate")
private BigDecimal commissionRate;
/**
* order id
*/
@TableField(value = "reference_id")
private String referenceId;
/**
* 用户充值时间
*/
@TableField(value = "recharge_time")
private LocalDateTime rechargeTime;
/**
* 面值
*/
@TableField(value = "price")
private BigDecimal price;
/**
* 奖励基数(充值支付金额 或 淘宝京东原始佣金)
*/
@TableField(value = "cash")
private BigDecimal cash;
/**
* 源用户id
*/
@TableField(value = "source_user_id")
private Integer sourceUserId;
/**
* 源用户邀请人id
*/
@TableField(value = "invite_user_id")
private Integer inviteUserId;
/**
* 源用户邀请人级别 普通10 高级20
*/
@TableField(value = "invite_user_level")
private Integer inviteUserLevel;
/**
* 源原用户邀请人是否超级 1是 0否
*/
@TableField(value = "invite_user_is_super")
private Integer inviteUserIsSuper;
@TableField(value = "created_at")
private Long createdAt;
@TableField(value = "updated_at")
private Long updatedAt;
/**
* 创建时间
*/
@TableField(value = "create_time")
private LocalDateTime createTime;
/**
* 是直接还是间接邀请人 10直接 20间接 30自己
*/
@TableField(value = "source_type")
private Integer sourceType;
/**
* 第?笔下单激活奖励
*/
@TableField(value = "reward_times")
private Integer rewardTimes;
/**
* 结算状态 100在路上 200预结算 300已结算 -100在路上已失效 -200预结算已失效 -300已结算扣回
*/
@TableField(value = "settle_state")
private Integer settleState;
/**
* 商品id
*/
@TableField(value = "goods_id")
private String goodsId;
/**
* 标题
*/
@TableField(value = "title")
private String title;
/**
* 订单类型
*/
@TableField(value = "order_type")
private String orderType;
/**
* 订单号
*/
@TableField(value = "order_sn")
private String orderSn;
/**
* 子订单号
*/
@TableField(value = "sub_order_sn")
private String subOrderSn;
private static final long serialVersionUID = 1L;
public static final String COL_USER_ID = "user_id";
public static final String COL_USER_IS_SUPER = "user_is_super";
public static final String COL_USER_PARTNER_LEVEL = "user_partner_level";
public static final String COL_REWARD_TYPE = "reward_type";
public static final String COL_REWARD_STATUS = "reward_status";
public static final String COL_COMMISSION_ACOUNT = "commission_acount";
public static final String COL_COMMISSION_RATE = "commission_rate";
public static final String COL_REFERENCE_ID = "reference_id";
public static final String COL_RECHARGE_TIME = "recharge_time";
public static final String COL_PRICE = "price";
public static final String COL_CASH = "cash";
public static final String COL_SOURCE_USER_ID = "source_user_id";
public static final String COL_INVITE_USER_ID = "invite_user_id";
public static final String COL_INVITE_USER_LEVEL = "invite_user_level";
public static final String COL_INVITE_USER_IS_SUPER = "invite_user_is_super";
public static final String COL_CREATED_AT = "created_at";
public static final String COL_UPDATED_AT = "updated_at";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_SOURCE_TYPE = "source_type";
public static final String COL_REWARD_TIMES = "reward_times";
public static final String COL_SETTLE_STATE = "settle_state";
public static final String COL_GOODS_ID = "goods_id";
public static final String COL_TITLE = "title";
public static final String COL_ORDER_TYPE = "order_type";
public static final String COL_ORDER_SN = "order_sn";
public static final String COL_SUB_ORDER_SN = "sub_order_sn";
}
\ No newline at end of file
package com.lanren.huhu.partner.manager; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.lanren.huhu.partner.domain.OrderTaobaoJdCommission;import com.lanren.huhu.partner.service.OrderTaobaoJdCommissionService;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component; /** * @author houseme * @date 2019-07-01 14:45 * @Project partner * @Package com.lanren.huhu.partner.manager * @File: OrderTaobaoJdCommissionManager */@Componentpublic class OrderTaobaoJdCommissionManager { private static Logger logger = LoggerFactory.getLogger(OrderTaobaoJdCommissionManager.class); @Autowired private OrderTaobaoJdCommissionService orderTaobaoJdCommissionService; public void one() { QueryWrapper<OrderTaobaoJdCommission> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("order_sn", "511853890422935938 "); System.out.println(queryWrapper); System.out.println(orderTaobaoJdCommissionService.getOne(queryWrapper)); }}
\ No newline at end of file
package com.lanren.huhu.partner.manager; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.lanren.huhu.partner.domain.OrderTaobaoJdCommission;import com.lanren.huhu.partner.service.OrderTaobaoJdCommissionService;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component; /** * @author houseme * @date 2019-07-01 14:45 * @Project partner * @Package com.lanren.huhu.partner.manager * @File: OrderTaobaoJdCommissionManager */@Componentpublic class OrderTaobaoJdCommissionManager { private static Logger logger = LoggerFactory.getLogger(OrderTaobaoJdCommissionManager.class); @Autowired private OrderTaobaoJdCommissionService orderTaobaoJdCommissionService; public void one() { QueryWrapper<OrderTaobaoJdCommission> queryWrapper = new QueryWrapper<OrderTaobaoJdCommission>(); queryWrapper.eq("order_sn", "511853890422935938 "); System.out.println(queryWrapper); System.out.println(orderTaobaoJdCommissionService.getOne(queryWrapper)); }}
\ No newline at end of file
......
......@@ -60,7 +60,7 @@ public class AgentRewardQueueTask {
logger.info("run AgentRewardQueueTask done");
}
public void runConsume() {
private void runConsume() {
ListOperations<String, String> ops = stringRedisTemplate.opsForList();
while(null != ops && null != ops.size(AGENT_REWARD_QUEUE_KEY) && ops.size(AGENT_REWARD_QUEUE_KEY) > 0L) {
String msg = "";
......@@ -77,7 +77,6 @@ public class AgentRewardQueueTask {
} finally{
LockUtil.unlock(DISTRIBUTE_REDIS_LOCK_KEY);
}
logger.info("msg is {}", msg);
JSONObject json = JSON.parseObject(msg);
AgentRewardMessage message = json.toJavaObject(AgentRewardMessage.class);
......@@ -96,18 +95,18 @@ public class AgentRewardQueueTask {
int rewardType = message.getRewardType();
Map<Integer, BigDecimal> rateMap;
if (!AGENT_RATE_MAP.keySet().contains(rewardType)) {
logger.error("未知的奖励类型 跳过不处理: {}", message);
logger.info("未知的奖励类型 跳过不处理: {}", message);
return;
} else {
rateMap = AGENT_RATE_MAP.get(rewardType);
}
UserAgent userAgent = userAgentService.getOneByAgentId(message.getAgentId());
if (userAgent == null) {
logger.error("代理商id: {} 不存在, 跳过不处理", message);
logger.info("代理商id: {} 不存在, 跳过不处理", message);
return;
}
if (userAgent.getAgentLevel() != AGENT_LEVEL_4) {
logger.error("代理商id: {} 不是城市代理, 跳过不处理", message);
logger.info("代理商id: {} 不是城市代理, 跳过不处理", message);
return;
}
User user = userService.getRelationByUserId(userAgent.getUserId());
......@@ -193,11 +192,7 @@ public class AgentRewardQueueTask {
agentReward.setSourceOrder(message.getReferenceId());
agentReward.setSourceUserLevel(sourceUserLevel);
agentReward.setCreatedAt(System.currentTimeMillis() / 1000L);
if (agentRewardService.save(agentReward)) {
return true;
} else {
return false;
}
return agentRewardService.save(agentReward);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return false;
......
package com.lanren.huhu.partner.schedule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* @author chen
* @title: PartnerSettleTask
* @projectName partner
* @description: TODO
* @package com.lanren.huhu.partner.schedule
* @date 2019-07-02 15:45
*/
@Component
public class PartnerSettleTask {
private static Logger logger = LoggerFactory.getLogger(PartnerSettleTask.class);
}
package com.lanren.huhu.partner.service;
import java.util.List;
import com.lanren.huhu.partner.domain.AgentBankCard;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 15:59
*/
public interface AgentBankCardService extends IService<AgentBankCard>{
int updateBatch(List<AgentBankCard> list);
int batchInsert(List<AgentBankCard> list);
int insertOrUpdate(AgentBankCard record);
int insertOrUpdateSelective(AgentBankCard record);
}
package com.lanren.huhu.partner.service;
import java.util.List;
import com.lanren.huhu.partner.domain.AgentSalary;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 15:57
*/
public interface AgentSalaryService extends IService<AgentSalary>{
int updateBatch(List<AgentSalary> list);
int batchInsert(List<AgentSalary> list);
int insertOrUpdate(AgentSalary record);
int insertOrUpdateSelective(AgentSalary record);
}
package com.lanren.huhu.partner.service;
import java.util.List;
import com.lanren.huhu.partner.domain.PartnerAccountLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 15:57
*/
public interface PartnerAccountLogService extends IService<PartnerAccountLog>{
int updateBatch(List<PartnerAccountLog> list);
int batchInsert(List<PartnerAccountLog> list);
int insertOrUpdate(PartnerAccountLog record);
int insertOrUpdateSelective(PartnerAccountLog record);
}
package com.lanren.huhu.partner.service;
import java.util.List;
import com.lanren.huhu.partner.domain.PartnerReward;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 14:54
*/
public interface PartnerRewardService extends IService<PartnerReward>{
int updateBatch(List<PartnerReward> list);
int batchInsert(List<PartnerReward> list);
int insertOrUpdate(PartnerReward record);
int insertOrUpdateSelective(PartnerReward record);
}
package com.lanren.huhu.partner.service; import com.lanren.huhu.partner.domain.PartnerAccount;import com.lanren.huhu.partner.domain.UserAgent;import com.lanren.huhu.partner.model.ParentAgent;import com.lanren.huhu.partner.model.ParentPartner;import com.lanren.huhu.partner.model.User; import java.util.List; /** * @author houseme * @date 2019-06-28 18:35 * @Project partner * @Package com.lanren.huhu.partner.service * @File: UserService */public interface UserService { /** * @description: 根据用户id, 查找一个用户的全部合伙人上级 和 代理商上级 * 缓存用户邀请关系和代理商关系数据 * 缓存不能带有构造方法的Bean 所以只能返回User的Bean * 包装Result在Cacheable注解的方法之外进行操作 * @param userId * @return User * @throws * @author chen * @date 2019-06-26 20:01 */ User getRelationByUserId(Integer userId); /** * 清理用户缓存 */ boolean deleteRalationByUserId(Integer userId); /*** * PartnerAccount * * 根据用户id查询账户信息 * @param userId * @return PartnerAccount */ PartnerAccount getPartnerAccountByUserId(Integer userId); /** * @description: TODO * @param userId * @return List<PartnerAccount> * @author chen * @date 2019-06-28 11:49 */ List<PartnerAccount> getPartnerAccountChildrenByUserId(Integer userId); /*** * UserAgent * 根据用户id查询账户信息 * @param userId * @return */ UserAgent getUserAgentByUserId(Integer userId); /** * 按userId查找上级合伙人的 userId 和 level * @param userId * @return */ ParentPartner getParentPartner(Integer userId); /** * @description: 查找一个用户的全部合伙人上级, set到User对象的partnerList中 * @param userId * @author chen * @return List<ParentPartner> */ List<ParentPartner> getPartnerListByUserId(Integer userId); /** * 按agentId 查找上级代理商的 agentId 和 level * @param agentId * @return */ ParentAgent getParentAgent(Integer agentId); /** * @description: 查找一个用户的全部代理商上级 set到User对象的agentList中 * @param userId * @return List<ParentAgent> */ List<ParentAgent> getAgentListByUserId(Integer userId); }
\ No newline at end of file
package com.lanren.huhu.partner.service; import com.lanren.huhu.partner.domain.PartnerAccount;import com.lanren.huhu.partner.domain.UserAgent;import com.lanren.huhu.partner.model.User; import java.util.List; /** * @author houseme * @date 2019-06-28 18:35 * @Project partner * @Package com.lanren.huhu.partner.service * @File: UserService */public interface UserService { /** * @description: 根据用户id, 查找一个用户的全部合伙人上级 和 代理商上级 * 缓存用户邀请关系和代理商关系数据 * 缓存不能带有构造方法的Bean 所以只能返回User的Bean * 包装Result在Cacheable注解的方法之外进行操作 * @param userId * @return User * @throws * @author chen * @date 2019-06-26 20:01 */ User getRelationByUserId(Integer userId); /** * 清理用户缓存 */ boolean deleteRalationByUserId(Integer userId); /*** * PartnerAccount * * 根据用户id查询账户信息 * @param userId * @return PartnerAccount */ PartnerAccount getPartnerAccountByUserId(Integer userId); /** * @description: 根据用户id查询全部下级合伙人 * @param userId * @return List<PartnerAccount> * @author chen * @date 2019-06-28 11:49 */ List<PartnerAccount> getPartnerAccountChildrenByUserId(Integer userId); /*** * UserAgent * 根据用户id查询账户信息 * @param userId * @return */ UserAgent getUserAgentByUserId(Integer userId); // /** // * 按userId查找上级合伙人的 userId 和 level // * @param userId // * @return // */ // ParentPartner getParentPartner(Integer userId); // /** // * @description: 查找一个用户的全部合伙人上级, set到User对象的partnerList中 // * @param userId // * @author chen // * @return List<ParentPartner> // */ // List<ParentPartner> getPartnerListByUserId(Integer userId); // /** // * 按agentId 查找上级代理商的 agentId 和 level // * @param agentId // * @return // */ // ParentAgent getParentAgent(Integer agentId); // /** // * @description: 查找一个用户的全部代理商上级 set到User对象的agentList中 // * @param userId // * @return List<ParentAgent> // */ // List<ParentAgent> getAgentListByUserId(Integer userId); }
\ No newline at end of file
......
package com.lanren.huhu.partner.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.lanren.huhu.partner.domain.AgentBankCard;
import com.lanren.huhu.partner.dao.AgentBankCardMapper;
import com.lanren.huhu.partner.service.AgentBankCardService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 15:59
*/
@Service
public class AgentBankCardServiceImpl extends ServiceImpl<AgentBankCardMapper, AgentBankCard> implements AgentBankCardService{
@Override
public int updateBatch(List<AgentBankCard> list) {
return baseMapper.updateBatch(list);
}
@Override
public int batchInsert(List<AgentBankCard> list) {
return baseMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(AgentBankCard record) {
return baseMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(AgentBankCard record) {
return baseMapper.insertOrUpdateSelective(record);
}
}
package com.lanren.huhu.partner.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.lanren.huhu.partner.dao.AgentSalaryMapper;
import com.lanren.huhu.partner.domain.AgentSalary;
import com.lanren.huhu.partner.service.AgentSalaryService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 15:57
*/
@Service
public class AgentSalaryServiceImpl extends ServiceImpl<AgentSalaryMapper, AgentSalary> implements AgentSalaryService{
@Override
public int updateBatch(List<AgentSalary> list) {
return baseMapper.updateBatch(list);
}
@Override
public int batchInsert(List<AgentSalary> list) {
return baseMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(AgentSalary record) {
return baseMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(AgentSalary record) {
return baseMapper.insertOrUpdateSelective(record);
}
}
package com.lanren.huhu.partner.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.lanren.huhu.partner.domain.PartnerAccountLog;
import com.lanren.huhu.partner.dao.PartnerAccountLogMapper;
import com.lanren.huhu.partner.service.PartnerAccountLogService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 15:57
*/
@Service
public class PartnerAccountLogServiceImpl extends ServiceImpl<PartnerAccountLogMapper, PartnerAccountLog> implements PartnerAccountLogService{
@Override
public int updateBatch(List<PartnerAccountLog> list) {
return baseMapper.updateBatch(list);
}
@Override
public int batchInsert(List<PartnerAccountLog> list) {
return baseMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(PartnerAccountLog record) {
return baseMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(PartnerAccountLog record) {
return baseMapper.insertOrUpdateSelective(record);
}
}
......@@ -41,7 +41,7 @@ public class PartnerAccountServiceImpl extends ServiceImpl<PartnerAccountMapper,
@Override
public PartnerAccount getOneByUserId(Integer userId) {
QueryWrapper<PartnerAccount> queryWrapper = new QueryWrapper();
QueryWrapper<PartnerAccount> queryWrapper = new QueryWrapper<PartnerAccount>();
queryWrapper.eq("user_id", userId);
return baseMapper.selectOne(queryWrapper);
}
......
package com.lanren.huhu.partner.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.lanren.huhu.partner.dao.PartnerRewardMapper;
import com.lanren.huhu.partner.domain.PartnerReward;
import com.lanren.huhu.partner.service.PartnerRewardService;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-07-02 14:54
*/
@Service
public class PartnerRewardServiceImpl extends ServiceImpl<PartnerRewardMapper, PartnerReward> implements PartnerRewardService{
@Override
public int updateBatch(List<PartnerReward> list) {
return baseMapper.updateBatch(list);
}
@Override
public int batchInsert(List<PartnerReward> list) {
return baseMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(PartnerReward record) {
return baseMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(PartnerReward record) {
return baseMapper.insertOrUpdateSelective(record);
}
}
......@@ -38,7 +38,7 @@ public class UserAgentServiceImpl extends ServiceImpl<UserAgentMapper, UserAgent
@Override
public UserAgent getOneByAgentId(Integer agentId) {
QueryWrapper<UserAgent> queryWrapper = new QueryWrapper();
QueryWrapper<UserAgent> queryWrapper = new QueryWrapper<UserAgent>();
queryWrapper.eq("agent_id", agentId)
.le("agent_level", 4)
;
......
package com.lanren.huhu.partner.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.lanren.huhu.partner.dao.PartnerAccountMapper;import com.lanren.huhu.partner.dao.UserAgentMapper;import com.lanren.huhu.partner.domain.PartnerAccount;import com.lanren.huhu.partner.domain.UserAgent;import com.lanren.huhu.partner.model.ParentAgent;import com.lanren.huhu.partner.model.ParentPartner;import com.lanren.huhu.partner.model.User;import com.lanren.huhu.partner.service.UserService;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.cache.annotation.CacheConfig;import org.springframework.cache.annotation.CacheEvict;import org.springframework.cache.annotation.Cacheable;import org.springframework.stereotype.Service; import java.util.ArrayList;import java.util.List; /** * @author houseme * @date 2019-06-28 18:36 * @Project partner * @Package com.lanren.huhu.partner.service.impl * @File: UserServiceImpl */@Service@CacheConfig(cacheNames = "user:relation:cache")public class UserServiceImpl implements UserService { private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); @Autowired private UserAgentMapper userAgentMapper; @Autowired private PartnerAccountMapper partnerAccountMapper; /** * 用户上级 合伙人 和 代理 关系 * @param userId * @return */ @Override @Cacheable public User getRelationByUserId(Integer userId) { logger.info("new a user object "); if (logger.isDebugEnabled()) { logger.info("new a user object "); } User user = new User(); user.setUserId(userId); user.setPartnerList((ArrayList<ParentPartner>) getPartnerListByUserId(userId)); user.setAgentList((ArrayList<ParentAgent>) getAgentListByUserId(userId)); return user; } @Override @CacheEvict(key = "#userId") public boolean deleteRalationByUserId(Integer userId) { if (logger.isInfoEnabled()) { logger.info("delete user relation cache, userId: {}", userId); } return true; } /** * 合伙人数据 * @param userId * @return */ @Override public PartnerAccount getPartnerAccountByUserId(Integer userId) { QueryWrapper<PartnerAccount> queryWrapper = new QueryWrapper(); queryWrapper.eq("user_id", userId); return partnerAccountMapper.selectOne(queryWrapper); } @Override public List<PartnerAccount> getPartnerAccountChildrenByUserId(Integer userId) { return partnerAccountMapper.getChildrenByUserId(userId); } @Override public ParentPartner getParentPartner(Integer userId) { PartnerAccount partnerAccount = partnerAccountMapper.getParentByUserId(userId); ParentPartner parentPartner = null; if (null != partnerAccount) { int partnerLevel = partnerAccount.getIsSuperPartner() == 1 ? 30 : partnerAccount.getPartnerLevel(); parentPartner = new ParentPartner(partnerAccount.getUserId(),partnerLevel); } return parentPartner; } @Override public List<ParentPartner> getPartnerListByUserId(Integer userId) { if (logger.isInfoEnabled()) { logger.info("begin setPartnerList for user: {} ......", userId); } ArrayList<ParentPartner> partnerList = new ArrayList<ParentPartner>(); /** * 无限找 */ int loopUserId = userId; int loopTimes = 0; while (true) { if (logger.isDebugEnabled()) { logger.info("now loop uid is {}", loopUserId); } ParentPartner parentPartner = getParentPartner(loopUserId); if (null == parentPartner) { break; } else { if (logger.isDebugEnabled()) { logger.info("parent is {} ", parentPartner.getUserId()); } partnerList.add(parentPartner); loopUserId = parentPartner.getUserId(); loopTimes++; if (loopTimes > 500) { partnerList.clear(); logger.error("用户:{} 邀请关系异常, 已超500层", userId); break; } } } if (logger.isInfoEnabled()) { logger.info("setPartnerList for user: {} end", userId); } return partnerList; } /** * 代理商数据 * @param userId * @return */ @Override public UserAgent getUserAgentByUserId(Integer userId) { QueryWrapper<UserAgent> queryWrapper = new QueryWrapper(); queryWrapper.eq("user_id", userId).le("agent_level", 4); return userAgentMapper.selectOne(queryWrapper); } @Override public ParentAgent getParentAgent(Integer agentId) { UserAgent userAgent = userAgentMapper.getParentAgent(agentId); ParentAgent parentAgent = null; if (null != userAgent) { int agentLevel = userAgent.getAgentLevel(); parentAgent = new ParentAgent(userAgent.getUserId(), userAgent.getAgentId(), agentLevel); } return parentAgent; } @Override public List<ParentAgent> getAgentListByUserId(Integer userId) { if (logger.isInfoEnabled()) { logger.info("begin setAgentList for user: {} ......", userId); } ArrayList<ParentAgent> agentList = new ArrayList<ParentAgent>(); /** * 无限找 * 先无限找上级合伙人, 直到找到第一个是代理商的合伙人 */ int loopUserId = userId; int loopTimes = 0; while (true) { if (logger.isDebugEnabled()) { logger.info("now loop uid is {}", loopUserId); } ParentPartner parentPartner = getParentPartner(loopUserId); /** * 有上级合伙人 */ if (null != parentPartner) { UserAgent userAgent = getUserAgentByUserId(parentPartner.getUserId()); /** * 找到了第一个是代理商的合伙人 */ if (null != userAgent) { /** * 然后开始 无限找 这个人的上级代理商 */ if (logger.isDebugEnabled()) { logger.info("find first agent({}) for user: {}", userAgent.getAgentId(), userId); } agentList.add(new ParentAgent(userAgent.getUserId(), userAgent.getAgentId(), userAgent.getAgentLevel())); loopTimes++; if (logger.isDebugEnabled()) { logger.info("loop find parent agent start ......"); } int loogAgentId = userAgent.getAgentId(); while (true) { ParentAgent loopUserAgent = getParentAgent(loogAgentId); if (null == loopUserAgent) { break; } else { if (logger.isDebugEnabled()) { logger.info("parent agent is ", loopUserAgent.getAgentId()); } agentList.add(new ParentAgent(loopUserAgent.getUserId(), loopUserAgent.getAgentId(), loopUserAgent.getLevel())); loogAgentId = loopUserAgent.getAgentId(); loopTimes++; if (loopTimes > 500) { agentList.clear(); logger.error("用户ID:{} 代理商关系异常, 已超500层", userId); break; } } } /** * 找完 "第一个是代理商的合伙人" 的 全部上级代理后 退出while循环 */ if (logger.isDebugEnabled()) { logger.info("loop find parent agent end"); } break; } else { /** * 这个人不是代理商 继续往上找 */ loopUserId = parentPartner.getUserId(); } } else { /** * 没有上级合伙人 打印结束信息 跳出循环 */ if (logger.isDebugEnabled()) { logger.info("loop end with userId: {}", loopUserId); } break; } } if (logger.isInfoEnabled()) { logger.info("setAgentList for user: {} end", userId); } return agentList; }}
\ No newline at end of file
package com.lanren.huhu.partner.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.lanren.huhu.partner.dao.PartnerAccountMapper;import com.lanren.huhu.partner.dao.UserAgentMapper;import com.lanren.huhu.partner.domain.PartnerAccount;import com.lanren.huhu.partner.domain.UserAgent;import com.lanren.huhu.partner.model.ParentAgent;import com.lanren.huhu.partner.model.ParentPartner;import com.lanren.huhu.partner.model.User;import com.lanren.huhu.partner.service.UserService;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.cache.annotation.CacheConfig;import org.springframework.cache.annotation.CacheEvict;import org.springframework.cache.annotation.Cacheable;import org.springframework.stereotype.Service; import java.util.ArrayList;import java.util.List; /** * @author houseme * @date 2019-06-28 18:36 * @Project partner * @Package com.lanren.huhu.partner.service.impl * @File: UserServiceImpl */@Service@CacheConfig(cacheNames = "user:relation:cache")public class UserServiceImpl implements UserService { private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); @Autowired private UserAgentMapper userAgentMapper; @Autowired private PartnerAccountMapper partnerAccountMapper; /** * 用户上级 合伙人 和 代理 关系 * @param userId * @return */ @Override @Cacheable public User getRelationByUserId(Integer userId) { logger.info("UserServiceImpl get user relation from database, userId: {}", userId); User user = new User(); user.setUserId(userId); user.setPartnerList((ArrayList<ParentPartner>) getPartnerListByUserId(userId)); user.setAgentList((ArrayList<ParentAgent>) getAgentListByUserId(userId)); return user; } @Override @CacheEvict(key = "#userId") public boolean deleteRalationByUserId(Integer userId) { logger.info("UserServiceImpl delete user relation cache, userId: {}", userId); return true; } /** * 合伙人数据 * @param userId * @return */ @Override public PartnerAccount getPartnerAccountByUserId(Integer userId) { QueryWrapper<PartnerAccount> queryWrapper = new QueryWrapper<PartnerAccount>(); queryWrapper.eq("user_id", userId); return partnerAccountMapper.selectOne(queryWrapper); } @Override public List<PartnerAccount> getPartnerAccountChildrenByUserId(Integer userId) { return partnerAccountMapper.getChildrenByUserId(userId); } /** * 按userId查找上级合伙人的 userId 和 level * @param userId * @return */ private ParentPartner getParentPartner(Integer userId) { PartnerAccount partnerAccount = partnerAccountMapper.getParentByUserId(userId); ParentPartner parentPartner = null; if (null != partnerAccount) { int partnerLevel = partnerAccount.getIsSuperPartner() == 1 ? 30 : partnerAccount.getPartnerLevel(); parentPartner = new ParentPartner(partnerAccount.getUserId(),partnerLevel); } return parentPartner; } /** * @description: 查找一个用户的全部合伙人上级 * @param userId * @author chen * @return List<ParentPartner> */ private List<ParentPartner> getPartnerListByUserId(Integer userId) { if (logger.isInfoEnabled()) { logger.info("UserServiceImpl getPartnerListByUserId for user: {} ......", userId); } ArrayList<ParentPartner> partnerList = new ArrayList<ParentPartner>(); /** * 无限找 */ int loopUserId = userId; int loopTimes = 0; while (true) { if (logger.isDebugEnabled()) { logger.info("now loop uid is {}", loopUserId); } ParentPartner parentPartner = getParentPartner(loopUserId); if (null == parentPartner) { break; } else { if (logger.isDebugEnabled()) { logger.info("parent is {} ", parentPartner.getUserId()); } partnerList.add(parentPartner); loopUserId = parentPartner.getUserId(); loopTimes++; if (loopTimes > 500) { partnerList.clear(); logger.error("用户:{} 邀请关系异常, 已超500层", userId); break; } } } if (logger.isInfoEnabled()) { logger.info("setPartnerList for user: {} end", userId); } return partnerList; } /** * 代理商数据 * @param userId * @return */ @Override public UserAgent getUserAgentByUserId(Integer userId) { QueryWrapper<UserAgent> queryWrapper = new QueryWrapper<UserAgent>(); queryWrapper.eq("user_id", userId).le("agent_level", 4); return userAgentMapper.selectOne(queryWrapper); } /** * 按agentId 查找上级代理商的 agentId 和 level * @param agentId * @return */ private ParentAgent getParentAgent(Integer agentId) { UserAgent userAgent = userAgentMapper.getParentAgent(agentId); ParentAgent parentAgent = null; if (null != userAgent) { int agentLevel = userAgent.getAgentLevel(); parentAgent = new ParentAgent(userAgent.getUserId(), userAgent.getAgentId(), agentLevel); } return parentAgent; } /** * @description: 查找一个用户的全部代理商上级 * @param userId * @return List<ParentAgent> */ private List<ParentAgent> getAgentListByUserId(Integer userId) { if (logger.isInfoEnabled()) { logger.info("getAgentListByUserId for user: {} ......", userId); } ArrayList<ParentAgent> agentList = new ArrayList<ParentAgent>(); /** * 无限找 * 先无限找上级合伙人, 直到找到第一个是代理商的合伙人 */ int loopUserId = userId; int loopTimes = 0; while (true) { if (logger.isDebugEnabled()) { logger.info("now loop uid is {}", loopUserId); } ParentPartner parentPartner = getParentPartner(loopUserId); /** * 有上级合伙人 */ if (null != parentPartner) { UserAgent userAgent = getUserAgentByUserId(parentPartner.getUserId()); /** * 找到了第一个是代理商的合伙人 */ if (null != userAgent) { /** * 然后开始 无限找 这个人的上级代理商 */ if (logger.isDebugEnabled()) { logger.info("find first agent({}) for user: {}", userAgent.getAgentId(), userId); } agentList.add(new ParentAgent(userAgent.getUserId(), userAgent.getAgentId(), userAgent.getAgentLevel())); loopTimes++; if (logger.isDebugEnabled()) { logger.info("loop find parent agent start ......"); } int loogAgentId = userAgent.getAgentId(); while (true) { ParentAgent loopUserAgent = getParentAgent(loogAgentId); if (null == loopUserAgent) { break; } else { if (logger.isDebugEnabled()) { logger.info("parent agent is ", loopUserAgent.getAgentId()); } agentList.add(new ParentAgent(loopUserAgent.getUserId(), loopUserAgent.getAgentId(), loopUserAgent.getLevel())); loogAgentId = loopUserAgent.getAgentId(); loopTimes++; if (loopTimes > 500) { agentList.clear(); logger.error("用户ID:{} 代理商关系异常, 已超500层", userId); break; } } } /** * 找完 "第一个是代理商的合伙人" 的 全部上级代理后 退出while循环 */ if (logger.isDebugEnabled()) { logger.info("loop find parent agent end"); } break; } else { /** * 这个人不是代理商 继续往上找 */ loopUserId = parentPartner.getUserId(); } } else { /** * 没有上级合伙人 打印结束信息 跳出循环 */ if (logger.isDebugEnabled()) { logger.info("loop end with userId: {}", loopUserId); } break; } } if (logger.isInfoEnabled()) { logger.info("setAgentList for user: {} end", userId); } return agentList; }}
\ No newline at end of file
......
<?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.lanren.huhu.partner.dao.AgentBankCardMapper">
<resultMap id="BaseResultMap" type="com.lanren.huhu.partner.domain.AgentBankCard">
<!--@mbg.generated-->
<id column="id" property="id" />
<result column="agent_id" property="agentId" />
<result column="user_id" property="userId" />
<result column="real_name" property="realName" />
<result column="user_phone" property="userPhone" />
<result column="currency_code" property="currencyCode" />
<result column="bank_type" property="bankType" />
<result column="bank_code" property="bankCode" />
<result column="bank_name" property="bankName" />
<result column="bank_account" property="bankAccount" />
<result column="bank_card_number" property="bankCardNumber" />
<result column="branch_name" property="branchName" />
<result column="bank_province" property="bankProvince" />
<result column="bank_city" property="bankCity" />
<result column="bank_address" property="bankAddress" />
<result column="bank_state" property="bankState" />
<result column="idcard_no" property="idcardNo" />
<result column="idcard_pic_front" property="idcardPicFront" />
<result column="idcard_pic_back" property="idcardPicBack" />
<result column="business_license" property="businessLicense" />
<result column="tax_number" property="taxNumber" />
<result column="company_address" property="companyAddress" />
<result column="company_phone" property="companyPhone" />
<result column="quota_node" property="quotaNode" />
<result column="tax_rate" property="taxRate" />
<result column="start_time" property="startTime" />
<result column="create_time" property="createTime" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
<result column="deleted_at" property="deletedAt" />
<result column="is_default" property="isDefault" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, agent_id, user_id, real_name, user_phone, currency_code, bank_type, bank_code,
bank_name, bank_account, bank_card_number, branch_name, bank_province, bank_city,
bank_address, bank_state, idcard_no, idcard_pic_front, idcard_pic_back, business_license,
tax_number, company_address, company_phone, quota_node, tax_rate, start_time, create_time,
created_at, updated_at, deleted_at, is_default
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update agent_bank_card
<trim prefix="set" suffixOverrides=",">
<trim prefix="agent_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.agentId}
</foreach>
</trim>
<trim prefix="user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.userId}
</foreach>
</trim>
<trim prefix="real_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.realName}
</foreach>
</trim>
<trim prefix="user_phone = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.userPhone}
</foreach>
</trim>
<trim prefix="currency_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.currencyCode}
</foreach>
</trim>
<trim prefix="bank_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankType}
</foreach>
</trim>
<trim prefix="bank_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankCode}
</foreach>
</trim>
<trim prefix="bank_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankName}
</foreach>
</trim>
<trim prefix="bank_account = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankAccount}
</foreach>
</trim>
<trim prefix="bank_card_number = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankCardNumber}
</foreach>
</trim>
<trim prefix="branch_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.branchName}
</foreach>
</trim>
<trim prefix="bank_province = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankProvince}
</foreach>
</trim>
<trim prefix="bank_city = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankCity}
</foreach>
</trim>
<trim prefix="bank_address = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankAddress}
</foreach>
</trim>
<trim prefix="bank_state = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankState}
</foreach>
</trim>
<trim prefix="idcard_no = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.idcardNo}
</foreach>
</trim>
<trim prefix="idcard_pic_front = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.idcardPicFront}
</foreach>
</trim>
<trim prefix="idcard_pic_back = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.idcardPicBack}
</foreach>
</trim>
<trim prefix="business_license = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.businessLicense}
</foreach>
</trim>
<trim prefix="tax_number = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.taxNumber}
</foreach>
</trim>
<trim prefix="company_address = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.companyAddress}
</foreach>
</trim>
<trim prefix="company_phone = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.companyPhone}
</foreach>
</trim>
<trim prefix="quota_node = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.quotaNode}
</foreach>
</trim>
<trim prefix="tax_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.taxRate}
</foreach>
</trim>
<trim prefix="start_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.startTime}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.createTime}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.createdAt}
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.updatedAt}
</foreach>
</trim>
<trim prefix="deleted_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.deletedAt}
</foreach>
</trim>
<trim prefix="is_default = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.isDefault}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into agent_bank_card
(agent_id, user_id, real_name, user_phone, currency_code, bank_type, bank_code, bank_name,
bank_account, bank_card_number, branch_name, bank_province, bank_city, bank_address,
bank_state, idcard_no, idcard_pic_front, idcard_pic_back, business_license, tax_number,
company_address, company_phone, quota_node, tax_rate, start_time, create_time,
created_at, updated_at, deleted_at, is_default)
values
<foreach collection="list" item="item" separator=",">
(#{item.agentId}, #{item.userId}, #{item.realName}, #{item.userPhone}, #{item.currencyCode},
#{item.bankType}, #{item.bankCode}, #{item.bankName}, #{item.bankAccount}, #{item.bankCardNumber},
#{item.branchName}, #{item.bankProvince}, #{item.bankCity}, #{item.bankAddress},
#{item.bankState}, #{item.idcardNo}, #{item.idcardPicFront}, #{item.idcardPicBack},
#{item.businessLicense}, #{item.taxNumber}, #{item.companyAddress}, #{item.companyPhone},
#{item.quotaNode}, #{item.taxRate}, #{item.startTime}, #{item.createTime}, #{item.createdAt},
#{item.updatedAt}, #{item.deletedAt}, #{item.isDefault})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.AgentBankCard" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into agent_bank_card
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
agent_id,
user_id,
real_name,
user_phone,
currency_code,
bank_type,
bank_code,
bank_name,
bank_account,
bank_card_number,
branch_name,
bank_province,
bank_city,
bank_address,
bank_state,
idcard_no,
idcard_pic_front,
idcard_pic_back,
business_license,
tax_number,
company_address,
company_phone,
quota_node,
tax_rate,
start_time,
create_time,
created_at,
updated_at,
deleted_at,
is_default,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
#{agentId},
#{userId},
#{realName},
#{userPhone},
#{currencyCode},
#{bankType},
#{bankCode},
#{bankName},
#{bankAccount},
#{bankCardNumber},
#{branchName},
#{bankProvince},
#{bankCity},
#{bankAddress},
#{bankState},
#{idcardNo},
#{idcardPicFront},
#{idcardPicBack},
#{businessLicense},
#{taxNumber},
#{companyAddress},
#{companyPhone},
#{quotaNode},
#{taxRate},
#{startTime},
#{createTime},
#{createdAt},
#{updatedAt},
#{deletedAt},
#{isDefault},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
agent_id = #{agentId},
user_id = #{userId},
real_name = #{realName},
user_phone = #{userPhone},
currency_code = #{currencyCode},
bank_type = #{bankType},
bank_code = #{bankCode},
bank_name = #{bankName},
bank_account = #{bankAccount},
bank_card_number = #{bankCardNumber},
branch_name = #{branchName},
bank_province = #{bankProvince},
bank_city = #{bankCity},
bank_address = #{bankAddress},
bank_state = #{bankState},
idcard_no = #{idcardNo},
idcard_pic_front = #{idcardPicFront},
idcard_pic_back = #{idcardPicBack},
business_license = #{businessLicense},
tax_number = #{taxNumber},
company_address = #{companyAddress},
company_phone = #{companyPhone},
quota_node = #{quotaNode},
tax_rate = #{taxRate},
start_time = #{startTime},
create_time = #{createTime},
created_at = #{createdAt},
updated_at = #{updatedAt},
deleted_at = #{deletedAt},
is_default = #{isDefault},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.AgentBankCard" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into agent_bank_card
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="agentId != null">
agent_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="realName != null">
real_name,
</if>
<if test="userPhone != null">
user_phone,
</if>
<if test="currencyCode != null">
currency_code,
</if>
<if test="bankType != null">
bank_type,
</if>
<if test="bankCode != null">
bank_code,
</if>
<if test="bankName != null">
bank_name,
</if>
<if test="bankAccount != null">
bank_account,
</if>
<if test="bankCardNumber != null">
bank_card_number,
</if>
<if test="branchName != null">
branch_name,
</if>
<if test="bankProvince != null">
bank_province,
</if>
<if test="bankCity != null">
bank_city,
</if>
<if test="bankAddress != null">
bank_address,
</if>
<if test="bankState != null">
bank_state,
</if>
<if test="idcardNo != null">
idcard_no,
</if>
<if test="idcardPicFront != null">
idcard_pic_front,
</if>
<if test="idcardPicBack != null">
idcard_pic_back,
</if>
<if test="businessLicense != null">
business_license,
</if>
<if test="taxNumber != null">
tax_number,
</if>
<if test="companyAddress != null">
company_address,
</if>
<if test="companyPhone != null">
company_phone,
</if>
<if test="quotaNode != null">
quota_node,
</if>
<if test="taxRate != null">
tax_rate,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="deletedAt != null">
deleted_at,
</if>
<if test="isDefault != null">
is_default,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="agentId != null">
#{agentId},
</if>
<if test="userId != null">
#{userId},
</if>
<if test="realName != null">
#{realName},
</if>
<if test="userPhone != null">
#{userPhone},
</if>
<if test="currencyCode != null">
#{currencyCode},
</if>
<if test="bankType != null">
#{bankType},
</if>
<if test="bankCode != null">
#{bankCode},
</if>
<if test="bankName != null">
#{bankName},
</if>
<if test="bankAccount != null">
#{bankAccount},
</if>
<if test="bankCardNumber != null">
#{bankCardNumber},
</if>
<if test="branchName != null">
#{branchName},
</if>
<if test="bankProvince != null">
#{bankProvince},
</if>
<if test="bankCity != null">
#{bankCity},
</if>
<if test="bankAddress != null">
#{bankAddress},
</if>
<if test="bankState != null">
#{bankState},
</if>
<if test="idcardNo != null">
#{idcardNo},
</if>
<if test="idcardPicFront != null">
#{idcardPicFront},
</if>
<if test="idcardPicBack != null">
#{idcardPicBack},
</if>
<if test="businessLicense != null">
#{businessLicense},
</if>
<if test="taxNumber != null">
#{taxNumber},
</if>
<if test="companyAddress != null">
#{companyAddress},
</if>
<if test="companyPhone != null">
#{companyPhone},
</if>
<if test="quotaNode != null">
#{quotaNode},
</if>
<if test="taxRate != null">
#{taxRate},
</if>
<if test="startTime != null">
#{startTime},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="createdAt != null">
#{createdAt},
</if>
<if test="updatedAt != null">
#{updatedAt},
</if>
<if test="deletedAt != null">
#{deletedAt},
</if>
<if test="isDefault != null">
#{isDefault},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
<if test="agentId != null">
agent_id = #{agentId},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="realName != null">
real_name = #{realName},
</if>
<if test="userPhone != null">
user_phone = #{userPhone},
</if>
<if test="currencyCode != null">
currency_code = #{currencyCode},
</if>
<if test="bankType != null">
bank_type = #{bankType},
</if>
<if test="bankCode != null">
bank_code = #{bankCode},
</if>
<if test="bankName != null">
bank_name = #{bankName},
</if>
<if test="bankAccount != null">
bank_account = #{bankAccount},
</if>
<if test="bankCardNumber != null">
bank_card_number = #{bankCardNumber},
</if>
<if test="branchName != null">
branch_name = #{branchName},
</if>
<if test="bankProvince != null">
bank_province = #{bankProvince},
</if>
<if test="bankCity != null">
bank_city = #{bankCity},
</if>
<if test="bankAddress != null">
bank_address = #{bankAddress},
</if>
<if test="bankState != null">
bank_state = #{bankState},
</if>
<if test="idcardNo != null">
idcard_no = #{idcardNo},
</if>
<if test="idcardPicFront != null">
idcard_pic_front = #{idcardPicFront},
</if>
<if test="idcardPicBack != null">
idcard_pic_back = #{idcardPicBack},
</if>
<if test="businessLicense != null">
business_license = #{businessLicense},
</if>
<if test="taxNumber != null">
tax_number = #{taxNumber},
</if>
<if test="companyAddress != null">
company_address = #{companyAddress},
</if>
<if test="companyPhone != null">
company_phone = #{companyPhone},
</if>
<if test="quotaNode != null">
quota_node = #{quotaNode},
</if>
<if test="taxRate != null">
tax_rate = #{taxRate},
</if>
<if test="startTime != null">
start_time = #{startTime},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="createdAt != null">
created_at = #{createdAt},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt},
</if>
<if test="deletedAt != null">
deleted_at = #{deletedAt},
</if>
<if test="isDefault != null">
is_default = #{isDefault},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
<?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.lanren.huhu.partner.dao.AgentSalaryMapper">
<resultMap id="BaseResultMap" type="com.lanren.huhu.partner.domain.AgentSalary">
<!--@mbg.generated-->
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="agent_id" property="agentId" />
<result column="month" property="month" />
<result column="balance" property="balance" />
<result column="opencard_balance" property="opencardBalance" />
<result column="recharge_balance" property="rechargeBalance" />
<result column="upgrade_balance" property="upgradeBalance" />
<result column="upgrade_super_balance" property="upgradeSuperBalance" />
<result column="tax_balance" property="taxBalance" />
<result column="bank_account" property="bankAccount" />
<result column="bank_card_number" property="bankCardNumber" />
<result column="bank_name" property="bankName" />
<result column="branch_name" property="branchName" />
<result column="reference_id" property="referenceId" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
<result column="deleted_at" property="deletedAt" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, user_id, agent_id, `month`, balance, opencard_balance, recharge_balance, upgrade_balance,
upgrade_super_balance, tax_balance, bank_account, bank_card_number, bank_name, branch_name,
reference_id, `status`, create_time, modify_time, created_at, updated_at, deleted_at
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update agent_salary
<trim prefix="set" suffixOverrides=",">
<trim prefix="user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.userId}
</foreach>
</trim>
<trim prefix="agent_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.agentId}
</foreach>
</trim>
<trim prefix="`month` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.month}
</foreach>
</trim>
<trim prefix="balance = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.balance}
</foreach>
</trim>
<trim prefix="opencard_balance = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.opencardBalance}
</foreach>
</trim>
<trim prefix="recharge_balance = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.rechargeBalance}
</foreach>
</trim>
<trim prefix="upgrade_balance = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.upgradeBalance}
</foreach>
</trim>
<trim prefix="upgrade_super_balance = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.upgradeSuperBalance}
</foreach>
</trim>
<trim prefix="tax_balance = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.taxBalance}
</foreach>
</trim>
<trim prefix="bank_account = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankAccount}
</foreach>
</trim>
<trim prefix="bank_card_number = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankCardNumber}
</foreach>
</trim>
<trim prefix="bank_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.bankName}
</foreach>
</trim>
<trim prefix="branch_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.branchName}
</foreach>
</trim>
<trim prefix="reference_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.referenceId}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.status}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.createTime}
</foreach>
</trim>
<trim prefix="modify_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.modifyTime}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.createdAt}
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.updatedAt}
</foreach>
</trim>
<trim prefix="deleted_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.deletedAt}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into agent_salary
(user_id, agent_id, `month`, balance, opencard_balance, recharge_balance, upgrade_balance,
upgrade_super_balance, tax_balance, bank_account, bank_card_number, bank_name,
branch_name, reference_id, `status`, create_time, modify_time, created_at, updated_at,
deleted_at)
values
<foreach collection="list" item="item" separator=",">
(#{item.userId}, #{item.agentId}, #{item.month}, #{item.balance}, #{item.opencardBalance},
#{item.rechargeBalance}, #{item.upgradeBalance}, #{item.upgradeSuperBalance}, #{item.taxBalance},
#{item.bankAccount}, #{item.bankCardNumber}, #{item.bankName}, #{item.branchName},
#{item.referenceId}, #{item.status}, #{item.createTime}, #{item.modifyTime}, #{item.createdAt},
#{item.updatedAt}, #{item.deletedAt})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.AgentSalary" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into agent_salary
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
user_id,
agent_id,
`month`,
balance,
opencard_balance,
recharge_balance,
upgrade_balance,
upgrade_super_balance,
tax_balance,
bank_account,
bank_card_number,
bank_name,
branch_name,
reference_id,
`status`,
create_time,
modify_time,
created_at,
updated_at,
deleted_at,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
#{userId},
#{agentId},
#{month},
#{balance},
#{opencardBalance},
#{rechargeBalance},
#{upgradeBalance},
#{upgradeSuperBalance},
#{taxBalance},
#{bankAccount},
#{bankCardNumber},
#{bankName},
#{branchName},
#{referenceId},
#{status},
#{createTime},
#{modifyTime},
#{createdAt},
#{updatedAt},
#{deletedAt},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
user_id = #{userId},
agent_id = #{agentId},
`month` = #{month},
balance = #{balance},
opencard_balance = #{opencardBalance},
recharge_balance = #{rechargeBalance},
upgrade_balance = #{upgradeBalance},
upgrade_super_balance = #{upgradeSuperBalance},
tax_balance = #{taxBalance},
bank_account = #{bankAccount},
bank_card_number = #{bankCardNumber},
bank_name = #{bankName},
branch_name = #{branchName},
reference_id = #{referenceId},
`status` = #{status},
create_time = #{createTime},
modify_time = #{modifyTime},
created_at = #{createdAt},
updated_at = #{updatedAt},
deleted_at = #{deletedAt},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.AgentSalary" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into agent_salary
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="agentId != null">
agent_id,
</if>
<if test="month != null">
`month`,
</if>
<if test="balance != null">
balance,
</if>
<if test="opencardBalance != null">
opencard_balance,
</if>
<if test="rechargeBalance != null">
recharge_balance,
</if>
<if test="upgradeBalance != null">
upgrade_balance,
</if>
<if test="upgradeSuperBalance != null">
upgrade_super_balance,
</if>
<if test="taxBalance != null">
tax_balance,
</if>
<if test="bankAccount != null">
bank_account,
</if>
<if test="bankCardNumber != null">
bank_card_number,
</if>
<if test="bankName != null">
bank_name,
</if>
<if test="branchName != null">
branch_name,
</if>
<if test="referenceId != null">
reference_id,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="deletedAt != null">
deleted_at,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="userId != null">
#{userId},
</if>
<if test="agentId != null">
#{agentId},
</if>
<if test="month != null">
#{month},
</if>
<if test="balance != null">
#{balance},
</if>
<if test="opencardBalance != null">
#{opencardBalance},
</if>
<if test="rechargeBalance != null">
#{rechargeBalance},
</if>
<if test="upgradeBalance != null">
#{upgradeBalance},
</if>
<if test="upgradeSuperBalance != null">
#{upgradeSuperBalance},
</if>
<if test="taxBalance != null">
#{taxBalance},
</if>
<if test="bankAccount != null">
#{bankAccount},
</if>
<if test="bankCardNumber != null">
#{bankCardNumber},
</if>
<if test="bankName != null">
#{bankName},
</if>
<if test="branchName != null">
#{branchName},
</if>
<if test="referenceId != null">
#{referenceId},
</if>
<if test="status != null">
#{status},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="modifyTime != null">
#{modifyTime},
</if>
<if test="createdAt != null">
#{createdAt},
</if>
<if test="updatedAt != null">
#{updatedAt},
</if>
<if test="deletedAt != null">
#{deletedAt},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="agentId != null">
agent_id = #{agentId},
</if>
<if test="month != null">
`month` = #{month},
</if>
<if test="balance != null">
balance = #{balance},
</if>
<if test="opencardBalance != null">
opencard_balance = #{opencardBalance},
</if>
<if test="rechargeBalance != null">
recharge_balance = #{rechargeBalance},
</if>
<if test="upgradeBalance != null">
upgrade_balance = #{upgradeBalance},
</if>
<if test="upgradeSuperBalance != null">
upgrade_super_balance = #{upgradeSuperBalance},
</if>
<if test="taxBalance != null">
tax_balance = #{taxBalance},
</if>
<if test="bankAccount != null">
bank_account = #{bankAccount},
</if>
<if test="bankCardNumber != null">
bank_card_number = #{bankCardNumber},
</if>
<if test="bankName != null">
bank_name = #{bankName},
</if>
<if test="branchName != null">
branch_name = #{branchName},
</if>
<if test="referenceId != null">
reference_id = #{referenceId},
</if>
<if test="status != null">
`status` = #{status},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime},
</if>
<if test="createdAt != null">
created_at = #{createdAt},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt},
</if>
<if test="deletedAt != null">
deleted_at = #{deletedAt},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
<?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.lanren.huhu.partner.dao.PartnerAccountLogMapper">
<resultMap id="BaseResultMap" type="com.lanren.huhu.partner.domain.PartnerAccountLog">
<!--@mbg.generated-->
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="yeartime" property="yeartime" />
<result column="monthtime" property="monthtime" />
<result column="daytime" property="daytime" />
<result column="type" property="type" />
<result column="change_num" property="changeNum" />
<result column="changed_amount" property="changedAmount" />
<result column="change_time" property="changeTime" />
<result column="pay_state" property="payState" />
<result column="pay_platform" property="payPlatform" />
<result column="pay_type" property="payType" />
<result column="pay_remark" property="payRemark" />
<result column="pay_info" property="payInfo" />
<result column="reference_id" property="referenceId" />
<result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, user_id, yeartime, monthtime, daytime, `type`, change_num, changed_amount, change_time,
pay_state, pay_platform, pay_type, pay_remark, pay_info, reference_id, create_time,
modify_time
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update partner_account_log
<trim prefix="set" suffixOverrides=",">
<trim prefix="user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.userId}
</foreach>
</trim>
<trim prefix="yeartime = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.yeartime}
</foreach>
</trim>
<trim prefix="monthtime = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.monthtime}
</foreach>
</trim>
<trim prefix="daytime = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.daytime}
</foreach>
</trim>
<trim prefix="`type` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.type}
</foreach>
</trim>
<trim prefix="change_num = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.changeNum}
</foreach>
</trim>
<trim prefix="changed_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.changedAmount}
</foreach>
</trim>
<trim prefix="change_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.changeTime}
</foreach>
</trim>
<trim prefix="pay_state = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.payState}
</foreach>
</trim>
<trim prefix="pay_platform = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.payPlatform}
</foreach>
</trim>
<trim prefix="pay_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.payType}
</foreach>
</trim>
<trim prefix="pay_remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.payRemark}
</foreach>
</trim>
<trim prefix="pay_info = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.payInfo}
</foreach>
</trim>
<trim prefix="reference_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.referenceId}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.createTime}
</foreach>
</trim>
<trim prefix="modify_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.modifyTime}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into partner_account_log
(user_id, yeartime, monthtime, daytime, `type`, change_num, changed_amount, change_time,
pay_state, pay_platform, pay_type, pay_remark, pay_info, reference_id, create_time,
modify_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.userId}, #{item.yeartime}, #{item.monthtime}, #{item.daytime}, #{item.type},
#{item.changeNum}, #{item.changedAmount}, #{item.changeTime}, #{item.payState},
#{item.payPlatform}, #{item.payType}, #{item.payRemark}, #{item.payInfo}, #{item.referenceId},
#{item.createTime}, #{item.modifyTime})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.PartnerAccountLog" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into partner_account_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
user_id,
yeartime,
monthtime,
daytime,
`type`,
change_num,
changed_amount,
change_time,
pay_state,
pay_platform,
pay_type,
pay_remark,
pay_info,
reference_id,
create_time,
modify_time,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
#{userId},
#{yeartime},
#{monthtime},
#{daytime},
#{type},
#{changeNum},
#{changedAmount},
#{changeTime},
#{payState},
#{payPlatform},
#{payType},
#{payRemark},
#{payInfo},
#{referenceId},
#{createTime},
#{modifyTime},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
user_id = #{userId},
yeartime = #{yeartime},
monthtime = #{monthtime},
daytime = #{daytime},
`type` = #{type},
change_num = #{changeNum},
changed_amount = #{changedAmount},
change_time = #{changeTime},
pay_state = #{payState},
pay_platform = #{payPlatform},
pay_type = #{payType},
pay_remark = #{payRemark},
pay_info = #{payInfo},
reference_id = #{referenceId},
create_time = #{createTime},
modify_time = #{modifyTime},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.PartnerAccountLog" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into partner_account_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="yeartime != null">
yeartime,
</if>
<if test="monthtime != null">
monthtime,
</if>
<if test="daytime != null">
daytime,
</if>
<if test="type != null">
`type`,
</if>
<if test="changeNum != null">
change_num,
</if>
<if test="changedAmount != null">
changed_amount,
</if>
<if test="changeTime != null">
change_time,
</if>
<if test="payState != null">
pay_state,
</if>
<if test="payPlatform != null">
pay_platform,
</if>
<if test="payType != null">
pay_type,
</if>
<if test="payRemark != null">
pay_remark,
</if>
<if test="payInfo != null">
pay_info,
</if>
<if test="referenceId != null">
reference_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="modifyTime != null">
modify_time,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="userId != null">
#{userId},
</if>
<if test="yeartime != null">
#{yeartime},
</if>
<if test="monthtime != null">
#{monthtime},
</if>
<if test="daytime != null">
#{daytime},
</if>
<if test="type != null">
#{type},
</if>
<if test="changeNum != null">
#{changeNum},
</if>
<if test="changedAmount != null">
#{changedAmount},
</if>
<if test="changeTime != null">
#{changeTime},
</if>
<if test="payState != null">
#{payState},
</if>
<if test="payPlatform != null">
#{payPlatform},
</if>
<if test="payType != null">
#{payType},
</if>
<if test="payRemark != null">
#{payRemark},
</if>
<if test="payInfo != null">
#{payInfo},
</if>
<if test="referenceId != null">
#{referenceId},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="modifyTime != null">
#{modifyTime},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="yeartime != null">
yeartime = #{yeartime},
</if>
<if test="monthtime != null">
monthtime = #{monthtime},
</if>
<if test="daytime != null">
daytime = #{daytime},
</if>
<if test="type != null">
`type` = #{type},
</if>
<if test="changeNum != null">
change_num = #{changeNum},
</if>
<if test="changedAmount != null">
changed_amount = #{changedAmount},
</if>
<if test="changeTime != null">
change_time = #{changeTime},
</if>
<if test="payState != null">
pay_state = #{payState},
</if>
<if test="payPlatform != null">
pay_platform = #{payPlatform},
</if>
<if test="payType != null">
pay_type = #{payType},
</if>
<if test="payRemark != null">
pay_remark = #{payRemark},
</if>
<if test="payInfo != null">
pay_info = #{payInfo},
</if>
<if test="referenceId != null">
reference_id = #{referenceId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
<?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.lanren.huhu.partner.dao.PartnerRewardMapper">
<resultMap id="BaseResultMap" type="com.lanren.huhu.partner.domain.PartnerReward">
<!--@mbg.generated-->
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="user_is_super" property="userIsSuper" />
<result column="user_partner_level" property="userPartnerLevel" />
<result column="reward_type" property="rewardType" />
<result column="reward_status" property="rewardStatus" />
<result column="commission_acount" property="commissionAcount" />
<result column="commission_rate" property="commissionRate" />
<result column="reference_id" property="referenceId" />
<result column="recharge_time" property="rechargeTime" />
<result column="price" property="price" />
<result column="cash" property="cash" />
<result column="source_user_id" property="sourceUserId" />
<result column="invite_user_id" property="inviteUserId" />
<result column="invite_user_level" property="inviteUserLevel" />
<result column="invite_user_is_super" property="inviteUserIsSuper" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
<result column="create_time" property="createTime" />
<result column="source_type" property="sourceType" />
<result column="reward_times" property="rewardTimes" />
<result column="settle_state" property="settleState" />
<result column="goods_id" property="goodsId" />
<result column="title" property="title" />
<result column="order_type" property="orderType" />
<result column="order_sn" property="orderSn" />
<result column="sub_order_sn" property="subOrderSn" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, user_id, user_is_super, user_partner_level, reward_type, reward_status, commission_acount,
commission_rate, reference_id, recharge_time, price, cash, source_user_id, invite_user_id,
invite_user_level, invite_user_is_super, created_at, updated_at, create_time, source_type,
reward_times, settle_state, goods_id, title, order_type, order_sn, sub_order_sn
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update partner_reward
<trim prefix="set" suffixOverrides=",">
<trim prefix="user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.userId}
</foreach>
</trim>
<trim prefix="user_is_super = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.userIsSuper}
</foreach>
</trim>
<trim prefix="user_partner_level = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.userPartnerLevel}
</foreach>
</trim>
<trim prefix="reward_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.rewardType}
</foreach>
</trim>
<trim prefix="reward_status = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.rewardStatus}
</foreach>
</trim>
<trim prefix="commission_acount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.commissionAcount}
</foreach>
</trim>
<trim prefix="commission_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.commissionRate}
</foreach>
</trim>
<trim prefix="reference_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.referenceId}
</foreach>
</trim>
<trim prefix="recharge_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.rechargeTime}
</foreach>
</trim>
<trim prefix="price = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.price}
</foreach>
</trim>
<trim prefix="cash = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.cash}
</foreach>
</trim>
<trim prefix="source_user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.sourceUserId}
</foreach>
</trim>
<trim prefix="invite_user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.inviteUserId}
</foreach>
</trim>
<trim prefix="invite_user_level = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.inviteUserLevel}
</foreach>
</trim>
<trim prefix="invite_user_is_super = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.inviteUserIsSuper}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.createdAt}
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.updatedAt}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.createTime}
</foreach>
</trim>
<trim prefix="source_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.sourceType}
</foreach>
</trim>
<trim prefix="reward_times = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.rewardTimes}
</foreach>
</trim>
<trim prefix="settle_state = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.settleState}
</foreach>
</trim>
<trim prefix="goods_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.goodsId}
</foreach>
</trim>
<trim prefix="title = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.title}
</foreach>
</trim>
<trim prefix="order_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.orderType}
</foreach>
</trim>
<trim prefix="order_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.orderSn}
</foreach>
</trim>
<trim prefix="sub_order_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id} then #{item.subOrderSn}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into partner_reward
(user_id, user_is_super, user_partner_level, reward_type, reward_status, commission_acount,
commission_rate, reference_id, recharge_time, price, cash, source_user_id, invite_user_id,
invite_user_level, invite_user_is_super, created_at, updated_at, create_time, source_type,
reward_times, settle_state, goods_id, title, order_type, order_sn, sub_order_sn
)
values
<foreach collection="list" item="item" separator=",">
(#{item.userId}, #{item.userIsSuper}, #{item.userPartnerLevel}, #{item.rewardType},
#{item.rewardStatus}, #{item.commissionAcount}, #{item.commissionRate}, #{item.referenceId},
#{item.rechargeTime}, #{item.price}, #{item.cash}, #{item.sourceUserId}, #{item.inviteUserId},
#{item.inviteUserLevel}, #{item.inviteUserIsSuper}, #{item.createdAt}, #{item.updatedAt},
#{item.createTime}, #{item.sourceType}, #{item.rewardTimes}, #{item.settleState},
#{item.goodsId}, #{item.title}, #{item.orderType}, #{item.orderSn}, #{item.subOrderSn}
)
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.PartnerReward" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into partner_reward
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
user_id,
user_is_super,
user_partner_level,
reward_type,
reward_status,
commission_acount,
commission_rate,
reference_id,
recharge_time,
price,
cash,
source_user_id,
invite_user_id,
invite_user_level,
invite_user_is_super,
created_at,
updated_at,
create_time,
source_type,
reward_times,
settle_state,
goods_id,
title,
order_type,
order_sn,
sub_order_sn,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
#{userId},
#{userIsSuper},
#{userPartnerLevel},
#{rewardType},
#{rewardStatus},
#{commissionAcount},
#{commissionRate},
#{referenceId},
#{rechargeTime},
#{price},
#{cash},
#{sourceUserId},
#{inviteUserId},
#{inviteUserLevel},
#{inviteUserIsSuper},
#{createdAt},
#{updatedAt},
#{createTime},
#{sourceType},
#{rewardTimes},
#{settleState},
#{goodsId},
#{title},
#{orderType},
#{orderSn},
#{subOrderSn},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
user_id = #{userId},
user_is_super = #{userIsSuper},
user_partner_level = #{userPartnerLevel},
reward_type = #{rewardType},
reward_status = #{rewardStatus},
commission_acount = #{commissionAcount},
commission_rate = #{commissionRate},
reference_id = #{referenceId},
recharge_time = #{rechargeTime},
price = #{price},
cash = #{cash},
source_user_id = #{sourceUserId},
invite_user_id = #{inviteUserId},
invite_user_level = #{inviteUserLevel},
invite_user_is_super = #{inviteUserIsSuper},
created_at = #{createdAt},
updated_at = #{updatedAt},
create_time = #{createTime},
source_type = #{sourceType},
reward_times = #{rewardTimes},
settle_state = #{settleState},
goods_id = #{goodsId},
title = #{title},
order_type = #{orderType},
order_sn = #{orderSn},
sub_order_sn = #{subOrderSn},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.lanren.huhu.partner.domain.PartnerReward" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into partner_reward
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="userIsSuper != null">
user_is_super,
</if>
<if test="userPartnerLevel != null">
user_partner_level,
</if>
<if test="rewardType != null">
reward_type,
</if>
<if test="rewardStatus != null">
reward_status,
</if>
<if test="commissionAcount != null">
commission_acount,
</if>
<if test="commissionRate != null">
commission_rate,
</if>
<if test="referenceId != null">
reference_id,
</if>
<if test="rechargeTime != null">
recharge_time,
</if>
<if test="price != null">
price,
</if>
<if test="cash != null">
cash,
</if>
<if test="sourceUserId != null">
source_user_id,
</if>
<if test="inviteUserId != null">
invite_user_id,
</if>
<if test="inviteUserLevel != null">
invite_user_level,
</if>
<if test="inviteUserIsSuper != null">
invite_user_is_super,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="sourceType != null">
source_type,
</if>
<if test="rewardTimes != null">
reward_times,
</if>
<if test="settleState != null">
settle_state,
</if>
<if test="goodsId != null">
goods_id,
</if>
<if test="title != null">
title,
</if>
<if test="orderType != null">
order_type,
</if>
<if test="orderSn != null">
order_sn,
</if>
<if test="subOrderSn != null">
sub_order_sn,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="userId != null">
#{userId},
</if>
<if test="userIsSuper != null">
#{userIsSuper},
</if>
<if test="userPartnerLevel != null">
#{userPartnerLevel},
</if>
<if test="rewardType != null">
#{rewardType},
</if>
<if test="rewardStatus != null">
#{rewardStatus},
</if>
<if test="commissionAcount != null">
#{commissionAcount},
</if>
<if test="commissionRate != null">
#{commissionRate},
</if>
<if test="referenceId != null">
#{referenceId},
</if>
<if test="rechargeTime != null">
#{rechargeTime},
</if>
<if test="price != null">
#{price},
</if>
<if test="cash != null">
#{cash},
</if>
<if test="sourceUserId != null">
#{sourceUserId},
</if>
<if test="inviteUserId != null">
#{inviteUserId},
</if>
<if test="inviteUserLevel != null">
#{inviteUserLevel},
</if>
<if test="inviteUserIsSuper != null">
#{inviteUserIsSuper},
</if>
<if test="createdAt != null">
#{createdAt},
</if>
<if test="updatedAt != null">
#{updatedAt},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="sourceType != null">
#{sourceType},
</if>
<if test="rewardTimes != null">
#{rewardTimes},
</if>
<if test="settleState != null">
#{settleState},
</if>
<if test="goodsId != null">
#{goodsId},
</if>
<if test="title != null">
#{title},
</if>
<if test="orderType != null">
#{orderType},
</if>
<if test="orderSn != null">
#{orderSn},
</if>
<if test="subOrderSn != null">
#{subOrderSn},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="userIsSuper != null">
user_is_super = #{userIsSuper},
</if>
<if test="userPartnerLevel != null">
user_partner_level = #{userPartnerLevel},
</if>
<if test="rewardType != null">
reward_type = #{rewardType},
</if>
<if test="rewardStatus != null">
reward_status = #{rewardStatus},
</if>
<if test="commissionAcount != null">
commission_acount = #{commissionAcount},
</if>
<if test="commissionRate != null">
commission_rate = #{commissionRate},
</if>
<if test="referenceId != null">
reference_id = #{referenceId},
</if>
<if test="rechargeTime != null">
recharge_time = #{rechargeTime},
</if>
<if test="price != null">
price = #{price},
</if>
<if test="cash != null">
cash = #{cash},
</if>
<if test="sourceUserId != null">
source_user_id = #{sourceUserId},
</if>
<if test="inviteUserId != null">
invite_user_id = #{inviteUserId},
</if>
<if test="inviteUserLevel != null">
invite_user_level = #{inviteUserLevel},
</if>
<if test="inviteUserIsSuper != null">
invite_user_is_super = #{inviteUserIsSuper},
</if>
<if test="createdAt != null">
created_at = #{createdAt},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="sourceType != null">
source_type = #{sourceType},
</if>
<if test="rewardTimes != null">
reward_times = #{rewardTimes},
</if>
<if test="settleState != null">
settle_state = #{settleState},
</if>
<if test="goodsId != null">
goods_id = #{goodsId},
</if>
<if test="title != null">
title = #{title},
</if>
<if test="orderType != null">
order_type = #{orderType},
</if>
<if test="orderSn != null">
order_sn = #{orderSn},
</if>
<if test="subOrderSn != null">
sub_order_sn = #{subOrderSn},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment