| | |
| | | comment on column nsl.simu.bak is '夿³¨'; |
| | | comment on column nsl.simu.geom is '空é´ä½ç½®'; |
| | | |
| | | select * from nsl.simu; |
| | | -- insert into nsl.simu (name, service_name, type, area_type, status, geom) values ('颿µæ¨¡æ-0416', '20250416100000', 1, 1, 0, ST_GeomFromText('MULTIPOLYGON(((116.666748 39.639859,116.659403 39.626287,116.665956 39.654698,116.666748 39.639859)))')); |
| | | |
| | | select *, st_astext(geom) geom from nsl.simu; |
| | | ---------------------------------------------- 2.æ¨æ¼åºå |
| | | -- drop table if exists nsl.region; |
| | | create table nsl.region ( |
| | |
| | | comment on column nsl.region.type is 'ç±»å«ï¼1-è¡æ¿åºåï¼2-éç¹åºåï¼3-éç¹æ²'; |
| | | comment on column nsl.region.geom is '空é´ä½ç½®'; |
| | | |
| | | select * from nsl.region; |
| | | -- insert into nsl.region (name, type, geom) values ('大å
´', 1, ST_GeomFromText('MULTIPOLYGON(((116.666748 39.639859,116.659403 39.626287,116.665956 39.654698,116.666748 39.639859)))')); |
| | | |
| | | select id, name, type, st_astext(geom) from nsl.region order by id; |
| | | ---------------------------------------------- 3.é¨é计 * |
| | | -- drop table if exists nsl.udometer; |
| | | create table nsl.udometer ( |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.nsl.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.se.nsl.domain.po.Region; |
| | | import com.se.nsl.domain.vo.R; |
| | | import com.se.nsl.service.RegionService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Api(tags = "1ï¼æ¨æ¼åºå") |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/region") |
| | | @SuppressWarnings("ALL") |
| | | public class RegionController extends BaseController { |
| | | @Resource |
| | | RegionService regionService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ¨æ¼åºå |
| | | * |
| | | * @param pageNum 页ç |
| | | * @param pageSize æ¯é¡µæ°é |
| | | * @return å页åçæ¨æ¼åºå |
| | | */ |
| | | @ApiOperation(value = "selectPage") |
| | | @GetMapping("/selectPage") |
| | | public R<Object> selectPage(Region region, Integer pageNum, Integer pageSize) { |
| | | try { |
| | | if (null == pageNum || pageNum < 1) pageNum = 1; |
| | | if (null == pageSize || pageSize < 1) pageSize = 10; |
| | | if (pageSize > 1000) pageSize = 1000; |
| | | |
| | | IPage<Region> paged = regionService.selectPage(region, pageNum, pageSize); |
| | | if (null == paged) { |
| | | return success(null, 0); |
| | | } |
| | | |
| | | return success(paged.getRecords(), paged.getTotal()); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¹éå 餿¨æ¼åºå |
| | | * |
| | | * @param ids è¦å é¤çæ¨æ¼åºåIDå表 |
| | | * @return å 餿åçè®°å½æ° |
| | | */ |
| | | @ApiOperation(value = "deleteByIds") |
| | | @DeleteMapping("/deleteByIds") |
| | | public R<Object> deleteByIds(java.util.List<Integer> ids) { |
| | | try { |
| | | return success(regionService.deleteByIds(ids)); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¨æ¼åºå |
| | | * |
| | | * @param region æ¨æ¼åºå对象 |
| | | * @return æ°å¢æåçè®°å½æ° |
| | | */ |
| | | @ApiOperation(value = "insert") |
| | | @PostMapping("/insert") |
| | | public R<Object> insert(Region region) { |
| | | try { |
| | | return success(regionService.insert(region)); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨æ¼åºå |
| | | * |
| | | * @param region æ¨æ¼åºå对象 |
| | | * @return ä¿®æ¹æåçè®°å½æ° |
| | | */ |
| | | @ApiOperation(value = "updateById") |
| | | @PutMapping("/updateById") |
| | | public R<Object> updateById(Region region) { |
| | | try { |
| | | return success(regionService.updateById(region)); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.nsl.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.se.nsl.domain.po.Simu; |
| | | import com.se.nsl.domain.vo.R; |
| | | import com.se.nsl.service.SimuService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Api(tags = "2ï¼æ¨æ¼æ¨¡æ") |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/simu") |
| | | @SuppressWarnings("ALL") |
| | | public class SimuController extends BaseController { |
| | | @Resource |
| | | SimuService simuService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ¨æ¼æ¨¡æ |
| | | * |
| | | * @param pageNum 页ç |
| | | * @param pageSize æ¯é¡µæ°é |
| | | * @return å页åçæ¨æ¼æ¨¡æ |
| | | */ |
| | | @ApiOperation(value = "selectPage") |
| | | @GetMapping("/selectPage") |
| | | public R<Object> selectPage(Simu simu, Integer pageNum, Integer pageSize) { |
| | | try { |
| | | if (null == pageNum || pageNum < 1) pageNum = 1; |
| | | if (null == pageSize || pageSize < 1) pageSize = 10; |
| | | if (pageSize > 1000) pageSize = 1000; |
| | | |
| | | IPage<Simu> paged = simuService.selectPage(simu, pageNum, pageSize); |
| | | if (null == paged) { |
| | | return success(null, 0); |
| | | } |
| | | |
| | | return success(paged.getRecords(), paged.getTotal()); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¹éå 餿¨æ¼æ¨¡æ |
| | | * |
| | | * @param ids è¦å é¤çæ¨æ¼æ¨¡æIDå表 |
| | | * @return å 餿åçè®°å½æ° |
| | | */ |
| | | @ApiOperation(value = "deleteByIds") |
| | | @DeleteMapping("/deleteByIds") |
| | | public R<Object> deleteByIds(java.util.List<Integer> ids) { |
| | | try { |
| | | return success(simuService.deleteByIds(ids)); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¨æ¼æ¨¡æ |
| | | * |
| | | * @param simu æ¨æ¼æ¨¡æå¯¹è±¡ |
| | | * @return æ°å¢æåçè®°å½æ° |
| | | */ |
| | | @ApiOperation(value = "insert") |
| | | @PostMapping("/insert") |
| | | public R<Object> insert(Simu simu) { |
| | | try { |
| | | return success(simuService.insert(simu)); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨æ¼æ¨¡æ |
| | | * |
| | | * @param simu æ¨æ¼æ¨¡æå¯¹è±¡ |
| | | * @return ä¿®æ¹æåçè®°å½æ° |
| | | */ |
| | | @ApiOperation(value = "updateById") |
| | | @PutMapping("/updateById") |
| | | public R<Object> updateById(Simu simu) { |
| | | try { |
| | | return success(simuService.updateById(simu)); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "è·å") |
| | | @GetMapping("/get") |
| | | public R<Object> get(@ApiParam("仿çè§å¾ç±»") SimuVo vo) { |
| | | public R<Object> get(@ApiParam("仿çè§å¾ç±»") SimulateVo vo) { |
| | | try { |
| | | if (null == vo) { |
| | | vo = new SimuVo(); |
| | | vo = new SimulateVo(); |
| | | } |
| | | if (null == vo.getPageSize() || vo.getPageSize() < 1) { |
| | | vo.setPageSize(10); |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.netty.util.internal.StringUtil; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | |
| | | public void setGeom(String geom) { |
| | | this.geom = geom; |
| | | } |
| | | |
| | | public void setGeomWkt(String wkt) { |
| | | this.geom = StringUtil.isNullOrEmpty(wkt) ? "null" : String.format("ST_GeomFromText('%s')", wkt.trim()); |
| | | } |
| | | } |
| | |
| | | package com.se.nsl.domain.po; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.netty.util.internal.StringUtil; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | |
| | | @ApiModelProperty("ç»æ(JSON)") |
| | | private String result; |
| | | |
| | | @JSONField(format = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty("å建æ¶é´") |
| | | private Timestamp createTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | private Timestamp createUser; |
| | | |
| | | @JSONField(format = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | private Timestamp updateTime; |
| | | |
| | |
| | | @ApiModelProperty("夿³¨") |
| | | private String bak; |
| | | |
| | | @TableField(select = false) |
| | | @ApiModelProperty("空é´ä½ç½®") |
| | | private String geom; |
| | | |
| | |
| | | public void setGeom(String geom) { |
| | | this.geom = geom; |
| | | } |
| | | |
| | | public void setGeomWkt(String wkt) { |
| | | this.geom = StringUtil.isNullOrEmpty(wkt) ? "null" : String.format("ST_GeomFromText('%s')", wkt.trim()); |
| | | } |
| | | } |
ÎļþÃû´Ó src/main/java/com/se/nsl/domain/vo/SimuVo.java ÐÞ¸Ä |
| | |
| | | |
| | | @TableName("bs.simu") |
| | | @SuppressWarnings("ALL") |
| | | public class SimuVo { |
| | | public class SimulateVo { |
| | | @ApiModelProperty("ID") |
| | | private Long id; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.nsl.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.se.nsl.domain.po.Region; |
| | | import com.se.nsl.helper.StringHelper; |
| | | import com.se.nsl.mapper.RegionMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class RegionService { |
| | | @Resource |
| | | RegionMapper regionMapper; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ¨æ¼åºå |
| | | * |
| | | * @param pageNum 页ç |
| | | * @param pageSize æ¯é¡µæ°é |
| | | * @return å页åçæ¨æ¼åºå |
| | | */ |
| | | public IPage<Region> selectPage(Region vo, int pageNum, int pageSize) { |
| | | QueryWrapper<Region> wrapper = getPageWrapper(vo, pageNum, pageSize); |
| | | |
| | | Page<Region> page = new Page<>(pageNum, pageSize); |
| | | page.addOrder(OrderItem.desc("id")); |
| | | |
| | | IPage<Region> paged = regionMapper.selectPage(page, wrapper); |
| | | |
| | | return paged; |
| | | } |
| | | |
| | | private QueryWrapper<Region> getPageWrapper(Region vo, int pageNum, int pageSize) { |
| | | QueryWrapper<Region> wrapper = new QueryWrapper<>(); |
| | | if (null != vo.getId()) { |
| | | wrapper.eq("id", vo.getId()); |
| | | } |
| | | if (!StringHelper.isEmpty(vo.getName())) { |
| | | wrapper.like("lower(name)", vo.getName().trim().toLowerCase()); |
| | | } |
| | | if (null != vo.getType()) { |
| | | wrapper.eq("type", vo.getType()); |
| | | } |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¹éå 餿¨æ¼åºå |
| | | * |
| | | * @param ids è¦å é¤çåºåIDå表 |
| | | * @return å 餿åçè®°å½æ° |
| | | */ |
| | | public int deleteByIds(List<Integer> ids) { |
| | | return regionMapper.deleteByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¨æ¼åºå |
| | | * |
| | | * @param region æ¨æ¼åºå对象 |
| | | * @return æ°å¢æåçè®°å½æ° |
| | | */ |
| | | public int insert(Region region) { |
| | | return regionMapper.insert(region); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨æ¼åºå |
| | | * |
| | | * @param region æ¨æ¼åºå对象 |
| | | * @return ä¿®æ¹æåçè®°å½æ° |
| | | */ |
| | | public int updateById(Region region) { |
| | | return regionMapper.updateById(region); |
| | | } |
| | | } |
| | |
| | | import com.se.nsl.domain.po.DataPo; |
| | | import com.se.nsl.domain.po.SimuPo; |
| | | import com.se.nsl.domain.vo.CreateFilesSimuVo; |
| | | import com.se.nsl.domain.vo.SimuVo; |
| | | import com.se.nsl.domain.vo.SimulateVo; |
| | | import com.se.nsl.helper.StringHelper; |
| | | import com.se.nsl.helper.WebHelper; |
| | | import com.se.nsl.mapper.SimuPoMapper; |
| | |
| | | @Resource |
| | | ResultService resultService; |
| | | |
| | | public IPage<SimuPo> get(SimuVo vo) { |
| | | public IPage<SimuPo> get(SimulateVo vo) { |
| | | QueryWrapper<SimuPo> wrapper = getPageWrapper(vo); |
| | | |
| | | Page<SimuPo> page = new Page<>(vo.getPageIndex(), vo.getPageSize()); |
| | |
| | | return paged; |
| | | } |
| | | |
| | | private QueryWrapper<SimuPo> getPageWrapper(SimuVo vo) { |
| | | private QueryWrapper<SimuPo> getPageWrapper(SimulateVo vo) { |
| | | QueryWrapper<SimuPo> wrapper = new QueryWrapper<>(); |
| | | if (null != vo.getId()) { |
| | | wrapper.eq("id", vo.getId()); |
| | |
| | | import com.se.nsl.domain.po.DataPo; |
| | | import com.se.nsl.domain.po.SimuPo; |
| | | import com.se.nsl.domain.vo.CreateSimuVo; |
| | | import com.se.nsl.domain.vo.SimuVo; |
| | | import com.se.nsl.domain.vo.SimulateVo; |
| | | import com.se.nsl.helper.StringHelper; |
| | | import com.se.nsl.helper.WebHelper; |
| | | import com.se.nsl.mapper.SimuPoMapper; |
| | |
| | | @Resource |
| | | ResultService resultService; |
| | | |
| | | public IPage<SimuPo> get(SimuVo vo) { |
| | | public IPage<SimuPo> get(SimulateVo vo) { |
| | | QueryWrapper<SimuPo> wrapper = getPageWrapper(vo); |
| | | |
| | | Page<SimuPo> page = new Page<>(vo.getPageIndex(), vo.getPageSize()); |
| | |
| | | return paged; |
| | | } |
| | | |
| | | private QueryWrapper<SimuPo> getPageWrapper(SimuVo vo) { |
| | | private QueryWrapper<SimuPo> getPageWrapper(SimulateVo vo) { |
| | | QueryWrapper<SimuPo> wrapper = new QueryWrapper<>(); |
| | | if (null != vo.getId()) { |
| | | wrapper.eq("id", vo.getId()); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.nsl.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.se.nsl.domain.po.Simu; |
| | | import com.se.nsl.helper.StringHelper; |
| | | import com.se.nsl.mapper.SimuMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class SimuService { |
| | | @Resource |
| | | SimuMapper simuMapper; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ¨æ¼æ¨¡æ |
| | | * |
| | | * @param pageNum 页ç |
| | | * @param pageSize æ¯é¡µæ°é |
| | | * @return å页åçæ¨æ¼æ¨¡æ |
| | | */ |
| | | public IPage<Simu> selectPage(Simu vo, int pageNum, int pageSize) { |
| | | QueryWrapper<Simu> wrapper = getPageWrapper(vo, pageNum, pageSize); |
| | | |
| | | Page<Simu> page = new Page<>(pageNum, pageSize); |
| | | page.addOrder(OrderItem.desc("id")); |
| | | |
| | | IPage<Simu> paged = simuMapper.selectPage(page, wrapper); |
| | | |
| | | return paged; |
| | | } |
| | | |
| | | private QueryWrapper<Simu> getPageWrapper(Simu vo, int pageNum, int pageSize) { |
| | | QueryWrapper<Simu> wrapper = new QueryWrapper<>(); |
| | | if (null != vo.getId()) { |
| | | wrapper.eq("id", vo.getId()); |
| | | } |
| | | if (!StringHelper.isEmpty(vo.getName())) { |
| | | wrapper.like("lower(name)", vo.getName().trim().toLowerCase()); |
| | | } |
| | | if (!StringHelper.isEmpty(vo.getServiceName())) { |
| | | wrapper.like("service_name", vo.getServiceName().trim()); |
| | | } |
| | | if (null != vo.getType()) { |
| | | wrapper.eq("type", vo.getType()); |
| | | } |
| | | if (null != vo.getAreaType()) { |
| | | wrapper.eq("area_type", vo.getAreaType()); |
| | | } |
| | | if (null != vo.getStatus()) { |
| | | wrapper.eq("status", vo.getStatus()); |
| | | } |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¹éå 餿¨æ¼æ¨¡æ |
| | | * |
| | | * @param ids è¦å é¤çåºåIDå表 |
| | | * @return å 餿åçè®°å½æ° |
| | | */ |
| | | public int deleteByIds(List<Integer> ids) { |
| | | return simuMapper.deleteByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¨æ¼æ¨¡æ |
| | | * |
| | | * @param Simu æ¨æ¼æ¨¡æå¯¹è±¡ |
| | | * @return æ°å¢æåçè®°å½æ° |
| | | */ |
| | | public int insert(Simu Simu) { |
| | | return simuMapper.insert(Simu); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨æ¼æ¨¡æ |
| | | * |
| | | * @param Simu æ¨æ¼æ¨¡æå¯¹è±¡ |
| | | * @return ä¿®æ¹æåçè®°å½æ° |
| | | */ |
| | | public int updateById(Simu Simu) { |
| | | return simuMapper.updateById(Simu); |
| | | } |
| | | } |