Browse Source

导入数据,查询地区

feature/v.2.0.0
caoyizhong 3 years ago
parent
commit
ab592e440e
  1. 1
      air/src/main/java/com/air/applets/controller/LandListedController.java
  2. 3
      air/src/main/java/com/air/dictitem/mapper/DictItemMapper.java
  3. 12
      air/src/main/java/com/air/facilities/controller/FacilitiesController.java
  4. 8
      air/src/main/java/com/air/facilities/entity/Facilities.java
  5. 165
      air/src/main/java/com/air/facilities/listener/FacilitiesListener.java
  6. 13
      air/src/main/java/com/air/facilities/mapper/FacilitiesMapper.java
  7. 7
      air/src/main/java/com/air/facilities/service/FacilitiesService.java
  8. 107
      air/src/main/java/com/air/facilities/service/impl/FacilitiesServiceImpl.java
  9. 7
      air/src/main/java/com/air/land/controller/LandListedController.java
  10. 10
      air/src/main/java/com/air/land/service/LandListedService.java
  11. 26
      air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java
  12. 2
      air/src/main/resources/application.yml
  13. 1
      air/src/main/resources/mapper/BaseRegionMapper.xml
  14. 9
      air/src/main/resources/mapper/DictItemMapper.xml
  15. 22
      air/src/main/resources/mapper/FacilitiesMapper.xml
  16. 17
      air/src/main/resources/mapper/LandListedMapper.xml

1
air/src/main/java/com/air/applets/controller/LandListedController.java

@ -10,6 +10,7 @@ import com.air.land.entity.LandListed;
import com.air.land.service.LandListedService;
import com.air.land.service.LandToListService;
import com.air.land.vo.LandListedAppletsVo;
import com.air.land.vo.LandListedVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cinderella.framework.common.core.util.R;
import com.cinderella.framework.common.data.mybatis.QueryPage;

3
air/src/main/java/com/air/dictitem/mapper/DictItemMapper.java

@ -2,9 +2,10 @@ package com.air.dictitem.mapper;
import com.air.dictitem.entity.DictItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
@Repository
public interface DictItemMapper extends BaseMapper<DictItem> {
DictItem selectAllDictItem(DictItem dictItem);
}

12
air/src/main/java/com/air/facilities/controller/FacilitiesController.java

