mybatis crud_MyBatis教程– CRUD操作和映射关系–第1部分

mybatis crud

CRUD操作
MyBatis是一个SQL Mapper工具,与直接使用JDBC相比,它极大地简化了数据库编程。

步骤1:创建一个Maven项目并配置MyBatis依赖项。

<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'><modelVersion>4.0.0</modelVersion><groupId>com.sivalabs</groupId><artifactId>mybatis-demo</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>mybatis-demo</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.2</version><configuration><source>1.6</source><target>1.6</target><encoding>${project.build.sourceEncoding}</encoding></configuration></plugin></plugins></build><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.10</version><scope>test</scope></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.1.1</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.21</version><scope>runtime</scope></dependency></dependencies>
</project>

步骤2:创建表USER和Java域对象User,如下所示:

CREATE TABLE  user (user_id int(10) unsigned NOT NULL auto_increment,email_id varchar(45) NOT NULL,password varchar(45) NOT NULL,first_name varchar(45) NOT NULL,last_name varchar(45) default NULL,PRIMARY KEY  (user_id),UNIQUE KEY Index_2_email_uniq (email_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
package com.sivalabs.mybatisdemo.domain;
public class User 
{private Integer userId;private String emailId;private String password;private String firstName;private String lastName;@Overridepublic String toString() {return 'User [userId=' + userId + ', emailId=' + emailId+ ', password=' + password + ', firstName=' + firstName+ ', lastName=' + lastName + ']';}//setters and getters 
}

步骤#3:创建MyBatis配置文件。

a)在src / main / resources文件夹中创建jdbc.properties文件

jdbc.driverClassName=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://localhost:3306/mybatis-demojdbc.username=rootjdbc.password=admin

b)在src / main / resources文件夹中创建mybatis-config.xml文件

<?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE configurationPUBLIC '-//mybatis.org//DTD Config 3.0//EN''http://mybatis.org/dtd/mybatis-3-config.dtd'><configuration><properties resource='jdbc.properties'/><typeAliases><typeAlias type='com.sivalabs.mybatisdemo.domain.User' alias='User'></typeAlias></typeAliases><environments default='development'><environment id='development'><transactionManager type='JDBC'/><dataSource type='POOLED'>    <property name='driver' value='${jdbc.driverClassName}'/><property name='url' value='${jdbc.url}'/><property name='username' value='${jdbc.username}'/><property name='password' value='${jdbc.password}'/></dataSource></environment></environments><mappers><mapper resource='com/sivalabs/mybatisdemo/mappers/UserMapper.xml'/></mappers></configuration>

步骤4:在com.sivalabs.mybatisdemo.mappers包的src / main / java文件夹中创建一个UserMapper.java接口。

package com.sivalabs.mybatisdemo.mappers;import java.util.List;import com.sivalabs.mybatisdemo.domain.User;public interface UserMapper {public void insertUser(User user);public User getUserById(Integer userId);public List<User> getAllUsers();public void updateUser(User user);public void deleteUser(Integer userId);}

步骤5:在com.sivalabs.mybatisdemo.mappers包的src / main / resources文件夹中创建UserMapper.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.sivalabs.mybatisdemo.mappers.UserMapper'><select id='getUserById' parameterType='int' resultType='com.sivalabs.mybatisdemo.domain.User'>SELECT user_id as userId, email_id as emailId , password, first_name as firstName, last_name as lastNameFROM USER WHERE USER_ID = #{userId}</select><!-- Instead of referencing Fully Qualified Class Names we can register Aliases in mybatis-config.xml and use Alias names. --><resultMap type='User' id='UserResult'><id property='userId' column='user_id'/><result property='emailId' column='email_id'/><result property='password' column='password'/><result property='firstName' column='first_name'/><result property='lastName' column='last_name'/>   </resultMap><select id='getAllUsers' resultMap='UserResult'>SELECT * FROM USER</select><insert id='insertUser' parameterType='User' useGeneratedKeys='true' keyProperty='userId'>INSERT INTO USER(email_id, password, first_name, last_name)VALUES(#{emailId}, #{password}, #{firstName}, #{lastName})</insert><update id='updateUser' parameterType='User'>UPDATE USER SETPASSWORD= #{password},FIRST_NAME = #{firstName},LAST_NAME = #{lastName}WHERE USER_ID = #{userId}</update><delete id='deleteUser' parameterType='int'>DELETE FROM USER WHERE USER_ID = #{userId}</delete></mapper>

步骤#6:创建MyBatisUtil.java实例化SqlSessionFactory。

