月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-07-31 cd141865ed4082bb3218e3d197cacc5c412027cd
修改图层管理的接口
已重命名4个文件
已添加1个文件
已修改2个文件
已删除1个文件
332 ■■■■■ 文件已修改
src/main/java/com/moon/server/controller/all/PermsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/sys/LayerController.java 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/entity/sys/LayerEntity.java 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/mapper/sys/LayerMapper.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/sys/LayerService.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/data/LayerMapper.xml 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/LayerMapper.xml 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/all/PermsController.java
@@ -5,7 +5,7 @@
import com.moon.server.entity.sys.ResEntity;
import com.moon.server.entity.sys.UserEntity;
import com.moon.server.service.all.PermsService;
import com.moon.server.service.data.LayerService;
import com.moon.server.service.sys.LayerService;
import com.moon.server.service.sys.MenuService;
import com.moon.server.service.sys.TokenService;
import com.moon.server.entity.all.*;
src/main/java/com/moon/server/controller/sys/LayerController.java
ÎļþÃû´Ó src/main/java/com/moon/server/controller/data/LayerController.java ÐÞ¸Ä
@@ -1,11 +1,11 @@
package com.moon.server.controller.data;
package com.moon.server.controller.sys;
import com.moon.server.annotation.SysLog;
import com.moon.server.controller.all.BaseController;
import com.moon.server.entity.all.ResponseMsg;
import com.moon.server.entity.data.LayerEntity;
import com.moon.server.entity.sys.LayerEntity;
import com.moon.server.entity.sys.UserEntity;
import com.moon.server.service.data.LayerService;
import com.moon.server.service.sys.LayerService;
import com.moon.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,10 +18,10 @@
import java.util.List;
/**
 * å›¾å±‚管理
 * å›¾å±‚
 * @author WWW
 */
