管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-10 f1f07a3213a41c6e41bc56d268b7f8e3a67c057d
1
已修改12个文件
263 ■■■■■ 文件已修改
data/db.sql 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/sys/OperateController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/sys/ResOpController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/sys/OperateEntity.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/sys/ResOpEntity.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/sys/LoginMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/sys/OperateMapper.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/sys/ResOpMapper.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/OperateService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/ResOpService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/OperateMapper.xml 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/ResOpMapper.xml 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db.sql
@@ -311,13 +311,15 @@
alter table lf.sys_operate add column modular1 varchar(50);
alter table lf.sys_operate add column modular2 varchar(50);
alter table lf.sys_operate drop column modular;
select split_part(modular,'\',1),split_part(modular,'\',2) from lf.sys_operate;
update lf.sys_operate set modular1=split_part(modular,'\',1),modular2=split_part(modular,'\',2);
delete from lf.sys_operate where modular is null and modular2 is null;
/*insert into lf.sys_operate (modular,url,ip,type) values ('数据管理\目录管理','data/manage/update','192.168.20.106',5);
insert into lf.sys_operate (modular,url,ip,type,optime) values ('数据管理\目录管理','data/manage/delete','192.168.20.107',4,'2024-01-02');*/
select * from lf.sys_operate where modular is null or ;
select a.*,b.uname from lf.sys_operate a inner join lf.sys_user b on a.userid = b.id;
select * from lf.sys_operate;
select * from lf.sys_operate_2022;
select * from lf.sys_operate_2024;
----------------------------------------------------------------------------------------------------- 7.令牌表
@@ -441,8 +443,11 @@
comment on column lf.sys_res_op.optime is '创建时间';
/*insert into lf.sys_res_op (resid,ip,type) values (1,'192.168.20.106',5);
insert into lf.sys_res_op (resid,ip,type) values (1,'192.168.20.106',1);
insert into lf.sys_res_op (resid,ip,type,optime) values (1,'192.168.20.107',4,'2024-01-02');*/
select a.*,b.uname,c.name from lf.sys_res_op a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id;
select * from lf.sys_res_op;
select * from lf.sys_res_op_2022;
select * from lf.sys_res_op_2024;
src/main/java/com/lf/server/controller/sys/OperateController.java
@@ -12,6 +12,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.List;
/**
@@ -29,12 +30,15 @@
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "登录人ID", dataType = "String", paramType = "query", required = false, example = "sys_operate")
            @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "管理员"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(String userid) {
    public ResponseMsg<Integer> selectCount(String uname, Integer type, Timestamp start, Timestamp end) {
        try {
            int count = operateService.selectCount(userid);
            int count = operateService.selectCount(uname, type, start, end);
            return success(count);
        } catch (Exception ex) {
@@ -45,17 +49,20 @@
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "登录人ID", dataType = "String", paramType = "query", example = "sys_operate"),
            @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "管理员"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"),
            @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<OperateEntity>> selectByPage(String userid, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<OperateEntity>> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<OperateEntity> rs = operateService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            List<OperateEntity> rs = operateService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
@@ -65,23 +72,26 @@
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "登录人ID", dataType = "String", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "管理员"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"),
            @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<OperateEntity>> selectByPageAndCount(String userid, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<OperateEntity>> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = operateService.selectCount(userid);
            int count = operateService.selectCount(uname, type, start, end);
            if (count == 0) {
                return success(0, null);
            }
            List<OperateEntity> rs = operateService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            List<OperateEntity> rs = operateService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
src/main/java/com/lf/server/controller/sys/ResOpController.java
@@ -12,6 +12,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.List;
/**
@@ -29,12 +30,15 @@
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "登录人ID", dataType = "String", paramType = "query", required = false, example = "sys_res_op")
            @ApiImplicitParam(name = "name", value = "资源名称", dataType = "String", paramType = "query", example = "天地图"),
            @ApiImplicitParam(name = "type", value = "操作类型", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"),
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(String userid) {
    public ResponseMsg<Integer> selectCount(String name, Integer type, Timestamp start, Timestamp end) {
        try {
            int count = resOpService.selectCount(userid);
            int count = resOpService.selectCount(name, type, start, end);
            return success(count);
        } catch (Exception ex) {
@@ -45,17 +49,20 @@
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "登录人ID", dataType = "String", paramType = "query", example = "sys_res_op"),
            @ApiImplicitParam(name = "name", value = "资源名称", dataType = "String", paramType = "query", example = "天地图"),
            @ApiImplicitParam(name = "type", value = "操作类型", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"),
            @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<ResOpEntity>> selectByPage(String userid, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<ResOpEntity>> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<ResOpEntity> rs = resOpService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
@@ -65,23 +72,26 @@
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userid", value = "登录人ID", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "name", value = "资源名称", dataType = "String", paramType = "query", example = "天地图"),
            @ApiImplicitParam(name = "type", value = "操作类型", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"),
            @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<ResOpEntity>> selectByPageAndCount(String userid, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<ResOpEntity>> selectByPageAndCount(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = resOpService.selectCount(userid);
            int count = resOpService.selectCount(name, type, start, end);
            if (count == 0) {
                return success(0, null);
            }
            List<ResOpEntity> rs = resOpService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1));
            List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
src/main/java/com/lf/server/entity/sys/OperateEntity.java
@@ -13,7 +13,7 @@
    private int id;
    private String modular;
    private String uname;
    private String modular1;
@@ -43,12 +43,12 @@
        this.id = id;
    }
    public String getModular() {
        return modular;
    public String getUname() {
        return uname;
    }
    public void setModular(String modular) {
        this.modular = modular;
    public void setUname(String uname) {
        this.uname = uname;
    }
    public String getModular1() {
src/main/java/com/lf/server/entity/sys/ResOpEntity.java
@@ -10,10 +10,13 @@
 */
public class ResOpEntity implements Serializable {
    private static final long serialVersionUID = -7322438248126715583L;
    private int id;
    private String uname;
    private String name;
    private int resid;
@@ -33,6 +36,22 @@
        this.id = id;
    }
    public String getUname() {
        return uname;
    }
    public void setUname(String uname) {
        this.uname = uname;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getResid() {
        return resid;
    }
src/main/java/com/lf/server/mapper/sys/LoginMapper.java
@@ -16,7 +16,7 @@
@ResponseBody
public interface LoginMapper {
    /**
     * 根据表名查询记录数
     * 查询记录数
     *
     * @param uname
     * @param type
@@ -27,7 +27,7 @@
    public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end);
    /**
     * 根据表名分页查询
     * 分页查询
     *
     * @param uname
     * @param type
src/main/java/com/lf/server/mapper/sys/OperateMapper.java
@@ -4,6 +4,7 @@
import org.apache.ibatis.annotations.Mapper;
import org.springframework.web.bind.annotation.ResponseBody;
import java.sql.Timestamp;
import java.util.List;
/**
@@ -15,22 +16,26 @@
@ResponseBody
public interface OperateMapper {
    /**
     * 根据表名查询记录数
     *
     * @param userid 登录人ID
     * @return 记录数
     * 查询记录数
     * @param uname
     * @param type
     * @param start
     * @param end
     * @return
     */
    public Integer selectCount(String userid);
    public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end);
    /**
     * 根据表名分页查询
     *
     * @param userid 表名
     * @param limit  记录表
     * @param offset 偏移量
     * @return 列表
     * 分页查询
     * @param uname
     * @param type
     * @param start
     * @param end
     * @param limit
     * @param offset
     * @return
     */
    public List<OperateEntity> selectByPage(String userid, Integer limit, Integer offset);
    public List<OperateEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset);
    /**
     * 添加数据
src/main/java/com/lf/server/mapper/sys/ResOpMapper.java
@@ -4,6 +4,7 @@
import org.apache.ibatis.annotations.Mapper;
import org.springframework.web.bind.annotation.ResponseBody;
import java.sql.Timestamp;
import java.util.List;
/**
@@ -15,22 +16,29 @@
@ResponseBody
public interface ResOpMapper {
    /**
     * 根据表名查询记录数
     * 查询记录数
     *
     * @param userid 登录人ID
     * @return 记录数
     * @param name
     * @param type
     * @param start
     * @param end
     * @return
     */
    public Integer selectCount(String userid);
    public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end);
    /**
     * 根据表名分页查询
     * 分页查询
     *
     * @param userid 表名
     * @param limit  记录表
     * @param offset 偏移量
     * @return 列表
     * @param name
     * @param type
     * @param start
     * @param end
     * @param type
     * @param start
     * @param end
     * @return
     */
    public List<ResOpEntity> selectByPage(String userid, Integer limit, Integer offset);
    public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset);
    /**
     * 添加数据
src/main/java/com/lf/server/service/sys/OperateService.java
@@ -1,10 +1,12 @@
package com.lf.server.service.sys;
import com.lf.server.entity.sys.OperateEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.mapper.sys.OperateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.List;
/**
@@ -18,13 +20,17 @@
    OperateMapper operateMapper;
    @Override
    public Integer selectCount(String userid) {
        return operateMapper.selectCount(userid);
    public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) {
        uname = StringHelper.isNull(uname) ? null : "%" + uname.trim() + "%";
        return operateMapper.selectCount(uname, type, start, end);
    }
    @Override
    public List<OperateEntity> selectByPage(String userid, Integer limit, Integer offset) {
        return operateMapper.selectByPage(userid,limit,offset);
    public List<OperateEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) {
        uname = StringHelper.isNull(uname) ? null : "%" + uname.trim() + "%";
        return operateMapper.selectByPage(uname, type, start, end, limit, offset);
    }
    @Override
src/main/java/com/lf/server/service/sys/ResOpService.java
@@ -1,10 +1,12 @@
package com.lf.server.service.sys;
import com.lf.server.entity.sys.ResOpEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.mapper.sys.ResOpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.List;
/**
@@ -18,13 +20,17 @@
    ResOpMapper resOpMapper;
    @Override
    public Integer selectCount(String userid) {
        return resOpMapper.selectCount(userid);
    public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end) {
        name = StringHelper.isNull(name) ? null : "%" + name.trim() + "%";
        return resOpMapper.selectCount(name, type, start, end);
    }
    @Override
    public List<ResOpEntity> selectByPage(String userid, Integer limit, Integer offset) {
        return resOpMapper.selectByPage(userid, limit, offset);
    public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) {
        name = StringHelper.isNull(name) ? null : "%" + name.trim() + "%";
        return resOpMapper.selectByPage(name, type, start, end, limit, offset);
    }
    @Override
src/main/resources/mapper/sys/OperateMapper.xml
@@ -1,26 +1,43 @@
<?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.lf.server.mapper.sys.OperateMapper">
    <!-- 统计行数 -->
    <select id="selectCount" resultType="java.lang.Integer" parameterType="java.lang.String">
        select count(*) from lf.sys_operate
        select count(*) from lf.sys_operate a inner join lf.sys_user b on a.userid = b.id
        <where>
            <if test="userid != null">
                userid = #{userid}
            1 = 1
            <if test="uname != null">
                and b.uname like #{uname}
            </if>
            <if test="type != null">
                and a.type = #{type}
            </if>
            <if test="start != null">
                and a.optime &gt;= #{start}
            </if>
            <if test="end != null">
                and a.optime &lt;= #{end}
            </if>
        </where>
    </select>
    <!-- 分页查询 -->
    <select id="selectByPage" resultType="com.lf.server.entity.sys.OperateEntity">
        select * from lf.sys_operate
        select a.*,b.uname from lf.sys_operate a inner join lf.sys_user b on a.userid = b.id
        <where>
            <if test="userid != null">
                userid = #{userid}
            1 = 1
            <if test="uname != null">
                and b.uname like #{uname}
            </if>
            <if test="type != null">
                and a.type = #{type}
            </if>
            <if test="start != null">
                and a.optime &gt;= #{start}
            </if>
            <if test="end != null">
                and a.optime &lt;= #{end}
            </if>
        </where>
        order by id
        order by a.id
        limit #{limit} offset #{offset}
    </select>
src/main/resources/mapper/sys/ResOpMapper.xml
@@ -1,26 +1,43 @@
<?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.lf.server.mapper.sys.ResOpMapper">
    <!-- 统计行数 -->
    <select id="selectCount" resultType="java.lang.Integer" parameterType="java.lang.String">
        select count(*) from lf.sys_res_op
        select count(*) from lf.sys_res_op a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id
        <where>
            <if test="userid != null">
                userid = #{userid}
            1 = 1
            <if test="name != null">
                and c.name like #{name}
            </if>
            <if test="type != null">
                and a.type = #{type}
            </if>
            <if test="start != null">
                and a.optime &gt;= #{start}
            </if>
            <if test="end != null">
                and a.optime &lt;= #{end}
            </if>
        </where>
    </select>
    <!-- 分页查询 -->
    <select id="selectByPage" resultType="com.lf.server.entity.sys.ResOpEntity">
        select * from lf.sys_res_op
        select a.*,b.uname,c.name from lf.sys_res_op a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id
        <where>
            <if test="userid != null">
                userid = #{userid}
            1 = 1
            <if test="name != null">
                and c.name like #{name}
            </if>
            <if test="type != null">
                and a.type = #{type}
            </if>
            <if test="start != null">
                and a.optime &gt;= #{start}
            </if>
            <if test="end != null">
                and a.optime &lt;= #{end}
            </if>
        </where>
        order by id
        order by a.id
        limit #{limit} offset #{offset}
    </select>