Day207&208,linux应用开发面试题

先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7

深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
img
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以添加V获取:vip1024b (备注Java)
img

正文

//2、修改描述信息

EduCourseDescription eduCourseDescription = new EduCourseDescription();

eduCourseDescription.setDescription(courseInfoForm.getDescription());

eduCourseDescription.setId(courseInfoForm.getId());

eduCourseDescriptionService.updateById(eduCourseDescription);

}


二、前端实现


  • 定义api方法

guli-admin\src\api\teacher\course.js

//根据课程id 查询课程基本信息

getCourseInfoById(courseId){

return request({

url:/eduservice/edu-course/getCourseInfoById/${courseId},

method: ‘get’,

})

},

//修改课程信息

updateCourseInfo(courseInfoForm){

return request({

url:“/eduservice/edu-course/updateCourseInfo”,

method: ‘post’,

data: courseInfoForm,

})

}

  • 修改chapter页面跳转路径

guli-admin\src\views\edu\course\chapter.vue

//跳转到上一步

previous() {

this.$router.push({ path: “/course/info/”+this.courseId});

},

next() {

//跳转到第三步

this.$router.push({ path: “/course/publish/”+this.courseId});

}

  • info页面 created()

created() {

//判断路径中是否有课程id

if (this.KaTeX parse error: Expected 'EOF', got '&' at position 14: route.params &̲& this.route.params.id) {

this.courseId = this.$route.params.id;

//根据课程id 查询课程基本信息

this.getCourseInfo()

},

}

  • info页面 methods

methods: {

//获取课程信息

getCourseInfo() {

course.getCourseInfoById(this.courseId).then((resp) => {

this.courseInfo = resp.data.courseInfoForm

})

},

}

  • info页面 data

data() {

return {

courseId: “”,

};

}

  • 测试

在这里插入图片描述

  • 上面问题,二级分类中的数据显示出现了问题

created() {

//判断路径中是否有课程id

if (this.KaTeX parse error: Expected 'EOF', got '&' at position 14: route.params &̲& this.route.params.id) {

this.courseId = this.$route.params.id;

//根据课程id 查询课程基本信息

this.getCourseInfo();

} else {

//初始化所有讲师

this.getListTeacher();

//初始化一级分类

this.getOneSubject();

}

}

//获取课程信息

getCourseInfo() {

course.getCourseInfoById(this.courseId).then((resp) => {

this.courseInfo = resp.data.courseInfoForm;

//查询所有分类,包含一级和二级所有

subject.getSubjectList().then((resp) => {

//获取所有一级分类

this.subjectOneLists = resp.data.list;

//把所有一级分类数组进行遍历

for (var i = 0; i < this.subjectOneLists.length; i++) {

//获取每个一级分类

var oneSubject = this.subjectOneLists[i];

//比较当前courseInfo里面的一级分类id和所有的一级分类id是否一样

if (this.courseInfo.subjectParentId == oneSubject.id) {

//获取一级分类中所有的二级分类

this.subjectTwoLists = oneSubject.children;

}

}

});

//初始化所有讲师

this.getListTeacher();

});

}

  • 出现一个bug,就是回显数据后,再单击添加课程,数据还在,按理应该是清空数据

添加监听器,监听路由,如果路由变化,就将courseInfo的数据清空

watch: {

$route(to, from) {

//路由变化方式,当路由发送变化,方法就执行

console.log(“watch $route”);

this.courseInfo={}

},

}

  • 实现修改功能

guli-admin\src\views\edu\course\info.vue

//添加课程

saveCourse() {

course.addCourseInfo(this.courseInfo).then((resp) => {

this.$message({

message: “添加课程信息成功”,

type: “success”,

});

//跳转到第二步,并带着这个课程生成的id

this.$router.push({ path: “/course/chapter/” + resp.data.courseId });

});

},

//修改课程

updateCourse() {

course.updateCourseInfo(this.courseInfo).then((resp) => {

this.$message({

message: “修改课程信息成功”,

type: “success”,

});

//跳转到第二步,并带着这个课程生成的id

this.$router.push({ path: “/course/chapter/” + this.courseId });

});

},

