{"id":51330,"date":"2025-08-10T21:24:33","date_gmt":"2025-08-10T13:24:33","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/51330.html"},"modified":"2025-08-10T21:24:33","modified_gmt":"2025-08-10T13:24:33","slug":"mybatis-%e6%a0%b8%e5%bf%83%e5%85%a5%e9%97%a8%ef%bc%9a%e4%bb%8e%e6%a6%82%e5%bf%b5%e5%88%b0%e5%ae%9e%e6%88%98%ef%bc%8c%e4%b8%80%e7%af%87%e6%8e%8c%e6%8f%a1%e7%ae%80%e5%8d%95%e5%a2%9e%e5%88%a0%e6%94%b9","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/51330.html","title":{"rendered":"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5"},"content":{"rendered":"<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"632\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810132432-68989d90654ff.png\" width=\"652\" \/><\/p>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"-toc\" style=\"margin-left:80px\">\n<p id=\"%E4%B8%80%E3%80%81%E4%BB%80%E4%B9%88%E6%98%AF%20MyBatis%EF%BC%9F%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E7%94%A8%E5%AE%83%EF%BC%9F-toc\" style=\"margin-left:0px\">\u4e00\u3001\u4ec0\u4e48\u662f MyBatis&#xff1f;\u4e3a\u4ec0\u4e48\u8981\u7528\u5b83&#xff1f;<\/p>\n<p id=\"%E4%BA%8C%E3%80%81MyBatis%20%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5%EF%BC%88%E9%80%9A%E4%BF%97%E7%90%86%E8%A7%A3%EF%BC%89-toc\" style=\"margin-left:0px\">\u4e8c\u3001MyBatis \u6838\u5fc3\u6982\u5ff5&#xff08;\u901a\u4fd7\u7406\u89e3&#xff09;<\/p>\n<p id=\"1.SqlSessionFactory-toc\" style=\"margin-left:40px\">1.SqlSessionFactory<\/p>\n<p id=\"2.SqlSession-toc\" style=\"margin-left:40px\">2.SqlSession<\/p>\n<p id=\"3.Mapper%E6%8E%A5%E5%8F%A3-toc\" style=\"margin-left:40px\">3.Mapper\u63a5\u53e3<\/p>\n<p id=\"4.%E6%98%A0%E5%B0%84%E6%96%87%E4%BB%B6%EF%BC%88XML%EF%BC%89-toc\" style=\"margin-left:40px\">4.\u6620\u5c04\u6587\u4ef6&#xff08;XML&#xff09;<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E6%89%8B%E6%8A%8A%E6%89%8B%E6%90%AD%E5%BB%BA%E7%AC%AC%E4%B8%80%E4%B8%AA%20MyBatis%20%E9%A1%B9%E7%9B%AE-toc\" style=\"margin-left:0px\">\u4e09\u3001\u624b\u628a\u624b\u642d\u5efa\u7b2c\u4e00\u4e2a MyBatis \u9879\u76ee<\/p>\n<p id=\"1.%20%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C-toc\" style=\"margin-left:40px\">1. \u51c6\u5907\u5de5\u4f5c<\/p>\n<p id=\"2.%20%E6%A0%B8%E5%BF%83%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%EF%BC%88mybatis-config.xml%EF%BC%89-toc\" style=\"margin-left:40px\">2. \u6838\u5fc3\u914d\u7f6e\u6587\u4ef6&#xff08;mybatis-config.xml&#xff09;<\/p>\n<p id=\"3.%20%E7%BC%96%E5%86%99%E5%AE%9E%E4%BD%93%E7%B1%BB%EF%BC%88User.java%EF%BC%89-toc\" style=\"margin-left:40px\">3. \u7f16\u5199\u5b9e\u4f53\u7c7b&#xff08;User.java&#xff09;<\/p>\n<p id=\"4.%20%E7%BC%96%E5%86%99%20Mapper%20%E6%8E%A5%E5%8F%A3%EF%BC%88UserMapper.java%EF%BC%89-toc\" style=\"margin-left:40px\">4. \u7f16\u5199 Mapper \u63a5\u53e3&#xff08;UserMapper.java&#xff09;<\/p>\n<p id=\"5.%20%E7%BC%96%E5%86%99%E6%98%A0%E5%B0%84%E6%96%87%E4%BB%B6(UserMapper.xml)-toc\" style=\"margin-left:40px\">5. \u7f16\u5199\u6620\u5c04\u6587\u4ef6(UserMapper.xml)<\/p>\n<p id=\"6.%20%E7%BC%96%E5%86%99%E6%B5%8B%E8%AF%95%E7%B1%BB%EF%BC%88MyBatisTest.java%EF%BC%89-toc\" style=\"margin-left:40px\">6. \u7f16\u5199\u6d4b\u8bd5\u7c7b&#xff08;MyBatisTest.java&#xff09;<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9%E6%80%BB%E7%BB%93-toc\" style=\"margin-left:0px\">\u56db\u3001\u6838\u5fc3\u77e5\u8bc6\u70b9\u603b\u7ed3<\/p>\n<p id=\"1.%E5%8F%82%E6%95%B0%E4%BC%A0%E9%80%92-toc\" style=\"margin-left:40px\">1.\u53c2\u6570\u4f20\u9012<\/p>\n<p id=\"2.%E7%BB%93%E6%9E%9C%E6%98%A0%E5%B0%84-toc\" style=\"margin-left:40px\">2.\u7ed3\u679c\u6620\u5c04<\/p>\n<hr \/>\n<h2 id=\"%E4%B8%80%E3%80%81%E4%BB%80%E4%B9%88%E6%98%AF%20MyBatis%EF%BC%9F%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E7%94%A8%E5%AE%83%EF%BC%9F\">\u4e00\u3001\u4ec0\u4e48\u662f MyBatis&#xff1f;\u4e3a\u4ec0\u4e48\u8981\u7528\u5b83&#xff1f;<\/h2>\n<p>MyBatis \u662f\u4e00\u6b3e Java \u534a\u81ea\u52a8\u5316\u6620\u5c04\u6846\u67b6&#xff0c;\u6838\u5fc3\u4f5c\u7528\u662f\u7b80\u5316\u6570\u636e\u5e93\u64cd\u4f5c\u3002<\/p>\n<p>\u5bf9\u6bd4\u4f20\u7edf JDBC&#xff1a;<\/p>\n<ul>\n<li>\u65e0\u9700\u624b\u52a8\u5199 Connection\u3001Statement\u3001ResultSet \u7b49\u91cd\u590d\u4ee3\u7801 SQL \u8bed\u53e5&#xff0c;\u51cf\u5c11\u4e8650%\u4ee5\u4e0a\u7684\u4ee3\u7801\u91cf\u3002<\/li>\n<li>\u4e0e Java \u4ee3\u7801\u5206\u79bb&#xff0c;\u4fbf\u4e8e\u7ef4\u62a4\u548c\u4f18\u5316 \u81ea\u52a8\u5b8c\u6210\u6570\u636e\u5e93\u5b57\u6bb5\u4e0e Java \u5b9e\u4f53\u7c7b\u7684\u6620\u5c04\u3002<\/li>\n<li>\u63d0\u4f9b\u6620\u5c04\u6807\u7b7e&#xff0c;\u652f\u6301\u5bf9\u8c61\u4e0e\u6570\u636e\u5e93\u7684 ORM \u5b57\u6bb5\u5173\u7cfb\u6620\u5c04\u3002<\/li>\n<\/ul>\n<p><span style=\"background-color:#ffd900\">\u7b80\u5355\u8bf4<\/span>&#xff1a;\u7528 MyBatis \u5199\u6570\u636e\u5e93\u64cd\u4f5c&#xff0c;\u66f4\u7b80\u5355\u3001\u66f4\u7075\u6d3b<\/p>\n<h2 id=\"%E4%BA%8C%E3%80%81MyBatis%20%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5%EF%BC%88%E9%80%9A%E4%BF%97%E7%90%86%E8%A7%A3%EF%BC%89\">\u4e8c\u3001MyBatis \u6838\u5fc3\u6982\u5ff5&#xff08;\u901a\u4fd7\u7406\u89e3&#xff09;<\/h2>\n<h3 id=\"1.SqlSessionFactory\">1.SqlSessionFactory<\/h3>\n<ul>\n<li>\u6570\u636e\u5e93\u8fde\u63a5\u7684 \u201c\u5de5\u5382\u201d&#xff0c;\u901a\u8fc7\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6\u521b\u5efa<\/li>\n<li>\u4f5c\u7528&#xff1a;\u751f\u4ea7SqlSession&#xff08;\u7c7b\u4f3c\u751f\u4ea7 \u201c\u6570\u636e\u5e93\u8fde\u63a5\u201d&#xff0c;\u540c\u6837\u4e5f\u9700\u8981\u5173\u95ed\u8d44\u6e90&#xff09;<\/li>\n<\/ul>\n<h3 id=\"2.SqlSession\">2.SqlSession<\/h3>\n<ul>\n<li>\u6570\u636e\u5e93\u4f1a\u8bdd\u5bf9\u8c61&#xff0c;\u76f8\u5f53\u4e8e\u201c\u6570\u636e\u5e93\u8fde\u63a5\u201d<\/li>\n<li>\u4f5c\u7528&#xff1a;\u83b7\u53d6Mapper\u63a5\u53e3&#xff0c;\u6267\u884cSQL\u64cd\u4f5c<\/li>\n<\/ul>\n<h3 id=\"3.Mapper%E6%8E%A5%E5%8F%A3\">3.Mapper\u63a5\u53e3<\/h3>\n<ul>\n<li>\u5b9a\u4e49\u6570\u636e\u5e93\u64cd\u4f5c\u65b9\u6cd5&#xff08;\u5982 selectUserById\u3001insertUser&#xff09;<\/li>\n<li>\u65e0\u9700\u5b9e\u73b0\u7c7b&#xff0c;MyBatis \u4f1a\u81ea\u52a8\u751f\u6210\u4ee3\u7406\u5bf9\u8c61<\/li>\n<\/ul>\n<h3 id=\"4.%E6%98%A0%E5%B0%84%E6%96%87%E4%BB%B6%EF%BC%88XML%EF%BC%89\">4.\u6620\u5c04\u6587\u4ef6&#xff08;XML&#xff09;<\/h3>\n<ul>\n<li>\u5b58\u653e SQL \u8bed\u53e5&#xff0c;\u4e0e Mapper \u63a5\u53e3\u4e00\u4e00\u5bf9\u5e94<\/li>\n<li>\u901a\u8fc7\u6807\u7b7e&#xff08;select\/insert \u7b49&#xff09;\u7ed1\u5b9a\u63a5\u53e3\u65b9\u6cd5<\/li>\n<\/ul>\n<h2 id=\"%E4%B8%89%E3%80%81%E6%89%8B%E6%8A%8A%E6%89%8B%E6%90%AD%E5%BB%BA%E7%AC%AC%E4%B8%80%E4%B8%AA%20MyBatis%20%E9%A1%B9%E7%9B%AE\">\u4e09\u3001\u624b\u628a\u624b\u642d\u5efa\u7b2c\u4e00\u4e2a MyBatis \u9879\u76ee<\/h2>\n<h3 id=\"1.%20%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C\">1. \u51c6\u5907\u5de5\u4f5c<\/h3>\n<p>\u6570\u636e\u5e93&#xff1a;MySQL&#xff0c;\u521b\u5efa user \u8868&#xff08;\u9644\u5efa\u8868 SQL&#xff09;&#xff1a;<\/p>\n<p>CREATE TABLE &#096;user&#096; (<br \/>\n  &#096;id&#096; int(11) PRIMARY KEY AUTO_INCREMENT,<br \/>\n  &#096;username&#096; varchar(50) NOT NULL,<br \/>\n  &#096;age&#096; int(3) DEFAULT NULL,<br \/>\n  &#096;create_time&#096; datetime DEFAULT NULL<br \/>\n) ENGINE&#061;InnoDB DEFAULT CHARSET&#061;utf8; <\/p>\n<p>\u9879\u76ee&#xff1a;Maven \u5de5\u7a0b&#xff0c;\u5f15\u5165\u4f9d\u8d56&#xff08;pom.xml&#xff09;&#xff1a;<\/p>\n<p>&lt;!&#8211; MyBatis \u6838\u5fc3\u5305 &#8211;&gt;<br \/>\n&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;org.mybatis&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;mybatis&lt;\/artifactId&gt;<br \/>\n    &lt;version&gt;3.5.10&lt;\/version&gt;<br \/>\n&lt;\/dependency&gt;<br \/>\n&lt;!&#8211; MySQL \u9a71\u52a8 &#8211;&gt;<br \/>\n&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;mysql&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;mysql-connector-java&lt;\/artifactId&gt;<br \/>\n    &lt;version&gt;8.0.30&lt;\/version&gt;<br \/>\n&lt;\/dependency&gt; <\/p>\n<h3 id=\"2.%20%E6%A0%B8%E5%BF%83%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%EF%BC%88mybatis-config.xml%EF%BC%89\">2. \u6838\u5fc3\u914d\u7f6e\u6587\u4ef6&#xff08;mybatis-config.xml&#xff09;<\/h3>\n<p>\u653e\u5728 resources \u76ee\u5f55\u4e0b&#xff0c;\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u548c\u6620\u5c04\u6587\u4ef6\u8def\u5f84&#xff1a;<\/p>\n<p>&lt;?xml version&#061;&#034;1.0&#034; encoding&#061;&#034;UTF-8&#034; ?&gt;<br \/>\n&lt;!DOCTYPE configuration PUBLIC &#034;-\/\/mybatis.org\/\/DTD Config 3.0\/\/EN&#034;<br \/>\n        &#034;http:\/\/mybatis.org\/dtd\/mybatis-3-config.dtd&#034;&gt;<br \/>\n&lt;configuration&gt;<br \/>\n    &lt;environments default&#061;&#034;development&#034;&gt;<br \/>\n        &lt;environment id&#061;&#034;development&#034;&gt;<br \/>\n            &lt;!&#8211; \u4e8b\u52a1\u7ba1\u7406&#xff1a;JDBC \u65b9\u5f0f &#8211;&gt;<br \/>\n            &lt;transactionManager type&#061;&#034;JDBC&#034;\/&gt;<br \/>\n            &lt;!&#8211; \u6570\u636e\u6e90&#xff1a;\u8fde\u63a5\u6c60\u65b9\u5f0f &#8211;&gt;<br \/>\n            &lt;dataSource type&#061;&#034;POOLED&#034;&gt;<br \/>\n                &lt;property name&#061;&#034;driver&#034; value&#061;&#034;com.mysql.cj.jdbc.Driver&#034;\/&gt;<br \/>\n                &lt;property name&#061;&#034;url&#034; value&#061;&#034;jdbc:mysql:\/\/localhost:3306\/mybatis_demo?useSSL&#061;false&#034;\/&gt;<br \/>\n                &lt;property name&#061;&#034;username&#034; value&#061;&#034;root&#034;\/&gt; &lt;!&#8211; \u4f60\u7684\u6570\u636e\u5e93\u7528\u6237\u540d &#8211;&gt;<br \/>\n                &lt;property name&#061;&#034;password&#034; value&#061;&#034;123456&#034;\/&gt; &lt;!&#8211; \u4f60\u7684\u6570\u636e\u5e93\u5bc6\u7801 &#8211;&gt;<br \/>\n            &lt;\/dataSource&gt;<br \/>\n        &lt;\/environment&gt;<br \/>\n    &lt;\/environments&gt;<\/p>\n<p>    &lt;!&#8211; \u6620\u5c04\u6587\u4ef6\u8def\u5f84&#xff1a;\u6307\u5b9a Mapper XML \u4f4d\u7f6e &#8211;&gt;<br \/>\n    &lt;mappers&gt;<br \/>\n        &lt;mapper resource&#061;&#034;mapper\/UserMapper.xml&#034;\/&gt;<br \/>\n    &lt;\/mappers&gt;<br \/>\n&lt;\/configuration&gt; <\/p>\n<h3 id=\"3.%20%E7%BC%96%E5%86%99%E5%AE%9E%E4%BD%93%E7%B1%BB%EF%BC%88User.java%EF%BC%89\">3. \u7f16\u5199\u5b9e\u4f53\u7c7b&#xff08;User.java&#xff09;<\/h3>\n<p>\u5c5e\u6027\u4e0e\u8868\u5b57\u6bb5\u5bf9\u5e94&#xff08;\u5efa\u8bae\u7528\u9a7c\u5cf0\u547d\u540d&#xff0c;\u5982 createTime \u5bf9\u5e94\u8868 create_time&#xff09;&#xff1a;<\/p>\n<p>public class User {<br \/>\n    private Integer id;<br \/>\n    private String username;<br \/>\n    private Integer age;<br \/>\n    private LocalDateTime createTime;<\/p>\n<p>    \/\/ \u7701\u7565 getter\u3001setter\u3001toString \u65b9\u6cd5<br \/>\n} <\/p>\n<h3 id=\"4.%20%E7%BC%96%E5%86%99%20Mapper%20%E6%8E%A5%E5%8F%A3%EF%BC%88UserMapper.java%EF%BC%89\">4. \u7f16\u5199 Mapper \u63a5\u53e3&#xff08;UserMapper.java&#xff09;<\/h3>\n<p>\u5b9a\u4e49\u6570\u636e\u5e93\u64cd\u4f5c\u65b9\u6cd5&#xff1a;<\/p>\n<p>public interface UserMapper {<\/p>\n<p>    \/\/\u67e5\u8be2\u6240\u6709\u7528\u6237<br \/>\n    List&lt;User&gt; selectAllUser();<\/p>\n<p>    \/\/ \u6839\u636e ID \u67e5\u8be2\u7528\u6237<br \/>\n    User selectById(Integer id);<\/p>\n<p>    \/\/ \u65b0\u589e\u7528\u6237<br \/>\n    int insert(User user);<\/p>\n<p>    \/\/ \u6839\u636e ID \u4fee\u6539\u7528\u6237<br \/>\n    int updateById(User user);<\/p>\n<p>    \/\/ \u6839\u636e ID \u5220\u9664\u7528\u6237<br \/>\n    int deleteById(Integer id);<br \/>\n} <\/p>\n<h3 id=\"5.%20%E7%BC%96%E5%86%99%E6%98%A0%E5%B0%84%E6%96%87%E4%BB%B6(UserMapper.xml)\">5. \u7f16\u5199\u6620\u5c04\u6587\u4ef6(UserMapper.xml)<\/h3>\n<p>\u653e\u5728 resources\/mapper \u76ee\u5f55\u4e0b&#xff0c;\u7ed1\u5b9a Mapper \u63a5\u53e3\u5e76\u5199 SQL&#xff1a;<\/p>\n<p>&lt;?xml version&#061;&#034;1.0&#034; encoding&#061;&#034;UTF-8&#034; ?&gt;<br \/>\n&lt;!DOCTYPE mapper PUBLIC &#034;-\/\/mybatis.org\/\/DTD Mapper 3.0\/\/EN&#034;<br \/>\n        &#034;http:\/\/mybatis.org\/dtd\/mybatis-3-mapper.dtd&#034;&gt;<br \/>\n&lt;!&#8211; namespace \u5fc5\u987b\u4e0e Mapper \u63a5\u53e3\u5168\u7c7b\u540d\u4e00\u81f4 &#8211;&gt;<br \/>\n&lt;mapper namespace&#061;&#034;com.example.mapper.UserMapper&#034;&gt;<\/p>\n<p>    &lt;!&#8211; \u67e5\u8be2&#xff1a;id \u4e0e\u63a5\u53e3\u65b9\u6cd5\u540d\u4e00\u81f4&#xff0c;resultType \u662f\u8fd4\u56de\u7c7b\u578b &#8211;&gt;<br \/>\n    &lt;select id&#061;&#034;selectById&#034; resultType&#061;&#034;com.example.pojo.User&#034;&gt;<br \/>\n        select * from user where id &#061; #{id}<br \/>\n    &lt;\/select&gt;<\/p>\n<p>    &lt;!&#8211; \u65b0\u589e&#xff1a;useGeneratedKeys \u83b7\u53d6\u81ea\u589e\u4e3b\u952e&#xff0c;keyProperty \u7ed1\u5b9a\u5b9e\u4f53\u7c7b\u5c5e\u6027 &#8211;&gt;<br \/>\n    &lt;insert id&#061;&#034;insert&#034; useGeneratedKeys&#061;&#034;true&#034; keyProperty&#061;&#034;id&#034;&gt;<br \/>\n        insert into user(username, age, create_time)<br \/>\n        values(#{username}, #{age}, #{createTime})<br \/>\n    &lt;\/insert&gt;<\/p>\n<p>    &lt;!&#8211; \u4fee\u6539 &#8211;&gt;<br \/>\n    &lt;update id&#061;&#034;updateById&#034;&gt;<br \/>\n        update user set<br \/>\n            username &#061; #{username},<br \/>\n            age &#061; #{age}<br \/>\n        where id &#061; #{id}<br \/>\n    &lt;\/update&gt;<\/p>\n<p>    &lt;!&#8211; \u5220\u9664 &#8211;&gt;<br \/>\n    &lt;delete id&#061;&#034;deleteById&#034;&gt;<br \/>\n        delete from user where id &#061; #{id}<br \/>\n    &lt;\/delete&gt;<br \/>\n&lt;\/mapper&gt; <\/p>\n<p>#{}\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u5360\u4f4d\u7b26\u8bed\u6cd5&#xff0c; \u7528\u4e8e\u5c06\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f\u7684\u7ed3\u679c\u5d4c\u5165\u5230\u53cc\u5f15\u53f7\/\u5355\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d&#xff0c;\u81ea\u52a8\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\u3002&#xff08;\u80fd\u591f\u6709\u6548\u9632\u6b62sql\u6ce8\u5165\u95ee\u9898&#xff09;<\/p>\n<h3 id=\"6.%20%E7%BC%96%E5%86%99%E6%B5%8B%E8%AF%95%E7%B1%BB%EF%BC%88MyBatisTest.java%EF%BC%89\">6. \u7f16\u5199\u6d4b\u8bd5\u7c7b&#xff08;MyBatisTest.java&#xff09;<\/h3>\n<p>\u901a\u8fc7SqlSession\u6267\u884c\u64cd\u4f5c&#xff1a;<\/p>\n<p>public class MyBatisTest {<br \/>\n    public static void main(String[] args) throws IOException {<br \/>\n        \/\/ 1. \u8bfb\u53d6\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6<br \/>\n        InputStream is &#061; Resources.getResourceAsStream(&#034;mybatis-config.xml&#034;);<\/p>\n<p>        \/\/ 2. \u521b\u5efa SqlSessionFactory<br \/>\n        SqlSessionFactory factory &#061; new SqlSessionFactoryBuilder().build(is);<\/p>\n<p>        \/\/ 3. \u83b7\u53d6 SqlSession&#xff08;true \u8868\u793a\u81ea\u52a8\u63d0\u4ea4\u4e8b\u52a1&#xff09;<br \/>\n        SqlSession session &#061; factory.openSession(true);<\/p>\n<p>        \/\/ 4. \u83b7\u53d6 Mapper \u63a5\u53e3\u4ee3\u7406\u5bf9\u8c61<br \/>\n        UserMapper userMapper &#061; session.getMapper(UserMapper.class);<\/p>\n<p>        \/\/ 5. \u6267\u884c SQL \u64cd\u4f5c<br \/>\n        \/\/ \u65b0\u589e\u7528\u6237<br \/>\n        User user &#061; new User();<br \/>\n        user.setUsername(&#034;\u5f20\u4e09&#034;);<br \/>\n        user.setAge(20);<br \/>\n        user.setCreateTime(LocalDateTime.now());<br \/>\n        int insert &#061; userMapper.insert(user);<br \/>\n        System.out.println(&#034;\u65b0\u589e\u6210\u529f&#xff0c;\u5f71\u54cd\u884c\u6570&#xff1a;&#034; &#043; insert);<br \/>\n        System.out.println(&#034;\u65b0\u589e\u7684\u7528\u6237 ID&#xff1a;&#034; &#043; user.getId()); \/\/ \u81ea\u589e ID \u4f1a\u56de\u663e<\/p>\n<p>        \/\/ \u67e5\u8be2\u7528\u6237&#xff08;\u7528\u4e0a\u9762\u65b0\u589e\u7684 ID&#xff09;<br \/>\n        User queryUser &#061; userMapper.selectById(user.getId());<br \/>\n        System.out.println(&#034;\u67e5\u8be2\u7ed3\u679c&#xff1a;&#034; &#043; queryUser);<\/p>\n<p>        \/\/ \u4fee\u6539\u7528\u6237<br \/>\n        queryUser.setAge(21);<br \/>\n        int update &#061; userMapper.updateById(queryUser);<br \/>\n        System.out.println(&#034;\u4fee\u6539\u6210\u529f&#xff0c;\u5f71\u54cd\u884c\u6570&#xff1a;&#034; &#043; update);<\/p>\n<p>        \/\/ \u5220\u9664\u7528\u6237<br \/>\n        int delete &#061; userMapper.deleteById(user.getId());<br \/>\n        System.out.println(&#034;\u5220\u9664\u6210\u529f&#xff0c;\u5f71\u54cd\u884c\u6570&#xff1a;&#034; &#043; delete);<\/p>\n<p>        \/\/ 6. \u5173\u95ed\u4f1a\u8bdd<br \/>\n        session.close();<br \/>\n    }<br \/>\n} <\/p>\n<h2 id=\"%E5%9B%9B%E3%80%81%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9%E6%80%BB%E7%BB%93\">\u56db\u3001\u6838\u5fc3\u77e5\u8bc6\u70b9\u603b\u7ed3<\/h2>\n<h3 id=\"1.%E5%8F%82%E6%95%B0%E4%BC%A0%E9%80%92\">1.\u53c2\u6570\u4f20\u9012<\/h3>\n<ul>\n<li>\u5355\u4e2a\u53c2\u6570&#xff1a;\u76f4\u63a5\u7528 #{\u53c2\u6570\u540d}&#xff08;\u5982 #{id}&#xff09;<\/li>\n<li>\u591a\u4e2a\u53c2\u6570&#xff1a;\u6709\u4e24\u79cd\u65b9\u6cd5&#xff1a;&#xff08;1&#xff09;\u4f20\u5165\u53c2\u6570\u65f6\u653e\u5165Map\u952e\u503c\u5bf9&#xff0c;\u901a\u8fc7\u952e\u540d\u8bbf\u95ee\u503c&#xff0c;\u8fbe\u5230\u4f20\u5165\u591a\u4e2a\u53c2\u6570\u7684\u76ee\u7684&#xff1b;&#xff08;2&#xff09;\u4f20\u5165\u53c2\u6570\u65f6\u5c06\u8981\u4f20\u5165\u7684\u503c\u5c01\u88c5\u5230\u5b9e\u4f53\u7c7b\u4e2d&#xff0c;\u901a\u8fc7\u8bbf\u95ee\u5b9e\u4f53\u7c7b\u5c5e\u6027\u540d\u4f20\u5165\u591a\u4e2a\u53c2\u6570<\/li>\n<li>\u5b9e\u4f53\u7c7b\u53c2\u6570&#xff1a;\u7528 #{\u5c5e\u6027\u540d}&#xff08;\u5982 #{username} \u5bf9\u5e94 user.getUsername()&#xff09;<\/li>\n<\/ul>\n<h3 id=\"2.%E7%BB%93%E6%9E%9C%E6%98%A0%E5%B0%84\">2.\u7ed3\u679c\u6620\u5c04<\/h3>\n<ul>\n<li>\u8868\u5b57\u6bb5\u4e0e\u5b9e\u4f53\u5c5e\u6027\u540d\u4e00\u81f4&#xff1a;\u7528 resultType \u76f4\u63a5\u6307\u5b9a\u5b9e\u4f53\u7c7b<\/li>\n<li>\u7b26\u5408Mybatis\u5b9a\u4e49\u6620\u5c04\u89c4\u5219&#xff1a;\u7528 resultType \u76f4\u63a5\u6307\u5b9a\u5b9e\u4f53\u7c7b&#xff0c;\u5e76\u4e14\u5728mybatis-config.xml\u91cc\u9762\u914d\u7f6e\u9a7c\u5cf0\u6620\u5c04<\/li>\n<li>\u4e0d\u4e00\u81f4&#xff1a;\u7528 resultMap \u624b\u52a8\u6620\u5c04<\/li>\n<\/ul>\n<p> &lt;settings&gt;<br \/>\n    &lt;!&#8211;\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u4e0b\u5212\u7ebf\u6620\u5c04\u4e3a\u9a7c\u5cf0&#8211;&gt;<br \/>\n    &lt;setting name&#061;&#034;mapUnderscoreToCamelCase&#034; value&#061;&#034;true&#034;\/&gt;<br \/>\n&lt;\/settings&gt; <\/p>\n<p>\u4f4d\u7f6e\u653e\u4e8emybatis-config.xml\u4e2d&lt;environments&gt;\u524d<\/p>\n<p>&lt;resultMap id&#061;&#034;userMap&#034; type&#061;&#034;com.example.pojo.User&#034;&gt;<br \/>\n    &lt;id column&#061;&#034;id&#034; property&#061;&#034;id&#034;\/&gt; &lt;!&#8211; \u4e3b\u952e &#8211;&gt;<br \/>\n    &lt;result column&#061;&#034;username&#034; property&#061;&#034;username&#034;\/&gt;<br \/>\n    &lt;result column&#061;&#034;age&#034; property&#061;&#034;age&#034;\/&gt;<br \/>\n    &lt;result column&#061;&#034;create_time&#034; property&#061;&#034;createTime&#034;\/&gt; &lt;!&#8211; \u5b57\u6bb5\u4e0e\u5c5e\u6027\u6620\u5c04 &#8211;&gt;<br \/>\n&lt;\/resultMap&gt; <\/p>\n<h3 id=\"\"><\/h3>\n<h2 id=\"\"><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb452\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf8\u6b21\u3002MyBatis\u662f\u4e00\u6b3eJava\u534a\u81ea\u52a8\u5316ORM\u6846\u67b6\uff0c\u901a\u8fc7\u7b80\u5316JDBC\u64cd\u4f5c\u63d0\u5347\u5f00\u53d1\u6548\u7387\u3002\u672c\u6587\u4ecb\u7ecd\u4e86MyBatis\u7684\u6838\u5fc3\u6982\u5ff5\uff1aSqlSessionFactory\uff08\u6570\u636e\u5e93\u8fde\u63a5\u5de5\u5382\uff09\u3001SqlSession\uff08\u6570\u636e\u5e93\u4f1a\u8bdd\uff09\u3001Mapper\u63a5\u53e3\u548cXML\u6620\u5c04\u6587\u4ef6\u3002\u901a\u8fc7\u521b\u5efaMySQL\u7528\u6237\u8868\u3001\u914d\u7f6eMaven\u4f9d\u8d56\u3001\u7f16\u5199\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6mybatis-config.xml\u3001\u5b9e\u4f53\u7c7bUser.java\u548cMapper\u63a5\u53e3\uff0c\u5b9e\u73b0\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684MyBatis\u9879\u76ee\u3002\u6d4b\u8bd5\u7c7b\u6f14\u793a\u4e86CRUD\u64cd\u4f5c\uff0c\u5e76\u603b\u7ed3\u4e86\u53c2\u6570\u4f20\u9012\uff08\u5355\u4e2a\/\u591a\u4e2a\u53c2\u6570\u3001\u5b9e\u4f53\u7c7b\u53c2\u6570\uff09\u548c\u7ed3\u679c\u6620\u5c04\uff08\u81ea\u52a8\u6620<\/p>\n","protected":false},"author":2,"featured_media":51329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1769],"topic":[],"class_list":["post-51330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-mybatis"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/51330.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb452\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf8\u6b21\u3002MyBatis\u662f\u4e00\u6b3eJava\u534a\u81ea\u52a8\u5316ORM\u6846\u67b6\uff0c\u901a\u8fc7\u7b80\u5316JDBC\u64cd\u4f5c\u63d0\u5347\u5f00\u53d1\u6548\u7387\u3002\u672c\u6587\u4ecb\u7ecd\u4e86MyBatis\u7684\u6838\u5fc3\u6982\u5ff5\uff1aSqlSessionFactory\uff08\u6570\u636e\u5e93\u8fde\u63a5\u5de5\u5382\uff09\u3001SqlSession\uff08\u6570\u636e\u5e93\u4f1a\u8bdd\uff09\u3001Mapper\u63a5\u53e3\u548cXML\u6620\u5c04\u6587\u4ef6\u3002\u901a\u8fc7\u521b\u5efaMySQL\u7528\u6237\u8868\u3001\u914d\u7f6eMaven\u4f9d\u8d56\u3001\u7f16\u5199\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6mybatis-config.xml\u3001\u5b9e\u4f53\u7c7bUser.java\u548cMapper\u63a5\u53e3\uff0c\u5b9e\u73b0\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684MyBatis\u9879\u76ee\u3002\u6d4b\u8bd5\u7c7b\u6f14\u793a\u4e86CRUD\u64cd\u4f5c\uff0c\u5e76\u603b\u7ed3\u4e86\u53c2\u6570\u4f20\u9012\uff08\u5355\u4e2a\/\u591a\u4e2a\u53c2\u6570\u3001\u5b9e\u4f53\u7c7b\u53c2\u6570\uff09\u548c\u7ed3\u679c\u6620\u5c04\uff08\u81ea\u52a8\u6620\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/51330.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-10T13:24:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810132432-68989d90654ff.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/51330.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/51330.html\",\"name\":\"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-10T13:24:33+00:00\",\"dateModified\":\"2025-08-10T13:24:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/51330.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/51330.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/51330.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/51330.html","og_locale":"zh_CN","og_type":"article","og_title":"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb452\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf8\u6b21\u3002MyBatis\u662f\u4e00\u6b3eJava\u534a\u81ea\u52a8\u5316ORM\u6846\u67b6\uff0c\u901a\u8fc7\u7b80\u5316JDBC\u64cd\u4f5c\u63d0\u5347\u5f00\u53d1\u6548\u7387\u3002\u672c\u6587\u4ecb\u7ecd\u4e86MyBatis\u7684\u6838\u5fc3\u6982\u5ff5\uff1aSqlSessionFactory\uff08\u6570\u636e\u5e93\u8fde\u63a5\u5de5\u5382\uff09\u3001SqlSession\uff08\u6570\u636e\u5e93\u4f1a\u8bdd\uff09\u3001Mapper\u63a5\u53e3\u548cXML\u6620\u5c04\u6587\u4ef6\u3002\u901a\u8fc7\u521b\u5efaMySQL\u7528\u6237\u8868\u3001\u914d\u7f6eMaven\u4f9d\u8d56\u3001\u7f16\u5199\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6mybatis-config.xml\u3001\u5b9e\u4f53\u7c7bUser.java\u548cMapper\u63a5\u53e3\uff0c\u5b9e\u73b0\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684MyBatis\u9879\u76ee\u3002\u6d4b\u8bd5\u7c7b\u6f14\u793a\u4e86CRUD\u64cd\u4f5c\uff0c\u5e76\u603b\u7ed3\u4e86\u53c2\u6570\u4f20\u9012\uff08\u5355\u4e2a\/\u591a\u4e2a\u53c2\u6570\u3001\u5b9e\u4f53\u7c7b\u53c2\u6570\uff09\u548c\u7ed3\u679c\u6620\u5c04\uff08\u81ea\u52a8\u6620","og_url":"https:\/\/www.wsisp.com\/helps\/51330.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-10T13:24:33+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810132432-68989d90654ff.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/51330.html","url":"https:\/\/www.wsisp.com\/helps\/51330.html","name":"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-10T13:24:33+00:00","dateModified":"2025-08-10T13:24:33+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/51330.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/51330.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/51330.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MyBatis \u6838\u5fc3\u5165\u95e8\uff1a\u4ece\u6982\u5ff5\u5230\u5b9e\u6218\uff0c\u4e00\u7bc7\u638c\u63e1\u7b80\u5355\u589e\u5220\u6539\u67e5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/51330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=51330"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/51330\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/51329"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=51330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=51330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=51330"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=51330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}