diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcCyMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcCyMapper.java index 37799760..a8cceafe 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcCyMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcCyMapper.java @@ -65,4 +65,10 @@ public interface TcCyMapper * */ public void updateByisStatus(@Param("isStatus") Integer isStatus, @Param("ids") List ids); + + /** + * 删除词云表所有数据 + */ + void deleteAllData(); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java index 929277c3..a5604897 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.tcZz.service.ITcCyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; /** @@ -88,28 +89,22 @@ public class TcCyServiceImpl implements ITcCyService { return tcCyMapper.deleteTcCyById(id); } + /** + * 导入词云数据 + * + * @param tcCyList + * @return + */ @Override public String importUser(List tcCyList) { + tcCyMapper.deleteAllData(); StringBuilder successMsg = new StringBuilder(); if (!tcCyList.isEmpty()) { for (TcCy tcCy : tcCyList) { - //根据area_id + cy_name判断如果已存在,则调修改 - TcCy newtcCy = new TcCy(); - newtcCy.setAreaId(tcCy.getAreaId()); - newtcCy.setCyName(tcCy.getCyName()); - List list = tcCyMapper.selectTcCyList(newtcCy); - if (!list.isEmpty()) { - for (TcCy a : list) { - tcCy.setId(a.getId()); - tcCyMapper.updateTcCy(tcCy); - } - } else { - tcCyMapper.insertTcCy(tcCy); - } + this.insertTcCy(tcCy); } successMsg.append("导入成功"); } - return successMsg.toString(); } diff --git a/ruoyi-admin/src/main/resources/mapper/tcZz/netWorkYq/TcCyMapper.xml b/ruoyi-admin/src/main/resources/mapper/tcZz/netWorkYq/TcCyMapper.xml index ad685ae7..a99e6ab5 100644 --- a/ruoyi-admin/src/main/resources/mapper/tcZz/netWorkYq/TcCyMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/tcZz/netWorkYq/TcCyMapper.xml @@ -92,4 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + truncate table tc_cy; + \ No newline at end of file