//判断是修改还是新增

saveOrUpdate() {

//判断courseInfo中是否有id值

if (this.courseInfo.id) {

//有id值,为修改

this.updateCourse();

} else {

//没id值,为添加

this.saveCourse();

}

}


课程章节添加修改删除功能

======================================================================

一、后端接口实现


  • controller

//添加章节

@PostMapping(“addChapter”)

public R addChapter(@RequestBody EduChapter eduChapter){

eduChapterService.save(eduChapter);

return R.ok();

}

//根据章节id查询

@GetMapping(“getChapter/{chapterId}”)

public R getChapter(@PathVariable String chapterId){

EduChapter eduChapter = eduChapterService.getById(chapterId);

return R.ok().data(“chapter”,eduChapter);

}

//修改章节

@PostMapping(“updateChapter”)

public R updateChapter(@RequestBody EduChapter eduChapter){

eduChapterService.updateById(eduChapter);

return R.ok();

}

//删除章节

@DeleteMapping(“deleteById/{chapterId}”)

public R deleteById(@PathVariable String chapterId){

boolean flag = eduChapterService.deleteChapter(chapterId);

if (flag){

return R.ok();

}else {

return R.error();

}

}

  • service

boolean deleteChapter(String chapterId);

  • serviceImpl

//删除章节的方法

@Override

public boolean deleteChapter(String chapterId) {

//根据chapter章节id 查询查询小节表,如果查询有数据,则不删除

QueryWrapper wrapper = new QueryWrapper<>();

wrapper.eq(“chapter_id”,chapterId);

int count = eduVideoService.count(wrapper);

//判断

if (count>0){

//能查询出来小节,不进行删除

throw new AchangException(20001,“还有小节数据,不能删除”);

}else {

//不能查询出小节,进行删除

int delete = baseMapper.deleteById(chapterId);

return delete>0;

}

}


二、前端页面实现


  • 定义api

//添加章节

addChapter(chapter) {

return request({

url: /eduservice/edu-chapter/addChapter,

method: post,

data: chapter

})

},

//根据id查询章节

updateChapterById(chapterID) {

return request({

url: /eduservice/edu-chapter/getChapter/${chapterID},

method: get,

})

},

//修改章节

updateChapter(chapter) {

return request({

url: /eduservice/edu-chapter/updateChapter,

method: post,

data: chapter

})

},

//删除章节

deleteById(chapterID) {

return request({

url: /eduservice/edu-chapter/deleteById/${chapterID},

method: delete,

})

}

  • 引入api

import chapter from “@/api/teacher/chapter.js”;

  • 【添加课程】前端实现

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RnDlKFNU-1614611373370)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301192930998.png)]

methods: {

//添加章节

saveChapter() {

//设置课程id到chapter对象中

this.chapter.courseId = this.courseId

chapter.addChapter(this.chapter).then((resp) => {

//关闭弹框

this.dialogChapterFormVisible = false;

//提示信息

this.$message({

message: “添加章节成功”,

type: “success”,

});

//刷新页面

this.getChapterVideoByCourseId()

});

},

saveOrUpdate() {

this.saveChapter()

}

}

  • 设置com.achang.eduservice.entity.EduChapter的创建时间和更新时间自动增添

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cSQ1jeQ8-1614611373373)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301193058647.png)]

  • 测试新增章节功能是否优先

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-haSaK6wy-1614611373374)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301193140747.png)]

  • 设置弹出表单时,清空数据

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zEe86p2C-1614611373375)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301193809829.png)]

//弹出添加章节表单

openChapterDialog(){

//清空之前的数据

this.chapter={}

//显示弹框

this.dialogChapterFormVisible = true

}

  • 【修改功能】实现

//修改章节

