管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-20 789ae490b01b03de5b3e1009518c298b6c8ca2b9
1
已修改3个文件
91 ■■■■■ 文件已修改
src/main/java/com/lf/server/controller/sys/TokenController.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/sys/TokenEntity.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/TokenMapper.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/sys/TokenController.java
@@ -30,48 +30,10 @@
    TokenService tokenService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "令牌", dataType = "String", paramType = "query", required = false, example = "sys_token"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "sys_token"),
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(String name,Integer type) {
        try {
            int count = tokenService.selectCount(name,type);
            return success(count);
        } catch (Exception ex) {
            return fail(ex, -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "令牌", dataType = "String", paramType = "query", example = ""),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "0"),
            @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<TokenEntity>> selectByPage(String name, Integer type,Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<TokenEntity> rs = tokenService.selectByPage(name,type, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "令牌", dataType = "String", paramType = "query", example = "sys_token"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "sys_token"),
            @ApiImplicitParam(name = "name", value = "令牌", dataType = "String", paramType = "query", example = "ec101de8-1403-4d8f-ad13-edab8358399b"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "0"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
@@ -195,7 +157,7 @@
    @SysLog()
    @ApiOperation(value = "根据ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1")
            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1658")
    })
    @GetMapping(value = "/selectToken")
    public ResponseMsg<TokenEntity> selectToken(int id) {
@@ -203,18 +165,6 @@
            TokenEntity tokenEntity = tokenService.selectToken(id);
            return success(tokenEntity);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectTokenAll")
    public ResponseMsg<List<TokenEntity>> selectTokenAll() {
        try {
            List<TokenEntity> list = tokenService.selectTokenAll();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
src/main/java/com/lf/server/entity/sys/TokenEntity.java
@@ -33,6 +33,10 @@
    private Timestamp updateTime;
    private String createName;
    private String updateName;
    public int getId() {
        return id;
    }
@@ -120,4 +124,20 @@
    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }
    public String getCreateName() {
        return createName;
    }
    public void setCreateName(String createName) {
        this.createName = createName;
    }
    public String getUpdateName() {
        return updateName;
    }
    public void setUpdateName(String updateName) {
        this.updateName = updateName;
    }
}
src/main/resources/mapper/sys/TokenMapper.xml
@@ -25,7 +25,8 @@
    <!-- 分页查询 -->
    <select id="selectByPage" resultMap="resultMap" resultType="com.lf.server.entity.sys.TokenEntity">
        select * from lf.sys_token
        select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_token a
        <where>
            1=1
            <if test="name != null">
@@ -40,16 +41,16 @@
        limit #{limit} offset #{offset}
    </select>
    <select id="selectTokenAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.TokenEntity">
        select * from lf.sys_token order by id desc
    </select>
    <select id="selectToken" resultMap="resultMap" resultType="com.lf.server.entity.sys.TokenEntity">
        select * from lf.sys_token where id = #{id}
        select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_token a
        where id = #{id}
    </select>
    <select id="selectOneByToken" resultType="com.lf.server.entity.sys.TokenEntity">
        select a.*,fn_uname(a.create_user) uname from lf.sys_token a where token = #{token} and expire > now() limit 1
        select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_token a
        where token = #{token} and expire > now() limit 1
    </select>
    <insert id="insertToken" parameterType="com.lf.server.entity.sys.TokenEntity">