SpringBoot2+Vue2实战(十二)springboot一对一,一对多查询

新建数据库表

Course

@Data
@TableName("t_course")
public class Course implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 课程名称
     */
    private String name;

    /**
     * 学分
     */
    private Integer score;

    /**
     * 上课时间
     */
    private String times;

    /**
     * 是否开课
     */
    private Boolean state;

    /**
     * 授课老师id
     */
    private Integer teacherId;


}

CourseController 

@RestController
@RequestMapping("/course")
public class CourseController {

    @Resource
    private CourseService courseService;

    //修改或增加
    @PostMapping("/saveCourse")
    public Result saveCourse(@RequestBody Course course) {
        //新增或修改
        return Result.success(courseService.saveOrUpdate(course));
    }


    @GetMapping("/findAll")
    public Result findAll() {
        return Result.success(courseService.list());
    }

    @DeleteMapping("/{id}")
    public Result delete(@PathVariable("id") Integer id) {
        return Result.success(courseService.removeById(id));
    }

    //批量删除
    @PostMapping("/del/batch")
    public Result deleteBatch(@RequestBody List<Integer> ids) {
        return Result.success(courseService.removeBatchByIds(ids));
    }

    //分页查询 mybatis-plus方式
    @GetMapping("/selectPage")
    public Result selectPage(@RequestParam(defaultValue = "") String name,
                             @RequestParam Integer pageSize,
                             @RequestParam Integer pageNum) {

        IPage<Course> page = new Page<>(pageNum, pageSize);
        QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
        if (!"".equals(name)) {
            queryWrapper.like("name", name);
        }
        return Result.success(courseService.page(page, queryWrapper));
    }

}

Course.vue