updateChapter() {

//设置课程id到chapter对象中

this.chapter.courseId = this.courseId;

chapter.updateChapter(this.chapter).then((resp) => {

//关闭弹框

this.dialogChapterFormVisible = false;

//提示信息

this.$message({

message: “修改章节成功”,

type: “success”,

});

//刷新页面

this.getChapterVideoByCourseId();

});

}

saveOrUpdate() {

if (this.chapter.id) {

//修改章节

this.updateChapter();

} else {

//新增章节

this.saveChapter();

}

}


  • 【删除功能】实现

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-TS94m8kw-1614611373377)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301201936160.png)]

//删除章节

removeById(chapterId) {

this.$confirm(“此操作将永久删除章节信息, 是否继续?”, “提示”, {

confirmButtonText: “确定”,

cancelButtonText: “取消”,

type: “warning”,

}).then(() => {

//点击确定,执行then方法

chapter.deleteById(chapterId).then((resp) => {

//删除成功

//提示信息

this.$message({

type: “success”,

message: “删除成功!”,

});

//刷新页面

this.getChapterVideoByCourseId();

});

});

}


课程章节小节功能

==================================================================

一、后端接口实现


  • com.achang.eduservice.controller.EduVideoController

@RestController

@RequestMapping(“/eduservice/edu-video”)

@CrossOrigin //解决跨域问题

public class EduVideoController {

@Autowired

private EduVideoService eduVideoService;

//添加小节

@PostMapping(“/addVideo”)

public R addVideo(@RequestBody EduVideo eduVideo){

eduVideoService.save(eduVideo);

return R.ok();

}

//删除小节

// TODO 后面这个方法需要完善,删除小节的时候,同时也要把视频删除

@DeleteMapping(“/deleteVideo/{id}”)

public R deleteVideo(@PathVariable String id){

eduVideoService.removeById(id);

return R.ok();

}

//修改小节

@PostMapping(“/updateVideo”)

public R updateVideo(@RequestBody EduVideo eduVideo){

eduVideoService.updateById(eduVideo);

return R.ok();

}

//根据小节id查询

@GetMapping(“/getVideoById/{videoId}”)

public R getVideoById(@PathVariable String videoId){

EduVideo eduVideo = eduVideoService.getById(videoId);

return R.ok().data(“video”,eduVideo);

}

}

二、前端实现


  • 页面搭建

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tE45zGri-1614611373379)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301210837755.png)]

<el-input-number

v-model=“video.sort”

:min=“0”

controls-

position=“right”

/>

免费

默认

<el-button @click=“dialogVideoFormVisible = false”>取 消

<el-button

:disabled=“saveVideoBtnDisabled”

type=“primary”

@click=“saveOrUpdateVideo(video.id)”

确 定</el-button

  • api

guli-admin\src\api\teacher\video.js

import request from ‘@/utils/request’ //引入已经封装好的axios 和 拦截器

export default {

//添加小节

addVideo(video) {

return request({

url: /eduservice/edu-video/addVideo,

method: post,

data: video

})

},

//根据id查询小节

getVideoById(videoId) {

return request({

url: /eduservice/edu-video/getVideoById/${videoId},

method: get,

})

},

//修改小节

updateVideo(video) {

return request({

url: /eduservice/edu-video/updateVideo,

method: post,

data: video

})

},

//删除小节

deleteById(videoId) {

return request({

url: /eduservice/edu-video/deleteVideo/${videoId},

method: delete,

})

},

}

  • 引入api

import video from “@/api/teacher/video.js”;

  • 方法定义

//添加小节弹框的方法

openEditVideo(chapterId) {

//清空之前的数据

this.video = {};

//显示弹框

this.dialogVideoFormVisible = true;

//设置章节id

this.video.chapterId = chapterId;

},

  • 添加方法

//添加小节

addVideo() {

//设置课程id

this.video.courseId = this.courseId;

video.addVideo(this.video).then((resp) => {

//关闭弹框

this.dialogVideoFormVisible = false;

//提示信息

this.$message({

message: “添加小节成功”,

type: “success”,

});

//刷新页面

this.getChapterVideoByCourseId();

});

},

  • 给EduVideo,entity对象添加自动插入时间和修改时间

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PydDrQmx-1614611373381)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301211614154.png)]

  • 测试通过

  • 【删除小节】功能

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-MClVIf1z-1614611373382)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301213128067.png)]

