管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-19 73e8f38ca1c41290d129dddbce3cb7136c7b4c89
1
已添加2个文件
已修改7个文件
已删除1个文件
179 ■■■■ 文件已修改
src/main/java/com/lf/server/config/InitConfig.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/all/BaseController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/ComprehensiveController.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/PipelineController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/all/ResponseMsg.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/bd/DlgAgnp.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/bd/DlgAgnpMapper.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/ComprehensiveService.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
说明.txt 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/config/InitConfig.java
@@ -2,6 +2,7 @@
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;
@@ -59,8 +60,12 @@
        }
    }
    /**
     * æµ‹è¯• 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);
@@ -88,10 +93,16 @@
        // é¡µæ•° / æ¯é¡µè®°å½•æ•°
        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);
    }
}
src/main/java/com/lf/server/controller/all/BaseController.java
@@ -20,11 +20,11 @@
        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);
    }
src/main/java/com/lf/server/controller/show/ComprehensiveController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
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);
        }
    }
}
src/main/java/com/lf/server/controller/show/PipelineController.java
ÎļþÒÑɾ³ý
src/main/java/com/lf/server/entity/all/ResponseMsg.java
@@ -31,7 +31,7 @@
        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;
@@ -39,7 +39,7 @@
        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;
@@ -47,7 +47,7 @@
        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;
@@ -59,7 +59,7 @@
    private String msg;
    private int count;
    private long count;
    private T result;
@@ -81,11 +81,11 @@
        this.msg = msg;
    }
    public int getCount() {
    public long getCount() {
        return count;
    }
    public void setCount(int count) {
    public void setCount(long count) {
        this.count = count;
    }
src/main/java/com/lf/server/entity/bd/DlgAgnp.java
@@ -29,9 +29,6 @@
    @TableField(select = false)
    private String geom;
    @TableField(select = false)
    private String eventId;
    public int getGid() {
        return gid;
    }
@@ -62,13 +59,5 @@
    public void setGeom(String geom) {
        this.geom = geom;
    }
    public String getEventId() {
        return eventId;
    }
    public void setEventId(String eventId) {
        this.eventId = eventId;
    }
}
src/main/java/com/lf/server/mapper/bd/DlgAgnpMapper.java
@@ -2,14 +2,22 @@
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);
}
src/main/java/com/lf/server/service/show/ComprehensiveService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
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);
    }
}
src/main/resources/application.yml
@@ -38,7 +38,7 @@
  # datasource
  datasource:
    name: prod
    # JDBC åŸºæœ¬é…ç½®
    # JDBC åŸºæœ¬é…ç½® &currentSchema=public
    url: jdbc:postgresql://192.168.20.39:5433/langfang?useAffectedRows=true
    username : postgres
    password: postgres
˵Ã÷.txt
@@ -8,6 +8,9 @@
7.解决Swagger-UI无法传递Cookie信息
8.验证密码复杂度(8-20位包含字母、数字和特殊字符)
9.使用GDAL读取tif、shp、gdb文件
a.添加Mybatis Plus组件
b.解决表映射出错、根据ID查询失败、分页无效等问题
-----------------------------------------------
.后台服务访问添加登录验证拦截器
.开发切面日志功能
@@ -17,6 +20,8 @@
.Redis服务配置强密码
.添加批量修改用户密码接口
.修改所有的批量新增、删除、修改接口
.开发大文件上传接口
.解决上传文件时实体类映射异常
-----------------------------------------------
1.上传文件(commons-fileupload) *
@@ -49,7 +54,9 @@
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");