package com.sivalabs.mybatisdemo.service;import java.io.IOException;
import java.io.Reader;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;public class MyBatisUtil 
{private static SqlSessionFactory factory;private MyBatisUtil() {}static{Reader reader = null;try {reader = Resources.getResourceAsReader('mybatis-config.xml');} catch (IOException e) {throw new RuntimeException(e.getMessage());}factory = new SqlSessionFactoryBuilder().build(reader);}public static SqlSessionFactory getSqlSessionFactory() {return factory;}
}

步骤#7:在src / main / java文件夹中创建UserService.java。

package com.sivalabs.mybatisdemo.service;import java.util.List;
import org.apache.ibatis.session.SqlSession;
import com.sivalabs.mybatisdemo.domain.User;
import com.sivalabs.mybatisdemo.mappers.UserMapper;public class UserService
{public void insertUser(User user) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{UserMapper userMapper = sqlSession.getMapper(UserMapper.class);userMapper.insertUser(user);sqlSession.commit();}finally{sqlSession.close();}}public User getUserById(Integer userId) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{UserMapper userMapper = sqlSession.getMapper(UserMapper.class);return userMapper.getUserById(userId);}finally{sqlSession.close();}}public List<User> getAllUsers() {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{UserMapper userMapper = sqlSession.getMapper(UserMapper.class);return userMapper.getAllUsers();}finally{sqlSession.close();}}public void updateUser(User user) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{UserMapper userMapper = sqlSession.getMapper(UserMapper.class);userMapper.updateUser(user);sqlSession.commit();}finally{sqlSession.close();}}public void deleteUser(Integer userId) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{UserMapper userMapper = sqlSession.getMapper(UserMapper.class);userMapper.deleteUser(userId);sqlSession.commit();}finally{sqlSession.close();}}}

步骤#8:创建一个JUnit Test类以测试UserService方法。

package com.sivalabs.mybatisdemo;import java.util.List;import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;import com.sivalabs.mybatisdemo.domain.User;
import com.sivalabs.mybatisdemo.service.UserService;public class UserServiceTest 
{private static UserService userService;@BeforeClasspublic static void setup() {userService = new UserService();}@AfterClasspublic static void teardown() {userService = null;}@Testpublic void testGetUserById() {User user = userService.getUserById(1);Assert.assertNotNull(user);System.out.println(user);}@Testpublic void testGetAllUsers() {List<User> users = userService.getAllUsers();Assert.assertNotNull(users);for (User user : users) {System.out.println(user);}}@Testpublic void testInsertUser() {User user = new User();user.setEmailId('test_email_'+System.currentTimeMillis()+'@gmail.com');user.setPassword('secret');user.setFirstName('TestFirstName');user.setLastName('TestLastName');userService.insertUser(user);Assert.assertTrue(user.getUserId() != 0);User createdUser = userService.getUserById(user.getUserId());Assert.assertNotNull(createdUser);Assert.assertEquals(user.getEmailId(), createdUser.getEmailId());Assert.assertEquals(user.getPassword(), createdUser.getPassword());Assert.assertEquals(user.getFirstName(), createdUser.getFirstName());Assert.assertEquals(user.getLastName(), createdUser.getLastName());}@Testpublic void testUpdateUser() {long timestamp = System.currentTimeMillis();User user = userService.getUserById(2);user.setFirstName('TestFirstName'+timestamp);user.setLastName('TestLastName'+timestamp);userService.updateUser(user);User updatedUser = userService.getUserById(2);Assert.assertEquals(user.getFirstName(), updatedUser.getFirstName());Assert.assertEquals(user.getLastName(), updatedUser.getLastName());}@Testpublic void testDeleteUser() {User user = userService.getUserById(4);userService.deleteUser(user.getUserId());User deletedUser = userService.getUserById(4);Assert.assertNull(deletedUser);   }
}

现在,我将解释如何使用MyBatis注释支持执行CRUD操作,而无需在XML映射器文件中进行查询配置。

步骤#1 :创建一个表BLOG和一个Java域对象Blog。

