Prechádzať zdrojové kódy

超级会员优惠券页面回显2

chao 3 rokov pred
rodič
commit
58cd35e607

+ 1 - 12
src/main/java/com/caimei/modules/coupon/dao/CmCouponVipDao.java

@@ -29,16 +29,5 @@ public interface CmCouponVipDao extends CrudDao<CmVipCoupon> {
      * @param shopId
      * @return
      */
-    NewCmShop findShopName(Integer shopId);
-
-//    List<CmVipCouponRelation> findGroup(String useTime, Integer status);
-//
-//    List<String> findUseTime();
-//
-//    List<String> findBind();
-//
-//    CmVipCouponRelation findByCoupon(@Param("couponId") Integer couponId, @Param("status") String status);
-//
-//    void updateVip(CmVipCouponRelation vipCoupon);
-
+    NewCmShop getShopInfoByShopId(Integer shopId);
 }

+ 12 - 8
src/main/java/com/caimei/modules/coupon/service/CmVipCouponService.java

@@ -111,7 +111,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
             }
             if (cmCoupon.getCouponType() == 3) {
                 // 店铺券
-                NewCmShop shop = cmCouponVipDao.findShopName(cmCoupon.getShopId());
+                NewCmShop shop = cmCouponVipDao.getShopInfoByShopId(cmCoupon.getShopId());
                 svipcouponForm.setShopName1(shop.getName());
                 svipcouponForm.setShop1(shop);
             }
@@ -132,7 +132,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
             }
             if (cmCoupon.getCouponType() == 3) {
                 // 店铺券
-                NewCmShop shop = cmCouponVipDao.findShopName(cmCoupon.getShopId());
+                NewCmShop shop = cmCouponVipDao.getShopInfoByShopId(cmCoupon.getShopId());
                 svipcouponForm.setShopName2(shop.getName());
                 svipcouponForm.setShop2(shop);
             }
@@ -153,7 +153,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
             }
             if (cmCoupon.getCouponType() == 3) {
                 // 店铺券
-                NewCmShop shop = cmCouponVipDao.findShopName(cmCoupon.getShopId());
+                NewCmShop shop = cmCouponVipDao.getShopInfoByShopId(cmCoupon.getShopId());
                 svipcouponForm.setShopName3(shop.getName());
                 svipcouponForm.setShop3(shop);
             }
@@ -174,7 +174,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
             }
             if (cmCoupon.getCouponType() == 3) {
                 // 店铺券
-                NewCmShop shop = cmCouponVipDao.findShopName(cmCoupon.getShopId());
+                NewCmShop shop = cmCouponVipDao.getShopInfoByShopId(cmCoupon.getShopId());
                 svipcouponForm.setShopName4(shop.getName());
                 svipcouponForm.setShop4(shop);
             }
