Jelajahi Sumber

Merge branch 'blue' of http://39.105.160.25:10880/post-project-api/post

tangzetong 2 tahun lalu
induk
melakukan
492759d494

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

@@ -143,8 +143,8 @@ public class PoTetherController extends BaseController
     @Log(title = "套系", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     public AjaxResult add(@RequestBody TetherVo tetherVo,
-                          @RequestBody @Param("poUser") PoUser poUser,
-                          @RequestBody PoTetherandcollection poTetherandcollection)
+                          @RequestBody @Param("poUser") PoUser poUser
+                          )
     {
         //判断当前用户是否有操作的权限
         poUserService.checkUserAllowed(poUser);
@@ -170,7 +170,7 @@ public class PoTetherController extends BaseController
         }else{
             tetherVo.setSellStatus(0);
         }
-        poTetherService.insertPoTetherWithCollection(tetherVo,poTetherandcollection);
+        poTetherService.insertPoTetherWithCollection(tetherVo);
         return success("新增成功");
     }
 
@@ -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,12 @@ 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("修改成功");
     }
 

+ 4 - 4
ruoyi-system/src/main/java/com/ruoyi/system/domain/PoTether.java

@@ -41,13 +41,13 @@ public class PoTether extends BaseEntity
     private String image;
 
     /** 展示时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "展示时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "展示时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date showTimeStart;
 
     /** 展示时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "展示时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "展示时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date showTimeEnd;
 
     /** 数量 */

+ 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);
 }

+ 7 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/IPoTetherService.java

@@ -69,7 +69,7 @@ public interface IPoTetherService extends IService<PoTether>
      * @param tetherVo
      * @return
      */
-    void insertPoTetherWithCollection(TetherVo tetherVo,PoTetherandcollection poTetherandcollection);
+    void insertPoTetherWithCollection(TetherVo tetherVo);
 
     /**
      * 通过id查询套系信息和对应的藏品信息
@@ -139,5 +139,11 @@ public interface IPoTetherService extends IService<PoTether>
      */
     List<PoTether> selectPoTetherCollectionList(PoTether poTether);
 
+    /**
+     * 已经上架只允许修改展示结束时间
+     * @param tetherVo
+     */
+    void updateShowTimeEnd(TetherVo tetherVo);
+
 }
 

+ 6 - 10
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoCollectionServiceImpl.java

@@ -41,8 +41,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
      * @return
      */
     @Override
