add
This commit is contained in:
Binary file not shown.
@ -3,8 +3,15 @@ package ${packageName}.controller;
|
||||
import com.qiaoba.common.base.result.AjaxResult;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
#if($docFlag)
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
#end
|
||||
#if($excelFlag)
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.qiaoba.common.poi.utils.ExcelUtil;
|
||||
import ${packageName}.entity.template.${ClassName}Export;
|
||||
#end
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -27,45 +34,94 @@ import ${packageName}.service.${ClassName}Service;
|
||||
@RestController
|
||||
@RequestMapping("/${moduleName}/${businessName}")
|
||||
@RequiredArgsConstructor
|
||||
#if($docFlag)
|
||||
@Tag(name = "${functionName}管理")
|
||||
#end
|
||||
public class ${ClassName}Controller {
|
||||
|
||||
private final ${ClassName}Service ${className}Service;
|
||||
|
||||
#if($docFlag)
|
||||
@Operation(summary = "获取列表")
|
||||
#else
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
#end
|
||||
@PreAuthorize("hasAuthority('${permissionPrefix}:list')")
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获取列表")
|
||||
public TableDataInfo<${ClassName}> list(${ClassName}Param param, PageQuery pageQuery) {
|
||||
return ${className}Service.selectPageList(param, pageQuery);
|
||||
}
|
||||
|
||||
#if($docFlag)
|
||||
@Operation(summary = "获取详情")
|
||||
#else
|
||||
/**
|
||||
* 获取详情
|
||||
*/
|
||||
#end
|
||||
@PreAuthorize("hasAuthority('${permissionPrefix}:query')")
|
||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||
@Operation(summary = "获取详情")
|
||||
public AjaxResult getInfo(@PathVariable String ${pkColumn.javaField}) {
|
||||
return AjaxResult.success(${className}Service.selectById(${pkColumn.javaField}, false));
|
||||
}
|
||||
|
||||
#if($docFlag)
|
||||
@Operation(summary = "新增${functionName}")
|
||||
#else
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*/
|
||||
#end
|
||||
@PreAuthorize("hasAuthority('${permissionPrefix}:add')")
|
||||
@PostMapping
|
||||
@Operation(summary = "新增${functionName}")
|
||||
public AjaxResult add(@RequestBody ${ClassName}Dto dto) {
|
||||
return AjaxResult.toAjax(${className}Service.insert(dto));
|
||||
|
||||
}
|
||||
|
||||
#if($docFlag)
|
||||
@Operation(summary = "修改${functionName}")
|
||||
#else
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*/
|
||||
#end
|
||||
@PreAuthorize("hasAuthority('${permissionPrefix}:edit')")
|
||||
@PutMapping
|
||||
@Operation(summary = "修改${functionName}")
|
||||
public AjaxResult edit(@RequestBody ${ClassName}Dto dto) {
|
||||
return AjaxResult.toAjax(${className}Service.updateById(dto));
|
||||
|
||||
}
|
||||
|
||||
#if($docFlag)
|
||||
@Operation(summary = "删除${functionName}")
|
||||
#else
|
||||
/**
|
||||
* 删除${functionName}
|
||||
*/
|
||||
#end
|
||||
@PreAuthorize("hasAuthority('${permissionPrefix}:remove')")
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
@Operation(summary = "删除${functionName}")
|
||||
public AjaxResult remove(@PathVariable List<String> ${pkColumn.javaField}s) {
|
||||
return AjaxResult.toAjax(${className}Service.deleteByIds(${pkColumn.javaField}s));
|
||||
}
|
||||
|
||||
#if($excelFlag)
|
||||
#if($docFlag)
|
||||
@Operation(summary = "导出${functionName}")
|
||||
#else
|
||||
/**
|
||||
* 导出${functionName}
|
||||
*/
|
||||
#end
|
||||
@PreAuthorize("hasAuthority('${permissionPrefix}:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ${ClassName}Param param) {
|
||||
List<${ClassName}> list = ${className}Service.selectList(param);
|
||||
ExcelUtil.exportExcel(list, ${ClassName}Export.class, "${functionName}数据", response);
|
||||
}
|
||||
|
||||
#end
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
package ${packageName}.entity;
|
||||
|
||||
#if($docFlag)
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
#end
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -29,7 +31,13 @@ public class ${ClassName}Dto implements Serializable {
|
||||
|
||||
## 不是主键
|
||||
#else
|
||||
#if($docFlag)
|
||||
@Schema(description = "$column.columnComment")
|
||||
#else
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
#end
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
@ -0,0 +1,36 @@
|
||||
package ${packageName}.entity.template;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* ${functionName} 导出模板
|
||||
*
|
||||
* @author ${author}
|
||||
* @version 1.0
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ${ClassName}Export implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isList == "1")
|
||||
#if($column.javaType == "Date")
|
||||
@Excel(name = "$column.columnComment", width = 30, format = "yyyy-MM-dd HH:mm:ss")
|
||||
#else
|
||||
@Excel(name = "$column.columnComment", width = 20)
|
||||
#end
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
package ${packageName}.entity;
|
||||
|
||||
#if($docFlag)
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
#end
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -25,24 +27,42 @@ public class ${ClassName}Param implements Serializable {
|
||||
#if($column.queryType == "BETWEEN")
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
|
||||
#if($docFlag)
|
||||
@Schema(description = "开始$column.columnComment")
|
||||
#else
|
||||
/**
|
||||
* 开始$column.columnComment
|
||||
*/
|
||||
#end
|
||||
#if($column.javaType == "Date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
#end
|
||||
@Schema(description = "开始$column.columnComment")
|
||||
private $column.javaType start$AttrName;
|
||||
|
||||
#if($docFlag)
|
||||
@Schema(description = "结束$column.columnComment")
|
||||
#else
|
||||
/**
|
||||
* 结束$column.columnComment
|
||||
*/
|
||||
#end
|
||||
#if($column.javaType == "Date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
#end
|
||||
@Schema(description = "结束$column.columnComment")
|
||||
private $column.javaType end$AttrName;
|
||||
|
||||
#else
|
||||
|
||||
#if($docFlag)
|
||||
@Schema(description = "$column.columnComment")
|
||||
#else
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
#end
|
||||
#if($column.javaType == "Date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
#end
|
||||
@Schema(description = "$column.columnComment")
|
||||
private $column.javaType $column.javaField;
|
||||
#end
|
||||
#end
|
||||
@ -41,4 +41,5 @@ export function del${BusinessName}(${pkColumn.javaField}) {
|
||||
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
}
|
||||
@ -1,16 +1,21 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, is_visible, perms, icon, create_user, create_time, update_user, update_time, remark, tenant_id)
|
||||
values('${parentId}', '${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 0, 0, 'C', '1', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单', '${tenantId}');
|
||||
values('${parentId}', '${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 0, 0, 'C', '1', '${permissionPrefix}:list', '#', 'admin', '${datetime}', '', null, '${functionName}菜单', '${tenantId}');
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, is_visible, perms, icon, create_user, create_time, update_user, update_time, remark, tenant_id)
|
||||
values('${selectMenuId}', '${functionName}查询', '${parentId}', '1', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, '', '${tenantId}');
|
||||
values('${selectMenuId}', '${functionName}查询', '${parentId}', '1', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:query', '#', 'admin', '${datetime}', '', null, '', '${tenantId}');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, is_visible, perms, icon, create_user, create_time, update_user, update_time, remark, tenant_id)
|
||||
values('${insertMenuId}', '${functionName}新增', '${parentId}', '2', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, '', '${tenantId}');
|
||||
values('${insertMenuId}', '${functionName}新增', '${parentId}', '2', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:add', '#', 'admin', '${datetime}', '', null, '', '${tenantId}');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, is_visible, perms, icon, create_user, create_time, update_user, update_time, remark, tenant_id)
|
||||
values('${updateMenuId}', '${functionName}修改', '${parentId}', '3', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, '', '${tenantId}');
|
||||
values('${updateMenuId}', '${functionName}修改', '${parentId}', '3', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:edit', '#', 'admin', '${datetime}', '', null, '', '${tenantId}');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, is_visible, perms, icon, create_user, create_time, update_user, update_time, remark, tenant_id)
|
||||
values('${deleteMenuId}', '${functionName}删除', '${parentId}', '4', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, '', '${tenantId}');
|
||||
values('${deleteMenuId}', '${functionName}删除', '${parentId}', '4', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:remove', '#', 'admin', '${datetime}', '', null, '', '${tenantId}');
|
||||
|
||||
#if($excelFlag)
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, is_visible, perms, icon, create_user, create_time, update_user, update_time, remark, tenant_id)
|
||||
values('${exportMenuId}', '${functionName}导出', '${parentId}', '5', '#', '', 0, 0, 'F', '1', '${permissionPrefix}:export', '#', 'admin', '${datetime}', '', null, '', '${tenantId}');
|
||||
#end
|
||||
@ -96,6 +96,7 @@
|
||||
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
#if($excelFlag)
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -105,6 +106,7 @@
|
||||
v-hasPermi="['${moduleName}:${businessName}:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
#end
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -465,12 +467,14 @@ function handleDelete(row) {
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
#if($excelFlag)
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('${moduleName}/${businessName}/export', {
|
||||
...queryParams.value
|
||||
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
||||
}
|
||||
#end
|
||||
|
||||
getList();
|
||||
</script>
|
||||
Reference in New Issue
Block a user