CREATE TABLE  blog (blog_id int(10) unsigned NOT NULL auto_increment,blog_name varchar(45) NOT NULL,created_on datetime NOT NULL,PRIMARY KEY  (blog_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
package com.sivalabs.mybatisdemo.domain;import java.util.Date;public class Blog {private Integer blogId;private String blogName;private Date createdOn;@Overridepublic String toString() {return 'Blog [blogId=' + blogId + ', blogName=' + blogName+ ', createdOn=' + createdOn + ']';}//Seeters and getters
}

步骤2 :在Annotations中使用SQL查询创建UserMapper.java接口。

package com.sivalabs.mybatisdemo.mappers;import java.util.List;import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;import com.sivalabs.mybatisdemo.domain.Blog;public interface BlogMapper 
{@Insert('INSERT INTO BLOG(BLOG_NAME, CREATED_ON) VALUES(#{blogName}, #{createdOn})')@Options(useGeneratedKeys=true, keyProperty='blogId')public void insertBlog(Blog blog);@Select('SELECT BLOG_ID AS blogId, BLOG_NAME as blogName, CREATED_ON as createdOn FROM BLOG WHERE BLOG_ID=#{blogId}')public Blog getBlogById(Integer blogId);@Select('SELECT * FROM BLOG ')@Results({@Result(id=true, property='blogId', column='BLOG_ID'),@Result(property='blogName', column='BLOG_NAME'),@Result(property='createdOn', column='CREATED_ON')  })public List<Blog> getAllBlogs();@Update('UPDATE BLOG SET BLOG_NAME=#{blogName}, CREATED_ON=#{createdOn} WHERE BLOG_ID=#{blogId}')public void updateBlog(Blog blog);@Delete('DELETE FROM BLOG WHERE BLOG_ID=#{blogId}')public void deleteBlog(Integer blogId);}

步骤#3 :在mybatis-config.xml中配置BlogMapper

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE configurationPUBLIC '-//mybatis.org//DTD Config 3.0//EN''http://mybatis.org/dtd/mybatis-3-config.dtd'>
<configuration><properties resource='jdbc.properties'/><environments default='development'><environment id='development'><transactionManager type='JDBC'/><dataSource type='POOLED'><!-- <property name='driver' value='com.mysql.jdbc.Driver'/><property name='url' value='jdbc:mysql://localhost:3306/mybatis-demo'/><property name='username' value='root'/><property name='password' value='admin'/> --><property name='driver' value='${jdbc.driverClassName}'/><property name='url' value='${jdbc.url}'/><property name='username' value='${jdbc.username}'/><property name='password' value='${jdbc.password}'/></dataSource></environment></environments><mappers><mapper class='com.sivalabs.mybatisdemo.mappers.BlogMapper'/></mappers>
</configuration>

步骤#4 :创建BlogService.java

package com.sivalabs.mybatisdemo.service;import java.util.List;import org.apache.ibatis.session.SqlSession;import com.sivalabs.mybatisdemo.domain.Blog;
import com.sivalabs.mybatisdemo.mappers.BlogMapper;public class BlogService
{public void insertBlog(Blog blog) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);blogMapper.insertBlog(blog);sqlSession.commit();}finally{sqlSession.close();}}public Blog getBlogById(Integer blogId) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);return blogMapper.getBlogById(blogId);}finally{sqlSession.close();}}public List<Blog> getAllBlogs() {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);return blogMapper.getAllBlogs();}finally{sqlSession.close();}}public void updateBlog(Blog blog) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);blogMapper.updateBlog(blog);sqlSession.commit();}finally{sqlSession.close();}  }public void deleteBlog(Integer blogId) {SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();try{BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);blogMapper.deleteBlog(blogId);sqlSession.commit();}finally{sqlSession.close();}}}

步骤5 :为BlogService方法创建JUnit测试

package com.sivalabs.mybatisdemo;import java.util.Date;
import java.util.List;import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;import com.sivalabs.mybatisdemo.domain.Blog;
import com.sivalabs.mybatisdemo.service.BlogService;public class BlogServiceTest 
{private static BlogService blogService;@BeforeClasspublic static void setup() {blogService = new BlogService();}@AfterClasspublic static void teardown() {blogService = null;}@Testpublic void testGetBlogById() {Blog blog = blogService.getBlogById(1);Assert.assertNotNull(blog);System.out.println(blog);}@Testpublic void testGetAllBlogs() {List<Blog> blogs = blogService.getAllBlogs();Assert.assertNotNull(blogs);for (Blog blog : blogs) {System.out.println(blog);}}@Testpublic void testInsertBlog() {Blog blog = new Blog();blog.setBlogName('test_blog_'+System.currentTimeMillis());blog.setCreatedOn(new Date());blogService.insertBlog(blog);Assert.assertTrue(blog.getBlogId() != 0);Blog createdBlog = blogService.getBlogById(blog.getBlogId());Assert.assertNotNull(createdBlog);Assert.assertEquals(blog.getBlogName(), createdBlog.getBlogName());}@Testpublic void testUpdateBlog() {long timestamp = System.currentTimeMillis();Blog blog = blogService.getBlogById(2);blog.setBlogName('TestBlogName'+timestamp);blogService.updateBlog(blog);Blog updatedBlog = blogService.getBlogById(2);Assert.assertEquals(blog.getBlogName(), updatedBlog.getBlogName());}@Testpublic void testDeleteBlog() {Blog blog = blogService.getBlogById(4);blogService.deleteBlog(blog.getBlogId());Blog deletedBlog = blogService.getBlogById(4);Assert.assertNull(deletedBlog);}
}

