From 120136539788c9bc347d35c80de2cb93f35469ed Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 06 十月 2023 13:30:31 +0800
Subject: [PATCH] 1

---
 src/main/resources/application.properties                    |    2 
 src/main/java/com/smartearth/poiexcel/mapper/QiYeMapper.java |   48 ++++++++++++++++++++++++
 src/main/resources/mapper/QiYeMapper.xml                     |   29 ++++++++++++++
 src/main/java/com/smartearth/poiexcel/config/InitConfig.java |   20 +++++++--
 src/main/java/com/smartearth/poiexcel/entity/EntEntity.java  |   14 +++---
 5 files changed, 100 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/smartearth/poiexcel/config/InitConfig.java b/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
index ceea9e7..3fbbfd8 100644
--- a/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
+++ b/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
@@ -3,11 +3,9 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.smartearth.poiexcel.entity.EntEntity;
-import com.smartearth.poiexcel.entity.EntResult;
-import com.smartearth.poiexcel.entity.Result;
-import com.smartearth.poiexcel.entity.TokenResult;
+import com.smartearth.poiexcel.entity.*;
 import com.smartearth.poiexcel.mapper.EntMapper;
+import com.smartearth.poiexcel.mapper.QiYeMapper;
 import com.smartearth.poiexcel.service.EntService;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,6 +28,9 @@
     @Resource
     EntMapper entMapper;
 
+    @Resource
+    QiYeMapper qiYeMapper;
+
     private final static Log log = LogFactory.getLog(InitConfig.class);
 
     @Override
@@ -48,7 +49,16 @@
      * 娴嬭瘯
      */
     private void test() {
-        List<EntEntity> list = entMapper.selectList(new QueryWrapper<>());
+        int count = qiYeMapper.selectCount();
+        int pages = (count - 1) / StaticData.I100 + 1;
+        int pageSize = 2, pageIndex = 1;
+        List<EntEntity> list = qiYeMapper.selectByPage(pageSize, pageSize * (pageIndex - 1));
+        list.get(0).setX(119.0);
+        list.get(0).setY(39.0);
+        //qiYeMapper.update(list.get(0));
+        int cc = qiYeMapper.updates(list);
+
+        // List<EntEntity> list = entMapper.selectList(new QueryWrapper<>())
 
         String tokenJson = "{\"success\":true,\"code\":200,\"message\":\"鎴愬姛\",\"data\":{\"ctoken\":\"ZmYxZTgyN2QxZTYyNDMxMDhjZjgzNDNiNDZiN2RjMDVAYTc3ZmFlOGE5ZGM0OGQ1Y2ZmODY4ZTFmNWYwZTEzM2E=\",\"userInfo\":{\"loginLogId\":\"1ab1675c3632428a84dc0ebe579cd66f\",\"phoneNumber\":\"\",\"displayName\":\"鏃剁┖涓�寮犲浘\",\"userMail\":\"\",\"departLevel\":\"5-1\",\"id\":\"ff1e827d1e6243108cf8343b46b7dc05\",\"userID\":\"shikong001\",\"uniqueID\":\"\",\"departName\":\"姹借溅鍜屾櫤鑳藉埗閫犱骇涓氫笓鐝璡"},\"expires\":3600,\"roles\":[]}}";
         Result rsToken = JSON.parseObject(tokenJson, Result.class);
diff --git a/src/main/java/com/smartearth/poiexcel/entity/EntEntity.java b/src/main/java/com/smartearth/poiexcel/entity/EntEntity.java
index a900eb5..2ad459f 100644
--- a/src/main/java/com/smartearth/poiexcel/entity/EntEntity.java
+++ b/src/main/java/com/smartearth/poiexcel/entity/EntEntity.java
@@ -29,9 +29,9 @@
 
     private String fingerId;
 
-    private Integer regCapital;
+    private String regCapital;
 
-    private Integer regCapitalCNY;
+    private String regCapitalCNY;
 
     private String legalPerson;
 
@@ -58,7 +58,7 @@
     public EntEntity() {
     }
 
