瀏覽代碼

Merge remote-tracking branch 'origin/master'

lchao 5 月之前
父節點
當前提交
caa84f87a5
共有 19 個文件被更改,包括 408 次插入232 次删除
  1. 27 4
      qmjszx-admin/src/main/java/beilv/web/controller/usermembershipcard/UserMembershipCardController.java
  2. 15 6
      qmjszx-admin/src/main/resources/templates/card/card.html
  3. 33 46
      qmjszx-admin/src/main/resources/templates/card/stream.html
  4. 26 25
      qmjszx-admin/src/main/resources/templates/information/information.html
  5. 14 1
      qmjszx-admin/src/main/resources/templates/record/add.html
  6. 7 7
      qmjszx-admin/src/main/resources/templates/record/record.html
  7. 74 59
      qmjszx-business/src/main/java/beilv/cardpurchaserecord/domain/CardPurchaseRecord.java
  8. 1 0
      qmjszx-business/src/main/java/beilv/cardpurchaserecord/mapper/CardPurchaseRecordMapper.java
  9. 10 7
      qmjszx-business/src/main/java/beilv/cardpurchaserecord/service/impl/CardPurchaseRecordServiceImpl.java
  10. 0 21
      qmjszx-business/src/main/java/beilv/carinformation/domain/CarInformation.java
  11. 1 3
      qmjszx-business/src/main/java/beilv/carinformation/service/impl/CarInformationServiceImpl.java
  12. 71 0
      qmjszx-business/src/main/java/beilv/usermembershipcard/domain/MemberStream.java
  13. 19 12
      qmjszx-business/src/main/java/beilv/usermembershipcard/domain/UserMembershipCard.java
  14. 3 0
      qmjszx-business/src/main/java/beilv/usermembershipcard/mapper/UserMembershipCardMapper.java
  15. 13 0
      qmjszx-business/src/main/java/beilv/usermembershipcard/service/IUserMembershipCardService.java
  16. 34 1
      qmjszx-business/src/main/java/beilv/usermembershipcard/service/impl/UserMembershipCardServiceImpl.java
  17. 1 6
      qmjszx-business/src/main/resources/mapper/card/CarInformationMapper.xml
  18. 30 23
      qmjszx-business/src/main/resources/mapper/card/CardPurchaseRecordMapper.xml
  19. 29 11
      qmjszx-business/src/main/resources/mapper/card/UserMembershipCardMapper.xml

+ 27 - 4
qmjszx-admin/src/main/java/beilv/web/controller/usermembershipcard/UserMembershipCardController.java