-    public List<PoCollection> selectPoCollectionList(PoCollection poCollection)
-    {
+    public List<PoCollection> selectPoCollectionList(PoCollection poCollection) {
         return poCollectionMapper.selectPoCollectionList(poCollection);
     }
 
@@ -68,7 +67,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
     @Override
     public int insertCollection(PoCollection collection) {
         List<PoCollection> poCollection = poCollectionMapper.selectPoCollectionList(collection);
-        if (poCollection != null)
+        if (poCollection != null && !poCollection.isEmpty())
             return -1;
         return poCollectionMapper.insertPoCollection(collection);
     }
@@ -83,9 +82,8 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
     public int batchInsertCollection(List<PoCollection> collection) {
         for (PoCollection collection1 : collection) {
             List<PoCollection> list = poCollectionMapper.selectPoCollectionList(collection1);
-            if (list == null || list.isEmpty())
-                continue;
-            return -1;
+            if (list != null && !list.isEmpty())
+                return -1;
         }
         return poCollectionMapper.batchInsertPoCollection(collection);
     }
@@ -108,8 +106,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
      * @return
      */
     @Override
-    public int deletePoCollectionByCollectionIds(Long[] collectionIds)
-    {
+    public int deletePoCollectionByCollectionIds(Long[] collectionIds) {
         return poCollectionMapper.deletePoCollectionByCollectionIds(collectionIds);
     }
 
@@ -120,8 +117,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
      * @return
      */
     @Override
-    public int deletePoCollectionByCollectionId(Long collectionId)
-    {
+    public int deletePoCollectionByCollectionId(Long collectionId) {
         return poCollectionMapper.deletePoCollectionByCollectionId(collectionId);
     }
 }

+ 12 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoTetherServiceImpl.java

@@ -155,7 +155,7 @@ public class PoTetherServiceImpl extends ServiceImpl<PoTetherMapper,PoTether> im
      */
     @Override
     @Transactional
-    public void insertPoTetherWithCollection(TetherVo tetherVo,PoTetherandcollection poTetherandcollection) {
+    public void insertPoTetherWithCollection(TetherVo tetherVo) {
         //保存套系的基本数据到套系表tether
         this.poTetherMapper.insertPoTether(tetherVo);
         //套系包含藏品
@@ -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);
+    }
+
 }
 

+ 23 - 10
ruoyi-system/src/main/resources/mapper/system/PoCollectionMapper.xml

@@ -22,7 +22,7 @@
         <result property="story" column="story"/>
         <result property="grounding" column="grouding"/>
         <result property="cochain" column="cochain"/>
-        <result property="tetherId" column="tetherId"/>
+        <result property="tetherId" column="tether_id"/>
     </resultMap>
 
     <sql id="selectPoCollectionVo">
@@ -36,6 +36,7 @@
                update_time,
                remark,
                del_flag,
+               image,
                publisher_name,
                formwork,
                price,
@@ -58,14 +59,13 @@
             <if test="status != null  and status != ''"> and status = #{status}</if>
             <if test="collectionType != null "> and collection_type = #{collectionType}</if>
             <if test="total != null "> and total = #{total}</if>
-            <if test="image != null  and image != ''"> and image = #{image}</if>
             <if test="formwork != null  and formwork != ''"> and formwork = #{formwork}</if>
             <if test="price != null "> and price = #{price}</if>
             <if test="publisherName != null "> and publisher_name like concat('%', #{publisherName}, '%')</if>
-            <if test="story != null  and story != ''"> and story = #{story}</if>
             <if test="grounding != null "> and grounding = #{grounding}</if>
             <if test="cochain != null "> and cochain = #{cochain}</if>
             <if test="tetherId != null "> and tether_id = #{tetherId}</if>
+            <if test="delFlag != null">and del_flag = #{delFlag}</if>
         </where>
     </select>
 
@@ -76,6 +76,8 @@
         <if test="status != null and status != '' ">status,</if>
         <if test="remark != null and remark != ''">remark,</if>
         <if test="createBy != null and createBy != ''">create_by,</if>
+        <if test="total != null and total != ''">total,</if>
+        <if test="image != null and image != ''">image,</if>
         <if test="publisherName != null and publisherName != ''">publisher_name,</if>
         <if test="formwork != null and formwork != ''">formwork,</if>
         <if test="price != null and price != ''">price,</if>
@@ -91,6 +93,8 @@
         <if test="status != null and status != ''">#{status},</if>
         <if test="remark != null and remark != ''">#{remark},</if>
         <if test="createBy != null and createBy != ''">#{createBy},</if>
+        <if test="total != null and total != ''">#{total},</if>
+        <if test="image != null and image != ''">#{image},</if>
         <if test="publisherName != null and publisherName != ''">#{publisherName},</if>
         <if test="formwork != null and formwork != ''">#{formwork},</if>
         <if test="price != null and price != ''">#{price},</if>
@@ -110,6 +114,8 @@
         <if test="status != null and status != '' ">status,</if>
         <if test="remark != null and remark != ''">remark,</if>
         <if test="createBy != null and createBy != ''">create_by,</if>
+        <if test="total != null and total != ''">total,</if>
+        <if test="image != null and image != ''">image,</if>
         <if test="publisherName != null and publisherName != ''">publisher_name,</if>
         <if test="formwork != null and formwork != ''">formwork,</if>
         <if test="price != null and price != ''">price,</if>
@@ -126,6 +132,8 @@
             <if test="status != null and status != ''">#{status},</if>
             <if test="remark != null and remark != ''">#{remark},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
+            <if test="total != null and total != ''">#{total},</if>
+            <if test="image != null and image != ''">#{image},</if>
             <if test="publisherName != null and publisherName != ''">#{publisherName},</if>
             <if test="formwork != null and formwork != ''">#{formwork},</if>
             <if test="price != null and price != ''">#{price},</if>
@@ -147,27 +155,32 @@
             <if test="status != null and status != ''">status = #{status},</if>
             <if test="remark != null and remark != ''">remark = #{remark},</if>
             <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
+            <if test="total != null and total != ''">total = #{total},</if>
+            <if test="image != null and image != ''">image = #{image},</if>
             <if test="publisherName != null and publisherName != ''">publisher_name = #{publisherName},</if>
             <if test="formwork != null and formwork != ''">formwork = #{formwork},</if>
             <if test="price != null and price != ''">price = #{price},</if>
             <if test="story != null and story != ''">story = #{story},</if>
             <if test="grouding != null and grouding != ''">grouding = #{grounding},</if>
             <if test="cochain != null and cochain != ''">cochain = #{cochain},</if>
-            <if test="tetherId != null and tetherId != ''">tetherId = #{tetherId},</if>
+            <if test="tetherId != null and tetherId != ''">tether_id = #{tetherId},</if>
+            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
             update_time = sysdate()
         </set>
         where collection_id = #{collectionId}
     </update>
 
-    <delete id="deletePoCollectionByCollectionId" parameterType="Long">
-        delete from po_collection where collection_id = #{collectionId}
-    </delete>
+    <update id="deletePoCollectionByCollectionId" parameterType="Long">
+        update po_collection
+        SET del_flag = #{1}
+        where collection_id = #{collectionId}
+    </update>
 
-    <delete id="deletePoCollectionByCollectionIds" parameterType="String">
-        delete from po_collection where collection_id in
+    <update id="deletePoCollectionByCollectionIds" parameterType="String">
+        update po_collection SET del_flag = #{1} where collection_id in
         <foreach item="collectionId" collection="array" open="(" separator="," close=")">
             #{collectionId}
         </foreach>
-    </delete>
+    </update>
 
 </mapper>

+ 3 - 3
ruoyi-system/src/main/resources/mapper/system/PoNewsMapper.xml

@@ -116,12 +116,12 @@
     </delete>
 
 <!--    批量删除-->
-    <delete id="deletePoNewsByNewsIds" parameterType="String">
-        delete from po_news where news_id in
+    <update id="deletePoNewsByNewsIds" parameterType="String">
+        update  po_news  set del_falg = '1' where news_id in
         <foreach item="newsId" collection="array" open="(" separator="," close=")">
             #{newsId}
         </foreach>
-    </delete>
+    </update>
 
 
     <!--    标题时间都不为空-->

+ 8 - 7
ruoyi-system/src/main/resources/mapper/system/PoNoticeMapper.xml

@@ -63,6 +63,7 @@
             <if test="noticeType != null and noticeType != ''">
                 AND notice_type like concat('%', #{noticeType}, '%')
             </if>
+            <if test="delFlag != null">and del_flag = #{delFlag}</if>
         </where>
     </select>
 
@@ -112,17 +113,17 @@
         where notice_id = #{noticeId}
     </update>
 
-    <delete id="deletePoNoticeById" parameterType="Long">
-        delete
-        from po_notice
+    <update id="deletePoNoticeById" parameterType="Long">
+        update po_notice
+        SET del_flag = #{1}
         where notice_id = #{noticeId}
-    </delete>
+    </update>
 
-    <delete id="deletePoNoticeByIds" parameterType="Long">
-        delete from po_notice where notice_id in
+    <update id="deletePoNoticeByIds" parameterType="Long">
+        update po_notice SET del_flag = #{1} where notice_id in
         <foreach item="noticeId" collection="array" open="(" separator="," close=")">
             #{noticeId}
         </foreach>
-    </delete>
+    </update>
 
 </mapper>

+ 13 - 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,16 @@
         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>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where tether_id = #{tetherId}
+    </update>
 </mapper>