ftl
This commit is contained in:
parent
a59dd25156
commit
142c24ca90
@ -0,0 +1,75 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${classInfo.className?uncap_first}")
|
||||
public class ${classInfo.className}Controller {
|
||||
|
||||
@Autowired
|
||||
private SQLManager sqlManager;
|
||||
|
||||
/**
|
||||
* 新增或编辑
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public Object save(${classInfo.className} ${classInfo.className?uncap_first}){
|
||||
${classInfo.className} ${classInfo.className?uncap_first}=sqlManager.unique(${classInfo.className}.class,${classInfo.className?uncap_first}.getId());
|
||||
if(${classInfo.className?uncap_first}!=null){
|
||||
sqlManager.updateById(${classInfo.className?uncap_first});
|
||||
return ${returnUtilSuccess}("编辑成功");
|
||||
}else{
|
||||
sqlManager.insert(${classInfo.className?uncap_first});
|
||||
return ${returnUtilFailure}("保存成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Object delete(int id){
|
||||
${classInfo.className} ${classInfo.className?uncap_first}=sqlManager.unique(${classInfo.className}.class,id);
|
||||
if(${classInfo.className?uncap_first}!=null){
|
||||
sqlManager.deleteById(id);
|
||||
return ${returnUtilSuccess}("删除成功");
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PostMapping("/find")
|
||||
public Object find(int id){
|
||||
${classInfo.className} ${classInfo.className?uncap_first}=sqlManager.unique(${classInfo.className}.class,id);
|
||||
if(${classInfo.className?uncap_first}!=null){
|
||||
return ${returnUtilSuccess}(${classInfo.className?uncap_first});
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Object list(${classInfo.className} ${classInfo.className?uncap_first},
|
||||
@RequestParam(required = false, defaultValue = "0") int pageNumber,
|
||||
@RequestParam(required = false, defaultValue = "10") int pageSize) {
|
||||
List<${classInfo.className}> list = sqlManager.query(${classInfo.className}.class).select();
|
||||
return ${returnUtilSuccess}(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Data<#if isSwagger?exists && isSwagger==true>
|
||||
@Schema"${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema(description = "${fieldItem.fieldComment}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
public ${classInfo.className}() {
|
||||
}
|
||||
</#if>
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
sample
|
||||
===
|
||||
|
||||
select #use("cols")# from ${classInfo.tableName} where #use("condition")#
|
||||
|
||||
cols
|
||||
===
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
`${fieldItem.columnName}`<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
updateSample
|
||||
===
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
`${fieldItem.columnName}=#${fieldItem.fieldName}#`<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
condition
|
||||
===
|
||||
1 = 1
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
@if(!isEmpty(${fieldItem.fieldName})){
|
||||
and `${fieldItem.columnName}`=#${fieldItem.fieldName}#
|
||||
@}
|
||||
</#list>
|
||||
</#if>
|
||||
@ -0,0 +1,94 @@
|
||||
//***************************
|
||||
//[${classInfo.classComment} - ${classInfo.tableName}]
|
||||
//AUTHOR ${authorName}
|
||||
//HISTORY ${.now?string('yyyy-MM-dd')}
|
||||
//***************************
|
||||
|
||||
//***************************
|
||||
//load all
|
||||
[${classInfo.tableName}]:
|
||||
LOAD * FROM ['LIB://QVD/${classInfo.className}.qvd'](qvd);
|
||||
|
||||
//***************************
|
||||
//load columns
|
||||
[${classInfo.tableName}]:
|
||||
LOAD
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
"${fieldItem.columnName}" as "${fieldItem.fieldName}"<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
FROM
|
||||
['LIB://QVD/${classInfo.className}.qvd'](qvd);
|
||||
;
|
||||
|
||||
//load inline
|
||||
[${classInfo.tableName}]:
|
||||
LOAD * INLINE
|
||||
[
|
||||
<#list classInfo.fieldList as fieldItem >${fieldItem.columnName} <#if fieldItem_has_next>,</#if></#list>
|
||||
<#list classInfo.fieldList as fieldItem >${fieldItem.fieldName} <#if fieldItem_has_next>,</#if></#list>
|
||||
<#list classInfo.fieldList as fieldItem >${fieldItem.fieldComment} <#if fieldItem_has_next>,</#if></#list>
|
||||
];
|
||||
|
||||
//***************************
|
||||
//load from api data connection (wrap on)
|
||||
LIB CONNECT TO '${classInfo.tableName}_api';
|
||||
|
||||
RestConnectorMasterTable:
|
||||
SQL SELECT
|
||||
"__KEY_root",
|
||||
(SELECT
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
"${fieldItem.columnName}"
|
||||
</#list>
|
||||
"__FK_object"
|
||||
FROM "object" FK "__FK_object")
|
||||
FROM JSON (wrap on) "root" PK "__KEY_root"
|
||||
// WITH CONNECTION (
|
||||
// Url "https://localhost:8080/${classInfo.tableName}_api",
|
||||
// QUERY "page" "1",
|
||||
// QUERY "size" "100",
|
||||
// HTTPHEADER "token" "123456",
|
||||
// BODY "Post body here")
|
||||
;
|
||||
|
||||
[${classInfo.className}]:
|
||||
LOAD
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
[${fieldItem.columnName}] as [${fieldItem.fieldName}]
|
||||
</#list>
|
||||
[__FK_object] AS [__KEY_root]
|
||||
RESIDENT RestConnectorMasterTable
|
||||
WHERE NOT IsNull([__FK_stores]);
|
||||
|
||||
DROP TABLE [${classInfo.className}];
|
||||
DROP TABLE RestConnectorMasterTable;
|
||||
|
||||
//***************************
|
||||
//load from api data connection (wrap off)
|
||||
LIB CONNECT TO '${classInfo.tableName}_api';
|
||||
[${classInfo.className}]:
|
||||
SQL SELECT
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
[${fieldItem.fieldName}] as [${fieldItem.fieldName}]<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
FROM JSON(wrap off) "${classInfo.className}"
|
||||
// WITH CONNECTION (
|
||||
// Url "https://localhost:8080/${classInfo.tableName}_api",
|
||||
// QUERY "page" "1",
|
||||
// QUERY "size" "100",
|
||||
// HTTPHEADER "token" "123456",
|
||||
// BODY "Post body here")
|
||||
;
|
||||
|
||||
//***************************
|
||||
//load from sql data connection
|
||||
LIB CONNECT TO '${classInfo.tableName}_db';
|
||||
|
||||
SQL SELECT
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
[${fieldItem.columnName}] as [${fieldItem.fieldName}]<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
FROM
|
||||
${classInfo.tableName}
|
||||
WHERE
|
||||
Create_Time > '2023-01-01 00:00:00';
|
||||
@ -0,0 +1,17 @@
|
||||
|
||||
SELECT * FROM 'your_project.your_dataset.${tableName}' t
|
||||
order by t.id desc
|
||||
LIMIT 100
|
||||
;
|
||||
|
||||
SELECT * FROM 'your_project.your_dataset.${tableName}_error_records' t
|
||||
order by t.timestamp desc
|
||||
LIMIT 100
|
||||
;
|
||||
|
||||
bigquery table -> SCHEMA -> Edit as text , then input below text:
|
||||
[
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
{"name":"${fieldItem.columnName}",type:"STRING","mode":"NULLABLE","description": "${fieldItem.fieldName} - ${fieldItem.fieldComment}"}<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
||||
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* GCP - dataflow job jjs for [${classInfo.classComment} - ${classInfo.tableName}]
|
||||
* AUTHOR ${authorName}
|
||||
*
|
||||
* User-defined function (UDF) to transform events as part of a Dataflow template job.
|
||||
* upload to GCS and create dataflow job with this js file and method as 'process'
|
||||
* @param {string} inJson input Pub/Sub JSON message (stringified)
|
||||
* @return {string} outJson output JSON message (stringified)
|
||||
*/
|
||||
function process(inJson) {
|
||||
//for local js debug
|
||||
//var obj = JSON.parse(JSON.stringify(inJson));
|
||||
//for online jjs
|
||||
var obj = JSON.parse(inJson);
|
||||
var includePubsubMessage = obj.data && obj.attributes;
|
||||
var data = includePubsubMessage ? obj.data : obj;
|
||||
//debug and show error if you need special logic
|
||||
if(data.hasOwnProperty('show_error')){
|
||||
throw new ERROR("show_error:"+JSON.stringify(data))
|
||||
}
|
||||
// INSERT CUSTOM TRANSFORMATION LOGIC HERE
|
||||
var tableObj= {};
|
||||
tableObj.insert_time=new Date().toUTCString()
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
tableObj.${fieldItem.columnName}=data.${fieldItem.fieldName}
|
||||
</#list>
|
||||
return JSON.stringify(tableObj);
|
||||
}
|
||||
|
||||
//field name = field name
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
tableObj.${fieldItem.fieldName}=data.${fieldItem.fieldName}
|
||||
</#list>
|
||||
|
||||
//column name = column name
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
tableObj.${fieldItem.columnName}=data.${fieldItem.columnName}
|
||||
</#list>
|
||||
@ -0,0 +1,49 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.*;
|
||||
<#if isSwagger?exists && isSwagger==true>
|
||||
import io.swagger.v3.oas.annotations.media.Schema;</#if>
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
<#if isLombok?exists && isLombok==true>@Data</#if>
|
||||
<#if isComment?exists && isComment==true>@Table(name="${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema"${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema(description = "${fieldItem.fieldComment}")</#if>
|
||||
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
public ${classInfo.className}() {
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if isLombok?exists && isLombok==false>
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}Mapper
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${classInfo.className}Mapper extends Mapper<${classInfo.className}> {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.util.List;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
public interface I${classInfo.className}DAO {
|
||||
|
||||
int add(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
int update(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
int delete(int id);
|
||||
|
||||
${classInfo.className} findById(int id);
|
||||
|
||||
List<${classInfo.className}> findAllList(Map<String,Object> param);
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Repository
|
||||
public class ${classInfo.className}DaoImpl implements I${classInfo.className}Dao{
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Override
|
||||
public int add(${classInfo.className} ${classInfo.className?uncap_first}) {
|
||||
return jdbcTemplate.update("insert into ${classInfo.originTableName} (<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0><#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list></#if> ) values (<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0><#list classInfo.fieldList as fieldItem >?<#if fieldItem_has_next>,</#if></#list></#if> )",
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0><#list classInfo.fieldList as fieldItem >${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}()<#if fieldItem_has_next>,</#if></#list></#if>);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(${classInfo.className} ${classInfo.className?uncap_first}) {
|
||||
return jdbcTemplate.update("UPDATE ${classInfo.originTableName} SET <#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0><#list classInfo.fieldList as fieldItem ><#if fieldItem_index gt 0 >${fieldItem.columnName}=?<#if fieldItem_has_next>,</#if></#if></#list></#if>"
|
||||
+" where <#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0><#list classInfo.fieldList as fieldItem ><#if fieldItem_index = 0>${fieldItem.columnName}=?<#break ></#if></#list></#if>",
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem ><#if fieldItem_index gt 0 >${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}(),</#if></#list>
|
||||
<#list classInfo.fieldList as fieldItem ><#if fieldItem_index = 0 >${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}()</#if></#list>
|
||||
</#if>);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(int id) {
|
||||
return jdbcTemplate.update("DELETE from ${classInfo.originTableName} where <#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0><#list classInfo.fieldList as fieldItem ><#if fieldItem_index = 0>${fieldItem.columnName}=?<#break ></#if></#list></#if>",id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ${classInfo.className} findById(int id) {
|
||||
List<${classInfo.className}> list = jdbcTemplate.query("select * from ${classInfo.originTableName} where <#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0><#list classInfo.fieldList as fieldItem ><#if fieldItem_index = 0>${fieldItem.columnName}=?<#break ></#if></#list></#if>", new Object[]{id}, new BeanPropertyRowMapper<${classInfo.className}>(${classInfo.className}.class));
|
||||
if(list!=null && !list.isEmpty() ){
|
||||
return list.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${classInfo.className}> findAllList(Map<String,Object> params) {
|
||||
List<${classInfo.className}> list = jdbcTemplate.query("select * from ${classInfo.originTableName}", new Object[]{}, new BeanPropertyRowMapper<${classInfo.className}>(${classInfo.className}.class));
|
||||
if(list!=null && !list.isEmpty() ){
|
||||
return list;
|
||||
}else{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.GeneratedValue;
|
||||
<#if isSwagger?exists && isSwagger==true>
|
||||
import io.swagger.v3.oas.annotations.media.Schema;</#if>
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Entity
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
<#if isLombok?exists && isLombok==true>@Data</#if>
|
||||
<#if isComment?exists && isComment==true>@Table(name="${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema"${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Schema(description = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema(description = "${fieldItem.fieldComment}")</#if>
|
||||
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
public ${classInfo.className}() {
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if isLombok?exists && isLombok==false>
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.controller;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import ${packageName}.repository.${classInfo.className}Repository;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "${classInfo.className?uncap_first}")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/${classInfo.className?uncap_first}")
|
||||
public class ${classInfo.className}Controller {
|
||||
|
||||
@Autowired
|
||||
private ${classInfo.className}Repository ${classInfo.className?uncap_first}Repository;
|
||||
|
||||
/**
|
||||
* 新增或编辑
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation(value = "save ${classInfo.className}", notes = "save ${classInfo.className}")
|
||||
public Object save(@RequestBody ${classInfo.className} ${classInfo.className?uncap_first}){
|
||||
try {
|
||||
return ReturnT.success(${classInfo.className?uncap_first}Repository.save(${classInfo.className?uncap_first}));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ReturnT.error("保存失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "delete ${classInfo.className}", notes = "delete ${classInfo.className}")
|
||||
public Object delete(int id){
|
||||
Optional<${classInfo.className}> ${classInfo.className?uncap_first}=${classInfo.className?uncap_first}Repository.findById(id);
|
||||
if(${classInfo.className?uncap_first}.isPresent()){
|
||||
${classInfo.className?uncap_first}Repository.deleteById(id);
|
||||
return ${returnUtilSuccess}("删除成功");
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PostMapping("/find")
|
||||
@ApiOperation(value = "find ${classInfo.className} by id", notes = "find ${classInfo.className} by id")
|
||||
public Object find(int id){
|
||||
Optional<${classInfo.className}> ${classInfo.className?uncap_first}=${classInfo.className?uncap_first}Repository.findById(id);
|
||||
if(${classInfo.className?uncap_first}.isPresent()){
|
||||
return ${returnUtilSuccess}(${classInfo.className?uncap_first}.get());
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ApiOperation(value = "list ${classInfo.className}", notes = "list ${classInfo.className}")
|
||||
public Object list(@RequestBody ${classInfo.className} ${classInfo.className?uncap_first},
|
||||
@RequestParam(required = false, defaultValue = "0") int pageNumber,
|
||||
@RequestParam(required = false, defaultValue = "10") int pageSize) {
|
||||
|
||||
try {
|
||||
//创建匹配器,需要查询条件请修改此处代码
|
||||
ExampleMatcher matcher = ExampleMatcher.matchingAll();
|
||||
|
||||
//创建实例
|
||||
Example<${classInfo.className}> example = Example.of(${classInfo.className?uncap_first}, matcher);
|
||||
//分页构造
|
||||
Pageable pageable = PageRequest.of(pageNumber,pageSize);
|
||||
|
||||
return ReturnT.success(${classInfo.className?uncap_first}Repository.findAll(example, pageable));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ReturnT.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.repository;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>import ${packageName}.entity.${classInfo.className};
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem.fieldClass == "Date">
|
||||
<#assign importDdate = true />
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
<#if importDdate?exists && importDdate==true>import java.util.Date;</#if>
|
||||
import java.util.List;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Repository
|
||||
public interface ${classInfo.className}Repository extends JpaRepository<${classInfo.className},Integer> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.GeneratedValue;
|
||||
<#if isSwagger?exists && isSwagger==true>
|
||||
import io.swagger.v3.oas.annotations.media.Schema;</#if>
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Entity
|
||||
<#if isLombok?exists && isLombok==true>@Data</#if>
|
||||
<#if isComment?exists && isComment==true>@Table(name="${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema"${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema(description = "${fieldItem.fieldComment}")</#if>
|
||||
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
public ${classInfo.className}() {
|
||||
}
|
||||
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isLombok?exists && isLombok==false>
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
</#if></#if>
|
||||
@ -0,0 +1,85 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.controller;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import ${packageName}.repository.${classInfo.className}Repository;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${classInfo.className?uncap_first}")
|
||||
public class ${classInfo.className}Controller {
|
||||
|
||||
@Autowired
|
||||
private ${classInfo.className}Repository ${classInfo.className?uncap_first}Repository;
|
||||
|
||||
/**
|
||||
* 新增或编辑
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public Object save(${classInfo.className} ${classInfo.className?uncap_first}){
|
||||
return ${classInfo.className?uncap_first}Repository.save(${classInfo.className?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Object delete(int id){
|
||||
Optional<${classInfo.className}> ${classInfo.className?uncap_first}=${classInfo.className?uncap_first}Repository.findById(id);
|
||||
if(${classInfo.className?uncap_first}.isPresent()){
|
||||
${classInfo.className?uncap_first}Repository.deleteById(id);
|
||||
return ${returnUtilSuccess}("删除成功");
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PostMapping("/find")
|
||||
public Object find(int id){
|
||||
Optional<${classInfo.className}> ${classInfo.className?uncap_first}=${classInfo.className?uncap_first}Repository.findById(id);
|
||||
if(${classInfo.className?uncap_first}.isPresent()){
|
||||
return ${returnUtilSuccess}(${classInfo.className?uncap_first}.get());
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Object list(${classInfo.className} ${classInfo.className?uncap_first},
|
||||
@RequestParam(required = false, defaultValue = "0") int pageNumber,
|
||||
@RequestParam(required = false, defaultValue = "10") int pageSize) {
|
||||
|
||||
//创建匹配器,需要查询条件请修改此处代码
|
||||
ExampleMatcher matcher = ExampleMatcher.matchingAll();
|
||||
|
||||
//创建实例
|
||||
Example<${classInfo.className}> example = Example.of(${classInfo.className?uncap_first}, matcher);
|
||||
//分页构造
|
||||
Pageable pageable = PageRequest.of(pageNumber,pageSize);
|
||||
|
||||
return ${classInfo.className?uncap_first}Repository.findAll(example, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.repository;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>import ${packageName}.entity.${classInfo.className};
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem.fieldClass == "Date">
|
||||
<#assign importDdate = true />
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
<#if importDdate?exists && importDdate==true>import java.util.Date;</#if>
|
||||
import java.util.List;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Repository
|
||||
public interface ${classInfo.className}Repository extends JpaRepository<${classInfo.className},Integer> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,163 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.controller;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import ${packageName}.mapper.${classInfo.className}Mapper;
|
||||
import ${packageName}.util.ReturnT;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
<#if isSwagger?exists && isSwagger==true>import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}控制器
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/${classInfo.className?uncap_first}")
|
||||
<#if isSwagger?exists && isSwagger==true>@Tag(name = "${classInfo.className}",description = "${classInfo.classComment}控制器")</#if>
|
||||
public class ${classInfo.className}Controller {
|
||||
|
||||
@Autowired
|
||||
private ${classInfo.className}Mapper ${classInfo.className?uncap_first}Mapper;
|
||||
|
||||
/**
|
||||
* 新增或编辑
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public Object save(@RequestBody ${classInfo.className} ${classInfo.className?uncap_first}){
|
||||
log.info("${classInfo.className?uncap_first}:"+JSON.toJSONString(${classInfo.className?uncap_first}));
|
||||
${classInfo.className} old${classInfo.className} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",${classInfo.className?uncap_first}.get${classInfo.className}Id()));
|
||||
${classInfo.className?uncap_first}.setUpdateTime(new Date());
|
||||
if(old${classInfo.className}!=null){
|
||||
${classInfo.className?uncap_first}Mapper.updateById(${classInfo.className?uncap_first});
|
||||
}else{
|
||||
if(${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_name",${classInfo.className?uncap_first}.get${classInfo.className}Name()))!=null){
|
||||
return ${returnUtilFailure}("保存失败,名字重复");
|
||||
}
|
||||
${classInfo.className?uncap_first}.setCreateTime(new Date());
|
||||
${classInfo.className?uncap_first}Mapper.insert(${classInfo.className?uncap_first});
|
||||
}
|
||||
return ${returnUtilSuccess}("保存成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Object delete(int id){
|
||||
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
|
||||
if(${classInfo.className?uncap_first}!=null){
|
||||
${classInfo.className?uncap_first}Mapper.deleteById(id);
|
||||
return ${returnUtilSuccess}("删除成功");
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PostMapping("/find")
|
||||
public Object find(int id){
|
||||
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
|
||||
if(${classInfo.className?uncap_first}!=null){
|
||||
return ${returnUtilSuccess}(${classInfo.className?uncap_first});
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动分页查询
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Object list(String searchParams,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int limit) {
|
||||
log.info("page:"+page+"-limit:"+limit+"-json:"+ JSON.toJSONString(searchParams));
|
||||
//分页构造器
|
||||
Page<${classInfo.className}> buildPage = new Page<${classInfo.className}>(page,limit);
|
||||
//条件构造器
|
||||
QueryWrapper<${classInfo.className}> queryWrapper = new QueryWrapper<${classInfo.className}>();
|
||||
if(StringUtils.isNotEmpty(searchParams)&&JSON.isValid(searchParams)) {
|
||||
${classInfo.className} ${classInfo.className?uncap_first} = JSON.parseObject(searchParams, ${classInfo.className}.class);
|
||||
queryWrapper.eq(StringUtils.isNoneEmpty(${classInfo.className?uncap_first}.get${classInfo.className}Name()), "${classInfo.className?uncap_first}_name", ${classInfo.className?uncap_first}.get${classInfo.className}Name());
|
||||
}
|
||||
//执行分页
|
||||
IPage<${classInfo.className}> pageList = ${classInfo.className?uncap_first}Mapper.selectPage(buildPage, queryWrapper);
|
||||
//返回结果
|
||||
return ${returnUtil}.PAGE(pageList.getRecords(),pageList.getTotal());
|
||||
}
|
||||
/**
|
||||
* 手工分页查询(按需使用)
|
||||
*/
|
||||
/*@PostMapping("/list2")
|
||||
public Object list2(String searchParams,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int limit) {
|
||||
log.info("searchParams:"+ JSON.toJSONString(searchParams));
|
||||
//通用模式
|
||||
${classInfo.className} queryParamDTO = JSON.parseObject(searchParams, ${classInfo.className}.class);
|
||||
//专用DTO模式
|
||||
//QueryParamDTO queryParamDTO = JSON.parseObject(searchParams, QueryParamDTO.class);
|
||||
//queryParamDTO.setPage((page - 1)* limit);
|
||||
//queryParamDTO.setLimit(limit);
|
||||
//(page - 1) * limit, limit
|
||||
List<${classInfo.className}> itemList = ${classInfo.className?uncap_first}Mapper.pageAll(queryParamDTO,(page - 1)* limit,limit);
|
||||
Integer itemCount = ${classInfo.className?uncap_first}Mapper.countAll(queryParamDTO);
|
||||
//返回结果
|
||||
return ${returnUtilSuccess}.PAGE(itemList,itemCount);
|
||||
}*/
|
||||
@GetMapping("/list")
|
||||
public ModelAndView listPage(){
|
||||
return new ModelAndView("${classInfo.className?uncap_first}-list");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView editPage(int id){
|
||||
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
|
||||
return new ModelAndView("${classInfo.className?uncap_first}-edit","${classInfo.className?uncap_first}",${classInfo.className?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布/暂停(如不需要请屏蔽)
|
||||
*/
|
||||
@PostMapping("/publish")
|
||||
public Object publish(int id,Integer status){
|
||||
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
|
||||
if(${classInfo.className?uncap_first}!=null){
|
||||
${classInfo.className?uncap_first}.setUpdateTime(new Date());
|
||||
${classInfo.className?uncap_first}.setStatus(status);
|
||||
${classInfo.className?uncap_first}Mapper.updateById(${classInfo.className?uncap_first});
|
||||
return ${returnUtilSuccess}((status==1)?"已发布":"已暂停");
|
||||
}else if(status.equals(${classInfo.className?uncap_first}.getStatus())){
|
||||
return ${returnUtilFailure}("状态不正确");
|
||||
}else{
|
||||
return ${returnUtilFailure}();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行(如不需要请屏蔽)
|
||||
*/
|
||||
@PostMapping("/execute")
|
||||
public Object execute(){
|
||||
return ${returnUtilSuccess};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
<#if isSwagger?exists && isSwagger==true>
|
||||
import io.swagger.v3.oas.annotations.media.Schema;</#if>
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
<#if isLombok?exists && isLombok==true>@Data</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema"${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema(description = "${fieldItem.fieldComment}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
<#if isLombok?exists && isLombok==false>
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
public ${classInfo.className}() {}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import java.util.List;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}Mapper
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${classInfo.className}Mapper extends BaseMapper<${classInfo.className}> {
|
||||
|
||||
@Select(
|
||||
"<script>select t0.* from ${classInfo.tableName} t0 " +
|
||||
//add here if need left join
|
||||
"where 1=1" +
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
"<when test='${fieldItem.fieldName}!=null and ${fieldItem.fieldName}!='' '> and t0.${fieldItem.columnName}=井{${fieldItem.fieldName}}</when> " +
|
||||
</#list>
|
||||
//add here if need page limit
|
||||
//" limit ¥{page},¥{limit} " +
|
||||
" </script>")
|
||||
List<${classInfo.className}> pageAll(${classInfo.className} queryParamDTO,int page,int limit);
|
||||
|
||||
@Select("<script>select count(1) from ${classInfo.tableName} t0 " +
|
||||
//add here if need left join
|
||||
"where 1=1" +
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
"<when test='${fieldItem.fieldName}!=null and ${fieldItem.fieldName}!='' '> and t0.${fieldItem.columnName}=井{${fieldItem.fieldName}}</when> " +
|
||||
</#list>
|
||||
" </script>")
|
||||
int countAll(${classInfo.className} queryParamDTO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.service;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}服务层
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Service
|
||||
public interface ${classInfo.className}Service extends IService<${classInfo.className}> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/${classInfo.className?uncap_first}")
|
||||
public class ${classInfo.className}Controller {
|
||||
|
||||
@Resource
|
||||
private ${classInfo.className}Service ${classInfo.className?uncap_first}Service;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
@RequestMapping("/insert")
|
||||
public Object insert(${classInfo.className} ${classInfo.className?uncap_first}){
|
||||
return ${classInfo.className?uncap_first}Service.insert(${classInfo.className?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 刪除
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
@RequestMapping("/delete")
|
||||
public Object delete(int id){
|
||||
return ${classInfo.className?uncap_first}Service.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
@RequestMapping("/update")
|
||||
public Object update(${classInfo.className} ${classInfo.className?uncap_first}){
|
||||
return ${classInfo.className?uncap_first}Service.update(${classInfo.className?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 根据主键 id 查询
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
@RequestMapping("/load")
|
||||
public Object load(int id){
|
||||
return ${classInfo.className?uncap_first}Service.load(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 分页查询
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
@RequestMapping("/pageList")
|
||||
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int offset,
|
||||
@RequestParam(required = false, defaultValue = "10") int pagesize) {
|
||||
return ${classInfo.className?uncap_first}Service.pageList(offset, pagesize);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ${classInfo.className}Mapper {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
int insert(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
/**
|
||||
* 刪除
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
int delete(int id);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
int update(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
/**
|
||||
* 查询 根据主键 id 查询
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
${classInfo.className} load(int id);
|
||||
|
||||
/**
|
||||
* 查询 分页查询
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
List<${classInfo.className}> pageList(int offset,int pagesize);
|
||||
|
||||
/**
|
||||
* 查询 分页查询 count
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy/MM/dd')}
|
||||
**/
|
||||
int pageListCount(int offset,int pagesize);
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}Mapper
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ${classInfo.className}Mapper {
|
||||
|
||||
@Select("select * from ${classInfo.tableName} where ${classInfo.tableName}_id=井{id}")
|
||||
public ${classInfo.className} getById(Integer id);
|
||||
|
||||
@Options(useGeneratedKeys=true,keyProperty="${classInfo.className?uncap_first}Id")
|
||||
@Insert("insert into ${classInfo.tableName}" +
|
||||
" (<#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list>)" +
|
||||
" values(<#list classInfo.fieldList as fieldItem >${fieldItem.fieldName}<#if fieldItem_has_next>,<#else>)</#if></#list>")
|
||||
public Integer insert(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
@Delete(value = "delete from ${classInfo.tableName} where ${classInfo.tableName}_id=井{${classInfo.className?uncap_first}Id}")
|
||||
boolean delete(Integer id);
|
||||
|
||||
@Update(value = "update ${classInfo.tableName} set "
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem.columnName != "id">+" ${fieldItem.columnName}=井{${fieldItem.fieldName}}<#if fieldItem_has_next>,</#if>"</#if>
|
||||
</#list>
|
||||
+" where ${classInfo.tableName}_id=井{${classInfo.className?uncap_first}Id} ")
|
||||
boolean update(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
|
||||
@Results(value = {
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
@Result(property = "${fieldItem.fieldName}", column = "${fieldItem.columnName}")<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
})
|
||||
@Select(value = "select * from ${classInfo.tableName} where ${classInfo.tableName}_id=井{queryParam}")
|
||||
${classInfo.className} selectOne(String queryParam);
|
||||
|
||||
@Results(value = {
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
@Result(property = "${fieldItem.fieldName}", column = "${fieldItem.columnName}")<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
})
|
||||
@Select(value = "select * from ${classInfo.tableName} where "
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
+" ${fieldItem.columnName}=井{${fieldItem.fieldName}}<#if fieldItem_has_next> or </#if>"
|
||||
</#list>
|
||||
)
|
||||
List<${classInfo.className}> selectList(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
public ${classInfo.className}() {
|
||||
}
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
</#list>
|
||||
</#if>
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
<?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}.dao.${classInfo.className}Mapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="${packageName}.entity.${classInfo.className}" >
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<result column="${fieldItem.columnName}" property="${fieldItem.fieldName}" />
|
||||
</#list>
|
||||
</#if>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName}<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="${packageName}.entity.${classInfo.className}">
|
||||
INSERT INTO ${classInfo.originTableName}
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem.columnName != "id" >
|
||||
<if test="null != ${fieldItem.fieldName} <#if fieldItem.fieldClass ="String">and '' != ${fieldItem.fieldName}</#if>">
|
||||
${fieldItem.columnName}<#if fieldItem_has_next>,</#if>
|
||||
${r"</if>"}
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem.columnName != "id" >
|
||||
<#--<#if fieldItem.columnName="addtime" || fieldItem.columnName="updatetime" >
|
||||
${r"<if test ='null != "}${fieldItem.fieldName}${r"'>"}
|
||||
NOW()<#if fieldItem_has_next>,</#if>
|
||||
${r"</if>"}
|
||||
<#else>-->
|
||||
<if test="null != ${fieldItem.fieldName} <#if fieldItem.fieldClass ="String">and '' != ${fieldItem.fieldName}</#if>">
|
||||
${r"#{"}${fieldItem.fieldName}${r"}"}<#if fieldItem_has_next>,</#if>
|
||||
${r"</if>"}
|
||||
<#--</#if>-->
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<delete id="delete" >
|
||||
DELETE FROM ${classInfo.originTableName}
|
||||
WHERE id = ${r"#{id}"}
|
||||
</delete>
|
||||
|
||||
<update id="update" parameterType="${packageName}.entity.${classInfo.className}">
|
||||
UPDATE ${classInfo.originTableName}
|
||||
<set>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem.columnName != "id" && fieldItem.columnName != "AddTime" && fieldItem.columnName != "UpdateTime" >
|
||||
<if test="null != ${fieldItem.fieldName} <#if fieldItem.fieldClass ="String">and '' != ${fieldItem.fieldName}</#if>">${fieldItem.columnName} = ${r"#{"}${fieldItem.fieldName}${r"}"}<#if fieldItem_has_next>,</#if>${r"</if>"}
|
||||
</#if>
|
||||
</#list>
|
||||
</set>
|
||||
WHERE id = ${r"#{"}id${r"}"}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="load" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM ${classInfo.originTableName}
|
||||
WHERE id = ${r"#{id}"}
|
||||
</select>
|
||||
|
||||
<select id="pageList" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM ${classInfo.originTableName}
|
||||
LIMIT ${r"#{offset}"}, ${r"#{pageSize}"}
|
||||
</select>
|
||||
|
||||
<select id="pageListCount" resultType="java.lang.Integer">
|
||||
SELECT count(1)
|
||||
FROM ${classInfo.originTableName}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,36 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.util.Map;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
public interface ${classInfo.className}Service {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public Object insert(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public Object delete(int id);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
public Object update(${classInfo.className} ${classInfo.className?uncap_first});
|
||||
|
||||
/**
|
||||
* 根据主键 id 查询
|
||||
*/
|
||||
public ${classInfo.className} load(int id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public Map<String,Object> pageList(int offset, int pagesize);
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Service
|
||||
public class ${classInfo.className}ServiceImpl implements ${classInfo.className}Service {
|
||||
|
||||
@Resource
|
||||
private ${classInfo.className}Mapper ${classInfo.className?uncap_first}Mapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Object insert(${classInfo.className} ${classInfo.className?uncap_first}) {
|
||||
|
||||
// valid
|
||||
if (${classInfo.className?uncap_first} == null) {
|
||||
return ${returnUtilFailure}("必要参数缺失");
|
||||
}
|
||||
|
||||
${classInfo.className?uncap_first}Mapper.insert(${classInfo.className?uncap_first});
|
||||
return ${returnUtilSuccess}();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object delete(int id) {
|
||||
int ret = ${classInfo.className?uncap_first}Mapper.delete(id);
|
||||
return ret>0?${returnUtilSuccess}():${returnUtilFailure}();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object update(${classInfo.className} ${classInfo.className?uncap_first}) {
|
||||
int ret = ${classInfo.className?uncap_first}Mapper.update(${classInfo.className?uncap_first});
|
||||
return ret>0?${returnUtilSuccess}():${returnUtilFailure}();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ${classInfo.className} load(int id) {
|
||||
return ${classInfo.className?uncap_first}Mapper.load(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String,Object> pageList(int offset, int pagesize) {
|
||||
|
||||
List<${classInfo.className}> pageList = ${classInfo.className?uncap_first}Mapper.pageList(offset, pagesize);
|
||||
int totalCount = ${classInfo.className?uncap_first}Mapper.pageListCount(offset, pagesize);
|
||||
|
||||
// result
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("pageList", pageList);
|
||||
result.put("totalCount", totalCount);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
-- 菜单SQL
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
VALUES ('1', '${classInfo.classComment}', 'generator/${classInfo.className?uncap_first}', NULL, '1', 'config', '6');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
set @parentId = @@identity;
|
||||
|
||||
-- 菜单对应按钮SQL
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '查看', null, 'generator:${classInfo.className?uncap_first}:list,generator:${classInfo.className?uncap_first}:info', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '新增', null, 'generator:${classInfo.className?uncap_first}:save', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '修改', null, 'generator:${classInfo.className?uncap_first}:update', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '删除', null, 'generator:${classInfo.className?uncap_first}:delete', '2', null, '6';
|
||||
|
||||
@ -0,0 +1,89 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.controller;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import ${packageName}.entity.${classInfo.className}Entity;
|
||||
import ${packageName}.service.${classInfo.className}Service;
|
||||
import ${packageName}.common.utils.PageUtils;
|
||||
import ${packageName}.common.utils.R;
|
||||
</#if>
|
||||
|
||||
|
||||
/**
|
||||
* @description ${classInfo.classComment}控制器
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("generator/${classInfo.className?uncap_first}")
|
||||
public class ${classInfo.className}Controller {
|
||||
|
||||
@Autowired
|
||||
private ${classInfo.className}Service ${classInfo.className?uncap_first}Service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("generator:${classInfo.className?uncap_first}:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = ${classInfo.className?uncap_first}Service.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{${classInfo.className?uncap_first}Id}")
|
||||
@RequiresPermissions("generator:${classInfo.className?uncap_first}:info")
|
||||
public R info(@PathVariable("${classInfo.className?uncap_first}Id") int ${classInfo.className?uncap_first}Id){
|
||||
${classInfo.className}Entity ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Service.getById(${classInfo.className?uncap_first}Id);
|
||||
|
||||
return R.ok().put("${classInfo.className?uncap_first}", ${classInfo.className?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
@RequiresPermissions("generator:${classInfo.className?uncap_first}:save")
|
||||
public R save(@RequestBody ${classInfo.className}Entity ${classInfo.className?uncap_first}){
|
||||
${classInfo.className?uncap_first}Service.save(${classInfo.className?uncap_first});
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("generator:${classInfo.className?uncap_first}:update")
|
||||
public R update(@RequestBody ${classInfo.className}Entity ${classInfo.className?uncap_first}){
|
||||
${classInfo.className?uncap_first}Service.updateById(${classInfo.className?uncap_first});
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
@RequiresPermissions("generator:${classInfo.className?uncap_first}:delete")
|
||||
public R delete(@RequestBody int[] ${classInfo.className?uncap_first}Ids){
|
||||
${classInfo.className?uncap_first}Service.removeByIds(Arrays.asList(${classInfo.className?uncap_first}Ids));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import ${packageName}.entity.${classInfo.className}Entity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}Mapper
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${classInfo.className}Dao extends BaseMapper<${classInfo.className}Entity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
<?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}.dao.${classInfo.className}Dao">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="${packageName}.entity.${classInfo.className}Entity" id="${classInfo.className}Map">
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<result property="${fieldItem.fieldName}" column="${fieldItem.fieldName}"/>
|
||||
</#list>
|
||||
</#if>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,28 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.service;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import ${packageName}.common.utils.PageUtils;
|
||||
import ${packageName}.common.utils.Query;
|
||||
|
||||
import ${packageName}.dao.${classInfo.className}Dao;
|
||||
import ${packageName}.entity.${classInfo.className}Entity;
|
||||
</#if>
|
||||
|
||||
@Service("${classInfo.className?uncap_first}Service")
|
||||
public class ${classInfo.className}Service extends ServiceImpl<${classInfo.className}Dao, ${classInfo.className}Entity> {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<${classInfo.className}Entity> page = this.page(
|
||||
new Query<${classInfo.className}Entity>().getPage(params),
|
||||
new QueryWrapper<${classInfo.className}Entity>()
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.${classInfo.className?uncap_first}Id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<el-form-item label="${fieldItem.fieldComment}" prop="${fieldItem.fieldName}">
|
||||
<el-input v-model="dataForm.${fieldItem.fieldName}" placeholder="${fieldItem.fieldComment}"></el-input>
|
||||
</el-form-item>
|
||||
</#list>
|
||||
</#if>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.fieldName}: ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
},
|
||||
dataRule: {
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.fieldName}: [{ required: true, message: '${fieldItem.fieldComment}不能为空', trigger: 'blur' }]<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (id) {
|
||||
this.dataForm.${classInfo.className?uncap_first}Id = id || 0
|
||||
this.visible = true
|
||||
this.¥nextTick(() => {
|
||||
this.¥refs['dataForm'].resetFields()
|
||||
// <!-- 请把 ${classInfo.className?uncap_first}Id 替换成正确的ID -->
|
||||
if (this.dataForm.${classInfo.className?uncap_first}Id) {
|
||||
this.¥http({
|
||||
url: this.¥http.adornUrl(`/generator/${classInfo.className?uncap_first}/info/¥{this.dataForm.${classInfo.className?uncap_first}Id}`),
|
||||
method: 'get',
|
||||
params: this.¥http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
this.dataForm.${fieldItem.fieldName} = data.${classInfo.className?uncap_first}.${fieldItem.fieldName}
|
||||
</#list>
|
||||
</#if>
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.¥refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.¥http({
|
||||
url: this.¥http.adornUrl(`/generator/${classInfo.className?uncap_first}/¥{this.dataForm.${classInfo.className?uncap_first}Id? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.¥http.adornData({
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
'${fieldItem.fieldName}': '${fieldItem.fieldName}' || undefined<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.¥message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.¥emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.¥message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,162 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('generator:${classInfo.className?uncap_first}:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('generator:${classInfo.className?uncap_first}:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<el-table-column
|
||||
prop="${fieldItem.fieldName}"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="${fieldItem.fieldComment}">
|
||||
</el-table-column>
|
||||
</#list>
|
||||
</#if>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<!-- 请把 ${classInfo.className?uncap_first}Id 替换成正确的ID -->
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.${classInfo.className?uncap_first}Id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.${classInfo.className?uncap_first}Id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './${classInfo.className?uncap_first}-add-or-update'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.¥http({
|
||||
url: this.¥http.adornUrl('/generator/${classInfo.className?uncap_first}/list'),
|
||||
method: 'get',
|
||||
params: this.¥http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.¥nextTick(() => {
|
||||
this.¥refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.${classInfo.className?uncap_first}Id
|
||||
})
|
||||
this.¥confirm(`确定对[id=¥{ids.join(',')}]进行[¥{id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.¥http({
|
||||
url: this.¥http.adornUrl('/generator/${classInfo.className?uncap_first}/delete'),
|
||||
method: 'post',
|
||||
data: this.¥http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.¥message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.¥message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,79 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.controller;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import ${packageName}.mapper.${classInfo.className}Mapper;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${classInfo.className?uncap_first}")
|
||||
public class ${classInfo.className}Controller {
|
||||
|
||||
@Autowired
|
||||
private ${classInfo.className}Mapper ${classInfo.className?uncap_first}Mapper;
|
||||
|
||||
/**
|
||||
* 新增或编辑
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public Object save(${classInfo.className} ${classInfo.className?uncap_first}){
|
||||
if(${classInfo.className?uncap_first}Mapper.selectCount(${classInfo.className?uncap_first})>0){
|
||||
${classInfo.className?uncap_first}Mapper.insert(${classInfo.className?uncap_first});
|
||||
}else{
|
||||
${classInfo.className?uncap_first}Mapper.updateByPrimaryKeySelective(${classInfo.className?uncap_first});
|
||||
}
|
||||
return ${returnUtilSuccess}("新增或编辑成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Object delete(int id){
|
||||
if(${classInfo.className?uncap_first}Mapper.selectCount(${classInfo.className?uncap_first})>0){
|
||||
${classInfo.className?uncap_first}Mapper.deleteByPrimaryKey(id);
|
||||
return ${returnUtilSuccess}("删除成功");
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PostMapping("/find")
|
||||
public Object find(int id){
|
||||
Optional<${classInfo.className}> ${classInfo.className?uncap_first}=${classInfo.className?uncap_first}Mapper.selectOne(id);
|
||||
if(${classInfo.className?uncap_first}.isPresent()){
|
||||
return ${returnUtilSuccess}(${classInfo.className?uncap_first}.get());
|
||||
}else{
|
||||
return ${returnUtilFailure}("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Object list(${classInfo.className} ${classInfo.className?uncap_first},
|
||||
@RequestParam(required = false, defaultValue = "0") int pageNumber,
|
||||
@RequestParam(required = false, defaultValue = "10") int pageSize) {
|
||||
//TBC
|
||||
return ${classInfo.className?uncap_first}Mapper.selectList(${classInfo.className?uncap_first});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.io.Serializable;
|
||||
import io.mybatis.provider.Entity;
|
||||
<#if isSwagger?exists && isSwagger==true>
|
||||
import io.swagger.v3.oas.annotations.media.Schema;</#if>
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
<#if isLombok?exists && isLombok==true>@Data</#if>
|
||||
<#if isComment?exists && isComment==true>@Entity.Table("${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema"${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//@Entity.Column(id = true)
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@Schema(description = "${fieldItem.fieldComment}")</#if>
|
||||
<#if isComment?exists && isComment==true>@Entity.Column("${fieldItem.columnName}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
public ${classInfo.className}() {
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if isLombok?exists && isLombok==false>
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
</#list>
|
||||
</#if>
|
||||
</#if>
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>import ${packageName}.entity.${classInfo.className};
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem.fieldClass == "Date">
|
||||
<#assign importDdate = true />
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
<#if importDdate?exists && importDdate==true>import java.util.Date;</#if>
|
||||
import java.util.List;
|
||||
import io.mybatis.mapper.Mapper;
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@org.apache.ibatis.annotations.Mapper
|
||||
public interface ${classInfo.className}Mapper extends Mapper<${classInfo.className},Integer> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
<form action="/${classInfo.className?uncap_first}/save">
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<div class="form-group">
|
||||
<label for="${fieldItem.fieldName}Label">${fieldItem.fieldComment}</label>
|
||||
<input type="input" class="form-control" id="${fieldItem.fieldName}" name="${fieldItem.fieldName}" placeholder="请输入${fieldItem.fieldComment}">
|
||||
</div>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
<button type="submit" class="btn btn-primary">保存</button>
|
||||
</form>
|
||||
@ -0,0 +1,16 @@
|
||||
<el-form :inline="true" :model="submitData" class="demo-form-inline" :rules="rules" ref="ruleForm">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="header clearfix">
|
||||
<span>${classInfo.classComment}</span>
|
||||
<el-button v-if="!ischeck && !isFind" class="fr" type="primary" @click="validate('ruleForm')">提交</el-button>
|
||||
<el-button v-else class="fr" type="primary" @click="goBack">返回</el-button>
|
||||
</div>
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<el-form-item label="${fieldItem.fieldComment}" prop="${fieldItem.fieldName}">
|
||||
<el-input placeholder="请输入${fieldItem.fieldComment}" v-model="formData.${fieldItem.fieldName}"></el-input>
|
||||
</el-form-item>
|
||||
</#list>
|
||||
</#if>
|
||||
</el-card>
|
||||
</el-form>
|
||||
@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div class="layui-form layuimini-form">
|
||||
<input type="hidden" name="${classInfo.className?uncap_first}Id" value="" class="layui-input">
|
||||
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">${fieldItem.fieldComment}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="${fieldItem.fieldName}" lay-verify="required" lay-reqtext="${fieldItem.fieldComment}不能为空" placeholder="请输入${fieldItem.fieldComment}" value="¥{(${classInfo.className?uncap_first}.${fieldItem.fieldName})!!}" class="layui-input">
|
||||
<#--<tip>${fieldItem.fieldComment}</tip>-->
|
||||
</div>
|
||||
</div>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="¥{request.contextPath}/static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
|
||||
<script>
|
||||
layui.use(['form'], function () {
|
||||
var form = layui.form,
|
||||
layer = layui.layer,
|
||||
$ = layui.$;
|
||||
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "¥{request.contextPath}/${classInfo.className?uncap_first}/save",
|
||||
data:JSON.stringify(data.field),
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
success: function (responseData) {
|
||||
if (responseData.code === 200) {
|
||||
layer.msg(responseData.msg, function () {
|
||||
// 关闭弹出层
|
||||
//layer.close(index);
|
||||
var iframeIndex = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(iframeIndex);
|
||||
parent.searchBtn.click();
|
||||
});
|
||||
} else {
|
||||
layer.msg(responseData.msg, function () {
|
||||
//window.location = '/index.html';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,221 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<fieldset class="table-search-fieldset">
|
||||
<legend>搜索信息</legend>
|
||||
<div style="margin: 10px 10px 10px 10px">
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">${classInfo.classComment}Id</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="${classInfo.className?uncap_first}Id" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">${classInfo.classComment}名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="${classInfo.className?uncap_first}Name" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button id="searchBtn" type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> <i class="layui-icon layui-icon-addition"></i>${classInfo.classComment} </button>
|
||||
<#-- <button class="layui-btn layui-btn-normal layui-btn-sm layui-btn-danger data-delete-btn" lay-event="del"> 删除${classInfo.classComment} </button>-->
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="typeTemplate">
|
||||
{{# if(d.type == '1'){ }}
|
||||
常规
|
||||
{{# } else if(d.type =='2') { }}
|
||||
专项
|
||||
{{# } else { }}
|
||||
其它
|
||||
{{# } }}
|
||||
</script>
|
||||
<script type="text/html" id="statusTemplate">
|
||||
{{# if(d.status == '1' ){ }}
|
||||
<i class="layui-icon layui-icon-ok"></i>已发布
|
||||
{{# } else { }}
|
||||
- 未发布
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<script src="¥{request.contextPath}/static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
|
||||
<script>
|
||||
layui.use(['form', 'table'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table;
|
||||
|
||||
table.render({
|
||||
elem: '#currentTableId',
|
||||
method: 'post',
|
||||
url: '¥{request.contextPath}/${classInfo.className?uncap_first}/list',
|
||||
toolbar: '#toolbarDemo',
|
||||
defaultToolbar: ['filter', 'exports', 'print', {
|
||||
title: '提示',
|
||||
layEvent: 'LAYTABLE_TIPS',
|
||||
icon: 'layui-icon-tips'
|
||||
}],
|
||||
cols: [[
|
||||
{type: "checkbox", width: 50, fixed: "left"},
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
{field: '${fieldItem.fieldName}', title: '${fieldItem.fieldComment}', sort: true}, <#if fieldItem_has_next> </#if>
|
||||
</#list>
|
||||
</#if>
|
||||
/* 需要时间请自行解封
|
||||
{title: '创建时间', sort: true,templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd')}}</div>"},
|
||||
{title: '修改时间', sort: true,templet: "<div>{{layui.util.toDateString(d.updateTime, 'yyyy-MM-dd')}}</div>"},
|
||||
*/
|
||||
{title: '操作', minWidth: 400, templet: '#currentTableBar', fixed: "right", align: "center"}
|
||||
]],
|
||||
limits: [20 , 50 , 100],
|
||||
limit: 20,
|
||||
page: true
|
||||
});
|
||||
|
||||
var result;
|
||||
/**
|
||||
* submit(data-search-btn):监听搜索操作
|
||||
*/
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
result = JSON.stringify(data.field);
|
||||
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
, where: {
|
||||
searchParams: result
|
||||
}
|
||||
}, 'data');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
var searchBtn = $("#searchBtn");
|
||||
/**
|
||||
* toolbar监听事件:表格添加按钮
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
var index = layer.open({
|
||||
title: '添加',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['1000px', '700px'],
|
||||
content: '¥{request.contextPath}/${classInfo.className?uncap_first}/edit?id=0',
|
||||
});
|
||||
return false;
|
||||
}else if(obj.event === 'del') {
|
||||
var checkStatus = table.checkStatus('currentTableId')
|
||||
, data = checkStatus.data;
|
||||
layer.alert(JSON.stringify(data));
|
||||
}
|
||||
});
|
||||
/**
|
||||
* checkbox(currentTableFilter):表格复选框选择
|
||||
*/
|
||||
table.on('checkbox(currentTableFilter)', function (obj) {
|
||||
//console.log(obj)
|
||||
});
|
||||
|
||||
/**
|
||||
* tool监听事件:表格编辑删除等功能按钮
|
||||
*/
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
var index = layer.open({
|
||||
title: '编辑',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['1000px', '700px'],
|
||||
content: '¥{request.contextPath}/${classInfo.className?uncap_first}/edit?id='+obj.data.${classInfo.className?uncap_first}Id,
|
||||
});
|
||||
return false;
|
||||
} else if (obj.event === 'delete') {
|
||||
layer.confirm('确认删除该记录吗?', function (index) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "¥{request.contextPath}/${classInfo.className?uncap_first}/delete",
|
||||
data:{"id":obj.data.${classInfo.className?uncap_first}Id},
|
||||
success: function (responseData) {
|
||||
if (responseData.code === 200) {
|
||||
layer.msg(responseData.msg, function () {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
layer.msg(responseData.msg, function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}else if (obj.event === 'publish') {
|
||||
layer.confirm('确定要发布吗?', function (index) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "¥{request.contextPath}/${classInfo.className?uncap_first}/publish",
|
||||
data:{"id":obj.data.${classInfo.className?uncap_first}Id,"status":"1"},
|
||||
success: function (responseData) {
|
||||
searchBtn.click();
|
||||
layer.msg(responseData.msg, function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}else if (obj.event === 'unpublish') {
|
||||
layer.confirm('确定要停止吗?', function (index) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "¥{request.contextPath}/${classInfo.className?uncap_first}/publish",
|
||||
data:{"id":obj.data.${classInfo.className?uncap_first}Id,"status":"0"},
|
||||
success: function (responseData) {
|
||||
searchBtn.click();
|
||||
layer.msg(responseData.msg, function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,9 @@
|
||||
@ApiOperation(value = "${classInfo.classComment}", notes = "${classInfo.classComment}")
|
||||
@ApiImplicitParams({
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
@ApiImplicitParam(name = "${fieldItem.fieldName}", value = "${fieldItem.fieldComment}", required = false, dataType = "${fieldItem.fieldClass}")<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
}
|
||||
)
|
||||
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* ${classInfo.classComment}对象Get Set
|
||||
* @author ${authorName} ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
${fieldItem.fieldClass} ${fieldItem.fieldName} = ${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}();
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}();
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(${classInfo.className?uncap_first}2.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.fieldName?uncap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.columnName}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
map.put("${fieldItem.fieldComment}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.fieldName?uncap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
</#if>
|
||||
@ -0,0 +1,13 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
{
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
"${fieldItem.fieldName}":"${fieldItem.fieldComment}"<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
}
|
||||
|
||||
{
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
"${fieldItem.fieldName}":""<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
}
|
||||
</#if>
|
||||
@ -0,0 +1,74 @@
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#SQL横向select
|
||||
SELECT <#list classInfo.fieldList as fieldItem >t.${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list>
|
||||
FROM ${classInfo.tableName} t;
|
||||
|
||||
#CSV横向字段名
|
||||
<#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list>
|
||||
</#if>
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#LEFT JOIN
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
${classInfo.tableName} a
|
||||
LEFT JOIN ${classInfo.tableName} b
|
||||
ON a.${classInfo.tableName}_id=b.${classInfo.tableName}_id
|
||||
WHERE 1=1;
|
||||
</#if>
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#INSERT INTO
|
||||
INSERT INTO ${classInfo.tableName} ( <#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list> )
|
||||
VALUES
|
||||
(
|
||||
<#list classInfo.fieldList as fieldItem >''<#if fieldItem_has_next>,</#if></#list>
|
||||
);
|
||||
</#if>
|
||||
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#关联更新
|
||||
UPDATE ${classInfo.tableName} a
|
||||
JOIN ${classInfo.tableName}_join b ON a.${classInfo.tableName}_id = b.${classInfo.tableName}_id
|
||||
SET <#list classInfo.fieldList as fieldItem > a.${fieldItem.columnName} = b.${fieldItem.columnName}<#if fieldItem_has_next>,</#if> </#list>
|
||||
WHERE
|
||||
b.${classInfo.tableName}_id IS NOT NULL;
|
||||
|
||||
UPDATE ${classInfo.tableName} a,${classInfo.tableName}_join b
|
||||
SET <#list classInfo.fieldList as fieldItem > a.${fieldItem.columnName} = b.${fieldItem.columnName}<#if fieldItem_has_next>,</#if> </#list>
|
||||
WHERE a.${classInfo.tableName}_id = b.${classInfo.tableName}_id;
|
||||
|
||||
#普通update
|
||||
UPDATE ${classInfo.tableName}
|
||||
SET
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName} = ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
WHERE
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName} = ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>;
|
||||
</#if>
|
||||
|
||||
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#关联删除
|
||||
delete a from ${classInfo.tableName}_del as a inner join ${classInfo.tableName} as b
|
||||
where a.${classInfo.tableName}_id=b.${classInfo.tableName}_id;
|
||||
|
||||
#普通删除
|
||||
DELETE
|
||||
FROM
|
||||
${classInfo.tableName}
|
||||
WHERE
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName} = ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>;
|
||||
|
||||
</#if>
|
||||
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
${classInfo.className}:
|
||||
type: "object"
|
||||
properties:
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.fieldName}:
|
||||
type: ${fieldItem.swaggerClass}
|
||||
description: <#if isComment?exists && isComment==true>"${fieldItem.fieldComment}"</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
<!--
|
||||
${classInfo.classComment}对象Get Set
|
||||
@author ${authorName} ${.now?string('yyyy-MM-dd')}
|
||||
-->
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<${classInfo.className}>
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
<${fieldItem.fieldName}>${fieldItem.fieldComment}</${fieldItem.fieldName}>
|
||||
</#list>
|
||||
</${classInfo.className}>
|
||||
</#if>
|
||||
Loading…
x
Reference in New Issue
Block a user