参考: MyBatis教程:第1部分–来自JCG合作伙伴 Siva Reddy的CRUD操作,位于“我的实验在技术”博客上。

翻译自: https://www.javacodegeeks.com/2012/11/mybatis-tutorial-crud-operations-and-mapping-relationships-part-1.html

mybatis crud

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C语言实现字符串匹配KMP算法

相信很多人&#xff08;包括自己&#xff09;初识KMP算法的时候始终是丈二和尚摸不着头脑&#xff0c;要么完全不知所云&#xff0c;要么看不懂书上的解释&#xff0c;要么自己觉得好像心里了解KMP算法的意思&#xff0c;却说不出个究竟&#xff0c;所谓知其然不知其所以然是也…

Linux问题分析或解决_samba无法连接

1. windows设置方面问题 问题&#xff1a;window能连接部分服务器的samba共享&#xff0c;一部分无法连接。报错如截图。 解决&#xff1a;前提---其他人连接都没有问题&#xff0c;发现有问题的连接服务器的电脑是win10&#xff0c;而win10可以连接到的服务器系统比较新&#…

Drools 7支持DMN(决策模型和表示法)

决策模型和表示法&#xff08;DMN&#xff09;规范是OMG&#xff08;对象管理小组&#xff09;提出的相对较新的标准&#xff0c;旨在为业务规则和业务决策做些什么。 BPMN&#xff08;它的兄弟规范&#xff09;用于业务流程&#xff1a;标准化表示法和执行语义&#xff0c;以…

Ubuntu系统下Python虚拟环境构建详解

在编程开发中&#xff0c;我们经常会利用不同版本的协助软件包&#xff0c;这样就导致一些软件不能兼容&#xff0c;为了解决这个问题呢&#xff0c;我们在儿引进Python虚拟环境&#xff0c;我们安装好虚拟环境之后&#xff0c;进一步激活它&#xff0c;然后在虚拟环境中运行不…

字符串匹配算法

1. 朴素算法 朴素算法是最简单的字符串匹配算法&#xff0c;也是人们接触得最多的字符串匹配算法。 2. Rabin-Karp算法 一个时间复杂度为O(&#xff08;N-M1)*M)的字符串匹配算法&#xff0c;即Rabin-Karp算法。Rabin-Karp算法的预处理时间是O(m)&#xff0c; 匹配时间OO(&…

SolrCloud集群配置

前提&#xff1a; 1&#xff0c;已经做好zookeeper集群或伪集群配置. 2&#xff0c;已将solr部署到tomcat中 接下来&#xff0c;我们将zookeeper与tomcat进行关联 1 vim tomcat/bin/catalina.sh tomcat1的bin目录下catalina.sh文件在第二行加入 1 JAVA_OPTS"-Dbootstrap_c…

Ubuntu18.04 台式电脑插入耳机没有声音解决办法

最近换位ubnutu18.04后发现电脑戴耳机没有声音网上查了一下解决办法如下&#xff1a; 1、打开命令行&#xff0c;输入&#xff1a;sudo apt-get install pavucontrol 2、接着再命令行中输入: pavucontrol 在上面点击向右按钮&#xff0c;然后会出现configuration&#xff0…

第2章 网页基础知识

HTTP 基础术语HTTP 请求过程HTTP Headers 信息网页的组成网页的结构HTML节点树CSS 选择器爬虫的基本原理HTTP CookiesHTTP 代理转载于:https://www.cnblogs.com/pzk7788/p/10512338.html

适用于无服务器Java开发人员的AWS Lambda:它为您带来了什么?

无服务器计算如何帮助您的生产基础架构&#xff1f; 在过去的几年中&#xff0c;无服务器计算架构一直受到关注&#xff0c;因为它专注于应用程序的主要组件之一&#xff1a;服务器。 这种体系结构采用了不同的方法。 在下面的文章中&#xff0c;我们将解释无服务器的含义&am…

