| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.GenConstants; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.exception.CustomException; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.generator.domain.GenTable; |
| | |
| | | GenTable genTable = baseMapper.selectGenTableById(id); |
| | | setTableFromOptions(genTable); |
| | | return genTable; |
| | | } |
| | | |
| | | @Override |
| | | public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable) { |
| | | return PageUtils.buildDataInfo(baseMapper.selectPageGenTableList(PageUtils.buildPage(), genTable)); |
| | | } |
| | | |
| | | @Override |
| | | public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable) { |
| | | return PageUtils.buildDataInfo(baseMapper.selectPageDbTableList(PageUtils.buildPage(), genTable)); |
| | | } |
| | | |
| | | /** |
| | |
| | | .set(cenTableColumn.getIsEdit() == null, GenTableColumn::getIsEdit, null) |
| | | .set(cenTableColumn.getIsList() == null, GenTableColumn::getIsList, null) |
| | | .set(cenTableColumn.getIsQuery() == null, GenTableColumn::getIsQuery, null) |
| | | .set(cenTableColumn.getIsRequired() == null, GenTableColumn::getIsRequired, null) |
| | | .eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId())); |
| | | } |
| | | } |
| | |
| | | StringWriter sw = new StringWriter(); |
| | | Template tpl = Velocity.getTemplate(template, Constants.UTF8); |
| | | tpl.merge(context, sw); |
| | | try { |
| | | String path = getGenPath(table, template); |
| | | FileUtils.writeStringToFile(new File(path), sw.toString(), Constants.UTF8); |
| | | } catch (IOException e) { |
| | | throw new CustomException("渲染模板失败,表名:" + table.getTableName()); |
| | | } |
| | | String path = getGenPath(table, template); |
| | | FileUtils.writeUtf8String(sw.toString(), path); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return genPath + File.separator + VelocityUtils.getFileName(template, table); |
| | | } |
| | | } |
| | | } |