//删除小节

removeVideo(videoId) {

this.$confirm(“此操作将永久删除小节信息, 是否继续?”, “提示”, {

confirmButtonText: “确定”,

cancelButtonText: “取消”,

type: “warning”,

}).then(() => {

//点击确定,执行then方法

video.deleteById(videoId).then((resp) => {

//删除成功

//提示信息

this.$message({

type: “success”,

message: “删除成功!”,

});

//刷新页面

this.getChapterVideoByCourseId();

});

});

},


  • 【小节修改】功能

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ypmselu5-1614611373384)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301214211583.png)]

//修改小节表单回显

getVideoById(videoId) {

//弹出小节弹窗

this.dialogVideoFormVisible = true;

video.getVideoById(videoId).then((resp) => {

this.video = resp.data.video;

});

},

  • 【小节修改】功能

//小节修改

updateVideorById(videoId) {

//设置小节id到video对象中

this.video.id = videoId;

video.updateVideo(this.video).then((resp) => {

//关闭弹框

this.dialogVideoFormVisible = false;

//提示信息

this.$message({

message: “修改小节成功”,

type: “success”,

});

//刷新页面

this.getChapterVideoByCourseId();

});

},

  • 测试

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2L2Oos8t-1614611373386)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301220516228.png)]


课程最终发布

================================================================

一、后端实现


  • com.achang.eduservice.entity.vo.CoursePublishVo

@Data

public class CoursePublishVo implements Serializable {

private static final long serialVersionUID = 1L;

private String id;//课程id

private String title; //课程名称

private String cover; //封面

private Integer lessonNum;//课时数

private String subjectLevelOne;//一级分类

private String subjectLevelTwo;//二级分类

private String teacherName;//讲师名称

private String price;//价格 ,只用于显示

}

  • 数据访问层

接口:EduCourseMapper

public interface EduCourseMapper extends BaseMapper {

public CoursePublishVo getPublishCourseInfo(String courseId);

}

实现:EduCourseMapper.xml

<?xml version="1.0" encoding="UTF-8"?>

SELECT

ec.id,

ec.title,

ec.cover,

ec.lesson_num AS lessonNum,

ec.price,

s1.title AS subjectLevelOne,

s2.title AS subjectLevelTwo,

t.name AS teacherName

FROM

edu_course ec

LEFT JOIN edu_teacher t ON ec.id = t.id

LEFT JOIN edu_subject s1 ON ec.subject_parent_id = s1.id

LEFT JOIN edu_subject s2 ON ec.id = s2.id

WHERE

ec.id = #{id}

  • EduCourseMapper接口

@Component

public interface EduCourseMapper extends BaseMapper {

public CoursePublishVo getPublishCourseInfo(String courseId);

}

  • EduCourseService接口

根据课程id查询课程确认信息

public CoursePublishVo getPublishCourseInfo(String courseId);

  • EduCourseServiceImpl

//根据课程id查询课程确认信息

@Override

public CoursePublishVo getPublishCourseInfo(String courseId) {

return eduCourseMapper.getPublishCourseInfo(courseId);

}

  • EduCourseController

//根据课程id查询课程确认信息

@GetMapping(“/getpublishCourseInfo/{id}”)

public R getpublishCourseInfo(@PathVariable String id){

CoursePublishVo publishCourseInfo = eduCourseService.getPublishCourseInfo(id);

return R.ok().data(“publishCourse”,publishCourseInfo);

}

  • 测试,访问:http://localhost:8801/swagger-ui.html

  • 报错

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Yjqfo99p-1614611373388)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301225614464.png)]

  • 原因、解决方式

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-07skounZ-1614611373390)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301230028092.png)]

  • application.properties下指定xml文件夹

#配置mapper xml文件的路径

