浏览代码

单表维护模板

lizw 3 年之前
父节点
当前提交
ff2ebea5a0
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      single_table/groovy.hbs

+ 2 - 2
single_table/groovy.hbs

@@ -50,7 +50,7 @@ class {{{ groovyClass }}} {
         }
         for (def row : params.modifyRows) {
             // 提取 modifyRows 全部修改的数据,构建update的queryDsl语句,并添加到 "批量执行(addBatch)" 的缓存中
-            if ({{#each updateWheres}}row._origin.{{{ paramField }}} != null{{/each}}) {
+            if ({{#each updateWheres}}row._origin.{{{ paramField }}} != null{{#if @last}}{{else}} && {{/if}}{{/each}}) {
                 update
                         {{#each updateColumns}}
                         .setx({{{ ../qClassTable }}}.{{{ qClassField }}}, row.{{{ paramField }}})
@@ -63,7 +63,7 @@ class {{{ groovyClass }}} {
         }
         for (def row : params.removeRecords) {
             // 提取 removeRecords 全部删除的数据,构建删除条件,添加到 "批量执行(addBatch)" 的缓存中
-            if ({{#each deleteWheres}}row._origin.{{{ paramField }}} != null{{/each}}) {
+            if ({{#each deleteWheres}}row._origin.{{{ paramField }}} != null{{#if @last}}{{else}} && {{/if}}{{/each}}) {
                 delete
                         {{#each deleteWheres}}
                         .where({{{ ../qClassTable }}}.{{{ qClassField }}}.eq(DbConv.{{{ dbConvMethod }}}(row._origin.{{{ paramField }}})))