Browse Source

评论删除

Administrator 1 year ago
parent
commit
f3e4924ede

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/notice/XiaoyuanInfoController.java

@@ -114,6 +114,15 @@ public class XiaoyuanInfoController extends BaseController
         return toAjax(xiaoyuanInfoService.insertInfoPingLun(infoPinglun));
     }
 
+    /**
+     * 删除校园安全信息评论
+     */
+    @PostMapping("/delete/pingLun")
+    public AjaxResult deletePingLun(@RequestBody InfoPinglun infoPinglun)
+    {
+        return toAjax(xiaoyuanInfoService.deletePingLun(infoPinglun));
+    }
+
     /**
      * 新增校园安全信息点赞接口/取消点赞
      */

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

@@ -45,6 +45,13 @@ public interface XiaoyuanInfoMapper
      */
     public int updateXiaoyuanInfo(XiaoyuanInfo xiaoyuanInfo);
 
+    /**
+     * 删除评论
+     * @param infoPinglun
+     * @return
+     */
+    public int deletePingLun(InfoPinglun infoPinglun);
+
     /**
      * 增加已读数量
      * @param xiaoyuanInfo

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/notice/XiaoyuanInfoServiceImpl.java

@@ -192,6 +192,16 @@ public class XiaoyuanInfoServiceImpl implements IXiaoyuanInfoService
         return xiaoyuanInfoMapper.batchInfoPingLun(infoPingLunList);
     }
 
+    /**
+     * 删除评论
+     * @param infoPinglun
+     * @return
+     */
+    @Override
+    public int deletePingLun(InfoPinglun infoPinglun) {
+        return xiaoyuanInfoMapper.deletePingLun(infoPinglun);
+    }
+
     /**
      * 修改校园安全信息
      * 

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/notice/IXiaoyuanInfoService.java

@@ -45,6 +45,13 @@ public interface IXiaoyuanInfoService
      */
     public int insertInfoPingLun(InfoPinglun infoPinglun);
 
+    /**
+     * 删除评论
+     * @param infoPinglun
+     * @return
+     */
+    public int deletePingLun(InfoPinglun infoPinglun);
+
     /**
      * 修改校园安全信息
      * 

+ 6 - 0
ruoyi-system/src/main/resources/mapper/notice/XiaoyuanInfoMapper.xml

@@ -184,6 +184,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from info_pinglun where info_id = #{infoId}
     </delete>
 
+    <delete id="deletePingLun" parameterType="InfoPingLun">
+           delete from info_pinglun where
+        <if test="infoPingLunType != null and infoPingLunType == 1">info_pinglun_parent = #{infoPingLunId} or info_pinglun_id = #{infoPingLunId}</if>
+        <if test="infoPingLunType != null and infoPingLunType == 2">info_pinglun_id = #{infoPingLunId}</if>
+    </delete>
+
     <insert id="batchInfoPingLun">
         insert into info_pinglun( info_pinglun_id, info_id, info_pinglun_parent, info_pinglun_content, avatar, info_pinglun_user_id, info_pinglun_user_name, info_pinglun_quilt_user_id, info_pinglun_quilt_user_name, pinglun_time, info_pinglun_type, info_pinglun_examine, create_by, create_time, update_by, update_time, remark) values
 		<foreach item="item" index="index" collection="list" separator=",">