Explorar o código

会员卡管理

hanfucheng hai 5 meses
pai
achega
c7afc537a1

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

@@ -19,7 +19,7 @@
                 <div class="form-group">
                     <label class="col-sm-3 control-label is-required">类型:</label>
                     <div class="col-sm-8">
-                        <select name="type" class="form-control" th:with="type=${@dict.getType('card_type')}" required>
+                        <select name="type" class="form-control" th:with="type=${@dict.getType('site_type')}" required>
                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                         </select>
                     </div>

+ 1 - 1
qmjszx-admin/src/main/resources/templates/information/edit.html

@@ -20,7 +20,7 @@
                 <div class="form-group">
                     <label class="col-sm-3 control-label is-required">类型:</label>
                     <div class="col-sm-8">
-                        <select name="type" class="form-control" th:with="type=${@dict.getType('card_type')}">
+                        <select name="type" class="form-control" th:with="type=${@dict.getType('site_type')}">
                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{type}"></option>
                         </select>
                     </div>

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

@@ -16,7 +16,7 @@
                             </li>
                             <li>
                                 <label>类型:</label>
-                                <select name="type" th:with="type=${@dict.getType('card_type')}">
+                                <select name="type" th:with="type=${@dict.getType('site_type')}">
                                     <option value="">所有</option>
                                     <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                             th:value="${dict.dictValue}"></option>
@@ -63,7 +63,7 @@
         var editFlag = [[${@permission.hasPermi('system:information:edit')}]];
         var removeFlag = [[${@permission.hasPermi('system:information:remove')}]];
         var prefix = ctx + "information";
-        var cardType = [[${@dict.getType('card_type')}]];
+        var cardType = [[${@dict.getType('site_type')}]];
         var sysJobStatus = [[${@dict.getType('goods_state')}]];
 
         $(function() {

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

@@ -53,7 +53,7 @@ public class CardPurchaseRecordServiceImpl implements ICardPurchaseRecordService
         List<CardPurchaseRecord> cardPurchaseRecords = cardPurchaseRecordMapper.selectCardPurchaseRecordList(cardPurchaseRecord);
         for (CardPurchaseRecord cardPurchaseRecord2 : cardPurchaseRecords) {
             cardPurchaseRecord2.setTypeLabel(dictDataService.selectDictLabel("card_status",cardPurchaseRecord2.getType()));
-            cardPurchaseRecord2.setCardTypeLabel(dictDataService.selectDictLabel("card_type",cardPurchaseRecord2.getCardType()));
+            cardPurchaseRecord2.setCardTypeLabel(dictDataService.selectDictLabel("site_type",cardPurchaseRecord2.getCardType()));
         }
         return cardPurchaseRecords;
     }

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

@@ -47,7 +47,7 @@ public class CarInformationServiceImpl implements ICarInformationService {
     public List<CarInformation> selectCarInformationList(CarInformation carInformation) {
         List<CarInformation> carInformations = carInformationMapper.selectCarInformationList(carInformation);
         for (CarInformation carInformation1 : carInformations) {
-            carInformation1.setTypeLabel(dictDataService.selectDictLabel("card_type",carInformation1.getType()));
+            carInformation1.setTypeLabel(dictDataService.selectDictLabel("site_type",carInformation1.getType()));
             carInformation1.setCardStateLabel(dictDataService.selectDictLabel("goods_state",carInformation1.getCardState()));
         }
         return carInformations;

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

@@ -76,4 +76,12 @@ public interface UserMembershipCardMapper {
     * @date 2025/1/8 上午9:24
     */
     public int addStream(MemberStream memberStream);
+
+    /*
+    * 修改剩余次数
+    *
+    * @author 韩福成
+    * @date 2025/1/8 上午11:05
+    */
+    public int updateRemainingNumber(UserMembershipCard userMembershipCard);
 }

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

@@ -122,8 +122,7 @@ public class UserMembershipCardServiceImpl implements IUserMembershipCardService
         //扣除会员卡剩余次数
         UserMembershipCard userMembershipCard = new UserMembershipCard();
         userMembershipCard.setId(Long.valueOf(memberStream.getUserCardId()));
-        userMembershipCard.setRemainingNumber(memberStream.getRemainingNumber()-1);
-        userMembershipCardMapper.updateUserMembershipCard(userMembershipCard);
+        userMembershipCardMapper.updateRemainingNumber(userMembershipCard);
         return userMembershipCardMapper.addStream(memberStream);
     }
 

+ 15 - 10
qmjszx-business/src/main/resources/mapper/card/UserMembershipCardMapper.xml

@@ -96,16 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userId != null">user_id = #{userId},</if>
             <if test="recordId != null">record_id = #{recordId},</if>
             <if test="totalNumber != null">total_number = #{totalNumber},</if>
-            <if test="remainingNumber != null">
-                <choose>
-                    <when test="remainingNumber == -1">
-                        remaining_number = (select remaining_number -1 from user_membership_card where id = #{id}),
-                    </when>
-                    <otherwise>
-                        remaining_number = #{remainingNumber}
-                    </otherwise>
-                </choose>
-            </if>
+            <if test="remainingNumber != null">remaining_number = #{remainingNumber}</if>
             <if test="version != null">version = #{version},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
@@ -164,4 +155,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
     </insert>
 
+    <update id="updateRemainingNumber" parameterType="UserMembershipCard">
+        update user_membership_card
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="remainingNumber != null">
+                <choose>
+                    <when test="remainingNumber == -1">
+                        remaining_number = (select remaining_number-1 from user_membership_card where id = #{id})
+                    </when>
+                    <otherwise>remaining_number = (select remaining_number+1 from user_membership_card where id = #{id})</otherwise>
+                </choose>
+            </if>
+        </trim>
+        where id = #{id}
+    </update>
 </mapper>