@@ -15,6 +15,7 @@ import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户会员卡Controller
@@ -121,10 +122,32 @@ public class UserMembershipCardController extends BaseController {
     * @date 2025/1/6 下午3:47
     */
     @RequiresPermissions("system:card:stream")
-    @GetMapping("/stream/{id}")
-    public String stream(@PathVariable("id") Long id, ModelMap mmap) {
-        UserMembershipCard userMembershipCard = userMembershipCardService.selectUserMembershipCardById(id);
-        mmap.put("stream", userMembershipCard);
+    @GetMapping("/toStream/{id}")
+    public String toStream(@PathVariable("id") Long id, ModelMap mmap) {
+        mmap.put("id", id);
         return prefix + "/stream";
     }
+
+    @RequiresPermissions("system:card:stream")
+    @PostMapping("/stream")
+    @ResponseBody
+    public TableDataInfo stream(UserMembershipCard userMembershipCard) {
+        startPage();
+        List<Map<String,Object>> list = userMembershipCardService.getStream(userMembershipCard.getId());
+        return getDataTable(list);
+    }
+
+    /*
+     * 新增退卡记录
+     *
+     * @author 韩福成
+     * @date 2025/1/7 上午10:46
+     */
+    @RequiresPermissions("system:record:refundCard")
+    @Log(title = "退卡", businessType = BusinessType.INSERT)
+    @PostMapping("/refundCard")
+    @ResponseBody
+    public AjaxResult refundCard(UserMembershipCard userMembershipCard) {
+        return toAjax(userMembershipCardService.refundCard(userMembershipCard));
+    }
 }

+ 15 - 6
qmjszx-admin/src/main/resources/templates/card/card.html

@@ -53,16 +53,13 @@
     <th:block th:include="include :: footer" />
     <script th:inline="javascript">
         var editFlag = [[${@permission.hasPermi('system:card:edit')}]];
-        var removeFlag = [[${@permission.hasPermi('system:card:remove')}]];
+        var refundCard = [[${@permission.hasPermi('system:record:add')}]];
         var prefix = ctx + "card";
 
         $(function() {
             var options = {
                 url: prefix + "/list",
                 createUrl: prefix + "/add",
-                updateUrl: prefix + "/edit/{id}",
-                stream: prefix + "/stream/{id}",
-                removeUrl: prefix + "/remove",
                 exportUrl: prefix + "/export",
                 modalName: "用户会员卡",
                 columns: [{
@@ -74,6 +71,11 @@
                     visible: false
                 },
                 {
+                    field: 'userCardId',
+                    title: '用户会员卡id',
+                    visible: false
+                },
+                {
                     field: 'userName',
                     title: '用户账户'
                 },
@@ -103,7 +105,7 @@
                     formatter: function(value, row, index) {
                         var actions = [];
                         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="stream(\'' + row.id + '\')"><i class="fa fa-edit"></i>流水</a> ');
-                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>退卡</a>');
+                        actions.push('<a class="btn btn-danger btn-xs ' + refundCard + '" href="javascript:void(0)" onclick="refundCard1(\'' + row.id + '\')"><i class="fa fa-remove"></i>退卡</a>');
                         return actions.join('');
                     }
                 }]
@@ -113,7 +115,14 @@
 
         function stream(id) {
             table.set();
-            $.modal.open("查看流水", table.options.stream(id));
+            $.modal.open("查看流水", prefix + "/toStream/" + id);
+        }
+
+        function refundCard1(id) {
+            $.modal.confirm("确认要退选中的会员卡吗?", function() {
+                var data = { "id": id };
+                $.operate.submit("/record/refundCard", "post", "json", data);
+            });
         }
     </script>
 </body>

+ 33 - 46
qmjszx-admin/src/main/resources/templates/card/stream.html

@@ -1,46 +1,36 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
-    <th:block th:include="include :: header('会员用卡流水列表')" />
+    <th:block th:include="include :: header('会员用卡流水列表')" th:value="${id}"/>
 </head>
 <body class="gray-bg">
      <div class="container-div">
         <div class="row">
-            <div class="col-sm-12 search-collapse">
+<!--            <div class="col-sm-12 search-collapse">-->
                 <form id="formId">
                     <div class="select-list">
                         <ul>
                             <li>
-                                <label>用户id:</label>
-                                <input type="text" name="userId"/>
-                            </li>
-                            <li>
-                                <label>卡种id:</label>
-                                <input type="text" name="cardId"/>
-                            </li>
-                            <li>
-                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
-                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                                <input type="hidden" name="id" th:value="${id}"/>
                             </li>
                         </ul>
                     </div>
                 </form>
-            </div>
-
-            <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:stream:add">
-                    <i class="fa fa-plus"></i> 添加
-                </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:stream:edit">
-                    <i class="fa fa-edit"></i> 修改
-                </a>
-                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:stream:remove">
-                    <i class="fa fa-remove"></i> 删除
-                </a>
-                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:stream:export">
-                    <i class="fa fa-download"></i> 导出
-                </a>
-            </div>
+<!--            </div>-->
+<!--            <div class="btn-group-sm" id="toolbar" role="group">-->
+<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:stream:add">-->
+<!--                    <i class="fa fa-plus"></i> 添加-->
+<!--                </a>-->
+<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:stream:edit">-->
+<!--                    <i class="fa fa-edit"></i> 修改-->
+<!--                </a>-->
+<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:stream:remove">-->
+<!--                    <i class="fa fa-remove"></i> 删除-->
+<!--                </a>-->
+<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:stream:export">-->
+<!--                    <i class="fa fa-download"></i> 导出-->
+<!--                </a>-->
+<!--            </div>-->
             <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
             </div>
@@ -50,38 +40,35 @@
     <script th:inline="javascript">
         var editFlag = [[${@permission.hasPermi('system:stream:edit')}]];
         var removeFlag = [[${@permission.hasPermi('system:stream:remove')}]];
-        var prefix = ctx + "system/card";
+        var prefix = ctx + "card";
 
         $(function() {
             var options = {
                 url: prefix + "/stream",
-                exportUrl: prefix + "/export",
                 modalName: "会员用卡流水",
                 columns: [{
-                    checkbox: true
+                    field: 'username',
+                    title: '用户账户'
+                },
+                {
+                    field: 'realName',
+                    title: '姓名'
                 },
                 {
-                    field: 'id',
-                    title: '主键',
-                    visible: false
+                    field: 'mobile',
+                    title: '手机号码'
                 },
                 {
-                    field: 'userId',
-                    title: '用户id'
+                    field: 'name',
+                    title: '卡种名称'
                 },
                 {
-                    field: 'cardId',
-                    title: '卡种id'
+                    field: 'createTime',
+                    title: '消费时间'
                 },
                 {
-                    title: '操作',
-                    align: 'center',
-                    formatter: function(value, row, index) {
-                        var actions = [];
-                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
-                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
-                        return actions.join('');
-                    }
+                    field: 'statLabel',
+                    title: '状态'
                 }]
             };
             $.table.init(options);

+ 26 - 25
qmjszx-admin/src/main/resources/templates/information/information.html

@@ -31,14 +31,6 @@
                                 </select>
                             </li>
                             <li>
-                                <label>发布状态:</label>
-                                <select name="releaseState" th:with="type=${@dict.getType('release_state')}">
-                                    <option value="">所有</option>
-                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
-                                            th:value="${dict.dictValue}"></option>
-                                </select>
-                            </li>
-                            <li>
                                 <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                 <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                             </li>
@@ -73,7 +65,6 @@
         var prefix = ctx + "information";
         var cardType = [[${@dict.getType('card_type')}]];
         var sysJobStatus = [[${@dict.getType('goods_state')}]];
-        var releaseState = [[${@dict.getType('release_state')}]];
 
         $(function() {
             var options = {
@@ -121,17 +112,11 @@
                     title: '单次积分'
                 },
                 {
+                    visible: true,
                     field: 'cardState',
                     title: '卡种状态',
                     formatter: function (value, row, index) {
-                        return $.table.selectDictLabel(sysJobStatus, value);
-                    }
-                },
-                {
-                    field: 'releaseState',
-                    title: '发布状态',
-                    formatter: function (value, row, index) {
-                        return $.table.selectDictLabel(releaseState, value);
+                        return statusTools(row);
                     }
                 },
                 {
@@ -139,16 +124,9 @@
                     align: 'center',
                     formatter: function(value, row, index) {
                         var actions = [];
-                        var type = '';
-                        if (row.releaseState==1){
-                            type = 'release'
+                        if (row.cardState=='2'){
                             actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                             actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
-                            actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.release(\'' + row.id + '\', \'' + type + '\')"><i class="fa fa-edit"></i>发布</a>');
-                        }
-                        if (row.cardState==1){
-                            type = 'card'
-                            actions.push('<a class="btn btn-large btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.release(\'' + row.id + '\', \'' + type + '\')"><i class="fa fa-remove"></i>下架</a>');
                         }
                         return actions.join('');
                     }
@@ -156,6 +134,29 @@
             };
             $.table.init(options);
         });
+
+        /* 商品状态显示 */
+        function statusTools(row) {
+            if (row.cardState == 2) {
+                return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
+            } else {
+                return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
+            }
+        }
+
+        /* 用户管理-停用 */
+        function disable(id) {
+            $.modal.confirm("确认要下架商品吗?", function() {
+                $.operate.post(prefix + "/edit", { "id": id, "cardState": 2 });
+            })
+        }
+
+        /* 用户管理启用 */
+        function enable(id) {
+            $.modal.confirm("确认要上架商品吗?", function() {
+                $.operate.post(prefix + "/edit", { "id": id, "cardState": 1 });
+            })
+        }
     </script>
 </body>
 </html>

+ 14 - 1
qmjszx-admin/src/main/resources/templates/record/add.html

@@ -87,6 +87,10 @@
         const cardSelect = document.getElementById('cardSelect');
         const priceInput = document.getElementsByName("memberPrice")[0];
         let totalNumber = null;
+        let cardType = null;
+        let originalPrice = null;
+        let memberPrice = null;
+        let point = null;
         const requestData = {
             cardState: "1"
         };
@@ -98,6 +102,10 @@
             success: function (data) {
                 priceInput.value = data.rows[0].memberPrice
                 totalNumber = data.rows[0].totalNumber
+                cardType = data.rows[0].type
+                originalPrice = data.rows[0].originalPrice
+                memberPrice = data.rows[0].memberPrice
+                point = data.rows[0].point
                 // 在这里处理成功获取到的数据
                 data.rows.forEach(cardType => {
                     const option = document.createElement('option');
@@ -111,6 +119,10 @@
                     if (selectedCardType && priceInput) {
                         priceInput.value = selectedCardType.memberPrice;
                         totalNumber = selectedCardType.totalNumber
+                        cardType = selectedCardType.type
+                        originalPrice = selectedCardType.originalPrice
+                        memberPrice = selectedCardType.memberPrice
+                        point = selectedCardType.point
                     }
                 });
             },
@@ -124,7 +136,8 @@
         function submitHandler() {
             if ($.validate.form()) {
                 const cardName = cardSelect.options[cardSelect.selectedIndex].text
-                const request =  $('#form-record-add').serialize() + '&cardName='+cardName + '&price=' + priceInput.value + '&totalNumber='+totalNumber
+                const request =  $('#form-record-add').serialize() + '&cardName='+cardName + '&price=' + priceInput.value
+                    + '&totalNumber='+totalNumber + '&cardType=' +cardType + '&originalPrice=' +originalPrice + '&memberPrice='+memberPrice + '&point='+point
                 console.log(request)
                 $.operate.save(prefix + "/add", request);
             }

+ 7 - 7
qmjszx-admin/src/main/resources/templates/record/record.html

@@ -97,23 +97,23 @@
                     title: '卡种名称'
                 },
                 {
-                    field: 'price',
-                    title: '价格'
+                    field: 'cardTypeLabel',
+                    title: '卡种类型'
                 },
                 {
-                    field: 'paymentTime',
-                    title: '支付时间'
+                    field: 'memberPrice',
+                    title: '价格'
                 },
                 {
-                    field: 'refundTime',
-                    title: '退款时间'
+                    field: 'time',
+                    title: '时间'
                 },
                 {
                     field: 'paymentWay',
                     title: '支付方式'
                 },
                 {
-                    field: 'stateLabel',
+                    field: 'typeLabel',
                     title: '状态'
                 },
                 {

+ 74 - 59
qmjszx-business/src/main/java/beilv/cardpurchaserecord/domain/CardPurchaseRecord.java

@@ -42,19 +42,24 @@ public class CardPurchaseRecord extends BaseEntity
     @Excel(name = "卡种名称")
     private String cardName;
 
+    private String cardType;
+
+    private String cardTypeLabel;
+
+    private Integer totalNumber;
+
+    private String originalPrice;
+
     /** 价格 */
     @Excel(name = "价格")
-    private BigDecimal price;
+    private BigDecimal memberPrice;
 
-    /** 支付时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private Date paymentTime;
+    private String point;
 
-    /** 退款时间 */
+    /** 时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @Excel(name = "退款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private Date refundTime;
+    @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date time;
 
     /** 支付方式 */
     @Excel(name = "支付方式")
@@ -62,10 +67,10 @@ public class CardPurchaseRecord extends BaseEntity
 
     /** 状态(待使用、已使用、已退款) */
 //    @Excel(name = "状态", readConverterExp = "待=使用、已使用、已退款")
-    private String state;
+    private String type;
 
     @Excel(name = "状态")
-    private String stateLabel;
+    private String typeLabel;
 
     /** 备注 */
     @Excel(name = "备注")
@@ -75,7 +80,53 @@ public class CardPurchaseRecord extends BaseEntity
 //    @Excel(name = "版本")
     private String version;
 
-    private Integer totalNumber;
+    public String getCardTypeLabel() {
+        return cardTypeLabel;
+    }
+
+    public void setCardTypeLabel(String cardTypeLabel) {
+        this.cardTypeLabel = cardTypeLabel;
+    }
+
+    public String getOriginalPrice() {
+        return originalPrice;
+    }
+
+    public void setOriginalPrice(String originalPrice) {
+        this.originalPrice = originalPrice;
+    }
+
+    public String getPoint() {
+        return point;
+    }
+
+    public void setPoint(String point) {
+        this.point = point;
+    }
+
+    public String getCardType() {
+        return cardType;
+    }
+
+    public void setCardType(String cardType) {
+        this.cardType = cardType;
+    }
+
+    public BigDecimal getMemberPrice() {
+        return memberPrice;
+    }
+
+    public void setMemberPrice(BigDecimal memberPrice) {
+        this.memberPrice = memberPrice;
+    }
+
+    public Date getTime() {
+        return time;
+    }
+
+    public void setTime(Date time) {
+        this.time = time;
+    }
 
     public Integer getTotalNumber() {
         return totalNumber;
@@ -85,12 +136,20 @@ public class CardPurchaseRecord extends BaseEntity
         this.totalNumber = totalNumber;
     }
 
-    public String getStateLabel() {
-        return stateLabel;
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getTypeLabel() {
+        return typeLabel;
     }
 
-    public void setStateLabel(String stateLabel) {
-        this.stateLabel = stateLabel;
+    public void setTypeLabel(String typeLabel) {
+        this.typeLabel = typeLabel;
     }
 
     public String getUserName() {
@@ -153,36 +212,6 @@ public class CardPurchaseRecord extends BaseEntity
         this.cardName = cardName;
     }
 
-    public void setPrice(BigDecimal price)
-    {
-        this.price = price;
-    }
-
-    public BigDecimal getPrice()
-    {
-        return price;
-    }
-
-    public void setPaymentTime(Date paymentTime)
-    {
-        this.paymentTime = paymentTime;
-    }
-
-    public Date getPaymentTime()
-    {
-        return paymentTime;
-    }
-
-    public void setRefundTime(Date refundTime)
-    {
-        this.refundTime = refundTime;
-    }
-
-    public Date getRefundTime()
-    {
-        return refundTime;
-    }
-
     public void setPaymentWay(String paymentWay)
     {
         this.paymentWay = paymentWay;
@@ -193,16 +222,6 @@ public class CardPurchaseRecord extends BaseEntity
         return paymentWay;
     }
 
-    public void setState(String state)
-    {
-        this.state = state;
-    }
-
-    public String getState()
-    {
-        return state;
-    }
-
     public void setNotes(String notes)
     {
         this.notes = notes;
@@ -230,11 +249,7 @@ public class CardPurchaseRecord extends BaseEntity
             .append("userId", getUserId())
             .append("carId", getCardId())
             .append("carName", getCardName())
-            .append("price", getPrice())
-            .append("paymentTime", getPaymentTime())
-            .append("refundTime", getRefundTime())
             .append("paymentWay", getPaymentWay())
-            .append("state", getState())
             .append("notes", getNotes())
             .append("version", getVersion())
             .append("createBy", getCreateBy())

+ 1 - 0
qmjszx-business/src/main/java/beilv/cardpurchaserecord/mapper/CardPurchaseRecordMapper.java

@@ -1,6 +1,7 @@
 package beilv.cardpurchaserecord.mapper;
 
 import beilv.cardpurchaserecord.domain.CardPurchaseRecord;
+import org.apache.ibatis.annotations.Options;
 
 import java.util.List;
 

+ 10 - 7
qmjszx-business/src/main/java/beilv/cardpurchaserecord/service/impl/CardPurchaseRecordServiceImpl.java

@@ -52,7 +52,8 @@ public class CardPurchaseRecordServiceImpl implements ICardPurchaseRecordService
     public List<CardPurchaseRecord> selectCardPurchaseRecordList(CardPurchaseRecord cardPurchaseRecord) {
         List<CardPurchaseRecord> cardPurchaseRecords = cardPurchaseRecordMapper.selectCardPurchaseRecordList(cardPurchaseRecord);
         for (CardPurchaseRecord cardPurchaseRecord2 : cardPurchaseRecords) {
-            cardPurchaseRecord2.setStateLabel(dictDataService.selectDictLabel("card_status",cardPurchaseRecord2.getState()));
+            cardPurchaseRecord2.setTypeLabel(dictDataService.selectDictLabel("card_status",cardPurchaseRecord2.getType()));
+            cardPurchaseRecord2.setCardTypeLabel(dictDataService.selectDictLabel("card_type",cardPurchaseRecord2.getCardType()));
         }
         return cardPurchaseRecords;
     }
@@ -65,21 +66,23 @@ public class CardPurchaseRecordServiceImpl implements ICardPurchaseRecordService
      */
     @Override
     public int insertCardPurchaseRecord(CardPurchaseRecord cardPurchaseRecord) {
+        //新增购卡记录
         cardPurchaseRecord.setCreateBy(ShiroUtils.getUserId().toString());
         cardPurchaseRecord.setCreateTime(DateUtils.getNowDate());
-        cardPurchaseRecord.setState("1");
-        cardPurchaseRecord.setPaymentTime(DateUtils.getNowDate());
+        cardPurchaseRecord.setType("1");
+        cardPurchaseRecord.setTime(DateUtils.getNowDate());
         cardPurchaseRecord.setVersion("0");
+        cardPurchaseRecordMapper.insertCardPurchaseRecord(cardPurchaseRecord);
         //新增会员管理
         UserMembershipCard userMembershipCard = new UserMembershipCard();
         userMembershipCard.setUserId(cardPurchaseRecord.getUserId());
-        userMembershipCard.setCardId(cardPurchaseRecord.getCardId());
-        userMembershipCard.setTotalNumber(cardPurchaseRecord.getTotalNumber());
+        userMembershipCard.setRecordId(cardPurchaseRecord.getId().toString());
         userMembershipCard.setRemainingNumber(cardPurchaseRecord.getTotalNumber());
         userMembershipCard.setCreateBy(ShiroUtils.getUserId().toString());
         userMembershipCard.setCreateTime(DateUtils.getNowDate());
-        userMembershipCardMapper.insertUserMembershipCard(userMembershipCard);
-        return cardPurchaseRecordMapper.insertCardPurchaseRecord(cardPurchaseRecord);
+//        userMembershipCard.setState("1");
+        userMembershipCard.setVersion("0");
+        return userMembershipCardMapper.insertUserMembershipCard(userMembershipCard);
     }
 
     /**

+ 0 - 21
qmjszx-business/src/main/java/beilv/carinformation/domain/CarInformation.java

@@ -82,11 +82,6 @@ public class CarInformation extends BaseEntity {
     @Excel(name = "卡种状态")
     private String cardStateLabel;
 
-    private String releaseState;
-
-    @Excel(name = "发布状态")
-    private String releaseStateLabel;
-
     public BigDecimal getOriginalPrice() {
         return originalPrice;
     }
@@ -103,22 +98,6 @@ public class CarInformation extends BaseEntity {
         this.memberPrice = memberPrice;
     }
 
-    public String getReleaseState() {
-        return releaseState;
-    }
-
-    public void setReleaseState(String releaseState) {
-        this.releaseState = releaseState;
-    }
-
-    public String getReleaseStateLabel() {
-        return releaseStateLabel;
-    }
-
-    public void setReleaseStateLabel(String releaseStateLabel) {
-        this.releaseStateLabel = releaseStateLabel;
-    }
-
     public String getCardState() {
         return cardState;
     }

+ 1 - 3
qmjszx-business/src/main/java/beilv/carinformation/service/impl/CarInformationServiceImpl.java

@@ -49,7 +49,6 @@ public class CarInformationServiceImpl implements ICarInformationService {
         for (CarInformation carInformation1 : carInformations) {
             carInformation1.setTypeLabel(dictDataService.selectDictLabel("card_type",carInformation1.getType()));
             carInformation1.setCardStateLabel(dictDataService.selectDictLabel("goods_state",carInformation1.getCardState()));
-            carInformation1.setReleaseStateLabel(dictDataService.selectDictLabel("release_state",carInformation1.getReleaseState()));
         }
         return carInformations;
     }
@@ -64,8 +63,7 @@ public class CarInformationServiceImpl implements ICarInformationService {
     public int insertCarInformation(CarInformation carInformation) {
         carInformation.setCreateTime(DateUtils.getNowDate());
         carInformation.setCreateBy(ShiroUtils.getUserId().toString());
-        carInformation.setCardState("3");
-        carInformation.setReleaseState("1");
+        carInformation.setCardState("2");
         return carInformationMapper.insertCarInformation(carInformation);
     }
 

+ 71 - 0
qmjszx-business/src/main/java/beilv/usermembershipcard/domain/MemberStream.java

@@ -0,0 +1,71 @@
+package beilv.usermembershipcard.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import beilv.common.annotation.Excel;
+import beilv.common.core.domain.BaseEntity;
+
+/**
+ * 会员用卡流水对象 member_stream
+ *
+ * @author ruoyi
+ * @date 2025-01-06
+ */
+public class MemberStream extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private String userId;
+
+    /** 卡种id */
+    @Excel(name = "卡种id")
+    private String cardId;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+
+    public void setUserId(String userId)
+    {
+        this.userId = userId;
+    }
+
+    public String getUserId()
+    {
+        return userId;
+    }
+
+    public void setCardId(String cardId)
+    {
+        this.cardId = cardId;
+    }
+
+    public String getCardId()
+    {
+        return cardId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("userId", getUserId())
+            .append("cardId", getCardId())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 19 - 12
qmjszx-business/src/main/java/beilv/usermembershipcard/domain/UserMembershipCard.java

@@ -24,7 +24,7 @@ public class UserMembershipCard extends BaseEntity
 
     /** 卡种id */
 //    @Excel(name = "卡种id")
-    private String cardId;
+    private String recordId;
 
     @Excel(name = "用户账户")
     private String userName;
@@ -50,6 +50,24 @@ public class UserMembershipCard extends BaseEntity
 //    @Excel(name = "版本")
     private String version;
 
+    private String state;
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getRecordId() {
+        return recordId;
+    }
+
+    public void setRecordId(String recordId) {
+        this.recordId = recordId;
+    }
+
     public String getUserName() {
         return userName;
     }
@@ -102,16 +120,6 @@ public class UserMembershipCard extends BaseEntity
         return userId;
     }
 
-    public void setCardId(String cardId)
-    {
-        this.cardId = cardId;
-    }
-
-    public String getCardId()
-    {
-        return cardId;
-    }
-
     public void setTotalNumber(Integer totalNumber)
     {
         this.totalNumber = totalNumber;
@@ -147,7 +155,6 @@ public class UserMembershipCard extends BaseEntity
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("id", getId())
             .append("userId", getUserId())
-            .append("carId", getCardId())
             .append("totalNumber", getTotalNumber())
             .append("remainingNumber", getRemainingNumber())
             .append("version", getVersion())

+ 3 - 0
qmjszx-business/src/main/java/beilv/usermembershipcard/mapper/UserMembershipCardMapper.java

@@ -3,6 +3,7 @@ package beilv.usermembershipcard.mapper;
 import beilv.usermembershipcard.domain.UserMembershipCard;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户会员卡Mapper接口
@@ -58,4 +59,6 @@ public interface UserMembershipCardMapper {
      * @return 结果
      */
     public int deleteUserMembershipCardByIds(String[] ids);
+
+    public List<Map<String,Object>> getStream(Long id);
 }

+ 13 - 0
qmjszx-business/src/main/java/beilv/usermembershipcard/service/IUserMembershipCardService.java

@@ -1,8 +1,11 @@
 package beilv.usermembershipcard.service;
 
+import beilv.cardpurchaserecord.domain.CardPurchaseRecord;
+import beilv.usermembershipcard.domain.MemberStream;
 import beilv.usermembershipcard.domain.UserMembershipCard;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户会员卡Service接口
@@ -59,4 +62,14 @@ public interface IUserMembershipCardService {
      */
     public int deleteUserMembershipCardById(Long id);
 
+    public List<Map<String,Object>> getStream(Long id);
+
+    /*
+     * 新增退卡记录
+     *
+     * @author 韩福成
+     * @date 2025/1/7 上午10:47
+     */
+    public int refundCard(UserMembershipCard userMembershipCard);
+
 }

+ 34 - 1
qmjszx-business/src/main/java/beilv/usermembershipcard/service/impl/UserMembershipCardServiceImpl.java

@@ -1,8 +1,10 @@
 package beilv.usermembershipcard.service.impl;
 
+import beilv.cardpurchaserecord.domain.CardPurchaseRecord;
+import beilv.cardpurchaserecord.mapper.CardPurchaseRecordMapper;
 import beilv.common.core.text.Convert;
 import beilv.common.utils.DateUtils;
-import beilv.common.utils.uuid.IdUtils;
+import beilv.common.utils.ShiroUtils;
 import beilv.usermembershipcard.domain.UserMembershipCard;
 import beilv.usermembershipcard.mapper.UserMembershipCardMapper;
 import beilv.usermembershipcard.service.IUserMembershipCardService;
@@ -10,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户会员卡Service业务层处理
@@ -22,6 +25,9 @@ public class UserMembershipCardServiceImpl implements IUserMembershipCardService
     @Autowired
     private UserMembershipCardMapper userMembershipCardMapper;
 
+    @Autowired
+    private CardPurchaseRecordMapper cardPurchaseRecordMapper;
+
     /**
      * 查询用户会员卡
      *
@@ -89,4 +95,31 @@ public class UserMembershipCardServiceImpl implements IUserMembershipCardService
     public int deleteUserMembershipCardById(Long id) {
         return userMembershipCardMapper.deleteUserMembershipCardById(id);
     }
+
+    @Override
+    public List<Map<String,Object>> getStream(Long id) {
+        return userMembershipCardMapper.getStream(id);
+    }
+
+    /*
+     * 新增退卡记录
+     *
+     * @author 韩福成
+     * @date 2025/1/7 上午10:50
+     */
+    @Override
+    public int refundCard(UserMembershipCard userMembershipCard) {
+        //新增退卡记录
+        CardPurchaseRecord record = new CardPurchaseRecord();
+        record.setCreateBy(ShiroUtils.getUserId().toString());
+        record.setCreateTime(DateUtils.getNowDate());
+        record.setType("2");
+        record.setTime(DateUtils.getNowDate());
+        record.setVersion("0");
+        cardPurchaseRecordMapper.insertCardPurchaseRecord(record);
+
+        //修改会员管理状态
+//        userMembershipCard.setState("3");
+        return userMembershipCardMapper.updateUserMembershipCard(userMembershipCard);
+    }
 }

+ 1 - 6
qmjszx-business/src/main/resources/mapper/card/CarInformationMapper.xml

@@ -15,7 +15,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="expirationDate"    column="expiration_date"    />
         <result property="notes"    column="notes"    />
         <result property="cardState"    column="card_state"    />
-        <result property="releaseState"    column="release_state"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -23,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCarInformationVo">
-        select id, name, type, total_number, original_price,member_price, point, expiration_date, notes, card_state,release_state, create_by, create_time, update_by, update_time from card_information
+        select id, name, type, total_number, original_price,member_price, point, expiration_date, notes, card_state, create_by, create_time, update_by, update_time from card_information
     </sql>
 
     <select id="selectCarInformationList" parameterType="CarInformation" resultMap="CarInformationResult">
@@ -38,7 +37,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expirationDate != null "> and expiration_date = #{expirationDate}</if>
             <if test="notes != null  and notes != ''"> and notes = #{notes}</if>
             <if test="cardState != null  and cardState != ''"> and card_state = #{cardState}</if>
-            <if test="releaseState != null  and releaseState != ''"> and release_state = #{releaseState}</if>
         </where>
         order by create_time desc
     </select>
@@ -61,7 +59,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expirationDate != null">expiration_date,</if>
             <if test="notes != null">notes,</if>
             <if test="cardState != null">card_state,</if>
-            <if test="releaseState != null">release_state,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -78,7 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expirationDate != null">#{expirationDate},</if>
             <if test="notes != null">#{notes},</if>
             <if test="cardState != null">#{cardState},</if>
-            <if test="releaseState != null">#{releaseState},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -98,7 +94,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expirationDate != null">expiration_date = #{expirationDate},</if>
             <if test="notes != null">notes = #{notes},</if>
             <if test="cardState != null">card_state = #{cardState},</if>
-            <if test="releaseState != null">release_state = #{releaseState},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 30 - 23
qmjszx-business/src/main/resources/mapper/card/CardPurchaseRecordMapper.xml

@@ -9,11 +9,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="userId"    column="user_id"    />
         <result property="cardId"    column="card_id"    />
         <result property="cardName"    column="card_name"    />
-        <result property="price"    column="price"    />
-        <result property="paymentTime"    column="payment_time"    />
-        <result property="refundTime"    column="refund_time"    />
+        <result property="time"    column="time"    />
         <result property="paymentWay"    column="payment_way"    />
-        <result property="state"    column="state"    />
+        <result property="type"    column="type"    />
         <result property="notes"    column="notes"    />
         <result property="version"    column="version"    />
         <result property="createBy"    column="create_by"    />
@@ -23,14 +21,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="userName"    column="username"    />
         <result property="realName"    column="real_name"    />
         <result property="mobile"    column="mobile"    />
+        <result property="cardType"    column="card_type"    />
+        <result property="totalNumber"    column="total_number"    />
+        <result property="memberPrice"    column="member_price"    />
     </resultMap>
 
     <sql id="selectCardPurchaseRecordVo">
-        select a.id, a.user_id, a.card_id, a.card_name, a.price, a.payment_time, a.refund_time, a.payment_way, a.state, a.notes, a.version, a.create_by, a.create_time, a.update_by, a.update_time from card_purchase_record a
+        select a.id, a.user_id, a.card_id, a.card_name,a.card_type, a.total_number, a.member_price, a.time, a.payment_way, a.type, a.notes, a.version, a.create_by, a.create_time, a.update_by, a.update_time from card_purchase_record a
     </sql>
 
     <select id="selectCardPurchaseRecordList" parameterType="CardPurchaseRecord" resultMap="CardPurchaseRecordResult">
-        select a.id, a.user_id, a.card_id, a.card_name, a.price, a.payment_time, a.refund_time, a.payment_way, a.state, a.notes, a.version, a.create_by, a.create_time, a.update_by, a.update_time,
+        select a.id, a.user_id, a.card_id, a.card_name,a.card_type, a.total_number, a.member_price, a.time, a.payment_way, a.type, a.notes, a.version, a.create_by, a.create_time, a.update_by, a.update_time,
         b.username,b.real_name,b.mobile
         from card_purchase_record a
         left join sys_member b on a.user_id = b.id
@@ -38,11 +39,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
             <if test="cardId != null  and cardId != ''"> and card_id = #{cardId}</if>
             <if test="cardName != null  and cardName != ''"> and card_name like concat('%', #{cardName}, '%')</if>
-            <if test="price != null "> and price = #{price}</if>
-            <if test="paymentTime != null "> and payment_time = #{paymentTime}</if>
-            <if test="refundTime != null "> and refund_time = #{refundTime}</if>
+            <if test="memberPrice != null "> and member_price = #{memberPrice}</if>
+            <if test="time != null "> and time = #{time}</if>
             <if test="paymentWay != null  and paymentWay != ''"> and payment_way = #{paymentWay}</if>
-            <if test="state != null  and state != ''"> and state = #{state}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="notes != null  and notes != ''"> and notes = #{notes}</if>
             <if test="version != null  and version != ''"> and version = #{version}</if>
             <if test="realName != null  and realName != ''"> and b.real_name like concat('%', #{realName}, '%')</if>
@@ -56,18 +56,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
-    <insert id="insertCardPurchaseRecord" parameterType="CardPurchaseRecord">
+    <insert id="insertCardPurchaseRecord" parameterType="CardPurchaseRecord" keyProperty="id" useGeneratedKeys="true">
         insert into card_purchase_record
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
             <if test="userId != null">user_id,</if>
             <if test="cardId != null">card_id,</if>
             <if test="cardName != null">card_name,</if>
-            <if test="price != null">price,</if>
-            <if test="paymentTime != null">payment_time,</if>
-            <if test="refundTime != null">refund_time,</if>
+            <if test="cardType != null">card_type,</if>
+            <if test="totalNumber != null">total_number,</if>
+            <if test="originalPrice != null">original_price,</if>
+            <if test="memberPrice != null">member_price,</if>
+            <if test="point != null">point,</if>
+            <if test="time != null">time,</if>
             <if test="paymentWay != null">payment_way,</if>
-            <if test="state != null">state,</if>
+            <if test="type != null">type,</if>
             <if test="notes != null">notes,</if>
             <if test="version != null">version,</if>
             <if test="createBy != null">create_by,</if>
@@ -80,11 +83,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userId != null">#{userId},</if>
             <if test="cardId != null">#{cardId},</if>
             <if test="cardName != null">#{cardName},</if>
-            <if test="price != null">#{price},</if>
-            <if test="paymentTime != null">#{paymentTime},</if>
-            <if test="refundTime != null">#{refundTime},</if>
+            <if test="cardType != null">#{cardType},</if>
+            <if test="totalNumber != null">#{totalNumber},</if>
+            <if test="originalPrice != null">#{originalPrice},</if>
+            <if test="memberPrice != null">#{memberPrice},</if>
+            <if test="point != null">#{point},</if>
+            <if test="time != null">#{time},</if>
             <if test="paymentWay != null">#{paymentWay},</if>
-            <if test="state != null">#{state},</if>
+            <if test="type != null">#{type},</if>
             <if test="notes != null">#{notes},</if>
             <if test="version != null">#{version},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -100,11 +106,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userId != null">user_id = #{userId},</if>
             <if test="cardId != null">card_id = #{cardId},</if>
             <if test="cardName != null">card_name = #{cardName},</if>
-            <if test="price != null">price = #{price},</if>
-            <if test="paymentTime != null">payment_time = #{paymentTime},</if>
-            <if test="refundTime != null">refund_time = #{refundTime},</if>
+            <if test="cardType != null">card_type = #{cardType},</if>
+            <if test="totalNumber != null">total_number = #{totalNumber},</if>
+            <if test="memberPrice != null">member_price = #{memberPrice},</if>
+            <if test="time != null">time = #{time},</if>
             <if test="paymentWay != null">payment_way = #{paymentWay},</if>
-            <if test="state != null">state = #{state},</if>
+            <if test="type != null">type = #{type},</if>
             <if test="notes != null">notes = #{notes},</if>
             <if test="version != null">version = #{version},</if>
             <if test="createBy != null">create_by = #{createBy},</if>

+ 29 - 11
qmjszx-business/src/main/resources/mapper/card/UserMembershipCardMapper.xml

@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="UserMembershipCard" id="UserMembershipCardResult">
         <result property="id"    column="id"    />
         <result property="userId"    column="user_id"    />
-        <result property="cardId"    column="card_id"    />
+        <result property="recordId"    column="record_id"    />
         <result property="totalNumber"    column="total_number"    />
         <result property="remainingNumber"    column="remaining_number"    />
         <result property="version"    column="version"    />
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectUserMembershipCardVo">
-        select id, user_id, card_id, total_number, remaining_number, version, create_by, create_time, update_by, update_time from user_membership_card
+        select id, user_id, record_id, remaining_number, version,state, create_by, create_time, update_by, update_time from user_membership_card
     </sql>
 
     <select id="selectUserMembershipCardList" parameterType="UserMembershipCard" resultMap="UserMembershipCardResult">
@@ -32,18 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             b.username,
             b.real_name,
             b.mobile,
-            a.card_id,
-            c.name cardName,
-            a.total_number,
+            a.record_id,
+            c.card_name cardName,
+            c.total_number,
             a.remaining_number
         FROM
             user_membership_card a
             left join sys_member b on a.user_id = b.id
-            left join card_information c on a.card_id = c.id
+            left join card_purchase_record c on a.record_id = c.id
         <where>
             <if test="userId != null  and userId != ''"> and a.user_id = #{userId}</if>
-            <if test="cardId != null  and cardId != ''"> and a.card_id = #{cardId}</if>
-            <if test="totalNumber != null "> and a.total_number = #{totalNumber}</if>
+            <if test="recordId != null  and recordId != ''"> and a.record_id = #{recordId}</if>
+            <if test="totalNumber != null "> and c.total_number = #{totalNumber}</if>
             <if test="remainingNumber != null "> and a.remaining_number = #{remainingNumber}</if>
             <if test="version != null  and version != ''"> and a.version = #{version}</if>
             <if test="realName != null  and realName != ''"> and b.real_name like concat('%', #{realName}, '%')</if>
@@ -63,9 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
             <if test="userId != null">user_id,</if>
-            <if test="cardId != null">card_id,</if>
+            <if test="recordId != null">record_id,</if>
             <if test="totalNumber != null">total_number,</if>
             <if test="remainingNumber != null">remaining_number,</if>
+            <if test="state != null">state,</if>
             <if test="version != null">version,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -75,9 +76,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
             <if test="userId != null">#{userId},</if>
-            <if test="cardId != null">#{cardId},</if>
+            <if test="recordId != null">#{recordId},</if>
             <if test="totalNumber != null">#{totalNumber},</if>
             <if test="remainingNumber != null">#{remainingNumber},</if>
+            <if test="state != null">#{state},</if>
             <if test="version != null">#{version},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -90,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update user_membership_card
         <trim prefix="SET" suffixOverrides=",">
             <if test="userId != null">user_id = #{userId},</if>
-            <if test="cardId != null">card_id = #{cardId},</if>
+            <if test="recordId != null">record_id = #{recordId},</if>
             <if test="totalNumber != null">total_number = #{totalNumber},</if>
             <if test="remainingNumber != null">remaining_number = #{remainingNumber},</if>
             <if test="version != null">version = #{version},</if>
@@ -113,4 +115,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
+    <select id="getStream" parameterType="Long" resultType="java.util.Map">
+        SELECT
+            a.id,
+            d.username,
+            d.real_name realName,
+            d.mobile,
+            c.`name`,
+            a.create_time createTime
+        FROM
+            member_stream a
+            left join user_membership_card b on a.user_card_id = b.id
+            left join card_information c on b.card_id = c.id
+            left join sys_member d on b.user_id = d.id
+        WHERE a.user_card_id = #{id}
+    </select>
+
 </mapper>