| | |
| | | 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; |
| | |
| | | @Resource |
| | | EntMapper entMapper; |
| | | |
| | | @Resource |
| | | QiYeMapper qiYeMapper; |
| | | |
| | | private final static Log log = LogFactory.getLog(InitConfig.class); |
| | | |
| | | @Override |
| | |
| | | * æµè¯ |
| | | */ |
| | | 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); |
| | |
| | | |
| | | private String fingerId; |
| | | |
| | | private Integer regCapital; |
| | | private String regCapital; |
| | | |
| | | private Integer regCapitalCNY; |
| | | private String regCapitalCNY; |
| | | |
| | | private String legalPerson; |
| | | |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | |
| | | # æ°æ®æºé
ç½® |
| | | 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 |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |