mirror of https://gitee.com/makejava/EasyCode.git
修复已知问题,兼容旧版本导入导出。优化默认模板
This commit is contained in:
parent
0192ae2f91
commit
505f4af206
|
@ -1,5 +1,6 @@
|
|||
package com.sjhy.plugin.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.intellij.ide.fileTemplates.impl.UrlUtil;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.sjhy.plugin.dict.GlobalDict;
|
||||
|
@ -130,6 +131,7 @@ public class SettingsStorageDTO {
|
|||
/**
|
||||
* 类型映射组
|
||||
*/
|
||||
@JsonProperty("typeMapper")
|
||||
private Map<String, TypeMapperGroup> typeMapperGroupMap;
|
||||
/**
|
||||
* 当前模板组名
|
||||
|
@ -138,6 +140,7 @@ public class SettingsStorageDTO {
|
|||
/**
|
||||
* 模板组
|
||||
*/
|
||||
@JsonProperty("template")
|
||||
private Map<String, TemplateGroup> templateGroupMap;
|
||||
/**
|
||||
* 当前配置表组名
|
||||
|
@ -146,6 +149,7 @@ public class SettingsStorageDTO {
|
|||
/**
|
||||
* 配置表组
|
||||
*/
|
||||
@JsonProperty("columnConfig")
|
||||
private Map<String, ColumnConfigGroup> columnConfigGroupMap;
|
||||
/**
|
||||
* 当前全局配置组名
|
||||
|
@ -154,6 +158,7 @@ public class SettingsStorageDTO {
|
|||
/**
|
||||
* 全局配置组
|
||||
*/
|
||||
@JsonProperty("globalConfig")
|
||||
private Map<String, GlobalConfigGroup> globalConfigGroupMap;
|
||||
|
||||
public void fillDefaultVal() {
|
||||
|
|
|
@ -153,7 +153,7 @@ public class GlobalConfigSettingForm implements Configurable, BaseSettings {
|
|||
@Override
|
||||
public void apply() {
|
||||
getSettingsStorage().setGlobalConfigGroupMap(this.globalConfigGroupMap);
|
||||
getSettingsStorage().setCurrTypeMapperGroupName(this.currGlobalConfigGroup.getName());
|
||||
getSettingsStorage().setCurrGlobalConfigGroupName(this.currGlobalConfigGroup.getName());
|
||||
// 保存包后重新加载配置
|
||||
this.loadSettingsStore(getSettingsStorage());
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="10" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="9" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
|
@ -74,7 +74,7 @@
|
|||
</component>
|
||||
<grid id="7831c" binding="templatePanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="4" column="1" row-span="6" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="1" row-span="5" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
|
@ -82,7 +82,7 @@
|
|||
</grid>
|
||||
<component id="91ae2" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="6" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="5" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="string" key="label.template"/>
|
||||
|
@ -90,7 +90,7 @@
|
|||
</component>
|
||||
<vspacer id="98aa7">
|
||||
<constraints>
|
||||
<grid row="9" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="8" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="caddc" class="javax.swing.JLabel">
|
||||
|
|
|
@ -157,7 +157,7 @@ public class TemplateSettingForm implements Configurable, BaseSettings {
|
|||
@Override
|
||||
public void apply() {
|
||||
getSettingsStorage().setTemplateGroupMap(this.templateGroupMap);
|
||||
getSettingsStorage().setCurrTypeMapperGroupName(this.currTemplateGroup.getName());
|
||||
getSettingsStorage().setCurrTemplateGroupName(this.currTemplateGroup.getName());
|
||||
// 保存包后重新加载配置
|
||||
this.loadSettingsStore(getSettingsStorage());
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ public class ConfigTableModel extends DefaultTableModel implements EditableModel
|
|||
if (columnInfo == null) {
|
||||
return;
|
||||
}
|
||||
// 非自定义数据不允许修改列名
|
||||
if (!columnInfo.getCustom() && column == 0) {
|
||||
// 非自定义数据不允许修改
|
||||
if (!columnInfo.getCustom() && column <= 2) {
|
||||
return;
|
||||
}
|
||||
switch (column) {
|
||||
|
@ -125,6 +125,9 @@ public class ConfigTableModel extends DefaultTableModel implements EditableModel
|
|||
break;
|
||||
default:
|
||||
ColumnConfig columnConfig = CurrGroupUtils.getCurrColumnConfigGroup().getElementList().get(column - 3);
|
||||
if (columnInfo.getExt() == null) {
|
||||
columnInfo.setExt(new HashMap<>(16));
|
||||
}
|
||||
columnInfo.getExt().put(columnConfig.getTitle(), value);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.intellij.openapi.ui.DialogWrapper;
|
|||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.VerticalFlowLayout;
|
||||
import com.intellij.openapi.ui.ex.MultiLineLabel;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.sjhy.plugin.dict.GlobalDict;
|
||||
import com.sjhy.plugin.dto.SettingsStorageDTO;
|
||||
import com.sjhy.plugin.entity.AbstractGroup;
|
||||
|
@ -166,6 +167,19 @@ public class ExportImportComponent {
|
|||
mainPanel.add(handler.getRadioComponent());
|
||||
}
|
||||
}
|
||||
// 没有需要选择处理的分组则不构建Dialog
|
||||
boolean anyMatch = allHandlerList.stream().anyMatch(item -> item.getRadioComponent() != null);
|
||||
if (!anyMatch) {
|
||||
// 执行每个处理器
|
||||
for (Handler handler : allHandlerList) {
|
||||
handler.execute();
|
||||
}
|
||||
// 执行回调
|
||||
if (callback != null) {
|
||||
callback.run();
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 构建dialog
|
||||
DialogBuilder dialogBuilder = new DialogBuilder(ProjectUtils.getCurrProject());
|
||||
dialogBuilder.setTitle(GlobalDict.TITLE_INFO);
|
||||
|
@ -184,6 +198,7 @@ public class ExportImportComponent {
|
|||
}
|
||||
// 关闭并退出
|
||||
dialogWrapper.close(DialogWrapper.OK_EXIT_CODE);
|
||||
Messages.showInfoMessage("导入完成", GlobalDict.TITLE_INFO);
|
||||
}
|
||||
});
|
||||
// 显示窗口
|
||||
|
@ -191,6 +206,9 @@ public class ExportImportComponent {
|
|||
}
|
||||
|
||||
private <T extends AbstractGroup> void addRadioComponent(List<Handler> allHandlerList, String groupName, Map<String, T> localMap, Map<String, T> remoteMap) {
|
||||
if (CollectionUtil.isEmpty(remoteMap)) {
|
||||
return;
|
||||
}
|
||||
for (String key : remoteMap.keySet()) {
|
||||
if (localMap.containsKey(key)) {
|
||||
ListRadioComponent listRadioComponent = new ListRadioComponent(groupName + "->" + key, Stream.of(Operator.values()).map(item -> StringUtils.capitalize(item.name())).collect(Collectors.toList()));
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,6 +12,9 @@ $!callback.setSavePath($tool.append($tableInfo.savePath, "/controller"))
|
|||
|
||||
import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};
|
||||
import $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -31,15 +34,60 @@ public class $!{tableName} {
|
|||
@Resource
|
||||
private $!{tableInfo.name}Service $!tool.firstLowerCase($tableInfo.name)Service;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param actualFlightInfo 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseEntity<Page<$!{tableInfo.name}>> queryByPage($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}, PageRequest pageRequest) {
|
||||
return ResponseEntity.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.queryByPage($!{tool.firstLowerCase($tableInfo.name)}, pageRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("selectOne")
|
||||
public $!{tableInfo.name} selectOne($!pk.shortType id) {
|
||||
return this.$!{tool.firstLowerCase($tableInfo.name)}Service.queryById(id);
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<$!{tableInfo.name}> queryById(@PathVariable("id") $!pk.shortType id) {
|
||||
return ResponseEntity.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param $!{tool.firstLowerCase($tableInfo.name)} 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<$!{tableInfo.name}> add($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {
|
||||
return ResponseEntity.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.insert($!{tool.firstLowerCase($tableInfo.name)}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param $!{tool.firstLowerCase($tableInfo.name)} 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<$!{tableInfo.name}> edit($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {
|
||||
return ResponseEntity.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.update($!{tool.firstLowerCase($tableInfo.name)}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById($!pk.shortType id) {
|
||||
return ResponseEntity.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ $!callback.setSavePath($tool.append($tableInfo.savePath, "/dao"))
|
|||
|
||||
import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -34,20 +35,19 @@ public interface $!{tableName} {
|
|||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param offset 查询起始位置
|
||||
* @param limit 查询条数
|
||||
* @param $!tool.firstLowerCase($!{tableInfo.name}) 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<$!{tableInfo.name}> queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit);
|
||||
|
||||
List<$!{tableInfo.name}> queryAllByLimit($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}), @Param("pageable") Pageable pageable);
|
||||
|
||||
/**
|
||||
* 通过实体作为筛选条件查询
|
||||
* 统计总行数
|
||||
*
|
||||
* @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象
|
||||
* @return 对象列表
|
||||
* @param $!tool.firstLowerCase($!{tableInfo.name}) 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
List<$!{tableInfo.name}> queryAll($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));
|
||||
long count($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// 禁止将生成结果写入到文件
|
||||
$!callback.setWriteFile(false)
|
||||
|
||||
//调试表原始对象
|
||||
$!tool.debug($tableInfo.obj)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##引入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##使用宏定义设置回调(保存位置与文件后缀)
|
||||
#save("/entity", ".java")
|
||||
|
@ -8,7 +8,7 @@ $!define
|
|||
#setPackageSuffix("entity")
|
||||
|
||||
##使用全局变量实现默认包导入
|
||||
$!autoImport
|
||||
$!{autoImport.vm}
|
||||
import java.io.Serializable;
|
||||
|
||||
##使用宏定义实现类注释信息
|
||||
|
@ -17,8 +17,8 @@ public class $!{tableInfo.name} implements Serializable {
|
|||
private static final long serialVersionUID = $!tool.serial();
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
#if(${column.comment})/**
|
||||
* ${column.comment}
|
||||
*/#end
|
||||
* ${column.comment}
|
||||
*/#end
|
||||
|
||||
private $!{tool.getClsNameByFullName($column.type)} $!{column.name};
|
||||
#end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##引入mybatis支持
|
||||
$!mybatisSupport
|
||||
$!{mybatisSupport.vm}
|
||||
|
||||
##设置保存名称与保存位置
|
||||
$!callback.setFileName($tool.append($!{tableInfo.name}, "Dao.xml"))
|
||||
|
@ -25,7 +25,7 @@ $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
|
|||
select
|
||||
#allSqlColumn()
|
||||
|
||||
from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
|
||||
from $!tableInfo.obj.name
|
||||
where $!pk.obj.name = #{$!pk.name}
|
||||
</select>
|
||||
|
||||
|
@ -34,16 +34,7 @@ $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
|
|||
select
|
||||
#allSqlColumn()
|
||||
|
||||
from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
|
||||
limit #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<!--通过实体作为筛选条件查询-->
|
||||
<select id="queryAll" resultMap="$!{tableInfo.name}Map">
|
||||
select
|
||||
#allSqlColumn()
|
||||
|
||||
from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
|
||||
from $!tableInfo.obj.name
|
||||
<where>
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
<if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end">
|
||||
|
@ -51,16 +42,24 @@ $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
|
|||
</if>
|
||||
#end
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from $!tableInfo.obj.name
|
||||
<include refid="queryWhere"/>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="$!pk.name" useGeneratedKeys="true">
|
||||
insert into $!{tableInfo.obj.parent.name}.$!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)
|
||||
insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)
|
||||
values (#foreach($column in $tableInfo.otherColumn)#{$!{column.name}}#if($velocityHasNext), #end#end)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="$!pk.name" useGeneratedKeys="true">
|
||||
insert into $!{tableInfo.obj.parent.name}.$!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)
|
||||
insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#foreach($column in $tableInfo.otherColumn)#{entity.$!{column.name}}#if($velocityHasNext), #end#end)
|
||||
|
@ -68,18 +67,20 @@ $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
|
|||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="$!pk.name" useGeneratedKeys="true">
|
||||
insert into $!{tableInfo.obj.parent.name}.$!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)
|
||||
insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#foreach($column in $tableInfo.otherColumn)#{entity.$!{column.name}}#if($velocityHasNext), #end#end)
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
#foreach($column in $tableInfo.otherColumn)$!column.obj.name = values($!column.obj.name) #if($velocityHasNext), #end#end
|
||||
#foreach($column in $tableInfo.otherColumn)$!column.obj.name = values($!column.obj.name)#if($velocityHasNext),
|
||||
#end#end
|
||||
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update $!{tableInfo.obj.parent.name}.$!{tableInfo.obj.name}
|
||||
update $!{tableInfo.obj.name}
|
||||
<set>
|
||||
#foreach($column in $tableInfo.otherColumn)
|
||||
<if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end">
|
||||
|
@ -92,7 +93,7 @@ $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
|
|||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from $!{tableInfo.obj.parent.name}.$!{tableInfo.obj.name} where $!pk.obj.name = #{$!pk.name}
|
||||
delete from $!{tableInfo.obj.name} where $!pk.obj.name = #{$!pk.name}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -12,7 +12,8 @@ $!callback.setSavePath($tool.append($tableInfo.savePath, "/service"))
|
|||
#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}service;
|
||||
|
||||
import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};
|
||||
import java.util.List;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
/**
|
||||
* $!{tableInfo.comment}($!{tableInfo.name})表服务接口
|
||||
|
@ -31,13 +32,13 @@ public interface $!{tableName} {
|
|||
$!{tableInfo.name} queryById($!pk.shortType $!pk.name);
|
||||
|
||||
/**
|
||||
* 查询多条数据
|
||||
* 分页查询
|
||||
*
|
||||
* @param offset 查询起始位置
|
||||
* @param limit 查询条数
|
||||
* @return 对象列表
|
||||
* @param $!tool.firstLowerCase($!{tableInfo.name}) 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<$!{tableInfo.name}> queryAllByLimit(int offset, int limit);
|
||||
Page<$!{tableInfo.name}> queryByPage($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}), PageRequest pageRequest);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
|
|
@ -15,9 +15,11 @@ import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};
|
|||
import $!{tableInfo.savePackageName}.dao.$!{tableInfo.name}Dao;
|
||||
import $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* $!{tableInfo.comment}($!{tableInfo.name})表服务实现类
|
||||
|
@ -42,15 +44,16 @@ public class $!{tableName} implements $!{tableInfo.name}Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* 查询多条数据
|
||||
* 分页查询
|
||||
*
|
||||
* @param offset 查询起始位置
|
||||
* @param limit 查询条数
|
||||
* @return 对象列表
|
||||
* @param $!{tool.firstLowerCase($tableInfo.name)} 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<$!{tableInfo.name}> queryAllByLimit(int offset, int limit) {
|
||||
return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.queryAllByLimit(offset, limit);
|
||||
public Page<$!{tableInfo.name}> queryByPage($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}, PageRequest pageRequest) {
|
||||
long total = this.$!{tool.firstLowerCase($tableInfo.name)}Dao.count($!{tool.firstLowerCase($tableInfo.name)});
|
||||
return new PageImpl<>(this.$!{tool.firstLowerCase($tableInfo.name)}Dao.queryAllByLimit($!{tool.firstLowerCase($tableInfo.name)}, pageRequest), pageRequest, total);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("Controller")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("Dao")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##保存文件(宏定义)
|
||||
#save("/entity", ".java")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##引入mybatis支持
|
||||
$!mybatisSupport
|
||||
$!{mybatisSupport.vm}
|
||||
|
||||
##设置保存名称与保存位置
|
||||
$!callback.setFileName($tool.append($!{tableInfo.name}, "Dao.xml"))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("Service")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("ServiceImpl")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("Controller")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("Dao")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##保存文件(宏定义)
|
||||
#save("/entity", ".java")
|
||||
|
@ -8,7 +8,7 @@ $!define
|
|||
#setPackageSuffix("entity")
|
||||
|
||||
##自动导入包(全局变量)
|
||||
$!autoImport
|
||||
$!{autoImport.vm}
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("Service")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#setTableSuffix("ServiceImpl")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义、设置包名、类名、文件名##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
#setPackageSuffix("controller")
|
||||
#setTableSuffix("Controller")
|
||||
#save("/controller", "Controller.java")
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
##引入宏定义
|
||||
$!{define.vm}
|
||||
|
||||
##使用宏定义设置回调(保存位置与文件后缀)
|
||||
#save("/entity", ".java")
|
||||
|
||||
##使用宏定义设置包后缀
|
||||
#setPackageSuffix("entity")
|
||||
|
||||
##使用全局变量实现默认包导入
|
||||
$!{autoImport.vm}
|
||||
import java.io.Serializable;
|
||||
|
||||
##使用宏定义实现类注释信息
|
||||
#tableComment("实体类")
|
||||
public class $!{tableInfo.name} implements Serializable {
|
||||
private static final long serialVersionUID = $!tool.serial();
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
#if(${column.comment})/**
|
||||
* ${column.comment}
|
||||
*/#end
|
||||
|
||||
private $!{tool.getClsNameByFullName($column.type)} $!{column.name};
|
||||
#end
|
||||
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
##使用宏定义实现get,set方法
|
||||
#getSetMethod($column)
|
||||
#end
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义、设置包名、类名、文件名##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
#setPackageSuffix("repository")
|
||||
#setTableSuffix("Repository")
|
||||
#save("/repository", "Repository.java")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义、设置包名、类名、文件名##导入宏定义
|
||||
$!define
|
||||
$!{define.vm}
|
||||
#setPackageSuffix("service")
|
||||
#setTableSuffix("Service")
|
||||
#save("/service", "Service.java")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##导入宏定义、设置包名、类名、文件名
|
||||
$!define
|
||||
$!{define.vm}
|
||||
#setPackageSuffix("service.impl")
|
||||
#setTableSuffix("ServiceImpl")
|
||||
#save("/service/impl", "ServiceImpl.java")
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
"columnType": "bigint(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.Long"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "date",
|
||||
"javaType": "java.util.Date"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "datetime",
|
||||
|
@ -54,6 +59,11 @@
|
|||
"columnType": "timestamp",
|
||||
"javaType": "java.util.Date"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "time",
|
||||
"javaType": "java.time.LocalTime"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "boolean",
|
||||
|
|
Loading…
Reference in New Issue