Skip to content

Commit

Permalink
支持包含查询
Browse files Browse the repository at this point in the history
  • Loading branch information
tangllty committed Dec 23, 2023
1 parent acd2cb8 commit 6faadd1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion databases/20221210.sql
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ create table gen_table_column (
is_insert char(1) default '0' comment '是否为插入字段{0=否, 1=是}',
is_edit char(1) default '0' comment '是否编辑字段{0=否, 1=是}',
is_required char(1) default '0' comment '是否必填{0=否, 1=是}',
query_type varchar(128) default 'equal' comment '查询方式{equal=等于, fuzzy=模糊}',
query_type varchar(128) default 'equal' comment '查询方式{equal=等于, fuzzy=模糊, findInSet=包含}',
html_type varchar(128) default '' comment '显示类型',
dict_type varchar(128) default '' comment '字典类型',
sort int(4) default 0 comment '显示顺序',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class GenTableColumn extends BaseEntity {
private String isRequired;

/**
* 查询方式{equal=等于, fuzzy=模糊}
* 查询方式{equal=等于, fuzzy=模糊, findInSet=包含}
*/
private String queryType;

Expand Down
5 changes: 5 additions & 0 deletions tang-generator/src/main/resources/vm/xml/mapper.xml.vm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
and ${tableAlias}.$column.columnName like concat('%', #{$column.javaField}, '%')
</if>
#end
#if($column.queryType == "in")
<if test="$column.javaField != null#if($column.javaType == 'String') and $column.javaField != ''#end">
and find_in_set(#{$column.javaField}, ${tableAlias}.$column.columnName)
</if>
#end
#end
</where>
</select>
Expand Down

0 comments on commit 6faadd1

Please sign in to comment.