{"id":9504,"date":"2023-02-24T14:48:56","date_gmt":"2023-02-24T06:48:56","guid":{"rendered":"http:\/\/123.57.164.21\/?p=9504"},"modified":"2023-02-24T14:48:56","modified_gmt":"2023-02-24T06:48:56","slug":"spring-boot-%e5%a4%9a%e7%a7%8d%e4%b8%8d%e5%90%8c%e7%b1%bb%e5%9e%8b%e6%95%b0%e6%8d%ae%e5%ba%93%e5%92%8c%e5%a4%9a%e6%95%b0%e6%8d%ae%e6%ba%90%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=9504","title":{"rendered":"Spring Boot \u591a\u79cd\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\u548c\u591a\u6570\u636e\u6e90\u914d\u7f6e"},"content":{"rendered":"\n<p><strong>\u524d\u8a00<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>spring boot\u5bf9\u591a\u79cd\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\uff0c\u591a\u6570\u636e\u6e90\u914d\u7f6e\u4f7f\u7528<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.spring.io\/spring-boot\/docs\/current\/api\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u591a\u6570\u636e\u6e90\u914d\u7f6e\u76f8\u5173\u5b98\u65b9API\uff1ahttps:\/\/docs.spring.io\/spring-boot\/docs\/current\/api\/<\/a><\/p>\n\n\n\n<p>\u73af\u5883\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>\u3000\u3000\u5f00\u53d1\u73af\u5883IDE\uff1aIntelliJ IDEA<\/p>\n\n\n\n<p>\u3000\u3000spring boot\u7248\u672c\uff1a1.5.9<\/p>\n\n\n\n<p>\u3000\u3000hibernate\u7248\u672c\uff1a5.0.12<\/p>\n\n\n\n<p>\u3000\u3000\u591a\u6570\u636e\u6e90\uff1a sql server2008 \u548c mysql 5.5<\/p>\n\n\n\n<p><strong>\u00a0\u5b9e\u73b0\u601d\u8def<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5b9e\u73b0\u591a\u6570\u636e\u6e90\u7684\u914d\u7f6e\u8fde\u63a5\uff0c\u4e3b\u8981\u601d\u8def\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>1\u300b\u9996\u5148\u5728application.properties\u4e2d\u914d\u7f6e\u4e24\u4e2a\u6570\u636e\u6e90&nbsp; \u548c\u5fc5\u8981\u7684JPA\u76f8\u5173\u914d\u7f6e<\/p>\n\n\n\n<p>2\u300bDataSourceConfig\u603b\u88c5\u8f7d\u7c7b\uff0c\u5206\u522b\u58f0\u660e\u591a\u4e2a\u6570\u636e\u6e90\u3010\u5e76\u6307\u5b9a\u5176\u4e2d\u4e00\u4e2a\u6570\u636e\u6e90\u4e3a\u4e3b\u6570\u636e\u6e90\u3011<\/p>\n\n\n\n<p>3\u300b\u5206\u522b\u521b\u5efa\u591a\u4e2a\u6570\u636e\u6e90\u7684\u5177\u4f53\u88c5\u8f7d\u7c7b\uff0c\u4f8b\u5982MyagenDataSourceConfig\uff0c\u5e76\u5728\u5177\u4f53\u88c5\u8f7d\u7c7b\u4e2d\uff0c\u6ce8\u5165\u5e76\u5b8c\u5584JpaProperties\uff0c\u58f0\u660e\u5e76\u5f15\u7528<strong>\u5b9e\u4f53\u7ba1\u7406<\/strong>\u548c<strong>\u4e8b\u52a1\u7ba1\u7406\uff0c<\/strong>\u5e76\u5728\u8fc7\u7a0b\u4e2d\u6307\u5b9a\u4e86<strong>\u672c\u6570\u636e\u6e90\u8981\u4f5c\u7528\u7684\u5305\u7684\u8303\u56f4<\/strong><\/p>\n\n\n\n<p>4\u300b\u6839\u636e\u7b2c3\u6b65\u4e2d\u6307\u5b9a\u7684\u5305\uff0c\u5206\u522b\u5bf9\u5e94\u591a\u4e2a\u6570\u636e\u6e90\u7684\u5177\u4f53\u88c5\u8f7d\u7c7b\uff0c\u521b\u5efa\u5305\u7ed3\u6784\uff0c\u4ee5\u53ca\u751f\u6210\u5b9e\u4f53\u548c\u5bf9\u5e94\u7684repository\u5c42\u64cd\u4f5c<\/p>\n\n\n\n<p>5\u300b\u6700\u540e\u518dcontroller\u5c42\uff0c\u4f9d\u6b21\u8c03\u7528\u5404\u79cd\u6570\u636e\u6e90\u5bf9\u5e94\u7684\u5404\u4e2a\u5305\u4e0b\u7684\u5404\u79cdrepository\u64cd\u4f5c\u8fdb\u884c\u64cd\u4f5c<\/p>\n\n\n\n<p>\u90a3\u4e48\u4e3b\u8981\u5b9e\u73b0\u76ee\u5f55\u5982\u4e0b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-154-866x1024.png\" alt=\"\" class=\"wp-image-9505\" width=\"466\" height=\"551\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154-866x1024.png 866w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154-254x300.png 254w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154-768x908.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154-830x982.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154-230x272.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154-350x414.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154-480x568.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-154.png 952w\" sizes=\"(max-width: 466px) 100vw, 466px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u5b9e\u9645\u64cd\u4f5c<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>1\u300b\u9996\u5148\u5728application.properties\u4e2d\u914d\u7f6e\u4e24\u4e2a\u6570\u636e\u6e90\u00a0 \u548c\u5fc5\u8981\u7684JPA\u76f8\u5173\u914d\u7f6e<\/strong><\/p>\n\n\n\n<p>\u5b8c\u6574\u4ee3\u7801\uff1a<\/p>\n\n\n\n<p>application.properties<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#datasource\nmyagen.spring.datasource.url=jdbc:sqlserver:\/\/localhost:1433;databasename=geneShop\nmyagen.spring.datasource.username=sa\nmyagen.spring.datasource.password=398023\nmyagen.spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver\n\n\norderdiscount.spring.datasource.url=jdbc:mysql:\/\/localhost:3306\/orderdiscount\norderdiscount.spring.datasource.username=root\norderdiscount.spring.datasource.password=root\norderdiscount.spring.datasource.driver-class-name=com.mysql.jdbc.Driver\n\n#jpa \u9700\u8981\u5355\u72ec\u63d0\u51fa\u6765\nspring.jpa.show-sql=true<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">1.\u8fd9\u4e2a\u5b9e\u73b0\u7684\u4f8b\u5b50\u4e2d\u3002\u4f7f\u7528\u7684\u591a\u6570\u636e\u6e90\u662f\u4e0d\u540c\u6570\u636e\u5e93\u7c7b\u578b\u4e0b\u7684\u591a\u6570\u636e\u6e90\u3002\n\n2.\u7136\u540e\u4ec5\u9700\u8981\u5728application.properties\u4e2d\u914d\u7f6espring.datasource\u4e0b\u7684\u5fc5\u8981\u5c5e\u6027\uff0c\u5f53\u7136\uff0c\u9664\u4e86\u8fd94\u4e2a\u5fc5\u8981\u5c5e\u6027\u4e4b\u5916\uff0c\u8fd8\u6709\u5f88\u591a\u5173\u4e8espring.datasource\u7684\u914d\u7f6e\uff0c\u5177\u4f53\u53ef\u4ee5\u67e5\u770b\uff0cspring boot\u5b98\u65b9\u5b8c\u6574\u6587\u6863\uff1ahttp:\/\/www.cnblogs.com\/sxdcgaq8080\/p\/7724506.html\uff0c\u8fdb\u5165\u641c\u7d22\u3010spring.datasource\u3011\uff0c\u5c31\u53ef\u4ee5\u627e\u5230\u5b8c\u6574\u7684\u5173\u4e8e\u5b83\u7684\u914d\u7f6e\u5c5e\u6027\u540d\u3002\n\n3.\u8fd9\u91cc\u5206\u522b\u5bf9\u591a\u6570\u636e\u6e90\u524d\u9762\u7684\u5c5e\u6027\u547d\u540d\u5206\u522b\u6dfb\u52a0\u4e86\u6807\u8bc6\u7528\u4e8e\u6807\u8bc6\u4e0d\u540c\u7684\u6570\u636e\u6e90\u3002\u4f8b\u5982\uff1a\n\nmyagen.spring.datasource.url \u548c  orderdiscount.spring.datasource.url\n\n\u5177\u4f53\u8fd9\u4e2a\u6807\u8bc6\u600e\u4e48\u7528\uff0c\u5c31\u662f\u7528\u4e8e\u5728\u7b2c\u4e8c\u6b65\u4e2d\u53d6\u524d\u7f00\u5206\u522b\u88c5\u8f7d\u4e0d\u540c\u6570\u636e\u6e90\u7684\u65f6\u5019\u7528\u3002\u9700\u8981\u660e\u767d\u4e00\u70b9\uff1aapplication.properties\u6587\u4ef6\u4e2d\u5b9a\u4e49\u952e\u540d\u4e3a\u4ec0\u4e48\u90fd\u4e0d\u4f1a\u62a5\u9519\uff0c\u4f46\u662f\u5982\u679c\u4e0d\u7b26\u5408\u89c4\u8303\u4e14\u4f60\u81ea\u5df1\u6ca1\u6709\u53bb\u5904\u7406\uff0c\u90a3\u4f60\u914d\u7f6e\u7684\u952e\u503c\u5bf9\u5e76\u4e0d\u4f1a\u88ab\u52a0\u8f7d\u800c\u8d77\u4f5c\u7528\u3002\n\n4.\u518d\u8bf4spring.jpa.show-sql\uff0c\u8fd9\u4e2a\u5c5e\u6027\u540d\u4e0d\u4f1a\u56e0\u4e3a\u5728\u4e0d\u540c\u6570\u636e\u5e93\u4e0b\u5c31\u4e0d\u8d77\u4f5c\u7528\u4e86\uff0c\u6240\u4ee5\uff0c\u76f4\u63a5\u914d\u7f6e\u5728\u8fd9\u91cc\u5373\u53ef\u3002\n\n5.\u6700\u540e\u8981\u8bf4\u7684\u662fhibernate.dialect,\u65b9\u8a00\u7b49\u7b49\u548c\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\u6709\u5173\u8054\u7684\u5c5e\u6027\u503c\uff0c\u4e0d\u80fd\u914d\u7f6e\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u56e0\u4e3a\u6ca1\u529e\u6cd5\u89e3\u6790\uff0c\u6240\u4ee5\u8fd9\u4e2a\u8981\u653e\u5728\u7b2c3\u6b65\u4e2d\u5904\u7406\uff0c\u5982\u679c\u9700\u8981\u67e5\u770b\u8fd9\u4e2a\uff0c\u53ef\u4ee5\u76f4\u63a5\u8df3\u5230\u7b2c\u4e09\u6b65<\/pre>\n\n\n\n<p><strong>2\u300bDataSourceConfig\u603b\u88c5\u8f7d\u7c7b\uff0c\u5206\u522b\u58f0\u660e\u591a\u4e2a\u6570\u636e\u6e90\u3010\u5e76\u6307\u5b9a\u5176\u4e2d\u4e00\u4e2a\u6570\u636e\u6e90\u4e3a\u4e3b\u6570\u636e\u6e90\u3011<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-155-1024x492.png\" alt=\"\" class=\"wp-image-9507\" width=\"573\" height=\"275\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-1024x492.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-300x144.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-768x369.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-1536x737.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-2048x983.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-830x398.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-230x110.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-350x168.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-155-480x230.png 480w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">1.\u8fd9\u4e2aDataSourceConfig\u603b\u7684\u88c5\u8f7d\u7c7b\uff0c\u5c31\u662f\u6839\u636e\u4e0a\u9762\u914d\u7f6e\u6587\u4ef6\u4e2d\u4e0d\u540c\u7684\u524d\u7f00\u83b7\u53d6\u5230\u4e0d\u540c\u7684\u51e0\u4e2a\u952e\u503c\u5bf9\u7684\u503c\uff0c\u5c01\u88c5\u8fdb\u4e86DataSource\u6570\u636e\u6e90\uff0c\u4f8b\u5982\u524d\u7f00\uff1a\n\nmyagen.spring.datasource\n\n2.\u9700\u8981\u6ce8\u610f\u7684\u662f\u8fd9\u4e2a\u7c7b\u9700\u8981@Configuration\u6ce8\u89e3\u6807\u6ce8\u672c\u7c7b\u9700\u8981\u88ab\u626b\u63cf\u5230\n\n3.\u5728\u6709\u591a\u4e2a\u6570\u636e\u6e90\u7684\u60c5\u51b5\u4e0b\uff0c\u5fc5\u987b\u8981\u6307\u5b9a\u5176\u4e2d\u4e00\u4e2a\u4e3a\u4e3b\u6570\u636e\u6e90\uff0c\u901a\u8fc7@Primary\n\n<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">DataSourceConfig.java\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.config;\n\nimport org.springframework.beans.factory.annotation.Qualifier;\nimport org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;\nimport org.springframework.boot.context.properties.ConfigurationProperties;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.context.annotation.Primary;\n\nimport javax.sql.DataSource;\n\n\/**\n * @author SXD\n * @date 2017\/12\/04\n * \u591a\u6570\u636e\u6e90\u88c5\u8f7d\u914d\u7f6e\u7c7b\n * \u6570\u636e\u6e90\u7684\u58f0\u660e\n *\/\n@Configuration\npublic class DataSourceConfig {\n\n    \/**\n     * @return  \u6211\u7684\u57fa\u56e0\u7f51\u6570\u636e\u5e93\n     *\/\n    @Bean(name = \"myagenDataSource\")\n    @Qualifier(value = \"myagenDataSource\")  \/\/spring\u88c5\u914dbean\u7684\u552f\u4e00\u6807\u8bc6\n    @ConfigurationProperties(prefix = \"myagen.spring.datasource\")   \/\/application.properties\u914d\u7f6e\u6587\u4ef6\u4e2d\u8be5\u6570\u636e\u6e90\u7684\u914d\u7f6e\u524d\u7f00\n    public DataSource myagenDataSource(){\n        return DataSourceBuilder.create().build();\n    }\n\n    \/**\n     * @return   \u57fa\u56e0\u7f51\u8ba2\u5355\u8fd4\u73b0\u6570\u636e\u5e93\n     *\/\n    @Primary    \/\/\u914d\u7f6e\u8be5\u6570\u636e\u6e90\u4e3a\u4e3b\u6570\u636e\u6e90\n    @Bean(name = \"orderDiscountDataSource\")\n    @Qualifier(value = \"orderDiscountDataSource\")\n    @ConfigurationProperties(prefix = \"orderdiscount.spring.datasource\")\n    public DataSource orderDiscountDataSource(){\n        return DataSourceBuilder.create().build();\n    }\n}<\/pre>\n\n\n\n<p><strong>\u00a03\u300b\u5206\u522b\u521b\u5efa\u591a\u4e2a\u6570\u636e\u6e90\u7684\u5177\u4f53\u88c5\u8f7d\u7c7b\uff0c\u4f8b\u5982MyagenDataSourceConfig\uff0c\u5e76\u5728\u5177\u4f53\u88c5\u8f7d\u7c7b\u4e2d\uff0c\u6ce8\u5165\u5e76\u5b8c\u5584JpaProperties\uff0c\u58f0\u660e\u5e76\u5f15\u7528<em>\u5b9e\u4f53\u7ba1\u7406<\/em>\u548c<em>\u4e8b\u52a1\u7ba1\u7406<\/em>\uff0c\u5e76\u5728\u8fc7\u7a0b\u4e2d\u6307\u5b9a\u4e86<em>\u672c\u6570\u636e\u6e90\u8981\u4f5c\u7528\u7684\u5305\u7684\u8303\u56f4<\/em><\/strong><\/p>\n\n\n\n<p>\u4e3b\u6570\u636e\u6e90\u5b8c\u6574\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">OrderDiscountDataSourceConfig.java\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.config.datasource;\n\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.beans.factory.annotation.Qualifier;\nimport org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;\nimport org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.context.annotation.Primary;\nimport org.springframework.data.jpa.repository.config.EnableJpaRepositories;\nimport org.springframework.orm.jpa.JpaTransactionManager;\nimport org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;\nimport org.springframework.orm.jpa.vendor.Database;\nimport org.springframework.transaction.PlatformTransactionManager;\nimport org.springframework.transaction.annotation.EnableTransactionManagement;\n\nimport javax.persistence.EntityManager;\nimport javax.sql.DataSource;\nimport java.util.HashMap;\nimport java.util.Map;\n\n\/**\n * @author SXD\n * @date 2017\/12\/04\n * mysql\u6570\u636e\u5e93\u4e2d\u6570\u636e\u6e90\u7684 \u58f0\u660e\u88c5\u8f7d\u7c7b\n *\n *\/\n@Configuration\n@EnableTransactionManagement\n@EnableJpaRepositories(entityManagerFactoryRef = \"entityManagerFactoryOrderDiscount\",   \/\/EntityManagerFactory\u5f15\u7528\n                        transactionManagerRef = \"transactionManagerOrderDiscount\",      \/\/transactionManager\u5f15\u7528\n                        basePackages = {\"com.agen.orderdiscount\"})                      \/\/\u8bbe\u7f6e \u57fa\u56e0\u7f51orderDiscountDataSource\u5e94\u7528\u5230\u7684\u5305\npublic class OrderDiscountDataSourceConfig {\n\n    \/**\n     * \u6ce8\u5165 \u57fa\u56e0\u7f51\u8ba2\u5355\u6298\u6263\u6570\u636e\u6e90\n     *\/\n    @Autowired()\n    @Qualifier(\"orderDiscountDataSource\")\n    private DataSource orderDiscountDataSource;\n\n    \/**\n     * \u6ce8\u5165JPA\u914d\u7f6e\u5b9e\u4f53\n     *\/\n    @Autowired\n    private JpaProperties jpaProperties;\n\n    \/**\n     * \u901a\u8fc7\u8c03\u7528JPA\u914d\u7f6e\u5b9e\u4f53\u4e2d\u7684\u89e3\u6790\u65b9\u6cd5\uff0c\u89e3\u6790datasource\u4e2d\u5404\u5c5e\u6027\u7684\u503c\n     * @param dataSource    \u6570\u636e\u6e90\n     * @return     \u672c\u6570\u636e\u6e90\u4e2d\u5404\u53c2\u6570\n     * Map\u4e2d\u8bbe\u503c\u5206\u522b\u4e3a\uff1a\n     *      hibernate-dialect   \u65b9\u8a00\n     *      hibernate.hbm2ddl.auto  DDL\u6267\u884c\u7b56\u7565\n     *      hibernate.physical_naming_strategy  \u547d\u540d\u7b56\u7565\n     *\n     *\u8fd9\u4e9b\u548c\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\u5bc6\u5207\u76f8\u5173\u7684\u5c5e\u6027\u8bbe\u7f6e\uff0c\u4e0d\u80fd\u8bbe\u7f6e\u5728application.properties\u4e2d\uff0c\u6240\u4ee5\u9700\u8981\u518d\u4e0d\u540c\u7684\u6570\u636e\u6e90\u4e2d\u5177\u4f53\u8bbe\u7f6e\uff0c\u8d4b\u503c\u7ed9JpaProperties\n     *\/\n    private Map&lt;String,String> getVendorProperties(DataSource dataSource){\n        jpaProperties.setDatabase(Database.MYSQL);\n        Map&lt;String,String> map = new HashMap&lt;>();\n        map.put(\"hibernate.dialect\",\"org.hibernate.dialect.MySQL5Dialect\");\n        map.put(\"hibernate.hbm2ddl.auto\",\"update\");\n        map.put(\"hibernate.physical_naming_strategy\",\"org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl\");\n        jpaProperties.setProperties(map);\n        return  jpaProperties.getHibernateProperties(dataSource);\n    }\n\n    \/**\n     * \u914d\u7f6eEntityManagerFactory\u5b9e\u4f53\n     * @param builder\n     * @return      \u5b9e\u4f53\u7ba1\u7406\u5de5\u5382\n     * packages     \u626b\u63cf@Entity\u6ce8\u91ca\u7684\u8f6f\u4ef6\u5305\u540d\u79f0\n     * persistenceUnit  \u6301\u4e45\u6027\u5355\u5143\u7684\u540d\u79f0\u3002 \u5982\u679c\u53ea\u5efa\u7acb\u4e00\u4e2aEntityManagerFactory\uff0c\u4f60\u53ef\u4ee5\u7701\u7565\u8fd9\u4e2a\uff0c\u4f46\u662f\u5982\u679c\u5728\u540c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u4e2d\u6709\u591a\u4e2a\uff0c\u4f60\u5e94\u8be5\u7ed9\u5b83\u4eec\u4e0d\u540c\u7684\u540d\u5b57\n     * properties       \u6807\u51c6JPA\u6216\u4f9b\u5e94\u5546\u7279\u5b9a\u914d\u7f6e\u7684\u901a\u7528\u5c5e\u6027\u3002 \u8fd9\u4e9b\u5c5e\u6027\u8986\u76d6\u6784\u9020\u51fd\u6570\u4e2d\u63d0\u4f9b\u7684\u4efb\u4f55\u503c\u3002\n     *\n     *\/\n    @Primary\n    @Bean(name = \"entityManagerFactoryOrderDiscount\")\n    public LocalContainerEntityManagerFactoryBean entityManagerFactoryOrderDiscount(EntityManagerFactoryBuilder builder){\n        return builder\n                .dataSource(orderDiscountDataSource)\n                .properties(getVendorProperties(orderDiscountDataSource))\n                .packages(new String[]{\"com.agen.orderdiscount\"})\n                .persistenceUnit(\"orderDiscountPersistenceUnit\")\n                .build();\n    }\n\n    \/**\n     * \u914d\u7f6eEntityManager\u5b9e\u4f53\n     * @param builder\n     * @return      \u5b9e\u4f53\u7ba1\u7406\u5668\n     *\/\n    @Primary\n    @Bean(name = \"entityManagerOrderDiscount\")\n    public EntityManager entityManager(EntityManagerFactoryBuilder builder){\n        return entityManagerFactoryOrderDiscount(builder).getObject().createEntityManager();\n    }\n\n\n    \/**\n     * \u914d\u7f6e\u4e8b\u52a1transactionManager\n     * @param builder\n     * @return      \u4e8b\u52a1\u7ba1\u7406\u5668\n     *\/\n    @Primary\n    @Bean(name = \"transactionManagerOrderDiscount\")\n    public PlatformTransactionManager transactionManagerOrderDiscount(EntityManagerFactoryBuilder builder){\n        return  new JpaTransactionManager(entityManagerFactoryOrderDiscount(builder).getObject());\n    }\n\n\n\n}<\/pre>\n\n\n\n<p>\u5176\u4ed6\u6570\u636e\u6e90\u5b8c\u6574\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MyagenDataSourceConfig.java\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.config.datasource;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.beans.factory.annotation.Qualifier;\nimport org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;\nimport org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.data.jpa.repository.config.EnableJpaRepositories;\nimport org.springframework.orm.jpa.JpaTransactionManager;\nimport org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;\nimport org.springframework.orm.jpa.vendor.Database;\nimport org.springframework.transaction.PlatformTransactionManager;\nimport org.springframework.transaction.annotation.EnableTransactionManagement;\n\nimport javax.persistence.EntityManager;\nimport javax.sql.DataSource;\nimport java.util.HashMap;\nimport java.util.Map;\n\n\/**\n * @author SXD\n * @date 2017\/12\/04\n * sql server\u6570\u636e\u5e93\u4e2d\u6570\u636e\u6e90\u7684 \u58f0\u660e\u88c5\u8f7d\u7c7b\n *\n *\/\n@Configuration\n@EnableTransactionManagement\n@EnableJpaRepositories(entityManagerFactoryRef = \"entityManagerFactoryMyagen\",   \/\/\u5b9e\u4f53\u7ba1\u7406\u5f15\u7528\n        transactionManagerRef = \"transactionManagerMyagen\",                     \/\/\u4e8b\u52a1\u7ba1\u7406\u5f15\u7528\n        basePackages = {\"com.agen.myagen\"})                                    \/\/\u8bbe\u7f6e myagenDataSource\u5e94\u7528\u5230\u7684\u5305\npublic class MyagenDataSourceConfig {\n\n    \/**\n     * \u6ce8\u5165 \u6211\u7684\u57fa\u56e0\u7f51\u6570\u636e\u6e90\n     *\/\n    @Autowired()\n    @Qualifier(\"myagenDataSource\")\n    private DataSource myagenDataSource;\n\n    \/**\n     * \u6ce8\u5165JPA\u914d\u7f6e\u5b9e\u4f53\n     *\/\n    @Autowired\n    private JpaProperties jpaProperties;\n\n    \/**\n     * \u901a\u8fc7\u8c03\u7528JPA\u914d\u7f6e\u5b9e\u4f53\u4e2d\u7684\u89e3\u6790\u65b9\u6cd5\uff0c\u89e3\u6790datasource\u4e2d\u5404\u5c5e\u6027\u7684\u503c\n     * @param dataSource    \u6570\u636e\u6e90\n     * @return     \u672c\u6570\u636e\u6e90\u4e2d\u5404\u53c2\u6570\n     * Map\u4e2d\u8bbe\u503c\u5206\u522b\u4e3a\uff1a\n     *      hibernate-dialect   \u65b9\u8a00\n     *      hibernate.hbm2ddl.auto  DDL\u6267\u884c\u7b56\u7565\n     *      hibernate.physical_naming_strategy  \u547d\u540d\u7b56\u7565\n     *\n     *\u8fd9\u4e9b\u548c\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\u5bc6\u5207\u76f8\u5173\u7684\u5c5e\u6027\u8bbe\u7f6e\uff0c\u4e0d\u80fd\u8bbe\u7f6e\u5728application.properties\u4e2d\uff0c\u6240\u4ee5\u9700\u8981\u518d\u4e0d\u540c\u7684\u6570\u636e\u6e90\u4e2d\u5177\u4f53\u8bbe\u7f6e\uff0c\u8d4b\u503c\u7ed9JpaProperties\n     *\/\n    private Map&lt;String, String> getVendorProperties(DataSource dataSource) {\n        jpaProperties.setDatabase(Database.SQL_SERVER);\n        Map&lt;String,String> map = new HashMap&lt;>();\n        map.put(\"hibernate.dialect\",\"org.hibernate.dialect.SQLServer2008Dialect\");\n        map.put(\"hibernate.hbm2ddl.auto\",\"update\");\n        map.put(\"hibernate.physical_naming_strategy\",\"org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl\");\n        jpaProperties.setProperties(map);\n        return jpaProperties.getHibernateProperties(dataSource);\n    }\n\n    \/**\n     * \u914d\u7f6eEntityManagerFactory\u5b9e\u4f53\n     *\n     * @param builder\n     * @return\n     * packages     \u626b\u63cf@Entity\u6ce8\u91ca\u7684\u8f6f\u4ef6\u5305\u540d\u79f0\n     * persistenceUnit  \u6301\u4e45\u6027\u5355\u5143\u7684\u540d\u79f0\u3002 \u5982\u679c\u53ea\u5efa\u7acb\u4e00\u4e2aEntityManagerFactory\uff0c\u4f60\u53ef\u4ee5\u7701\u7565\u8fd9\u4e2a\uff0c\u4f46\u662f\u5982\u679c\u5728\u540c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u4e2d\u6709\u591a\u4e2a\uff0c\u4f60\u5e94\u8be5\u7ed9\u5b83\u4eec\u4e0d\u540c\u7684\u540d\u5b57\n     * properties       \u6807\u51c6JPA\u6216\u4f9b\u5e94\u5546\u7279\u5b9a\u914d\u7f6e\u7684\u901a\u7528\u5c5e\u6027\u3002 \u8fd9\u4e9b\u5c5e\u6027\u8986\u76d6\u6784\u9020\u51fd\u6570\u4e2d\u63d0\u4f9b\u7684\u4efb\u4f55\u503c\u3002\n     *\/\n    @Bean(name = \"entityManagerFactoryMyagen\")\n    public LocalContainerEntityManagerFactoryBean entityManagerFactoryMyagen(EntityManagerFactoryBuilder builder) {\n        return builder\n                .dataSource(myagenDataSource)\n                .properties(getVendorProperties(myagenDataSource))\n                .packages(new String[]{\"com.agen.myagen\"})\n                .persistenceUnit(\"myagenPersistenceUnit\")\n                .build();\n    }\n\n    \/**\n     * \u914d\u7f6eEntityManager\u5b9e\u4f53\n     *\n     * @param builder\n     * @return \u5b9e\u4f53\u7ba1\u7406\u5668\n     *\/\n    @Bean(name = \"entityManagerMyagen\")\n    public EntityManager entityManager(EntityManagerFactoryBuilder builder) {\n        return entityManagerFactoryMyagen(builder).getObject().createEntityManager();\n    }\n\n\n    \/**\n     * \u914d\u7f6e\u4e8b\u52a1\n     *\n     * @param builder\n     * @return \u4e8b\u52a1\u7ba1\u7406\u5668\n     *\/\n    @Bean(name = \"transactionManagerMyagen\")\n    public PlatformTransactionManager transactionManagerMyagen(EntityManagerFactoryBuilder builder) {\n        return new JpaTransactionManager(entityManagerFactoryMyagen(builder).getObject());\n    }\n\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> 1.\u4e3b\u6570\u636e\u6e90\u548c\u5176\u4ed6\u6570\u636e\u6e90\u6700\u5927\u7684\u533a\u522b\u5728\u4e8e\uff0c\u4e3b\u6570\u636e\u6e90\u4e2d \u7684\u5b9e\u4f53\u7ba1\u7406\u5668\uff0c\u5b9e\u4f53\u5de5\u5382\u7ba1\u7406\u5668\uff0c\u4e8b\u52a1\u7ba1\u7406\u5668\u5728\u58f0\u660e\u52a0\u8f7d\u65f6 \uff0c\u8981\u58f0\u660e\u81ea\u5df1\u662f\u4e3b\u6570\u636e\u6e90\u7684\uff0c\u901a\u8fc7\n\n@Primary\n\n 2.\u5728\u5b9e\u4f53\u5de5\u5382\u7ba1\u7406\u5668\u4e2d\uff0c\u9700\u8981\u8bbe\u7f6e\n\npersistenceUnit\n\n \u5982\u679c\u4ec5\u6709\u4e00\u4e2a\u6570\u636e\u6e90\u7684\u8bdd\uff0c\u4e0d\u9700\u8981\u8bbe\u7f6e\u8fd9\u4e2a\uff0c\u4f46\u662f\u591a\u6570\u636e\u6e90\u7684\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u8bbe\u7f6e\u5176\u4e3a\u4e0d\u540c\u7684\u503c\u5373\u53ef\uff0c\u6ca1\u6709\u5177\u4f53\u7684\u547d\u540d\u89c4\u5219\u3002\n\n3.\u6307\u5b9a\u672c\u6570\u636e\u6e90\u8981\u626b\u63cf\u7684\u5305\u540d\uff0c\u53ef\u4ee5\u6307\u5b9a\u591a\u4e2a\u5305\uff0c\u4e5f\u53ef\u4ee5\u5c06entity\u548crepository\u653e\u5728\u540c\u4e00\u4e2a\u5305\u4e0b\uff0c\u8fd9\u6837\u4ec5\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u5373\u53ef\u88ab\u626b\u63cf\u5230\u3002\n\n4.\u5173\u4e8eapplication.properties\u4e2d\u6709\u5173\u548c\u6570\u636e\u5e93\u64cd\u4f5c\u76f8\u5173\u7684\u90e8\u5206\u5c5e\u6027\u503c\u7684\u9ed8\u8ba4\u503c\u662f\u4ec0\u4e48\u8bbe\u7f6e\u7684\uff1a<\/pre>\n\n\n\n<p>\u67e5\u770bJpaProperties\u6e90\u7801\uff0c\u9ed8\u8ba4\u7684\u4e3ahibernate\u547d\u540d\u751f\u6210\u7b56\u7565\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-157-1024x61.png\" alt=\"\" class=\"wp-image-9509\" width=\"627\" height=\"37\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-1024x61.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-300x18.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-768x46.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-1536x92.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-2048x122.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-830x50.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-230x14.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-350x21.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-157-480x29.png 480w\" sizes=\"(max-width: 627px) 100vw, 627px\" \/><\/figure><\/div>\n\n\n\n<p>\u800c\u8fd9\u79cd\u547d\u540d\u751f\u6210\u7b56\u7565\u662f\u4e3a\u82e5\u6709\u9a7c\u5cf0\u547d\u540d\u51fa\u73b0orderId,\u5219\u6570\u636e\u5e93\u4e2d\u4f1a\u6709order_id\u4e0b\u5212\u7ebf\u51fa\u73b0\u3002\u6211\u81ea\u5df1\u4e0d\u60f3\u91c7\u7528\u8fd9\u79cd\u3002<\/p>\n\n\n\n<p>\u00a0DDL\u7b56\u7565\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-158-1024x342.png\" alt=\"\" class=\"wp-image-9510\" width=\"579\" height=\"193\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-1024x342.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-300x100.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-768x256.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-1536x512.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-2048x683.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-830x277.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-230x77.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-350x117.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-158-480x160.png 480w\" sizes=\"(max-width: 579px) 100vw, 579px\" \/><\/figure><\/div>\n\n\n\n<p><strong>4\u300b\u6839\u636e\u7b2c3\u6b65\u4e2d\u6307\u5b9a\u7684\u5305\uff0c\u5206\u522b\u5bf9\u5e94\u591a\u4e2a\u6570\u636e\u6e90\u7684\u5177\u4f53\u88c5\u8f7d\u7c7b\uff0c\u521b\u5efa\u5305\u7ed3\u6784\uff0c\u4ee5\u53ca\u751f\u6210\u5b9e\u4f53\u548c\u5bf9\u5e94\u7684repository\u5c42\u64cd\u4f5c<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-159.png\" alt=\"\" class=\"wp-image-9511\" width=\"330\" height=\"393\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-159.png 642w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-159-252x300.png 252w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-159-230x274.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-159-350x417.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-159-480x571.png 480w\" sizes=\"(max-width: 330px) 100vw, 330px\" \/><\/figure><\/div>\n\n\n\n<p>XxOrder.java<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.myagen.entity;\n\nimport javax.persistence.*;\nimport java.math.BigDecimal;\nimport java.sql.Timestamp;\n\n@Entity\n@Table(name = \"xx_order\", schema = \"dbo\", catalog = \"geneshop\")\npublic class XxOrder {\n    private int id;\n    private Timestamp createDate;\n    private Timestamp modifyDate;\n    private String address;\n    private BigDecimal amountPaid;\n    private String areaName;\n    private String consignee;\n    private BigDecimal couponDiscount;\n    private int exchangePoint;\n    private Timestamp expire;\n    private BigDecimal fee;\n    private BigDecimal freight;\n    private String invoiceTitle;\n    private boolean isAllocatedStock;\n    private boolean isInvoice;\n    private Timestamp lockExpire;\n    private String memo;\n    private String name;\n    private BigDecimal offsetAmount;\n    private int orderStatus;\n    private String paymentMethodName;\n    private int paymentStatus;\n    private String phone;\n    private BigDecimal promotionDiscount;\n    private String promotionName;\n    private int rewardPoint;\n    private String shippingMethodName;\n    private int shippingStatus;\n    private String sn;\n    private BigDecimal tax;\n    private int type;\n    private String zipCode;\n    private String memberorderno;\n    private Integer ordertype;\n    private Boolean distributeState;\n    private Timestamp ctime;\n    private String guid;\n    private String cbqrr;\n    private Timestamp cbqrTime;\n    private Boolean isCbqr;\n    private Boolean isSrqr;\n    private String srqrr;\n    private Timestamp srqrTime;\n    private String isShow;\n    private Boolean isHunantb;\n    private Boolean byCreditCard;\n    private XxMember xxMemberByMember;\n    private XxAdmin xxAdminByOperator;\n    private XxAdmin xxAdminByAdmin;\n\n\n    @Id\n    @Column(name = \"id\", nullable = false, precision = 0)\n    public int getId() {\n        return id;\n    }\n\n    public void setId(int id) {\n        this.id = id;\n    }\n\n    @Basic\n    @Column(name = \"create_date\", nullable = false)\n    public Timestamp getCreateDate() {\n        return createDate;\n    }\n\n    public void setCreateDate(Timestamp createDate) {\n        this.createDate = createDate;\n    }\n\n    @Basic\n    @Column(name = \"modify_date\", nullable = false)\n    public Timestamp getModifyDate() {\n        return modifyDate;\n    }\n\n    public void setModifyDate(Timestamp modifyDate) {\n        this.modifyDate = modifyDate;\n    }\n\n    @Basic\n    @Column(name = \"address\", nullable = false, length = 255)\n    public String getAddress() {\n        return address;\n    }\n\n    public void setAddress(String address) {\n        this.address = address;\n    }\n\n    @Basic\n    @Column(name = \"amount_paid\", nullable = false, precision = 6)\n    public BigDecimal getAmountPaid() {\n        return amountPaid;\n    }\n\n    public void setAmountPaid(BigDecimal amountPaid) {\n        this.amountPaid = amountPaid;\n    }\n\n    @Basic\n    @Column(name = \"area_name\", nullable = false, length = 255)\n    public String getAreaName() {\n        return areaName;\n    }\n\n    public void setAreaName(String areaName) {\n        this.areaName = areaName;\n    }\n\n    @Basic\n    @Column(name = \"consignee\", nullable = false, length = 255)\n    public String getConsignee() {\n        return consignee;\n    }\n\n    public void setConsignee(String consignee) {\n        this.consignee = consignee;\n    }\n\n    @Basic\n    @Column(name = \"coupon_discount\", nullable = false, precision = 6)\n    public BigDecimal getCouponDiscount() {\n        return couponDiscount;\n    }\n\n    public void setCouponDiscount(BigDecimal couponDiscount) {\n        this.couponDiscount = couponDiscount;\n    }\n\n    @Basic\n    @Column(name = \"exchange_point\", nullable = false, precision = 0)\n    public int getExchangePoint() {\n        return exchangePoint;\n    }\n\n    public void setExchangePoint(int exchangePoint) {\n        this.exchangePoint = exchangePoint;\n    }\n\n    @Basic\n    @Column(name = \"expire\", nullable = true)\n    public Timestamp getExpire() {\n        return expire;\n    }\n\n    public void setExpire(Timestamp expire) {\n        this.expire = expire;\n    }\n\n    @Basic\n    @Column(name = \"fee\", nullable = false, precision = 6)\n    public BigDecimal getFee() {\n        return fee;\n    }\n\n    public void setFee(BigDecimal fee) {\n        this.fee = fee;\n    }\n\n    @Basic\n    @Column(name = \"freight\", nullable = false, precision = 6)\n    public BigDecimal getFreight() {\n        return freight;\n    }\n\n    public void setFreight(BigDecimal freight) {\n        this.freight = freight;\n    }\n\n    @Basic\n    @Column(name = \"invoice_title\", nullable = true, length = 255)\n    public String getInvoiceTitle() {\n        return invoiceTitle;\n    }\n\n    public void setInvoiceTitle(String invoiceTitle) {\n        this.invoiceTitle = invoiceTitle;\n    }\n\n    @Basic\n    @Column(name = \"is_allocated_stock\", nullable = false)\n    public boolean isAllocatedStock() {\n        return isAllocatedStock;\n    }\n\n    public void setAllocatedStock(boolean allocatedStock) {\n        isAllocatedStock = allocatedStock;\n    }\n\n    @Basic\n    @Column(name = \"is_invoice\", nullable = false)\n    public boolean isInvoice() {\n        return isInvoice;\n    }\n\n    public void setInvoice(boolean invoice) {\n        isInvoice = invoice;\n    }\n\n    @Basic\n    @Column(name = \"lock_expire\", nullable = true)\n    public Timestamp getLockExpire() {\n        return lockExpire;\n    }\n\n    public void setLockExpire(Timestamp lockExpire) {\n        this.lockExpire = lockExpire;\n    }\n\n    @Basic\n    @Column(name = \"memo\", nullable = true, length = 255)\n    public String getMemo() {\n        return memo;\n    }\n\n    public void setMemo(String memo) {\n        this.memo = memo;\n    }\n\n    @Basic\n    @Column(name = \"name\", nullable = false, length = 500)\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    @Basic\n    @Column(name = \"offset_amount\", nullable = false, precision = 6)\n    public BigDecimal getOffsetAmount() {\n        return offsetAmount;\n    }\n\n    public void setOffsetAmount(BigDecimal offsetAmount) {\n        this.offsetAmount = offsetAmount;\n    }\n\n    @Basic\n    @Column(name = \"order_status\", nullable = false)\n    public int getOrderStatus() {\n        return orderStatus;\n    }\n\n    public void setOrderStatus(int orderStatus) {\n        this.orderStatus = orderStatus;\n    }\n\n    @Basic\n    @Column(name = \"payment_method_name\", nullable = true, length = 255)\n    public String getPaymentMethodName() {\n        return paymentMethodName;\n    }\n\n    public void setPaymentMethodName(String paymentMethodName) {\n        this.paymentMethodName = paymentMethodName;\n    }\n\n    @Basic\n    @Column(name = \"payment_status\", nullable = false)\n    public int getPaymentStatus() {\n        return paymentStatus;\n    }\n\n    public void setPaymentStatus(int paymentStatus) {\n        this.paymentStatus = paymentStatus;\n    }\n\n    @Basic\n    @Column(name = \"phone\", nullable = false, length = 255)\n    public String getPhone() {\n        return phone;\n    }\n\n    public void setPhone(String phone) {\n        this.phone = phone;\n    }\n\n    @Basic\n    @Column(name = \"promotion_discount\", nullable = false, precision = 6)\n    public BigDecimal getPromotionDiscount() {\n        return promotionDiscount;\n    }\n\n    public void setPromotionDiscount(BigDecimal promotionDiscount) {\n        this.promotionDiscount = promotionDiscount;\n    }\n\n    @Basic\n    @Column(name = \"promotion_name\", nullable = true, length = 255)\n    public String getPromotionName() {\n        return promotionName;\n    }\n\n    public void setPromotionName(String promotionName) {\n        this.promotionName = promotionName;\n    }\n\n    @Basic\n    @Column(name = \"reward_point\", nullable = false, precision = 0)\n    public int getRewardPoint() {\n        return rewardPoint;\n    }\n\n    public void setRewardPoint(int rewardPoint) {\n        this.rewardPoint = rewardPoint;\n    }\n\n    @Basic\n    @Column(name = \"shipping_method_name\", nullable = true, length = 255)\n    public String getShippingMethodName() {\n        return shippingMethodName;\n    }\n\n    public void setShippingMethodName(String shippingMethodName) {\n        this.shippingMethodName = shippingMethodName;\n    }\n\n    @Basic\n    @Column(name = \"shipping_status\", nullable = false)\n    public int getShippingStatus() {\n        return shippingStatus;\n    }\n\n    public void setShippingStatus(int shippingStatus) {\n        this.shippingStatus = shippingStatus;\n    }\n\n    @Basic\n    @Column(name = \"sn\", nullable = false, length = 100)\n    public String getSn() {\n        return sn;\n    }\n\n    public void setSn(String sn) {\n        this.sn = sn;\n    }\n\n    @Basic\n    @Column(name = \"tax\", nullable = false, precision = 6)\n    public BigDecimal getTax() {\n        return tax;\n    }\n\n    public void setTax(BigDecimal tax) {\n        this.tax = tax;\n    }\n\n    @Basic\n    @Column(name = \"type\", nullable = false)\n    public int getType() {\n        return type;\n    }\n\n    public void setType(int type) {\n        this.type = type;\n    }\n\n    @Basic\n    @Column(name = \"zip_code\", nullable = false, length = 255)\n    public String getZipCode() {\n        return zipCode;\n    }\n\n    public void setZipCode(String zipCode) {\n        this.zipCode = zipCode;\n    }\n\n    @Basic\n    @Column(name = \"memberorderno\", nullable = true, length = 255)\n    public String getMemberorderno() {\n        return memberorderno;\n    }\n\n    public void setMemberorderno(String memberorderno) {\n        this.memberorderno = memberorderno;\n    }\n\n    @Basic\n    @Column(name = \"ordertype\", nullable = true)\n    public Integer getOrdertype() {\n        return ordertype;\n    }\n\n    public void setOrdertype(Integer ordertype) {\n        this.ordertype = ordertype;\n    }\n\n    @Basic\n    @Column(name = \"distributeState\", nullable = true)\n    public Boolean getDistributeState() {\n        return distributeState;\n    }\n\n    public void setDistributeState(Boolean distributeState) {\n        this.distributeState = distributeState;\n    }\n\n    @Basic\n    @Column(name = \"ctime\", nullable = true)\n    public Timestamp getCtime() {\n        return ctime;\n    }\n\n    public void setCtime(Timestamp ctime) {\n        this.ctime = ctime;\n    }\n\n    @Basic\n    @Column(name = \"guid\", nullable = true, length = 255)\n    public String getGuid() {\n        return guid;\n    }\n\n    public void setGuid(String guid) {\n        this.guid = guid;\n    }\n\n    @Basic\n    @Column(name = \"cbqrr\", nullable = true, length = 255)\n    public String getCbqrr() {\n        return cbqrr;\n    }\n\n    public void setCbqrr(String cbqrr) {\n        this.cbqrr = cbqrr;\n    }\n\n    @Basic\n    @Column(name = \"cbqr_time\", nullable = true)\n    public Timestamp getCbqrTime() {\n        return cbqrTime;\n    }\n\n    public void setCbqrTime(Timestamp cbqrTime) {\n        this.cbqrTime = cbqrTime;\n    }\n\n    @Basic\n    @Column(name = \"is_cbqr\", nullable = true)\n    public Boolean getCbqr() {\n        return isCbqr;\n    }\n\n    public void setCbqr(Boolean cbqr) {\n        isCbqr = cbqr;\n    }\n\n    @Basic\n    @Column(name = \"is_srqr\", nullable = true)\n    public Boolean getSrqr() {\n        return isSrqr;\n    }\n\n    public void setSrqr(Boolean srqr) {\n        isSrqr = srqr;\n    }\n\n    @Basic\n    @Column(name = \"srqrr\", nullable = true, length = 255)\n    public String getSrqrr() {\n        return srqrr;\n    }\n\n    public void setSrqrr(String srqrr) {\n        this.srqrr = srqrr;\n    }\n\n    @Basic\n    @Column(name = \"srqr_time\", nullable = true)\n    public Timestamp getSrqrTime() {\n        return srqrTime;\n    }\n\n    public void setSrqrTime(Timestamp srqrTime) {\n        this.srqrTime = srqrTime;\n    }\n\n    @Basic\n    @Column(name = \"is_show\", nullable = true, length = 255)\n    public String getIsShow() {\n        return isShow;\n    }\n\n    public void setIsShow(String isShow) {\n        this.isShow = isShow;\n    }\n\n    @Basic\n    @Column(name = \"is_hunantb\", nullable = true)\n    public Boolean getHunantb() {\n        return isHunantb;\n    }\n\n    public void setHunantb(Boolean hunantb) {\n        isHunantb = hunantb;\n    }\n\n    @Basic\n    @Column(name = \"by_credit_card\", nullable = true)\n    public Boolean getByCreditCard() {\n        return byCreditCard;\n    }\n\n    public void setByCreditCard(Boolean byCreditCard) {\n        this.byCreditCard = byCreditCard;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) return true;\n        if (o == null || getClass() != o.getClass()) return false;\n\n        XxOrder xxOrder = (XxOrder) o;\n\n        if (id != xxOrder.id) return false;\n        if (exchangePoint != xxOrder.exchangePoint) return false;\n        if (isAllocatedStock != xxOrder.isAllocatedStock) return false;\n        if (isInvoice != xxOrder.isInvoice) return false;\n        if (orderStatus != xxOrder.orderStatus) return false;\n        if (paymentStatus != xxOrder.paymentStatus) return false;\n        if (rewardPoint != xxOrder.rewardPoint) return false;\n        if (shippingStatus != xxOrder.shippingStatus) return false;\n        if (type != xxOrder.type) return false;\n        if (createDate != null ? !createDate.equals(xxOrder.createDate) : xxOrder.createDate != null) return false;\n        if (modifyDate != null ? !modifyDate.equals(xxOrder.modifyDate) : xxOrder.modifyDate != null) return false;\n        if (address != null ? !address.equals(xxOrder.address) : xxOrder.address != null) return false;\n        if (amountPaid != null ? !amountPaid.equals(xxOrder.amountPaid) : xxOrder.amountPaid != null) return false;\n        if (areaName != null ? !areaName.equals(xxOrder.areaName) : xxOrder.areaName != null) return false;\n        if (consignee != null ? !consignee.equals(xxOrder.consignee) : xxOrder.consignee != null) return false;\n        if (couponDiscount != null ? !couponDiscount.equals(xxOrder.couponDiscount) : xxOrder.couponDiscount != null)\n            return false;\n        if (expire != null ? !expire.equals(xxOrder.expire) : xxOrder.expire != null) return false;\n        if (fee != null ? !fee.equals(xxOrder.fee) : xxOrder.fee != null) return false;\n        if (freight != null ? !freight.equals(xxOrder.freight) : xxOrder.freight != null) return false;\n        if (invoiceTitle != null ? !invoiceTitle.equals(xxOrder.invoiceTitle) : xxOrder.invoiceTitle != null)\n            return false;\n        if (lockExpire != null ? !lockExpire.equals(xxOrder.lockExpire) : xxOrder.lockExpire != null) return false;\n        if (memo != null ? !memo.equals(xxOrder.memo) : xxOrder.memo != null) return false;\n        if (name != null ? !name.equals(xxOrder.name) : xxOrder.name != null) return false;\n        if (offsetAmount != null ? !offsetAmount.equals(xxOrder.offsetAmount) : xxOrder.offsetAmount != null)\n            return false;\n        if (paymentMethodName != null ? !paymentMethodName.equals(xxOrder.paymentMethodName) : xxOrder.paymentMethodName != null)\n            return false;\n        if (phone != null ? !phone.equals(xxOrder.phone) : xxOrder.phone != null) return false;\n        if (promotionDiscount != null ? !promotionDiscount.equals(xxOrder.promotionDiscount) : xxOrder.promotionDiscount != null)\n            return false;\n        if (promotionName != null ? !promotionName.equals(xxOrder.promotionName) : xxOrder.promotionName != null)\n            return false;\n        if (shippingMethodName != null ? !shippingMethodName.equals(xxOrder.shippingMethodName) : xxOrder.shippingMethodName != null)\n            return false;\n        if (sn != null ? !sn.equals(xxOrder.sn) : xxOrder.sn != null) return false;\n        if (tax != null ? !tax.equals(xxOrder.tax) : xxOrder.tax != null) return false;\n        if (zipCode != null ? !zipCode.equals(xxOrder.zipCode) : xxOrder.zipCode != null) return false;\n        if (memberorderno != null ? !memberorderno.equals(xxOrder.memberorderno) : xxOrder.memberorderno != null)\n            return false;\n        if (ordertype != null ? !ordertype.equals(xxOrder.ordertype) : xxOrder.ordertype != null) return false;\n        if (distributeState != null ? !distributeState.equals(xxOrder.distributeState) : xxOrder.distributeState != null)\n            return false;\n        if (ctime != null ? !ctime.equals(xxOrder.ctime) : xxOrder.ctime != null) return false;\n        if (guid != null ? !guid.equals(xxOrder.guid) : xxOrder.guid != null) return false;\n        if (cbqrr != null ? !cbqrr.equals(xxOrder.cbqrr) : xxOrder.cbqrr != null) return false;\n        if (cbqrTime != null ? !cbqrTime.equals(xxOrder.cbqrTime) : xxOrder.cbqrTime != null) return false;\n        if (isCbqr != null ? !isCbqr.equals(xxOrder.isCbqr) : xxOrder.isCbqr != null) return false;\n        if (isSrqr != null ? !isSrqr.equals(xxOrder.isSrqr) : xxOrder.isSrqr != null) return false;\n        if (srqrr != null ? !srqrr.equals(xxOrder.srqrr) : xxOrder.srqrr != null) return false;\n        if (srqrTime != null ? !srqrTime.equals(xxOrder.srqrTime) : xxOrder.srqrTime != null) return false;\n        if (isShow != null ? !isShow.equals(xxOrder.isShow) : xxOrder.isShow != null) return false;\n        if (isHunantb != null ? !isHunantb.equals(xxOrder.isHunantb) : xxOrder.isHunantb != null) return false;\n        if (byCreditCard != null ? !byCreditCard.equals(xxOrder.byCreditCard) : xxOrder.byCreditCard != null)\n            return false;\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = id;\n        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);\n        result = 31 * result + (modifyDate != null ? modifyDate.hashCode() : 0);\n        result = 31 * result + (address != null ? address.hashCode() : 0);\n        result = 31 * result + (amountPaid != null ? amountPaid.hashCode() : 0);\n        result = 31 * result + (areaName != null ? areaName.hashCode() : 0);\n        result = 31 * result + (consignee != null ? consignee.hashCode() : 0);\n        result = 31 * result + (couponDiscount != null ? couponDiscount.hashCode() : 0);\n        result = 31 * result + exchangePoint;\n        result = 31 * result + (expire != null ? expire.hashCode() : 0);\n        result = 31 * result + (fee != null ? fee.hashCode() : 0);\n        result = 31 * result + (freight != null ? freight.hashCode() : 0);\n        result = 31 * result + (invoiceTitle != null ? invoiceTitle.hashCode() : 0);\n        result = 31 * result + (isAllocatedStock ? 1 : 0);\n        result = 31 * result + (isInvoice ? 1 : 0);\n        result = 31 * result + (lockExpire != null ? lockExpire.hashCode() : 0);\n        result = 31 * result + (memo != null ? memo.hashCode() : 0);\n        result = 31 * result + (name != null ? name.hashCode() : 0);\n        result = 31 * result + (offsetAmount != null ? offsetAmount.hashCode() : 0);\n        result = 31 * result + orderStatus;\n        result = 31 * result + (paymentMethodName != null ? paymentMethodName.hashCode() : 0);\n        result = 31 * result + paymentStatus;\n        result = 31 * result + (phone != null ? phone.hashCode() : 0);\n        result = 31 * result + (promotionDiscount != null ? promotionDiscount.hashCode() : 0);\n        result = 31 * result + (promotionName != null ? promotionName.hashCode() : 0);\n        result = 31 * result + rewardPoint;\n        result = 31 * result + (shippingMethodName != null ? shippingMethodName.hashCode() : 0);\n        result = 31 * result + shippingStatus;\n        result = 31 * result + (sn != null ? sn.hashCode() : 0);\n        result = 31 * result + (tax != null ? tax.hashCode() : 0);\n        result = 31 * result + type;\n        result = 31 * result + (zipCode != null ? zipCode.hashCode() : 0);\n        result = 31 * result + (memberorderno != null ? memberorderno.hashCode() : 0);\n        result = 31 * result + (ordertype != null ? ordertype.hashCode() : 0);\n        result = 31 * result + (distributeState != null ? distributeState.hashCode() : 0);\n        result = 31 * result + (ctime != null ? ctime.hashCode() : 0);\n        result = 31 * result + (guid != null ? guid.hashCode() : 0);\n        result = 31 * result + (cbqrr != null ? cbqrr.hashCode() : 0);\n        result = 31 * result + (cbqrTime != null ? cbqrTime.hashCode() : 0);\n        result = 31 * result + (isCbqr != null ? isCbqr.hashCode() : 0);\n        result = 31 * result + (isSrqr != null ? isSrqr.hashCode() : 0);\n        result = 31 * result + (srqrr != null ? srqrr.hashCode() : 0);\n        result = 31 * result + (srqrTime != null ? srqrTime.hashCode() : 0);\n        result = 31 * result + (isShow != null ? isShow.hashCode() : 0);\n        result = 31 * result + (isHunantb != null ? isHunantb.hashCode() : 0);\n        result = 31 * result + (byCreditCard != null ? byCreditCard.hashCode() : 0);\n        return result;\n    }\n\n    @ManyToOne\n    @JoinColumn(name = \"member\", referencedColumnName = \"id\", nullable = false)\n    public XxMember getXxMemberByMember() {\n        return xxMemberByMember;\n    }\n\n    public void setXxMemberByMember(XxMember xxMemberByMember) {\n        this.xxMemberByMember = xxMemberByMember;\n    }\n\n\n    @ManyToOne\n    @JoinColumn(name = \"operator\", referencedColumnName = \"id\")\n    public XxAdmin getXxAdminByOperator() {\n        return xxAdminByOperator;\n    }\n\n    public void setXxAdminByOperator(XxAdmin xxAdminByOperator) {\n        this.xxAdminByOperator = xxAdminByOperator;\n    }\n\n\n    @ManyToOne\n    @JoinColumn(name = \"admin\", referencedColumnName = \"id\")\n    public XxAdmin getXxAdminByAdmin() {\n        return xxAdminByAdmin;\n    }\n\n    public void setXxAdminByAdmin(XxAdmin xxAdminByAdmin) {\n        this.xxAdminByAdmin = xxAdminByAdmin;\n    }\n\n\n}<\/pre>\n\n\n\n<p>OrderRepository.java<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.myagen.repository;\n\nimport com.agen.myagen.entity.XxAdmin;\nimport com.agen.myagen.entity.XxOrder;\nimport org.springframework.data.jpa.repository.JpaRepository;\n\nimport java.util.List;\n\npublic interface OrderRepository  extends JpaRepository&lt;XxOrder,Integer> {\n\n    List&lt;XxOrder> findTop10ByXxAdminByOperator(XxAdmin xxAdminByOperator);\n\n    @Override\n    XxOrder findOne(Integer integer);\n}<\/pre>\n\n\n\n<p>Member.java<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.orderdiscount.entity;\n\nimport lombok.*;\nimport lombok.experimental.Accessors;\n\nimport org.hibernate.annotations.GenericGenerator;\n\nimport javax.persistence.*;\n\n\n@Data(staticConstructor = \"of\")\n@NoArgsConstructor\n@AllArgsConstructor\n@Accessors(chain = true)\n@Entity\n@GenericGenerator(name = \"uuid2\", strategy = \"org.hibernate.id.UUIDGenerator\" )\npublic class Member {\n\n\n    @Id\n    @GeneratedValue(generator = \"uuid2\")\n    private String memberId;\n\n\n    @Column(nullable = false)\n    @NonNull\n    private Integer memberGrade;\n\n    @Column(nullable = false)\n    @NonNull\n    private String orderSn;\n}<\/pre>\n\n\n\n<p>MemberRepositpry.java<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.orderdiscount.repository;\n\nimport com.agen.orderdiscount.entity.Member;\nimport org.springframework.data.jpa.repository.JpaRepository;\n\nimport java.util.List;\n\npublic interface MemberRepository  extends JpaRepository&lt;Member,String>{\n    @Override\n    Member save(Member member);\n\n    List&lt;Member> findByMemberGrade(Integer memberGrade);\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">1.\u6211\u8fd9\u91ccmyagen\u6570\u636e\u6e90\u4e0b\u6570\u636e\u5e93\u4e2d\u8868\u65e9\u5df2\u5b58\u5728\uff0c\u662f\u6839\u636ehibernate\u53cd\u8f6c\u5de5\u5177\u751f\u6210\u7684\u51e0\u4e2a\u9700\u8981\u7684\u7c7b\n\n\u3010hibernate\u53cd\u8f6c\u5de5\u5177\u600e\u4e48\u4f7f\u7528\u3011\n\n\u3010idea\u4e0b\u7684\u5b9e\u4f53\u751f\u6210\u53cd\u8f6c\u5de5\u5177\uff1ahttp:\/\/www.cnblogs.com\/sxdcgaq8080\/p\/7978334.html\u3011\n\n\u3010myecplise\u4e0b\u7684\u5b9e\u4f53\u751f\u6210\u53cd\u8f6c\u5de5\u5177\uff1ahttp:\/\/www.cnblogs.com\/sxdcgaq8080\/p\/5593591.html\u3011\n\n 2.\u548c\u6570\u636e\u5e93\u6253\u4ea4\u9053\u7684\u6301\u4e45\u5316\u6846\u67b6\u662fspring boot\u81ea\u5e26\u7684spring-data-jpa\u3002\n\n\u3010spring-data-jpa\u600e\u4e48\u4f7f\u7528\u3011\n\n\u3010\u5165\u95e8\u4f7f\u7528\uff1ahttp:\/\/www.cnblogs.com\/sxdcgaq8080\/p\/7890571.html\u3011\n\n\u3010\u590d\u6742\u4f7f\u7528\uff1ahttp:\/\/www.cnblogs.com\/sxdcgaq8080\/p\/7894828.html\u3011\n\n 3.Member\u5b9e\u4f53\u4e2d\u4f7f\u7528\u4e86lombok\uff0c\u4e00\u4e2ajava\u7684\u4e00\u4e2a\u5947\u6280\u6deb\u5de7\n\n\u3010lombok\u7684\u8be6\u89e3\u548c\u4f7f\u7528\uff1ahttp:\/\/www.cnblogs.com\/sxdcgaq8080\/p\/7884477.html\u3011\n\n 4.\u5173\u4e8eMember.java\u5b9e\u4f53\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u5bf9\u5e94\u7684\u662forderdiscount\u6570\u636e\u6e90\uff0c\u4e5f\u5c31\u662f\u4e3b\u6570\u636e\u6e90\uff0c\u662fmysql\u8fd9\u8fb9\u7684\uff0c\u662f\u5148\u5199\u4e86\u5b9e\u4f53\u4e4b\u540e\uff0c\u81ea\u52a8\u6839\u636e\u7b2c\u4e09\u6b65\u4e2d\u8bbe\u7f6e\u5728map\u4e2d\u7684\n\nhibernate.physical_naming_strategy\n\n \uff0c\u6240\u4ee5\u751f\u6210\u7684\u6570\u636e\u8868\u4e2d\u7684\u5b57\u6bb5\uff0c\u5e94\u8be5\u662f\u4e0d\u5e26\u4e0b\u5212\u7ebf\u7684\u3002\n\n\u3010\u5173\u4e8ehibernate\u7684\u547d\u540d\u89c4\u5219\uff0c\u8bbe\u7f6e\u53c2\u8003\uff1ahttp:\/\/www.cnblogs.com\/sxdcgaq8080\/p\/7910474.html\u3011<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-160.png\" alt=\"\" class=\"wp-image-9512\" width=\"326\" height=\"164\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-160.png 638w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-160-300x150.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-160-230x115.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-160-350x176.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-160-480x241.png 480w\" sizes=\"(max-width: 326px) 100vw, 326px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u00a05\u300b\u6700\u540e\u518dcontroller\u5c42\uff0c\u4f9d\u6b21\u8c03\u7528\u5404\u79cd\u6570\u636e\u6e90\u5bf9\u5e94\u7684\u5404\u4e2a\u5305\u4e0b\u7684\u5404\u79cdrepository\u64cd\u4f5c\u8fdb\u884c\u64cd\u4f5c<\/strong><\/p>\n\n\n\n<p>\u8fd9\u4e00\u5c42\uff0c\u4ec0\u4e48\u4e5f\u4e0d\u7528\u591a\u8bf4\u4e86<\/p>\n\n\n\n<p>MainController.java<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package com.agen.controller;\n\nimport com.agen.myagen.entity.XxAdmin;\nimport com.agen.myagen.entity.XxOrder;\nimport com.agen.myagen.repository.OrderRepository;\nimport com.agen.orderdiscount.entity.Member;\nimport com.agen.orderdiscount.repository.MemberRepository;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.RequestMapping;\n\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.UUID;\n\n@Controller\npublic class MainController {\n\n    @Autowired\n    private OrderRepository orderRepository;\n    @Autowired\n    private MemberRepository memberRepository;\n\n    @RequestMapping(\"lo\")\n    public void getOrder(){\n        XxOrder xxOrder = orderRepository.findOne(1510);\n        System.out.println(\"sql server\u6570\u636e\u5e93\u67e5\u5230order\u7f16\u53f7\uff1a\"+xxOrder.getSn());\n        Member member = new Member();\n        member.setMemberId(UUID.randomUUID().toString());\n        member.setMemberGrade(2);\n        member.setOrderSn(xxOrder.getSn());\n\n        Member member1 = memberRepository.save(member);\n        if(Objects.nonNull(member1)){\n            System.out.println(\"mysql\u6570\u636e\u5e93\u63d2\u5165member\u6210\u529f\");\n\n            List&lt;Member> list = memberRepository.findByMemberGrade(2);\n            if(Objects.nonNull(list) &amp;&amp; list.size() > 0){\n                list.forEach(i->{\n                    System.out.println(\"mysql\u6570\u636e\u5e93\u67e5\u51faorder\u7f16\u53f7\uff1a\"+i.getOrderSn());\n                });\n            }\n        }\n\n\n    }\n}<\/pre>\n\n\n\n<p>\u7136\u540e\u542f\u52a8\uff0c\u542f\u52a8\u53ef\u4ee5\u770b\u5230\u4e0b\u9762\u8fd9\u4e9b\u4fe1\u606f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-161-1024x307.png\" alt=\"\" class=\"wp-image-9513\" width=\"525\" height=\"157\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-1024x307.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-300x90.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-768x230.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-1536x460.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-2048x614.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-830x249.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-230x69.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-350x105.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-161-480x144.png 480w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/figure><\/div>\n\n\n\n<p>\u6700\u540e\uff0c\u8bbf\u95ee\u4e00\u4e0b\u8fd9\u4e2a\u5730\u5740\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-162-1024x136.png\" alt=\"\" class=\"wp-image-9514\" width=\"566\" height=\"74\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162-1024x136.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162-300x40.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162-768x102.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162-830x110.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162-230x31.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162-350x46.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162-480x64.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-162.png 1206w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><\/figure><\/div>\n\n\n\n<p>\u00a0\u53ef\u4ee5\u770b\u5230\u548c\u591a\u6570\u636e\u6e90\u4ea4\u4e92\u7684 SQL\u8bed\u53e5\u6253\u5370\u51fa\u6765\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/02\/image-163-1024x128.png\" alt=\"\" class=\"wp-image-9515\" width=\"618\" height=\"77\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-1024x128.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-300x38.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-768x96.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-1536x193.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-2048x257.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-830x104.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-230x29.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-350x44.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/02\/image-163-480x60.png 480w\" sizes=\"(max-width: 618px) 100vw, 618px\" \/><\/figure><\/div>\n\n\n\n<p>\u597d\u4e86 \uff0c\u7ec8\u4e8e\u5b8c\u6210\u4e86\uff01\uff01\uff01\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 spring boot\u5bf9\u591a\u79cd\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\uff0c\u591a\u6570\u636e\u6e90\u914d\u7f6e\u4f7f\u7528 \u591a\u6570\u636e\u6e90\u914d\u7f6e\u76f8\u5173\u5b98\u65b9API\uff1ahttps:\/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9504"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9504"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9504\/revisions"}],"predecessor-version":[{"id":9516,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9504\/revisions\/9516"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}