mybatis-plus.mapper-locations=classpath:com/achang/eduservice/mapper/xml/*.xml

  • 再次测试,成功

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-iExDrqrh-1614611373391)(../../../../../AppData/Roaming/Typora/typora-user-images/image-20210301230137703.png)]


二、前端实现


  • api方法定义

guli-admin\src\api\teacher\course.js

//课程确认信息显示

getPublishCourseInfo(courseId){

return request({

url:“/eduservice/edu-course/getpublishCourseInfo/”+courseId,

method: ‘get’,

})

}

  • 导入api方法

import course from ‘@/api/teacher/course.js’

  • 定义变量方法

export default {

data() {

return {

courseId:‘’,

publishCourseinfo:{},

};

},

methods: {

//根据课程id查询

getPublishCourseInfo(){

course.getPublishCourseInfo(this.courseId)

.then(resp=>{

this.publishCourseinfo = resp.data.publishCourse

})

},

},

created() {

//获取路由中的id值

if(this.KaTeX parse error: Expected 'EOF', got '&' at position 14: route.params &̲& this.route.params.id){

this.courseId = this.$route.params.id

//调用接口方法根据课程id查询课程信息

this.getPublishCourseInfo()

}

},

};

  • 组件模板

发布新课程

<el-steps

:active=“3”

process-status=“wait”

align-center

style="margin-

bottom: 40px;"

{{ publishCourseinfo.title }}

共{{ publishCourseinfo.lessonNum }}课时

<span

所属分类:{{ publishCourseinfo.subjectLevelOne }} —

{{ publishCourseinfo.subjectLevelTwo }}</span

课程讲师:{{ publishCourseinfo.teacherName }}

¥{{ publishCourseinfo.price }}

最后

小编精心为大家准备了一手资料

以上Java高级架构资料、源码、笔记、视频。Dubbo、Redis、设计模式、Netty、zookeeper、Spring cloud、分布式、高并发等架构技术

【附】架构书籍

  1. BAT面试的20道高频数据库问题解析
  2. Java面试宝典
  3. Netty实战
  4. 算法

BATJ面试要点及Java架构师进阶资料

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注Java)
img

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

default {

data() {

return {

courseId:‘’,

publishCourseinfo:{},

};

},

methods: {

//根据课程id查询

getPublishCourseInfo(){

course.getPublishCourseInfo(this.courseId)

.then(resp=>{

this.publishCourseinfo = resp.data.publishCourse

})

},

},

created() {

//获取路由中的id值

if(this.KaTeX parse error: Expected 'EOF', got '&' at position 14: route.params &̲& this.route.params.id){

this.courseId = this.$route.params.id

//调用接口方法根据课程id查询课程信息

this.getPublishCourseInfo()

}

},

};

  • 组件模板

发布新课程

<el-steps

:active=“3”

process-status=“wait”

align-center

style="margin-

bottom: 40px;"

{{ publishCourseinfo.title }}

共{{ publishCourseinfo.lessonNum }}课时

<span

所属分类:{{ publishCourseinfo.subjectLevelOne }} —

{{ publishCourseinfo.subjectLevelTwo }}</span

课程讲师:{{ publishCourseinfo.teacherName }}

¥{{ publishCourseinfo.price }}

最后

小编精心为大家准备了一手资料

[外链图片转存中…(img-TIe77Mmr-1713598102503)]

[外链图片转存中…(img-q6XFB521-1713598102503)]

以上Java高级架构资料、源码、笔记、视频。Dubbo、Redis、设计模式、Netty、zookeeper、Spring cloud、分布式、高并发等架构技术

【附】架构书籍

  1. BAT面试的20道高频数据库问题解析
  2. Java面试宝典
  3. Netty实战
  4. 算法

[外链图片转存中…(img-Y3YWQkB6-1713598102504)]

BATJ面试要点及Java架构师进阶资料

[外链图片转存中…(img-XQPZN4Hn-1713598102504)]

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注Java)
[外链图片转存中…(img-Vpu6oNqD-1713598102505)]

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 16
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值