Commit 2bd7f88c by yao.xiao

暂存-修改佣金发放状态

parent 1f8683b1
package com.yd.api.agms; package com.yd.api.agms;
import com.yd.api.agms.service.AgmsDashboardService; import com.yd.api.agms.service.AgmsDashboardService;
import com.yd.api.agms.service.AgmsFortuneService;
import com.yd.api.agms.vo.dashboard.*; import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.agms.service.AgmsStatisticsService; import com.yd.api.agms.service.AgmsStatisticsService;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO; import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO; import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO; import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO;
...@@ -24,6 +27,8 @@ public class AgmsController { ...@@ -24,6 +27,8 @@ public class AgmsController {
private AgmsDashboardService agmsDashboardService; private AgmsDashboardService agmsDashboardService;
@Autowired @Autowired
private AgmsStatisticsService agmsStatisticsService; private AgmsStatisticsService agmsStatisticsService;
@Autowired
private AgmsFortuneService agmsFortuneService;
/** /**
* AGMS -- 财务管理报表 * AGMS -- 财务管理报表
...@@ -122,4 +127,18 @@ public class AgmsController { ...@@ -122,4 +127,18 @@ public class AgmsController {
result.addResult(responseVO); result.addResult(responseVO);
return result; return result;
} }
/**
* AGMS -- 修改佣金发放状态
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping(value="/commissionPayoutStatusUpdate")
public Object commissionPayoutStatusUpdate(@RequestBody CommissionPayoutStatusUpdateRequestVO requestVO) {
JsonResult result = new JsonResult();
CommissionPayoutStatusUpdateResponseVO responseVO = agmsFortuneService.commissionPayoutStatusUpdate(requestVO);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
} }
package com.yd.api.agms.service;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO;
/**
* @author xxy
*/
public interface AgmsFortuneService {
/**
* AGMS -- 修改佣金发放状态
* @param requestVO 请求数据
* @return 响应数据
*/
CommissionPayoutStatusUpdateResponseVO commissionPayoutStatusUpdate(CommissionPayoutStatusUpdateRequestVO requestVO);
}
package com.yd.api.agms.service.impl;
import com.yd.api.agms.service.AgmsFortuneService;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import com.yd.dal.service.customer.AclCustomerFortuneDALService;
import com.yd.dal.service.customer.AclCustomerFortuneWithdrawDALService;
import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Method;
import java.security.acl.Acl;
import java.util.*;
/**
* @author xxy
*/
@Service("agmsFortuneService")
public class AgmsFortuneServiceImpl implements AgmsFortuneService {
private AclCustomerFortuneDALService customerFortuneDalService;
private AclCustomerFortuneWithdrawDALService customerFortuneWithdrawDalService;
@Autowired
public void setAclCustomerFortuneDalService(AclCustomerFortuneDALService customerFortuneDalService) {
this.customerFortuneDalService = customerFortuneDalService;
}
@Autowired
public void setAclCustomerFortuneWithdrawDalService(AclCustomerFortuneWithdrawDALService customerFortuneWithdrawDalService) {
this.customerFortuneWithdrawDalService = customerFortuneWithdrawDalService;
}
@Override
public CommissionPayoutStatusUpdateResponseVO commissionPayoutStatusUpdate(CommissionPayoutStatusUpdateRequestVO requestVO) {
CommissionPayoutStatusUpdateResponseVO responseVO = new CommissionPayoutStatusUpdateResponseVO();
Long[] fortuneIds = requestVO.getFortuneIds();
//1.暂不可发 2.可发放 3.保留
String paymentStatus = requestVO.getPaymentStatus();
Long loginId = requestVO.getLoginId();
//查询出需修改的佣金发放状态的财富
List<AclCustomerFortune> customerFortunes = customerFortuneDalService.findByIds(fortuneIds);
if (("2").equals(paymentStatus)){
//如paymentStatus = 2(可发放),只需统计Fortune对应Customer最后一笔未支付的Withdraw,重新计算,如没有Withdraw生成一条新的Withdraw记录
canPaymentUpDate(paymentStatus,loginId,customerFortunes);
}else {
//如paymentStatus != 2(暂不可发,保留),只需统计原Fortune对应的Withdraw,重新计算
noPaymentUpDate(paymentStatus,loginId,customerFortunes);
}
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
private void canPaymentUpDate(String paymentStatus, Long loginId, List<AclCustomerFortune> customerFortunes) {
//将查询出来的财富列表根据customerId经行分类
Map<Long,List<AclCustomerFortune>> customerFortuneMap = changeCustomerFortunes(customerFortunes);
//获得所有需要修改佣金发放状的customerIds
Set<Long> customerIds = customerFortuneMap.keySet();
//查询这些customerId最后一笔未完成的提现记录ag_acl_customer_fortune_withdraw,需重新计算withdraw
Map<Long,Long> customerWithdrawMap = customerFortuneWithdrawDalService.findFinalWithdrawNoPayByCustomerIds(customerIds);
//没有最后一笔提现记录客户信息和此次提现的财富记录 customerId fortunes
Map<Long,List<AclCustomerFortune>> newCustomerWithdrawMap = new HashMap<>(16);
//可直接修改的fortune记录(需修改佣金发放状态)
List<AclCustomerFortune> fortuneUpdates = new ArrayList<>();
for(Map.Entry<Long, List<AclCustomerFortune>> customerFortune:customerFortuneMap.entrySet()){
//获取需要修改佣金发放状态的经纪人
Long customerId = customerFortune.getKey();
//此customer最后一笔提现记录id
Long withdrawId = customerWithdrawMap.get(customerId);
//新提现的记录
List<AclCustomerFortune> newFortunes = new ArrayList<>();
//获取休要修改的佣金发放状态的财富记录
List<AclCustomerFortune> fortunes = customerFortune.getValue();
//判断这些财富记录中佣金发放状态和要修改的状态是否一致,如一致,则不需要修改
for(AclCustomerFortune fortune : customerFortunes) {
//不一致,进行修改,并保存需修改的fortune和记录需要新生成的fortune
if (!paymentStatus.equals(fortune.getCommissionPayoutStatus())) {
fortune.setCommissionPayoutStatus(paymentStatus);
fortune.setCommissionPayoutBy(loginId);
fortune.setCommissionPayoutAt(new Date());
if (CommonUtil.isNullOrZero(withdrawId)){
//需生成新的withdraw
newFortunes.add(fortune);
}else {
//可直接修改fortune
fortune.setWithdrawedId(withdrawId);
fortuneUpdates.add(fortune);
}
}
}
if (!newFortunes.isEmpty()){
newCustomerWithdrawMap.put(customerId,newFortunes);
}
}
//批量更新需要修改的fortune记录
customerFortuneDalService.updateBatch(fortuneUpdates);
//重新计算受到影响的withdraw
List<Long> withdrawUpdateIds = new ArrayList<>(customerWithdrawMap.keySet());
recalculateWithdraw(withdrawUpdateIds);
//更新生成新的提现记录,及支付记录,fortune中记录对应的withdraw.id
insertWithdraw(newCustomerWithdrawMap);
}
private void noPaymentUpDate(String paymentStatus, Long loginId, List<AclCustomerFortune> customerFortunes) {
//需要修改的fortune记录(需修改佣金发放状态)
List<AclCustomerFortune> fortuneUpdates = new ArrayList<>();
//需要重新计算的withdraw.id
List<Long> withdrawUpdateIds = new ArrayList<>();
for(AclCustomerFortune fortune : customerFortunes){
//不一致,进行修改,并保存需修改的fortune和需重新计算的withdrawIds
if (!paymentStatus.equals(fortune.getCommissionPayoutStatus())){
fortune.setCommissionPayoutStatus(paymentStatus);
fortune.setCommissionPayoutBy(loginId);
fortune.setCommissionPayoutAt(new Date());
Long withdrawId = fortune.getWithdrawedId();
fortune.setWithdrawedId(null);
fortuneUpdates.add(fortune);
if (!CommonUtil.isNullOrZero(withdrawId)){
withdrawUpdateIds.add(withdrawId);
}
}
}
//批量更新需要修改的fortune记录
customerFortuneDalService.updateBatch(fortuneUpdates);
//重新计算受到影响的withdraw
recalculateWithdraw(withdrawUpdateIds);
}
private void recalculateWithdraw(List<Long> withdrawUpdateIds) {
if (withdrawUpdateIds.isEmpty()){
return;
}
System.out.println("recalculateWithdraw");
// List<AclCustomerFortune> fortunes = customerFortuneDalService.findByWithdrawIds(withdrawUpdateIds);
}
private void insertWithdraw(Map<Long, List<AclCustomerFortune>> newCustomerWithdrawMap) {
if (newCustomerWithdrawMap.isEmpty()){
return;
}
System.out.println("insertWithdraw");
}
private Map<Long, List<AclCustomerFortune>> changeCustomerFortunes(List<AclCustomerFortune> customerFortunes) {
Map<Long, List<AclCustomerFortune>> map = new HashMap<>(16);
for (AclCustomerFortune list: customerFortunes) {
List<AclCustomerFortune> customerFortuneList = map.get(list.getCustomerId());
customerFortuneList = Optional.ofNullable(customerFortuneList).orElse(new ArrayList<>());
if (customerFortuneList.isEmpty()){
customerFortuneList.add(list);
map.put(list.getCustomerId(),customerFortuneList);
}else {
customerFortuneList.add(list);
}
}
return map;
}
private Map<Long, List<Object>> changeList(List<Object> objList ,String name) {
Map<Long, List<Object>> map = new HashMap<>(16);
for (Object obj: objList) {
List<Object> list = map.get(getFieldValueByName(name,obj));
list = Optional.ofNullable(list).orElse(new ArrayList<>());
if (list.isEmpty()){
list.add(list);
map.put(getFieldValueByName(name,obj),list);
}else {
list.add(list);
}
}
return map;
}
/**
* 根据属性名获取属性值
* */
private Long getFieldValueByName(String fieldName, Object o) {
try {
String firstLetter = fieldName.substring(0, 1).toUpperCase();
String getter = "get" + firstLetter + fieldName.substring(1);
Method method = o.getClass().getMethod(getter, new Class[] {});
return (Long) method.invoke(o, new Object[] {});
} catch (Exception e) {
return null;
}
}
}
package com.yd.api.agms.vo.fortune;
import lombok.Data;
/**
* @author xxy
*/
@Data
public class CommissionPayoutStatusUpdateRequestVO {
/**
* 财富id,fortuneId
*/
private Long[] fortuneIds;
/**
* 佣金发放状态
* 1.暂不可发 2.可发放 3.保留
*/
private String paymentStatus;
/**
* 登入者id,loginId
*/
private Long loginId;
}
package com.yd.api.agms.vo.fortune;
import com.yd.api.result.CommonResult;
import lombok.Data;
/**
* @author xxy
*/
@Data
public class CommissionPayoutStatusUpdateResponseVO {
private CommonResult commonResult;
}
package com.yd.dal.entity.customer; package com.yd.dal.entity.customer;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;
/** /**
* ag_acl_customer_fortune * fortune record of customer
* @author
*/ */
@Data @Data
public class AclCustomerFortune implements Serializable { public class AclCustomerFortune {
private static final long serialVersionUID = 1L;
/** /**
* serial id * serial id
*/ */
...@@ -46,14 +45,14 @@ public class AclCustomerFortune implements Serializable { ...@@ -46,14 +45,14 @@ public class AclCustomerFortune implements Serializable {
private BigDecimal commissionAmount; private BigDecimal commissionAmount;
/** /**
* FK ag_product_plan_commission,ag_product_life_plan_commission公告佣金率 * 公告佣金率存百分值
*/ */
private BigDecimal announcementCommissionRate; private BigDecimal fycRate;
/** /**
* 公告佣金 * 公告佣金
*/ */
private BigDecimal announcementCommissionAmount; private BigDecimal fycAmount;
/** /**
* FK ag_acl_channel_referral_rate个人职级佣金率 * FK ag_acl_channel_referral_rate个人职级佣金率
...@@ -61,13 +60,38 @@ public class AclCustomerFortune implements Serializable { ...@@ -61,13 +60,38 @@ public class AclCustomerFortune implements Serializable {
private BigDecimal gradeCommissionRate; private BigDecimal gradeCommissionRate;
/** /**
* %=referral amount / order price * 多个代理人财富分摊比例
*/
private BigDecimal shareRate;
/**
* %=referral amount / order price
*/ */
private BigDecimal referralRate; private BigDecimal referralRate;
private BigDecimal referralAmount; private BigDecimal referralAmount;
/** /**
* 发佣年月
*/
private String monthPeriod;
/**
* 佣金类型
*/
private String commissionType;
/**
* FK ag_md_drop_options.drop_option_code where master = Commission_Type,佣金项目类型编码
*/
private String dropOptionCode;
/**
* 经纪人等级
*/
private String practitionerLevel;
/**
* 0=No, 1=Yes * 0=No, 1=Yes
*/ */
private Integer isTax; private Integer isTax;
...@@ -82,11 +106,31 @@ public class AclCustomerFortune implements Serializable { ...@@ -82,11 +106,31 @@ public class AclCustomerFortune implements Serializable {
private Long campaignId; private Long campaignId;
/** /**
* 推广活动
*/
private String campaignName;
/**
* 可提现日期,在生产记录时就算好 * 可提现日期,在生产记录时就算好
*/ */
private Date withdrawableDate; private Date withdrawableDate;
/** /**
* FK ag_md_drop_options.drop_option_code where master = Commission_Payout_Status,佣金发放状态
*/
private String commissionPayoutStatus;
/**
* 发放状态修改时间
*/
private Date commissionPayoutAt;
/**
* FK ag_acl_user.id
*/
private Long commissionPayoutBy;
/**
* FK ag_acl_customer_fortune_withdraw.id 提现表的id * FK ag_acl_customer_fortune_withdraw.id 提现表的id
*/ */
private Long withdrawedId; private Long withdrawedId;
...@@ -105,6 +149,4 @@ public class AclCustomerFortune implements Serializable { ...@@ -105,6 +149,4 @@ public class AclCustomerFortune implements Serializable {
* FK ag_acl_customer.id * FK ag_acl_customer.id
*/ */
private Long createdBy; private Long createdBy;
private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package com.yd.dal.entity.customer;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* 财务红包小助手真实付给客户提现记录
*/
@Data
public class AclCustomerFortunePay {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_customer_fortune_withdraw.id
*/
private Long withdrawId;
/**
* 提现金额
*/
private BigDecimal withdrawAmount;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
private String customerName;
/**
* 活动id, FK ag_md_mk_campaign.id
*/
private Long campaignId;
/**
* 活动名称
*/
private String campaignName;
/**
* 活动酬金额
*/
private BigDecimal campaingReward;
/**
* 收款者
*/
private String payTo;
private String payToMobile;
/**
* 收款者微信账号
*/
private String payToWechat;
/**
* 收款者证件类型 FK ag_md_id_type, 1=身份证 2=护照 4=台胞证 5=香港身份证
*/
private Long payToIdTypeId;
/**
* 收款者证件号码
*/
private String payToIdNo;
/**
* 收款者生日
*/
private Date payToBirthday;
/**
* 收款者性别 1=Male, 2=Female
*/
private Integer payToGender;
/**
* 付款日
*/
private Date payDate;
/**
* 付款金额
*/
private BigDecimal payAmount;
/**
* 代缴税额
*/
private BigDecimal taxAmount;
/**
* 付款执行者
*/
private String paidBy;
/**
* 1. Wechat red envelope 3. Bank
*/
private Integer paidMethod;
/**
* 0. 待付 1已付
*/
private Integer payStatus;
/**
* 注释或补充
*/
private String remark;
private Date createdAt;
private Long createdBy;
private Date updatedAt;
/**
* 变更者 id
*/
private Long updatedBy;
}
\ No newline at end of file
package com.yd.dal.entity.customer;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* customer withdrawl record
*/
@Data
public class AclCustomerFortuneWithdraw {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
/**
* FK ag_acl_customer_lottery_draws.id
*/
private Long lotteryDrawsId;
/**
* balance before withdrawal
*/
private BigDecimal withdrawBeforeAmount;
private BigDecimal withdrawAmount;
/**
* balance after withdrawal
*/
private BigDecimal withdrawAfterAmount;
/**
* 0=No=申请中, 1=Yes=已付
*/
private Integer isPaid;
/**
* Paid date by finance
*/
private Date paidDate;
private BigDecimal paidAmount;
/**
* 付款后的待缴税额
*/
private BigDecimal taxAmount;
/**
* 1. Wechat red envelope 3. Bank
*/
private Integer paidMethod;
/**
* 提现申请者
*/
private String requestorName;
/**
* 证件类型 FK ag_md_id_type, 1=身份证 2=护照 4=台胞证 5=香港身份证
*/
private Long requestorIdTypeId;
/**
* 证件号码
*/
private String requestorId;
/**
* 申请者生日
*/
private Date requestorBirthdate;
/**
* 申请者性别 1=Male, 2=Female
*/
private Integer requestorGender;
/**
* 0=核实中, 1=已支付关帐, 2=取消
*/
private Integer status;
/**
* 提现申请者wechat id (加入红包小助手)
*/
private String wechatId;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private Long createdBy;
}
\ No newline at end of file
package com.yd.dal.mapper.customer; package com.yd.dal.mapper.customer;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics; import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.entity.customer.AclCustomerFortune;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortuneMapper { public interface AclCustomerFortuneMapper {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
...@@ -19,5 +17,13 @@ public interface AclCustomerFortuneMapper { ...@@ -19,5 +17,13 @@ public interface AclCustomerFortuneMapper {
int updateByPrimaryKey(AclCustomerFortune record); int updateByPrimaryKey(AclCustomerFortune record);
int updateBatch(List<AclCustomerFortune> list);
int updateBatchSelective(List<AclCustomerFortune> list);
int batchInsert(@Param("list") List<AclCustomerFortune> list);
List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(@Param("subordinateSystemId") Long subordinateSystemId, @Param("time") Integer time); List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(@Param("subordinateSystemId") Long subordinateSystemId, @Param("time") Integer time);
List<AclCustomerFortune> findByIds(Long[] fortuneIds);
} }
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomerFortunePay;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortunePayMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortunePay record);
int insertSelective(AclCustomerFortunePay record);
AclCustomerFortunePay selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortunePay record);
int updateByPrimaryKey(AclCustomerFortunePay record);
int updateBatch(List<AclCustomerFortunePay> list);
int updateBatchSelective(List<AclCustomerFortunePay> list);
int batchInsert(@Param("list") List<AclCustomerFortunePay> list);
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortuneWithdrawMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortuneWithdraw record);
int insertSelective(AclCustomerFortuneWithdraw record);
AclCustomerFortuneWithdraw selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortuneWithdraw record);
int updateByPrimaryKey(AclCustomerFortuneWithdraw record);
int updateBatch(List<AclCustomerFortuneWithdraw> list);
int updateBatchSelective(List<AclCustomerFortuneWithdraw> list);
int batchInsert(@Param("list") List<AclCustomerFortuneWithdraw> list);
List<Map<String, Object>> findFinalWithdrawNoPayByCustomerIds(List<Long> customerIdList);
}
\ No newline at end of file
package com.yd.dal.service.customer; package com.yd.dal.service.customer;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics; import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import com.yd.dal.entity.customer.AclCustomerFortune;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/**
* @author xxy
*/
@Service("aclCustomerFortuneDALService") @Service("aclCustomerFortuneDALService")
public interface AclCustomerFortuneDALService { public interface AclCustomerFortuneDALService {
List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time); List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time);
List<AclCustomerFortune> findByIds(Long[] fortuneIds);
void updateBatch(List<AclCustomerFortune> fortuneUpdates);
} }
package com.yd.dal.service.customer;
import org.springframework.stereotype.Service;
/**
* @author xxy
*/
public interface AclCustomerFortunePayDALService {
}
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Set;
/**
* @author xxy
*/
public interface AclCustomerFortuneWithdrawDALService {
/**
* 查询这些customerId最后一笔未完成的提现记录
* @param customerIds 客户id
* @return map customerId withdrawId
*/
Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds);
}
package com.yd.dal.service.customer.impl; package com.yd.dal.service.customer.impl;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics; import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.mapper.customer.AclCustomerFortuneMapper; import com.yd.dal.mapper.customer.AclCustomerFortuneMapper;
import com.yd.dal.service.customer.AclCustomerFortuneDALService; import com.yd.dal.service.customer.AclCustomerFortuneDALService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -16,4 +17,16 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe ...@@ -16,4 +17,16 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe
public List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time) { public List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time) {
return aclCustomerFortuneMapper.findBySubordinateSystemStatistics(subordinateSystemId,time); return aclCustomerFortuneMapper.findBySubordinateSystemStatistics(subordinateSystemId,time);
} }
@Override
public List<AclCustomerFortune> findByIds(Long[] fortuneIds) {
return aclCustomerFortuneMapper.findByIds(fortuneIds);
}
@Override
public void updateBatch(List<AclCustomerFortune> fortuneUpdates) {
if (!fortuneUpdates.isEmpty()){
aclCustomerFortuneMapper.updateBatch(fortuneUpdates);
}
}
} }
package com.yd.dal.service.customer.impl;
import com.yd.dal.service.customer.AclCustomerFortunePayDALService;
/**
* @author xxy
*/
public class AclCustomerFortunePayDALServiceImpl implements AclCustomerFortunePayDALService {
}
package com.yd.dal.service.customer.impl;
import com.yd.dal.mapper.customer.AclCustomerFortuneWithdrawMapper;
import com.yd.dal.service.customer.AclCustomerFortuneWithdrawDALService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author xxy
*/
@Service("aclCustomerFortuneWithdrawDALService")
public class AclCustomerFortuneWithdrawDALServiceImpl implements AclCustomerFortuneWithdrawDALService {
@Autowired
private AclCustomerFortuneWithdrawMapper customerFortuneWithdrawMapper;
@Override
public Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds) {
List<Long> customerIdList = new ArrayList<>(customerIds);
List<Map<String,Object>> customerWithdrawList = customerFortuneWithdrawMapper.findFinalWithdrawNoPayByCustomerIds(customerIdList);
Map<Long, Long> customerWithdrawMap = new HashMap<>(16);
for (Map<String, Object> customerWithdraw : customerWithdrawList) {
Long customerId = (Long) customerWithdraw.get("customerId");
String withdrawIds = (String) customerWithdraw.get("withdrawIds");
//查询接口中以进行排序,转为数组,取最后一个
List<String> withdrawList = Arrays.asList(withdrawIds.split(","));
Long withdrawId = Long.valueOf(withdrawList.get(withdrawList.size()-1));
customerWithdrawMap.put(customerId,withdrawId);
}
return customerWithdrawMap;
}
}
...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml ...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml
######datasource###### ######datasource######
###spring boot自动配置单数据源### ###spring boot自动配置单数据源###
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
spring.datasource.username=devdbuser spring.datasource.username=devdbuser
spring.datasource.password=devdbpass1 spring.datasource.password=devdbpass1
###手动配置多数据源### ###手动配置多数据源###
#master #master
multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver
multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
multiple.datasource.master.username=devdbuser multiple.datasource.master.username=devdbuser
multiple.datasource.master.password=devdbpass1 multiple.datasource.master.password=devdbpass1
......
...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml ...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml
######datasource###### ######datasource######
###spring boot缺省配置单数据源### ###spring boot缺省配置单数据源###
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
spring.datasource.username=devdbuser spring.datasource.username=devdbuser
spring.datasource.password=devdbpass1 spring.datasource.password=devdbpass1
###手动配置主数据源### ###手动配置主数据源###
#master #master
multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver
multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
multiple.datasource.master.username=devdbuser multiple.datasource.master.username=devdbuser
multiple.datasource.master.password=devdbpass1 multiple.datasource.master.password=devdbpass1
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yd.dal.mapper.customer.AclCustomerFortuneMapper"> <mapper namespace="com.yd.dal.mapper.customer.AclCustomerFortuneMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortune"> <resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortune">
<!--@mbg.generated-->
<!--@Table ag_acl_customer_fortune-->
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="share_id" jdbcType="BIGINT" property="shareId" /> <result column="share_id" jdbcType="BIGINT" property="shareId" />
<result column="customer_id" jdbcType="BIGINT" property="customerId" /> <result column="customer_id" jdbcType="BIGINT" property="customerId" />
...@@ -10,56 +12,78 @@ ...@@ -10,56 +12,78 @@
<result column="order_price" jdbcType="DECIMAL" property="orderPrice" /> <result column="order_price" jdbcType="DECIMAL" property="orderPrice" />
<result column="commission_rate" jdbcType="DECIMAL" property="commissionRate" /> <result column="commission_rate" jdbcType="DECIMAL" property="commissionRate" />
<result column="commission_amount" jdbcType="DECIMAL" property="commissionAmount" /> <result column="commission_amount" jdbcType="DECIMAL" property="commissionAmount" />
<result column="fyc_rate" jdbcType="DECIMAL" property="fycRate" />
<result column="fyc_amount" jdbcType="DECIMAL" property="fycAmount" />
<result column="grade_commission_rate" jdbcType="DECIMAL" property="gradeCommissionRate" /> <result column="grade_commission_rate" jdbcType="DECIMAL" property="gradeCommissionRate" />
<result column="share_rate" jdbcType="DECIMAL" property="shareRate" />
<result column="referral_rate" jdbcType="DECIMAL" property="referralRate" /> <result column="referral_rate" jdbcType="DECIMAL" property="referralRate" />
<result column="referral_amount" jdbcType="DECIMAL" property="referralAmount" /> <result column="referral_amount" jdbcType="DECIMAL" property="referralAmount" />
<result column="month_period" jdbcType="VARCHAR" property="monthPeriod" />
<result column="commission_type" jdbcType="VARCHAR" property="commissionType" />
<result column="drop_option_code" jdbcType="VARCHAR" property="dropOptionCode" />
<result column="practitioner_level" jdbcType="VARCHAR" property="practitionerLevel" />
<result column="is_tax" jdbcType="INTEGER" property="isTax" /> <result column="is_tax" jdbcType="INTEGER" property="isTax" />
<result column="tax_amount" jdbcType="DECIMAL" property="taxAmount" /> <result column="tax_amount" jdbcType="DECIMAL" property="taxAmount" />
<result column="net_amount" jdbcType="DECIMAL" property="netAmount" /> <result column="net_amount" jdbcType="DECIMAL" property="netAmount" />
<result column="campaign_id" jdbcType="BIGINT" property="campaignId" /> <result column="campaign_id" jdbcType="BIGINT" property="campaignId" />
<result column="campaign_name" jdbcType="VARCHAR" property="campaignName" />
<result column="withdrawable_date" jdbcType="TIMESTAMP" property="withdrawableDate" /> <result column="withdrawable_date" jdbcType="TIMESTAMP" property="withdrawableDate" />
<result column="commission_payout_status" jdbcType="VARCHAR" property="commissionPayoutStatus" />
<result column="commission_payout_at" jdbcType="TIMESTAMP" property="commissionPayoutAt" />
<result column="commission_payout_by" jdbcType="BIGINT" property="commissionPayoutBy" />
<result column="withdrawed_id" jdbcType="BIGINT" property="withdrawedId" /> <result column="withdrawed_id" jdbcType="BIGINT" property="withdrawedId" />
<result column="fortune_payed_id" jdbcType="BIGINT" property="fortunePayedId" /> <result column="fortune_payed_id" jdbcType="BIGINT" property="fortunePayedId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" /> <result column="created_by" jdbcType="BIGINT" property="createdBy" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated-->
id, share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount, id, share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount,
grade_commission_rate, fyc_rate, fyc_amount, grade_commission_rate, share_rate, referral_rate, referral_amount,
referral_rate, referral_amount, is_tax, tax_amount, month_period, commission_type, drop_option_code, practitioner_level, is_tax, tax_amount,
net_amount, campaign_id, withdrawable_date, withdrawed_id, fortune_payed_id, created_at, net_amount, campaign_id, campaign_name, withdrawable_date, commission_payout_status,
commission_payout_at, commission_payout_by, withdrawed_id, fortune_payed_id, created_at,
created_by created_by
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from ag_acl_customer_fortune from ag_acl_customer_fortune
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_acl_customer_fortune delete from ag_acl_customer_fortune
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune (share_id, customer_id, order_id, insert into ag_acl_customer_fortune (share_id, customer_id, order_id,
order_date, order_price, commission_rate, order_date, order_price, commission_rate,
commission_amount, grade_commission_rate, commission_amount, fyc_rate, fyc_amount,
referral_rate, referral_amount, grade_commission_rate, share_rate, referral_rate,
is_tax, tax_amount, net_amount, referral_amount, month_period, commission_type,
campaign_id, withdrawable_date, withdrawed_id, drop_option_code, practitioner_level, is_tax,
fortune_payed_id, created_at, created_by tax_amount, net_amount, campaign_id,
) campaign_name, withdrawable_date, commission_payout_status,
commission_payout_at, commission_payout_by,
withdrawed_id, fortune_payed_id, created_at,
created_by)
values (#{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, values (#{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT},
#{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL}, #{commissionRate,jdbcType=DECIMAL}, #{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL}, #{commissionRate,jdbcType=DECIMAL},
#{commissionAmount,jdbcType=DECIMAL}, #{commissionAmount,jdbcType=DECIMAL}, #{fycRate,jdbcType=DECIMAL}, #{fycAmount,jdbcType=DECIMAL},
#{gradeCommissionRate,jdbcType=DECIMAL}, #{gradeCommissionRate,jdbcType=DECIMAL}, #{shareRate,jdbcType=DECIMAL}, #{referralRate,jdbcType=DECIMAL},
#{referralRate,jdbcType=DECIMAL}, #{referralAmount,jdbcType=DECIMAL}, #{referralAmount,jdbcType=DECIMAL}, #{monthPeriod,jdbcType=VARCHAR}, #{commissionType,jdbcType=VARCHAR},
#{isTax,jdbcType=INTEGER}, #{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL}, #{dropOptionCode,jdbcType=VARCHAR}, #{practitionerLevel,jdbcType=VARCHAR}, #{isTax,jdbcType=INTEGER},
#{campaignId,jdbcType=BIGINT}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{withdrawedId,jdbcType=BIGINT}, #{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL}, #{campaignId,jdbcType=BIGINT},
#{fortunePayedId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT} #{campaignName,jdbcType=VARCHAR}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{commissionPayoutStatus,jdbcType=VARCHAR},
) #{commissionPayoutAt,jdbcType=TIMESTAMP}, #{commissionPayoutBy,jdbcType=BIGINT},
#{withdrawedId,jdbcType=BIGINT}, #{fortunePayedId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune insert into ag_acl_customer_fortune
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shareId != null"> <if test="shareId != null">
...@@ -83,21 +107,36 @@ ...@@ -83,21 +107,36 @@
<if test="commissionAmount != null"> <if test="commissionAmount != null">
commission_amount, commission_amount,
</if> </if>
<if test="announcementCommissionRate != null"> <if test="fycRate != null">
announcement_commission_rate, fyc_rate,
</if> </if>
<if test="announcementCommissionAmount != null"> <if test="fycAmount != null">
announcement_commission_amount, fyc_amount,
</if> </if>
<if test="gradeCommissionRate != null"> <if test="gradeCommissionRate != null">
grade_commission_rate, grade_commission_rate,
</if> </if>
<if test="shareRate != null">
share_rate,
</if>
<if test="referralRate != null"> <if test="referralRate != null">
referral_rate, referral_rate,
</if> </if>
<if test="referralAmount != null"> <if test="referralAmount != null">
referral_amount, referral_amount,
</if> </if>
<if test="monthPeriod != null">
month_period,
</if>
<if test="commissionType != null">
commission_type,
</if>
<if test="dropOptionCode != null">
drop_option_code,
</if>
<if test="practitionerLevel != null">
practitioner_level,
</if>
<if test="isTax != null"> <if test="isTax != null">
is_tax, is_tax,
</if> </if>
...@@ -110,9 +149,21 @@ ...@@ -110,9 +149,21 @@
<if test="campaignId != null"> <if test="campaignId != null">
campaign_id, campaign_id,
</if> </if>
<if test="campaignName != null">
campaign_name,
</if>
<if test="withdrawableDate != null"> <if test="withdrawableDate != null">
withdrawable_date, withdrawable_date,
</if> </if>
<if test="commissionPayoutStatus != null">
commission_payout_status,
</if>
<if test="commissionPayoutAt != null">
commission_payout_at,
</if>
<if test="commissionPayoutBy != null">
commission_payout_by,
</if>
<if test="withdrawedId != null"> <if test="withdrawedId != null">
withdrawed_id, withdrawed_id,
</if> </if>
...@@ -148,15 +199,36 @@ ...@@ -148,15 +199,36 @@
<if test="commissionAmount != null"> <if test="commissionAmount != null">
#{commissionAmount,jdbcType=DECIMAL}, #{commissionAmount,jdbcType=DECIMAL},
</if> </if>
<if test="fycRate != null">
#{fycRate,jdbcType=DECIMAL},
</if>
<if test="fycAmount != null">
#{fycAmount,jdbcType=DECIMAL},
</if>
<if test="gradeCommissionRate != null"> <if test="gradeCommissionRate != null">
#{gradeCommissionRate,jdbcType=DECIMAL}, #{gradeCommissionRate,jdbcType=DECIMAL},
</if> </if>
<if test="shareRate != null">
#{shareRate,jdbcType=DECIMAL},
</if>
<if test="referralRate != null"> <if test="referralRate != null">
#{referralRate,jdbcType=DECIMAL}, #{referralRate,jdbcType=DECIMAL},
</if> </if>
<if test="referralAmount != null"> <if test="referralAmount != null">
#{referralAmount,jdbcType=DECIMAL}, #{referralAmount,jdbcType=DECIMAL},
</if> </if>
<if test="monthPeriod != null">
#{monthPeriod,jdbcType=VARCHAR},
</if>
<if test="commissionType != null">
#{commissionType,jdbcType=VARCHAR},
</if>
<if test="dropOptionCode != null">
#{dropOptionCode,jdbcType=VARCHAR},
</if>
<if test="practitionerLevel != null">
#{practitionerLevel,jdbcType=VARCHAR},
</if>
<if test="isTax != null"> <if test="isTax != null">
#{isTax,jdbcType=INTEGER}, #{isTax,jdbcType=INTEGER},
</if> </if>
...@@ -169,9 +241,21 @@ ...@@ -169,9 +241,21 @@
<if test="campaignId != null"> <if test="campaignId != null">
#{campaignId,jdbcType=BIGINT}, #{campaignId,jdbcType=BIGINT},
</if> </if>
<if test="campaignName != null">
#{campaignName,jdbcType=VARCHAR},
</if>
<if test="withdrawableDate != null"> <if test="withdrawableDate != null">
#{withdrawableDate,jdbcType=TIMESTAMP}, #{withdrawableDate,jdbcType=TIMESTAMP},
</if> </if>
<if test="commissionPayoutStatus != null">
#{commissionPayoutStatus,jdbcType=VARCHAR},
</if>
<if test="commissionPayoutAt != null">
#{commissionPayoutAt,jdbcType=TIMESTAMP},
</if>
<if test="commissionPayoutBy != null">
#{commissionPayoutBy,jdbcType=BIGINT},
</if>
<if test="withdrawedId != null"> <if test="withdrawedId != null">
#{withdrawedId,jdbcType=BIGINT}, #{withdrawedId,jdbcType=BIGINT},
</if> </if>
...@@ -187,6 +271,7 @@ ...@@ -187,6 +271,7 @@
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerFortune"> <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerFortune">
<!--@mbg.generated-->
update ag_acl_customer_fortune update ag_acl_customer_fortune
<set> <set>
<if test="shareId != null"> <if test="shareId != null">
...@@ -210,15 +295,36 @@ ...@@ -210,15 +295,36 @@
<if test="commissionAmount != null"> <if test="commissionAmount != null">
commission_amount = #{commissionAmount,jdbcType=DECIMAL}, commission_amount = #{commissionAmount,jdbcType=DECIMAL},
</if> </if>
<if test="fycRate != null">
fyc_rate = #{fycRate,jdbcType=DECIMAL},
</if>
<if test="fycAmount != null">
fyc_amount = #{fycAmount,jdbcType=DECIMAL},
</if>
<if test="gradeCommissionRate != null"> <if test="gradeCommissionRate != null">
grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL}, grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL},
</if> </if>
<if test="shareRate != null">
share_rate = #{shareRate,jdbcType=DECIMAL},
</if>
<if test="referralRate != null"> <if test="referralRate != null">
referral_rate = #{referralRate,jdbcType=DECIMAL}, referral_rate = #{referralRate,jdbcType=DECIMAL},
</if> </if>
<if test="referralAmount != null"> <if test="referralAmount != null">
referral_amount = #{referralAmount,jdbcType=DECIMAL}, referral_amount = #{referralAmount,jdbcType=DECIMAL},
</if> </if>
<if test="monthPeriod != null">
month_period = #{monthPeriod,jdbcType=VARCHAR},
</if>
<if test="commissionType != null">
commission_type = #{commissionType,jdbcType=VARCHAR},
</if>
<if test="dropOptionCode != null">
drop_option_code = #{dropOptionCode,jdbcType=VARCHAR},
</if>
<if test="practitionerLevel != null">
practitioner_level = #{practitionerLevel,jdbcType=VARCHAR},
</if>
<if test="isTax != null"> <if test="isTax != null">
is_tax = #{isTax,jdbcType=INTEGER}, is_tax = #{isTax,jdbcType=INTEGER},
</if> </if>
...@@ -231,9 +337,21 @@ ...@@ -231,9 +337,21 @@
<if test="campaignId != null"> <if test="campaignId != null">
campaign_id = #{campaignId,jdbcType=BIGINT}, campaign_id = #{campaignId,jdbcType=BIGINT},
</if> </if>
<if test="campaignName != null">
campaign_name = #{campaignName,jdbcType=VARCHAR},
</if>
<if test="withdrawableDate != null"> <if test="withdrawableDate != null">
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP}, withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
</if> </if>
<if test="commissionPayoutStatus != null">
commission_payout_status = #{commissionPayoutStatus,jdbcType=VARCHAR},
</if>
<if test="commissionPayoutAt != null">
commission_payout_at = #{commissionPayoutAt,jdbcType=TIMESTAMP},
</if>
<if test="commissionPayoutBy != null">
commission_payout_by = #{commissionPayoutBy,jdbcType=BIGINT},
</if>
<if test="withdrawedId != null"> <if test="withdrawedId != null">
withdrawed_id = #{withdrawedId,jdbcType=BIGINT}, withdrawed_id = #{withdrawedId,jdbcType=BIGINT},
</if> </if>
...@@ -250,6 +368,7 @@ ...@@ -250,6 +368,7 @@
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerFortune"> <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerFortune">
<!--@mbg.generated-->
update ag_acl_customer_fortune update ag_acl_customer_fortune
set share_id = #{shareId,jdbcType=BIGINT}, set share_id = #{shareId,jdbcType=BIGINT},
customer_id = #{customerId,jdbcType=BIGINT}, customer_id = #{customerId,jdbcType=BIGINT},
...@@ -258,22 +377,439 @@ ...@@ -258,22 +377,439 @@
order_price = #{orderPrice,jdbcType=DECIMAL}, order_price = #{orderPrice,jdbcType=DECIMAL},
commission_rate = #{commissionRate,jdbcType=DECIMAL}, commission_rate = #{commissionRate,jdbcType=DECIMAL},
commission_amount = #{commissionAmount,jdbcType=DECIMAL}, commission_amount = #{commissionAmount,jdbcType=DECIMAL},
fyc_rate = #{fycRate,jdbcType=DECIMAL},
fyc_amount = #{fycAmount,jdbcType=DECIMAL},
grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL}, grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL},
share_rate = #{shareRate,jdbcType=DECIMAL},
referral_rate = #{referralRate,jdbcType=DECIMAL}, referral_rate = #{referralRate,jdbcType=DECIMAL},
referral_amount = #{referralAmount,jdbcType=DECIMAL}, referral_amount = #{referralAmount,jdbcType=DECIMAL},
month_period = #{monthPeriod,jdbcType=VARCHAR},
commission_type = #{commissionType,jdbcType=VARCHAR},
drop_option_code = #{dropOptionCode,jdbcType=VARCHAR},
practitioner_level = #{practitionerLevel,jdbcType=VARCHAR},
is_tax = #{isTax,jdbcType=INTEGER}, is_tax = #{isTax,jdbcType=INTEGER},
tax_amount = #{taxAmount,jdbcType=DECIMAL}, tax_amount = #{taxAmount,jdbcType=DECIMAL},
net_amount = #{netAmount,jdbcType=DECIMAL}, net_amount = #{netAmount,jdbcType=DECIMAL},
campaign_id = #{campaignId,jdbcType=BIGINT}, campaign_id = #{campaignId,jdbcType=BIGINT},
campaign_name = #{campaignName,jdbcType=VARCHAR},
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP}, withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
commission_payout_status = #{commissionPayoutStatus,jdbcType=VARCHAR},
commission_payout_at = #{commissionPayoutAt,jdbcType=TIMESTAMP},
commission_payout_by = #{commissionPayoutBy,jdbcType=BIGINT},
withdrawed_id = #{withdrawedId,jdbcType=BIGINT}, withdrawed_id = #{withdrawedId,jdbcType=BIGINT},
fortune_payed_id = #{fortunePayedId,jdbcType=BIGINT}, fortune_payed_id = #{fortunePayedId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP}, created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT} created_by = #{createdBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="findBySubordinateSystemStatistics" <update id="updateBatch" parameterType="java.util.List">
resultType="com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics"> <!--@mbg.generated-->
update ag_acl_customer_fortune
<trim prefix="set" suffixOverrides=",">
<trim prefix="share_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.shareId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="order_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.orderId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="order_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.orderDate,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="order_price = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.orderPrice,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="commission_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionRate,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="commission_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="fyc_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.fycRate,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="fyc_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.fycAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="grade_commission_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.gradeCommissionRate,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="share_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.shareRate,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="referral_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.referralRate,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="referral_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.referralAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="month_period = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.monthPeriod,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="commission_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionType,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="drop_option_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.dropOptionCode,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="practitioner_level = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.practitionerLevel,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="is_tax = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.isTax,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="tax_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="net_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.netAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="campaign_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="campaign_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignName,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="withdrawable_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawableDate,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="commission_payout_status = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutStatus,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="commission_payout_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="commission_payout_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutBy,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="withdrawed_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawedId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="fortune_payed_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.fortunePayedId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune
<trim prefix="set" suffixOverrides=",">
<trim prefix="share_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.shareId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.shareId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="order_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.orderId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.orderId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="order_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.orderDate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.orderDate,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="order_price = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.orderPrice != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.orderPrice,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="commission_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.commissionRate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionRate,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="commission_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.commissionAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="fyc_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.fycRate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.fycRate,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="fyc_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.fycAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.fycAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="grade_commission_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.gradeCommissionRate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.gradeCommissionRate,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="share_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.shareRate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.shareRate,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="referral_rate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.referralRate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.referralRate,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="referral_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.referralAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.referralAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="month_period = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.monthPeriod != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.monthPeriod,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="commission_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.commissionType != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="drop_option_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.dropOptionCode != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.dropOptionCode,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="practitioner_level = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.practitionerLevel != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.practitionerLevel,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="is_tax = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.isTax != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.isTax,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="tax_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.taxAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="net_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.netAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.netAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="campaign_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.campaignId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="campaign_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.campaignName != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignName,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="withdrawable_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawableDate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawableDate,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="commission_payout_status = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.commissionPayoutStatus != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutStatus,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="commission_payout_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.commissionPayoutAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="commission_payout_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.commissionPayoutBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="withdrawed_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawedId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawedId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="fortune_payed_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.fortunePayedId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.fortunePayedId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune
(share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount,
fyc_rate, fyc_amount, grade_commission_rate, share_rate, referral_rate, referral_amount,
month_period, commission_type, drop_option_code, practitioner_level, is_tax, tax_amount,
net_amount, campaign_id, campaign_name, withdrawable_date, commission_payout_status,
commission_payout_at, commission_payout_by, withdrawed_id, fortune_payed_id, created_at,
created_by)
values
<foreach collection="list" item="item" separator=",">
(#{item.shareId,jdbcType=BIGINT}, #{item.customerId,jdbcType=BIGINT}, #{item.orderId,jdbcType=BIGINT},
#{item.orderDate,jdbcType=TIMESTAMP}, #{item.orderPrice,jdbcType=DECIMAL}, #{item.commissionRate,jdbcType=DECIMAL},
#{item.commissionAmount,jdbcType=DECIMAL}, #{item.fycRate,jdbcType=DECIMAL}, #{item.fycAmount,jdbcType=DECIMAL},
#{item.gradeCommissionRate,jdbcType=DECIMAL}, #{item.shareRate,jdbcType=DECIMAL},
#{item.referralRate,jdbcType=DECIMAL}, #{item.referralAmount,jdbcType=DECIMAL},
#{item.monthPeriod,jdbcType=VARCHAR}, #{item.commissionType,jdbcType=VARCHAR},
#{item.dropOptionCode,jdbcType=VARCHAR}, #{item.practitionerLevel,jdbcType=VARCHAR},
#{item.isTax,jdbcType=INTEGER}, #{item.taxAmount,jdbcType=DECIMAL}, #{item.netAmount,jdbcType=DECIMAL},
#{item.campaignId,jdbcType=BIGINT}, #{item.campaignName,jdbcType=VARCHAR}, #{item.withdrawableDate,jdbcType=TIMESTAMP},
#{item.commissionPayoutStatus,jdbcType=VARCHAR}, #{item.commissionPayoutAt,jdbcType=TIMESTAMP},
#{item.commissionPayoutBy,jdbcType=BIGINT}, #{item.withdrawedId,jdbcType=BIGINT},
#{item.fortunePayedId,jdbcType=BIGINT}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.createdBy,jdbcType=BIGINT}
)
</foreach>
</insert>
<select id="findBySubordinateSystemStatistics" resultType="com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics">
SELECT SELECT
f.customer_id customerId , f.customer_id customerId ,
p.id practitionerId , p.id practitionerId ,
...@@ -288,7 +824,7 @@ ...@@ -288,7 +824,7 @@
INNER JOIN (select t.* from ag_acl_customer_fortune t where t.drop_option_code = "S01" group by t.order_id ) f ON f.customer_id = p.customer_id) INNER JOIN (select t.* from ag_acl_customer_fortune t where t.drop_option_code = "S01" group by t.order_id ) f ON f.customer_id = p.customer_id)
INNER JOIN ag_po_order o ON f.order_id = o.id INNER JOIN ag_po_order o ON f.order_id = o.id
WHERE WHERE
o.status = 3 and o.order_price > 0 o.status = 3 and o.order_price &gt; 0
<choose> <choose>
<when test="time == 1"> <when test="time == 1">
and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' ) and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
...@@ -303,4 +839,14 @@ ...@@ -303,4 +839,14 @@
AND p.subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT} AND p.subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT}
GROUP BY f.customer_id GROUP BY f.customer_id
</select> </select>
<select id="findByIds" parameterType="arraylist" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune
where id in
<foreach collection="array" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </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.yd.dal.mapper.customer.AclCustomerFortunePayMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortunePay">
<!--@mbg.generated-->
<!--@Table ag_acl_customer_fortune_pay-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="withdraw_id" jdbcType="BIGINT" property="withdrawId" />
<result column="withdraw_amount" jdbcType="DECIMAL" property="withdrawAmount" />
<result column="customer_id" jdbcType="BIGINT" property="customerId" />
<result column="customer_name" jdbcType="VARCHAR" property="customerName" />
<result column="campaign_id" jdbcType="BIGINT" property="campaignId" />
<result column="campaign_name" jdbcType="VARCHAR" property="campaignName" />
<result column="campaing_reward" jdbcType="DECIMAL" property="campaingReward" />
<result column="pay_to" jdbcType="VARCHAR" property="payTo" />
<result column="pay_to_mobile" jdbcType="VARCHAR" property="payToMobile" />
<result column="pay_to_wechat" jdbcType="VARCHAR" property="payToWechat" />
<result column="pay_to_id_type_id" jdbcType="BIGINT" property="payToIdTypeId" />
<result column="pay_to_id_no" jdbcType="VARCHAR" property="payToIdNo" />
<result column="pay_to_birthday" jdbcType="DATE" property="payToBirthday" />
<result column="pay_to_gender" jdbcType="INTEGER" property="payToGender" />
<result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
<result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
<result column="tax_amount" jdbcType="DECIMAL" property="taxAmount" />
<result column="paid_by" jdbcType="VARCHAR" property="paidBy" />
<result column="paid_method" jdbcType="INTEGER" property="paidMethod" />
<result column="pay_status" jdbcType="INTEGER" property="payStatus" />
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, withdraw_id, withdraw_amount, customer_id, customer_name, campaign_id, campaign_name,
campaing_reward, pay_to, pay_to_mobile, pay_to_wechat, pay_to_id_type_id, pay_to_id_no,
pay_to_birthday, pay_to_gender, pay_date, pay_amount, tax_amount, paid_by, paid_method,
pay_status, remark, created_at, created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_pay
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_acl_customer_fortune_pay
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePay" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_pay (withdraw_id, withdraw_amount, customer_id,
customer_name, campaign_id, campaign_name,
campaing_reward, pay_to, pay_to_mobile,
pay_to_wechat, pay_to_id_type_id, pay_to_id_no,
pay_to_birthday, pay_to_gender, pay_date,
pay_amount, tax_amount, paid_by,
paid_method, pay_status, remark,
created_at, created_by, updated_at,
updated_by)
values (#{withdrawId,jdbcType=BIGINT}, #{withdrawAmount,jdbcType=DECIMAL}, #{customerId,jdbcType=BIGINT},
#{customerName,jdbcType=VARCHAR}, #{campaignId,jdbcType=BIGINT}, #{campaignName,jdbcType=VARCHAR},
#{campaingReward,jdbcType=DECIMAL}, #{payTo,jdbcType=VARCHAR}, #{payToMobile,jdbcType=VARCHAR},
#{payToWechat,jdbcType=VARCHAR}, #{payToIdTypeId,jdbcType=BIGINT}, #{payToIdNo,jdbcType=VARCHAR},
#{payToBirthday,jdbcType=DATE}, #{payToGender,jdbcType=INTEGER}, #{payDate,jdbcType=TIMESTAMP},
#{payAmount,jdbcType=DECIMAL}, #{taxAmount,jdbcType=DECIMAL}, #{paidBy,jdbcType=VARCHAR},
#{paidMethod,jdbcType=INTEGER}, #{payStatus,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePay" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_pay
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="withdrawId != null">
withdraw_id,
</if>
<if test="withdrawAmount != null">
withdraw_amount,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="customerName != null">
customer_name,
</if>
<if test="campaignId != null">
campaign_id,
</if>
<if test="campaignName != null">
campaign_name,
</if>
<if test="campaingReward != null">
campaing_reward,
</if>
<if test="payTo != null">
pay_to,
</if>
<if test="payToMobile != null">
pay_to_mobile,
</if>
<if test="payToWechat != null">
pay_to_wechat,
</if>
<if test="payToIdTypeId != null">
pay_to_id_type_id,
</if>
<if test="payToIdNo != null">
pay_to_id_no,
</if>
<if test="payToBirthday != null">
pay_to_birthday,
</if>
<if test="payToGender != null">
pay_to_gender,
</if>
<if test="payDate != null">
pay_date,
</if>
<if test="payAmount != null">
pay_amount,
</if>
<if test="taxAmount != null">
tax_amount,
</if>
<if test="paidBy != null">
paid_by,
</if>
<if test="paidMethod != null">
paid_method,
</if>
<if test="payStatus != null">
pay_status,
</if>
<if test="remark != null">
remark,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="withdrawId != null">
#{withdrawId,jdbcType=BIGINT},
</if>
<if test="withdrawAmount != null">
#{withdrawAmount,jdbcType=DECIMAL},
</if>
<if test="customerId != null">
#{customerId,jdbcType=BIGINT},
</if>
<if test="customerName != null">
#{customerName,jdbcType=VARCHAR},
</if>
<if test="campaignId != null">
#{campaignId,jdbcType=BIGINT},
</if>
<if test="campaignName != null">
#{campaignName,jdbcType=VARCHAR},
</if>
<if test="campaingReward != null">
#{campaingReward,jdbcType=DECIMAL},
</if>
<if test="payTo != null">
#{payTo,jdbcType=VARCHAR},
</if>
<if test="payToMobile != null">
#{payToMobile,jdbcType=VARCHAR},
</if>
<if test="payToWechat != null">
#{payToWechat,jdbcType=VARCHAR},
</if>
<if test="payToIdTypeId != null">
#{payToIdTypeId,jdbcType=BIGINT},
</if>
<if test="payToIdNo != null">
#{payToIdNo,jdbcType=VARCHAR},
</if>
<if test="payToBirthday != null">
#{payToBirthday,jdbcType=DATE},
</if>
<if test="payToGender != null">
#{payToGender,jdbcType=INTEGER},
</if>
<if test="payDate != null">
#{payDate,jdbcType=TIMESTAMP},
</if>
<if test="payAmount != null">
#{payAmount,jdbcType=DECIMAL},
</if>
<if test="taxAmount != null">
#{taxAmount,jdbcType=DECIMAL},
</if>
<if test="paidBy != null">
#{paidBy,jdbcType=VARCHAR},
</if>
<if test="paidMethod != null">
#{paidMethod,jdbcType=INTEGER},
</if>
<if test="payStatus != null">
#{payStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=LONGVARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePay">
<!--@mbg.generated-->
update ag_acl_customer_fortune_pay
<set>
<if test="withdrawId != null">
withdraw_id = #{withdrawId,jdbcType=BIGINT},
</if>
<if test="withdrawAmount != null">
withdraw_amount = #{withdrawAmount,jdbcType=DECIMAL},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=BIGINT},
</if>
<if test="customerName != null">
customer_name = #{customerName,jdbcType=VARCHAR},
</if>
<if test="campaignId != null">
campaign_id = #{campaignId,jdbcType=BIGINT},
</if>
<if test="campaignName != null">
campaign_name = #{campaignName,jdbcType=VARCHAR},
</if>
<if test="campaingReward != null">
campaing_reward = #{campaingReward,jdbcType=DECIMAL},
</if>
<if test="payTo != null">
pay_to = #{payTo,jdbcType=VARCHAR},
</if>
<if test="payToMobile != null">
pay_to_mobile = #{payToMobile,jdbcType=VARCHAR},
</if>
<if test="payToWechat != null">
pay_to_wechat = #{payToWechat,jdbcType=VARCHAR},
</if>
<if test="payToIdTypeId != null">
pay_to_id_type_id = #{payToIdTypeId,jdbcType=BIGINT},
</if>
<if test="payToIdNo != null">
pay_to_id_no = #{payToIdNo,jdbcType=VARCHAR},
</if>
<if test="payToBirthday != null">
pay_to_birthday = #{payToBirthday,jdbcType=DATE},
</if>
<if test="payToGender != null">
pay_to_gender = #{payToGender,jdbcType=INTEGER},
</if>
<if test="payDate != null">
pay_date = #{payDate,jdbcType=TIMESTAMP},
</if>
<if test="payAmount != null">
pay_amount = #{payAmount,jdbcType=DECIMAL},
</if>
<if test="taxAmount != null">
tax_amount = #{taxAmount,jdbcType=DECIMAL},
</if>
<if test="paidBy != null">
paid_by = #{paidBy,jdbcType=VARCHAR},
</if>
<if test="paidMethod != null">
paid_method = #{paidMethod,jdbcType=INTEGER},
</if>
<if test="payStatus != null">
pay_status = #{payStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePay">
<!--@mbg.generated-->
update ag_acl_customer_fortune_pay
set withdraw_id = #{withdrawId,jdbcType=BIGINT},
withdraw_amount = #{withdrawAmount,jdbcType=DECIMAL},
customer_id = #{customerId,jdbcType=BIGINT},
customer_name = #{customerName,jdbcType=VARCHAR},
campaign_id = #{campaignId,jdbcType=BIGINT},
campaign_name = #{campaignName,jdbcType=VARCHAR},
campaing_reward = #{campaingReward,jdbcType=DECIMAL},
pay_to = #{payTo,jdbcType=VARCHAR},
pay_to_mobile = #{payToMobile,jdbcType=VARCHAR},
pay_to_wechat = #{payToWechat,jdbcType=VARCHAR},
pay_to_id_type_id = #{payToIdTypeId,jdbcType=BIGINT},
pay_to_id_no = #{payToIdNo,jdbcType=VARCHAR},
pay_to_birthday = #{payToBirthday,jdbcType=DATE},
pay_to_gender = #{payToGender,jdbcType=INTEGER},
pay_date = #{payDate,jdbcType=TIMESTAMP},
pay_amount = #{payAmount,jdbcType=DECIMAL},
tax_amount = #{taxAmount,jdbcType=DECIMAL},
paid_by = #{paidBy,jdbcType=VARCHAR},
paid_method = #{paidMethod,jdbcType=INTEGER},
pay_status = #{payStatus,jdbcType=INTEGER},
remark = #{remark,jdbcType=LONGVARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_pay
<trim prefix="set" suffixOverrides=",">
<trim prefix="withdraw_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="withdraw_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="customer_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerName,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="campaign_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="campaign_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignName,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="campaing_reward = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaingReward,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="pay_to = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payTo,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="pay_to_mobile = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToMobile,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="pay_to_wechat = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToWechat,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="pay_to_id_type_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToIdTypeId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="pay_to_id_no = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToIdNo,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="pay_to_birthday = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToBirthday,jdbcType=DATE}
</foreach>
</trim>
<trim prefix="pay_to_gender = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToGender,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="pay_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payDate,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="pay_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="tax_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="paid_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidBy,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="paid_method = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidMethod,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="pay_status = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payStatus,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.remark,jdbcType=LONGVARCHAR}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="updated_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_pay
<trim prefix="set" suffixOverrides=",">
<trim prefix="withdraw_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="withdraw_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="customer_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerName != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerName,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="campaign_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.campaignId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="campaign_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.campaignName != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaignName,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="campaing_reward = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.campaingReward != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.campaingReward,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="pay_to = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payTo != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payTo,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="pay_to_mobile = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payToMobile != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToMobile,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="pay_to_wechat = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payToWechat != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToWechat,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="pay_to_id_type_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payToIdTypeId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToIdTypeId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="pay_to_id_no = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payToIdNo != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToIdNo,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="pay_to_birthday = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payToBirthday != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToBirthday,jdbcType=DATE}
</if>
</foreach>
</trim>
<trim prefix="pay_to_gender = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payToGender != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payToGender,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="pay_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payDate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payDate,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="pay_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="tax_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.taxAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="paid_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.paidBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidBy,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="paid_method = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.paidMethod != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidMethod,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="pay_status = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payStatus != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payStatus,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.remark != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.remark,jdbcType=LONGVARCHAR}
</if>
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updatedAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="updated_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updatedBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_pay
(withdraw_id, withdraw_amount, customer_id, customer_name, campaign_id, campaign_name,
campaing_reward, pay_to, pay_to_mobile, pay_to_wechat, pay_to_id_type_id, pay_to_id_no,
pay_to_birthday, pay_to_gender, pay_date, pay_amount, tax_amount, paid_by, paid_method,
pay_status, remark, created_at, created_by, updated_at, updated_by)
values
<foreach collection="list" item="item" separator=",">
(#{item.withdrawId,jdbcType=BIGINT}, #{item.withdrawAmount,jdbcType=DECIMAL}, #{item.customerId,jdbcType=BIGINT},
#{item.customerName,jdbcType=VARCHAR}, #{item.campaignId,jdbcType=BIGINT}, #{item.campaignName,jdbcType=VARCHAR},
#{item.campaingReward,jdbcType=DECIMAL}, #{item.payTo,jdbcType=VARCHAR}, #{item.payToMobile,jdbcType=VARCHAR},
#{item.payToWechat,jdbcType=VARCHAR}, #{item.payToIdTypeId,jdbcType=BIGINT}, #{item.payToIdNo,jdbcType=VARCHAR},
#{item.payToBirthday,jdbcType=DATE}, #{item.payToGender,jdbcType=INTEGER}, #{item.payDate,jdbcType=TIMESTAMP},
#{item.payAmount,jdbcType=DECIMAL}, #{item.taxAmount,jdbcType=DECIMAL}, #{item.paidBy,jdbcType=VARCHAR},
#{item.paidMethod,jdbcType=INTEGER}, #{item.payStatus,jdbcType=INTEGER}, #{item.remark,jdbcType=LONGVARCHAR},
#{item.createdAt,jdbcType=TIMESTAMP}, #{item.createdBy,jdbcType=BIGINT}, #{item.updatedAt,jdbcType=TIMESTAMP},
#{item.updatedBy,jdbcType=BIGINT})
</foreach>
</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.yd.dal.mapper.customer.AclCustomerFortuneWithdrawMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw">
<!--@mbg.generated-->
<!--@Table ag_acl_customer_fortune_withdraw-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="customer_id" jdbcType="BIGINT" property="customerId" />
<result column="lottery_draws_id" jdbcType="BIGINT" property="lotteryDrawsId" />
<result column="withdraw_before_amount" jdbcType="DECIMAL" property="withdrawBeforeAmount" />
<result column="withdraw_amount" jdbcType="DECIMAL" property="withdrawAmount" />
<result column="withdraw_after_amount" jdbcType="DECIMAL" property="withdrawAfterAmount" />
<result column="is_paid" jdbcType="INTEGER" property="isPaid" />
<result column="paid_date" jdbcType="TIMESTAMP" property="paidDate" />
<result column="paid_amount" jdbcType="DECIMAL" property="paidAmount" />
<result column="tax_amount" jdbcType="DECIMAL" property="taxAmount" />
<result column="paid_method" jdbcType="INTEGER" property="paidMethod" />
<result column="requestor_name" jdbcType="VARCHAR" property="requestorName" />
<result column="requestor_id_type_id" jdbcType="BIGINT" property="requestorIdTypeId" />
<result column="requestor_id" jdbcType="VARCHAR" property="requestorId" />
<result column="requestor_birthdate" jdbcType="DATE" property="requestorBirthdate" />
<result column="requestor_gender" jdbcType="INTEGER" property="requestorGender" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="wechat_id" jdbcType="VARCHAR" property="wechatId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, customer_id, lottery_draws_id, withdraw_before_amount, withdraw_amount, withdraw_after_amount,
is_paid, paid_date, paid_amount, tax_amount, paid_method, requestor_name, requestor_id_type_id,
requestor_id, requestor_birthdate, requestor_gender, `status`, wechat_id, created_at,
created_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_withdraw
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_acl_customer_fortune_withdraw
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_withdraw (customer_id, lottery_draws_id, withdraw_before_amount,
withdraw_amount, withdraw_after_amount, is_paid,
paid_date, paid_amount, tax_amount,
paid_method, requestor_name, requestor_id_type_id,
requestor_id, requestor_birthdate, requestor_gender,
`status`, wechat_id, created_at,
created_by)
values (#{customerId,jdbcType=BIGINT}, #{lotteryDrawsId,jdbcType=BIGINT}, #{withdrawBeforeAmount,jdbcType=DECIMAL},
#{withdrawAmount,jdbcType=DECIMAL}, #{withdrawAfterAmount,jdbcType=DECIMAL}, #{isPaid,jdbcType=INTEGER},
#{paidDate,jdbcType=TIMESTAMP}, #{paidAmount,jdbcType=DECIMAL}, #{taxAmount,jdbcType=DECIMAL},
#{paidMethod,jdbcType=INTEGER}, #{requestorName,jdbcType=VARCHAR}, #{requestorIdTypeId,jdbcType=BIGINT},
#{requestorId,jdbcType=VARCHAR}, #{requestorBirthdate,jdbcType=DATE}, #{requestorGender,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{wechatId,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_withdraw
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">
customer_id,
</if>
<if test="lotteryDrawsId != null">
lottery_draws_id,
</if>
<if test="withdrawBeforeAmount != null">
withdraw_before_amount,
</if>
<if test="withdrawAmount != null">
withdraw_amount,
</if>
<if test="withdrawAfterAmount != null">
withdraw_after_amount,
</if>
<if test="isPaid != null">
is_paid,
</if>
<if test="paidDate != null">
paid_date,
</if>
<if test="paidAmount != null">
paid_amount,
</if>
<if test="taxAmount != null">
tax_amount,
</if>
<if test="paidMethod != null">
paid_method,
</if>
<if test="requestorName != null">
requestor_name,
</if>
<if test="requestorIdTypeId != null">
requestor_id_type_id,
</if>
<if test="requestorId != null">
requestor_id,
</if>
<if test="requestorBirthdate != null">
requestor_birthdate,
</if>
<if test="requestorGender != null">
requestor_gender,
</if>
<if test="status != null">
`status`,
</if>
<if test="wechatId != null">
wechat_id,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">
#{customerId,jdbcType=BIGINT},
</if>
<if test="lotteryDrawsId != null">
#{lotteryDrawsId,jdbcType=BIGINT},
</if>
<if test="withdrawBeforeAmount != null">
#{withdrawBeforeAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawAmount != null">
#{withdrawAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawAfterAmount != null">
#{withdrawAfterAmount,jdbcType=DECIMAL},
</if>
<if test="isPaid != null">
#{isPaid,jdbcType=INTEGER},
</if>
<if test="paidDate != null">
#{paidDate,jdbcType=TIMESTAMP},
</if>
<if test="paidAmount != null">
#{paidAmount,jdbcType=DECIMAL},
</if>
<if test="taxAmount != null">
#{taxAmount,jdbcType=DECIMAL},
</if>
<if test="paidMethod != null">
#{paidMethod,jdbcType=INTEGER},
</if>
<if test="requestorName != null">
#{requestorName,jdbcType=VARCHAR},
</if>
<if test="requestorIdTypeId != null">
#{requestorIdTypeId,jdbcType=BIGINT},
</if>
<if test="requestorId != null">
#{requestorId,jdbcType=VARCHAR},
</if>
<if test="requestorBirthdate != null">
#{requestorBirthdate,jdbcType=DATE},
</if>
<if test="requestorGender != null">
#{requestorGender,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="wechatId != null">
#{wechatId,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw">
<!--@mbg.generated-->
update ag_acl_customer_fortune_withdraw
<set>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=BIGINT},
</if>
<if test="lotteryDrawsId != null">
lottery_draws_id = #{lotteryDrawsId,jdbcType=BIGINT},
</if>
<if test="withdrawBeforeAmount != null">
withdraw_before_amount = #{withdrawBeforeAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawAmount != null">
withdraw_amount = #{withdrawAmount,jdbcType=DECIMAL},
</if>
<if test="withdrawAfterAmount != null">
withdraw_after_amount = #{withdrawAfterAmount,jdbcType=DECIMAL},
</if>
<if test="isPaid != null">
is_paid = #{isPaid,jdbcType=INTEGER},
</if>
<if test="paidDate != null">
paid_date = #{paidDate,jdbcType=TIMESTAMP},
</if>
<if test="paidAmount != null">
paid_amount = #{paidAmount,jdbcType=DECIMAL},
</if>
<if test="taxAmount != null">
tax_amount = #{taxAmount,jdbcType=DECIMAL},
</if>
<if test="paidMethod != null">
paid_method = #{paidMethod,jdbcType=INTEGER},
</if>
<if test="requestorName != null">
requestor_name = #{requestorName,jdbcType=VARCHAR},
</if>
<if test="requestorIdTypeId != null">
requestor_id_type_id = #{requestorIdTypeId,jdbcType=BIGINT},
</if>
<if test="requestorId != null">
requestor_id = #{requestorId,jdbcType=VARCHAR},
</if>
<if test="requestorBirthdate != null">
requestor_birthdate = #{requestorBirthdate,jdbcType=DATE},
</if>
<if test="requestorGender != null">
requestor_gender = #{requestorGender,jdbcType=INTEGER},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="wechatId != null">
wechat_id = #{wechatId,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneWithdraw">
<!--@mbg.generated-->
update ag_acl_customer_fortune_withdraw
set customer_id = #{customerId,jdbcType=BIGINT},
lottery_draws_id = #{lotteryDrawsId,jdbcType=BIGINT},
withdraw_before_amount = #{withdrawBeforeAmount,jdbcType=DECIMAL},
withdraw_amount = #{withdrawAmount,jdbcType=DECIMAL},
withdraw_after_amount = #{withdrawAfterAmount,jdbcType=DECIMAL},
is_paid = #{isPaid,jdbcType=INTEGER},
paid_date = #{paidDate,jdbcType=TIMESTAMP},
paid_amount = #{paidAmount,jdbcType=DECIMAL},
tax_amount = #{taxAmount,jdbcType=DECIMAL},
paid_method = #{paidMethod,jdbcType=INTEGER},
requestor_name = #{requestorName,jdbcType=VARCHAR},
requestor_id_type_id = #{requestorIdTypeId,jdbcType=BIGINT},
requestor_id = #{requestorId,jdbcType=VARCHAR},
requestor_birthdate = #{requestorBirthdate,jdbcType=DATE},
requestor_gender = #{requestorGender,jdbcType=INTEGER},
`status` = #{status,jdbcType=INTEGER},
wechat_id = #{wechatId,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_withdraw
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="lottery_draws_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.lotteryDrawsId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="withdraw_before_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawBeforeAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="withdraw_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="withdraw_after_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAfterAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="is_paid = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.isPaid,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="paid_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidDate,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="paid_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="tax_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="paid_method = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidMethod,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="requestor_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorName,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="requestor_id_type_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorIdTypeId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="requestor_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="requestor_birthdate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorBirthdate,jdbcType=DATE}
</foreach>
</trim>
<trim prefix="requestor_gender = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorGender,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.status,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="wechat_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.wechatId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_withdraw
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="lottery_draws_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.lotteryDrawsId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.lotteryDrawsId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="withdraw_before_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawBeforeAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawBeforeAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="withdraw_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="withdraw_after_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.withdrawAfterAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawAfterAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="is_paid = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.isPaid != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.isPaid,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="paid_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.paidDate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidDate,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="paid_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.paidAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="tax_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.taxAmount != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.taxAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="paid_method = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.paidMethod != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.paidMethod,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="requestor_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.requestorName != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorName,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="requestor_id_type_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.requestorIdTypeId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorIdTypeId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="requestor_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.requestorId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorId,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="requestor_birthdate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.requestorBirthdate != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorBirthdate,jdbcType=DATE}
</if>
</foreach>
</trim>
<trim prefix="requestor_gender = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.requestorGender != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.requestorGender,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.status != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.status,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="wechat_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.wechatId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.wechatId,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_withdraw
(customer_id, lottery_draws_id, withdraw_before_amount, withdraw_amount, withdraw_after_amount,
is_paid, paid_date, paid_amount, tax_amount, paid_method, requestor_name, requestor_id_type_id,
requestor_id, requestor_birthdate, requestor_gender, `status`, wechat_id, created_at,
created_by)
values
<foreach collection="list" item="item" separator=",">
(#{item.customerId,jdbcType=BIGINT}, #{item.lotteryDrawsId,jdbcType=BIGINT}, #{item.withdrawBeforeAmount,jdbcType=DECIMAL},
#{item.withdrawAmount,jdbcType=DECIMAL}, #{item.withdrawAfterAmount,jdbcType=DECIMAL},
#{item.isPaid,jdbcType=INTEGER}, #{item.paidDate,jdbcType=TIMESTAMP}, #{item.paidAmount,jdbcType=DECIMAL},
#{item.taxAmount,jdbcType=DECIMAL}, #{item.paidMethod,jdbcType=INTEGER}, #{item.requestorName,jdbcType=VARCHAR},
#{item.requestorIdTypeId,jdbcType=BIGINT}, #{item.requestorId,jdbcType=VARCHAR},
#{item.requestorBirthdate,jdbcType=DATE}, #{item.requestorGender,jdbcType=INTEGER},
#{item.status,jdbcType=INTEGER}, #{item.wechatId,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP},
#{item.createdBy,jdbcType=BIGINT})
</foreach>
</insert>
<select id="findFinalWithdrawNoPayByCustomerIds" parameterType="arraylist" resultType="java.util.Map">
select customer_id customerId,
group_concat(id order by id) withdrawIds
from ag_acl_customer_fortune_withdraw
where customer_id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and is_paid != 1
group by customer_id
</select>
</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