@@ -226,7 +226,8 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         if ("0".equals(svipcouponForm.getCouponType1())){
             coupon1.setCouponType(0);
             coupon1.setProductType(svipcouponForm.getProductType1());
-            if (svipcouponForm.getProductInfo1() != null) {
+            if ("2".equals(svipcouponForm.getProductType1())){
+                // 指定商品
                 coupon1.setProductInfo(svipcouponForm.getProductInfo1());
             }
         } else if ("1".equals(svipcouponForm.getCouponType1())) {
@@ -250,7 +251,8 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         if ("0".equals(svipcouponForm.getCouponType2())){
             coupon2.setCouponType(0);
             coupon2.setProductType(svipcouponForm.getProductType2());
-            if (svipcouponForm.getProductInfo2() != null) {
+            if ("2".equals(svipcouponForm.getProductType2())){
+                // 指定商品
                 coupon2.setProductInfo(svipcouponForm.getProductInfo2());
             }
         } else if ("1".equals(svipcouponForm.getCouponType2())) {
@@ -274,7 +276,8 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         if ("0".equals(svipcouponForm.getCouponType3())){
             coupon3.setCouponType(0);
             coupon3.setProductType(svipcouponForm.getProductType3());
-            if (svipcouponForm.getProductInfo3() != null) {
+            if ("2".equals(svipcouponForm.getProductType3())){
+                // 指定商品
                 coupon3.setProductInfo(svipcouponForm.getProductInfo3());
             }
         } else if ("1".equals(svipcouponForm.getCouponType3())) {
@@ -298,7 +301,8 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
         if ("0".equals(svipcouponForm.getCouponType4())){
             coupon4.setCouponType(0);
             coupon4.setProductType(svipcouponForm.getProductType4());
-            if (svipcouponForm.getProductInfo4() != null) {
+            if ("2".equals(svipcouponForm.getProductType4())){
+                // 指定商品
                 coupon4.setProductInfo(svipcouponForm.getProductInfo4());
             }
         } else if ("1".equals(svipcouponForm.getCouponType4())) {

+ 12 - 33
src/main/resources/mappings/modules/super/CmCouponVipMapper.xml

@@ -100,38 +100,17 @@
     <delete id="deleteByMonthId">
         UPDATE cm_svip_coupon SET delFlag=1 WHERE montId = #{montId}
     </delete>
-    <select id="findShopName" resultType="com.caimei.modules.user.entity.NewCmShop">
-        select name,sname,linkMan,contractMobile
-        from shop
-        where shopID = #{shopId}
+    <select id="getShopInfoByShopId" resultType="com.caimei.modules.user.entity.NewCmShop">
+        SELECT
+        s.shopID,
+        s.userID,
+        IFNULL(s.name, u.name) AS name,
+        IFNULL(s.sname, u.realName) AS sname,
+        IFNULL(s.contractMobile, u.bindMobile) AS contractMobile,
+        IFNULL(s.linkMan, u.userName) AS linkMan
+        FROM shop s
+        LEFT JOIN USER u ON u.`shopID` = s.`shopID`
+        WHERE s.shopID = #{shopId}
+        LIMIT 1
     </select>
-
-<!--    <select id="findGroup" resultType="com.caimei.modules.coupon.entity.CmVipCouponRelation">-->
-<!--        select *-->
-<!--        from cm_svip_coupon cs-->
-<!--        where useTime = #{useTime}-->
-<!--        AND cs.delFlag=0-->
-<!--        <if test="status!=null and status != ''">-->
-<!--            AND cs.status=#{status}-->
-<!--        </if>-->
-<!--    </select>-->
-<!--    <select id="findUseTime" resultType="String">-->
-<!--        SELECT DISTINCT usetime-->
-<!--        FROM cm_svip_coupon-->
-<!--    </select>-->
-
-<!--    <select id="findBind" resultType="java.lang.String">-->
-<!--        SELECT DISTINCT bindCoupon-->
-<!--        FROM cm_svip_coupon-->
-<!--    </select>-->
-
-<!--    <select id="findByCoupon" resultType="com.caimei.modules.coupon.entity.CmVipCouponRelation">-->
-<!--        select useTime, status, couponId, bindCoupon-->
-<!--        from cm_svip_coupon-->
-<!--        where delFlag = 0-->
-<!--        and couponId=#{couponId}-->
-<!--        <if test="status != null and status != ''">-->
-<!--            and status=#{status}-->
-<!--        </if>-->
-<!--    </select>-->
 </mapper>

+ 7 - 7
src/main/webapp/WEB-INF/views/modules/svip/cmSvipCouponForm.jsp

@@ -18,7 +18,7 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li class="active"><a href="${ctx}/vip/cmCoupon/">超级会员专属优惠券</a></li>
+    <li><a href="${ctx}/vip/cmCoupon/">超级会员专属优惠券</a></li>
     <li class="active"><a href="${ctx}/vip/cmCoupon/form?id=${cmVipCoupon.id}">${not empty cmVipCoupon.id?'编辑':'添加'}</a>
     </li>
 </ul><br>
@@ -47,7 +47,7 @@
             <label class="control-label"><font color="red">*</font>供应商:</label>
             <div class="controls">
                 <a href="javascript:void(0);" onclick="showSelectShop(1)" id="chooseShop1">请选择供应商</a>
-                <form:hidden path="shopId1"/>
+                <form:hidden path="shopId1" id="shopId1"/>
                 <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
                     <thead></thead>
                     <tbody class="hotSearchShop"></tbody>
@@ -109,7 +109,7 @@
             <label class="control-label"><font color="red">*</font>供应商:</label>
             <div class="controls">
                 <a href="javascript:void(0);" onclick="showSelectShop(2)" id="chooseShop2">请选择供应商</a>
-                <form:hidden path="shopId2"/>
+                <form:hidden path="shopId2" id="shopId2"/>
                 <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
                     <thead></thead>
                     <tbody class="hotSearchShop"></tbody>
@@ -171,7 +171,7 @@
             <label class="control-label"><font color="red">*</font>供应商:</label>
             <div class="controls">
                 <a href="javascript:void(0);" onclick="showSelectShop(3)" id="chooseShop3">请选择供应商</a>
-                <form:hidden path="shopId3"/>
+                <form:hidden path="shopId3" id="shopId3"/>
                 <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
                     <thead></thead>
                     <tbody class="hotSearchShop"></tbody>
@@ -228,12 +228,12 @@
                 <form:radiobutton path="couponType4" class="couponType" label="店铺券" value="3" onclick="cType(1)"></form:radiobutton>
             </div>
         </div>
-        <form:hidden path="couponId1" id="couponId4"/>
+        <form:hidden path="couponId4" id="couponId4"/>
         <div class="control-group coupon-line l0" ${svipcouponForm.couponType4 ne '3' ? 'style="display:none"':''}>
             <label class="control-label"><font color="red">*</font>供应商:</label>
             <div class="controls">
                 <a href="javascript:void(0);" onclick="showSelectShop(4)" id="chooseShop4">请选择供应商</a>
-                <form:hidden path="shopId4"/>
+                <form:hidden path="shopId4" id="shopId4"/>
                 <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
                     <thead></thead>
                     <tbody class="hotSearchShop"></tbody>
@@ -286,7 +286,7 @@
 </form:form>
 
 <script type="text/javascript">
-    $(".contentTableShop thead").html('<tr><th>机构名称</th><th>机构简称</th><th>联系人</th><th>手机号</th><th>操作</th></tr>');
+    $(".contentTableShop thead").html('<tr><th>供应商名称</th><th>供应商简称</th><th>联系人</th><th>手机号</th><th>操作</th></tr>');
     $(".contentTableProduct thead").html('<tr><th style="width:20px;"><input class="check-all" type="checkbox" onclick="clickAllSelect(this)"/>全选</th>' +
         '<th>商品图片</th><th>商品名称</th><th>供应商</th><th>网站状态</th><th>小程序状态</th><th>排序</th><th>添加时间</th><th>操作</th></tr>');