@ -4,6 +4,7 @@ import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.entity.Facilities;
import com.air.facilities.service.FacilitiesService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cinderella.framework.common.core.exception.BusinessException;
import com.cinderella.framework.common.core.util.R;
import com.cinderella.framework.common.data.mybatis.QueryPage;
import io.swagger.annotations.Api;
@ -56,6 +57,14 @@ public class FacilitiesController {
return R.ok(page.setRecords(facilities1), "查询成功");
}
@ApiOperation(value = "查询城市地区")
@GetMapping("/list/rim")
public R<Page<Facilities>> selectFacilitiesRim(QueryPage queryPage){
Page<Facilities> page = queryPage.toPage();
List<Facilities> facilities1 = facilitiesService.selectAllFacilitiesRim(page);
return R.ok(page.setRecords(facilities1), "查询成功");
}
@ApiOperation(value = "根据ID查询")
@GetMapping("/list/{id}")
public R<Facilities> selectFacilitiesId(@PathVariable("id") String id){
@ -91,6 +100,9 @@ public class FacilitiesController {
return R.failed("导入文件格式不正确!请上传后缀为.xlsx");
}
return R.failed();
}catch (BusinessException be) {
be.printStackTrace();
return R.failed("导入失败!"+be.getMessage());
} catch (IOException e) {
e.printStackTrace();
return R.failed();

8
air/src/main/java/com/air/facilities/entity/Facilities.java

@ -47,8 +47,12 @@ public class Facilities extends Model<Facilities> {
private String geom;
@ApiModelProperty(value="计算坐标对象")
private String miniGeom;
@ApiModelProperty(value = "所属地区ID")
private BigInteger site;
@ApiModelProperty(value = "省")
private String site;
@ApiModelProperty(value = "市")
private String city;
@ApiModelProperty(value = "区、县")
private String county;
@ApiModelProperty(value = "所在地址")
private String address;

165
air/src/main/java/com/air/facilities/listener/FacilitiesListener.java

@ -0,0 +1,165 @@
package com.air.facilities.listener;
import cn.hutool.core.util.ObjectUtil;
import com.air.baseRegion.dto.BaseRegionDTO;
import com.air.baseRegion.mapper.BaseRegionMapper;
import com.air.baseRegion.vo.BaseRegionVO;
import com.air.dictitem.entity.DictItem;
import com.air.dictitem.mapper.DictItemMapper;
import com.air.facilities.dto.FacilitiesFileDTO;
import com.air.facilities.entity.Facilities;
import com.air.facilities.mapper.FacilitiesMapper;
import com.air.facilities.service.FacilitiesService;
import com.air.facilities.service.impl.FacilitiesServiceImpl;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.cinderella.framework.common.core.exception.BusinessException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @program: back-end
* @description: 监听
* @author: cyz
* @create: 2022-07-14 09:05
**/
public class FacilitiesListener extends AnalysisEventListener<FacilitiesFileDTO> {
private static final Logger LOGGER = LoggerFactory.getLogger(FacilitiesListener.class);
@Autowired
@Lazy
private FacilitiesMapper facilitiesMapper;
@Autowired
@Lazy
private BaseRegionMapper baseRegionMapper;
@Autowired
@Lazy
private DictItemMapper dictItemMapper;
@Autowired
private ThreadPoolTaskExecutor executor;
/**
* 如果使用了spring,请使用这个构造方法每次创建Listener的时候需要把spring管理的类传进来
*
* @param
*/
public FacilitiesListener(DictItemMapper dictItemMapper, BaseRegionMapper baseRegionMapper,FacilitiesMapper facilitiesMapper,ThreadPoolTaskExecutor executor) {
this.dictItemMapper = dictItemMapper;
this.baseRegionMapper = baseRegionMapper;
this.facilitiesMapper = facilitiesMapper;
this.executor = executor;
}
/**
* 每隔5条存储数据库实际使用中可以3000条然后清理list 方便内存回收
*/
private static final int BATCH_COUNT = 10;
List<FacilitiesFileDTO> list = new ArrayList<FacilitiesFileDTO>();
@Override
public void invoke(FacilitiesFileDTO bzhdSystemConstructionImport, AnalysisContext analysisContext) {
LOGGER.info("解析到一条数据:{}", bzhdSystemConstructionImport);
list.add(bzhdSystemConstructionImport);
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
if (list.size() >= BATCH_COUNT) {
saveData();
LOGGER.info("大于了");
// //开启多线程处理
// executor.execute(()->{
// String threadNamePrefix = executor.getThreadNamePrefix();
// LOGGER.info(threadNamePrefix);
// saveData();
// // 存储完成清理 list
// list.clear();
// LOGGER.info("大于了");
// });
}
}
/**
* 所有数据解析完成了 都会来调用
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
saveData();
LOGGER.info("所有数据解析完成!");
}
/**
* 加上存储数据库
*/
@Transactional
public void saveData() {
LOGGER.info("{}条数据,开始存储数据库!", list.size());
//开启多线程处理
executor.execute(()->{
String threadNamePrefix = executor.getThreadNamePrefix();
LOGGER.info(threadNamePrefix);
for (FacilitiesFileDTO demoData : list) {
LOGGER.info(list.size() + "======================");
Facilities facilities = new Facilities();
facilities.setName(demoData.getName());
String[] split = demoData.getNautica().split(",");
String srt = "POINT(" + split[0] + " " + split[1] + ")";
String s = split[0];
BigDecimal bd = new BigDecimal(s);
facilities.setLon(bd);//经度
String se = split[1];
BigDecimal bed = new BigDecimal(se);
facilities.setLat(bed);//纬度
facilities.setGeom(srt);
//查询周边类型
DictItem rim = dictItemMapper.selectOne(Wrappers.<DictItem>query().lambda()
.like(StringUtils.isNotBlank(demoData.getClassify()), DictItem::getLabel, demoData.getClassifyTwo())
.eq(DictItem::getType, "rim")
);
if (ObjectUtil.isNotNull(rim)) {
facilities.setType(rim.getValue());
facilities.setTypecn(rim.getLabel());
} else {
throw new BusinessException("没有该分类");
}
//查询地区ID
BaseRegionDTO baseRegionDTO = new BaseRegionDTO();
baseRegionDTO.setProvince(demoData.getProvince());
baseRegionDTO.setCity(demoData.getCity());
baseRegionDTO.setArea(demoData.getArea());
BaseRegionVO baseRegionVO = baseRegionMapper.selectBaseRegion(baseRegionDTO);
// facilities.setSite(baseRegionVO.getXianId());
if (StringUtils.isNotBlank(demoData.getAddress())) {
facilities.setAddress(demoData.getAddress());
}
facilitiesMapper.insertFacilities(facilities);
}
// 存储完成清理 list
list.clear();
});
LOGGER.info("存储数据库成功!");
}
}

13
air/src/main/java/com/air/facilities/mapper/FacilitiesMapper.java

@ -25,6 +25,12 @@ public interface FacilitiesMapper extends BaseMapper<Facilities> {
*/
List<Facilities> getAllFacilities(Page page ,@Param("facilities")Facilities facilities);
/**
* 查询全部周边信息
* @return
*/
List<Facilities> getAllFacilitiesRim(Page page);
/**
* 查询周边类型集合
@ -46,6 +52,13 @@ public interface FacilitiesMapper extends BaseMapper<Facilities> {
*/
int insertFacilities(Facilities facilities);
/**
* 添加List
* @param facilities
* @return
*/
int insertFacilitiesList(List<Facilities> facilities);
/**
* 修改
* @param facilities

7
air/src/main/java/com/air/facilities/service/FacilitiesService.java

@ -1,6 +1,7 @@
package com.air.facilities.service;
import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.dto.FacilitiesFileDTO;
import com.air.facilities.entity.Facilities;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -18,6 +19,12 @@ public interface FacilitiesService extends IService<Facilities> {
*/
List<Facilities> selectAllFacilitiesPage(Page page, Facilities facilities);
/**
* 查询全部周边信息
* @return
*/
List<Facilities> selectAllFacilitiesRim(Page page);
/**
* 根据ID查询具体信息
* @param id

107
air/src/main/java/com/air/facilities/service/impl/FacilitiesServiceImpl.java

@ -2,6 +2,7 @@ package com.air.facilities.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSON;
import com.air.baseRegion.dto.BaseRegionDTO;
import com.air.baseRegion.mapper.BaseRegionMapper;
import com.air.baseRegion.vo.BaseRegionVO;
@ -10,6 +11,7 @@ import com.air.dictitem.mapper.DictItemMapper;
import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.dto.FacilitiesFileDTO;
import com.air.facilities.entity.Facilities;
import com.air.facilities.listener.FacilitiesListener;
import com.air.facilities.mapper.FacilitiesMapper;
import com.air.facilities.service.FacilitiesService;
import com.alibaba.excel.EasyExcel;
@ -22,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -29,7 +32,11 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;
/**
* @program: back-end
@ -49,6 +56,8 @@ public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilit
@Autowired
private DictItemMapper dictItemMapper;
@Autowired
ThreadPoolTaskExecutor executor;
/**
* 查询全部数据
@ -58,10 +67,21 @@ public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilit
*/
@Override
public List<Facilities> selectAllFacilitiesPage(Page page, Facilities facilities) {
log.info("===="+facilities);
List<Facilities> allFacilities = facilitiesMapper.getAllFacilities(page, facilities);
return allFacilities;
}
/**
* 查询全部地区
* @param page
* @return
*/
@Override
public List<Facilities> selectAllFacilitiesRim(Page page) {
return facilitiesMapper.getAllFacilitiesRim(page);
}
/**
* 根据ID查询具体信息
*
@ -186,45 +206,54 @@ public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilit
return 10;
}
InputStream inputStream = file.getInputStream();
EasyExcel.read(inputStream, FacilitiesFileDTO.class, new PageReadListener<FacilitiesFileDTO>(dataList -> {
dataList.forEach( demoData -> {
log.info(dataList.size()+"======================");
// for (FacilitiesFileDTO demoData : dataList) {
Facilities facilities = new Facilities();
facilities.setName(demoData.getName());
String[] split = demoData.getNautica().split(",");
String srt = "POINT(" + split[0] + " " + split[1] + ")";
String s = split[0];
BigDecimal bd=new BigDecimal(s);
facilities.setLon(bd);//经度
String se = split[1];
BigDecimal bed=new BigDecimal(se);
facilities.setLat(bed);//纬度
facilities.setGeom(srt);
//查询周边类型
DictItem rim = dictItemMapper.selectOne(Wrappers.<DictItem>query().lambda()
.like(StringUtils.isNotBlank(demoData.getClassify()), DictItem::getLabel, demoData.getClassifyTwo())
.eq(DictItem::getType, "rim")
);
if(ObjectUtil.isNotNull(rim) ){
facilities.setType(rim.getValue());
facilities.setTypecn(rim.getLabel());
}else{
throw new BusinessException("没有该分类");
}
//查询地区ID
BaseRegionDTO baseRegionDTO = new BaseRegionDTO();
baseRegionDTO.setProvince(demoData.getProvince());
baseRegionDTO.setCity(demoData.getCity());
baseRegionDTO.setArea(demoData.getArea());
BaseRegionVO baseRegionVO = baseRegionMapper.selectBaseRegion(baseRegionDTO);
facilities.setSite(baseRegionVO.getXianId());
if(StringUtils.isNotBlank(demoData.getAddress())){
facilities.setAddress(demoData.getAddress());
}
facilitiesMapper.insertFacilities(facilities);
});
})).sheet().headRowNumber(1).doRead();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
log.info("{},开始导入数据...", format.format(new Date()));
// EasyExcel.read(inputStream, FacilitiesFileDTO.class, new FacilitiesListener(dictItemMapper,baseRegionMapper,facilitiesMapper,executor)
List<Facilities> facilitiesList = new ArrayList<>();
EasyExcel.read(inputStream, FacilitiesFileDTO.class, new PageReadListener<FacilitiesFileDTO>
( dataList -> {
log.info("====================={}条数据",dataList.size());
dataList.forEach( demoData -> {
Facilities facilities = new Facilities();
facilities.setName(demoData.getName());
String[] split = demoData.getNautica().split(",");
String srt = "POINT(" + split[0] + " " + split[1] + ")";
String s = split[0];
BigDecimal bd=new BigDecimal(s);
facilities.setLon(bd);//经度
String se = split[1];
BigDecimal bed=new BigDecimal(se);
facilities.setLat(bed);//纬度
facilities.setGeom(srt);
//查询周边类型
DictItem rim = dictItemMapper.selectOne(Wrappers.<DictItem>query().lambda()
.like(StringUtils.isNotBlank(demoData.getClassify()), DictItem::getLabel, demoData.getClassifyTwo())
.eq(DictItem::getType, "rim")
);
if(ObjectUtil.isNotNull(rim) ){
facilities.setType(rim.getValue());
facilities.setTypecn(rim.getLabel());
}else{
throw new BusinessException("没有该分类");
}
//查询地区ID
facilities.setSite(demoData.getProvince());
facilities.setCounty(demoData.getArea());
facilities.setCity(demoData.getCity());
if(StringUtils.isNotBlank(demoData.getAddress())){
facilities.setAddress(demoData.getAddress());
}
facilitiesList.add(facilities);
});
})
).sheet().headRowNumber(1).doRead();
facilitiesMapper.insertFacilitiesList(facilitiesList);
log.info("==========插入的数量{}",facilitiesList.size());
facilitiesList.clear();
return 1;
} catch (IOException e) {
e.printStackTrace();

7
air/src/main/java/com/air/land/controller/LandListedController.java

@ -310,8 +310,8 @@ public class LandListedController {
**/
@ApiOperation(value = "导出全部已挂牌地块信息", notes = "导出全部已挂牌地块信息")
@GetMapping("/exportAllLandListExcel")
public void exportAllLandListExcels(HttpServletResponse response) {
public void exportAllLandListExcels(HttpServletResponse response,String city) {
log.info("====地区{}",city);
int NUM_PER_SHEET = 300000;
// 每次向 sheet 中写入的数据(分页写入)
int NUM_BY_TIMES = 50000;
@ -321,7 +321,8 @@ public class LandListedController {
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx");
// 获取数据
List<List<String>> date = landListedService.getLandList(null);
List<List<String>> date = landListedService.getLandListCity(city);
// List<List<String>> date = landListedService.getLandList(null);
log.info(date.size() + "==================================多少数量");
// InputStream resourceAsStream = LandListedController.class.getClassLoader().getResourceAsStream("templates/excel/exportLandList.xlsx");
//获取静态文件

10
air/src/main/java/com/air/land/service/LandListedService.java

@ -6,6 +6,7 @@ import com.air.land.dto.LandListedDto;
import com.air.land.dto.LandListedStatisticsDto;
import com.air.land.entity.LandListed;
import com.air.land.vo.LandListedAppletsVo;
import com.air.land.vo.LandListedVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cinderella.framework.common.core.util.R;
@ -62,6 +63,15 @@ public interface LandListedService extends IService<LandListed> {
**/
List<List<String>> getLandList(List<String> ids);
/**
* 通过地区查询已挂牌地块数据
* @author peihao
* @param city 地区导出全部数据
* @date 2021/7/9
* @return
**/
List<List<String>> getLandListCity(String city);
/**
* 复合条件查询已挂牌列表数据
* @author peihao

26
air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java

@ -100,8 +100,8 @@ public class LandListedServiceImpl extends ServiceImpl<LandListedMapper, LandLis
@Override
public R<List<LandListedStatisticsDto>> appletsCalendar(String date, String city, String canton) {
List<LandListedStatisticsDto> annoDateList = baseMapper.appletsCalendarToAnnoDate(date, city, canton);
List<LandListedStatisticsDto> auctionDateList = baseMapper.appletsCalendarToAuctionDate(date, city, canton);
List<LandListedStatisticsDto> annoDateList = baseMapper.appletsCalendarToAnnoDate(date, city, canton);//按挂牌日期统计地块数量(日历)
List<LandListedStatisticsDto> auctionDateList = baseMapper.appletsCalendarToAuctionDate(date, city, canton);//按拍卖日期统计地块数量(日历)
if (CollectionUtil.isEmpty(annoDateList)) {
return R.ok(auctionDateList);
}
@ -223,11 +223,31 @@ public class LandListedServiceImpl extends ServiceImpl<LandListedMapper, LandLis
return list;
}
/**
* 通过地区查询已挂牌地块数据
* @param city 地区导出全部数据
* @return
*/
@Override
public List<List<String>> getLandListCity(String city) {
List<LandListed> landListeds=list(Wrappers.<LandListed>query().lambda()
.eq(StringUtils.isNotBlank(city),LandListed :: getCity,city)
);
if(landListeds.size() > 0){
List<List<String>> list = new ArrayList<>();
landListeds.forEach(landListed -> {
list.add(entityToList(landListed));
});
return list;
}
return null;
}
/**
* 定时查询已挂出导出全部数据
*/
@Async
@Scheduled(cron = "0 0/59 * * * *") // 10分执行一次 “0 0 12 ?” 每天12时执行一次
// @Scheduled(cron = "0 0/58 * * * *") // 10分执行一次 “0 0 12 ?” 每天12时执行一次
public void selectCollection() throws IOException {
log.info("定时查询已挂出导出全部数据"+System.currentTimeMillis());
List<LandListed> landListeds = list();

2
air/src/main/resources/application.yml

@ -2,6 +2,8 @@ server:
port: 9002
spring:
jackson:
default-property-inclusion: non_null
application:
name: air
datasource:

1
air/src/main/resources/mapper/BaseRegionMapper.xml

@ -12,7 +12,6 @@
<if test="province != null and province != '' "> sbr.REGION_NAME like concat('%',#{ province },'%') </if>
<if test="city != null and city != ''">and sen.REGION_NAME like concat('%', #{ city },'%') </if>
<if test="area != null and area != ''">and shi.REGION_NAME like concat('%', #{ area },'%')</if>
</where>
</select>
</mapper>

9
air/src/main/resources/mapper/DictItemMapper.xml

@ -3,5 +3,12 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.air.dictitem.mapper.DictItemMapper">
<select id="selectAllDictItem" resultType="com.air.dictitem.entity.DictItem">
select id,dict_id dictId,value,label,type,description,sort,create_time createTime,update_time updateTime,remarks,del_flag,tenant_id tenantId
from sys_dict_item
<where>
<if test="label != null">and label like concat('%',#{ label },'%') </if>
<if test="type != null">and type = #{ type }</if>
</where>
</select>
</mapper>

22
air/src/main/resources/mapper/FacilitiesMapper.xml

@ -8,9 +8,13 @@
<where>
<if test="facilities.name != null and facilities.name != ''"> and name like concat('%', #{facilities.name},'%') </if>
<if test="facilities.typecn != null and facilities.typecn != ''"> and typecn = #{facilities.typecn} </if>
<if test="facilities.type != null and facilities.type != ''"> and type = #{facilities.type} </if>
</where>
</select>
<select id="getAllFacilitiesRim" resultType="com.air.facilities.entity.Facilities">
select DISTINCT site,city,county from facilities
</select>
<select id="selectTypeList" resultType="com.air.facilities.entity.Facilities">
select DISTINCT typecn,type from facilities
</select>
@ -51,6 +55,22 @@
<if test="address != null">#{ address },</if>
</trim>
</insert>
<insert id="insertFacilitiesList">
insert into facilities(
name,typecn,
created_time,lon,lat,
type,geom,site,city,county,address
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.name},#{item.typecn}, now(),
#{item.lon},#{item.lat},
#{item.type},ST_GeomFromText(#{item.geom}),#{item.site},#{item.city},#{item.county},
#{item.address})
</foreach>
</insert>
<update id="updateFacilities" >
update facilities
<trim prefix="SET" suffixOverrides=",">

17
air/src/main/resources/mapper/LandListedMapper.xml

@ -141,12 +141,14 @@
FROM
land_listed ll
where
DATE_FORMAT(ll.anno_date,'%Y-%m') = #{annoDate}
<if test="city != null and city != ''">
and city = #{city}
<!-- DATE_FORMAT(ll.anno_date,'%Y-%m') = #{annoDate} -->
DATE_FORMAT(ll.anno_date,'%Y-%m') = DATE_FORMAT(#{annoDate}, '%Y-%m')
<if test="city != null and city != ''">
and ll.city = #{city}
</if>
<if test="canton != null and canton != ''">
and canton = #{canton}
and ll.canton = #{canton}
</if>
GROUP BY DATE_FORMAT(ll.anno_date,'%Y-%m-%d')
</select>
@ -158,12 +160,13 @@
FROM
land_listed ll
where
DATE_FORMAT(ll.auction_date,'%Y-%m') = #{auctionDate}
<!-- DATE_FORMAT(ll.auction_date,'%Y-%m') = #{auctionDate}-->
DATE_FORMAT(ll.auction_date,'%Y-%m') = DATE_FORMAT(#{auctionDate}, '%Y-%m')
<if test="city != null and city != ''">
and city = #{city}
and ll.city = #{city}
</if>
<if test="canton != null and canton != ''">
and canton = #{canton}
and ll.canton = #{canton}
</if>
GROUP BY DATE_FORMAT(ll.auction_date,'%Y-%m-%d')
</select>

Loading…
Cancel
Save