diff --git a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java index caa7fd9a1..f69619dfe 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java @@ -123,7 +123,7 @@ public class OrderService { private IPileMerchantInfoService pileMerchantInfoService; @Resource - private IMemberWalletLogService memberWalletLogService; + private MemberWalletLogService memberWalletLogService; @Resource private ClearingBillInfoService clearingBillInfoService; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/MemberWalletLog.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/MemberWalletLog.java index 71daef1fc..3b8ce7bb3 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/MemberWalletLog.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/MemberWalletLog.java @@ -52,6 +52,16 @@ public class MemberWalletLog { */ private String relatedOrderCode; + /** + * 变动前金额 + */ + private BigDecimal beforeAmount; + + /** + * 变动后金额 + */ + private BigDecimal afterAmount; + /** * 创建人 */ diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberWalletLogMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberWalletLogMapper.java index a21b10704..8349aadae 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberWalletLogMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberWalletLogMapper.java @@ -5,11 +5,9 @@ import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO; import com.jsowell.pile.vo.uniapp.MemberBalanceVO; import com.jsowell.pile.vo.uniapp.MemberWalletLogVO; import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; import java.util.List; -@Repository public interface MemberWalletLogMapper { /** * delete by primary key @@ -27,6 +25,10 @@ public interface MemberWalletLogMapper { */ int insert(MemberWalletLog record); + int insertOrUpdate(MemberWalletLog record); + + int insertOrUpdateSelective(MemberWalletLog record); + /** * insert record to table selective * @@ -59,7 +61,11 @@ public interface MemberWalletLogMapper { */ int updateByPrimaryKey(MemberWalletLog record); - void batchInsert(@Param("list") List logList); + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(@Param("list") List list); /** * 查询用户账户余额变动信息 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IMemberWalletLogService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IMemberWalletLogService.java deleted file mode 100644 index b0536b8c8..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IMemberWalletLogService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.jsowell.pile.service; - -import com.jsowell.pile.domain.MemberWalletLog; - -public interface IMemberWalletLogService { - int deleteByPrimaryKey(Integer id); - - int insert(MemberWalletLog record); - - int insertSelective(MemberWalletLog record); - - MemberWalletLog selectByPrimaryKey(Integer id); - - int updateByPrimaryKeySelective(MemberWalletLog record); - - int updateByPrimaryKey(MemberWalletLog record); - - MemberWalletLog getOrderRecord(String orderCode, String type); -} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberWalletLogService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberWalletLogService.java new file mode 100644 index 000000000..2e5c18c5d --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberWalletLogService.java @@ -0,0 +1,34 @@ +package com.jsowell.pile.service; + +import com.jsowell.pile.domain.MemberWalletLog; + +import java.util.List; + +public interface MemberWalletLogService { + + + int deleteByPrimaryKey(Integer id); + + int insert(MemberWalletLog record); + + int insertSelective(MemberWalletLog record); + + MemberWalletLog selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(MemberWalletLog record); + + int updateByPrimaryKey(MemberWalletLog record); + + int insertOrUpdate(MemberWalletLog record); + + int insertOrUpdateSelective(MemberWalletLog record); + + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(List list); + + MemberWalletLog getOrderRecord(String orderCode, String type); +} + diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java index be302c5b8..8dbb2f464 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java @@ -212,6 +212,8 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService { .amount(updatePrincipalBalance) .category("1") .relatedOrderCode(dto.getRelatedOrderCode()) + .beforeAmount(oldPrincipalBalance) + .afterAmount(newPrincipalBalance) .createBy(dto.getMemberId()) .build()); } @@ -239,6 +241,8 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService { .amount(updateGiftBalance) .category("2") .relatedOrderCode(dto.getRelatedOrderCode()) + .beforeAmount(oldGiftBalance) + .afterAmount(newGiftBalance) .createBy(dto.getMemberId()) .build()); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberWalletLogServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberWalletLogServiceImpl.java index 2bb5151fa..d22b8de37 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberWalletLogServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberWalletLogServiceImpl.java @@ -2,13 +2,14 @@ package com.jsowell.pile.service.impl; import com.jsowell.pile.domain.MemberWalletLog; import com.jsowell.pile.mapper.MemberWalletLogMapper; -import com.jsowell.pile.service.IMemberWalletLogService; +import com.jsowell.pile.service.MemberWalletLogService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.List; @Service -public class MemberWalletLogServiceImpl implements IMemberWalletLogService { +public class MemberWalletLogServiceImpl implements MemberWalletLogService { @Resource private MemberWalletLogMapper memberWalletLogMapper; @@ -48,4 +49,29 @@ public class MemberWalletLogServiceImpl implements IMemberWalletLogService { return memberWalletLogMapper.getOrderRecord(orderCode, type); } + @Override + public int insertOrUpdate(MemberWalletLog record) { + return memberWalletLogMapper.insertOrUpdate(record); + } + + @Override + public int insertOrUpdateSelective(MemberWalletLog record) { + return memberWalletLogMapper.insertOrUpdateSelective(record); + } + + @Override + public int updateBatch(List list) { + return memberWalletLogMapper.updateBatch(list); + } + + @Override + public int updateBatchSelective(List list) { + return memberWalletLogMapper.updateBatchSelective(list); + } + + @Override + public int batchInsert(List list) { + return memberWalletLogMapper.batchInsert(list); + } } + diff --git a/jsowell-pile/src/main/resources/mapper/pile/MemberWalletLogMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/MemberWalletLogMapper.xml index 5698b508a..88d27a92e 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/MemberWalletLogMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/MemberWalletLogMapper.xml @@ -1,156 +1,499 @@ - - - - - - - - - - - - - - - - id, member_id, `type`, sub_type, amount, category, related_order_code, create_by, - create_time - - - - - delete from member_wallet_log - where id = #{id,jdbcType=INTEGER} - - - - insert into member_wallet_log (member_id, `type`, sub_type, - amount, category, related_order_code, - create_by, create_time) - values (#{memberId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR}, - #{amount,jdbcType=DECIMAL}, #{category,jdbcType=CHAR}, #{relatedOrderCode,jdbcType=VARCHAR}, - #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}) - - - - insert into member_wallet_log - - + + + + + + + + + + + + + + + + + + id, member_id, - - `type`, - - sub_type, - - amount, - - category, - - related_order_code, - - + before_amount, + after_amount, create_by, - - - create_time, - - - - - #{memberId,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{subType,jdbcType=VARCHAR}, - - - #{amount,jdbcType=DECIMAL}, - - - #{category,jdbcType=CHAR}, - - - #{relatedOrderCode,jdbcType=VARCHAR}, - - - #{createBy,jdbcType=VARCHAR}, - - - #{createTime,jdbcType=TIMESTAMP}, - - - - - - update member_wallet_log - - - member_id = #{memberId,jdbcType=VARCHAR}, - - - `type` = #{type,jdbcType=VARCHAR}, - - - sub_type = #{subType,jdbcType=VARCHAR}, - - - amount = #{amount,jdbcType=DECIMAL}, - - - category = #{category,jdbcType=CHAR}, - - - related_order_code = #{relatedOrderCode,jdbcType=VARCHAR}, - - - create_by = #{createBy,jdbcType=VARCHAR}, - - - create_time = #{createTime,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=INTEGER} - - - - update member_wallet_log - set member_id = #{memberId,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - sub_type = #{subType,jdbcType=VARCHAR}, - amount = #{amount,jdbcType=DECIMAL}, - category = #{category,jdbcType=CHAR}, - related_order_code = #{relatedOrderCode,jdbcType=VARCHAR}, - create_by = #{createBy,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=INTEGER} - - - - insert into member_wallet_log (member_id, `type`, - sub_type, amount, category, related_order_code, create_by) + create_time + + + + + delete + from member_wallet_log + where id = #{id,jdbcType=INTEGER} + + + + insert into member_wallet_log (member_id, `type`, sub_type, + amount, category, related_order_code, + before_amount, after_amount, create_by, + create_time) + values (#{memberId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR}, + #{amount,jdbcType=DECIMAL}, #{category,jdbcType=CHAR}, #{relatedOrderCode,jdbcType=VARCHAR}, + #{beforeAmount,jdbcType=DECIMAL}, #{afterAmount,jdbcType=DECIMAL}, #{createBy,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}) + + + + insert into member_wallet_log + + + member_id, + + + `type`, + + + sub_type, + + + amount, + + + category, + + + related_order_code, + + + before_amount, + + + after_amount, + + + create_by, + + + create_time, + + + + + #{memberId,jdbcType=VARCHAR}, + + + #{type,jdbcType=VARCHAR}, + + + #{subType,jdbcType=VARCHAR}, + + + #{amount,jdbcType=DECIMAL}, + + + #{category,jdbcType=CHAR}, + + + #{relatedOrderCode,jdbcType=VARCHAR}, + + + #{beforeAmount,jdbcType=DECIMAL}, + + + #{afterAmount,jdbcType=DECIMAL}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + update member_wallet_log + + + member_id = #{memberId,jdbcType=VARCHAR}, + + + `type` = #{type,jdbcType=VARCHAR}, + + + sub_type = #{subType,jdbcType=VARCHAR}, + + + amount = #{amount,jdbcType=DECIMAL}, + + + category = #{category,jdbcType=CHAR}, + + + related_order_code = #{relatedOrderCode,jdbcType=VARCHAR}, + + + before_amount = #{beforeAmount,jdbcType=DECIMAL}, + + + after_amount = #{afterAmount,jdbcType=DECIMAL}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + + update member_wallet_log + set member_id = #{memberId,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + sub_type = #{subType,jdbcType=VARCHAR}, + amount = #{amount,jdbcType=DECIMAL}, + category = #{category,jdbcType=CHAR}, + related_order_code = #{relatedOrderCode,jdbcType=VARCHAR}, + before_amount = #{beforeAmount,jdbcType=DECIMAL}, + after_amount = #{afterAmount,jdbcType=DECIMAL}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + + + update member_wallet_log + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.subType,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.amount,jdbcType=DECIMAL} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.category,jdbcType=CHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.relatedOrderCode,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.beforeAmount,jdbcType=DECIMAL} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.afterAmount,jdbcType=DECIMAL} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + update member_wallet_log + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.subType,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.amount,jdbcType=DECIMAL} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.category,jdbcType=CHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.relatedOrderCode,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.beforeAmount,jdbcType=DECIMAL} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.afterAmount,jdbcType=DECIMAL} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} + + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + insert into member_wallet_log + (member_id, `type`, sub_type, amount, category, related_order_code, before_amount, + after_amount, create_by, create_time) values (#{item.memberId,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.subType,jdbcType=VARCHAR}, #{item.amount,jdbcType=DECIMAL}, #{item.category,jdbcType=CHAR}, #{item.relatedOrderCode,jdbcType=VARCHAR}, - #{item.createBy,jdbcType=VARCHAR}) + #{item.beforeAmount,jdbcType=DECIMAL}, #{item.afterAmount,jdbcType=DECIMAL}, + #{item.createBy,jdbcType=VARCHAR}, + #{item.createTime,jdbcType=TIMESTAMP}) + + + insert into member_wallet_log + + + id, + + member_id, + `type`, + sub_type, + amount, + category, + related_order_code, + before_amount, + after_amount, + create_by, + create_time, + + values + + + #{id,jdbcType=INTEGER}, + + #{memberId,jdbcType=VARCHAR}, + #{type,jdbcType=VARCHAR}, + #{subType,jdbcType=VARCHAR}, + #{amount,jdbcType=DECIMAL}, + #{category,jdbcType=CHAR}, + #{relatedOrderCode,jdbcType=VARCHAR}, + #{beforeAmount,jdbcType=DECIMAL}, + #{afterAmount,jdbcType=DECIMAL}, + #{createBy,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + member_id = #{memberId,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + sub_type = #{subType,jdbcType=VARCHAR}, + amount = #{amount,jdbcType=DECIMAL}, + category = #{category,jdbcType=CHAR}, + related_order_code = #{relatedOrderCode,jdbcType=VARCHAR}, + before_amount = #{beforeAmount,jdbcType=DECIMAL}, + after_amount = #{afterAmount,jdbcType=DECIMAL}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + + + insert into member_wallet_log + + + id, + + + member_id, + + + `type`, + + + sub_type, + + + amount, + + + category, + + + related_order_code, + + + before_amount, + + + after_amount, + + + create_by, + + + create_time, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{memberId,jdbcType=VARCHAR}, + + + #{type,jdbcType=VARCHAR}, + + + #{subType,jdbcType=VARCHAR}, + + + #{amount,jdbcType=DECIMAL}, + + + #{category,jdbcType=CHAR}, + + + #{relatedOrderCode,jdbcType=VARCHAR}, + + + #{beforeAmount,jdbcType=DECIMAL}, + + + #{afterAmount,jdbcType=DECIMAL}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + + member_id = #{memberId,jdbcType=VARCHAR}, + + + `type` = #{type,jdbcType=VARCHAR}, + + + sub_type = #{subType,jdbcType=VARCHAR}, + + + amount = #{amount,jdbcType=DECIMAL}, + + + category = #{category,jdbcType=CHAR}, + + + related_order_code = #{relatedOrderCode,jdbcType=VARCHAR}, + + + before_amount = #{beforeAmount,jdbcType=DECIMAL}, + + + after_amount = #{afterAmount,jdbcType=DECIMAL}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + - + select + + from member_wallet_log + where related_order_code = #{orderCode,jdbcType=VARCHAR} + and type = #{type,jdbcType=VARCHAR} \ No newline at end of file