From fd6bb502578fa6af39f1b8ea936387517054159f Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 07 十月 2023 15:48:52 +0800 Subject: [PATCH] 修改地块控制器 --- src/main/java/com/smartearth/poiexcel/controller/DkController.java | 24 +++++++++++- src/main/java/com/smartearth/poiexcel/service/DkService.java | 45 ++++++++++++++++++++++ 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/smartearth/poiexcel/controller/DkController.java b/src/main/java/com/smartearth/poiexcel/controller/DkController.java index eca68d6..b8c08b9 100644 --- a/src/main/java/com/smartearth/poiexcel/controller/DkController.java +++ b/src/main/java/com/smartearth/poiexcel/controller/DkController.java @@ -7,6 +7,7 @@ import com.smartearth.poiexcel.entity.DkEntity; import com.smartearth.poiexcel.entity.ResponseMsg; import com.smartearth.poiexcel.mapper.DkMapper; +import com.smartearth.poiexcel.service.DkService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -30,6 +31,9 @@ public class DkController extends BaseController { @Resource DkMapper dkMapper; + + @Resource + DkService dkService; @ApiOperation(value = "鍒嗛〉鏌ヨ鍦板潡") @ApiImplicitParams({ @@ -75,7 +79,10 @@ int rows = 0; for (DkEntity dk : list) { - //boolean flag + boolean flag = dkService.updateByBh(dk); + if (flag) { + rows += dkMapper.updateById(dk); + } } return success(rows); @@ -88,8 +95,21 @@ @GetMapping(value = "/updateByCoord") public ResponseMsg<Object> updateByCoord() { try { - int rows = 0; + QueryWrapper<DkEntity> wrapper = new QueryWrapper<>(); + wrapper.apply("length(dikuaibianhao) > 0"); + List<DkEntity> list = dkMapper.selectList(wrapper); + if (null == list || list.isEmpty()) { + return success("娌¢渶瑕佹洿鏂扮殑鍦板潡", 0); + } + + int rows = 0; + for (DkEntity dk : list) { + boolean flag = dkService.updateByCoord(dk); + if (flag) { + rows += dkMapper.updateById(dk); + } + } return success(rows); } catch (Exception ex) { diff --git a/src/main/java/com/smartearth/poiexcel/service/DkService.java b/src/main/java/com/smartearth/poiexcel/service/DkService.java new file mode 100644 index 0000000..d0ab1e0 --- /dev/null +++ b/src/main/java/com/smartearth/poiexcel/service/DkService.java @@ -0,0 +1,45 @@ +package com.smartearth.poiexcel.service; + +import com.smartearth.poiexcel.entity.DkEntity; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.stereotype.Service; + +/** + * 鍦板潡鏈嶅姟绫� + * @author WWW + * @date 2023-10-05 + */ +@Service +@SuppressWarnings("ALL") +public class DkService { + private final static Log log = LogFactory.getLog(DkService.class); + + /** + * 鏍规嵁缂栧彿鏇存柊 + */ + public boolean updateByBh(DkEntity dk) { + try { + // + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } + } + + /** + * 鏍规嵁鍧愭爣鏇存柊 + */ + public boolean updateByCoord(DkEntity dk) { + try { + // + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } + } +} -- Gitblit v1.9.3