|
@@ -24,6 +24,7 @@ class ZenSqlInjector : LogicSqlInjector() {
|
|
|
|
|
|
override fun inject(configuration: Configuration, builderAssistant: MapperBuilderAssistant, mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
|
|
|
super.inject(configuration, builderAssistant, mapperClass, modelClass, table)
|
|
|
+// this.testSelect(mapperClass, modelClass, table)
|
|
|
this.updateWOLogic(mapperClass, modelClass, table)
|
|
|
this.physicalDeleteById(mapperClass, modelClass, table)
|
|
|
this.physicalDelete(mapperClass, modelClass, table)
|
|
@@ -31,9 +32,16 @@ class ZenSqlInjector : LogicSqlInjector() {
|
|
|
this.selectWOLogicPage(mapperClass, modelClass, table)
|
|
|
}
|
|
|
|
|
|
+// fun testSelect(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
|
|
|
+// val sqlMethod = "testSelect"
|
|
|
+// val sql = "<script>SELECT ${sqlSelectColumns(table, true)} FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
|
|
|
+// val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
|
|
|
+// this.addSelectMappedStatement(mapperClass, sqlMethod, sqlSource, modelClass, table)
|
|
|
+// }
|
|
|
+
|
|
|
fun updateWOLogic(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
|
|
|
val sqlMethod = "updateWOLogic"
|
|
|
- val sql = "<script>UPDATE ${table.tableName} ${sqlSet(true, table, "et.")} ${sqlWhereEntityWrapper(table)}</script>"
|
|
|
+ val sql = "<script>UPDATE ${table.tableName} ${sqlSet(true, table, "et.")} ${zenSqlWhereEntityWrapper(table)}</script>"
|
|
|
val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
|
|
|
this.addUpdateMappedStatement(mapperClass, modelClass, sqlMethod, sqlSource)
|
|
|
}
|
|
@@ -47,26 +55,26 @@ class ZenSqlInjector : LogicSqlInjector() {
|
|
|
|
|
|
fun physicalDelete(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
|
|
|
val sqlMethod = "physicalDelete"
|
|
|
- val sql = "<script>DELETE FROM ${table.tableName} ${sqlWhereEntityWrapper(table)}</script>"
|
|
|
+ val sql = "<script>DELETE FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
|
|
|
val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
|
|
|
this.addDeleteMappedStatement(mapperClass, sqlMethod, sqlSource)
|
|
|
}
|
|
|
|
|
|
fun selectWOLogic(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
|
|
|
val sqlMethod = "selectWOLogic"
|
|
|
- val sql = "SELECT ${sqlSelectColumns(table, false)} FROM ${table.tableName} ${sqlWhereEntityWrapper(table)}"
|
|
|
+ val sql = "<script>SELECT ${sqlSelectColumns(table, true)} FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
|
|
|
val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
|
|
|
this.addSelectMappedStatement(mapperClass, sqlMethod, sqlSource, modelClass, table)
|
|
|
}
|
|
|
|
|
|
fun selectWOLogicPage(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
|
|
|
val sqlMethod = "selectWOLogicPage"
|
|
|
- val sql = "SELECT ${sqlSelectColumns(table, false)} FROM ${table.tableName} ${sqlWhereEntityWrapper(table)}"
|
|
|
+ val sql = "<script>SELECT ${sqlSelectColumns(table, true)} FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
|
|
|
val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
|
|
|
this.addSelectMappedStatement(mapperClass, sqlMethod, sqlSource, modelClass, table)
|
|
|
}
|
|
|
|
|
|
- override fun sqlWhereEntityWrapper(table: TableInfo): String {
|
|
|
+ fun zenSqlWhereEntityWrapper(table: TableInfo): String {
|
|
|
val where = StringBuilder(128)
|
|
|
where.append("\n<where>")
|
|
|
where.append("\n<if test=\"ew!=null\">")
|