Ver Fonte

添加评论接口

elis há 2 anos atrás
pai
commit
71586695d9

+ 84 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/program/dao/HlwCommentsDao.java

@@ -0,0 +1,84 @@
+package com.example.nngkxxdp.program.dao;
+
+
+import com.example.nngkxxdp.program.entity.jsonobj.HlwComments;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+import java.util.List;
+
+/**
+ * (HlwComments)表数据库访问层
+ *
+ * @author makejava
+ * @since 2022-11-10 09:45:12
+ */
+public interface HlwCommentsDao {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param replyid 主键
+     * @return 实例对象
+     */
+    HlwComments queryById(Integer replyid);
+
+    /**
+     * 查询指定行数据
+     *
+     * @param hlwComments 查询条件
+     * @param pageable         分页对象
+     * @return 对象列表
+     */
+    List<HlwComments> queryAllByLimit(HlwComments hlwComments, @Param("pageable") Pageable pageable);
+
+    /**
+     * 统计总行数
+     *
+     * @param hlwComments 查询条件
+     * @return 总行数
+     */
+    long count(HlwComments hlwComments);
+
+    /**
+     * 新增数据
+     *
+     * @param hlwComments 实例对象
+     * @return 影响行数
+     */
+    int insert(HlwComments hlwComments);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<HlwComments> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<HlwComments> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<HlwComments> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<HlwComments> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param hlwComments 实例对象
+     * @return 影响行数
+     */
+    int update(HlwComments hlwComments);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param replyid 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer replyid);
+
+}
+

+ 17 - 17
nngkxxdp/src/main/java/com/example/nngkxxdp/program/dao/HlwCollectionDao.java → nngkxxdp/src/main/java/com/example/nngkxxdp/program/dao/HlwFavoritesDao.java

@@ -1,17 +1,17 @@
 package com.example.nngkxxdp.program.dao;
 
-import com.example.nngkxxdp.program.entity.HlwCollection;
+import com.example.nngkxxdp.program.entity.HlwFavorites;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.data.domain.Pageable;
 import java.util.List;
 
 /**
- * (HlwCollection)表数据库访问层
+ * (HlwFavorites)表数据库访问层
  *
  * @author makejava
- * @since 2022-11-09 14:32:17
+ * @since 2022-11-09 17:35:01
  */
