Commit 6883721a477f678f8ed815619229c5ec78f9703f
1 parent
9678e67d
修复代码生成器的一些bug
Showing
46 changed files
with
391 additions
and
81 deletions
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... | ... | @@ -52,7 +52,7 @@ public class ${entityName} implements Serializable { |
52 | 52 | <#if po.fieldName == primaryKeyField> |
53 | 53 | @TableId(type = IdType.ASSIGN_ID) |
54 | 54 | <#else> |
55 | - <#if po.fieldDbType =='Date'> | |
55 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
56 | 56 | <#if po.classType=='date'> |
57 | 57 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
58 | 58 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... | ... | @@ -47,7 +47,7 @@ public class ${entityName} implements Serializable { |
47 | 47 | <#if po.fieldName == primaryKeyField> |
48 | 48 | @TableId(type = IdType.ASSIGN_ID) |
49 | 49 | <#else> |
50 | - <#if po.fieldDbType =='Date'> | |
50 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
51 | 51 | <#if po.classType=='date'> |
52 | 52 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
53 | 53 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... | ... | @@ -48,7 +48,7 @@ public class ${subTab.entityName} implements Serializable { |
48 | 48 | <#if po.fieldName == primaryKeyField> |
49 | 49 | @TableId(type = IdType.ASSIGN_ID) |
50 | 50 | <#else> |
51 | - <#if po.fieldDbType =='Date'> | |
51 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
52 | 52 | <#if po.classType=='date'> |
53 | 53 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
54 | 54 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/onetomany/java/${bussiPackage}/${entityPackage}/vo/${entityName}Page.javai
... | ... | @@ -44,7 +44,7 @@ public class ${entityName}Page { |
44 | 44 | /**${po.filedComment}*/ |
45 | 45 | <#if po.fieldName == primaryKeyField> |
46 | 46 | <#else> |
47 | - <#if po.fieldDbType =='Date'> | |
47 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
48 | 48 | <#if po.classType=='date'> |
49 | 49 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
50 | 50 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
... | ... | @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; |
12 | 12 | import org.jeecg.common.api.vo.Result; |
13 | 13 | import org.jeecg.common.system.query.QueryGenerator; |
14 | 14 | import org.jeecg.common.util.oConvertUtils; |
15 | +import org.jeecg.common.system.vo.SelectTreeModel; | |
15 | 16 | import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
16 | 17 | import ${bussiPackage}.${entityPackage}.service.I${entityName}Service; |
17 | 18 | |
... | ... | @@ -55,7 +56,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; |
55 | 56 | public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service>{ |
56 | 57 | @Autowired |
57 | 58 | private I${entityName}Service ${entityName?uncap_first}Service; |
58 | - | |
59 | + | |
59 | 60 | /** |
60 | 61 | * 分页列表查询 |
61 | 62 | * |
... | ... | @@ -95,6 +96,67 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e |
95 | 96 | } |
96 | 97 | |
97 | 98 | /** |
99 | + * 【vue3专用】加载节点的子数据 | |
100 | + * | |
101 | + * @param pid | |
102 | + * @return | |
103 | + */ | |
104 | + @RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET) | |
105 | + public Result<List<SelectTreeModel>> loadTreeChildren(@RequestParam(name = "pid") String pid) { | |
106 | + Result<List<SelectTreeModel>> result = new Result<>(); | |
107 | + try { | |
108 | + List<SelectTreeModel> ls = ${entityName?uncap_first}Service.queryListByPid(pid); | |
109 | + result.setResult(ls); | |
110 | + result.setSuccess(true); | |
111 | + } catch (Exception e) { | |
112 | + e.printStackTrace(); | |
113 | + result.setMessage(e.getMessage()); | |
114 | + result.setSuccess(false); | |
115 | + } | |
116 | + return result; | |
117 | + } | |
118 | + | |
119 | + /** | |
120 | + * 【vue3专用】加载一级节点/如果是同步 则所有数据 | |
121 | + * | |
122 | + * @param async | |
123 | + * @param pcode | |
124 | + * @return | |
125 | + */ | |
126 | + @RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET) | |
127 | + public Result<List<SelectTreeModel>> loadTreeRoot(@RequestParam(name = "async") Boolean async, @RequestParam(name = "pcode") String pcode) { | |
128 | + Result<List<SelectTreeModel>> result = new Result<>(); | |
129 | + try { | |
130 | + List<SelectTreeModel> ls = ${entityName?uncap_first}Service.queryListByCode(pcode); | |
131 | + if (!async) { | |
132 | + loadAllChildren(ls); | |
133 | + } | |
134 | + result.setResult(ls); | |
135 | + result.setSuccess(true); | |
136 | + } catch (Exception e) { | |
137 | + e.printStackTrace(); | |
138 | + result.setMessage(e.getMessage()); | |
139 | + result.setSuccess(false); | |
140 | + } | |
141 | + return result; | |
142 | + } | |
143 | + | |
144 | + /** | |
145 | + * 【vue3专用】递归求子节点 同步加载用到 | |
146 | + * | |
147 | + * @param ls | |
148 | + */ | |
149 | + private void loadAllChildren(List<SelectTreeModel> ls) { | |
150 | + for (SelectTreeModel tsm : ls) { | |
151 | + List<SelectTreeModel> temp = ${entityName?uncap_first}Service.queryListByPid(tsm.getKey()); | |
152 | + if (temp != null && temp.size() > 0) { | |
153 | + tsm.setChildren(temp); | |
154 | + loadAllChildren(temp); | |
155 | + } | |
156 | + } | |
157 | + } | |
158 | + | |
159 | + /** | |
98 | 160 | * 获取子数据 |
99 | 161 | * @param ${entityName?uncap_first} |
100 | 162 | * @param req |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... | ... | @@ -48,7 +48,7 @@ public class ${entityName} implements Serializable { |
48 | 48 | <#if po.fieldName == primaryKeyField> |
49 | 49 | @TableId(type = IdType.ASSIGN_ID) |
50 | 50 | <#else> |
51 | - <#if po.fieldDbType =='Date'> | |
51 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
52 | 52 | <#if po.classType=='date'> |
53 | 53 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
54 | 54 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/mapper/${entityName}Mapper.javai
1 | 1 | package ${bussiPackage}.${entityPackage}.mapper; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
3 | 4 | import org.apache.ibatis.annotations.Param; |
5 | +import org.jeecg.common.system.vo.SelectTreeModel; | |
4 | 6 | import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
5 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
7 | + | |
8 | +import java.util.List; | |
9 | +import java.util.Map; | |
6 | 10 | |
7 | 11 | /** |
8 | 12 | * @Description: ${tableVo.ftlDescription} |
... | ... | @@ -19,4 +23,13 @@ public interface ${entityName}Mapper extends BaseMapper<${entityName}> { |
19 | 23 | */ |
20 | 24 | void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status); |
21 | 25 | |
26 | + /** | |
27 | + * 【vue3专用】根据父级ID查询树节点数据 | |
28 | + * | |
29 | + * @param pid | |
30 | + * @param query | |
31 | + * @return | |
32 | + */ | |
33 | + List<SelectTreeModel> queryListByPid(@Param("pid") String pid, @Param("query") Map<String, String> query); | |
34 | + | |
22 | 35 | } |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/mapper/xml/${entityName}Mapper.xml
1 | 1 | <#assign hasChildrenField = ""> |
2 | +<#assign pidFieldName = ""> | |
3 | +<#assign textFieldName = ""> | |
2 | 4 | <#list originalColumns as po> |
3 | -<#if po.fieldDbName == tableVo.extendParams.hasChildren> | |
4 | -<#assign hasChildrenField = po.fieldName> | |
5 | -</#if> | |
5 | + <#if po.fieldDbName == tableVo.extendParams.hasChildren> | |
6 | + <#assign hasChildrenField = po.fieldName> | |
7 | + </#if> | |
8 | + <#-- begin 【vue3专用】 --> | |
9 | + <#if po.fieldDbName == tableVo.extendParams.pidField> | |
10 | + <#assign pidFieldName = po.fieldName> | |
11 | + </#if> | |
12 | + <#if po.fieldDbName == tableVo.extendParams.textField> | |
13 | + <#assign textFieldName = po.fieldName> | |
14 | + </#if> | |
15 | + <#-- end 【vue3专用】 --> | |
6 | 16 | </#list> |
7 | 17 | <?xml version="1.0" encoding="UTF-8"?> |
8 | 18 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
... | ... | @@ -12,4 +22,20 @@ |
12 | 22 | update ${tableName} set ${Format.humpToUnderline(hasChildrenField)} = ${r'#'}{status} where id = ${r'#'}{id} |
13 | 23 | </update> |
14 | 24 | |
25 | + <!-- 【vue3专用】 --> | |
26 | + <select id="queryListByPid" parameterType="java.lang.Object" resultType="org.jeecg.common.system.vo.SelectTreeModel"> | |
27 | + select | |
28 | + id as "key", | |
29 | + ${textFieldName} as "title", | |
30 | + (case when ${Format.humpToUnderline(hasChildrenField)} = '1' then 0 else 1 end) as isLeaf, | |
31 | + ${pidFieldName} as parentId | |
32 | + from ${tableName} | |
33 | + where ${pidFieldName} = ${r'#'}{pid} | |
34 | + <if test="query != null"> | |
35 | + <foreach collection="query.entrySet()" item="value" index="key"> | |
36 | + and ${r'$'}{key} = ${r'#'}{value} | |
37 | + </foreach> | |
38 | + </if> | |
39 | + </select> | |
40 | + | |
15 | 41 | </mapper> |
16 | 42 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai
1 | 1 | package ${bussiPackage}.${entityPackage}.service; |
2 | 2 | |
3 | +import org.jeecg.common.system.vo.SelectTreeModel; | |
3 | 4 | import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | 6 | import org.jeecg.common.exception.JeecgBootException; |
... | ... | @@ -23,16 +24,51 @@ public interface I${entityName}Service extends IService<${entityName}> { |
23 | 24 | /**树节点无子节点状态值*/ |
24 | 25 | public static final String NOCHILD = "0"; |
25 | 26 | |
26 | - /**新增节点*/ | |
27 | + /** | |
28 | + * 新增节点 | |
29 | + * | |
30 | + * @param ${entityName?uncap_first} | |
31 | + */ | |
27 | 32 | void add${entityName}(${entityName} ${entityName?uncap_first}); |
28 | 33 | |
29 | - /**修改节点*/ | |
34 | + /** | |
35 | + * 修改节点 | |
36 | + * | |
37 | + * @param ${entityName?uncap_first} | |
38 | + * @throws JeecgBootException | |
39 | + */ | |
30 | 40 | void update${entityName}(${entityName} ${entityName?uncap_first}) throws JeecgBootException; |
31 | 41 | |
32 | - /**删除节点*/ | |
42 | + /** | |
43 | + * 删除节点 | |
44 | + * | |
45 | + * @param id | |
46 | + * @throws JeecgBootException | |
47 | + */ | |
33 | 48 | void delete${entityName}(String id) throws JeecgBootException; |
34 | 49 | |
35 | - /**查询所有数据,无分页*/ | |
50 | + /** | |
51 | + * 查询所有数据,无分页 | |
52 | + * | |
53 | + * @param queryWrapper | |
54 | + * @return List<${entityName}> | |
55 | + */ | |
36 | 56 | List<${entityName}> queryTreeListNoPage(QueryWrapper<${entityName}> queryWrapper); |
37 | 57 | |
58 | + /** | |
59 | + * 【vue3专用】根据父级编码加载分类字典的数据 | |
60 | + * | |
61 | + * @param parentCode | |
62 | + * @return | |
63 | + */ | |
64 | + List<SelectTreeModel> queryListByCode(String parentCode); | |
65 | + | |
66 | + /** | |
67 | + * 【vue3专用】根据pid查询子节点集合 | |
68 | + * | |
69 | + * @param pid | |
70 | + * @return | |
71 | + */ | |
72 | + List<SelectTreeModel> queryListByPid(String pid); | |
73 | + | |
38 | 74 | } |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/service/impl/${entityName}ServiceImpl.javai
1 | 1 | package ${bussiPackage}.${entityPackage}.service.impl; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
3 | 4 | import org.jeecg.common.exception.JeecgBootException; |
4 | 5 | import org.jeecg.common.util.oConvertUtils; |
6 | +import org.jeecg.common.system.vo.SelectTreeModel; | |
5 | 7 | import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
6 | 8 | import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper; |
7 | 9 | import ${bussiPackage}.${entityPackage}.service.I${entityName}Service; |
... | ... | @@ -84,8 +86,8 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ |
84 | 86 | String pidVal = ${entityName?uncap_first}.get${pidFieldName?cap_first}(); |
85 | 87 | //查询此节点上一级是否还有其他子节点 |
86 | 88 | List<${entityName}> dataList = baseMapper.selectList(new QueryWrapper<${entityName}>().eq("${tableVo.extendParams.pidField}", pidVal).notIn("id",Arrays.asList(idArr))); |
87 | - if((dataList == null || dataList.size()==0) && !Arrays.asList(idArr).contains(pidVal) | |
88 | - && !sb.toString().contains(pidVal)){ | |
89 | + boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(pidVal) && !sb.toString().contains(pidVal); | |
90 | + if(flag){ | |
89 | 91 | //如果当前节点原本有子节点 现在木有了,更新状态 |
90 | 92 | sb.append(pidVal).append(","); |
91 | 93 | } |
... | ... | @@ -115,7 +117,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ |
115 | 117 | for(${entityName} data : dataList){ |
116 | 118 | String pidVal = data.get${pidFieldName?cap_first}(); |
117 | 119 | //递归查询子节点的根节点 |
118 | - if(pidVal != null && !"0".equals(pidVal)){ | |
120 | + if(pidVal != null && !I${entityName}Service.NOCHILD.equals(pidVal)){ | |
119 | 121 | ${entityName} rootVal = this.getTreeRoot(pidVal); |
120 | 122 | if(rootVal != null && !mapList.contains(rootVal)){ |
121 | 123 | mapList.add(rootVal); |
... | ... | @@ -128,7 +130,33 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ |
128 | 130 | } |
129 | 131 | return mapList; |
130 | 132 | } |
131 | - | |
133 | + | |
134 | + @Override | |
135 | + public List<SelectTreeModel> queryListByCode(String parentCode) { | |
136 | + String pid = ROOT_PID_VALUE; | |
137 | + if (oConvertUtils.isNotEmpty(parentCode)) { | |
138 | + LambdaQueryWrapper<${entityName}> queryWrapper = new LambdaQueryWrapper<>(); | |
139 | + queryWrapper.eq(${entityName}::get${pidFieldName?cap_first}, parentCode); | |
140 | + List<${entityName}> list = baseMapper.selectList(queryWrapper); | |
141 | + if (list == null || list.size() == 0) { | |
142 | + throw new JeecgBootException("该编码【" + parentCode + "】不存在,请核实!"); | |
143 | + } | |
144 | + if (list.size() > 1) { | |
145 | + throw new JeecgBootException("该编码【" + parentCode + "】存在多个,请核实!"); | |
146 | + } | |
147 | + pid = list.get(0).getId(); | |
148 | + } | |
149 | + return baseMapper.queryListByPid(pid, null); | |
150 | + } | |
151 | + | |
152 | + @Override | |
153 | + public List<SelectTreeModel> queryListByPid(String pid) { | |
154 | + if (oConvertUtils.isEmpty(pid)) { | |
155 | + pid = ROOT_PID_VALUE; | |
156 | + } | |
157 | + return baseMapper.queryListByPid(pid, null); | |
158 | + } | |
159 | + | |
132 | 160 | /** |
133 | 161 | * 根据所传pid查询旧的父级节点的子节点并修改相应状态值 |
134 | 162 | * @param pid |
... | ... | @@ -149,7 +177,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ |
149 | 177 | */ |
150 | 178 | private ${entityName} getTreeRoot(String pidVal){ |
151 | 179 | ${entityName} data = baseMapper.selectById(pidVal); |
152 | - if(data != null && !"0".equals(data.get${pidFieldName?cap_first}())){ | |
180 | + if(data != null && !I${entityName}Service.ROOT_PID_VALUE.equals(data.get${pidFieldName?cap_first}())){ | |
153 | 181 | return this.getTreeRoot(data.get${pidFieldName?cap_first}()); |
154 | 182 | }else{ |
155 | 183 | return data; |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei
1 | +<#assign pidFieldName = ""> | |
2 | +<#assign hasChildrenField = ""> | |
3 | +<#list originalColumns as po> | |
4 | + <#if po.fieldDbName == tableVo.extendParams.pidField> | |
5 | + <#assign pidFieldName = po.fieldName> | |
6 | + </#if> | |
7 | + <#if po.fieldDbName == tableVo.extendParams.hasChildren> | |
8 | + <#assign hasChildrenField = po.fieldName> | |
9 | + </#if> | |
10 | +</#list> | |
1 | 11 | <template> |
2 | 12 | <div class="p-4"> |
3 | 13 | <!--引用表格--> |
... | ... | @@ -35,8 +45,8 @@ |
35 | 45 | <script lang="ts" name="${entityPackage}-${entityName?uncap_first}" setup> |
36 | 46 | //ts语法 |
37 | 47 | import {ref, computed, unref, toRaw, nextTick} from 'vue'; |
38 | - import {BasicTable, useTable, TableAction} from '/src/components/Table'; | |
39 | - import {useModal} from '/src/components/Modal'; | |
48 | + import {BasicTable, TableAction} from '/@/components/Table'; | |
49 | + import {useModal} from '/@/components/Modal'; | |
40 | 50 | import { useListPage } from '/@/hooks/system/useListPage' |
41 | 51 | import ${entityName}Modal from './components/${entityName}Modal.vue'; |
42 | 52 | import {columns} from './${entityName}.data'; |
... | ... | @@ -48,12 +58,13 @@ |
48 | 58 | //注册table数据 |
49 | 59 | const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ |
50 | 60 | tableProps:{ |
61 | + api: list, | |
51 | 62 | title: '${tableVo.ftlDescription}', |
52 | 63 | columns, |
53 | 64 | canResize:false, |
54 | 65 | actionColumn: { |
55 | - width: 120, | |
56 | - }, | |
66 | + width: 240, | |
67 | + }, | |
57 | 68 | }, |
58 | 69 | exportConfig: { |
59 | 70 | name:"${tableVo.ftlDescription}", |
... | ... | @@ -134,7 +145,7 @@ |
134 | 145 | //编辑回调 |
135 | 146 | updateTableDataRecord(values.id, values); |
136 | 147 | } else { |
137 | - if(!values['pid']){ | |
148 | + if(!values['${pidFieldName}']){ | |
138 | 149 | //新增根节点 |
139 | 150 | reload(); |
140 | 151 | }else{ |
... | ... | @@ -164,7 +175,7 @@ |
164 | 175 | let records = res.result.records |
165 | 176 | const listMap = new Map(); |
166 | 177 | for (let item of records) { |
167 | - let pid = item['pid']; | |
178 | + let pid = item['${pidFieldName}']; | |
168 | 179 | if (unref(expandedRowKeys).includes(pid)) { |
169 | 180 | let mapList = listMap.get(pid); |
170 | 181 | if (mapList == null) { |
... | ... | @@ -212,7 +223,7 @@ |
212 | 223 | if (expanded) { |
213 | 224 | expandedRowKeys.value.push(record.id) |
214 | 225 | if (record.children.length > 0 && !!record.children[0].isLoading) { |
215 | - let result = await getChildList({pid: record.id}); | |
226 | + let result = await getChildList({${pidFieldName}: record.id}); | |
216 | 227 | result=result.records?result.records:result; |
217 | 228 | if (result && result.length > 0) { |
218 | 229 | record.children = getDataByResult(result); |
... | ... | @@ -234,7 +245,7 @@ |
234 | 245 | async function expandTreeNode(key) { |
235 | 246 | let record = findTableDataRecord(key) |
236 | 247 | expandedRowKeys.value.push(key); |
237 | - let result = await getChildList({pid: key}); | |
248 | + let result = await getChildList({${pidFieldName}: key}); | |
238 | 249 | if (result && result.length > 0) { |
239 | 250 | record.children = getDataByResult(result); |
240 | 251 | } else { |
... | ... | @@ -261,7 +272,7 @@ |
261 | 272 | }, |
262 | 273 | { |
263 | 274 | label: '添加下级', |
264 | - onClick: handleAddSub.bind(null, {pid: record.id}), | |
275 | + onClick: handleAddSub.bind(null, {${pidFieldName}: record.id}), | |
265 | 276 | } |
266 | 277 | ] |
267 | 278 | } |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__api.tsi
... | ... | @@ -5,7 +5,7 @@ enum Api { |
5 | 5 | list = '/${entityPackage}/${entityName?uncap_first}/rootList', |
6 | 6 | save='/${entityPackage}/${entityName?uncap_first}/add', |
7 | 7 | edit='/${entityPackage}/${entityName?uncap_first}/edit', |
8 | - delete${entityName} = '/sys/${entityName?uncap_first}/delete', | |
8 | + delete${entityName} = '/${entityPackage}/${entityName?uncap_first}/delete', | |
9 | 9 | deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch', |
10 | 10 | importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel', |
11 | 11 | exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls', |
... | ... | @@ -13,6 +13,7 @@ enum Api { |
13 | 13 | getChildList = '/${entityPackage}/${entityName?uncap_first}/childList', |
14 | 14 | getChildListBatch = '/${entityPackage}/${entityName?uncap_first}/getChildListBatch', |
15 | 15 | } |
16 | + | |
16 | 17 | /** |
17 | 18 | * 导出api |
18 | 19 | * @param params |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3/${entityName}__data.tsi
... | ... | @@ -8,7 +8,11 @@ export const columns: BasicColumn[] = [ |
8 | 8 | <#if po.isShowList =='Y' && po.fieldName !='id'> |
9 | 9 | { |
10 | 10 | title: '${po.filedComment}', |
11 | - align:"center", | |
11 | + <#if po.fieldDbName == tableVo.extendParams.textField> | |
12 | + align: 'left', | |
13 | + <#else> | |
14 | + align: 'center', | |
15 | + </#if> | |
12 | 16 | <#if po.sort=='Y'> |
13 | 17 | sorter: true, |
14 | 18 | </#if> |
... | ... | @@ -277,13 +281,15 @@ export const formSchema: FormSchema[] = [ |
277 | 281 | component: 'JTreeSelect', |
278 | 282 | componentProps:{ |
279 | 283 | <#if po.dictText??> |
280 | - <#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??> | |
284 | + <#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??> | |
281 | 285 | dict:"${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}", |
282 | - <#elseif po.dictText?split(',')[1]??> | |
286 | + </#if> | |
287 | + <#if po.dictText?split(',')[1]??> | |
283 | 288 | pidField:"${po.dictText?split(',')[1]}", |
284 | - <#elseif po.dictText?split(',')[3]??> | |
289 | + </#if> | |
290 | + <#if po.dictText?split(',')[3]??> | |
285 | 291 | hasChildField:"${po.dictText?split(',')[3]}", |
286 | - </#if> | |
292 | + </#if> | |
287 | 293 | </#if> |
288 | 294 | pidValue:"${po.dictField}", |
289 | 295 | }, |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/default/tree/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei
1 | +<#assign pidFieldName = ""> | |
2 | +<#assign hasChildrenField = ""> | |
3 | +<#list originalColumns as po> | |
4 | + <#if po.fieldDbName == tableVo.extendParams.pidField> | |
5 | + <#assign pidFieldName = po.fieldName> | |
6 | + </#if> | |
7 | + <#if po.fieldDbName == tableVo.extendParams.hasChildren> | |
8 | + <#assign hasChildrenField = po.fieldName> | |
9 | + </#if> | |
10 | +</#list> | |
1 | 11 | <template> |
2 | 12 | <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |
3 | 13 | <BasicForm @register="registerForm"/> |
... | ... | @@ -5,8 +15,8 @@ |
5 | 15 | </template> |
6 | 16 | <script lang="ts" setup> |
7 | 17 | import {ref, computed, unref} from 'vue'; |
8 | - import {BasicModal, useModalInner} from '/src/components/Modal'; | |
9 | - import {BasicForm, useForm} from '/src/components/Form'; | |
18 | + import {BasicModal, useModalInner} from '/@/components/Modal'; | |
19 | + import {BasicForm, useForm} from '/@/components/Form'; | |
10 | 20 | import {formSchema} from '../${entityName}.data'; |
11 | 21 | import {loadTreeData, saveOrUpdateDict} from '../${entityName}.api'; |
12 | 22 | // 获取emit |
... | ... | @@ -42,13 +52,9 @@ |
42 | 52 | } |
43 | 53 | //父级节点树信息 |
44 | 54 | treeData.value = await loadTreeData({'async': false,'pcode':''}); |
45 | - updateSchema({ | |
46 | - field: 'pid', | |
47 | - componentProps: {treeData}, | |
48 | - }); | |
49 | 55 | }); |
50 | 56 | //设置标题 |
51 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增字典' : '编辑字典')); | |
57 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |
52 | 58 | |
53 | 59 | /** |
54 | 60 | * 根据pid获取展开的节点 |
... | ... | @@ -77,7 +83,7 @@ |
77 | 83 | //关闭弹窗 |
78 | 84 | closeModal(); |
79 | 85 | //展开的节点信息 |
80 | - await getExpandKeysByPid(values['pid'],unref(treeData)) | |
86 | + await getExpandKeysByPid(values['${pidFieldName}'],unref(treeData)) | |
81 | 87 | //刷新列表(isUpdate:是否编辑;values:表单信息;expandedArr:展开的节点信息) |
82 | 88 | emit('success', {isUpdate: unref(isUpdate), values:{...values},expandedArr: unref(expandedRowKeys).reverse()}); |
83 | 89 | } finally { |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
... | ... | @@ -251,7 +251,8 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e |
251 | 251 | |
252 | 252 | // Step.3 AutoPoi 导出Excel |
253 | 253 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
254 | - mv.addObject(NormalExcelConstants.FILE_NAME, "${sub.ftlDescription}"); //此处设置的filename无效 ,前端会重更新设置一下 | |
254 | + //此处设置的filename无效,前端会重更新设置一下 | |
255 | + mv.addObject(NormalExcelConstants.FILE_NAME, "${sub.ftlDescription}"); | |
255 | 256 | mv.addObject(NormalExcelConstants.CLASS, ${sub.entityName}.class); |
256 | 257 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${sub.ftlDescription}报表", "导出人:" + sysUser.getRealname(), "${sub.ftlDescription}")); |
257 | 258 | mv.addObject(NormalExcelConstants.DATA_LIST, exportList); |
... | ... | @@ -267,7 +268,8 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e |
267 | 268 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
268 | 269 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
269 | 270 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
270 | - MultipartFile file = entity.getValue();// 获取上传文件对象 | |
271 | + // 获取上传文件对象 | |
272 | + MultipartFile file = entity.getValue(); | |
271 | 273 | ImportParams params = new ImportParams(); |
272 | 274 | params.setTitleRows(2); |
273 | 275 | params.setHeadRows(1); |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... | ... | @@ -47,7 +47,7 @@ public class ${entityName} implements Serializable { |
47 | 47 | <#if po.fieldName == primaryKeyField> |
48 | 48 | @TableId(type = IdType.ASSIGN_ID) |
49 | 49 | <#else> |
50 | - <#if po.fieldDbType =='Date'> | |
50 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
51 | 51 | <#if po.classType=='date'> |
52 | 52 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
53 | 53 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... | ... | @@ -34,7 +34,7 @@ public class ${subTab.entityName} implements Serializable { |
34 | 34 | <#if po.fieldName == primaryKeyField> |
35 | 35 | @TableId(type = IdType.ASSIGN_ID) |
36 | 36 | <#else> |
37 | - <#if po.fieldDbType =='Date'> | |
37 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
38 | 38 | <#if po.classType=='date'> |
39 | 39 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
40 | 40 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/mapper/[1-n]Mapper.javai
... | ... | @@ -15,8 +15,20 @@ import org.apache.ibatis.annotations.Param; |
15 | 15 | */ |
16 | 16 | public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> { |
17 | 17 | |
18 | + /** | |
19 | + * 通过主表id删除子表数据 | |
20 | + * | |
21 | + * @param mainId 主表id | |
22 | + * @return boolean | |
23 | + */ | |
18 | 24 | public boolean deleteByMainId(@Param("mainId") String mainId); |
19 | - | |
25 | + | |
26 | + /** | |
27 | + * 通过主表id查询子表数据 | |
28 | + * | |
29 | + * @param mainId 主表id | |
30 | + * @return List<${subTab.entityName}> | |
31 | + */ | |
20 | 32 | public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId); |
21 | 33 | |
22 | 34 | } |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai
... | ... | @@ -20,11 +20,15 @@ public interface I${entityName}Service extends IService<${entityName}> { |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * 删除一对多 |
23 | + * | |
24 | + * @param id | |
23 | 25 | */ |
24 | 26 | public void delMain (String id); |
25 | 27 | |
26 | 28 | /** |
27 | 29 | * 批量删除一对多 |
30 | + * | |
31 | + * @param idList | |
28 | 32 | */ |
29 | 33 | public void delBatchMain (Collection<? extends Serializable> idList); |
30 | 34 | |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/service/[1-n]Service.javai
... | ... | @@ -14,6 +14,12 @@ import java.util.List; |
14 | 14 | */ |
15 | 15 | public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> { |
16 | 16 | |
17 | + /** | |
18 | + * 通过主表id查询子表数据 | |
19 | + * | |
20 | + * @param mainId | |
21 | + * @return List<${subTab.entityName}> | |
22 | + */ | |
17 | 23 | public List<${subTab.entityName}> selectByMainId(String mainId); |
18 | 24 | } |
19 | 25 | </#list> |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue/${entityName}List.vuei
... | ... | @@ -193,7 +193,7 @@ |
193 | 193 | <#assign sub_seq=1> |
194 | 194 | <#list subTables as sub> |
195 | 195 | <a-tab-pane tab="${sub.ftlDescription}" key="${sub_seq}" <#if sub_seq gt 1>forceRender</#if>> |
196 | - <${sub.entityName}List :mainId="${sub.entityName?uncap_first}MainId" /> | |
196 | + <${sub.entityName}List :mainId="selectedMainId" /> | |
197 | 197 | </a-tab-pane> |
198 | 198 | <#assign sub_seq=sub_seq+1> |
199 | 199 | </#list> |
... | ... | @@ -340,7 +340,7 @@ |
340 | 340 | selectedMainId:'', |
341 | 341 | superFieldList:[], |
342 | 342 | <#list subTables as sub> |
343 | - <#if sub != null> | |
343 | + <#if sub?? && (sub.foreignMainKeys)??> | |
344 | 344 | <#list sub.foreignMainKeys as key> |
345 | 345 | <#assign subMainFieldMap += {"${sub.entityName?uncap_first}MainId": "${dashedToCamel(key)}"}> |
346 | 346 | </#list> |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
... | ... | @@ -245,7 +245,8 @@ public class ${entityName}Controller { |
245 | 245 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
246 | 246 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
247 | 247 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
248 | - MultipartFile file = entity.getValue();// 获取上传文件对象 | |
248 | + // 获取上传文件对象 | |
249 | + MultipartFile file = entity.getValue(); | |
249 | 250 | ImportParams params = new ImportParams(); |
250 | 251 | params.setTitleRows(2); |
251 | 252 | params.setHeadRows(1); |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... | ... | @@ -47,7 +47,7 @@ public class ${entityName} implements Serializable { |
47 | 47 | <#if po.fieldName == primaryKeyField> |
48 | 48 | @TableId(type = IdType.ASSIGN_ID) |
49 | 49 | <#else> |
50 | - <#if po.fieldDbType =='Date'> | |
50 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
51 | 51 | <#if po.classType=='date'> |
52 | 52 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
53 | 53 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... | ... | @@ -49,7 +49,7 @@ public class ${subTab.entityName} implements Serializable { |
49 | 49 | <#if po.fieldName == primaryKeyField> |
50 | 50 | @TableId(type = IdType.ASSIGN_ID) |
51 | 51 | <#else> |
52 | - <#if po.fieldDbType =='Date'> | |
52 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
53 | 53 | <#if po.classType=='date'> |
54 | 54 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
55 | 55 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/mapper/[1-n]Mapper.javai
... | ... | @@ -15,8 +15,20 @@ import org.apache.ibatis.annotations.Param; |
15 | 15 | */ |
16 | 16 | public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> { |
17 | 17 | |
18 | + /** | |
19 | + * 通过主表id删除子表数据 | |
20 | + * | |
21 | + * @param mainId 主表id | |
22 | + * @return boolean | |
23 | + */ | |
18 | 24 | public boolean deleteByMainId(@Param("mainId") String mainId); |
19 | - | |
25 | + | |
26 | + /** | |
27 | + * 通过主表id查询子表数据 | |
28 | + * | |
29 | + * @param mainId 主表id | |
30 | + * @return List<${subTab.entityName}> | |
31 | + */ | |
20 | 32 | public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId); |
21 | 33 | } |
22 | 34 | </#list> |
23 | 35 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai
... | ... | @@ -19,23 +19,35 @@ public interface I${entityName}Service extends IService<${entityName}> { |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * 添加一对多 |
22 | - * | |
22 | + * | |
23 | + * @param ${entityName?uncap_first} | |
24 | + <#list subTables as sub> | |
25 | + * @param ${sub.entityName?uncap_first}List | |
26 | + </#list> | |
23 | 27 | */ |
24 | 28 | public void saveMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) ; |
25 | 29 | |
26 | 30 | /** |
27 | 31 | * 修改一对多 |
28 | - * | |
32 | + * | |
33 | + * @param ${entityName?uncap_first} | |
34 | + <#list subTables as sub> | |
35 | + * @param ${sub.entityName?uncap_first}List | |
36 | + </#list> | |
29 | 37 | */ |
30 | 38 | public void updateMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>); |
31 | 39 | |
32 | 40 | /** |
33 | 41 | * 删除一对多 |
42 | + * | |
43 | + * @param id | |
34 | 44 | */ |
35 | 45 | public void delMain (String id); |
36 | 46 | |
37 | 47 | /** |
38 | 48 | * 批量删除一对多 |
49 | + * | |
50 | + * @param idList | |
39 | 51 | */ |
40 | 52 | public void delBatchMain (Collection<? extends Serializable> idList); |
41 | 53 | |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/service/[1-n]Service.javai
... | ... | @@ -14,6 +14,12 @@ import java.util.List; |
14 | 14 | */ |
15 | 15 | public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> { |
16 | 16 | |
17 | + /** | |
18 | + * 通过主表id查询子表数据 | |
19 | + * | |
20 | + * @param mainId 主表id | |
21 | + * @return List<${subTab.entityName}> | |
22 | + */ | |
17 | 23 | public List<${subTab.entityName}> selectByMainId(String mainId); |
18 | 24 | } |
19 | 25 | </#list> |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vo/${entityName}Page.javai
... | ... | @@ -44,7 +44,7 @@ public class ${entityName}Page { |
44 | 44 | /**${po.filedComment}*/ |
45 | 45 | <#if po.fieldName == primaryKeyField> |
46 | 46 | <#else> |
47 | - <#if po.fieldDbType =='Date'> | |
47 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
48 | 48 | <#if po.classType=='date'> |
49 | 49 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
50 | 50 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei
... | ... | @@ -4,17 +4,18 @@ |
4 | 4 | <!-- 子表单区域 --> |
5 | 5 | <a-tabs v-model:activeKey="activeKey" @change="handleChangeTabs"> |
6 | 6 | <#list subTables as sub><#rt/> |
7 | + <#assign refKey = sub.entityName?uncap_first/> | |
7 | 8 | <#if sub.foreignRelationType =='1'> |
8 | - <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true"> | |
9 | + <a-tab-pane tab="${sub.ftlDescription}" key="${refKey}" :forceRender="true"> | |
9 | 10 | <${sub.entityName}Form ref="${sub.entityName?uncap_first}Form"></${sub.entityName}Form> |
10 | 11 | </a-tab-pane> |
11 | 12 | |
12 | 13 | <#else> |
13 | - <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true"> | |
14 | + <a-tab-pane tab="${sub.ftlDescription}" key="${refKey}" :forceRender="true"> | |
14 | 15 | <JVxeTable |
15 | 16 | keep-source |
16 | 17 | resizable |
17 | - :ref="refKeys[${sub_index}]" | |
18 | + ref="${refKey}" | |
18 | 19 | :loading="${sub.entityName?uncap_first}Table.loading" |
19 | 20 | :columns="${sub.entityName?uncap_first}Table.columns" |
20 | 21 | :dataSource="${sub.entityName?uncap_first}Table.dataSource" |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
... | ... | @@ -250,7 +250,8 @@ public class ${entityName}Controller { |
250 | 250 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
251 | 251 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
252 | 252 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
253 | - MultipartFile file = entity.getValue();// 获取上传文件对象 | |
253 | + // 获取上传文件对象 | |
254 | + MultipartFile file = entity.getValue(); | |
254 | 255 | ImportParams params = new ImportParams(); |
255 | 256 | params.setTitleRows(2); |
256 | 257 | params.setHeadRows(1); |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... | ... | @@ -47,7 +47,7 @@ public class ${entityName} implements Serializable { |
47 | 47 | <#if po.fieldName == primaryKeyField> |
48 | 48 | @TableId(type = IdType.ASSIGN_ID) |
49 | 49 | <#else> |
50 | - <#if po.fieldDbType =='Date'> | |
50 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
51 | 51 | <#if po.classType=='date'> |
52 | 52 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
53 | 53 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... | ... | @@ -48,7 +48,7 @@ public class ${subTab.entityName} implements Serializable { |
48 | 48 | <#if po.fieldName == primaryKeyField> |
49 | 49 | @TableId(type = IdType.ASSIGN_ID) |
50 | 50 | <#else> |
51 | - <#if po.fieldDbType =='Date'> | |
51 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
52 | 52 | <#if po.classType=='date'> |
53 | 53 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
54 | 54 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/mapper/[1-n]Mapper.javai
... | ... | @@ -15,8 +15,20 @@ import org.apache.ibatis.annotations.Param; |
15 | 15 | */ |
16 | 16 | public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> { |
17 | 17 | |
18 | + /** | |
19 | + * 通过主表id删除子表数据 | |
20 | + * | |
21 | + * @param mainId 主表id | |
22 | + * @return boolean | |
23 | + */ | |
18 | 24 | public boolean deleteByMainId(@Param("mainId") String mainId); |
19 | - | |
25 | + | |
26 | + /** | |
27 | + * 通过主表id查询子表数据 | |
28 | + * | |
29 | + * @param mainId 主表id | |
30 | + * @return List<${subTab.entityName}> | |
31 | + */ | |
20 | 32 | public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId); |
21 | 33 | } |
22 | 34 | </#list> |
23 | 35 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai
... | ... | @@ -19,23 +19,35 @@ public interface I${entityName}Service extends IService<${entityName}> { |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * 添加一对多 |
22 | - * | |
22 | + * | |
23 | + * @param ${entityName?uncap_first} | |
24 | + <#list subTables as sub> | |
25 | + * @param ${sub.entityName?uncap_first}List | |
26 | + </#list> | |
23 | 27 | */ |
24 | 28 | public void saveMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) ; |
25 | 29 | |
26 | 30 | /** |
27 | 31 | * 修改一对多 |
28 | - * | |
32 | + * | |
33 | + * @param ${entityName?uncap_first} | |
34 | + <#list subTables as sub> | |
35 | + * @param ${sub.entityName?uncap_first}List | |
36 | + </#list> | |
29 | 37 | */ |
30 | 38 | public void updateMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>); |
31 | 39 | |
32 | 40 | /** |
33 | 41 | * 删除一对多 |
42 | + * | |
43 | + * @param id | |
34 | 44 | */ |
35 | 45 | public void delMain (String id); |
36 | 46 | |
37 | 47 | /** |
38 | 48 | * 批量删除一对多 |
49 | + * | |
50 | + * @param idList | |
39 | 51 | */ |
40 | 52 | public void delBatchMain (Collection<? extends Serializable> idList); |
41 | 53 | |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/service/[1-n]Service.javai
... | ... | @@ -14,6 +14,12 @@ import java.util.List; |
14 | 14 | */ |
15 | 15 | public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> { |
16 | 16 | |
17 | + /** | |
18 | + * 通过主表id查询子表数据 | |
19 | + * | |
20 | + * @param mainId 主表id | |
21 | + * @return List<${subTab.entityName}> | |
22 | + */ | |
17 | 23 | public List<${subTab.entityName}> selectByMainId(String mainId); |
18 | 24 | } |
19 | 25 | </#list> |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/vo/${entityName}Page.javai
... | ... | @@ -44,7 +44,7 @@ public class ${entityName}Page { |
44 | 44 | /**${po.filedComment}*/ |
45 | 45 | <#if po.fieldName == primaryKeyField> |
46 | 46 | <#else> |
47 | - <#if po.fieldDbType =='Date'> | |
47 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
48 | 48 | <#if po.classType=='date'> |
49 | 49 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
50 | 50 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/jvxe/onetomany/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei
... | ... | @@ -4,17 +4,18 @@ |
4 | 4 | <!-- 子表单区域 --> |
5 | 5 | <a-tabs v-model:activeKey="activeKey" @change="handleChangeTabs"> |
6 | 6 | <#list subTables as sub><#rt/> |
7 | + <#assign refKey = sub.entityName?uncap_first/> | |
7 | 8 | <#if sub.foreignRelationType =='1'> |
8 | - <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true"> | |
9 | + <a-tab-pane tab="${sub.ftlDescription}" key="${refKey}" :forceRender="true"> | |
9 | 10 | <${sub.entityName}Form ref="${sub.entityName?uncap_first}Form"></${sub.entityName}Form> |
10 | 11 | </a-tab-pane> |
11 | 12 | |
12 | 13 | <#else> |
13 | - <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true"> | |
14 | + <a-tab-pane tab="${sub.ftlDescription}" key="${refKey}" :forceRender="true"> | |
14 | 15 | <JVxeTable |
15 | 16 | keep-source |
16 | 17 | resizable |
17 | - :ref="refKeys[${sub_index}]" | |
18 | + ref="${refKey}" | |
18 | 19 | :loading="${sub.entityName?uncap_first}Table.loading" |
19 | 20 | :columns="${sub.entityName?uncap_first}Table.columns" |
20 | 21 | :dataSource="${sub.entityName?uncap_first}Table.dataSource" |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
... | ... | @@ -241,7 +241,8 @@ public class ${entityName}Controller { |
241 | 241 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
242 | 242 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
243 | 243 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
244 | - MultipartFile file = entity.getValue();// 获取上传文件对象 | |
244 | + // 获取上传文件对象 | |
245 | + MultipartFile file = entity.getValue(); | |
245 | 246 | ImportParams params = new ImportParams(); |
246 | 247 | params.setTitleRows(2); |
247 | 248 | params.setHeadRows(1); |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/entity/${entityName}.javai
... | ... | @@ -47,7 +47,7 @@ public class ${entityName} implements Serializable { |
47 | 47 | <#if po.fieldName == primaryKeyField> |
48 | 48 | @TableId(type = IdType.ASSIGN_ID) |
49 | 49 | <#else> |
50 | - <#if po.fieldDbType =='Date'> | |
50 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
51 | 51 | <#if po.classType=='date'> |
52 | 52 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
53 | 53 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/entity/[1-n]Entity.javai
... | ... | @@ -48,7 +48,7 @@ public class ${subTab.entityName} implements Serializable { |
48 | 48 | <#if po.fieldName == primaryKeyField> |
49 | 49 | @TableId(type = IdType.ASSIGN_ID) |
50 | 50 | <#else> |
51 | - <#if po.fieldDbType =='Date'> | |
51 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
52 | 52 | <#if po.classType=='date'> |
53 | 53 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
54 | 54 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/mapper/[1-n]Mapper.javai
... | ... | @@ -15,8 +15,20 @@ import org.apache.ibatis.annotations.Param; |
15 | 15 | */ |
16 | 16 | public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> { |
17 | 17 | |
18 | + /** | |
19 | + * 通过主表id删除子表数据 | |
20 | + * | |
21 | + * @param mainId 主表id | |
22 | + * @return boolean | |
23 | + */ | |
18 | 24 | public boolean deleteByMainId(@Param("mainId") String mainId); |
19 | - | |
25 | + | |
26 | + /** | |
27 | + * 通过主表id查询子表数据 | |
28 | + * | |
29 | + * @param mainId 主表id | |
30 | + * @return List<${subTab.entityName}> | |
31 | + */ | |
20 | 32 | public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId); |
21 | 33 | } |
22 | 34 | </#list> |
23 | 35 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/service/I${entityName}Service.javai
... | ... | @@ -19,23 +19,35 @@ public interface I${entityName}Service extends IService<${entityName}> { |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * 添加一对多 |
22 | - * | |
22 | + * | |
23 | + * @param ${entityName?uncap_first} | |
24 | + <#list subTables as sub> | |
25 | + * @param ${sub.entityName?uncap_first}List | |
26 | + </#list> | |
23 | 27 | */ |
24 | 28 | public void saveMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) ; |
25 | 29 | |
26 | 30 | /** |
27 | 31 | * 修改一对多 |
28 | - * | |
32 | + * | |
33 | + * @param ${entityName?uncap_first} | |
34 | + <#list subTables as sub> | |
35 | + * @param ${sub.entityName?uncap_first}List | |
36 | + </#list> | |
29 | 37 | */ |
30 | 38 | public void updateMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>); |
31 | 39 | |
32 | 40 | /** |
33 | 41 | * 删除一对多 |
42 | + * | |
43 | + * @param id | |
34 | 44 | */ |
35 | 45 | public void delMain (String id); |
36 | 46 | |
37 | 47 | /** |
38 | 48 | * 批量删除一对多 |
49 | + * | |
50 | + * @param idList | |
39 | 51 | */ |
40 | 52 | public void delBatchMain (Collection<? extends Serializable> idList); |
41 | 53 | |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/service/[1-n]Service.javai
... | ... | @@ -14,6 +14,12 @@ import java.util.List; |
14 | 14 | */ |
15 | 15 | public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> { |
16 | 16 | |
17 | + /** | |
18 | + * 通过主表id查询子表数据 | |
19 | + * | |
20 | + * @param mainId 主表id | |
21 | + * @return List<${subTab.entityName}> | |
22 | + */ | |
17 | 23 | public List<${subTab.entityName}> selectByMainId(String mainId); |
18 | 24 | } |
19 | 25 | </#list> |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/vo/${entityName}Page.javai
... | ... | @@ -44,7 +44,7 @@ public class ${entityName}Page { |
44 | 44 | /**${po.filedComment}*/ |
45 | 45 | <#if po.fieldName == primaryKeyField> |
46 | 46 | <#else> |
47 | - <#if po.fieldDbType =='Date'> | |
47 | + <#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'> | |
48 | 48 | <#if po.classType=='date'> |
49 | 49 | <#if !excel_ignore_arr?seq_contains("${po.fieldName}")> |
50 | 50 | @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template-online/tab/onetomany/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei
... | ... | @@ -8,17 +8,18 @@ |
8 | 8 | </a-tab-pane> |
9 | 9 | <!--子表单区域 --> |
10 | 10 | <#list subTables as sub><#rt/> |
11 | + <#assign refKey = sub.entityName?uncap_first/> | |
11 | 12 | <#if sub.foreignRelationType =='1'> |
12 | - <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index+1}]" :forceRender="true"> | |
13 | + <a-tab-pane tab="${sub.ftlDescription}" key="${refKey}" :forceRender="true"> | |
13 | 14 | <${sub.entityName}Form ref="${sub.entityName?uncap_first}Form"></${sub.entityName}Form> |
14 | 15 | </a-tab-pane> |
15 | 16 | |
16 | 17 | <#else> |
17 | - <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index+1}]" :forceRender="true"> | |
18 | + <a-tab-pane tab="${sub.ftlDescription}" key="${refKey}" :forceRender="true"> | |
18 | 19 | <JVxeTable |
19 | 20 | keep-source |
20 | 21 | resizable |
21 | - :ref="refKeys[${sub_index+1}]" | |
22 | + ref="${refKey}" | |
22 | 23 | :loading="${sub.entityName?uncap_first}Table.loading" |
23 | 24 | :columns="${sub.entityName?uncap_first}Table.columns" |
24 | 25 | :dataSource="${sub.entityName?uncap_first}Table.dataSource" |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/jeecg/code-template/onetomany/java/${bussiPackage}/${entityPackage}/vue3/modules/${entityName}Modal.vuei
... | ... | @@ -4,11 +4,12 @@ |
4 | 4 | <!-- 子表单区域 --> |
5 | 5 | <a-tabs v-model:activeKey="activeKey" @change="handleChangeTabs"> |
6 | 6 | <#list subTables as sub><#rt/> |
7 | - <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true"> | |
7 | + <#assign refKey = sub.entityName?uncap_first/> | |
8 | + <a-tab-pane tab="${sub.ftlDescription}" key="${refKey}" :forceRender="true"> | |
8 | 9 | <JVxeTable |
9 | 10 | keep-source |
10 | 11 | resizable |
11 | - :ref="refKeys[${sub_index}]" | |
12 | + ref="${refKey}" | |
12 | 13 | :loading="${sub.entityName?uncap_first}Table.loading" |
13 | 14 | :columns="${sub.entityName?uncap_first}Table.columns" |
14 | 15 | :dataSource="${sub.entityName?uncap_first}Table.dataSource" |
... | ... |