@Api(tags = "数据管理\\图层管理")
@Api(tags = "运维管理\\图层管理")
@RestController
@RequestMapping("/layer")
public class LayerController extends BaseController {
@@ -32,63 +32,25 @@
    TokenService tokenService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cnName", value = "中文名称", dataType = "String", paramType = "query", required = false, example = "")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(String cnName) {
        try {
            int count = layerService.selectCount(cnName);
            return success(count);
        } catch (Exception ex) {
            return fail(ex, -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cnName", 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 = "/selectByPage")
    public ResponseMsg<List<LayerEntity>> selectByPage(String cnName, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cnName", value = "中文名称", dataType = "String", paramType = "query", example = ""),
            @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 = "/selectByPageAndCount")
    public ResponseMsg<List<LayerEntity>> selectByPageAndCount(String cnName, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<LayerEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = layerService.selectCount(cnName);
            int count = layerService.selectCount(name);
            if (count == 0) {
                return success(0, null);
            }
            List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1));
            List<LayerEntity> rs = layerService.selectByPage(name, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
src/main/java/com/moon/server/entity/sys/LayerEntity.java
ÎļþÃû´Ó src/main/java/com/moon/server/entity/data/LayerEntity.java ÐÞ¸Ä
@@ -1,4 +1,4 @@
package com.moon.server.entity.data;
package com.moon.server.entity.sys;
import java.io.Serializable;
import java.sql.Timestamp;
@@ -8,7 +8,7 @@
 * @author WWW
 */
public class LayerEntity implements Serializable {
    private static final long serialVersionUID = -159911666139919168L;
    private static final long serialVersionUID = -371902381708800000L;
    private int id;
@@ -20,9 +20,7 @@
    private String url;
    private String testUrl;
    private int type;
    private int isLayer;
    private String icon;
@@ -30,7 +28,7 @@
    private int orderNum;
    private int isShow;
    private int status;
    private int createUser;
@@ -42,17 +40,11 @@
    private String bak;
    private String serveType;
    private String dataType;
    private double elev;
    private String ns;
    private int resid;
    private Integer pubid;
    private Integer isProject;
    private int type;
    public LayerEntity() {
    }
@@ -97,20 +89,12 @@
        this.url = url;
    }
    public String getTestUrl() {
        return testUrl;
    public int getIsLayer() {
        return isLayer;
    }
    public void setTestUrl(String testUrl) {
        this.testUrl = testUrl;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    public void setIsLayer(int isLayer) {
        this.isLayer = isLayer;
    }
    public String getIcon() {
@@ -137,12 +121,12 @@
        this.orderNum = orderNum;
    }
    public int getIsShow() {
        return isShow;
    public int getStatus() {
        return status;
    }
    public void setIsShow(int isShow) {
        this.isShow = isShow;
    public void setStatus(int status) {
        this.status = status;
    }
    public int getCreateUser() {
@@ -185,22 +169,6 @@
        this.bak = bak;
    }
    public String getServeType() {
        return serveType;
    }
    public void setServeType(String serveType) {
        this.serveType = serveType;
    }
    public String getDataType() {
        return dataType;
    }
    public void setDataType(String dataType) {
        this.dataType = dataType;
    }
    public double getElev() {
        return elev;
    }
@@ -209,27 +177,19 @@
        this.elev = elev;
    }
    public String getNs() {
        return ns;
    public int getResid() {
        return resid;
    }
    public void setNs(String ns) {
        this.ns = ns;
    public void setResid(int resid) {
        this.resid = resid;
    }
    public Integer getPubid() {
        return pubid;
    public int getType() {
        return type;
    }
    public void setPubid(Integer pubid) {
        this.pubid = pubid;
    }
    public Integer getIsProject() {
        return isProject;
    }
    public void setIsProject(Integer isProject) {
        this.isProject = isProject;
    public void setType(int type) {
        this.type = type;
    }
}
src/main/java/com/moon/server/mapper/sys/LayerMapper.java
ÎļþÃû´Ó src/main/java/com/moon/server/mapper/data/LayerMapper.java ÐÞ¸Ä
@@ -1,6 +1,6 @@
package com.moon.server.mapper.data;
package com.moon.server.mapper.sys;
import com.moon.server.entity.data.LayerEntity;
import com.moon.server.entity.sys.LayerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@@ -16,20 +16,20 @@
    /**
     * æŸ¥è¯¢è®°å½•æ•°
     *
     * @param cnName ä¸­æ–‡åç§°
     * @param name åç§°
     * @return è®°å½•æ•°
     */
    public Integer selectCount(String cnName);
    public Integer selectCount(String name);
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param cnName   ä¸­æ–‡åç§°
     * @param name   åç§°
     * @param limit  è®°å½•æ•°
     * @param offset åç§»é‡
     * @return åˆ—表
     */
    public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset);
    public List<LayerEntity> selectByPage(String name, Integer limit, Integer offset);
    /**
     * æŸ¥è¯¢æ‰€æœ‰
src/main/java/com/moon/server/service/sys/LayerService.java
ÎļþÃû´Ó src/main/java/com/moon/server/service/data/LayerService.java ÐÞ¸Ä
@@ -1,8 +1,8 @@
package com.moon.server.service.data;
package com.moon.server.service.sys;
import com.moon.server.entity.data.LayerEntity;
import com.moon.server.entity.sys.LayerEntity;
import com.moon.server.helper.StringHelper;
import com.moon.server.mapper.data.LayerMapper;
import com.moon.server.mapper.sys.LayerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -18,17 +18,17 @@
    LayerMapper layerMapper;
    @Override
    public Integer selectCount(String cnName) {
        cnName = StringHelper.getLikeUpperStr(cnName);
    public Integer selectCount(String name) {
        name = StringHelper.getLikeUpperStr(name);
        return layerMapper.selectCount(cnName);
        return layerMapper.selectCount(name);
    }
    @Override
    public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset) {
        cnName = StringHelper.getLikeUpperStr(cnName);
    public List<LayerEntity> selectByPage(String name, Integer limit, Integer offset) {
        name = StringHelper.getLikeUpperStr(name);
        return layerMapper.selectByPage(cnName, limit, offset);
        return layerMapper.selectByPage(name, limit, offset);
    }
    @Override
src/main/resources/application.yml
@@ -12,10 +12,10 @@
  # redis
  redis:
    database: 0
    host: 127.0.0.1
    host: 192.168.20.83
    port: 6369
    password: rediS_5L#F4_Server
    timeout: 10000  # è¿žæŽ¥è¶…时时长(毫秒)
    timeout: 90000  # è¿žæŽ¥è¶…时时长(毫秒)
    lettuce:
      pool:
        max-active: 1000  # è¿žæŽ¥æ± æœ€å¤§è¿žæŽ¥æ•°ï¼ˆä½¿ç”¨è´Ÿå€¼è¡¨ç¤ºæ²¡æœ‰é™åˆ¶ï¼‰
@@ -42,11 +42,11 @@
  datasource:
    name: prod
    # JDBC åŸºæœ¬é…ç½® &currentSchema=public
    #url: jdbc:postgresql://192.168.20.83:5433/moon?useAffectedRows=true
    url: jdbc:postgresql://127.0.0.1:5433/moon?useAffectedRows=true
    url: jdbc:postgresql://192.168.20.83:5433/moon?useAffectedRows=true
    #url: jdbc:postgresql://127.0.0.1:5433/moon?useAffectedRows=true
    username : postgres
    #password: Postgres!_14_moon
    password: postgres
    password: Postgres!_14_moon
    #password: postgres
    driver-class-name: org.postgresql.Driver
    platform: POSTGRESQL
    type: com.alibaba.druid.pool.DruidDataSource
src/main/resources/mapper/data/LayerMapper.xml
ÎļþÒÑɾ³ý
src/main/resources/mapper/sys/LayerMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.moon.server.mapper.sys.LayerMapper">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_layer
        <where>
            <if test="name != null">
                upper(cn_name) like #{name} or upper(en_name) like #{name}
            </if>
        </where>
    </select>
    <select id="selectByPage" resultType="com.moon.server.entity.sys.LayerEntity">
        select * from lf.sys_layer
        <where>
            <if test="name != null">
                upper(cn_name) like #{name} or upper(en_name) like #{name}
            </if>
        </where>
        order by id desc
        limit #{limit} offset #{offset}
    </select>
    <select id="selectAll" resultType="com.moon.server.entity.sys.LayerEntity">
        select * from lf.sys_layer order by id desc;
    </select>
    <select id="selectById" resultType="com.moon.server.entity.sys.LayerEntity">
        select * from lf.sys_layer where id = #{id}
    </select>
    <insert id="insert" parameterType="com.moon.server.entity.sys.LayerEntity">
        insert into lf.sys_layer
        (pid,cn_name,en_name,url,is_layer,icon,level,order_num,status,create_user,create_time,bak,elev,resid,type)
        values
        (#{pid},#{cnName},#{enName},#{url},#{isLayer},#{icon},#{level},#{orderNum},#{status},#{createUser},now(),#{bak},#{elev},#{resid},#{type})
    </insert>
    <insert id="inserts">
        insert into lf.sys_layer
        (pid,cn_name,en_name,url,is_layer,icon,level,order_num,status,create_user,create_time,bak,elev,resid,type)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.pid},#{item.cnName},#{item.enName},#{item.url},#{item.isLayer},#{item.icon},#{item.level},#{item.orderNum},#{item.status},#{item.createUser},now(),#{item.bak},#{item.elev},#{item.resid},#{item.type})
        </foreach>
    </insert>
    <delete id="delete">
        delete from lf.sys_layer where id = #{id}
    </delete>
    <delete id="deletes">
        delete from lf.sys_layer where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <update id="update">
        update lf.sys_layer
        set pid=#{pid},cn_name=#{cnName},en_name=#{enName},url=#{url},is_layer=#{isLayer},icon=#{icon},level=#{level},order_num=#{orderNum},status=#{status},update_user=#{updateUser},update_time=now(),bak=#{bak},elev=#{elev},resid=#{resid},type=#{type}
        where id=#{id}
    </update>
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update lf.sys_layer
            set pid=#{item.pid},cn_name=#{item.cnName},en_name=#{item.enName},url=#{item.url},is_layer=#{item.isLayer},icon=#{item.icon},level=#{item.level},order_num=#{item.orderNum},status=#{item.status},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},elev=#{item.elev},resid=#{item.resid},type=#{item.type}
            where id = #{item.id}
        </foreach>
    </update>
</mapper>