初始化项目
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Api</p>
|
||||
* <p>Description : $!{table.businessName} Api</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
public interface ${table.entityName}Api {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import org.springframework.web.service.annotation.HttpExchange;
|
||||
import ${table.packageName}.api.${table.entityName}Api;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Call</p>
|
||||
* <p>Description : $!{table.businessName} Call</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@HttpExchange("/${uri}")
|
||||
public interface ${table.entityName}Call extends ${table.entityName}Api {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import xtools.boot.api.model.dto.Result;
|
||||
import xtools.boot.api.model.dto.page.PageReq;
|
||||
import xtools.boot.api.model.dto.page.PageResp;
|
||||
import xtools.boot.api.model.dto.req.IdListReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}AddReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}PageReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}UpdateReq;
|
||||
import ${table.packageName}.model.dto.resp.${table.entityName}Resp;
|
||||
import ${table.packageName}.service.${table.entityName}Service;
|
||||
#if($api)
|
||||
import ${table.packageName}.api.${table.entityName}Api;
|
||||
#end
|
||||
#if($exportExcel || $importExcel)
|
||||
import ${table.packageName}.model.dto.excel.${table.entityName}Excel;
|
||||
import xtools.extend.office.FesodUtils;
|
||||
import xtools.boot.api.exection.BizError;
|
||||
|
||||
import java.io.IOException;
|
||||
#end
|
||||
#if($exportExcel)
|
||||
import java.util.List;
|
||||
|
||||
import xtools.web.HttpServletUtils;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
#end
|
||||
#if($importExcel)
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import xtools.core.CollectionUtils;
|
||||
import xtools.boot.api.exection.BizWarning;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
#end
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Controller</p>
|
||||
* <p>Description : $!{table.businessName} Controller</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "$!{table.businessName}")
|
||||
@RestController
|
||||
@RequestMapping("/${uri}")
|
||||
public class ${table.entityName}Controller #if($api)implements ${table.entityName}Api #end{
|
||||
|
||||
private final ${table.entityName}Service ${table.propName}Service;
|
||||
|
||||
@Operation(summary = "分页请求")
|
||||
@PostMapping("page")
|
||||
public Result<PageResp<${table.entityName}Resp>> page(@RequestBody @Valid PageReq<${table.entityName}PageReq> pageReq) {
|
||||
return ${table.propName}Service.page(pageReq);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取数据")
|
||||
@GetMapping("base/{id}")
|
||||
public Result<${table.entityName}Resp> getById(
|
||||
@Schema(description = "ID", example = "1")
|
||||
@Min(value = 1L, message = "不能小于1")
|
||||
@NotNull(message = "不能为空")
|
||||
@PathVariable Long id
|
||||
) {
|
||||
return ${table.propName}Service.getById(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "添加数据")
|
||||
@PostMapping("base")
|
||||
public Result<Boolean> add(@RequestBody @Valid ${table.entityName}AddReq req) {
|
||||
return ${table.propName}Service.add(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新数据")
|
||||
@PutMapping("base")
|
||||
public Result<Boolean> update(@RequestBody @Valid ${table.entityName}UpdateReq req) {
|
||||
return ${table.propName}Service.update(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除数据")
|
||||
@DeleteMapping("base")
|
||||
public Result<Boolean> delById(@RequestBody @Valid IdListReq req) {
|
||||
return ${table.propName}Service.delById(req);
|
||||
}
|
||||
|
||||
#if($exportExcel)
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("export")
|
||||
public void exportExcel(@RequestBody @Valid ${table.entityName}PageReq req, HttpServletResponse response) {
|
||||
String sheetName = "$!{table.businessName}" ;
|
||||
String filename = sheetName + ".xlsx" ;
|
||||
List<${table.entityName}Excel> dataList = ${table.propName}Service.exportExcel(req);
|
||||
try {
|
||||
FesodUtils.write(response.getOutputStream(), ${table.entityName}Excel.class, sheetName, dataList);
|
||||
} catch (IOException e) {
|
||||
throw new BizError("导出Excel失败");
|
||||
}
|
||||
// 设置 header 和 contentType.写在最后的原因是,避免报错时,响应 contentType 已经被修改
|
||||
HttpServletUtils.addDownloadHeader(response, filename);
|
||||
}
|
||||
|
||||
#end
|
||||
#if($importExcel)
|
||||
@Operation(summary = "导入Excel")
|
||||
@PostMapping("import")
|
||||
public Result<Boolean> importExcel(@RequestParam("file") MultipartFile file) {
|
||||
List<${table.entityName}Excel> dataList;
|
||||
try {
|
||||
dataList = FesodUtils.read(file.getInputStream(), ${table.entityName}Excel.class);
|
||||
} catch (IOException e) {
|
||||
throw new BizError("导入Excel失败");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
throw new BizWarning("导入Excel没有包含有效数据");
|
||||
}
|
||||
${table.propName}Service.importExcel(dataList);
|
||||
return Result.ok(true);
|
||||
}
|
||||
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}AddReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}UpdateReq;
|
||||
import ${table.packageName}.model.dto.resp.${table.entityName}Resp;
|
||||
import ${table.packageName}.model.entity.${table.entityName};
|
||||
#if($exportExcel || $importExcel)
|
||||
import ${table.packageName}.model.dto.excel.${table.entityName}Excel;
|
||||
#end
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Convert</p>
|
||||
* <p>Description : $!{table.businessName} Convert</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ${table.entityName}Convert {
|
||||
|
||||
/**
|
||||
* 添加请求转实体
|
||||
*
|
||||
* @param req 添加请求
|
||||
* @return 实体
|
||||
*/
|
||||
${table.entityName} addReqToEntity(${table.entityName}AddReq req);
|
||||
|
||||
/**
|
||||
* 修改请求转实体
|
||||
*
|
||||
* @param req 修改请求
|
||||
* @return 实体
|
||||
*/
|
||||
${table.entityName} updateReqToEntity(${table.entityName}UpdateReq req);
|
||||
|
||||
/**
|
||||
* 实体转响应
|
||||
*
|
||||
* @param data 实体
|
||||
* @return 响应
|
||||
*/
|
||||
${table.entityName}Resp entityToResp(${table.entityName} data);
|
||||
|
||||
/**
|
||||
* 批量实体转响应
|
||||
*
|
||||
* @param dataList 批量实体
|
||||
* @return 响应
|
||||
*/
|
||||
List<${table.entityName}Resp> entityToRespList(List<${table.entityName}> dataList);
|
||||
|
||||
#if($exportExcel)
|
||||
/**
|
||||
* 实体转Excel
|
||||
*
|
||||
* @param data 实体
|
||||
* @return Excel
|
||||
*/
|
||||
${table.entityName}Excel entityToExcel(${table.entityName} data);
|
||||
|
||||
#end
|
||||
#if($importExcel)
|
||||
/**
|
||||
* Excel转实体
|
||||
*
|
||||
* @param data Excel
|
||||
* @return 实体
|
||||
*/
|
||||
${table.entityName} excelToEntity(${table.entityName}Excel data);
|
||||
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import ${table.packageName}.model.entity.${table.entityName};
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Mapper</p>
|
||||
* <p>Description : $!{table.businessName} Mapper 接口</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${table.entityName}Mapper extends BaseMapper<${table.entityName}> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
#if($importMap.hasInstant)
|
||||
import java.time.Instant;
|
||||
#end
|
||||
#if($importMap.hasBigDecimal)
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}AddReq</p>
|
||||
* <p>Description : $!{table.businessName}添加请求对象</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ${table.entityName}AddReq implements Serializable {
|
||||
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.isPk.equals(1) && !$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
#if("$!column.fieldComment" != "")
|
||||
/**
|
||||
* ${column.fieldComment}
|
||||
*/
|
||||
@Schema(description = "${column.fieldComment}")
|
||||
#end
|
||||
private ${column.fieldType} ${column.fieldName};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
#if($importMap.hasInstant)
|
||||
import java.time.Instant;
|
||||
#end
|
||||
#if($importMap.hasBigDecimal)
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.fesod.sheet.annotation.ExcelProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Excel</p>
|
||||
* <p>Description : $!{table.businessName}Excel对象</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ${table.entityName}Excel implements Serializable {
|
||||
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
/**
|
||||
* ${column.fieldComment}
|
||||
*/
|
||||
@ExcelProperty("${column.fieldComment}")
|
||||
private ${column.fieldType} ${column.fieldName};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import java.time.Instant;
|
||||
#if($importMap.hasBigDecimal)
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}PageReq</p>
|
||||
* <p>Description : $!{table.businessName}分页请求对象</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ${table.entityName}PageReq implements Serializable {
|
||||
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
/**
|
||||
* ${column.fieldComment}
|
||||
*/
|
||||
#if($column.fieldType.equals("Instant"))
|
||||
@Schema(description = "${column.fieldComment}(范围)", example = "['2026-01-01 00:00:00', '2026-01-01 12:00:00']")
|
||||
private ${column.fieldType}[] ${column.fieldName}Range;
|
||||
#else
|
||||
@Schema(description = "${column.fieldComment}")
|
||||
private ${column.fieldType} ${column.fieldName};
|
||||
#end
|
||||
|
||||
#end
|
||||
#end
|
||||
/**
|
||||
* 创建时间(范围)
|
||||
*/
|
||||
@Schema(description = "创建时间(范围)", example = "['2026-01-01 00:00:00', '2026-01-01 12:00:00']")
|
||||
private Instant[] gmtCreateRange;
|
||||
|
||||
/**
|
||||
* 更新时间(范围)
|
||||
*/
|
||||
@Schema(description = "更新时间(范围)", example = "['2026-01-01 00:00:00', '2026-01-01 12:00:00']")
|
||||
private Instant[] gmtModifiedRange;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
#if($maskList.size() > 0)
|
||||
import xtools.boot.mask.anntation.Mask;
|
||||
import xtools.boot.mask.enums.MaskType;
|
||||
#end
|
||||
#if($importMap.hasInstant)
|
||||
import java.time.Instant;
|
||||
#end
|
||||
#if($importMap.hasBigDecimal)
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import xtools.boot.api.model.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Resp</p>
|
||||
* <p>Description : $!{table.businessName}响应对象</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ${table.entityName}Resp extends BaseEntity {
|
||||
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
/**
|
||||
* ${column.fieldComment}
|
||||
*/
|
||||
@Schema(description = "${column.fieldComment}")
|
||||
#if("$!column.maskType" != "OFF")
|
||||
@Mask(MaskType.${column.maskType})
|
||||
#end
|
||||
private ${column.fieldType} ${column.fieldName};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
#if($importMap.hasInstant)
|
||||
import java.time.Instant;
|
||||
#end
|
||||
#if($importMap.hasBigDecimal)
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}UpdateReq</p>
|
||||
* <p>Description : $!{table.businessName}更新请求对象</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ${table.entityName}UpdateReq implements Serializable {
|
||||
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
#if("$!column.fieldComment" != "")
|
||||
/**
|
||||
* ${column.fieldComment}
|
||||
*/
|
||||
@Schema(description = "${column.fieldComment}")
|
||||
#end
|
||||
private ${column.fieldType} ${column.fieldName};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
#if($importMap.hasInstant)
|
||||
import java.time.Instant;
|
||||
#end
|
||||
#if($importMap.hasBigDecimal)
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import xtools.boot.api.model.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}</p>
|
||||
* <p>Description : $!{table.businessName}实体对象</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("${table.tableName}")
|
||||
public class ${table.entityName} extends BaseEntity {
|
||||
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
/**
|
||||
* ${column.fieldComment}
|
||||
*/
|
||||
@Schema(description = "${column.fieldComment}")
|
||||
#if($column.isPk.equals(1))
|
||||
@TableId(value = "${column.columnName}", type = IdType.ASSIGN_ID)
|
||||
#else
|
||||
@TableField(value = "${column.columnName}")
|
||||
#end
|
||||
private ${column.fieldType} ${column.fieldName};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import xtools.boot.api.model.dto.Result;
|
||||
import xtools.boot.api.model.dto.page.PageReq;
|
||||
import xtools.boot.api.model.dto.page.PageResp;
|
||||
import xtools.boot.api.model.dto.req.IdListReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}AddReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}PageReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}UpdateReq;
|
||||
import ${table.packageName}.model.dto.resp.${table.entityName}Resp;
|
||||
#if($api)
|
||||
import ${table.packageName}.api.${table.entityName}Api;
|
||||
#end
|
||||
#if($exportExcel || $importExcel)
|
||||
import ${table.packageName}.model.dto.excel.${table.entityName}Excel;
|
||||
#end
|
||||
#if($exportExcel)
|
||||
import java.util.List;
|
||||
#end
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}Service</p>
|
||||
* <p>Description : $!{table.businessName} Service</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
public interface ${table.entityName}Service #if($api)extends ${table.entityName}Api #end{
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageReq 分页请求
|
||||
* @return 分页结果
|
||||
*/
|
||||
Result<PageResp<${table.entityName}Resp>> page(PageReq<${table.entityName}PageReq> pageReq);
|
||||
|
||||
/**
|
||||
* 根据 ID 查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return 结果
|
||||
*/
|
||||
Result<${table.entityName}Resp> getById(Long id);
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param req 添加请求
|
||||
* @return 添加结果
|
||||
*/
|
||||
Result<Boolean> add(${table.entityName}AddReq req);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param req 修改请求
|
||||
* @return 修改结果
|
||||
*/
|
||||
Result<Boolean> update(${table.entityName}UpdateReq req);
|
||||
|
||||
/**
|
||||
* 根据 ID 删除
|
||||
*
|
||||
* @param req ID 集合
|
||||
* @return 删除结果
|
||||
*/
|
||||
Result<Boolean> delById(IdListReq req);
|
||||
|
||||
#if($exportExcel)
|
||||
/**
|
||||
* 导出 Excel
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @return Excel 数据
|
||||
*/
|
||||
List<${table.entityName}Excel> exportExcel(${table.entityName}PageReq req);
|
||||
|
||||
#end
|
||||
#if($importExcel)
|
||||
/**
|
||||
* 导入 Excel
|
||||
*
|
||||
* @param dataList Excel 数据
|
||||
*/
|
||||
void importExcel(List<${table.entityName}Excel> dataList);
|
||||
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import ${table.packageName}.mapper.${table.entityName}Mapper;
|
||||
import ${table.packageName}.model.entity.${table.entityName};
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}BaseService</p>
|
||||
* <p>Description : $!{table.businessName} BaseService</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Component
|
||||
public class ${table.entityName}BaseService extends ServiceImpl<${table.entityName}Mapper, ${table.entityName}> {
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package ${table.packageName}.${subPackageName};
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import xtools.boot.api.exection.BizError;
|
||||
import xtools.boot.api.exection.BizWarning;
|
||||
import xtools.boot.api.model.dto.Result;
|
||||
import xtools.boot.api.model.dto.page.PageReq;
|
||||
import xtools.boot.api.model.dto.page.PageResp;
|
||||
import xtools.boot.api.model.dto.req.IdListReq;
|
||||
import xtools.boot.db.mybatisplus.utils.QueryUtils;
|
||||
#if($importMap.hasStringUtils)
|
||||
import xtools.core.StringUtils;
|
||||
#end
|
||||
import ${table.packageName}.convert.${table.entityName}Convert;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}AddReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}PageReq;
|
||||
import ${table.packageName}.model.dto.req.${table.entityName}UpdateReq;
|
||||
import ${table.packageName}.model.dto.resp.${table.entityName}Resp;
|
||||
import ${table.packageName}.model.entity.${table.entityName};
|
||||
#if($exportExcel || $importExcel)
|
||||
import ${table.packageName}.model.dto.excel.${table.entityName}Excel;
|
||||
#end
|
||||
import ${table.packageName}.service.${table.entityName}Service;
|
||||
import ${table.packageName}.service.base.${table.entityName}BaseService;
|
||||
import java.util.Objects;
|
||||
#if($exportExcel)
|
||||
import java.util.List;
|
||||
#end
|
||||
|
||||
/**
|
||||
* <p>Title : ${table.entityName}ServiceImpl</p>
|
||||
* <p>Description : $!{table.businessName} ServiceImpl</p>
|
||||
* <p>Company : org.xujun</p>
|
||||
*
|
||||
* @author : ${table.author}
|
||||
* @version : ${version}
|
||||
* @date : ${date}
|
||||
*/
|
||||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ${table.entityName}ServiceImpl implements ${table.entityName}Service {
|
||||
|
||||
private final ${table.entityName}BaseService ${table.propName}BaseService;
|
||||
|
||||
private final ${table.entityName}Convert ${table.propName}Convert;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageReq 分页请求
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public Result<PageResp<${table.entityName}Resp>> page(PageReq<${table.entityName}PageReq> pageReq) {
|
||||
// 分页查询
|
||||
Page<${table.entityName}> page = getPageData(pageReq.getCurrentPage(), pageReq.getPageSize(), pageReq.getQuery());
|
||||
// 分装结果
|
||||
PageResp<${table.entityName}Resp> pageResp = new PageResp<>(pageReq, page.getTotal(), ${table.propName}Convert.entityToRespList(page.getRecords()));
|
||||
return Result.ok(pageResp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 ID 查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Result<${table.entityName}Resp> getById(Long id) {
|
||||
${table.entityName} data = ${table.propName}BaseService.getById(id);
|
||||
return Result.ok(${table.propName}Convert.entityToResp(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param req 添加请求
|
||||
* @return 添加结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<Boolean> add(${table.entityName}AddReq req) {
|
||||
${table.entityName} entity = ${table.propName}Convert.addReqToEntity(req);
|
||||
if (Objects.nonNull(existsEntity(entity))) {
|
||||
throw new BizWarning("数据已存在");
|
||||
}
|
||||
return Result.ok(${table.propName}BaseService.save(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param req 修改请求
|
||||
* @return 修改结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<Boolean> update(${table.entityName}UpdateReq req) {
|
||||
${table.entityName} entity = ${table.propName}Convert.updateReqToEntity(req);
|
||||
if (Objects.nonNull(existsEntity(entity))) {
|
||||
throw new BizWarning("数据已存在");
|
||||
}
|
||||
return Result.ok(${table.propName}BaseService.updateById(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 ID 删除
|
||||
*
|
||||
* @param req ID 集合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<Boolean> delById(IdListReq req) {
|
||||
boolean removed = ${table.propName}BaseService.removeByIds(req.getIdList());
|
||||
if (!removed) {
|
||||
throw new BizError("删除失败");
|
||||
}
|
||||
return Result.ok(true);
|
||||
}
|
||||
|
||||
#if($exportExcel)
|
||||
/**
|
||||
* 导出 Excel
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @return Excel 数据
|
||||
*/
|
||||
@Override
|
||||
public List<${table.entityName}Excel> exportExcel(${table.entityName}PageReq req) {
|
||||
// 创建查询条件
|
||||
LambdaQueryWrapper<${table.entityName}> query = new LambdaQueryWrapper<>();
|
||||
// 查询字段
|
||||
query.select(
|
||||
#foreach($column in ${columnList})
|
||||
#if($foreach.index.equals(0))
|
||||
${table.entityName}::get${column.funName}
|
||||
#else
|
||||
, ${table.entityName}::get${column.funName}
|
||||
#end
|
||||
#end
|
||||
);
|
||||
// 设置查询条件
|
||||
setQueryWrapper(query, req);
|
||||
// 排序
|
||||
query.orderByDesc(${table.entityName}::getGmtCreate);
|
||||
List<${table.entityName}> dataList = ${table.propName}BaseService.list(query);
|
||||
return dataList.stream().map(item -> ${table.propName}Convert.entityToExcel(item)).toList();
|
||||
}
|
||||
|
||||
#end
|
||||
#if($importExcel)
|
||||
/**
|
||||
* 导入 Excel
|
||||
*
|
||||
* @param dataList Excel 数据
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(List<${table.entityName}Excel> dataList) {
|
||||
for (${table.entityName}Excel excel : dataList) {
|
||||
${table.entityName} item = ${table.propName}Convert.excelToEntity(excel);
|
||||
${table.entityName} dbItem = existsEntity(item);
|
||||
if (Objects.isNull(dbItem)) {
|
||||
// 新增
|
||||
${table.propName}BaseService.save(item);
|
||||
} else {
|
||||
// 修改
|
||||
item.setId(dbItem.getId());
|
||||
${table.propName}BaseService.updateById(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#end
|
||||
/**
|
||||
* 获取分页数据
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页数量
|
||||
* @param req 请求参数
|
||||
* @return 分页数据
|
||||
*/
|
||||
private Page<${table.entityName}> getPageData(Integer currentPage, Integer pageSize, ${table.entityName}PageReq req) {
|
||||
// 创建查询条件
|
||||
LambdaQueryWrapper<${table.entityName}> query = new LambdaQueryWrapper<>();
|
||||
// 查询字段
|
||||
query.select(
|
||||
#foreach($column in ${columnList})
|
||||
#if($foreach.index.equals(0))
|
||||
${table.entityName}::get${column.funName}
|
||||
#else
|
||||
, ${table.entityName}::get${column.funName}
|
||||
#end
|
||||
#end
|
||||
);
|
||||
// 设置查询条件
|
||||
setQueryWrapper(query, req);
|
||||
// 排序
|
||||
query.orderByDesc(${table.entityName}::getGmtCreate);
|
||||
return ${table.propName}BaseService.page(QueryUtils.getPage(currentPage, pageSize), query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置查询条件
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @param req 请求参数
|
||||
*/
|
||||
private void setQueryWrapper(LambdaQueryWrapper<${table.entityName}> query, ${table.entityName}PageReq req) {
|
||||
if (Objects.isNull(req)) {
|
||||
return;
|
||||
}
|
||||
// 查询条件
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
#if($column.queryType.equals(1))
|
||||
query.eq(Objects.nonNull(req.get${column.funName}()), ${table.entityName}::get${column.funName}, req.get${column.funName}());
|
||||
#end
|
||||
#if($column.queryType.equals(2))
|
||||
query.like(StringUtils.isNotBlank(req.get${column.funName}()), ${table.entityName}::get${column.funName}, req.get${column.funName}());
|
||||
#end
|
||||
#if($column.queryType.equals(12))
|
||||
QueryUtils.addTimeRange(query, req.get${column.funName}Range(), ${table.entityName}::get${column.funName});
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
QueryUtils.addTimeRange(query, req.getGmtCreateRange(), ${table.entityName}::getGmtCreate);
|
||||
QueryUtils.addTimeRange(query, req.getGmtModifiedRange(), ${table.entityName}::getGmtModified);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断实体是否存在
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 是否存在
|
||||
*/
|
||||
private ${table.entityName} existsEntity(${table.entityName} entity) {
|
||||
// 创建查询条件
|
||||
LambdaQueryWrapper<${table.entityName}> query = new LambdaQueryWrapper<>();
|
||||
// 查询字段
|
||||
query.select(${table.entityName}::getId);
|
||||
// 排除当前数据
|
||||
query.ne(Objects.nonNull(entity.getId()), ${table.entityName}::getId, entity.getId());
|
||||
// 校验数据时候存在的条件
|
||||
return ${table.propName}BaseService.getOne(query);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
-- 主菜单
|
||||
INSERT INTO sys_menu (`id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `route_name`, `route_path`, `component`, `menu_cache`) VALUES (${dbIds[0]}, ${parentId}, '${treePath}', '${table.businessName}', 'Link', 'M', '${table.entityName}', '/${uri}', '${component}', 1);
|
||||
-- 分页查询-接口权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `interface_perm_type`, `interface_perm_uri` ) VALUES ( ${dbIds[1]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '分页查询', 'Link', 'I', 1, '2', '/${uri}/page' );
|
||||
-- 获取数据-接口权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `interface_perm_type`, `interface_perm_uri` ) VALUES ( ${dbIds[2]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '获取数据', 'Link', 'I', 2, '1', '/${uri}/base/*' );
|
||||
-- 新增数据-接口权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `interface_perm_type`, `interface_perm_uri` ) VALUES ( ${dbIds[3]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '新增数据', 'Link', 'I', 3, '2', '/${uri}/base' );
|
||||
-- 修改数据-接口权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `interface_perm_type`, `interface_perm_uri` ) VALUES ( ${dbIds[4]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '修改数据', 'Link', 'I', 4, '3', '/${uri}/base' );
|
||||
-- 删除数据-接口权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `interface_perm_type`, `interface_perm_uri` ) VALUES ( ${dbIds[5]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '删除数据', 'Link', 'I', 5, '4', '/${uri}/base' );
|
||||
-- 按钮权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `btn_perm` ) VALUES ( ${dbIds[6]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '查看按钮', 'Pointer', 'B', 6, '${btnPermPrefix}:view' );
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `btn_perm` ) VALUES ( ${dbIds[7]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '新增按钮', 'Pointer', 'B', 7, '${btnPermPrefix}:add' );
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `btn_perm` ) VALUES ( ${dbIds[8]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '修改按钮', 'Pointer', 'B', 8, '${btnPermPrefix}:edit' );
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `btn_perm` ) VALUES ( ${dbIds[9]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '删除按钮', 'Pointer', 'B', 9, '${btnPermPrefix}:delete' );
|
||||
#if($exportExcel)
|
||||
-- 导出数据-接口权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `interface_perm_type`, `interface_perm_uri` ) VALUES ( ${dbIds[10]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '导出数据', 'Link', 'I', 10, '2', '/${uri}/export' );
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `btn_perm` ) VALUES ( ${dbIds[11]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '导出按钮', 'Pointer', 'B', 11, '${btnPermPrefix}:export' );
|
||||
#end
|
||||
#if($importExcel)
|
||||
-- 导入数据-接口权限
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `interface_perm_type`, `interface_perm_uri` ) VALUES ( ${dbIds[12]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '导入数据', 'Link', 'I', 12, '2', '/${uri}/import' );
|
||||
INSERT INTO sys_menu ( `id`, `parent_id`, `tree_path`, `menu_name`, `menu_icon`, `menu_type`, `sort`, `btn_perm` ) VALUES ( ${dbIds[13]}, ${dbIds[0]}, '${treePath},${dbIds[0]}', '导入按钮', 'Pointer', 'B', 13, '${btnPermPrefix}:import' );
|
||||
#end
|
||||
@@ -0,0 +1,142 @@
|
||||
import {PageReq, PageResult} from "@/types/global";
|
||||
import http from "@/plugins/axios";
|
||||
|
||||
// 基本的请求路径
|
||||
const BASE_URL = "/${uri}";
|
||||
|
||||
// 基本实体类
|
||||
interface BaseVo {
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
// ${column.fieldComment}
|
||||
${column.fieldName}?: string;
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
||||
// 分页搜索实体
|
||||
export interface PageQuery extends BaseVo {
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
#if($column.fieldType.equals("Instant"))
|
||||
// ${column.fieldComment}
|
||||
${column.fieldName}Range?: Array<string>;
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
// 更新时间
|
||||
gmtModifiedRange?: Array<string>;
|
||||
// 创建时间
|
||||
gmtCreateRange?: Array<string>;
|
||||
}
|
||||
|
||||
// 分页响应实体类
|
||||
export interface PageResp extends BaseVo {
|
||||
// 创建时间
|
||||
gmtCreate?: string;
|
||||
// 更新时间
|
||||
gmtModified?: string;
|
||||
}
|
||||
|
||||
// 编辑表单实体
|
||||
export interface EditForm extends BaseVo {
|
||||
}
|
||||
|
||||
// api
|
||||
const api = {
|
||||
/**
|
||||
* 分页列表
|
||||
* @param queryParams 搜索表单
|
||||
*/
|
||||
getPage(queryParams?: PageReq<PageQuery>) {
|
||||
return http<any, PageResult<PageResp>>({
|
||||
url: `${BASE_URL}/page`,
|
||||
method: "post",
|
||||
data: queryParams,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @param cancelToken 取消请求标识
|
||||
*/
|
||||
getById(id: number, cancelToken?: any) {
|
||||
return http({
|
||||
url: `${BASE_URL}/base/${id}`,
|
||||
method: "get",
|
||||
cancelToken,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param data 表单数据
|
||||
*/
|
||||
add(data: EditForm) {
|
||||
return http({
|
||||
url: `${BASE_URL}/base`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
* @param data 表单数据
|
||||
*/
|
||||
update(data: EditForm) {
|
||||
return http({
|
||||
url: `${BASE_URL}/base`,
|
||||
method: "put",
|
||||
data
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据ID集合删除
|
||||
* @param ids ID集合
|
||||
*/
|
||||
deleteByIds(ids: Array<string>) {
|
||||
return http({
|
||||
url: `${BASE_URL}/base`,
|
||||
method: "delete",
|
||||
data: {
|
||||
idList: ids,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
#if($exportExcel)
|
||||
/**
|
||||
* 导出
|
||||
* @param queryParams 搜索表单
|
||||
*/
|
||||
export(queryParams?: PageQuery) {
|
||||
return http<any>({
|
||||
url: `${BASE_URL}/export`,
|
||||
method: "post",
|
||||
data: queryParams,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
#end
|
||||
#if($importExcel)
|
||||
/**
|
||||
* 导入
|
||||
* @param formData 表单数据
|
||||
*/
|
||||
import(formData: any) {
|
||||
return http({
|
||||
url: `${BASE_URL}/import`,
|
||||
method: "post",
|
||||
data: formData,
|
||||
headers: {"Content-Type": "multipart/form-data"},
|
||||
});
|
||||
},
|
||||
|
||||
#end
|
||||
}
|
||||
|
||||
export default api;
|
||||
@@ -0,0 +1,687 @@
|
||||
<template>
|
||||
<div class="_route-view-root _table-page">
|
||||
<!-- 搜索表单 -->
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="_query-form"
|
||||
>
|
||||
#foreach($column in ${columnList})
|
||||
#if($column.isShowInQuery && !$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
<el-form-item prop="${column.fieldName}#if($column.formType.equals(9))Range#end">
|
||||
#if($column.formType.equals(1))
|
||||
<el-input
|
||||
v-model="queryParams.${column.fieldName}"
|
||||
clearable
|
||||
maxlength="50"
|
||||
placeholder="请输入${column.fieldComment}"
|
||||
@keyup.enter="handleQuery"
|
||||
>
|
||||
<template #prepend>${column.fieldComment}</template>
|
||||
</el-input>
|
||||
#end
|
||||
#if($column.formType.equals(2))
|
||||
<el-select
|
||||
v-model="queryParams.${column.fieldName}"
|
||||
clearable
|
||||
placeholder="请选择${column.fieldComment}"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in ${column.fieldName}Dict"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
#end
|
||||
#if($column.formType.equals(5))
|
||||
<el-input-number
|
||||
v-model="queryParams.${column.fieldName}"
|
||||
:min="1"
|
||||
:max="100"
|
||||
maxlength="50"
|
||||
controls-position="right"
|
||||
placeholder="请输入${column.fieldComment}"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
#end
|
||||
#if($column.formType.equals(9))
|
||||
<el-date-picker
|
||||
v-model="queryParams.${column.fieldName}Range"
|
||||
clearable
|
||||
end-placeholder="${column.fieldComment} - 截止时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
range-separator="~"
|
||||
start-placeholder="${column.fieldComment} - 开始时间"
|
||||
type="datetimerange"
|
||||
/>
|
||||
#end
|
||||
</el-form-item>
|
||||
#end
|
||||
#end
|
||||
<template v-if="queryShowMore">
|
||||
<el-form-item prop="gmtModifiedRange">
|
||||
<el-date-picker
|
||||
v-model="queryParams.gmtModifiedRange"
|
||||
clearable
|
||||
end-placeholder="数据更新 - 截止时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
range-separator="~"
|
||||
start-placeholder="数据更新 - 开始时间"
|
||||
type="datetimerange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="gmtCreateRange">
|
||||
<el-date-picker
|
||||
v-model="queryParams.gmtCreateRange"
|
||||
clearable
|
||||
end-placeholder="数据创建 - 截止时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
range-separator="~"
|
||||
start-placeholder="数据创建 - 开始时间"
|
||||
type="datetimerange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
:disabled="loading"
|
||||
icon="search"
|
||||
type="primary"
|
||||
@click="handleQuery"
|
||||
>
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button
|
||||
:disabled="loading"
|
||||
icon="RefreshLeft"
|
||||
@click="handleResetQuery"
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
text
|
||||
@click="queryShowMore = !queryShowMore"
|
||||
>
|
||||
{{ queryShowMore ? '收起' : '展开' }}
|
||||
<el-icon>
|
||||
<component :is="queryShowMore ? 'ArrowUp' : 'ArrowDown'"></component>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="_table-opt">
|
||||
<div>
|
||||
<el-button
|
||||
v-permission="'${btnPermPrefix}:add'"
|
||||
:size="settingsStore.button.size"
|
||||
icon="DocumentAdd"
|
||||
type="primary"
|
||||
@click="handleOpenEditDialog()"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<ButtonComponent
|
||||
v-permission="'${btnPermPrefix}:delete'"
|
||||
:size="settingsStore.button.size"
|
||||
:disabled="loading"
|
||||
icon="Delete"
|
||||
type="danger"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
删除
|
||||
</ButtonComponent>
|
||||
</div>
|
||||
<div>
|
||||
#if($exportExcel)
|
||||
<el-tooltip content="导出">
|
||||
<el-button
|
||||
v-permission="'${btnPermPrefix}:export'"
|
||||
:size="settingsStore.button.size"
|
||||
:loading="excelLoading"
|
||||
circle
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
#end
|
||||
#if($importExcel)
|
||||
<el-tooltip content="导入">
|
||||
<el-upload
|
||||
ref="uploadExcel"
|
||||
v-permission="'${btnPermPrefix}:import'"
|
||||
:http-request="handleUploadExcel"
|
||||
:limit="1"
|
||||
:on-exceed="handleExcelExceed"
|
||||
:show-file-list="false"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button
|
||||
:size="settingsStore.button.size"
|
||||
:loading="excelLoading"
|
||||
circle
|
||||
icon="Upload"
|
||||
/>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-tooltip>
|
||||
#end
|
||||
<el-tooltip content="刷新">
|
||||
<el-button
|
||||
:size="settingsStore.button.size"
|
||||
:disabled="loading"
|
||||
circle
|
||||
icon="refresh"
|
||||
@click="handleRefreshQuery"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 表格组件 -->
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
:element-loading-spinner="defaults.settings.loading.svg"
|
||||
:element-loading-svg-view-box="defaults.settings.loading.viewBox"
|
||||
:element-loading-text="defaults.settings.loading.text"
|
||||
cell-class-name="_table-cell"
|
||||
class="_table"
|
||||
height="100%"
|
||||
highlight-current-row
|
||||
row-key="id"
|
||||
v-bind="settingsStore.table"
|
||||
>
|
||||
<el-table-column type="selection" width="42"/>
|
||||
<el-table-column label="序号" type="index" width="64"/>
|
||||
#foreach($column in ${columnList})
|
||||
#if($column.isShowInList && !$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
#if($column.formType.equals(2))
|
||||
<el-table-column label="${column.fieldComment}" width="120">
|
||||
<template #default="scope">
|
||||
<DictComponent :value="scope.row.${column.fieldName}" :dict-list="${column.fieldName}Dict"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
#else
|
||||
<el-table-column label="${column.fieldComment}" prop="${column.fieldName}" width="120"/>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
<el-table-column label="创建时间" prop="gmtCreate" width="168"/>
|
||||
<el-table-column label="更新时间" prop="gmtModified" width="168"/>
|
||||
<el-table-column fixed="right" label="操作">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-permission="'${btnPermPrefix}:view'"
|
||||
icon="View"
|
||||
size="small"
|
||||
text
|
||||
type="success"
|
||||
@click="handleOpenEditDialog(scope.row.id, true)"
|
||||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-permission="'${btnPermPrefix}:edit'"
|
||||
icon="Edit"
|
||||
size="small"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleOpenEditDialog(scope.row.id)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<ButtonComponent
|
||||
v-permission="'${btnPermPrefix}:delete'"
|
||||
icon="Delete"
|
||||
size="small" text
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</ButtonComponent>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<PagingComponent
|
||||
v-model:currentPage="pageReq.currentPage"
|
||||
v-model:page-size="pageReq.pageSize"
|
||||
:disabled="loading"
|
||||
:total="tableTotal"
|
||||
@size-change="handleQuery"
|
||||
@current-change="fetchData"
|
||||
/>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<el-dialog
|
||||
:close-on-click-modal="settingsStore.dialog.modalClose"
|
||||
:close-on-press-escape="settingsStore.dialog.escClose"
|
||||
v-model="editDialog.visible"
|
||||
:title="editDialog.title"
|
||||
class="_dialog-x1_5"
|
||||
@close="handleCloseEditDialog"
|
||||
>
|
||||
<el-form
|
||||
class="_edit-form2"
|
||||
ref="editFormRef"
|
||||
:model="editFormData"
|
||||
:rules="editRules"
|
||||
v-loading="editDialog.loading"
|
||||
:element-loading-spinner="defaults.settings.loading.svg"
|
||||
:element-loading-svg-view-box="defaults.settings.loading.viewBox"
|
||||
:element-loading-text="defaults.settings.loading.text"
|
||||
>
|
||||
#foreach($column in ${columnList})
|
||||
#if($column.isShowInForm && !$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
<el-form-item prop="${column.fieldName}">
|
||||
<template #label>
|
||||
<FormLabelComponent label="${column.fieldComment}"/>
|
||||
</template>
|
||||
#if($column.formType.equals(1))
|
||||
<el-input
|
||||
v-model="editFormData.${column.fieldName}"
|
||||
:disabled="editDialog.detail"
|
||||
clearable
|
||||
maxlength="${column.maxLength}"
|
||||
placeholder="请输入${column.fieldComment}"
|
||||
/>
|
||||
#end
|
||||
#if($column.formType.equals(2))
|
||||
<el-select
|
||||
v-model="editFormData.${column.fieldName}"
|
||||
:disabled="editDialog.detail"
|
||||
clearable
|
||||
placeholder="请选择${column.fieldComment}"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in ${column.fieldName}Dict"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
#end
|
||||
#if($column.formType.equals(5))
|
||||
<el-input-number
|
||||
v-model="editFormData.${column.fieldName}"
|
||||
:min="1"
|
||||
:max="100"
|
||||
controls-position="right"
|
||||
:disabled="editDialog.detail"
|
||||
maxlength="${column.maxLength}"
|
||||
placeholder="请输入${column.fieldComment}"
|
||||
/>
|
||||
#end
|
||||
#if($column.formType.equals(9))
|
||||
<el-date-picker
|
||||
v-model="editFormData.${column.fieldName}"
|
||||
:disabled="editDialog.detail"
|
||||
clearable
|
||||
placeholder="请选择${column.fieldComment}"
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
/>
|
||||
#end
|
||||
</el-form-item>
|
||||
#end
|
||||
#end
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div v-if="!editDialog.detail" class="dialog-footer">
|
||||
<el-button
|
||||
:loading="editDialog.saving"
|
||||
icon="Finished"
|
||||
type="primary"
|
||||
@click="handleSaveEdit"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
<el-button icon="Close" @click="handleCloseEditDialog">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import {computed, onMounted, reactive, ref} from "vue";
|
||||
import {TableInstance#if($importExcel), genFileId, UploadInstance, UploadProps, UploadRawFile#end} from "element-plus";
|
||||
import {HttpCancelToken} from "@/plugins/axios";
|
||||
#if($maskList.size() > 0)
|
||||
import {CommonUtils} from "@/utils";
|
||||
#end
|
||||
import {defaults} from "@/settings";
|
||||
import {useSettingsStore} from "@/store";
|
||||
#if($dictList.size() > 0)
|
||||
import {DictItem, PageReq, PageResult} from "@/types/global";
|
||||
import SysCommonAPI from "@/api/sys/sys-common-api";
|
||||
#else
|
||||
import {PageReq} from "@/types/global";
|
||||
#end
|
||||
#if($exportExcel)
|
||||
import {FileUtils, Format} from "@/utils/utils";
|
||||
#end
|
||||
import ${table.entityName}API, {
|
||||
EditForm as ${table.entityName}EditForm,
|
||||
PageQuery as ${table.entityName}PageQuery,
|
||||
PageResp as ${table.entityName}PageResp
|
||||
} from "@/api/${subModuleName}/${apiPath}";
|
||||
|
||||
defineOptions({
|
||||
// 组件名称
|
||||
name: "${table.entityName}"
|
||||
});
|
||||
// 系统设置信息
|
||||
const settingsStore = computed(() => useSettingsStore());
|
||||
|
||||
// 搜索表单
|
||||
const queryFormRef = ref();
|
||||
const queryParams = reactive<${table.entityName}PageQuery>({});
|
||||
const queryShowMore = ref(false);
|
||||
|
||||
// 分页请求参数
|
||||
const pageReq = reactive<PageReq<${table.entityName}PageQuery>>({
|
||||
currentPage: defaults.paging.currentPage,
|
||||
pageSize: settingsStore.value.paging.defPageSize,
|
||||
query: queryParams
|
||||
});
|
||||
|
||||
// 分页加载状态
|
||||
const loading = ref(false);
|
||||
// 表格数据
|
||||
const tableRef = ref<TableInstance>();
|
||||
const tableData = ref<${table.entityName}PageResp[]>();
|
||||
// 数据总数
|
||||
const tableTotal = ref(0);
|
||||
|
||||
// 编辑弹窗
|
||||
const editDialog = reactive({
|
||||
// 弹窗标题
|
||||
title: '',
|
||||
// 是否显示弹窗
|
||||
visible: false,
|
||||
// 查看详情
|
||||
detail: false,
|
||||
// 数据加载中
|
||||
loading: false,
|
||||
// 保存中
|
||||
saving: false,
|
||||
// 获取数据源
|
||||
getByIdSource: undefined as any,
|
||||
});
|
||||
|
||||
// 编辑表单
|
||||
const editFormRef = ref();
|
||||
const editFormData = reactive<${table.entityName}EditForm>({});
|
||||
#if($maskList.size() > 0)
|
||||
let originalEditFormData = {} as any;
|
||||
#end
|
||||
// 编辑表单校验规则
|
||||
const editRules = reactive({
|
||||
#foreach($column in ${columnList})
|
||||
#if(!$column.isPk.equals(1) && !$column.fieldName.equals("gmtCreate") && !$column.fieldName.equals("gmtModified"))
|
||||
#if(!$column.isRequired)// #end${column.fieldName}: [{required: true, message: "请#if($column.formType.equals(2) || $column.formType.equals(9))选择#else输入#end${column.fieldComment}", trigger: "blur"}],
|
||||
#end
|
||||
#end
|
||||
});
|
||||
#if($exportExcel || $importExcel)
|
||||
|
||||
// excel加载中
|
||||
const excelLoading = ref(false);
|
||||
#end
|
||||
#if($importExcel)
|
||||
// 上传表格文件
|
||||
const uploadExcel = ref<UploadInstance>();
|
||||
#end
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
*/
|
||||
function handleQuery() {
|
||||
pageReq.currentPage = defaults.paging.currentPage;
|
||||
fetchData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置搜索
|
||||
*/
|
||||
function handleResetQuery() {
|
||||
pageReq.currentPage = defaults.paging.currentPage;
|
||||
queryFormRef.value.resetFields();
|
||||
fetchData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
function handleRefreshQuery() {
|
||||
fetchData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询数据
|
||||
*/
|
||||
function fetchData() {
|
||||
if (loading.value) {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
// 清空多选
|
||||
tableRef.value?.clearSelection();
|
||||
// 请求数据
|
||||
${table.entityName}API.getPage(pageReq).then((resp: PageResult<${table.entityName}PageResp>) => {
|
||||
tableData.value = resp.data;
|
||||
tableTotal.value = resp.total;
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表格选中的ID
|
||||
*/
|
||||
function getTableSelectIds() {
|
||||
return tableRef.value?.getSelectionRows().map((item: any) => item.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开编辑弹窗
|
||||
* @param id ID
|
||||
* @param detail 是否查看详情
|
||||
*/
|
||||
function handleOpenEditDialog(id?: number, detail?: boolean) {
|
||||
if (editDialog.loading) {
|
||||
return;
|
||||
}
|
||||
editDialog.visible = true;
|
||||
editDialog.detail = detail || false;
|
||||
|
||||
if (id) {
|
||||
editDialog.loading = true;
|
||||
// 创建请求源
|
||||
editDialog.getByIdSource = HttpCancelToken.source();
|
||||
editDialog.title = detail ? '查看详情' : '编辑';
|
||||
${table.entityName}API.getById(id, editDialog.getByIdSource.token).then((resp: any) => {
|
||||
#if($maskList.size() > 0)
|
||||
originalEditFormData = CommonUtils.copyObj(resp);
|
||||
#end
|
||||
Object.assign(editFormData, resp);
|
||||
}).finally(() => {
|
||||
editDialog.loading = false;
|
||||
});
|
||||
} else {
|
||||
editFormData.id = undefined;
|
||||
editDialog.title = '新增';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭编辑弹窗
|
||||
*/
|
||||
function handleCloseEditDialog() {
|
||||
// 取消请求
|
||||
editDialog.getByIdSource?.cancel();
|
||||
editDialog.getByIdSource = undefined;
|
||||
editDialog.loading = false;
|
||||
|
||||
editDialog.visible = false;
|
||||
|
||||
editFormRef.value.resetFields();
|
||||
editFormRef.value.clearValidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存编辑结果
|
||||
*/
|
||||
function handleSaveEdit() {
|
||||
editFormRef.value.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
editDialog.saving = true;
|
||||
const id = editFormData.id;
|
||||
if (id) {
|
||||
#foreach($column in ${maskList})
|
||||
const updateData = CommonUtils.copyObj(editFormData);
|
||||
if (editFormData.${column.fieldName} === originalEditFormData.${column.fieldName}) {
|
||||
delete updateData.${column.fieldName};
|
||||
}
|
||||
#end
|
||||
#if($maskList.size() > 0)
|
||||
${table.entityName}API.update(updateData).then(() => {
|
||||
#else
|
||||
${table.entityName}API.update(editFormData).then(() => {
|
||||
#end
|
||||
ElMessage.success("保存成功");
|
||||
handleCloseEditDialog();
|
||||
handleRefreshQuery();
|
||||
}).finally(() => {
|
||||
editDialog.saving = false;
|
||||
});
|
||||
} else {
|
||||
${table.entityName}API.add(editFormData).then(() => {
|
||||
ElMessage.success("保存成功");
|
||||
handleCloseEditDialog();
|
||||
handleRefreshQuery();
|
||||
}).finally(() => {
|
||||
editDialog.saving = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param id ID
|
||||
*/
|
||||
async function handleDelete(id?: string) {
|
||||
let ids: Array<string> = [];
|
||||
if (id) {
|
||||
ids.push(id);
|
||||
} else {
|
||||
ids = getTableSelectIds() || [];
|
||||
if (ids.length <= 0) {
|
||||
ElMessage.warning("请选择要删除的数据");
|
||||
return;
|
||||
}
|
||||
}
|
||||
await ElMessageBox.confirm("确认删除已选中的数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}).then(
|
||||
async () => {
|
||||
await ${table.entityName}API.deleteByIds(ids).then(() => {
|
||||
ElMessage.success("删除成功");
|
||||
handleRefreshQuery();
|
||||
});
|
||||
},
|
||||
() => {
|
||||
ElMessage.info("已取消删除");
|
||||
}
|
||||
);
|
||||
}
|
||||
#if($exportExcel)
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
function handleExport() {
|
||||
if (excelLoading.value) {
|
||||
return;
|
||||
}
|
||||
excelLoading.value = true;
|
||||
${table.entityName}API.export(queryParams).then((resp: any) => {
|
||||
FileUtils.save(resp.data, "$!{table.businessName}_" + Format.date(new Date(), 'yyyyMMDDHHmm') + ".xlsx");
|
||||
}).finally(() => {
|
||||
excelLoading.value = false;
|
||||
});
|
||||
}
|
||||
#end
|
||||
#if($importExcel)
|
||||
|
||||
/**
|
||||
* 替换上传文件
|
||||
* @param files 文件列表
|
||||
*/
|
||||
const handleExcelExceed: UploadProps['onExceed'] = (files) => {
|
||||
uploadExcel.value!.clearFiles();
|
||||
const file = files[0] as UploadRawFile;
|
||||
file.uid = genFileId();
|
||||
uploadExcel.value!.handleStart(file);
|
||||
uploadExcel.value!.submit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
const handleUploadExcel: any = async (options: any) => {
|
||||
if (excelLoading.value) {
|
||||
return;
|
||||
}
|
||||
const file = options.file;
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
excelLoading.value = true;
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
${table.entityName}API.import(formData).then(() => {
|
||||
ElMessage.success("导入成功");
|
||||
handleRefreshQuery();
|
||||
}).finally(() => {
|
||||
excelLoading.value = false;
|
||||
});
|
||||
};
|
||||
#end
|
||||
|
||||
#foreach($column in ${dictList})
|
||||
// ${column.fieldComment}字典
|
||||
const ${column.fieldName}Dict = ref<Array<DictItem>>([]);
|
||||
#end
|
||||
|
||||
/**
|
||||
* 页面加载后执行
|
||||
*/
|
||||
onMounted(() => {
|
||||
#foreach($column in ${dictList})
|
||||
SysCommonAPI.getByCode('${column.dictType}').then((resp: any) => {
|
||||
${column.fieldName}Dict.value = resp;
|
||||
});
|
||||
#end
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user