-    public EntEntity(String entName, String fingerId, Integer regCapital, Integer regCapitalCNY, String legalPerson, String address, Date buildDate, String entType, String industryCategory, String businessScope, String qylabel, String creator, Double x, Double y, String enterprise_area) {
+    public EntEntity(String entName, String fingerId, String regCapital, String regCapitalCNY, String legalPerson, String address, Date buildDate, String entType, String industryCategory, String businessScope, String qylabel, String creator, Double x, Double y, String enterprise_area) {
         this.entName = entName;
         this.fingerId = fingerId;
         this.regCapital = regCapital;
@@ -100,19 +100,19 @@
         this.fingerId = fingerId;
     }
 
-    public Integer getRegCapital() {
+    public String getRegCapital() {
         return regCapital;
     }
 
-    public void setRegCapital(Integer regCapital) {
+    public void setRegCapital(String regCapital) {
         this.regCapital = regCapital;
     }
 
-    public Integer getRegCapitalCNY() {
+    public String getRegCapitalCNY() {
         return regCapitalCNY;
     }
 
-    public void setRegCapitalCNY(Integer regCapitalCNY) {
+    public void setRegCapitalCNY(String regCapitalCNY) {
         this.regCapitalCNY = regCapitalCNY;
     }
 
diff --git a/src/main/java/com/smartearth/poiexcel/mapper/QiYeMapper.java b/src/main/java/com/smartearth/poiexcel/mapper/QiYeMapper.java
new file mode 100644
index 0000000..6b6e141
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/mapper/QiYeMapper.java
@@ -0,0 +1,48 @@
+package com.smartearth.poiexcel.mapper;
+
+import com.smartearth.poiexcel.entity.EntEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 浼佷笟Mapper
+ * @author WWW
+ */
+@Mapper
+@Repository
+public interface QiYeMapper {
+    /**
+     * 鏌ヨ琛屾暟
+     *
+     * @return
+     */
+    public Integer selectCount();
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     *
+     * @param limit
+     * @param offset
+     * @return
+     */
+    public List<EntEntity> selectByPage(@Param("limit") Integer limit, @Param("offset") Integer offset);
+
+    /**
+     * 鏇存柊涓�鏉�
+     *
+     * @param entity
+     * @return
+     */
+    public Integer update(EntEntity entity);
+
+    /**
+     * 鏇存柊澶氭潯
+     *
+     * @param list
+     * @return
+     */
+    public Integer updates(List<EntEntity> list);
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 8517f64..227cea2 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -9,7 +9,7 @@
 # 数据源配置
 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
 spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://127.0.0.1:3306/smart_earth?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/smart_earth?allowMultiQueries=true&useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
 spring.datasource.username=root
 spring.datasource.password=mysql
 
diff --git a/src/main/resources/mapper/QiYeMapper.xml b/src/main/resources/mapper/QiYeMapper.xml
new file mode 100644
index 0000000..8fbc98c
--- /dev/null
+++ b/src/main/resources/mapper/QiYeMapper.xml
@@ -0,0 +1,29 @@
+<?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.smartearth.poiexcel.mapper.QiYeMapper">
+    <select id="selectCount" resultType="java.lang.Integer">
+        select count(*)
+        from smart_earth.yz_qiyexinxi
+        where x is null or y is null;
+    </select>
+
+    <select id="selectByPage" resultType="com.smartearth.poiexcel.entity.EntEntity">
+        select *
+        from smart_earth.yz_qiyexinxi
+        where x is null or y
+        order by id
+        limit #{limit} offset #{offset};
+    </select>
+
+    <update id="update">
+        update smart_earth.yz_qiyexinxi
+        set x=#{x},y=#{y}
+        where id=#{id};
+    </update>
+
+    <update id="updates">
+        <foreach collection="list" item="item" index="index">
+            update smart_earth.yz_qiyexinxi set x=#{item.x},y=#{item.y} where id=#{item.id};
+        </foreach>
+    </update>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3