{"id":927,"date":"2023-03-11T17:23:59","date_gmt":"2023-03-11T09:23:59","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=927"},"modified":"2023-04-29T15:46:36","modified_gmt":"2023-04-29T07:46:36","slug":"mybatis-update-and-delete-records-in-batch-based-on-list","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/11\/mybatis-update-and-delete-records-in-batch-based-on-list\/","title":{"rendered":"MyBatis\u6839\u636eList\u6279\u91cf\u66f4\u65b0\u53ca\u5220\u9664\u8bb0\u5f55"},"content":{"rendered":"<h2>\u67e5\u8be2<\/h2>\n<pre><code class=\"language-java\">\/\/\u6839\u636e\u591a\u4e2a\u8bbe\u5907id\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f\npublic List&lt;Devices&gt; getDevicesList(@Param(&quot;devicesIds&quot;) String[] devicesIds);<\/code><\/pre>\n<p><!-- more --><\/p>\n<pre><code class=\"language-xml\">&lt;select id=&quot;getDevicesList&quot; resultMap=&quot;BaseResultMap&quot;&gt;\n    select\n    &lt;include refid=&quot;Base_Column_List&quot;\/&gt;\n    from sys_devices d\n    where d.devices_id in\n    &lt;foreach item=&quot;devices_id&quot; index=&quot;index&quot; collection=&quot;devicesIds&quot;\n            open=&quot;(&quot; separator=&quot;,&quot; close=&quot;)&quot;&gt;\n        #{devices_id}\n    &lt;\/foreach&gt;\n&lt;\/select&gt;<\/code><\/pre>\n<h2>\u5220\u9664<\/h2>\n<pre><code class=\"language-java\">\/\/\u6839\u636e\u4e3b\u952eID\u6279\u91cf\u5220\u9664\u8bb0\u5f55\nint deleteCategory(String[] categoryIds); <\/code><\/pre>\n<pre><code class=\"language-xml\">&lt;!-- \u6839\u636e\u4e3b\u952e\u6279\u91cf\u5220\u9664\u8bb0\u5f55 --&gt;\n&lt;delete id=&quot;deleteCategory&quot;&gt;\n    delete from category\n    where Category_ID in\n    &lt;foreach item=&quot;item&quot; index=&quot;index&quot; collection=&quot;array&quot; open=&quot;(&quot; separator=&quot;,&quot; close=&quot;)&quot;&gt;\n        #{item}\n    &lt;\/foreach&gt;\n&lt;\/delete&gt;<\/code><\/pre>\n<h2>\u66f4\u65b0<\/h2>\n<pre><code class=\"language-java\">int updateNotifyStatusForJob(List&lt;Long&gt; notifyIds);<\/code><\/pre>\n<pre><code class=\"language-xml\">&lt;update id=&quot;updateNotifyStatusForJob&quot; parameterType=&quot;java.util.List&quot;&gt;\n    update notify_info\n    set notify_status=&#039;doing&#039;\n    where notify_id IN\n    &lt;foreach collection=&quot;list&quot; index=&quot;index&quot; item=&quot;item&quot; open=&quot;(&quot; separator=&quot;,&quot; close=&quot;)&quot;&gt;\n        #{item}\n    &lt;\/foreach&gt;\n&lt;\/update&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u8be2 \/\/\u6839\u636e\u591a\u4e2a\u8bbe\u5907id\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f public List&lt;Devices&gt; getDevic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[111],"class_list":["post-927","post","type-post","status-publish","format-standard","hentry","category-mybatis","tag-mybatis"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=927"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/927\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}