修改词云导入

main
杜函宇 10 months ago
parent 3b7b9066e1
commit c5cf2f3171

@ -65,4 +65,10 @@ public interface TcCyMapper
*
*/
public void updateByisStatus(@Param("isStatus") Integer isStatus, @Param("ids") List<String> ids);
/**
*
*/
void deleteAllData();
}

@ -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<TcCy> 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<TcCy> 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();
}

@ -92,4 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteAllData" parameterType="Long">
truncate table tc_cy;
</delete>
</mapper>
Loading…
Cancel
Save