<template>
  <div>
    <div>
      <div style="margin: 10px 0">
        <el-input style="width: 200px" placeholder="请输入名称" suffix-icon="el-icon-search"
                  v-model="name"></el-input>
        <el-button class="ml-5" type="primary" @click="load">搜索</el-button>
        <el-button type="warning" @click="reset">重置</el-button>
      </div>
      <div style="margin: 10px 0">
        <el-button type="primary" @click="handleAdd">新增 <i class="el-icon-circle-plus-outline"></i></el-button>

        <el-popconfirm
            class="ml-5"
            confirm-button-text='确定'
            cancel-button-text='我再想想'
            icon="el-icon-info"
            icon-color="red"
            title="您确定批量删除这些数据吗?"
            @confirm="delBatch"
        >
          <el-button type="danger" slot="reference">批量删除 <i class="el-icon-remove-outline"></i></el-button>
        </el-popconfirm>
      </div>

      <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'"
                @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="id" label="ID" width="80"></el-table-column>
        <el-table-column prop="name" label="课程名"></el-table-column>
        <el-table-column prop="score" label="学分"></el-table-column>
        <el-table-column prop="times" label="课时"></el-table-column>
        <el-table-column prop="teacher" label="授课老师"></el-table-column>

        <el-table-column label="启用">
          <template slot-scope="scope">
            <el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ccc"
                       @change="changeEnable(scope.row)"></el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200" align="center">
          <template slot-scope="scope">
            <el-button type="success" @click="handleEdit(scope.row)">编辑 <i class="el-icon-edit"></i></el-button>
            <el-popconfirm
                class="ml-5"
                confirm-button-text='确定'
                cancel-button-text='我再想想'
                icon="el-icon-info"
                icon-color="red"
                title="您确定删除吗?"
                @confirm="del(scope.row.id)"
            >
              <el-button type="danger" slot="reference">删除 <i class="el-icon-remove-outline"></i></el-button>
            </el-popconfirm>
          </template>
        </el-table-column>
      </el-table>
      <div style="padding: 10px 0">
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="pageNum"
            :page-sizes="[2, 5, 10, 20]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
        </el-pagination>
      </div>

      <el-dialog title="课程信息" :visible.sync="dialogFormVisible" width="30%">
        <el-form label-width="80px" size="small">
          <el-form-item label="课程名">
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="学分">
            <el-input v-model="form.score" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="课时">
            <el-input v-model="form.times" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="授课老师">
            <el-select clearable v-model="form.teacherId" placeholder="请选择" style="width: 100%">
              <el-option v-for="item in teachers" :key="item.id" :label="item.nickname" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="save">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  name: "Course",
  data() {
    return {
      form: {},
      tableData: [],
      name: "",
      multipleSelection: [],
      pageNum: 1,
      pageSize: 5,
      total: 0,
      dialogFormVisible: false,
      teachers: [],
      user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {}
    }
  }, created() {
    this.load()
  },
  methods: {

    //图片回显
    formatImg(value) {
      if (value) {
        return "<img src='" + value.substring(21) + "' style='hight:50px'>"
      } else {
        return null;
      }
    },

    load() {
      this.request.get("/course/selectPage", {
        params: {
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          name: this.name
        }
      }).then(res => {
        //注意data
        this.tableData = res.data.records
        this.total = res.data.total
      })
    },
    changeEnable(row) {
      this.request.post("/course/update", row).then(res => {
        if (res.code === '200') {
          this.$message.success("更新成功")
        }
      })
    },
    del(id) {
      this.request.delete("/course/" + id).then(res => {
        if (res.code === '200') {
          this.$message.success("删除成功")
          this.load()
        } else {
          this.$message.error("删除失败")
        }
      })
    },

    save() {
      this.request.post("/course/saveCourse", this.form).then(res => {
        if (res.code === '200') {
          this.$message.success("保存成功")
          this.dialogFormVisible = false
          this.load()
        } else {
          this.$message.error("保存失败")
        }
      })
    },
    handleAdd() {
      this.dialogFormVisible = true
      this.form = {}
    },
    handleEdit(row) {
      this.form = JSON.parse(JSON.stringify(row))
      this.dialogFormVisible = true
    },

    handleSelectionChange(val) {
      console.log(val)
      this.multipleSelection = val
    },
    delBatch() {
      let ids = this.multipleSelection.map(v => v.id)  // [{}, {}, {}] => [1,2,3]
      this.request.post("/course/del/batch", ids).then(res => {
        if (res.data) {
          this.$message.success("批量删除成功")
          this.load()
        } else {
          this.$message.error("批量删除失败")
        }
      })
    },
    reset() {
      this.name = ""
      this.load()
    },
    handleSizeChange(pageSize) {
      console.log(pageSize)
      this.pageSize = pageSize
      this.load()
    },
    handleCurrentChange(pageNum) {
      console.log(pageNum)
      this.pageNum = pageNum
      this.load()
    },
    handleFileUploadSuccess(res) {
      console.log(res)
      this.load()
    },
    download(url) {
      window.open(url)
    }
  }
}
</script>

<style>

</style>

插入数据

一、实现授课老师查询

(关联查询)

一对一

UserController

@GetMapping("/role/{role}")
    public Result findAllUserByRoleId(@PathVariable String role) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("role", role);
        List<User> list = userService.list(queryWrapper);
        return success(list);
    }

Course.vue

load() {
      this.request.get("/course/selectPage", {
        params: {
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          name: this.name
        }
      }).then(res => {
        //注意data
        this.tableData = res.data.records
        this.total = res.data.total
      })
      this.request.get("/user/role/ROLE_TEACHER").then(res => {
        //注意data
        this.teachers = res.data
      })
    },

 Course

 @TableField(exist = false)
    private String teacher;
//睡一会
TimeUnit.SECONDS.sleep(20);

CourseController

第一种方法

//分页查询 mybatis-plus方式
    @GetMapping("/selectPage")
    public Result selectPage(@RequestParam(defaultValue = "") String name,
                             @RequestParam Integer pageSize,
                             @RequestParam Integer pageNum) {

        QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id");
        Page<Course> page = courseService.page(new Page<>(pageNum, pageSize), queryWrapper);
        List<Course> records = page.getRecords();
        for (Course record : records) {
            User user = userService.getById(record.getTeacherId());
            if (user != null) {
                record.setTeacher(user.getNickname());
            }
        }
        return Result.success(page);
    }

第二种方法

CourseController