Python的sys.stdout、sys.stdin重定向

Python的sys.stdout、sys.stdin重定向 转自&#xff1a;http://www.cnblogs.com/turtle-fly/p/3280519.html 本文环境&#xff1a;Python 2.7 使用 print obj 而非 print(obj) 一些背景 sys.stdout 与 print 当我们在 Python 中打印对象调用 print obj 时候&#xff0c;事实上…

Win10+Ubuntu16.04/Ubuntu18.04双系统安装教程

最近因为开发需要安装Linux系统&#xff0c;因为安装好几次Ubuntu18.04失败&#xff0c;退而安装Ubuntu16.04 安装也失败好几次&#xff0c;在不断尝试下终于解决&#xff0c;后来思考一下觉得Ubuntu 16.04/18.04安装失败原因一致,先进行分享。 先把我遇到的问题给大家看看如下…

获取XML的文件信息

1 /**2 * 获取XML文件的信息3 */4 import java.io.IOException;5 import javax.xml.parsers.DocumentBuilder;6 import javax.xml.parsers.DocumentBuilderFactory;7 import javax.xml.parsers.ParserConfigurationException;8 import org.w3c.dom.Document;9 import org.w3c…

python 中的三元表达式(三目运算符)

python中的三目运算符不像其他语言 其他的一般都是 判定条件?为真时的结果:为假时的结果 如 result5>3?1:0 这个输出1&#xff0c;但没有什么意义&#xff0c;仅仅是一个例子。 而在python中的格式为 为真时的结果 if 判定条件 else 为假时的结果 还是上面的例子 1 if 5…

Linux 命令简单介绍第一课笔记

第一&#xff1a; 相对路径和绝对路径 相对路径:从当前路径开始进入blog文件夹 cd blog绝对路径&#xff1a;从跟目录开始进入blog文件夹 cd /home/yq/Desktop/blog 全称&#xff1a;根目录下home文件下的yq文件下的Desktop文件下的blog文件夹cd ./blog&#xff1a;进入当前…

我是如何转行 AI 并且实现薪资翻倍的

大家好啊&#xff0c;我是董董灿。 熟悉我的小伙伴都知道&#xff0c;我之前在北京某211大学&#xff0c;本硕读了7年的机械专业&#xff0c;后来硕士毕业后&#xff0c;果断转行去做了嵌入式开发&#xff0c;随后瞅准了 AI 爆发的时机果断转行去做了AI。 这段经历已经过去了…

16_1

从16年开始向前&#xff0c;就变得简单了 一、问题 一&#xff0c;给定一个数n&#xff0c;将这个数的各位顺序颠倒&#xff0c;称为逆序数m。 例如1234的逆序数是4321 如果m是n的整数倍&#xff0c;那么输出n*km&#xff0c;例如&#xff1a; 输入&#xff1a; 1089 输出&…

免费网络研讨会:调试生产中Java的新方法

什么是最有用的Java生产调试技术&#xff1f; 您永远不知道将新代码部署到生产中时会发生什么。 曾经很好的工作代码可能会变成有问题的应用程序&#xff0c;无法按预期工作。 这就是为什么在生产中进行调试是了解应用程序在现实生活中的行为而不是您如何思考其行为的关键要素。…

你必须了解的session的本质

有一点我们必须承认&#xff0c;大多数web应用程序都离不开session的使用。这篇文章将会结合PHP以及http协议来分析如何建立一个安全的会话管理机制。我们先简单的了解一些http的知识&#xff0c;从而理解该协议的无状态特性。然后&#xff0c;学习一些关于cookie的基本操作。最…

Linux 命令简单介绍第二课笔记

第一&#xff1a;touch touch 1.txt 创建文件第二&#xff1a;ls ls 用来查看当前文件中的内容&#xff0c;其中加上不同参数-a,-h,-l可以有不同的显示&#xff0c;同事也可以将一个具体内容从定向到一个TXT文件中&#xff1a;具体如下 第三&#xff1a;grep搜索 grep:文本搜索…

人工智能实战_第一次作业_杨佳宁_16141032

项目内容这个作业属于哪个课程班级博客这个作业的要求在哪里作业要求我在这个课程的目标是对于人工智能有一定的了解这个作业在哪个具体方面帮助我实现目标能够有平台支持我对于人工智能更加深入的了解与交流作业正文见下其他参考文献无具体作业1、描述你在这门课想要达到的具体…