jeecgbot 创建helloworld

上一篇

打开ideal

1.在后端项目jeecg-boot-module-system\src\main\java\org\jeecg\modules中创建test文件夹
2.在test文件夹中创建JeecgTestController Java类

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test/jeecgTest")
@Slf4j
public class JeecgTestController {

    /**
     * hello world
     * 
     * @param id
     * @return
     */
    @GetMapping(value = "/hello")
    public Result<String> hello() {
        Result<String> result = new Result<String>();
        result.setResult("Hello World!");
        result.setSuccess(true);
        log.info("------------Hello world------");
        return result;
    }
}

3.在jeecg-boot-module-system\src\main\java\org\jeecg\config\ShiroConfig.java拦截器中允许访问刚才的controller,设置如下
在这里插入图片描述
4.运行后端项目,测试如下
在这里插入图片描述
5.
http://localhost:8080/jeecg-boot/swagger-ui.html#/
模仿postman发送get/post等请求

打开webstrom

1.打开前端项目
在ant-design-vue-jeecg\src\views\jeecg\tablist中建立test.vue
2.前后端项目运行在前端访问
图中test.vue中的代码是最终结果先不用管,但test.vue需要有基本的组件结构(如下)

<template>
  
</template>

<script>

</script>

<style>
</style>

在这里插入图片描述
3.登录
在这里插入图片描述
4.配置菜单
在这里插入图片描述

在这里插入图片描述

5.授权
在这里插入图片描述
在这里插入图片描述
6.刷新页面在这里插入图片描述
7.完善webstrom建立的test.vue文件

<template>
  <div>
    {{ message }}  hhhhh
  </div>
</template>

<script>
import { getAction } from '@/api/manage'

export default {
  data() {
    return {
      message: ''
    }
  },
  created() {//页面渲染前加载,mutation页面渲染后加载
    getAction('/test/jeecgTest/hello').then((res) => {
      console.log('------------')
      console.log(res)
      this.message = res.result;
    })
  }
}
</script>

<style>
</style>

测试成功
在这里插入图片描述

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月屯

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值