parent
37153ca7c3
commit
8a9c673cd5
@ -1,133 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
|
||||||
import com.bryx.core.common.base.entity.PageReq;
|
|
||||||
import com.bryx.core.common.base.entity.ResultEntity;
|
|
||||||
import com.bryx.core.operlog.enums.BusinessType;
|
|
||||||
import com.bryx.core.common.util.ExcelUtil2;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import com.bryx.core.operlog.annotation.Log;
|
|
||||||
import com.bryx.core.security.annotation.PreAuth;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import ${packageName}.model.entity.${ClassName};
|
|
||||||
import ${packageName}.pojo.query.${ClassName}Query;
|
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
/**
|
|
||||||
* ${functionName}Controller
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/${className}")
|
|
||||||
@Tag(name = "${functionName}")
|
|
||||||
@Log(title = "${ClassName}Controller")
|
|
||||||
public class ${ClassName}Controller {
|
|
||||||
@Autowired
|
|
||||||
private I${ClassName}Service ${className}Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询${functionName}列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/list")
|
|
||||||
@PreAuth(hasPerm = "${rootPermission}:${className}:list")
|
|
||||||
@Log(title = "Demo-Test", businessType = BusinessType.SELECT)
|
|
||||||
public ResultEntity<PageInfo<${ClassName}>> list(${ClassName}Query ${className}Query, PageReq pageable) {
|
|
||||||
List<${ClassName}> list = ${className}Service.selectByCondition(${className}Query, pageable);
|
|
||||||
return ResultEntity.of(new PageInfo<>(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出${functionName}列表
|
|
||||||
*/
|
|
||||||
@PreAuth(hasPerm = "${rootPermission}:${className}:export')")
|
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
|
||||||
@GetMapping("/export")
|
|
||||||
public void export(${ClassName}Query ${className}Query, HttpServletResponse response) throws IOException {
|
|
||||||
List<${ClassName}> list = ${className}Service.selectByCondition(${className}Query);
|
|
||||||
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
|
||||||
map.put("${column.javaField}", "${column.genLabel()}");
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
String name = "${functionName}_" + DatePattern.PURE_DATETIME_FORMAT.format(new Date());
|
|
||||||
|
|
||||||
response.setHeader("Access-Control-Expose-Headers", "Content-disposition,Content-Type");
|
|
||||||
response.setContentType("application/vnd.ms-excel");
|
|
||||||
response.setHeader("Content-disposition",
|
|
||||||
"attachment;filename*=utf-8''" + URLEncoder.encode(name, "UTF-8") + ".xlsx");
|
|
||||||
response.setCharacterEncoding("utf-8");
|
|
||||||
|
|
||||||
ExcelUtil2.export2(list, response.getOutputStream(), map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入${functionName}列表
|
|
||||||
*/
|
|
||||||
@PreAuth(hasPerm = "${rootPermission}:${className}:import')")
|
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.IMPORT)
|
|
||||||
@PostMapping("/importData")
|
|
||||||
public ResultEntity<Integer> importData(MultipartFile file) throws Exception {
|
|
||||||
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(!$table.isSuperColumn($column.javaField) && $column.javaField != $pkColumn.javaField)
|
|
||||||
map.put("${column.genLabel()}", "${column.javaField}");
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
List<${ClassName}> list = ExcelUtil2.importExcel(file.getInputStream(), ${ClassName}.class, map);
|
|
||||||
int message = ${className}Service.batchInsert(list);
|
|
||||||
return ResultEntity.of(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取${functionName}详细信息
|
|
||||||
*/
|
|
||||||
@PreAuth(hasPerm = "${rootPermission}:${className}:query')")
|
|
||||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
|
||||||
public ResultEntity<${ClassName}> getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
|
|
||||||
return ResultEntity.of(${className}Service.selectByPrimaryKey(${pkColumn.javaField}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增${functionName}
|
|
||||||
*/
|
|
||||||
@PreAuth(hasPerm = "${rootPermission}:${className}:add')")
|
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public ResultEntity<${ClassName}> add(@RequestBody ${ClassName} ${className}) {
|
|
||||||
${className}Service.insert(${className});
|
|
||||||
return ResultEntity.of(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改${functionName}
|
|
||||||
*/
|
|
||||||
@PreAuth(hasPerm = "${rootPermission}:${className}:edit')")
|
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public ResultEntity<${ClassName}> edit(@RequestBody ${ClassName} ${className}) {
|
|
||||||
${className}Service.updateByPrimaryKey(${className});
|
|
||||||
return ResultEntity.of(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除${functionName}
|
|
||||||
*/
|
|
||||||
@PreAuth(hasPerm = "${rootPermission}:${className}:remove')")
|
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
|
||||||
public ResultEntity<Integer> remove(@PathVariable List<${pkColumn.javaType}> ${pkColumn.javaField}s) {
|
|
||||||
int re = ${className}Service.deleteByPrimaryKeys(${pkColumn.javaField}s);
|
|
||||||
return ResultEntity.of(re);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
#foreach ($import in $importList)
|
|
||||||
import ${import};
|
|
||||||
#end
|
|
||||||
#if(($table.crud || $table.sub) && $table.audit == 1)
|
|
||||||
import ${env.baseAudit};
|
|
||||||
#elseif($table.tree)
|
|
||||||
import ${env.baseAudit};
|
|
||||||
#end
|
|
||||||
import lombok.Data;
|
|
||||||
/**
|
|
||||||
* ${functionName}对象 ${tableName}
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
#if(($table.crud || $table.sub) && $table.audit == 1)
|
|
||||||
#set($Entity="BaseAudit")
|
|
||||||
#elseif($table.tree)
|
|
||||||
#set($Entity="TreeEntity")
|
|
||||||
#end
|
|
||||||
@Data
|
|
||||||
public class ${ClassName}#if($Entity) extends ${Entity}#end {
|
|
||||||
private static final long serialVersionUID = -1L;
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
|
||||||
|
|
||||||
#if($column.columnComment)
|
|
||||||
/** $column.columnComment */
|
|
||||||
#end
|
|
||||||
private $column.javaType $column.javaField;
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
#foreach ($import in $importList)
|
|
||||||
import ${import};
|
|
||||||
#end
|
|
||||||
#if(($table.crud || $table.sub) && $table.audit == 1)
|
|
||||||
import ${env.baseAudit};
|
|
||||||
#elseif($table.tree)
|
|
||||||
import ${env.baseAudit};
|
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
import ${packageName}.${javaPath.pojo}.dto.${subClassName}DTO;
|
|
||||||
#end
|
|
||||||
import lombok.Data;
|
|
||||||
/**
|
|
||||||
* ${functionName} DTO 对象
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
#if(($table.crud || $table.sub) && $table.audit == 1)
|
|
||||||
#set($Entity="BaseAudit")
|
|
||||||
#elseif($table.tree)
|
|
||||||
#set($Entity="TreeEntity")
|
|
||||||
#end
|
|
||||||
@Data
|
|
||||||
public class ${ClassName}DTO#if($Entity) extends ${Entity}#end {
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
|
||||||
|
|
||||||
#if($column.columnComment)
|
|
||||||
/** $column.columnComment */
|
|
||||||
#end
|
|
||||||
private $column.javaType $column.javaField;
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
|
|
||||||
#if($table.sub)
|
|
||||||
private List<${subClassName}DTO> ${subclassName}List;
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
@ -1,302 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
public class ${ClassName}Example {
|
|
||||||
protected String orderByClause;
|
|
||||||
|
|
||||||
protected boolean distinct;
|
|
||||||
|
|
||||||
protected List<Criteria> oredCriteria;
|
|
||||||
|
|
||||||
public ${ClassName}Example() {
|
|
||||||
oredCriteria = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderByClause(String orderByClause) {
|
|
||||||
this.orderByClause = orderByClause;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrderByClause() {
|
|
||||||
return orderByClause;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDistinct(boolean distinct) {
|
|
||||||
this.distinct = distinct;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDistinct() {
|
|
||||||
return distinct;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criteria> getOredCriteria() {
|
|
||||||
return oredCriteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void or(Criteria criteria) {
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria or() {
|
|
||||||
Criteria criteria = createCriteriaInternal();
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria createCriteria() {
|
|
||||||
Criteria criteria = createCriteriaInternal();
|
|
||||||
if (oredCriteria.size() == 0) {
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
}
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criteria createCriteriaInternal() {
|
|
||||||
Criteria criteria = new Criteria();
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
oredCriteria.clear();
|
|
||||||
orderByClause = null;
|
|
||||||
distinct = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract static class GeneratedCriteria {
|
|
||||||
protected List<Criterion> criteria;
|
|
||||||
|
|
||||||
protected GeneratedCriteria() {
|
|
||||||
super();
|
|
||||||
criteria = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid() {
|
|
||||||
return criteria.size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> getAllCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> getCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition) {
|
|
||||||
if (condition == null) {
|
|
||||||
throw new RuntimeException("Value for condition cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value, String property) {
|
|
||||||
if (value == null) {
|
|
||||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
|
||||||
if (value1 == null || value2 == null) {
|
|
||||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition, value1, value2));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterionForJDBCDate(String condition, Date value, String property) {
|
|
||||||
if (value == null) {
|
|
||||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
addCriterion(condition, new java.sql.Date(value.getTime()), property);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) {
|
|
||||||
if (values == null || values.size() == 0) {
|
|
||||||
throw new RuntimeException("Value list for " + property + " cannot be null or empty");
|
|
||||||
}
|
|
||||||
List<java.sql.Date> dateList = new ArrayList<>();
|
|
||||||
Iterator<Date> iter = values.iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
dateList.add(new java.sql.Date(iter.next().getTime()));
|
|
||||||
}
|
|
||||||
addCriterion(condition, dateList, property);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) {
|
|
||||||
if (value1 == null || value2 == null) {
|
|
||||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);
|
|
||||||
}
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
public Criteria and${column.capJavaField}IsNull() {
|
|
||||||
addCriterion("${column.columnName} is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}IsNotNull() {
|
|
||||||
addCriterion("${column.columnName} is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}EqualTo(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} =", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}NotEqualTo(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} <>", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}GreaterThan(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} >", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}GreaterThanOrEqualTo(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} >=", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}LessThan(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} <", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}LessThanOrEqualTo(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} <=", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
#if($column.javaType == 'String')
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}Like(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} like", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}NotLike(${column.javaType} value) {
|
|
||||||
addCriterion("${column.columnName} not like", value, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
#end
|
|
||||||
public Criteria and${column.capJavaField}In(List<${column.javaType}> values) {
|
|
||||||
addCriterion("${column.columnName} in", values, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}NotIn(List<${column.javaType}> values) {
|
|
||||||
addCriterion("${column.columnName} not in", values, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}Between(${column.javaType} value1, ${column.javaType} value2) {
|
|
||||||
addCriterion("${column.columnName} between", value1, value2, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria and${column.capJavaField}NotBetween(${column.javaType} value1, ${column.javaType} value2) {
|
|
||||||
addCriterion("${column.columnName} not between", value1, value2, "${column.javaField}");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
|
||||||
protected Criteria() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Criterion {
|
|
||||||
private String condition;
|
|
||||||
|
|
||||||
private Object value;
|
|
||||||
|
|
||||||
private Object secondValue;
|
|
||||||
|
|
||||||
private boolean noValue;
|
|
||||||
|
|
||||||
private boolean singleValue;
|
|
||||||
|
|
||||||
private boolean betweenValue;
|
|
||||||
|
|
||||||
private boolean listValue;
|
|
||||||
|
|
||||||
private String typeHandler;
|
|
||||||
|
|
||||||
public String getCondition() {
|
|
||||||
return condition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getSecondValue() {
|
|
||||||
return secondValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNoValue() {
|
|
||||||
return noValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSingleValue() {
|
|
||||||
return singleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBetweenValue() {
|
|
||||||
return betweenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isListValue() {
|
|
||||||
return listValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeHandler() {
|
|
||||||
return typeHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.typeHandler = null;
|
|
||||||
this.noValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, String typeHandler) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.value = value;
|
|
||||||
this.typeHandler = typeHandler;
|
|
||||||
if (value instanceof List<?>) {
|
|
||||||
this.listValue = true;
|
|
||||||
} else {
|
|
||||||
this.singleValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value) {
|
|
||||||
this(condition, value, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.value = value;
|
|
||||||
this.secondValue = secondValue;
|
|
||||||
this.typeHandler = typeHandler;
|
|
||||||
this.betweenValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, Object secondValue) {
|
|
||||||
this(condition, value, secondValue, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,129 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import ${packageName}.model.entity.${ClassName};
|
|
||||||
import ${packageName}.pojo.dao.${ClassName}Example;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${functionName}Mapper接口
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface ${ClassName}Mapper {
|
|
||||||
/**
|
|
||||||
* ${functionName}总数
|
|
||||||
*
|
|
||||||
* @param example 入参
|
|
||||||
* @return 总数
|
|
||||||
*/
|
|
||||||
long countByExample(${ClassName}Example example);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件批量删除${functionName}
|
|
||||||
*
|
|
||||||
* @param example 入参
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteByExample(${ClassName}Example example);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键删除${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} 主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteByPrimaryKey(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insert(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入或更新${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insertOrUpdate(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入或更新${functionName}非空属性
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insertOrUpdateSelective(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入${functionName}非空属性
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insertSelective(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入${functionName}
|
|
||||||
*
|
|
||||||
* @param list ${functionName}列表
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int batchInsert(@Param("list") List<${ClassName}> list);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件查询${functionName}
|
|
||||||
*
|
|
||||||
* @param example 条件
|
|
||||||
* @return 列表
|
|
||||||
*/
|
|
||||||
List<${ClassName}> selectByExample(${ClassName}Example example);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键查询${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} 主键
|
|
||||||
* @return ${functionName}
|
|
||||||
*/
|
|
||||||
${ClassName} selectByPrimaryKey(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件批量更新${functionName}, 过滤非空属性
|
|
||||||
*
|
|
||||||
* @param ${className} 更新内容
|
|
||||||
* @param example 条件
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateByExampleSelective(@Param("record") ${ClassName} ${className}, @Param("example") ${ClassName}Example example);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件批量更新${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} 更新内容
|
|
||||||
* @param example 条件
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateByExample(@Param("record") ${ClassName} ${className}, @Param("example") ${ClassName}Example example);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键更新${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} 更新内容
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateByPrimaryKeySelective(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键更新${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} 更新内容
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateByPrimaryKey(${ClassName} ${className});
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${functionName} 查询 对象
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
public class ${ClassName}Query {
|
|
||||||
}
|
|
||||||
@ -1,117 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import ${packageName}.model.entity.${ClassName};
|
|
||||||
import ${packageName}.pojo.query.${ClassName}Query;
|
|
||||||
import com.bryx.core.common.base.entity.IPageable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${functionName}Service接口
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
public interface I${ClassName}Service {
|
|
||||||
/**
|
|
||||||
* 删除 ${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteByPrimaryKey(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键,批量删除 ${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField}s ${functionName}主键列表
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteByPrimaryKeys(List<${pkColumn.javaType}> ${pkColumn.javaField}s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insert(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增 或 修改 ${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insertOrUpdate(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增 或 修改 ${functionName}, 非空字段
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insertOrUpdateSelective(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增${functionName}, 非空字段
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insertSelective(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键,查询 ${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return ${functionName}
|
|
||||||
*/
|
|
||||||
${ClassName} selectByPrimaryKey(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件,查询 ${functionName}
|
|
||||||
*
|
|
||||||
* @param query ${functionName}条件
|
|
||||||
* @return ${functionName}
|
|
||||||
*/
|
|
||||||
List<${ClassName}> selectByCondition(${ClassName}Query query);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件,分页查询 ${functionName}
|
|
||||||
*
|
|
||||||
* @param query ${functionName}条件
|
|
||||||
* @return ${functionName}
|
|
||||||
*/
|
|
||||||
List<${ClassName}> selectByCondition(${ClassName}Query query, IPageable page);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键修改${functionName},过滤非空
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateByPrimaryKeySelective(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键修改${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateByPrimaryKey(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主键批量修改${functionName}
|
|
||||||
*
|
|
||||||
* @param list ${functionName}列表
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateBatch(List<${ClassName}> list);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入${functionName}
|
|
||||||
*
|
|
||||||
* @param list ${functionName}列表
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int batchInsert(List<${ClassName}> list);
|
|
||||||
}
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
#if($table.hasDate())
|
|
||||||
#foreach($date in $table.dateImports())
|
|
||||||
import $date;
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
import com.bryx.core.common.base.entity.IPageable;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import ${packageName}.mapper.${ClassName}Mapper;
|
|
||||||
import ${packageName}.model.entity.${ClassName};
|
|
||||||
import ${packageName}.pojo.query.${ClassName}Query;
|
|
||||||
import ${packageName}.pojo.dao.${ClassName}Example;
|
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${functionName}Service业务层处理
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|
||||||
@Autowired
|
|
||||||
private ${ClassName}Mapper ${className}Mapper;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int deleteByPrimaryKey(${pkColumn.javaType} ${pkColumn.javaField}) {
|
|
||||||
return ${className}Mapper.deleteByPrimaryKey(${pkColumn.javaField});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insert(${ClassName} ${className}) {
|
|
||||||
return ${className}Mapper.insert(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insertOrUpdate(${ClassName} ${className}) {
|
|
||||||
return ${className}Mapper.insertOrUpdate(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insertOrUpdateSelective(${ClassName} ${className}) {
|
|
||||||
return ${className}Mapper.insertOrUpdateSelective(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insertSelective(${ClassName} ${className}) {
|
|
||||||
return ${className}Mapper.insertSelective(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ${ClassName} selectByPrimaryKey(${pkColumn.javaType} ${pkColumn.javaField}) {
|
|
||||||
return ${className}Mapper.selectByPrimaryKey(${pkColumn.javaField});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateByPrimaryKeySelective(${ClassName} ${className}) {
|
|
||||||
return ${className}Mapper.updateByPrimaryKeySelective(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateByPrimaryKey(${ClassName} ${className}) {
|
|
||||||
return ${className}Mapper.updateByPrimaryKey(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateBatch(List<${ClassName}> list) {
|
|
||||||
return ${className}Mapper.batchInsert(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int batchInsert(List<${ClassName}> list) {
|
|
||||||
return ${className}Mapper.batchInsert(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<${ClassName}> selectByCondition(${ClassName}Query ${className}) {
|
|
||||||
${ClassName}Example example = new ${ClassName}Example();
|
|
||||||
return ${className}Mapper.selectByExample(example);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<${ClassName}> selectByCondition(${ClassName}Query ${className}Query, IPageable pageable) {
|
|
||||||
PageHelper.startPage(pageable.getPage(), pageable.getPageSize());
|
|
||||||
${ClassName}Example example = new ${ClassName}Example();
|
|
||||||
return ${className}Mapper.selectByExample(example);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int deleteByPrimaryKeys(List<Long> ids) {
|
|
||||||
${ClassName}Example example = new ${ClassName}Example();
|
|
||||||
example.createCriteria().andIdIn(ids);
|
|
||||||
return ${className}Mapper.deleteByExample(example);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
package ${fullPackage};
|
|
||||||
|
|
||||||
#foreach ($import in $importList)
|
|
||||||
import ${import};
|
|
||||||
#end
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
|
||||||
#if(${table.audit} == 1)
|
|
||||||
import ${env.baseAudit};
|
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
import ${packageName}.${javaPath.pojo}.dto.${subClassName}DTO;
|
|
||||||
#end
|
|
||||||
import lombok.Data;
|
|
||||||
/**
|
|
||||||
* ${functionName} 数据视图对象
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ${ClassName}VO #if(${table.audit} == 1)extends BaseAudit#end {
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
|
||||||
#if($column.isDate())
|
|
||||||
@JsonFormat(pattern = "${column.dateFormat}")
|
|
||||||
@Excel(name = "${column.genLabel()}", width = 30, dateFormat = "${column.dateFormat}")
|
|
||||||
#else
|
|
||||||
@Excel(name = "${column.genLabel()}")
|
|
||||||
#end
|
|
||||||
private $column.javaType $column.javaField;
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
private List<${subClassName}DTO> ${subclassName}List;
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
export function query${ClassName}Page (params) {
|
|
||||||
return request({
|
|
||||||
url: `/emergencyhandle-service/emergencyhandle/${className}/list`,
|
|
||||||
method: 'get',
|
|
||||||
params
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function query${ClassName}ById (id) {
|
|
||||||
return request({
|
|
||||||
url: `/emergencyhandle-service/emergencyhandle/${className}/` + id,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function add${ClassName} (data) {
|
|
||||||
return request({
|
|
||||||
url: `/emergencyhandle-service/emergencyhandle/${className}`,
|
|
||||||
method: 'post',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function update${ClassName} (data) {
|
|
||||||
return request({
|
|
||||||
url: `/emergencyhandle-service/emergencyhandle/${className}`,
|
|
||||||
method: 'put',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function delete${ClassName} (ids) {
|
|
||||||
return request({
|
|
||||||
url: `/emergencyhandle-service/emergencyhandle/${className}/` + ids.join(','),
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function export${ClassName} (params) {
|
|
||||||
return request({
|
|
||||||
url: `/emergencyhandle-service/emergencyhandle/${className}/export`,
|
|
||||||
method: 'get',
|
|
||||||
params,
|
|
||||||
responseType: 'blob'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function import${ClassName} (file) {
|
|
||||||
const formData = new FormData()
|
|
||||||
formData.append('file', file)
|
|
||||||
return request({
|
|
||||||
url: `/emergencyhandle-service/emergencyhandle/${className}/importData`,
|
|
||||||
method: 'post',
|
|
||||||
data: formData,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'multipart/form-data'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
.add_${className}_wrapper
|
|
||||||
a-form
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.edit)
|
|
||||||
a-form-item(label="${column.genLabel()}")
|
|
||||||
${column.genComponent()}(v-model="form.${column.javaField}")
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
a-button.mt16(type="primary" @click="add${ClassName}Click") 保存
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { add${ClassName}, query${ClassName}ById, update${ClassName} } from '@api/emergencyhandle/${className}'
|
|
||||||
import events from '@comp/MultiTab/events'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'Add',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
form: {
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.edit)
|
|
||||||
${column.javaField}: null,
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
const { id } = this.$route.query
|
|
||||||
if (id) {
|
|
||||||
this.init${ClassName}(id)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
add${ClassName}Click () {
|
|
||||||
const call = this.form.id ? update${ClassName} : add${ClassName};
|
|
||||||
call({ ...this.form }).then(res => {
|
|
||||||
this.$message.success('创建成功')
|
|
||||||
events.$emit('close')
|
|
||||||
})
|
|
||||||
},
|
|
||||||
init${ClassName} (id) {
|
|
||||||
query${ClassName}ById(id).then(res => {
|
|
||||||
this.form = res.data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus">
|
|
||||||
.add_${className}_wrapper
|
|
||||||
.ant-form
|
|
||||||
padding 1rem 0 0 1rem
|
|
||||||
background-color white
|
|
||||||
display flex
|
|
||||||
flex-wrap wrap
|
|
||||||
|
|
||||||
.ant-form-item
|
|
||||||
width calc(50% - 1rem)
|
|
||||||
margin-right 1rem
|
|
||||||
</style>
|
|
||||||
@ -1,165 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
.${className}_wrapper.base_query_page
|
|
||||||
.conds
|
|
||||||
a-form.flex_center(:label-col="{ span: 8 }" :wrapper-col="{ span: 16 }")
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.query)
|
|
||||||
a-form-item(label="${column.genLabel()}")
|
|
||||||
${column.genComponent()}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
div.tr
|
|
||||||
a-button(type="primary" @click="loadAll") 查询
|
|
||||||
.body.mt16
|
|
||||||
.ops.flex_center
|
|
||||||
.flex_one
|
|
||||||
| ${functionName}管理
|
|
||||||
.btns
|
|
||||||
a-button(type="primary" @click="add${ClassName}Click()") 新增
|
|
||||||
a-button(@click="importByExcel") 批量导入
|
|
||||||
a-button(@click="exportByExcel") 导出
|
|
||||||
.list
|
|
||||||
a-table(:columns="columns" :data-source="list" rowKey="id" :pagination="false")
|
|
||||||
span(slot="index" slot-scope="text, record, index") {{index + 1}}
|
|
||||||
span(slot="action" slot-scope="text, record")
|
|
||||||
a(@click="add${ClassName}Click(record.id)") 编辑
|
|
||||||
a-divider(type="vertical")
|
|
||||||
a(@click="deleteClick(record)") 删除
|
|
||||||
.pagination
|
|
||||||
a-pagination(v-model="pageReq.page"
|
|
||||||
:total="total"
|
|
||||||
:pageSize="pageReq.pageSize"
|
|
||||||
show-less-items
|
|
||||||
@change="changePage"
|
|
||||||
@showSizeChange="changePageSize"
|
|
||||||
)
|
|
||||||
a-modal(title="导入${functionName}"
|
|
||||||
:visible="importVisible"
|
|
||||||
okText="确认上传"
|
|
||||||
@ok="handleOk"
|
|
||||||
@cancel="importVisible = false")
|
|
||||||
a-upload(
|
|
||||||
name="file"
|
|
||||||
:multiple="false"
|
|
||||||
:customRequest="uploadFile"
|
|
||||||
:fileList="fileList"
|
|
||||||
:remove="removeFile"
|
|
||||||
)
|
|
||||||
a-button(v-if="fileList.length < 1")
|
|
||||||
a-icon(type="upload")
|
|
||||||
span 选择文件
|
|
||||||
.tr
|
|
||||||
a(@click="") 下载模板文件
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { export${ClassName}, import${ClassName}, query${ClassName}Page, delete${ClassName} } from '@api/emergencyhandle/${className}'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'Index',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
cond: {},
|
|
||||||
columns: [
|
|
||||||
{ title: '序号', scopedSlots: { customRender: 'index' } },
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.query)
|
|
||||||
{ title: '${column.genLabel()}', dataIndex: '${column.javaField}', key: '${column.javaField}' },
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
{ title: '操作', scopedSlots: { customRender: 'action' } }
|
|
||||||
],
|
|
||||||
list: [],
|
|
||||||
pageReq: {
|
|
||||||
page: 1,
|
|
||||||
pageSize: 20
|
|
||||||
},
|
|
||||||
total: 0,
|
|
||||||
importVisible: false,
|
|
||||||
fileList: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
this.loadAll()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
loadAll () {
|
|
||||||
query${ClassName}Page({ ...this.cond, ...this.pageReq }).then(res => {
|
|
||||||
const { total, list } = res.data
|
|
||||||
this.list = list
|
|
||||||
this.total = total
|
|
||||||
})
|
|
||||||
},
|
|
||||||
add${ClassName}Click (id) {
|
|
||||||
const obj = { path: '/${className}/edit', query: { id }};
|
|
||||||
this.$router.push(obj)
|
|
||||||
},
|
|
||||||
changePage (page) {
|
|
||||||
this.pageReq.page = page
|
|
||||||
this.loadAll()
|
|
||||||
},
|
|
||||||
changePageSize (size) {
|
|
||||||
this.pageReq.pageSize = size
|
|
||||||
this.pageReq.page = 1
|
|
||||||
this.loadAll()
|
|
||||||
},
|
|
||||||
exportByExcel () {
|
|
||||||
export${ClassName}()
|
|
||||||
.then(resp => {
|
|
||||||
const blob = resp.data
|
|
||||||
const url = window.URL.createObjectURL(blob)
|
|
||||||
const a = document.createElement('a')
|
|
||||||
a.style.display = 'none'
|
|
||||||
a.href = url
|
|
||||||
// the filename you want
|
|
||||||
a.download = '${functionName}.xlsx'
|
|
||||||
document.body.appendChild(a)
|
|
||||||
a.click()
|
|
||||||
window.URL.revokeObjectURL(url)
|
|
||||||
this.$message.success('导入成功!')
|
|
||||||
})
|
|
||||||
.catch(() => this.$message.error('导入失败!'))
|
|
||||||
},
|
|
||||||
importByExcel () {
|
|
||||||
this.importVisible = true
|
|
||||||
this.fileList = []
|
|
||||||
},
|
|
||||||
uploadFile (uploadObj) {
|
|
||||||
this.fileList.push(uploadObj.file)
|
|
||||||
},
|
|
||||||
removeFile (file) {
|
|
||||||
const index = this.fileList.findIndex(v => v === file)
|
|
||||||
this.fileList.splice(index, 1)
|
|
||||||
},
|
|
||||||
handleOk () {
|
|
||||||
if (this.fileList.length === 0) {
|
|
||||||
this.importVisible = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
import${ClassName}(this.fileList[0]).then(res => {
|
|
||||||
console.log(res)
|
|
||||||
this.loadAll()
|
|
||||||
}).finally(() => {
|
|
||||||
this.importVisible = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
deleteClick (row) {
|
|
||||||
this.$confirm({
|
|
||||||
title: '删除确认',
|
|
||||||
content: '确认删除 ' + row.userName + ' ?',
|
|
||||||
onOk: () => {
|
|
||||||
delete${ClassName}([row.id]).then(res => {
|
|
||||||
this.$message.success('删除成功!')
|
|
||||||
this.loadAll()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus">
|
|
||||||
.${className}_wrapper
|
|
||||||
padding 0
|
|
||||||
</style>
|
|
||||||
@ -1,290 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
|
||||||
<resultMap id="${ClassName}Result" type="${packageName}.model.entity.${ClassName}">
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
<result property="${column.javaField}" column="${column.columnName}"/>
|
|
||||||
#end
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()), #end#end
|
|
||||||
|
|
||||||
</sql>
|
|
||||||
<sql id="Base_Column_List_No_Pk">
|
|
||||||
#foreach($column in $columns)#if($column.javaField != $pkColumn.javaField)${column.columnName}#if($velocityCount != $columns.size()), #end#end#end
|
|
||||||
|
|
||||||
</sql>
|
|
||||||
<sql id="Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<sql id="Update_By_Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<select id="countByExample" parameterType="${packageName}.pojo.dao.${ClassName}Example" resultType="java.lang.Long">
|
|
||||||
select count(*) from ${tableName}
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByExample" parameterType="${packageName}.pojo.dao.${ClassName}Example">
|
|
||||||
delete from ${tableName}
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</delete>
|
|
||||||
<select id="selectByExample" parameterType="${packageName}.pojo.dao.${ClassName}Example" resultMap="${ClassName}Result">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from ${tableName}
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByPrimaryKey" parameterType="${pkColumn.javaType}" resultMap="${ClassName}Result">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from ${tableName}
|
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}, jdbcType=$pkColumn.CapColumnType}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="${pkColumn.javaType}">
|
|
||||||
delete from ${tableName}
|
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}, jdbcType=$pkColumn.CapColumnType}
|
|
||||||
</delete>
|
|
||||||
<insert id="insert" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
|
||||||
insert into ${tableName}
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)$column.columnName, #end
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)#{$column.javaField}, #end
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<insert id="insertSelective" keyColumn="$pkColumn.columnName" keyProperty="$pkColumn.javaField" parameterType="${ClassName}" useGeneratedKeys="true">
|
|
||||||
insert into ${tableName}
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="${ClassName}">
|
|
||||||
update ${tableName}
|
|
||||||
<set>
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">
|
|
||||||
$column.columnName = #{$column.javaField, jdbcType=$pkColumn.CapColumnType},
|
|
||||||
</if>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</set>
|
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}, jdbcType=$pkColumn.CapColumnType}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="${ClassName}">
|
|
||||||
update ${tableName}
|
|
||||||
<trim prefix="set " suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
$column.columnName = #{$column.javaField, jdbcType=$column.CapColumnType},
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}, jdbcType=$pkColumn.CapColumnType}
|
|
||||||
</update>
|
|
||||||
<update id="updateBatch" parameterType="java.util.List">
|
|
||||||
update ${tableName}
|
|
||||||
<trim prefix="set" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
<trim prefix="$pkColumn.columnName = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when ${pkColumn.columnName} = #{item.${pkColumn.javaField},jdbcType=$pkColumn.CapColumnType} then #{item.${column.javaField}, jdbcType=$column.CapColumnType}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
where ${pkColumn.columnName} in
|
|
||||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
||||||
#{item.$pkColumn.javaField,jdbcType=$pkColumn.CapColumnType}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
<update id="updateBatchSelective" parameterType="java.util.List">
|
|
||||||
update ${tableName}
|
|
||||||
<trim prefix="set" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
<trim prefix="$pkColumn.columnName = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">
|
|
||||||
when ${pkColumn.columnName} = #{item.${pkColumn.javaField},jdbcType=$pkColumn.CapColumnType} then #{item.${column.javaField}, jdbcType=$column.CapColumnType}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
where ${pkColumn.columnName} in
|
|
||||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
||||||
#{item.$pkColumn.javaField,jdbcType=$pkColumn.CapColumnType}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
<update id="updateByExampleSelective" parameterType="map">
|
|
||||||
update ${tableName}
|
|
||||||
<set>
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
<if test="record.$column.javaField != null">
|
|
||||||
$column.columnName = #{record.$column.javaField, jdbcType=$pkColumn.CapColumnType},
|
|
||||||
</if>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</set>
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</update>
|
|
||||||
<update id="updateByExample" parameterType="map">
|
|
||||||
update ${tableName}
|
|
||||||
set
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
$column.columnName = #{record.$column.javaField, jdbcType=$pkColumn.CapColumnType},
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</update>
|
|
||||||
<insert id="batchInsert" keyColumn="$pkColumn.columnName" keyProperty="$pkColumn.javaField" parameterType="map" useGeneratedKeys="true">
|
|
||||||
insert into ${tableName}
|
|
||||||
(<include refid="Base_Column_List_No_Pk" />)
|
|
||||||
values
|
|
||||||
<foreach collection="list" item="item" separator=",">
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)#if($column.javaField != $pkColumn.javaField)#{item.$column.javaField, jdbcType=$column.CapColumnType}, #end#end
|
|
||||||
</trim>
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
<insert id="insertOrUpdate" keyColumn="$pkColumn.columnName" keyProperty="$pkColumn.javaField" parameterType="${ClassName}" useGeneratedKeys="true">
|
|
||||||
insert into ${tableName}
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="$pkColumn.javaField != null">
|
|
||||||
$pkColumn.columnName,
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List_No_Pk" />
|
|
||||||
</trim>
|
|
||||||
values
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="$pkColumn.javaField != null">
|
|
||||||
#{$pkColumn.javaField,jdbcType=$pkColumn.CapColumnType},
|
|
||||||
</if>
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
#{$column.javaField, jdbcType=$column.CapColumnType},
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
<if test="$pkColumn.javaField != null">
|
|
||||||
on duplicate key update
|
|
||||||
<trim suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.javaField != $pkColumn.javaField)
|
|
||||||
$column.columnName = #{$column.javaField, jdbcType=$column.CapColumnType},
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</insert>
|
|
||||||
<insert id="insertOrUpdateSelective" keyColumn="$pkColumn.columnName" keyProperty="$pkColumn.javaField" parameterType="${ClassName}" useGeneratedKeys="true">
|
|
||||||
insert into ${tableName}
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
<if test="$column.javaField != null">
|
|
||||||
$column.columnName,
|
|
||||||
</if>
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
values
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
<if test="$column.javaField != null">
|
|
||||||
#{$column.javaField,jdbcType=$column.CapColumnType},
|
|
||||||
</if>
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
on duplicate key update
|
|
||||||
<trim suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
<if test="$column.javaField != null">
|
|
||||||
$column.columnName = #{$column.javaField, jdbcType=$column.CapColumnType},
|
|
||||||
</if>
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
</mapper>
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询${functionName}列表
|
|
||||||
export function list${ClassName}(data, query) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${className}/list',
|
|
||||||
method: 'post',
|
|
||||||
data,
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询${functionName}详细
|
|
||||||
export function get${ClassName}(${pkColumn.javaField}) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${className}/' + ${pkColumn.javaField},
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增${functionName}
|
|
||||||
export function add${ClassName}(data) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${className}',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改${functionName}
|
|
||||||
export function update${ClassName}(data) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${className}',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除${functionName}
|
|
||||||
export function del${ClassName}(${pkColumn.javaField}) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${className}/' + ${pkColumn.javaField},
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出${functionName}
|
|
||||||
export function export${ClassName}(query) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${className}/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
.add_${className}_wrapper
|
|
||||||
el-form
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.edit)
|
|
||||||
el-form-item(label="${column.genLabel()}")
|
|
||||||
${column.genComponent()}(v-model="form.${column.javaField}")
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
el-button.mt16(type="primary" @click="add${ClassName}Click") 保存
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { add${ClassName}, get${ClassName}, update${ClassName} } from '@/api/${moduleName}/${className}'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'Add',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
form: {
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.edit)
|
|
||||||
${column.javaField}: null,
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
const { id } = this.$route.query
|
|
||||||
if (id) {
|
|
||||||
this.init${ClassName}(id)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
add${ClassName}Click () {
|
|
||||||
const call = this.form.id ? update${ClassName} : add${ClassName};
|
|
||||||
call({ ...this.form }).then(res => {
|
|
||||||
this.$message.success('创建成功')
|
|
||||||
})
|
|
||||||
},
|
|
||||||
init${ClassName} (id) {
|
|
||||||
get${ClassName}(id).then(res => {
|
|
||||||
this.form = res.data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="stylus">
|
|
||||||
.add_${className}_wrapper
|
|
||||||
.ant-form
|
|
||||||
padding 1rem 0 0 1rem
|
|
||||||
background-color white
|
|
||||||
display flex
|
|
||||||
flex-wrap wrap
|
|
||||||
|
|
||||||
.ant-form-item
|
|
||||||
width calc(50% - 1rem)
|
|
||||||
margin-right 1rem
|
|
||||||
</style>
|
|
||||||
Loading…
Reference in new issue