| | |
| | | import cn.hutool.core.lang.Dict; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.ruoyi.common.constant.GenConstants; |
| | | import com.ruoyi.common.helper.DataBaseHelper; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.JsonUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | templates.add("vm/java/serviceImpl.java.vm"); |
| | | templates.add("vm/java/controller.java.vm"); |
| | | templates.add("vm/xml/mapper.xml.vm"); |
| | | templates.add("vm/sql/sql.vm"); |
| | | if (DataBaseHelper.isOracle()) { |
| | | templates.add("vm/sql/oracle/sql.vm"); |
| | | } else if (DataBaseHelper.isPostgerSql()) { |
| | | templates.add("vm/sql/postgres/sql.vm"); |
| | | } else if (DataBaseHelper.isSqlServer()) { |
| | | templates.add("vm/sql/sqlserver/sql.vm"); |
| | | } else { |
| | | templates.add("vm/sql/sql.vm"); |
| | | } |
| | | templates.add("vm/js/api.js.vm"); |
| | | if (GenConstants.TPL_CRUD.equals(tplCategory)) { |
| | | templates.add("vm/vue/index.vue.vm"); |
| | |
| | | public static String getDicts(GenTable genTable) { |
| | | List<GenTableColumn> columns = genTable.getColumns(); |
| | | Set<String> dicts = new HashSet<String>(); |
| | | addDicts(dicts, columns); |
| | | if (ObjectUtil.isNotNull(genTable.getSubTable())) { |
| | | List<GenTableColumn> subColumns = genTable.getSubTable().getColumns(); |
| | | addDicts(dicts, subColumns); |
| | | } |
| | | return StringUtils.join(dicts, ", "); |
| | | } |
| | | |
| | | /** |
| | | * 添加字典列表 |
| | | * |
| | | * @param dicts 字典列表 |
| | | * @param columns 列集合 |
| | | */ |
| | | public static void addDicts(Set<String> dicts, List<GenTableColumn> columns) { |
| | | for (GenTableColumn column : columns) { |
| | | if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( |
| | | column.getHtmlType(), |
| | | new String[]{GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX})) { |
| | | new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) { |
| | | dicts.add("'" + column.getDictType() + "'"); |
| | | } |
| | | } |
| | | return StringUtils.join(dicts, ", "); |
| | | } |
| | | |
| | | /** |