| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.lf.server.entity.bd.DlgAgnp; |
| | | import com.lf.server.helper.PathHelper; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æµè¯ Mybatis-Plus |
| | | */ |
| | | private void testMybatisPlus() { |
| | | DlgAgnp dlg = dlgAgnpMapper.selectById(1); |
| | | dlg = dlgAgnpMapper.selectOne(2); |
| | | |
| | | Map<String, Object> map = new HashMap<String, Object>(3); |
| | | map.put("gid", 2); |
| | |
| | | |
| | | // é¡µæ° / æ¯é¡µè®°å½æ° |
| | | Page<DlgAgnp> page = new Page<>(1, 10); |
| | | // å页 / åæ°äºï¼wrapperæ¥è¯¢æ¡ä»¶ |
| | | // ååºæåº |
| | | page.addOrder(OrderItem.asc("gid")); |
| | | // å页ï¼Wrapperæ¥è¯¢æ¡ä»¶ |
| | | Page<DlgAgnp> userPage = dlgAgnpMapper.selectPage(page, null); |
| | | // æ»é¡µæ° / æ»è®°å½æ°ï¼325 / 3247 |
| | | String str = userPage.getPages() + " / " + userPage.getTotal(); |
| | | List<DlgAgnp> list4 = userPage.getRecords(); |
| | | |
| | | QueryWrapper<DlgAgnp> w3 = new QueryWrapper<>(); |
| | | w3.like("name", "å¤").ge("gid", 100); |
| | | List<DlgAgnp> list5 = dlgAgnpMapper.selectList(w3); |
| | | } |
| | | } |
| | |
| | | return new ResponseMsg<T>(HttpStatus.OK, msg, result); |
| | | } |
| | | |
| | | public <T> ResponseMsg<T> success(int count, T result) { |
| | | public <T> ResponseMsg<T> success(long count, T result) { |
| | | return new ResponseMsg<T>(HttpStatus.OK, count, result); |
| | | } |
| | | |
| | | public <T> ResponseMsg<T> success(String msg, int count, T result) { |
| | | public <T> ResponseMsg<T> success(String msg, long count, T result) { |
| | | return new ResponseMsg<T>(HttpStatus.OK, msg, count, result); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.controller.show; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.lf.server.aspect.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.bd.DlgAgnp; |
| | | import com.lf.server.service.show.ComprehensiveService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 综åå±ç¤º |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "综åå±ç¤º\\综åå±ç¤º") |
| | | @RestController |
| | | @RequestMapping("/comprehensive") |
| | | public class ComprehensiveController extends BaseController { |
| | | @Autowired |
| | | ComprehensiveService comprehensiveService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°-å°åå°å") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", example = "å¤"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectAddrByPage") |
| | | public ResponseMsg<List<DlgAgnp>> selectAddrByPage(String name, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | Page<DlgAgnp> paged = comprehensiveService.selectAddrByPage(name, pageSize, pageIndex); |
| | | |
| | | return success(paged.getTotal(), paged.getRecords()); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢-å°åå°å") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectAddrById") |
| | | public ResponseMsg<DlgAgnp> selectAddrById(Integer id) { |
| | | try { |
| | | DlgAgnp entity = comprehensiveService.selectAddrById(id); |
| | | |
| | | return success(entity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.time = time; |
| | | } |
| | | |
| | | public ResponseMsg(HttpStatus code, int count, T result) { |
| | | public ResponseMsg(HttpStatus code, long count, T result) { |
| | | this.code = code.getValue(); |
| | | this.msg = this.code == 200 ? "æå" : "失败"; |
| | | this.count = count; |
| | |
| | | this.time = System.currentTimeMillis(); |
| | | } |
| | | |
| | | public ResponseMsg(HttpStatus code, String msg, int count, T result) { |
| | | public ResponseMsg(HttpStatus code, String msg, long count, T result) { |
| | | this.code = code.getValue(); |
| | | this.msg = msg; |
| | | this.count = count; |
| | |
| | | this.time = System.currentTimeMillis(); |
| | | } |
| | | |
| | | public ResponseMsg(int code, String msg, int count, T result, long time) { |
| | | public ResponseMsg(int code, String msg, long count, T result, long time) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.count = count; |
| | |
| | | |
| | | private String msg; |
| | | |
| | | private int count; |
| | | private long count; |
| | | |
| | | private T result; |
| | | |
| | |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCount() { |
| | | public long getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(int count) { |
| | | public void setCount(long count) { |
| | | this.count = count; |
| | | } |
| | | |
| | |
| | | @TableField(select = false) |
| | | private String geom; |
| | | |
| | | @TableField(select = false) |
| | | private String eventId; |
| | | |
| | | public int getGid() { |
| | | return gid; |
| | | } |
| | |
| | | |
| | | public void setGeom(String geom) { |
| | | this.geom = geom; |
| | | } |
| | | |
| | | public String getEventId() { |
| | | return eventId; |
| | | } |
| | | |
| | | public void setEventId(String eventId) { |
| | | this.eventId = eventId; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.lf.server.entity.bd.DlgAgnp; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | /** |
| | | * å°åå°å |
| | | * @author |
| | | * @author WWW |
| | | */ |
| | | @Repository |
| | | public interface DlgAgnpMapper extends BaseMapper<DlgAgnp> { |
| | | // ææçcrudé½ç¼åå®æäº |
| | | /** |
| | | * æ¥è¯¢ä¸æ¡ |
| | | * |
| | | * @param gid |
| | | * @return |
| | | */ |
| | | @Select("select gid,gb,name,st_astext(geom) geom from bd.dlg_agnp where gid = #{gid}") |
| | | DlgAgnp selectOne(@Param("gid") Integer gid); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.service.show; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.lf.server.entity.bd.DlgAgnp; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.bd.DlgAgnpMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 综åå±ç¤º |
| | | * @author WWW |
| | | */ |
| | | @Service |
| | | public class ComprehensiveService { |
| | | @Autowired |
| | | DlgAgnpMapper dlgAgnpMapper; |
| | | |
| | | public Page<DlgAgnp> selectAddrByPage(String name, Integer pageSize, Integer pageIndex) { |
| | | Page<DlgAgnp> paging = new Page<>(pageIndex, pageSize); |
| | | paging.addOrder(OrderItem.asc("gid")); |
| | | |
| | | QueryWrapper<DlgAgnp> wrapper = null; |
| | | if (!StringHelper.isEmpty(name)) { |
| | | wrapper = new QueryWrapper<>(); |
| | | wrapper.like("name", name.trim()); |
| | | } |
| | | |
| | | return dlgAgnpMapper.selectPage(paging, wrapper); |
| | | } |
| | | |
| | | public DlgAgnp selectAddrById(Integer id) { |
| | | return dlgAgnpMapper.selectOne(id); |
| | | } |
| | | } |
| | |
| | | # datasource |
| | | datasource: |
| | | name: prod |
| | | # JDBC åºæ¬é
ç½® |
| | | # JDBC åºæ¬é
ç½® ¤tSchema=public |
| | | url: jdbc:postgresql://192.168.20.39:5433/langfang?useAffectedRows=true |
| | | username : postgres |
| | | password: postgres |
| | |
| | | 7.è§£å³Swagger-UIæ æ³ä¼ éCookieä¿¡æ¯ |
| | | 8.éªè¯å¯ç å¤æåº¦(8-20ä½å
å«åæ¯ãæ°ååç¹æ®å符) |
| | | 9.使ç¨GDAL读åtifãshpãgdbæä»¶ |
| | | a.æ·»å Mybatis Plusç»ä»¶ |
| | | b.è§£å³è¡¨æ å°åºéãæ ¹æ®IDæ¥è¯¢å¤±è´¥ãåé¡µæ æçé®é¢ |
| | | |
| | | ----------------------------------------------- |
| | | .åå°æå¡è®¿é®æ·»å ç»å½éªè¯æ¦æªå¨ |
| | | .å¼åå颿¥å¿åè½ |
| | |
| | | .Redisæå¡é
置强å¯ç |
| | | .æ·»å æ¹éä¿®æ¹ç¨æ·å¯ç æ¥å£ |
| | | .ä¿®æ¹ææçæ¹éæ°å¢ãå é¤ãä¿®æ¹æ¥å£ |
| | | .å¼å大æä»¶ä¸ä¼ æ¥å£ |
| | | .è§£å³ä¸ä¼ æä»¶æ¶å®ä½ç±»æ å°å¼å¸¸ |
| | | |
| | | ----------------------------------------------- |
| | | 1.ä¸ä¼ æä»¶ï¼commons-fileuploadï¼ * |
| | |
| | | javaåjså®ç°aeså å¯è§£å¯ï¼ |
| | | https://blog.csdn.net/weixin_30663839/article/details/114049667 |
| | | |
| | | |
| | | http://192.168.20.39:12306/ |
| | | http://192.168.20.39:12315/ |
| | | http://192.168.20.39:12316/ |
| | | ---------------------------------------------------------------------------------------------------- |
| | | String path = System.getProperty("user.dir"); |
| | | |