-public interface HlwCollectionDao {
+public interface HlwFavoritesDao {
 
     /**
      * 通过ID查询单条数据
@@ -19,57 +19,57 @@ public interface HlwCollectionDao {
      * @param id 主键
      * @return 实例对象
      */
-    HlwCollection queryById(Integer id);
+    HlwFavorites queryById(Integer id);
 
     /**
      * 查询指定行数据
      *
-     * @param hlwCollection 查询条件
+     * @param hlwFavorites 查询条件
      * @param pageable         分页对象
      * @return 对象列表
      */
-    List<HlwCollection> queryAllByLimit(HlwCollection hlwCollection, @Param("pageable") Pageable pageable);
+    List<HlwFavorites> queryAllByLimit(HlwFavorites hlwFavorites, @Param("pageable") Pageable pageable);
 
     /**
      * 统计总行数
      *
-     * @param hlwCollection 查询条件
+     * @param hlwFavorites 查询条件
      * @return 总行数
      */
-    long count(HlwCollection hlwCollection);
+    long count(HlwFavorites hlwFavorites);
 
     /**
      * 新增数据
      *
-     * @param hlwCollection 实例对象
+     * @param hlwFavorites 实例对象
      * @return 影响行数
      */
-    int insert(HlwCollection hlwCollection);
+    int insert(HlwFavorites hlwFavorites);
 
     /**
      * 批量新增数据(MyBatis原生foreach方法)
      *
-     * @param entities List<HlwCollection> 实例对象列表
+     * @param entities List<HlwFavorites> 实例对象列表
      * @return 影响行数
      */
-    int insertBatch(@Param("entities") List<HlwCollection> entities);
+    int insertBatch(@Param("entities") List<HlwFavorites> entities);
 
     /**
      * 批量新增或按主键更新数据(MyBatis原生foreach方法)
      *
-     * @param entities List<HlwCollection> 实例对象列表
+     * @param entities List<HlwFavorites> 实例对象列表
      * @return 影响行数
      * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
      */
-    int insertOrUpdateBatch(@Param("entities") List<HlwCollection> entities);
+    int insertOrUpdateBatch(@Param("entities") List<HlwFavorites> entities);
 
     /**
      * 修改数据
      *
-     * @param hlwCollection 实例对象
+     * @param hlwFavorites 实例对象
      * @return 影响行数
      */
-    int update(HlwCollection hlwCollection);
+    int update(HlwFavorites hlwFavorites);
 
     /**
      * 通过主键删除数据

+ 2 - 2
nngkxxdp/src/main/java/com/example/nngkxxdp/program/entity/HlwCollection.java → nngkxxdp/src/main/java/com/example/nngkxxdp/program/entity/HlwFavorites.java

@@ -5,13 +5,13 @@ import lombok.Data;
 import java.io.Serializable;
 
 /**
- * (HlwCollection)实体类
+ * (HlwFavorites)实体类
  *
  * @author makejava
  * @since 2022-11-09 14:32:17
  */
 @Data
-public class HlwCollection implements Serializable {
+public class HlwFavorites implements Serializable {
     private static final long serialVersionUID = 422202153114771680L;
     
     private Integer id;

+ 56 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/program/entity/jsonobj/HlwComments.java

@@ -0,0 +1,56 @@
+package com.example.nngkxxdp.program.entity.jsonobj;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@Data
+public class HlwComments {
+
+    @JsonProperty("replyId")
+    private Integer replyId;
+    @JsonProperty("userId")
+    private Integer userId;
+    @JsonProperty("userName")
+    private String userName;
+    @JsonProperty("headerImg")
+    private String headerImg;
+    @JsonProperty("passiveReplyUserId")
+    private Object passiveReplyUserId;
+    @JsonProperty("passiveReplyName")
+    private Object passiveReplyName;
+    @JsonProperty("passiveReplyContent")
+    private String passiveReplyContent;
+    @JsonProperty("passiveRelpsyStatus")
+    private Integer passiveRelpsyStatus;
+    @JsonProperty("content")
+    private String content;
+    @JsonProperty("commentTime")
+    private String commentTime;
+    @JsonProperty("praiseCount")
+    private Integer praiseCount;
+    @JsonProperty("replyCount")
+    private Integer replyCount;
+    @JsonProperty("sourceId")
+    private Integer sourceId;
+    @JsonProperty("sourceTitle")
+    private String sourceTitle;
+    @JsonProperty("sourceType")
+    private Integer sourceType;
+    @JsonProperty("imageUrl")
+    private String imageUrl;
+    @JsonProperty("passiveReplyImageUrl")
+    private Object passiveReplyImageUrl;
+    @JsonProperty("circleLavelName")
+    private Object circleLavelName;
+    @JsonProperty("ipLocal")
+    private String ipLocal;
+    @JsonProperty("listSuffix")
+    private String listSuffix;
+    @JsonProperty("detailSuffix")
+    private String detailSuffix;
+    @JsonProperty("dimension")
+    private Integer dimension;
+
+}

+ 17 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/program/entity/jsonobj/HlwCommentsDTO.java

@@ -0,0 +1,17 @@
+package com.example.nngkxxdp.program.entity.jsonobj;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class HlwCommentsDTO {
+
+    @JsonProperty("dataList")
+    private List<HlwComments> dataList;
+
+
+}

+ 1 - 1
nngkxxdp/src/main/java/com/example/nngkxxdp/program/entity/jsonobj/HlwCollectionDTO.java → nngkxxdp/src/main/java/com/example/nngkxxdp/program/entity/jsonobj/HlwFavoritesDTO.java

@@ -9,7 +9,7 @@ import java.util.List;
 
 @NoArgsConstructor
 @Data
-public class HlwCollectionDTO {
+public class HlwFavoritesDTO {
 
     @JsonProperty("dataList")
     private List<DataListDTO> dataList;

+ 26 - 15
nngkxxdp/src/main/java/com/example/nngkxxdp/program/service/Impl/HLWIntefaceImpl.java

@@ -9,16 +9,17 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.example.nngkxxdp.program.constant.MiniConstant;
 import com.example.nngkxxdp.program.dao.AppletUserDao;
-import com.example.nngkxxdp.program.dao.HlwCollectionDao;
+import com.example.nngkxxdp.program.dao.HlwCommentsDao;
+import com.example.nngkxxdp.program.dao.HlwFavoritesDao;
 import com.example.nngkxxdp.program.dao.HlwNewsPaperDao;
-import com.example.nngkxxdp.program.entity.HlwCollection;
+import com.example.nngkxxdp.program.entity.HlwFavorites;
 import com.example.nngkxxdp.program.entity.jsonobj.HlNewsDTO;
 import com.example.nngkxxdp.program.entity.jsonobj.HlNewsPaperDTO;
-import com.example.nngkxxdp.program.entity.jsonobj.HlwCollectionDTO;
+import com.example.nngkxxdp.program.entity.jsonobj.HlwCommentsDTO;
+import com.example.nngkxxdp.program.entity.jsonobj.HlwFavoritesDTO;
 import com.example.nngkxxdp.program.service.HLWIntefaceService;
 import com.example.nngkxxdp.util.SendUtil;
 import lombok.RequiredArgsConstructor;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -33,7 +34,8 @@ import java.util.Map;
 public class HLWIntefaceImpl implements HLWIntefaceService {
     private final HlwNewsPaperDao hlwNewsPaperDao;
     private final AppletUserDao appletUserDao;
-    private final HlwCollectionDao hlwCollectionDao;
+    private final HlwFavoritesDao hlwFavoritesDao;
+    private final HlwCommentsDao hlwCommentsDao;
 
     @Value("${hlw}")
     private String address;
@@ -42,21 +44,20 @@ public class HLWIntefaceImpl implements HLWIntefaceService {
     public Map<String, Object> favorites(String userId) {
         String userToken = getUserToken(userId);
         // 拼装请求信息
-        Map<String, Object> requiredParameter = new HashMap<>();
+        Map<String, Object> requiredParameter = new HashMap<>(5);
         requiredParameter.put("appId", 4);
         requiredParameter.put("token", userToken);
-        HlwCollectionDTO data = getJsonObject(MiniConstant.HL_COLLECT, requiredParameter, HlwCollectionDTO.class);
+        HlwFavoritesDTO data = getJsonObject(MiniConstant.HL_COLLECT, requiredParameter, HlwFavoritesDTO.class);
         if (ObjectUtil.isEmpty(data)&&ObjectUtil.isEmpty(data.getDataList())&&data.getDataList().size()==0){
             return SendUtil.send(false, "", MiniConstant.RESULT_FAILED);
         }
-        List<HlwCollectionDTO.DataListDTO> dataList = data.getDataList();
-        List<HlwCollection> objects = new ArrayList<>();
-        for (HlwCollectionDTO.DataListDTO dataListDTO : dataList) {
-            HlwCollection hlwCollection = BeanUtil.copyProperties(dataListDTO, HlwCollection.class);
-            objects.add(hlwCollection);
+        List<HlwFavoritesDTO.DataListDTO> dataList = data.getDataList();
+        List<HlwFavorites> objects = new ArrayList<>();
+        for (HlwFavoritesDTO.DataListDTO dataListDTO : dataList) {
+            HlwFavorites hlwFavorites = BeanUtil.copyProperties(dataListDTO, HlwFavorites.class);
+            objects.add(hlwFavorites);
         }
-        hlwCollectionDao.insertOrUpdateBatch(objects);
-
+        hlwFavoritesDao.insertOrUpdateBatch(objects);
         return SendUtil.send(true,"",objects);
     }
 
@@ -64,7 +65,17 @@ public class HLWIntefaceImpl implements HLWIntefaceService {
 
     @Override
     public Map<String, Object> comments(String userId, Integer type) {
-        return null;
+        String userToken = getUserToken(userId);
+        Map<String, Object> requiredParameter = new HashMap<>(5);
+        requiredParameter.put("appId", 4);
+        requiredParameter.put("token", userToken);
+        requiredParameter.put("type", type);
+        HlwCommentsDTO data = getJsonObject(MiniConstant.HL_REMARK, requiredParameter, HlwCommentsDTO.class);
+        if (ObjectUtil.isEmpty(data)&&ObjectUtil.isEmpty(data.getDataList())&&data.getDataList().size()==0){
+            return SendUtil.send(false, "", MiniConstant.RESULT_FAILED);
+        }
+        hlwCommentsDao.insertOrUpdateBatch(data.getDataList());
+        return SendUtil.send(true,"",data.getDataList());
     }
 
     @Override

+ 309 - 0
nngkxxdp/src/main/resources/mapper/HlwCommentsDao.xml

@@ -0,0 +1,309 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.example.nngkxxdp.program.dao.HlwCommentsDao">
+
+    <resultMap type="com.example.nngkxxdp.program.entity.jsonobj.HlwComments" id="HlwCommentsMap">
+        <result property="replyId" column="replyId" jdbcType="INTEGER"/>
+        <result property="userId" column="userId" jdbcType="INTEGER"/>
+        <result property="userName" column="userName" jdbcType="VARCHAR"/>
+        <result property="headerImg" column="headerImg" jdbcType="VARCHAR"/>
+        <result property="passiveReplyUserId" column="passiveReplyUserId" jdbcType="INTEGER"/>
+        <result property="passiveReplyName" column="passiveReplyName" jdbcType="VARCHAR"/>
+        <result property="passiveReplyContent" column="passiveReplyContent" jdbcType="VARCHAR"/>
+        <result property="passiveRelpsyStatus" column="passiveRelpsyStatus" jdbcType="VARCHAR"/>
+        <result property="content" column="content" jdbcType="VARCHAR"/>
+        <result property="commentTime" column="commentTime" jdbcType="VARCHAR"/>
+        <result property="praiseCount" column="praiseCount" jdbcType="INTEGER"/>
+        <result property="replyCount" column="replyCount" jdbcType="INTEGER"/>
+        <result property="sourceId" column="sourceId" jdbcType="INTEGER"/>
+        <result property="sourceTitle" column="sourceTitle" jdbcType="VARCHAR"/>
+        <result property="sourceType" column="sourceType" jdbcType="INTEGER"/>
+        <result property="imageUrl" column="imageUrl" jdbcType="VARCHAR"/>
+        <result property="passiveReplyImageUrl" column="passiveReplyImageUrl" jdbcType="VARCHAR"/>
+        <result property="circleLavelName" column="circleLavelName" jdbcType="VARCHAR"/>
+        <result property="ipLocal" column="ipLocal" jdbcType="VARCHAR"/>
+        <result property="listSuffix" column="listSuffix" jdbcType="VARCHAR"/>
+        <result property="detailSuffix" column="detailSuffix" jdbcType="VARCHAR"/>
+        <result property="dimension" column="dimension" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="HlwCommentsMap">
+        select
+          replyId, userId, userName, headerImg, passiveReplyUserId, passiveReplyName, passiveReplyContent, passiveRelpsyStatus, content, commentTime, praiseCount, replyCount, sourceId, sourceTitle, sourceType, imageUrl, passiveReplyImageUrl, circleLavelName, ipLocal, listSuffix, detailSuffix, dimension
+        from hlw_comments
+        where replyId = #{replyid}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="HlwCommentsMap">
+        select
+          replyId, userId, userName, headerImg, passiveReplyUserId, passiveReplyName, passiveReplyContent, passiveRelpsyStatus, content, commentTime, praiseCount, replyCount, sourceId, sourceTitle, sourceType, imageUrl, passiveReplyImageUrl, circleLavelName, ipLocal, listSuffix, detailSuffix, dimension
+        from hlw_comments
+        <where>
+            <if test="replyid != null">
+                and replyId = #{replyid}
+            </if>
+            <if test="userid != null">
+                and userId = #{userid}
+            </if>
+            <if test="username != null and username != ''">
+                and userName = #{username}
+            </if>
+            <if test="headerimg != null and headerimg != ''">
+                and headerImg = #{headerimg}
+            </if>
+            <if test="passivereplyuserid != null">
+                and passiveReplyUserId = #{passivereplyuserid}
+            </if>
+            <if test="passivereplyname != null and passivereplyname != ''">
+                and passiveReplyName = #{passivereplyname}
+            </if>
+            <if test="passivereplycontent != null and passivereplycontent != ''">
+                and passiveReplyContent = #{passivereplycontent}
+            </if>
+            <if test="passiverelpsystatus != null and passiverelpsystatus != ''">
+                and passiveRelpsyStatus = #{passiverelpsystatus}
+            </if>
+            <if test="content != null and content != ''">
+                and content = #{content}
+            </if>
+            <if test="commenttime != null and commenttime != ''">
+                and commentTime = #{commenttime}
+            </if>
+            <if test="praisecount != null">
+                and praiseCount = #{praisecount}
+            </if>
+            <if test="replycount != null">
+                and replyCount = #{replycount}
+            </if>
+            <if test="sourceid != null">
+                and sourceId = #{sourceid}
+            </if>
+            <if test="sourcetitle != null and sourcetitle != ''">
+                and sourceTitle = #{sourcetitle}
+            </if>
+            <if test="sourcetype != null">
+                and sourceType = #{sourcetype}
+            </if>
+            <if test="imageurl != null and imageurl != ''">
+                and imageUrl = #{imageurl}
+            </if>
+            <if test="passivereplyimageurl != null and passivereplyimageurl != ''">
+                and passiveReplyImageUrl = #{passivereplyimageurl}
+            </if>
+            <if test="circlelavelname != null and circlelavelname != ''">
+                and circleLavelName = #{circlelavelname}
+            </if>
+            <if test="iplocal != null and iplocal != ''">
+                and ipLocal = #{iplocal}
+            </if>
+            <if test="listsuffix != null and listsuffix != ''">
+                and listSuffix = #{listsuffix}
+            </if>
+            <if test="detailsuffix != null and detailsuffix != ''">
+                and detailSuffix = #{detailsuffix}
+            </if>
+            <if test="dimension != null">
+                and dimension = #{dimension}
+            </if>
+        </where>
+        limit #{pageable.offset}, #{pageable.pageSize}
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from hlw_comments
+        <where>
+            <if test="replyid != null">
+                and replyId = #{replyid}
+            </if>
+            <if test="userid != null">
+                and userId = #{userid}
+            </if>
+            <if test="username != null and username != ''">
+                and userName = #{username}
+            </if>
+            <if test="headerimg != null and headerimg != ''">
+                and headerImg = #{headerimg}
+            </if>
+            <if test="passivereplyuserid != null">
+                and passiveReplyUserId = #{passivereplyuserid}
+            </if>
+            <if test="passivereplyname != null and passivereplyname != ''">
+                and passiveReplyName = #{passivereplyname}
+            </if>
+            <if test="passivereplycontent != null and passivereplycontent != ''">
+                and passiveReplyContent = #{passivereplycontent}
+            </if>
+            <if test="passiverelpsystatus != null and passiverelpsystatus != ''">
+                and passiveRelpsyStatus = #{passiverelpsystatus}
+            </if>
+            <if test="content != null and content != ''">
+                and content = #{content}
+            </if>
+            <if test="commenttime != null and commenttime != ''">
+                and commentTime = #{commenttime}
+            </if>
+            <if test="praisecount != null">
+                and praiseCount = #{praisecount}
+            </if>
+            <if test="replycount != null">
+                and replyCount = #{replycount}
+            </if>
+            <if test="sourceid != null">
+                and sourceId = #{sourceid}
+            </if>
+            <if test="sourcetitle != null and sourcetitle != ''">
+                and sourceTitle = #{sourcetitle}
+            </if>
+            <if test="sourcetype != null">
+                and sourceType = #{sourcetype}
+            </if>
+            <if test="imageurl != null and imageurl != ''">
+                and imageUrl = #{imageurl}
+            </if>
+            <if test="passivereplyimageurl != null and passivereplyimageurl != ''">
+                and passiveReplyImageUrl = #{passivereplyimageurl}
+            </if>
+            <if test="circlelavelname != null and circlelavelname != ''">
+                and circleLavelName = #{circlelavelname}
+            </if>
+            <if test="iplocal != null and iplocal != ''">
+                and ipLocal = #{iplocal}
+            </if>
+            <if test="listsuffix != null and listsuffix != ''">
+                and listSuffix = #{listsuffix}
+            </if>
+            <if test="detailsuffix != null and detailsuffix != ''">
+                and detailSuffix = #{detailsuffix}
+            </if>
+            <if test="dimension != null">
+                and dimension = #{dimension}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="replyid" useGeneratedKeys="true">
+        insert into hlw_comments(userId, userName, headerImg, passiveReplyUserId, passiveReplyName, passiveReplyContent, passiveRelpsyStatus, content, commentTime, praiseCount, replyCount, sourceId, sourceTitle, sourceType, imageUrl, passiveReplyImageUrl, circleLavelName, ipLocal, listSuffix, detailSuffix, dimension)
+        values (#{userid}, #{username}, #{headerimg}, #{passivereplyuserid}, #{passivereplyname}, #{passivereplycontent}, #{passiverelpsystatus}, #{content}, #{commenttime}, #{praisecount}, #{replycount}, #{sourceid}, #{sourcetitle}, #{sourcetype}, #{imageurl}, #{passivereplyimageurl}, #{circlelavelname}, #{iplocal}, #{listsuffix}, #{detailsuffix}, #{dimension})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="replyid" useGeneratedKeys="true">
+        insert into hlw_comments(userId, userName, headerImg, passiveReplyUserId, passiveReplyName, passiveReplyContent, passiveRelpsyStatus, content, commentTime, praiseCount, replyCount, sourceId, sourceTitle, sourceType, imageUrl, passiveReplyImageUrl, circleLavelName, ipLocal, listSuffix, detailSuffix, dimension)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.userid}, #{entity.username}, #{entity.headerimg}, #{entity.passivereplyuserid}, #{entity.passivereplyname}, #{entity.passivereplycontent}, #{entity.passiverelpsystatus}, #{entity.content}, #{entity.commenttime}, #{entity.praisecount}, #{entity.replycount}, #{entity.sourceid}, #{entity.sourcetitle}, #{entity.sourcetype}, #{entity.imageurl}, #{entity.passivereplyimageurl}, #{entity.circlelavelname}, #{entity.iplocal}, #{entity.listsuffix}, #{entity.detailsuffix}, #{entity.dimension})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="replyid" useGeneratedKeys="true">
+        insert into hlw_comments(userId, userName, headerImg, passiveReplyUserId, passiveReplyName, passiveReplyContent, passiveRelpsyStatus, content, commentTime, praiseCount, replyCount, sourceId, sourceTitle, sourceType, imageUrl, passiveReplyImageUrl, circleLavelName, ipLocal, listSuffix, detailSuffix, dimension)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.userid}, #{entity.username}, #{entity.headerimg}, #{entity.passivereplyuserid}, #{entity.passivereplyname}, #{entity.passivereplycontent}, #{entity.passiverelpsystatus}, #{entity.content}, #{entity.commenttime}, #{entity.praisecount}, #{entity.replycount}, #{entity.sourceid}, #{entity.sourcetitle}, #{entity.sourcetype}, #{entity.imageurl}, #{entity.passivereplyimageurl}, #{entity.circlelavelname}, #{entity.iplocal}, #{entity.listsuffix}, #{entity.detailsuffix}, #{entity.dimension})
+        </foreach>
+        on duplicate key update
+        userId = values(userId),
+        userName = values(userName),
+        headerImg = values(headerImg),
+        passiveReplyUserId = values(passiveReplyUserId),
+        passiveReplyName = values(passiveReplyName),
+        passiveReplyContent = values(passiveReplyContent),
+        passiveRelpsyStatus = values(passiveRelpsyStatus),
+        content = values(content),
+        commentTime = values(commentTime),
+        praiseCount = values(praiseCount),
+        replyCount = values(replyCount),
+        sourceId = values(sourceId),
+        sourceTitle = values(sourceTitle),
+        sourceType = values(sourceType),
+        imageUrl = values(imageUrl),
+        passiveReplyImageUrl = values(passiveReplyImageUrl),
+        circleLavelName = values(circleLavelName),
+        ipLocal = values(ipLocal),
+        listSuffix = values(listSuffix),
+        detailSuffix = values(detailSuffix),
+        dimension = values(dimension)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update hlw_comments
+        <set>
+            <if test="userid != null">
+                userId = #{userid},
+            </if>
+            <if test="username != null and username != ''">
+                userName = #{username},
+            </if>
+            <if test="headerimg != null and headerimg != ''">
+                headerImg = #{headerimg},
+            </if>
+            <if test="passivereplyuserid != null">
+                passiveReplyUserId = #{passivereplyuserid},
+            </if>
+            <if test="passivereplyname != null and passivereplyname != ''">
+                passiveReplyName = #{passivereplyname},
+            </if>
+            <if test="passivereplycontent != null and passivereplycontent != ''">
+                passiveReplyContent = #{passivereplycontent},
+            </if>
+            <if test="passiverelpsystatus != null and passiverelpsystatus != ''">
+                passiveRelpsyStatus = #{passiverelpsystatus},
+            </if>
+            <if test="content != null and content != ''">
+                content = #{content},
+            </if>
+            <if test="commenttime != null and commenttime != ''">
+                commentTime = #{commenttime},
+            </if>
+            <if test="praisecount != null">
+                praiseCount = #{praisecount},
+            </if>
+            <if test="replycount != null">
+                replyCount = #{replycount},
+            </if>
+            <if test="sourceid != null">
+                sourceId = #{sourceid},
+            </if>
+            <if test="sourcetitle != null and sourcetitle != ''">
+                sourceTitle = #{sourcetitle},
+            </if>
+            <if test="sourcetype != null">
+                sourceType = #{sourcetype},
+            </if>
+            <if test="imageurl != null and imageurl != ''">
+                imageUrl = #{imageurl},
+            </if>
+            <if test="passivereplyimageurl != null and passivereplyimageurl != ''">
+                passiveReplyImageUrl = #{passivereplyimageurl},
+            </if>
+            <if test="circlelavelname != null and circlelavelname != ''">
+                circleLavelName = #{circlelavelname},
+            </if>
+            <if test="iplocal != null and iplocal != ''">
+                ipLocal = #{iplocal},
+            </if>
+            <if test="listsuffix != null and listsuffix != ''">
+                listSuffix = #{listsuffix},
+            </if>
+            <if test="detailsuffix != null and detailsuffix != ''">
+                detailSuffix = #{detailsuffix},
+            </if>
+            <if test="dimension != null">
+                dimension = #{dimension},
+            </if>
+        </set>
+        where replyId = #{replyid}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from hlw_comments where replyId = #{replyid}
+    </delete>
+
+</mapper>
+

+ 12 - 12
nngkxxdp/src/main/resources/mapper/HlwCollectionDao.xml → nngkxxdp/src/main/resources/mapper/HlwFavoritesDao.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.example.nngkxxdp.program.dao.HlwCollectionDao">
+<mapper namespace="com.example.nngkxxdp.program.dao.HlwFavoritesDao">
 
-    <resultMap type="com.example.nngkxxdp.program.entity.HlwCollection" id="HlwCollectionMap">
+    <resultMap type="com.example.nngkxxdp.program.entity.HlwFavorites" id="HlwFavoritesMap">
         <result property="id" column="id" jdbcType="INTEGER"/>
         <result property="favoriteid" column="favoriteId" jdbcType="INTEGER"/>
         <result property="informationid" column="informationId" jdbcType="INTEGER"/>
@@ -41,18 +41,18 @@
     </resultMap>
 
     <!--查询单个-->
-    <select id="queryById" resultMap="HlwCollectionMap">
+    <select id="queryById" resultMap="HlwFavoritesMap">
         select
           id, favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl
-        from hlw_collection
+        from hlw_favorites
         where id = #{id}
     </select>
 
     <!--查询指定行数据-->
-    <select id="queryAllByLimit" resultMap="HlwCollectionMap">
+    <select id="queryAllByLimit" resultMap="HlwFavoritesMap">
         select
           id, favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl
-        from hlw_collection
+        from hlw_favorites
         <where>
             <if test="id != null">
                 and id = #{id}
@@ -166,7 +166,7 @@
     <!--统计总行数-->
     <select id="count" resultType="java.lang.Long">
         select count(1)
-        from hlw_collection
+        from hlw_favorites
         <where>
             <if test="id != null">
                 and id = #{id}
@@ -278,12 +278,12 @@
 
     <!--新增所有列-->
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
-        insert into hlw_collection(favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl)
+        insert into hlw_favorites(favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl)
         values (#{favoriteid}, #{informationid}, #{sortno}, #{listviewtype}, #{title}, #{detailtitle}, #{contenturl}, #{infosource}, #{onlinedate}, #{onlinetime}, #{replycount}, #{viewcount}, #{type}, #{contexttype}, #{infolabel}, #{images}, #{commenttype}, #{url}, #{shareurl}, #{sharetitle}, #{shareimgurl}, #{detailviewtype}, #{sourcetype}, #{multipleimgcount}, #{synopsis}, #{livebegintime}, #{livestatus}, #{livetype}, #{showviewcount}, #{videoformat}, #{outerlinkopentype}, #{appuserid}, #{name}, #{imgurl})
     </insert>
 
     <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into hlw_collection(favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl)
+        insert into hlw_favorites(favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl)
         values
         <foreach collection="entities" item="entity" separator=",">
         (#{entity.favoriteid}, #{entity.informationid}, #{entity.sortno}, #{entity.listviewtype}, #{entity.title}, #{entity.detailtitle}, #{entity.contenturl}, #{entity.infosource}, #{entity.onlinedate}, #{entity.onlinetime}, #{entity.replycount}, #{entity.viewcount}, #{entity.type}, #{entity.contexttype}, #{entity.infolabel}, #{entity.images}, #{entity.commenttype}, #{entity.url}, #{entity.shareurl}, #{entity.sharetitle}, #{entity.shareimgurl}, #{entity.detailviewtype}, #{entity.sourcetype}, #{entity.multipleimgcount}, #{entity.synopsis}, #{entity.livebegintime}, #{entity.livestatus}, #{entity.livetype}, #{entity.showviewcount}, #{entity.videoformat}, #{entity.outerlinkopentype}, #{entity.appuserid}, #{entity.name}, #{entity.imgurl})
@@ -291,7 +291,7 @@
     </insert>
 
     <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into hlw_collection(favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl)
+        insert into hlw_favorites(favoriteId, informationId, sortNo, listViewType, title, detailTitle, contentUrl, infoSource, onlineDate, onlineTime, replyCount, viewCount, type, contextType, infoLabel, images, commentType, url, shareUrl, shareTitle, shareImgUrl, detailViewType, sourceType, multipleImgCount, synopsis, liveBeginTime, liveStatus, liveType, showViewCount, videoFormat, outerLinkOpenType, appUserId, name, imgUrl)
         values
         <foreach collection="entities" item="entity" separator=",">
             (#{entity.favoriteid}, #{entity.informationid}, #{entity.sortno}, #{entity.listviewtype}, #{entity.title}, #{entity.detailtitle}, #{entity.contenturl}, #{entity.infosource}, #{entity.onlinedate}, #{entity.onlinetime}, #{entity.replycount}, #{entity.viewcount}, #{entity.type}, #{entity.contexttype}, #{entity.infolabel}, #{entity.images}, #{entity.commenttype}, #{entity.url}, #{entity.shareurl}, #{entity.sharetitle}, #{entity.shareimgurl}, #{entity.detailviewtype}, #{entity.sourcetype}, #{entity.multipleimgcount}, #{entity.synopsis}, #{entity.livebegintime}, #{entity.livestatus}, #{entity.livetype}, #{entity.showviewcount}, #{entity.videoformat}, #{entity.outerlinkopentype}, #{entity.appuserid}, #{entity.name}, #{entity.imgurl})
@@ -335,7 +335,7 @@
 
     <!--通过主键修改数据-->
     <update id="update">
-        update hlw_collection
+        update hlw_favorites
         <set>
             <if test="favoriteid != null">
                 favoriteId = #{favoriteid},
@@ -445,7 +445,7 @@
 
     <!--通过主键删除-->
     <delete id="deleteById">
-        delete from hlw_collection where id = #{id}
+        delete from hlw_favorites where id = #{id}
     </delete>
 
 </mapper>