Explorar o código

增加套系已经上架只能修改展示结束时间

zhangyang %!s(int64=2) %!d(string=hai) anos
pai
achega
9bc207dd2e

+ 8 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PoTetherController.java

@@ -203,8 +203,9 @@ public class PoTetherController extends BaseController
         if (tetherVo1 == null){
             return error("没有对应的数据");
         }
+        System.out.println(tetherVo1.getCochain());
         if (tetherVo1.getCochain() == 0){
-            return error("已经上链");
+            return error("已经上链不允许修改");
         }
 
         if (UserConstants.NOT_UNIQUE.equals(poTetherService.checkPostTetherNameUnique(tetherVo))){
@@ -213,10 +214,14 @@ public class PoTetherController extends BaseController
         if(UserConstants.NOT_UNIQUE.equals(poTetherService.checkPostTetherImageUnique(tetherVo))){
             return AjaxResult.error("修改失败"+tetherVo.getImage()+"已经存在");
         }
-
         tetherVo.setUpdateBy(getUsername());
         tetherVo.setUpdateTime(new Date());
-        poTetherService.updatePoTetherWithCollection(tetherVo);
+        if (tetherVo1.getGrounding() == 0){
+            //已经上架只可以修改展示结束的时间
+            poTetherService.updateShowTimeEnd(tetherVo);
+        }else{
+            poTetherService.updatePoTetherWithCollection(tetherVo);
+        }
         return success("修改成功");
     }
 

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PoTetherMapper.java

@@ -6,6 +6,7 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.system.domain.PoTether;
 import com.ruoyi.system.domain.PoTetherandcollection;
+import com.ruoyi.system.domain.vo.TetherVo;
 import org.apache.ibatis.annotations.Param;
 
 /**
@@ -149,4 +150,10 @@ public interface PoTetherMapper extends BaseMapper<PoTether>
      * @return
      */
     List<PoTether> selectPoTetherCollectionList(PoTether poTether);
+
+    /**
+     * 已经上架只允许修改展示结束时间
+     * @param tetherVo
+     */
+    void updateShowTimeEnd(TetherVo tetherVo);
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IPoTetherService.java

@@ -139,5 +139,11 @@ public interface IPoTetherService extends IService<PoTether>
      */
     List<PoTether> selectPoTetherCollectionList(PoTether poTether);
 
+    /**
+     * 已经上架只允许修改展示结束时间
+     * @param tetherVo
+     */
+    void updateShowTimeEnd(TetherVo tetherVo);
+
 }
 

+ 11 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoTetherServiceImpl.java

@@ -201,6 +201,7 @@ public class PoTetherServiceImpl extends ServiceImpl<PoTetherMapper,PoTether> im
         lambdaQueryWrapper.eq(PoTetherandcollection::getTetherId,tetherVo.getTetherId());
         poTetherandcollectionService.remove(lambdaQueryWrapper);
 //        //添加当前提交过来的藏品数据--po_Tetherandcollection表的insert操作
+
         for (int i = 0 ; i < tetherVo.getPoTetherandcollections().size();i++) {
 
             System.out.println(tetherVo.getPoTetherandcollections().get(i).getCollectionTitle());
@@ -324,7 +325,7 @@ public class PoTetherServiceImpl extends ServiceImpl<PoTetherMapper,PoTether> im
      */
     @Override
     public boolean updatePoTetherIsGrounding(Integer grounding, Long tetherId) {
-        return poTetherMapper.updatePoTetherIsGrounding(grounding,  tetherId);
+        return poTetherMapper.updatePoTetherIsGrounding(grounding, tetherId);
     }
 
     /**
@@ -339,5 +340,14 @@ public class PoTetherServiceImpl extends ServiceImpl<PoTetherMapper,PoTether> im
         return poTetherMapper.selectPoTetherCollectionList(poTether);
     }
 
+    /**
+     * 已经上架只允许修改展示结束时间
+     * @param tetherVo
+     */
+    @Override
+    public void updateShowTimeEnd(TetherVo tetherVo) {
+        poTetherMapper.updateShowTimeEnd(tetherVo);
+    }
+
 }
 

+ 11 - 0
ruoyi-system/src/main/resources/mapper/system/PoTetherMapper.xml

@@ -266,10 +266,12 @@
     <update id="updatePoTetherIsCochain" parameterType="PoTether">
         update po_tether set cochain = #{cochain} where tether_id = #{tetherId}
     </update>
+
 <!--    修改状态 是否上架-->
     <update id="updatePoTetherIsGrounding" parameterType="PoTether">
         update po_tether set grounding = #{grounding} where tether_id = #{tetherId}
     </update>
+
 <!--    更新种类-->
     <update id="updatePostTetherCollection" parameterType="PoTether">
         UPDATE po_tether INNER JOIN (
@@ -283,5 +285,14 @@
         ON po_tether.tether_id = a.tether_id
             SET po_tether.total = a.total
     </update>
+
+<!--    只修改展示结束时间-->
+    <update id="updateShowTimeEnd" parameterType="PoTether">
+        update po_tether
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="showTimeEnd != null">show_time_end = #{showTimeEnd},</if>
+        </trim>
+        where tether_id = #{tetherId}
+    </update>
 </mapper>