代码生成的d
This commit is contained in:
parent
ebfedb130e
commit
76a1ad9b0d
21
doc/修改笔记.txt
21
doc/修改笔记.txt
|
|
@ -17,9 +17,22 @@
|
||||||
$("input[name='updateTime']").prop('disabled', true);
|
$("input[name='updateTime']").prop('disabled', true);
|
||||||
|
|
||||||
|
|
||||||
|
4、 Java8 使用 stream().filter()过滤List对象(查找符合条件的对象集合)
|
||||||
|
//查找身高在1.8米及以上的男生
|
||||||
|
List<StudentInfo> boys = studentList.stream().filter(s->s.getGender() && s.getHeight() >= 1.8).collect(Collectors.toList());
|
||||||
|
//输出查找结果
|
||||||
|
StudentInfo.printStudents(boys);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 取身份信息
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
// 根据用户id取出菜单
|
||||||
|
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
||||||
|
mmap.put("menus", menus);
|
||||||
|
mmap.put("user", user);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=============== 相关资料 ========================================================================
|
=============== 相关资料 ========================================================================
|
||||||
|
|
||||||
|
|
@ -39,3 +52,11 @@ j2eefast开源
|
||||||
https://gitee.com/zhouhuanOGP/J2EEFAST
|
https://gitee.com/zhouhuanOGP/J2EEFAST
|
||||||
附件和图片上传我全套扣的j2eefast的,ruoyi的用着太怪了
|
附件和图片上传我全套扣的j2eefast的,ruoyi的用着太怪了
|
||||||
|
|
||||||
|
|
||||||
|
阿里云开发者成长计划
|
||||||
|
https://developer.aliyun.com/plan/grow-up?spm=5176.19720258.J_8058803260.1292.1d722c4ae1PLsq
|
||||||
|
|
||||||
|
|
||||||
|
VueOA
|
||||||
|
https://blog.csdn.net/aria_miazzy/article/details/104960221
|
||||||
|
https://gitee.com/yunwisdoms/oa-front-service
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,9 @@ public class GenTable extends BaseEntity
|
||||||
/** 主键信息 */
|
/** 主键信息 */
|
||||||
private GenTableColumn pkColumn;
|
private GenTableColumn pkColumn;
|
||||||
|
|
||||||
|
/** 名称列信息 */
|
||||||
|
private GenTableColumn dspColumn;
|
||||||
|
|
||||||
/** 子表信息 */
|
/** 子表信息 */
|
||||||
private GenTable subTable;
|
private GenTable subTable;
|
||||||
|
|
||||||
|
|
@ -271,6 +274,14 @@ public class GenTable extends BaseEntity
|
||||||
this.pkColumn = pkColumn;
|
this.pkColumn = pkColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GenTableColumn getDspColumn() {
|
||||||
|
return dspColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDspColumn(GenTableColumn dspColumn) {
|
||||||
|
this.dspColumn = dspColumn;
|
||||||
|
}
|
||||||
|
|
||||||
public GenTable getSubTable()
|
public GenTable getSubTable()
|
||||||
{
|
{
|
||||||
return subTable;
|
return subTable;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ public class GenTableColumn extends BaseEntity implements Cloneable
|
||||||
/** 默认值(1是) */
|
/** 默认值(1是) */
|
||||||
private String isDefaultValue;
|
private String isDefaultValue;
|
||||||
|
|
||||||
|
|
||||||
/** 关联实体名 */
|
/** 关联实体名 */
|
||||||
private String relevTable ;
|
private String relevTable ;
|
||||||
|
|
||||||
|
|
@ -83,6 +82,11 @@ public class GenTableColumn extends BaseEntity implements Cloneable
|
||||||
/** 关联表字段名称 */
|
/** 关联表字段名称 */
|
||||||
private String relevTableName;
|
private String relevTableName;
|
||||||
|
|
||||||
|
/** 关联实体 字段名称 */
|
||||||
|
private String relevjavafiledname;
|
||||||
|
|
||||||
|
/** 关联实体 Column 别名 */
|
||||||
|
private String relevcolumnalias;
|
||||||
|
|
||||||
/** 关联实体 别名 */
|
/** 关联实体 别名 */
|
||||||
private String relevAlias;
|
private String relevAlias;
|
||||||
|
|
@ -298,6 +302,22 @@ public class GenTableColumn extends BaseEntity implements Cloneable
|
||||||
return isRelevByHidden != null && StringUtils.equals("1", isRelevByHidden);
|
return isRelevByHidden != null && StringUtils.equals("1", isRelevByHidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRelevjavafiledname() {
|
||||||
|
return relevjavafiledname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelevjavafiledname(String relevjavafiledname) {
|
||||||
|
this.relevjavafiledname = relevjavafiledname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRelevcolumnalias() {
|
||||||
|
return relevcolumnalias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelevcolumnalias(String relevcolumnalias) {
|
||||||
|
this.relevcolumnalias = relevcolumnalias;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRelevAlias() {
|
public String getRelevAlias() {
|
||||||
return relevAlias;
|
return relevAlias;
|
||||||
}
|
}
|
||||||
|
|
@ -306,6 +326,7 @@ public class GenTableColumn extends BaseEntity implements Cloneable
|
||||||
this.relevAlias = relevAlias;
|
this.relevAlias = relevAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getIsRepeatControl() {
|
public String getIsRepeatControl() {
|
||||||
return isRepeatControl;
|
return isRepeatControl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,10 @@
|
||||||
package com.ruoyi.generator.service.impl;
|
package com.ruoyi.generator.service.impl;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.velocity.Template;
|
|
||||||
import org.apache.velocity.VelocityContext;
|
|
||||||
import org.apache.velocity.app.Velocity;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.constant.GenConstants;
|
import com.ruoyi.common.constant.GenConstants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.text.CharsetKit;
|
import com.ruoyi.common.core.text.CharsetKit;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.exception.BusinessException;
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
|
|
@ -36,23 +18,60 @@ import com.ruoyi.generator.service.IGenTableService;
|
||||||
import com.ruoyi.generator.util.GenUtils;
|
import com.ruoyi.generator.util.GenUtils;
|
||||||
import com.ruoyi.generator.util.VelocityInitializer;
|
import com.ruoyi.generator.util.VelocityInitializer;
|
||||||
import com.ruoyi.generator.util.VelocityUtils;
|
import com.ruoyi.generator.util.VelocityUtils;
|
||||||
|
import com.ruoyi.system.domain.RelevTable;
|
||||||
|
import com.ruoyi.system.mapper.RelevTableMapper;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.velocity.Template;
|
||||||
|
import org.apache.velocity.VelocityContext;
|
||||||
|
import org.apache.velocity.app.Velocity;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务 服务层实现
|
* 业务 服务层实现
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Component
|
||||||
@Service
|
@Service
|
||||||
public class GenTableServiceImpl implements IGenTableService
|
public class GenTableServiceImpl implements IGenTableService
|
||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RelevTableMapper relevTableMapper;
|
||||||
|
|
||||||
|
private static GenTableServiceImpl gnTableServiceImpl ;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GenTableMapper genTableMapper;
|
private GenTableMapper genTableMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GenTableColumnMapper genTableColumnMapper;
|
private GenTableColumnMapper genTableColumnMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@PostConstruct //通过@PostConstruct实现初始化bean之前进行的操作
|
||||||
|
public void init() {
|
||||||
|
gnTableServiceImpl = this;
|
||||||
|
gnTableServiceImpl.relevTableMapper = this.relevTableMapper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务信息
|
* 查询业务信息
|
||||||
*
|
*
|
||||||
|
|
@ -202,11 +221,18 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
GenTable table = genTableMapper.selectGenTableById(tableId);
|
GenTable table = genTableMapper.selectGenTableById(tableId);
|
||||||
// 设置主子表信息
|
// 设置主子表信息
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
|
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
setPkColumn(table);
|
setPkColumn(table);
|
||||||
|
// 设置名称重复列信息
|
||||||
|
setRepeatDspColumn(table);
|
||||||
|
|
||||||
VelocityInitializer.initVelocity();
|
VelocityInitializer.initVelocity();
|
||||||
|
|
||||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
List<RelevTable> lstRelev =
|
||||||
|
relevTableMapper.selectRelevTableAll() ; // "SysUser"
|
||||||
|
|
||||||
|
VelocityContext context = VelocityUtils.prepareContext(table,lstRelev);
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
|
|
@ -251,10 +277,15 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
setPkColumn(table);
|
setPkColumn(table);
|
||||||
|
// 设置名称重复列信息
|
||||||
|
setRepeatDspColumn(table);
|
||||||
|
|
||||||
VelocityInitializer.initVelocity();
|
VelocityInitializer.initVelocity();
|
||||||
|
|
||||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
List<RelevTable> lstRelev =
|
||||||
|
relevTableMapper.selectRelevTableAll() ; // "SysUser"
|
||||||
|
|
||||||
|
VelocityContext context = VelocityUtils.prepareContext(table,lstRelev);
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
|
|
@ -345,10 +376,15 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
setPkColumn(table);
|
setPkColumn(table);
|
||||||
|
// 设置名称重复列信息
|
||||||
|
setRepeatDspColumn(table);
|
||||||
|
|
||||||
VelocityInitializer.initVelocity();
|
VelocityInitializer.initVelocity();
|
||||||
|
|
||||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
List<RelevTable> lstRelev =
|
||||||
|
relevTableMapper.selectRelevTableAll() ; // "SysUser"
|
||||||
|
|
||||||
|
VelocityContext context = VelocityUtils.prepareContext(table,lstRelev);
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
|
|
@ -457,6 +493,28 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 名称列信息
|
||||||
|
*
|
||||||
|
* @param table 业务表信息
|
||||||
|
*/
|
||||||
|
public void setRepeatDspColumn(GenTable table)
|
||||||
|
{
|
||||||
|
for (GenTableColumn column : table.getColumns())
|
||||||
|
{
|
||||||
|
if (column.isRepeatControl())
|
||||||
|
{
|
||||||
|
table.setDspColumn(column);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isNull(table.getDspColumn()))
|
||||||
|
{
|
||||||
|
table.setDspColumn(table.getColumns().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置主子表信息
|
* 设置主子表信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,15 @@ import com.ruoyi.generator.config.GenConfig;
|
||||||
import com.ruoyi.generator.domain.GenTable;
|
import com.ruoyi.generator.domain.GenTable;
|
||||||
import com.ruoyi.generator.domain.GenTableColumn;
|
import com.ruoyi.generator.domain.GenTableColumn;
|
||||||
import com.ruoyi.system.domain.RelevTable;
|
import com.ruoyi.system.domain.RelevTable;
|
||||||
import com.ruoyi.system.service.IRelevTableService;
|
|
||||||
import org.apache.velocity.VelocityContext;
|
import org.apache.velocity.VelocityContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class VelocityUtils {
|
public class VelocityUtils {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IRelevTableService relevTableService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目空间路径
|
* 项目空间路径
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,7 +43,7 @@ public class VelocityUtils {
|
||||||
*
|
*
|
||||||
* @return 模板列表
|
* @return 模板列表
|
||||||
*/
|
*/
|
||||||
public static VelocityContext prepareContext(GenTable genTable) {
|
public static VelocityContext prepareContext(GenTable genTable,List<RelevTable> lstRelevTb) {
|
||||||
String moduleName = genTable.getModuleName();
|
String moduleName = genTable.getModuleName();
|
||||||
String businessName = genTable.getBusinessName();
|
String businessName = genTable.getBusinessName();
|
||||||
String packageName = genTable.getPackageName();
|
String packageName = genTable.getPackageName();
|
||||||
|
|
@ -67,6 +63,7 @@ public class VelocityUtils {
|
||||||
velocityContext.put("author", genTable.getFunctionAuthor());
|
velocityContext.put("author", genTable.getFunctionAuthor());
|
||||||
velocityContext.put("datetime", DateUtils.getDate());
|
velocityContext.put("datetime", DateUtils.getDate());
|
||||||
velocityContext.put("pkColumn", genTable.getPkColumn());
|
velocityContext.put("pkColumn", genTable.getPkColumn());
|
||||||
|
velocityContext.put("dspRepeatColumn", genTable.getDspColumn());
|
||||||
velocityContext.put("importList", getImportList(genTable));
|
velocityContext.put("importList", getImportList(genTable));
|
||||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||||
|
|
||||||
|
|
@ -75,48 +72,75 @@ public class VelocityUtils {
|
||||||
List<GenTableColumn> effectivecols = new ArrayList<GenTableColumn>();//定义一个list对象
|
List<GenTableColumn> effectivecols = new ArrayList<GenTableColumn>();//定义一个list对象
|
||||||
List<GenTableColumn> effectiveceditols = new ArrayList<GenTableColumn>();//定义一个list对象
|
List<GenTableColumn> effectiveceditols = new ArrayList<GenTableColumn>();//定义一个list对象
|
||||||
List<GenTableColumn> fieldcols = new ArrayList<GenTableColumn>();// 模板的变量 colums
|
List<GenTableColumn> fieldcols = new ArrayList<GenTableColumn>();// 模板的变量 colums
|
||||||
List<GenTableColumn> hiddenfiledcols = new ArrayList<GenTableColumn>();// 模板隐藏变量 hiddenfiledcols
|
List<GenTableColumn> hiddenleftjoinfiledcols = new ArrayList<GenTableColumn>();// 模板隐藏变量 hiddenfiledcols
|
||||||
|
|
||||||
|
Integer icount = 0 ;
|
||||||
|
|
||||||
for (GenTableColumn tcolumn : tempcolumns) {
|
for (GenTableColumn tcolumn : tempcolumns) {
|
||||||
if (tcolumn.isInsert() && !tcolumn.isPk())
|
|
||||||
if (tcolumn.isUsableColumn() || !tcolumn.isSuperColumn())
|
|
||||||
effectivecols.add(tcolumn);
|
|
||||||
|
|
||||||
if (tcolumn.isEdit() && !tcolumn.isPk())
|
|
||||||
if (tcolumn.isUsableColumn() || !tcolumn.isSuperColumn())
|
|
||||||
effectiveceditols.add(tcolumn);
|
|
||||||
|
|
||||||
if ( !StringUtil.isEmpty( tcolumn.getRelevEntity() ) && !tcolumn.isPk() ) {
|
if ( !StringUtil.isEmpty( tcolumn.getRelevEntity() ) && !tcolumn.isPk() ) {
|
||||||
// 添加 关联字段 信息
|
// 添加 关联字段 信息
|
||||||
try {
|
try {
|
||||||
|
// 根据关联字段 查找 ....
|
||||||
|
// RelevTable relevTb = null ; // lstRelevTb
|
||||||
|
List<RelevTable> lstcurRelevTb = lstRelevTb.stream().filter( s->s.getRelevEntity().equals(tcolumn.getRelevEntity()) ).collect(Collectors.toList());
|
||||||
|
//输出查找结果
|
||||||
|
|
||||||
|
tcolumn.setRelevEntityId( lstcurRelevTb.get(0).getRelevEntityId() );
|
||||||
|
tcolumn.setRelevEntityName( lstcurRelevTb.get(0).getRelevEntityName() );
|
||||||
|
tcolumn.setRelevTable(lstcurRelevTb.get(0).getRelevTable());
|
||||||
|
tcolumn.setRelevTableName(lstcurRelevTb.get(0).getRelevTableName());
|
||||||
|
tcolumn.setRelevTableId(lstcurRelevTb.get(0).getRelevTableId());
|
||||||
|
|
||||||
// 取得 关联实体信息
|
// 取得 关联实体信息
|
||||||
GenTableColumn relevColumn = (GenTableColumn) tcolumn.clone();
|
GenTableColumn relevColumn = (GenTableColumn) tcolumn.clone();
|
||||||
|
relevColumn.setJavaField( tcolumn.getJavaField().concat( relevColumn.getRelevEntityName() ));
|
||||||
RelevTable relevTb =
|
|
||||||
relevTableService.selectRelevTableByRelevEntity( tcolumn.getRelevEntity() ) ;
|
|
||||||
|
|
||||||
relevColumn.setRelevEntityId( relevTb.getRelevEntityId() );
|
|
||||||
relevColumn.setRelevEntityName( relevTb.getRelevEntityName() );
|
|
||||||
relevColumn.setRelevTable(relevTb.getRelevTable());
|
|
||||||
relevColumn.setRelevTableName(relevTb.getRelevTableName());
|
|
||||||
relevColumn.setRelevTableId(relevTb.getRelevTableId());
|
|
||||||
|
|
||||||
fieldcols.add(relevColumn) ;
|
fieldcols.add(relevColumn) ;
|
||||||
|
|
||||||
|
tcolumn.setIsRelevByHidden("1");
|
||||||
|
tcolumn.setColumnComment(tcolumn.getColumnComment().concat("ID"));
|
||||||
|
tcolumn.setRelevjavafiledname( tcolumn.getJavaField().concat( relevColumn.getRelevEntityName() ) );
|
||||||
|
|
||||||
|
icount ++ ;
|
||||||
|
tcolumn.setRelevAlias("a".concat(icount.toString()));
|
||||||
|
tcolumn.setRelevcolumnalias(tcolumn.getRelevAlias().concat(tcolumn.getRelevEntity().toLowerCase()));
|
||||||
|
|
||||||
|
hiddenleftjoinfiledcols.add(tcolumn) ;
|
||||||
|
fieldcols.add(tcolumn) ;
|
||||||
|
|
||||||
|
if (relevColumn.isInsert() && !relevColumn.isPk())
|
||||||
|
if (relevColumn.isUsableColumn() || !relevColumn.isSuperColumn())
|
||||||
|
effectivecols.add(relevColumn);
|
||||||
|
|
||||||
|
if (relevColumn.isEdit() && !relevColumn.isPk())
|
||||||
|
if (relevColumn.isUsableColumn() || !relevColumn.isSuperColumn())
|
||||||
|
effectiveceditols.add(relevColumn);
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tcolumn.setIsRelevByHidden("1");
|
} else {
|
||||||
|
|
||||||
fieldcols.add(tcolumn) ;
|
fieldcols.add(tcolumn) ;
|
||||||
|
|
||||||
} else
|
if (tcolumn.isInsert() && !tcolumn.isPk())
|
||||||
fieldcols.add(tcolumn) ;
|
if (tcolumn.isUsableColumn() || !tcolumn.isSuperColumn())
|
||||||
|
effectivecols.add(tcolumn);
|
||||||
|
|
||||||
|
if (tcolumn.isEdit() && !tcolumn.isPk())
|
||||||
|
if (tcolumn.isUsableColumn() || !tcolumn.isSuperColumn())
|
||||||
|
effectiveceditols.add(tcolumn);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
velocityContext.put("effectivecols", effectivecols);
|
velocityContext.put("effectivecols", effectivecols);
|
||||||
velocityContext.put("effectiveeditcols", effectiveceditols);
|
velocityContext.put("effectiveeditcols", effectiveceditols);
|
||||||
velocityContext.put("columns", genTable.getColumns());
|
// 在界面上 要隐藏的ID
|
||||||
|
velocityContext.put("hiddenleftjoinfiledcols", hiddenleftjoinfiledcols);
|
||||||
|
velocityContext.put("mappercols", genTable.getColumns() ); //
|
||||||
|
velocityContext.put("columns", fieldcols ); // genTable.getColumns()
|
||||||
|
|
||||||
velocityContext.put("table", genTable);
|
velocityContext.put("table", genTable);
|
||||||
setMenuVelocityContext(velocityContext, genTable);
|
setMenuVelocityContext(velocityContext, genTable);
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="isIncrement" column="is_increment" />
|
<result property="isIncrement" column="is_increment" />
|
||||||
<result property="isRequired" column="is_required" />
|
<result property="isRequired" column="is_required" />
|
||||||
<result property="isReadonly" column="is_readonly" />
|
<result property="isReadonly" column="is_readonly" />
|
||||||
<result property="isInsert" column="is_insert" />
|
|
||||||
|
<result property="relevEntity" column="relev_entity" />
|
||||||
|
<result property="isRepeatControl" column="is_repeat_control" />
|
||||||
|
|
||||||
|
<result property="isInsert" column="is_insert" />
|
||||||
<result property="isEdit" column="is_edit" />
|
<result property="isEdit" column="is_edit" />
|
||||||
<result property="isList" column="is_list" />
|
<result property="isList" column="is_list" />
|
||||||
<result property="isQuery" column="is_query" />
|
<result property="isQuery" column="is_query" />
|
||||||
|
|
@ -104,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
t.form_cols,t.bill_prefix,
|
t.form_cols,t.bill_prefix,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_readonly,c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_readonly,c.relev_entity,c.is_repeat_control,c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_id = #{tableId} order by c.sort
|
where t.table_id = #{tableId} order by c.sort
|
||||||
|
|
@ -113,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
t.form_cols,t.bill_prefix,
|
t.form_cols,t.bill_prefix,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_readonly, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_readonly,c.relev_entity,c.is_repeat_control,c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_name = #{tableName} order by c.sort
|
where t.table_name = #{tableName} order by c.sort
|
||||||
|
|
@ -122,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
t.form_cols,t.bill_prefix,
|
t.form_cols,t.bill_prefix,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_readonly,c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_readonly,c.relev_entity,c.is_repeat_control,c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
order by c.sort
|
order by c.sort
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-${businessName}-add">
|
<form class="form-horizontal m" id="form-${businessName}-add">
|
||||||
|
#if( $hiddencolumns.size() > 0 )
|
||||||
|
#foreach($column in $hiddencolumns)
|
||||||
|
<input type="hidden" name="${column.javaField}" id="${column.javaField}" />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<h4 class="form-header h4">${functionName}信息</h4>
|
<h4 class="form-header h4">${functionName}信息</h4>
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('新增${functionName}')" />
|
<th:block th:include="include :: header('新增${functionName}')" />
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
<th:block th:include="include :: datetimepicker-css" />
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
<th:block th:include="include :: summernote-css" />
|
<th:block th:include="include :: summernote-css" />
|
||||||
#break
|
#break
|
||||||
|
|
@ -24,11 +24,15 @@
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-${businessName}-add">
|
<form class="form-horizontal m" id="form-${businessName}-add">
|
||||||
|
#if( $hiddenleftjoinfiledcols.size() > 0 )
|
||||||
|
#foreach($column in $hiddenleftjoinfiledcols)
|
||||||
|
<input type="hidden" name="${column.javaField}" id="${column.javaField}" />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<h4 class="form-header h4">${functionName}信息</h4>
|
<h4 class="form-header h4">${functionName}信息</h4>
|
||||||
#end
|
#end
|
||||||
<input type="hidden" name="supplierTypeId" id="supplierTypeId" />
|
|
||||||
<input type="hidden" name="unitId" id="unitId" />
|
|
||||||
|
|
||||||
#set($cumvar=0)
|
#set($cumvar=0)
|
||||||
#set($colcount=$effectivecols.size())
|
#set($colcount=$effectivecols.size())
|
||||||
|
|
@ -114,13 +118,13 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
#break
|
#break
|
||||||
|
|
@ -151,7 +155,7 @@
|
||||||
$.operate.save(prefix + "/add", $('#form-${businessName}-add').serialize());
|
$.operate.save(prefix + "/add", $('#form-${businessName}-add').serialize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
|
||||||
$("input[name='$column.javaField']").datetimepicker({
|
$("input[name='$column.javaField']").datetimepicker({
|
||||||
|
|
@ -161,7 +165,7 @@
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
|
||||||
$(".file-upload").fileinput({
|
$(".file-upload").fileinput({
|
||||||
|
|
@ -176,7 +180,7 @@
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectivecols)
|
||||||
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('修改${functionName}')" />
|
<th:block th:include="include :: header('修改${functionName}')" />
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
<th:block th:include="include :: datetimepicker-css" />
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
<th:block th:include="include :: summernote-css" />
|
<th:block th:include="include :: summernote-css" />
|
||||||
#break
|
#break
|
||||||
|
|
@ -24,6 +24,12 @@
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-${businessName}-edit" th:object="${${className}}">
|
<form class="form-horizontal m" id="form-${businessName}-edit" th:object="${${className}}">
|
||||||
|
#if( $hiddenleftjoinfiledcols.size() > 0 )
|
||||||
|
#foreach($column in $hiddenleftjoinfiledcols)
|
||||||
|
<input type="hidden" name="${column.javaField}" id="${column.javaField}" />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<h4 class="form-header h4">${functionName}信息</h4>
|
<h4 class="form-header h4">${functionName}信息</h4>
|
||||||
#end
|
#end
|
||||||
|
|
@ -89,19 +95,19 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
<th:block th:include="include :: summernote-js" />
|
<th:block th:include="include :: summernote-js" />
|
||||||
#break
|
#break
|
||||||
|
|
@ -125,7 +131,7 @@
|
||||||
$.operate.save(prefix + "/edit", $('#form-${businessName}-edit').serialize());
|
$.operate.save(prefix + "/edit", $('#form-${businessName}-edit').serialize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
|
||||||
$("input[name='$column.javaField']").datetimepicker({
|
$("input[name='$column.javaField']").datetimepicker({
|
||||||
|
|
@ -135,7 +141,7 @@
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
|
||||||
$(".file-upload").each(function (i) {
|
$(".file-upload").each(function (i) {
|
||||||
|
|
@ -156,7 +162,7 @@
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach($column in $columns)
|
#foreach($column in $effectiveeditcols)
|
||||||
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,12 @@
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-${businessName}-edit" th:object="${${className}}">
|
<form class="form-horizontal m" id="form-${businessName}-edit" th:object="${${className}}">
|
||||||
|
#if( $hiddencolumns.size() > 0 )
|
||||||
|
#foreach($column in $hiddencolumns)
|
||||||
|
<input type="hidden" name="${column.javaField}" id="${column.javaField}" />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<h4 class="form-header h4">${functionName}信息</h4>
|
<h4 class="form-header h4">${functionName}信息</h4>
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,15 @@ public interface ${ClassName}Mapper
|
||||||
*/
|
*/
|
||||||
public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField});
|
public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
|
||||||
|
#if($dspRepeatColumn.size() > 0)
|
||||||
|
/**
|
||||||
|
* 查询${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}ID
|
||||||
|
* @return ${functionName}
|
||||||
|
*/
|
||||||
|
public ${ClassName} select${ClassName}ByName(${pkColumn.javaType} ${pkColumn.javaField},${dspRepeatColumn.javaType} ${dspRepeatColumn.javaField});
|
||||||
|
#end
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,16 @@ public interface I${ClassName}Service
|
||||||
*/
|
*/
|
||||||
public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField});
|
public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
|
||||||
|
#if($dspRepeatColumn.size() > 0)
|
||||||
|
/**
|
||||||
|
* 查询${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}ID
|
||||||
|
* @return ${functionName}
|
||||||
|
*/
|
||||||
|
public ${ClassName} select${ClassName}ByName(${pkColumn.javaType} ${pkColumn.javaField},${dspRepeatColumn.javaType} ${dspRepeatColumn.javaField});
|
||||||
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
#end
|
#end
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $mappercols)
|
||||||
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
#break
|
#break
|
||||||
|
|
@ -48,6 +48,20 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||||
return ${className}Mapper.select${ClassName}ById(${pkColumn.javaField});
|
return ${className}Mapper.select${ClassName}ById(${pkColumn.javaField});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if($dspRepeatColumn.size() > 0)
|
||||||
|
/**
|
||||||
|
* 查询${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}ID
|
||||||
|
* @return ${functionName}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ${ClassName} select${ClassName}ByName(${pkColumn.javaType} ${pkColumn.javaField},${dspRepeatColumn.javaType} ${dspRepeatColumn.javaField})
|
||||||
|
{
|
||||||
|
return ${className}Mapper.select${ClassName}ByName(${pkColumn.javaField},${dspRepeatColumn.javaField});
|
||||||
|
}
|
||||||
|
|
||||||
|
#end
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
*
|
*
|
||||||
|
|
@ -72,7 +86,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||||
@Override
|
@Override
|
||||||
public int insert${ClassName}(${ClassName} ${className})
|
public int insert${ClassName}(${ClassName} ${className})
|
||||||
{
|
{
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $mappercols)
|
||||||
#if($column.javaField == 'createTime')
|
#if($column.javaField == 'createTime')
|
||||||
${className}.setCreateTime(DateUtils.getNowDate());
|
${className}.setCreateTime(DateUtils.getNowDate());
|
||||||
#end
|
#end
|
||||||
|
|
@ -98,7 +112,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||||
@Override
|
@Override
|
||||||
public int update${ClassName}(${ClassName} ${className})
|
public int update${ClassName}(${ClassName} ${className})
|
||||||
{
|
{
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $mappercols)
|
||||||
#if($column.javaField == 'updateTime')
|
#if($column.javaField == 'updateTime')
|
||||||
${className}.setUpdateTime(DateUtils.getNowDate());
|
${className}.setUpdateTime(DateUtils.getNowDate());
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
||||||
|
|
||||||
<resultMap type="${ClassName}" id="${ClassName}Result">
|
<resultMap type="${ClassName}" id="${ClassName}Result">
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $mappercols)
|
||||||
<result property="${column.javaField}" column="${column.columnName}" />
|
<result property="${column.javaField}" column="${column.columnName}" />
|
||||||
#end
|
#end
|
||||||
|
#if($hiddenleftjoinfiledcols.size()>0)
|
||||||
|
#foreach ($column in $hiddenleftjoinfiledcols)
|
||||||
|
<result property="${column.relevjavafiledname}" column="${column.relevcolumnalias}" />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#if($table.tree)
|
#if($table.tree)
|
||||||
<result property="parentName" column="parent_name" />
|
<result property="parentName" column="parent_name" />
|
||||||
#end
|
#end
|
||||||
|
|
@ -26,13 +31,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#end
|
#end
|
||||||
|
|
||||||
<sql id="select${ClassName}Vo">
|
<sql id="select${ClassName}Vo">
|
||||||
select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName}
|
select#foreach($column in $mappercols) t.$column.columnName#if($velocityCount != $mappercols.size()),#end#end
|
||||||
|
#if($hiddenleftjoinfiledcols.size()>0),
|
||||||
|
#foreach($column in $hiddenleftjoinfiledcols)
|
||||||
|
$column.relevAlias.$column.relevTableName as $column.relevcolumnalias#if($velocityCount != $hiddenleftjoinfiledcols.size()),#end#end
|
||||||
|
#end
|
||||||
|
from ${tableName} t
|
||||||
|
#if($hiddenleftjoinfiledcols.size()>0)
|
||||||
|
#foreach($column in $hiddenleftjoinfiledcols)
|
||||||
|
left join $column.relevTable $column.relevAlias on t.$column.columnName=$column.relevAlias.$column.relevTableId
|
||||||
|
#end
|
||||||
|
#end
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
|
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
|
||||||
<include refid="select${ClassName}Vo"/>
|
<include refid="select${ClassName}Vo"/>
|
||||||
<where>
|
<where>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $mappercols)
|
||||||
#set($queryType=$column.queryType)
|
#set($queryType=$column.queryType)
|
||||||
#set($javaField=$column.javaField)
|
#set($javaField=$column.javaField)
|
||||||
#set($javaType=$column.javaType)
|
#set($javaType=$column.javaType)
|
||||||
|
|
@ -40,21 +55,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#if($column.query)
|
#if($column.query)
|
||||||
#if($column.queryType == "EQ")
|
#if($column.queryType == "EQ")
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
|
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and t.$columnName = #{$javaField}</if>
|
||||||
#elseif($queryType == "NE")
|
#elseif($queryType == "NE")
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
|
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and t.$columnName != #{$javaField}</if>
|
||||||
#elseif($queryType == "GT")
|
#elseif($queryType == "GT")
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if>
|
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and t.$columnName > #{$javaField}</if>
|
||||||
#elseif($queryType == "GTE")
|
#elseif($queryType == "GTE")
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if>
|
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and t.$columnName >= #{$javaField}</if>
|
||||||
#elseif($queryType == "LT")
|
#elseif($queryType == "LT")
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if>
|
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and t.$columnName < #{$javaField}</if>
|
||||||
#elseif($queryType == "LTE")
|
#elseif($queryType == "LTE")
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if>
|
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and t.$columnName <= #{$javaField}</if>
|
||||||
#elseif($queryType == "LIKE")
|
#elseif($queryType == "LIKE")
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
|
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and t.$columnName like concat('%', #{$javaField}, '%')</if>
|
||||||
#elseif($queryType == "BETWEEN")
|
#elseif($queryType == "BETWEEN")
|
||||||
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
|
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and t.$columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
@ -67,14 +82,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="select${ClassName}ById" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
|
<select id="select${ClassName}ById" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
|
||||||
#if($table.crud)
|
#if($table.crud)
|
||||||
<include refid="select${ClassName}Vo"/>
|
<include refid="select${ClassName}Vo"/>
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
where t.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
select#foreach($column in $columns) t.$column.columnName,#end p.${tree_name} as parent_name
|
select#foreach($column in $mappercols) t.$column.columnName,#end p.${tree_name} as parent_name
|
||||||
from ${tableName} t
|
from ${tableName} t
|
||||||
left join ${tableName} p on p.${pkColumn.columnName} = t.${tree_parent_code}
|
left join ${tableName} p on p.${pkColumn.columnName} = t.${tree_parent_code}
|
||||||
where t.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
where t.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||||
#elseif($table.sub)
|
#elseif($table.sub)
|
||||||
select#foreach($column in $columns) a.$column.columnName#if($velocityCount != $columns.size()),#end#end,
|
select#foreach($column in $mappercols) a.$column.columnName#if($velocityCount != $mappercols.size()),#end#end,
|
||||||
#foreach($column in $subTable.columns) b.$column.columnName#if($velocityCount != $subTable.columns.size()),#end#end
|
#foreach($column in $subTable.columns) b.$column.columnName#if($velocityCount != $subTable.columns.size()),#end#end
|
||||||
|
|
||||||
from ${tableName} a
|
from ${tableName} a
|
||||||
|
|
@ -83,17 +98,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#end
|
#end
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
#if($dspRepeatColumn.size() > 0)
|
||||||
|
<select id="select${ClassName}ByName" parameterType="String" resultMap="${ClassName}Result">
|
||||||
|
#if($table.crud)
|
||||||
|
<include refid="select t.${pkColumn.columnName} from ${tableName} t"/>
|
||||||
|
where t.${pkColumn.columnName} <> #{${pkColumn.javaField}}
|
||||||
|
and t.${dspRepeatColumn.columnName} = #{${dspRepeatColumn.javaField}}
|
||||||
|
#end
|
||||||
|
</select>
|
||||||
|
#end
|
||||||
|
|
||||||
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
||||||
insert into ${tableName}
|
insert into ${tableName}
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
#foreach($column in $columns)
|
#foreach($column in $mappercols)
|
||||||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
|
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
#foreach($column in $columns)
|
#foreach($column in $mappercols)
|
||||||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
|
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
|
||||||
#end
|
#end
|
||||||
|
|
@ -104,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="update${ClassName}" parameterType="${ClassName}">
|
<update id="update${ClassName}" parameterType="${ClassName}">
|
||||||
update ${tableName}
|
update ${tableName}
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
#foreach($column in $columns)
|
#foreach($column in $mappercols)
|
||||||
#if($column.columnName != $pkColumn.columnName)
|
#if($column.columnName != $pkColumn.columnName)
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
|
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,13 @@ public interface RelevTableMapper
|
||||||
*/
|
*/
|
||||||
public RelevTable selectRelevTableByRelevEntity(String relevEntity);
|
public RelevTable selectRelevTableByRelevEntity(String relevEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关联实体维护列表 所有数据
|
||||||
|
*
|
||||||
|
* @return 关联实体维护集合
|
||||||
|
*/
|
||||||
|
public List<RelevTable> selectRelevTableAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询关联实体维护列表
|
* 查询关联实体维护列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,15 @@ public class RelevTableServiceImpl implements IRelevTableService
|
||||||
{
|
{
|
||||||
return relevTableMapper.selectRelevTableByRelevEntity(relevEntity);
|
return relevTableMapper.selectRelevTableByRelevEntity(relevEntity);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 查询关联实体维护列表
|
||||||
|
*
|
||||||
|
* @return 关联实体维护
|
||||||
|
*/
|
||||||
|
public List<RelevTable> selectRelevTableAll()
|
||||||
|
{
|
||||||
|
return relevTableMapper.selectRelevTableAll();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询关联实体维护列表
|
* 查询关联实体维护列表
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select relev_id, relev_name, relev_entity, relev_entity_id, relev_entity_name, is_default_value, relev_table, relev_table_id, relev_table_name, create_by, create_time, update_by, update_time from sys_relev_table
|
select relev_id, relev_name, relev_entity, relev_entity_id, relev_entity_name, is_default_value, relev_table, relev_table_id, relev_table_name, create_by, create_time, update_by, update_time from sys_relev_table
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectRelevTableAll" parameterType="String" resultMap="RelevTableResult">
|
||||||
|
<include refid="selectRelevTableVo"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectRelevTableList" parameterType="RelevTable" resultMap="RelevTableResult">
|
<select id="selectRelevTableList" parameterType="RelevTable" resultMap="RelevTableResult">
|
||||||
<include refid="selectRelevTableVo"/>
|
<include refid="selectRelevTableVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue