微服务 服务中台 服务后台 开发案例 3

目录

一、admin-service管理员后台的搭建

1、环境测试

 2、登录功能的实现

3、权限数据的CRUD

4、员工查询操作

5、后台管理员权限配置

6、系统日志记录


序配置中心完善后,自动导入了Mybatis以后

一、admin-service管理员后台的搭建

1、环境测试

添加启动类和bootstrap.yml

bootstrap.yml

spring:
  application:
    name: admin-service
  cloud:
    nacos:
      server-addr: nacos-server:8848
      config:
        file-extension: yaml
  profiles:
    active: dev
# 拉取的配置文件的dataID=admin-service-dev.yaml

nacos映射配置

server:
    port: 8080
spring:
    datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://mysql-server:3307/coin-exchange?serverTimezone=UTC%2B8
        username: root
        password: WXL1214??
    redis:
        host: redis-server
        port: 6380
        password: WXL1214??
    cloud:
        sentinel:
            transport:
                dashboard: sentinel-dashboard:8858

mybatis-plus:
    configuration:
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    mapper-locations: classpath:/mappers/*Mapper.xml
jetcache:
    statIntervalMinutes: 15
    areaInCacheName: false
    local:
        default:
            type: linkedhashmap
            keyConvertor: fastjson
    remote:
        default:
            type: redis
            keyConvertor: fastjson
            valueEncoder: kryo
            valueDecoder: kryo
            poolConfig:
                minIdle: 5
                maxIdle: 20
                maxTotal: 50
            host: ${spring.redis.host}
            port: ${spring.redis.port}
            password: ${spring.redis.password}
swagger2:
    basePackage: com.dragonwu.controller
    name: liangtiandong
    url: www.liangtiandong.com
    email: liangtiandong@live.com
    title: 后台管理系统API接口
    description: 后台管理系统API接口演示
    version: 1.0
    termsOfServiceUrl: www.dragonwu.com

 添加测试类

package com.dragonwu.controller;

import com.dragonwu.domain.SysUser;
import com.dragonwu.model.R;
import com.dragonwu.service.SysUserService;
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.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "后台管理系统的测试接口")
public class TestController {
    @Autowired
    private SysUserService sysUserService;

    @ApiOperation(value = "查询用户详情")
    @GetMapping("/user/info/{id}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "用户的ID")
    })
    public R<SysUser> getSysUserInfo(@PathVariable("id")Long id){
        SysUser sysUser=sysUserService.getById(id);
        return R.ok(sysUser);
    }
}

运行测试,接口没问题

 2、登录功能的实现

见我的另一篇博客:微服务 管理员登录功能实现案例_Dragon Wu的博客-CSDN博客

3、权限数据的CRUD

微服务 后台 权限数据的CRUD 案例_Dragon Wu的博客-CSDN博客

4、员工查询操作

微服务项目 员工的查询操作_Dragon Wu的博客-CSDN博客

5、后台管理员权限配置

微服务项目 后台管理员角色管理 权限管理 案例_Dragon Wu的博客-CSDN博客

6、系统日志记录

​​​​​​微服务 系统日志记录 案例_Dragon Wu的博客-CSDN博客

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值