@GetMapping("/selectPage")
    public Result selectPage(@RequestParam String name,
                             @RequestParam Integer pageSize,
                             @RequestParam Integer pageNum) {

        Page<Course> page = courseService.findPage(new Page<>(pageNum, pageSize), name);
        return Result.success(page);
    }

CourseService

Page<Course> findPage(Page<Course> page, String name);

CourseServiceImpl

@Resource
    private CourseMapper courseMapper;


    @Override
    public Page<Course> findPage(Page<Course> page, String name) {
        return courseMapper.findPage(page,name);
    }

CourseMapper

Page<Course> findPage(Page<Course> page, @Param("name") String name);

CourseMapper.xml

<?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.example.springboot.mapper.CourseMapper">

    <select id="findPage" resultType="com.example.springboot.entity.Course">
        select t_course.*,sys_user.nickname as teacher
        from t_course
        left join sys_user
        on t_course.teacher_id = sys_user.id
        <where>
            <if test="name!=null and name !=''">
                and name like concat('%',#{name},'%')
            </if>
        </where>
    </select>
</mapper>

 多对一: 

查看老师教授课程

User.vue

//让页面好看

<el-table-column prop="role" label="角色" width="140">
        <template slot-scope="scope">
          <el-tag type="primary" v-if="scope.row.role==='ROLE_ADMIN'">管理员</el-tag>
          <el-tag type="warning" v-if="scope.row.role==='ROLE_TEACHER'">老师</el-tag>
          <el-tag type="success" v-if="scope.row.role==='ROLE_STUDENT'">学生</el-tag>
        </template>
      </el-table-column>



//添加按钮

<el-button type="primary" @click="lookCourse(scope.row.courses)" v-if="scope.row.role === 'ROLE_TEACHER'">
            查看教授课程<i class="el-icon-document"></i>
          </el-button>


//添加弹窗
<el-dialog title="课程信息" :visible.sync="vis" width="30%">
      <el-table :data="courses" border stripe>
        <el-table-column prop="name" label="课程名称"></el-table-column>
        <el-table-column prop="score" label="学分"></el-table-column>
      </el-table>
    </el-dialog>


//添加变量

courses: [],
      vis: false



//添加方法

    lookCourse(courses) {
      this.courses = courses
      this.vis = true
    },

User

@TableField(exist = false)
    private List<Course> courses;

UserController

@GetMapping("/selectPage")
    public Result selectPage(@RequestParam(defaultValue = "") String username,
                             @RequestParam Integer pageSize,
                             @RequestParam Integer pageNum,
                             @RequestParam(defaultValue = "") String email,
                             @RequestParam(defaultValue = "") String address) {

        return Result.success(userService.findPage(new Page<>(pageNum,pageSize),username,email,address));
    }

UserService

Page<User> findPage(Page<User> page, String username, String email, String address);

UserServiceImpl

 @Override
    public Page<User> findPage(Page<User> page, String username, String email, String address) {
        return userMapper.findPage(page,username,email,address);
    }

UserMapper

    Page<User> findPage(Page<User> page, @Param("username") String username,@Param("email") String email,@Param("address") String address);

UserMapper.xml

<resultMap id="pageUser" type="com.example.springboot.entity.User">
        <result column="id" property="id"/>
        <result column="username" property="username"/>
        <result column="nickname" property="nickname"/>
        <result column="email" property="email"/>
        <result column="phone" property="phone"/>
        <result column="address" property="address"/>
        <result column="create_time" property="createTime"/>
        <result column="avatar_url" property="avatarUrl"/>
        <result column="role" property="role"/>

        <collection property="courses" javaType="java.util.ArrayList" ofType="com.example.springboot.entity.Course">
            <result column="name" property="name"/>
            <result column="score" property="score"/>
        </collection>
    </resultMap>


    <select id="findPage" resultMap="pageUser">
        select sys_user.*,
        t_course.*
        from sys_user left join t_course
        on sys_user.id = t_course.teacher_id
        <where>
            <if test="username !=null and username!=''">
                and sys_user.username like concat('%',#{username},'%')
            </if>
            <if test="email !=null and email!=''">
                and sys_user.email like concat('%',#{email},'%')
            </if>
            <if test="address !=null and address!=''">
                and sys_user.address like concat('%',#{address},'%')
            </if>
        </where>
    </select>

 多对多

学生选课功能

新建数据库表

 

 CourseController

//修改或增加
    @PostMapping("/studentCourse/{courseId}/{studentId}")
    public Result StudentCourse(@PathVariable Integer courseId,@PathVariable Integer studentId ) {
        //新增或修改
        courseService.setStudentCourse(courseId,studentId);
        return Result.success();
    }

CourseService

void setStudentCourse(Integer courseId, Integer studentId);

CourseServiceImpl

@Override
    @Transactional
    public void setStudentCourse(Integer courseId, Integer studentId) {
        courseMapper.deleteStudentCourse(courseId, studentId);
        courseMapper.setStudentCourse(courseId, studentId);
    }

CourseMapper

    void deleteStudentCourse(@Param("courseId") Integer courseId, @Param("studentId") Integer studentId);



    void setStudentCourse(@Param("courseId") Integer courseId, @Param("studentId") Integer studentId);

CourseMapper.xml

<delete id="deleteStudentCourse">
        delete
        from student_course
        where student_id = #{studentId}
          and course_id = #{courseId}
    </delete>

    <insert id="setStudentCourse">
        insert
        into student_course(student_id, course_id)
        values (#{studentId}, #{courseId})
    </insert>

Course.vue

//添加按钮           
 <el-button type="primary" @click="selectCourse(scope.row.id)">选课</el-button>




//添加方法
selectCourse(courseId) {
      this.request.post("/course/studentCourse/" + courseId + "/" + this.user.id).then(res => {
        if (res.code === '200') {
          this.$message.success("选课成功")
        } else {
          this.$message.error(res.msg)
        }
      })
    },

查询已选课程功能实现

User.vue

//添加按钮

<el-button type="warning" @click="lookStuCourse(scope.row.stuCourses)" v-if="scope.row.role === 'ROLE_STUDENT'">
            查看已选课程<i class="el-icon-document"></i>
          </el-button>


//添加参数
stuVis:false,
      stuCourses:[],

//添加功能

lookStuCourse(stuCourses) {
      this.courses = stuCourses
      this.stuVis = true
    },




<el-dialog title="课程信息" :visible.sync="stuVis" width="30%">
      <el-table :data="courses" border stripe>
        <el-table-column prop="name" label="课程名称"></el-table-column>
        <el-table-column prop="score" label="学分"></el-table-column>
      </el-table>
    </el-dialog>

UserMapper.xml

<resultMap id="pageUser" type="com.example.springboot.entity.User">
        <result column="id" property="id"/>
        <result column="username" property="username"/>
        <result column="nickname" property="nickname"/>
        <result column="email" property="email"/>
        <result column="phone" property="phone"/>
        <result column="address" property="address"/>
        <result column="create_time" property="createTime"/>
        <result column="avatar_url" property="avatarUrl"/>
        <result column="role" property="role"/>

        <collection property="courses" javaType="java.util.ArrayList" ofType="com.example.springboot.entity.Course">
            <result column="teacherCourseName" property="name"/>
            <result column="teacherScore" property="score"/>
        </collection>
        <collection property="stuCourses" javaType="java.util.ArrayList" ofType="com.example.springboot.entity.Course">
            <result column="stuCourseName" property="name"/>
            <result column="stuScore" property="score"/>
        </collection>
    </resultMap>


    <select id="findPage" resultMap="pageUser">
        select sys_user.*,sc.name as stuCourseName,tc.name as teacherCourseName,tc.score as teacherScore,
        sc.score as stuScore from sys_user
        left join student_course
        on sys_user.id = student_course.student_id
        left join t_course sc
        on student_course.course_id = sc.id
        left join t_course tc
        on sys_user.id = tc.teacher_id
        <where>
            <if test="username !=null and username!=''">
                and sys_user.username like concat('%',#{username},'%')
            </if>
            <if test="email !=null and email!=''">
                and sys_user.email like concat('%',#{email},'%')
            </if>
            <if test="address !=null and address!=''">
                and sys_user.address like concat('%',#{address},'%')
            </if>
        </where>
    </select>

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/35252.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

微信小程序制作 购物商城首页 【内包含源码】

1、实现效果 手机效果预览,这里的首页使用到了轮播图。页面图片数据可以替换成自己的数据。 2、开发者工具效果图 3、项目的目录结构 4、首页核心代码 4.1 index.js 这里用来存放数据,页面的数据。目前是假数据,也可以调用接口接收真实数据 // index.jsimport {request }…

【我的创作纪念日】关于某站的音频爬虫+GUI

文章目录 一、前言&机遇二、爬虫代码三、爬虫GUI四、文件打包五、结果展示未来可期 一、前言&机遇 许久没看私信内容&#xff0c;一上线就看到了官方的私信&#xff0c;我已经来到CSDN1024天啦&#xff01; 想到注册这个号的初衷是学习记录爬虫&#xff0c;后面渐渐变…

【计算机视觉 | 目标检测】arxiv 计算机视觉关于目标检测的学术速递(7 月 3 日论文合集)

文章目录 一、检测相关(9篇)1.1 Federated Ensemble YOLOv5 - A Better Generalized Object Detection Algorithm1.2 Zero-shot Nuclei Detection via Visual-Language Pre-trained Models1.3 Federated Object Detection for Quality Inspection in Shared Production1.4 Comp…

【数据科学和可视化】反思十年数据科学和可视化工具的未来

数据科学在过去十年中呈爆炸式增长&#xff0c;改变了我们开展业务的方式&#xff0c;并让下一代年轻人为未来的工作做好准备。但是这种快速增长伴随着对数据科学工作的不断发展的理解&#xff0c;这导致我们在如何使用数据科学从我们的大量数据中获得可操作的见解方面存在很多…

Django的数据库配置、生成(创建)过程、写入数据、查看数据的学习过程记录

目录 01-配置数据库信息02-安装Python的MySQL数据库驱动程序 mysqlclient03-安装Mysql&#xff0c;并启动Mysql04-定义Django的数据库模型(定义数据表-编写models.py文件)05-按照数据的配置生成数据库(执行迁移命令)05-01-生成迁移执行文件05-02-执行数据库模型迁移 06-查看数据…

git bash 命令行反应慢、卡顿

1. 在Windows11的电脑上安装了git 后&#xff0c;鼠标右键打开git bash here&#xff0c;打开窗口缓慢&#xff0c;输入命令也慢的要死&#xff0c;如果安装git的时候选择在桌面创建图标&#xff0c;通过桌面图标打开也是一样的 2. 最简单的ls 命令&#xff0c;都要停顿半秒 3.…

m4a音频格式转换器:让音频轻松换装

大家有没有遇到这样的情况——你下载了一个很酷的音频文件&#xff0c;但是播放设备却说“不认识”这个格式&#xff1f;别担心&#xff01;现在有个超级厉害的工具可以帮你解决这个问题&#xff0c;它就是m4a音频格式转换器&#xff01;它能让你的音频文件变身&#xff0c;适应…

TiDB(2):TiDB架构特性

1 TiDB 整体架构 TiDB 集群主要包括三个核心组件&#xff1a;TiDB Server&#xff0c;PD Server 和 TiKV Server。此外&#xff0c;还有用于解决用户复杂 OLAP 需求的 TiSpark 组件和简化云上部署管理的 TiDB Operator 组件。 架构图解 1.1 TiDB Server TiDB Server 负责接收…

技术服务企业缺成本票,所得税高怎么解决?可有良策?

技术服务企业缺成本票&#xff0c;所得税高怎么解决&#xff1f;可有良策&#xff1f; 《税筹顾问》专注于园区招商、企业税务筹划&#xff0c;合理合规助力企业节税&#xff01; 技术服务型企业最核心的价值就是为客户提供技术支撑&#xff0c;而这类型的企业在税务方面面临的…

CSRF漏洞复现

目录 CSRF产生的条件CSRF漏洞分类CSRF漏洞危害CSRF漏洞检测CSRF漏洞修复方案利用靶场CSRF-Minefield-V1.0漏洞复现 CSRF产生的条件 一、被攻击者在登陆了web网页&#xff0c;并且在本地生成了cookie 二、在cookie未过期的情况下&#xff0c;利用同一个浏览器访问了攻击者的页…

最新版Flink CDC MySQL同步Elasticsearch(一)

1.环境准备 首先我们要基于Flink CDC MySQL同步MySQL的环境基础上&#xff08;flink-1.17.1、Java8、MySQL8&#xff09;搭建Elasticsearch7-17-10和Kibana 7.17.10。笔者已经搭建好环境&#xff0c;这里不做具体演示了&#xff0c;如果需要Es的搭建教程情况笔者其他博客 注意…

JVM源码剖析之Java对象创建过程

关于 "Java的对象创建" 这个话题分布在各种论坛、各种帖子&#xff0c;文章的水平参差不齐。并且大部分仅仅是总结 "面试宝典" 的流程&#xff0c;小部分就是copy其他帖子&#xff0c;极少能看到拿源码作为论证。所以特意写下这篇文章。 版本信息如下&…

Eclipse显示层级目录结构(像IDEA一样)

有的小伙伴使用IDEA习惯了&#xff0c;可能进入公司里面要求使用eclipse&#xff0c;但是eclipse默认目录是并列显示&#xff0c;而不是层级显示。部分人用起来感觉十分不方便。我们可以更改一下设置。 1、打开eclipse&#xff0c;找到这里 2、选择PackagePresentation 3、选…

Github-提交PR指南

1. Fork你将要提交PR的repo 2. 将你fork下来的repo克隆到你的本地 git clone your_repo.git Cloning into ultralytics... remote: Enumerating objects: 8834, done. remote: Counting objects: 100% (177/177), done. remote: Compressing objects: 100% (112/112), done. …

第二步:STM32F407ZGT6资源介绍

1.1 STM32F407ZGT6资源描述 内核&#xff1a; 32位 高性能ARM Cortex-M4处理器 时钟&#xff1a;高达168M,实际还可以超屏一点点 支持FPU&#xff08;浮点运算&#xff09;和DSP指令 IO口&#xff1a; STM32F407ZGT6: 144引脚 114个IO 大部分IO口都耐5V(模拟通道除外) …

C# .NET 如何调用 SAP RFC 接口

1.分析传参结构 SAP 传参格式对应 .NET 参数格式 SAP 参数.NET 参数参数类型import(导入)——关联类型为数据元素Param单个变量参数import(导出)——关联类型为结构体Struct结构体tableTable表 下面是 SAP 对应参数类型&#xff1a; 2.web.config 配置 配置文件需要客户端…

win10安装pytorch GPU

我记得以前安装过深度学习库GPU版本&#xff0c; 需要安装cuda什么的&#xff0c;翻了下还真写过一篇win10安装tensorflow的文章&#xff0c;但是流程不止不详细&#xff0c;还不清晰。这次就再记录一遍 这次安装的是pytorch&#xff0c;这么多年似乎pytorch要逐渐统一深度学习…

【算法与数据结构】232、LeetCode用栈实现队列

文章目录 一、题目二、解法三、完整代码 所有的LeetCode题解索引&#xff0c;可以看这篇文章——【算法和数据结构】LeetCode题解。 一、题目 二、解法 思路分析&#xff1a;这道题要求我们用栈模拟队列&#xff08;工作上一定没人这么搞&#xff09;。程序当中&#xff0c;pus…

spring之BeanFactory

spring之BeanFactory DefaultListableBeanFactory示例代码类继承实现结构 BeanFactory是Bean工厂&#xff0c;所以很明显&#xff0c;BeanFactory会负责创建Bean&#xff0c;并且提供获取Bean的API。 DefaultListableBeanFactory 在Spring源码中&#xff0c;BeanFactory接口存…

自定义的车牌号键盘组件

<template><view class"keyboard-wrap" v-if"kbShow"><view class"head"><view class"done" tap"done"><text class"iconfont iconxiala-"></text>关闭</view></vi…
最新文章