update: 代码生成器
parent
167d95c003
commit
1b6d831eb2
|
@ -107,6 +107,7 @@
|
||||||
</path>
|
</path>
|
||||||
<!-- other annotation processors -->
|
<!-- other annotation processors -->
|
||||||
</annotationProcessorPaths>
|
</annotationProcessorPaths>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class VelocityUtils {
|
||||||
templates.add("vm/java/idata.java.vm");
|
templates.add("vm/java/idata.java.vm");
|
||||||
templates.add("vm/java/idataimpl.java.vm");
|
templates.add("vm/java/idataimpl.java.vm");
|
||||||
templates.add("vm/java/tbmodel.java.vm");
|
templates.add("vm/java/tbmodel.java.vm");
|
||||||
|
templates.add("vm/java/repository.java.vm");
|
||||||
if (DataBaseHelper.isOracle()) {
|
if (DataBaseHelper.isOracle()) {
|
||||||
templates.add("vm/sql/oracle/sql.vm");
|
templates.add("vm/sql/oracle/sql.vm");
|
||||||
} else if (DataBaseHelper.isPostgerSql()) {
|
} else if (DataBaseHelper.isPostgerSql()) {
|
||||||
|
@ -162,11 +163,24 @@ public class VelocityUtils {
|
||||||
if (template.contains("domain.java.vm")) {
|
if (template.contains("domain.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
||||||
}
|
}
|
||||||
|
if (template.endsWith("tbmodel.java.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/data/model/Tb{}.java", javaPath, className);
|
||||||
|
} else if (template.endsWith("model.java.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/model/{}.java", javaPath, className);
|
||||||
|
}
|
||||||
|
if (template.endsWith("repository.java.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/repository/{}Repository.java", javaPath, className);
|
||||||
|
}
|
||||||
|
if (template.endsWith("idata.java.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/data/I{}Data.java", javaPath, className);
|
||||||
|
} else if (template.endsWith("idataimpl.java.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/data/impl/{}DataImpl.java", javaPath, className);
|
||||||
|
}
|
||||||
if (template.contains("vo.java.vm")) {
|
if (template.contains("vo.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/domain/vo/{}Vo.java", javaPath, className);
|
fileName = StringUtils.format("{}/dto/vo/{}Vo.java", javaPath, className);
|
||||||
}
|
}
|
||||||
if (template.contains("bo.java.vm")) {
|
if (template.contains("bo.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/domain/bo/{}Bo.java", javaPath, className);
|
fileName = StringUtils.format("{}/dto/bo/{}Bo.java", javaPath, className);
|
||||||
}
|
}
|
||||||
if (template.contains("mapper.java.vm")) {
|
if (template.contains("mapper.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package ${packageName}.domain.bo;
|
package ${packageName}.dto.bo;
|
||||||
|
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.model.${ClassName};
|
||||||
import cc.iotkit.common.api.BaseDto;
|
import cc.iotkit.common.api.BaseDto;
|
||||||
import cc.iotkit.common.api.PageRequest;
|
import cc.iotkit.common.api.PageRequest;
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -19,8 +19,8 @@ import cc.iotkit.common.validate.AddGroup;
|
||||||
import cc.iotkit.common.validate.EditGroup;
|
import cc.iotkit.common.validate.EditGroup;
|
||||||
import cc.iotkit.common.log.enums.BusinessType;
|
import cc.iotkit.common.log.enums.BusinessType;
|
||||||
import cc.iotkit.common.excel.utils.ExcelUtil;
|
import cc.iotkit.common.excel.utils.ExcelUtil;
|
||||||
import ${packageName}.domain.vo.${ClassName}Vo;
|
import ${packageName}.dto.vo.${ClassName}Vo;
|
||||||
import ${packageName}.domain.bo.${ClassName}Bo;
|
import ${packageName}.dto.bo.${ClassName}Bo;
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,12 +70,11 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取${functionName}详细信息
|
* 获取${functionName}详细信息
|
||||||
*
|
*
|
||||||
* @param ${pkColumn.javaField} 主键
|
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("${permissionPrefix}:query")
|
@SaCheckPermission("${permissionPrefix}:query")
|
||||||
@PostMapping("/getDetail")
|
@PostMapping("/getDetail")
|
||||||
@ApiOperation("获取${functionName}详细信息")
|
@ApiOperation("获取${functionName}详细信息")
|
||||||
public R<${ClassName}Vo> getDetail(@Validated @RequestBody Request<Long> request) {
|
public ${ClassName}Vo getDetail(@Validated @RequestBody Request<Long> request) {
|
||||||
return ${className}Service.queryById(request.getData());
|
return ${className}Service.queryById(request.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,20 +96,19 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ApiOperation("修改${functionName}")
|
@ApiOperation("修改${functionName}")
|
||||||
public boolean edit(@Validated(EditGroup.class) @RequestBody Request<${ClassName}Bo> bo) {
|
public boolean edit(@Validated(EditGroup.class) @RequestBody Request<${ClassName}Bo> request) {
|
||||||
return ${className}Service.updateByBo(bo);
|
return ${className}Service.updateByBo(request.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除${functionName}
|
* 删除${functionName}
|
||||||
*
|
*
|
||||||
* @param ${pkColumn.javaField}s 主键串
|
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("${permissionPrefix}:remove")
|
@SaCheckPermission("${permissionPrefix}:remove")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@ApiOperation("删除${functionName}")
|
@ApiOperation("删除${functionName}")
|
||||||
public boolean remove(@Validated @RequestBody Request<List<Long>> query) {
|
public boolean remove(@Validated @RequestBody Request<List<Long>> query) {
|
||||||
return ${className}Service.deleteWithValidByIds(query.getData());
|
return ${className}Service.deleteWithValidByIds(query.getData(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package ${packageName}.data;
|
package ${packageName}.data;
|
||||||
|
|
||||||
import cc.iotkit.data.ICommonData;
|
import cc.iotkit.data.ICommonData;
|
||||||
import cc.iotkit.model.system.SysRole;
|
import ${packageName}.model.${ClassName};
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,12 +2,24 @@ package ${packageName}.data;
|
||||||
|
|
||||||
import cc.iotkit.data.ICommonData;
|
import cc.iotkit.data.ICommonData;
|
||||||
import ${packageName}.data.I${ClassName}Data;
|
import ${packageName}.data.I${ClassName}Data;
|
||||||
import ${packageName}.data.${ClassName};
|
import ${packageName}.data.model.Tb${ClassName};
|
||||||
|
import ${packageName}.model.${ClassName};
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import com.querydsl.core.QueryResults;
|
||||||
|
import com.querydsl.core.types.Predicate;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import cc.iotkit.data.util.PredicateBuilder;
|
||||||
|
|
||||||
import cc.iotkit.common.api.PageRequest;
|
import cc.iotkit.common.api.PageRequest;
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
|
import cc.iotkit.common.utils.StringUtils;
|
||||||
|
import java.util.Collection;
|
||||||
|
import cc.iotkit.common.utils.MapstructUtils;
|
||||||
|
|
||||||
|
|
||||||
import static ${packageName}.data.model.QTb${ClassName}.tb${ClassName};
|
import static ${packageName}.data.model.QTb${ClassName}.tb${ClassName};
|
||||||
|
@ -20,27 +32,11 @@ import static ${packageName}.data.model.QTb${ClassName}.tb${ClassName};
|
||||||
@Primary
|
@Primary
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ${ClassName}DataImpl implements I${ClassName}Data, IJPACommData<${ClassName}, Long> {
|
public class ${ClassName}DataImpl implements I${ClassName}Data {
|
||||||
|
|
||||||
private final ${ClassName}Repository baseRepository;
|
private final ${ClassName}Repository baseRepository;
|
||||||
|
|
||||||
|
private final JPAQueryFactory jpaQueryFactory;
|
||||||
|
|
||||||
@Override
|
|
||||||
public JpaRepository getBaseRepository() {
|
|
||||||
return baseRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class getJpaRepositoryClass() {
|
|
||||||
return Tb${ClassName}.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class getTClass() {
|
|
||||||
return ${ClassName}.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<${ClassName}> findAll(PageRequest<${ClassName}> pageRequest) {
|
public Paging<${ClassName}> findAll(PageRequest<${ClassName}> pageRequest) {
|
||||||
|
@ -73,4 +69,37 @@ public class ${ClassName}DataImpl implements I${ClassName}Data, IJPACommData<${C
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<${ClassName}> findByIds(Collection<Long> id) {
|
||||||
|
List allById = baseRepository.findAllById(id);
|
||||||
|
return MapstructUtils.convert(allById, ${ClassName}.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ${ClassName} save(${ClassName} data) {
|
||||||
|
Object o = baseRepository.save(MapstructUtils.convert(data, Tb${ClassName}.class));
|
||||||
|
return MapstructUtils.convert(o, ${ClassName}.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void batchSave(List<${ClassName}> data) {
|
||||||
|
baseRepository.saveAll(MapstructUtils.convert(data, Tb${ClassName}.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(Long id) {
|
||||||
|
baseRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteByIds(Collection<Long> ids) {
|
||||||
|
baseRepository.deleteAllById(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ${ClassName} findById(Long id) {
|
||||||
|
Tb${ClassName} ret = jpaQueryFactory.select(tb${ClassName}).from(tb${ClassName}).where(tb${ClassName}.id.eq(id)).fetchOne();
|
||||||
|
${ClassName} convert = MapstructUtils.convert(ret, ${ClassName}.class);
|
||||||
|
return convert;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import cc.iotkit.model.Id;
|
||||||
#if($IsTenant==1)
|
#if($IsTenant==1)
|
||||||
import cc.iotkit.model.TenantModel;
|
import cc.iotkit.model.TenantModel;
|
||||||
#else
|
#else
|
||||||
import cc.iotkit.data.model.BaseEntity;
|
import cc.iotkit.model.BaseModel;
|
||||||
#end
|
#end
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -17,7 +17,8 @@ import lombok.EqualsAndHashCode;
|
||||||
import ${import};
|
import ${import};
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}对象 ${tableName}
|
* ${functionName}对象 ${tableName}
|
||||||
|
@ -34,7 +35,6 @@ import java.io.Serial;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ${ClassName} extends ${Entity} implements Id<Long>, Serializable{
|
public class ${ClassName} extends ${Entity} implements Id<Long>, Serializable{
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package ${packageName}.data.dao;
|
||||||
|
|
||||||
|
import cc.iotkit.data.model.Tb${ClassName};
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}对象 ${tableName}
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
public interface ${ClassName}Repository extends JpaRepository<Tb${ClassName}, Long>, QuerydslPredicateExecutor<Tb${ClassName}> {
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package ${packageName}.service;
|
package ${packageName}.service;
|
||||||
|
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.dto.vo.${ClassName}Vo;
|
||||||
import ${packageName}.domain.vo.${ClassName}Vo;
|
import ${packageName}.dto.bo.${ClassName}Bo;
|
||||||
import ${packageName}.domain.bo.${ClassName}Bo;
|
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
import cc.iotkit.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import cc.iotkit.common.mybatis.core.page.PageQuery;
|
|
||||||
#end
|
#end
|
||||||
|
import cc.iotkit.common.api.Paging;
|
||||||
|
import cc.iotkit.common.api.PageRequest;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package ${packageName}.service.impl;
|
package ${packageName}.service.impl;
|
||||||
|
|
||||||
import cc.iotkit.common.core.utils.MapstructUtils;
|
import cc.iotkit.common.utils.MapstructUtils;
|
||||||
import cc.iotkit.common.core.utils.StringUtils;
|
import cc.iotkit.common.utils.StringUtils;
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
import cc.iotkit.common.api.PageRequest;
|
import cc.iotkit.common.api.PageRequest;
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
|
@ -9,14 +9,17 @@ import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.common.api.Request;
|
import cc.iotkit.common.api.Request;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ${packageName}.domain.bo.${ClassName}Bo;
|
import ${packageName}.dto.bo.${ClassName}Bo;
|
||||||
import ${packageName}.domain.vo.${ClassName}Vo;
|
import ${packageName}.dto.vo.${ClassName}Vo;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.model.${ClassName};
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
|
import ${packageName}.data.I${ClassName}Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import cc.iotkit.common.exception.BizException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Service业务层处理
|
* ${functionName}Service业务层处理
|
||||||
|
@ -35,7 +38,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}){
|
public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}){
|
||||||
return baseData.selectVoById(${pkColumn.javaField});
|
return MapstructUtils.convert(baseData.findById(${pkColumn.javaField}), ${ClassName}Vo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
|
@ -43,9 +46,8 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Paging<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) {
|
public Paging<${ClassName}Vo> queryPageList(PageRequest<${ClassName}Bo> pageQuery) {
|
||||||
LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
|
Paging<${ClassName}Vo> result = baseData.findAll(pageQuery.to(${ClassName}.class)).to(${ClassName}Vo.class);
|
||||||
Paging<${ClassName}Vo> result = baseData.selectVoPage(pageQuery.build(), lqw);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
@ -56,22 +58,22 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
||||||
@Override
|
@Override
|
||||||
public List<${ClassName}Vo> queryList(${ClassName}Bo bo) {
|
public List<${ClassName}Vo> queryList(${ClassName}Bo bo) {
|
||||||
|
|
||||||
return baseData.selectVoList(bo);
|
return MapstructUtils.convert(baseData.findAllByCondition(bo.to(${ClassName}.class)), ${ClassName}Vo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增${functionName}
|
* 新增${functionName}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(${ClassName}Bo bo) {
|
public Long insertByBo(${ClassName}Bo bo) {
|
||||||
${ClassName} add = MapstructUtils.convert(bo, ${ClassName}.class);
|
${ClassName} add = MapstructUtils.convert(bo, ${ClassName}.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseData.insert(add) > 0;
|
baseData.save(add);
|
||||||
#set($pk=$pkColumn.javaField.substring(0,1).toUpperCase() + ${pkColumn.javaField.substring(1)})
|
if (add == null) {
|
||||||
if (flag) {
|
throw new BizException("新增失败");
|
||||||
bo.set$pk(add.get$pk());
|
|
||||||
}
|
}
|
||||||
return flag;
|
#set($pk=$pkColumn.javaField.substring(0,1).toUpperCase() + ${pkColumn.javaField.substring(1)})
|
||||||
|
return add.get$pk();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +83,11 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
||||||
public Boolean updateByBo(${ClassName}Bo bo) {
|
public Boolean updateByBo(${ClassName}Bo bo) {
|
||||||
${ClassName} update = MapstructUtils.convert(bo, ${ClassName}.class);
|
${ClassName} update = MapstructUtils.convert(bo, ${ClassName}.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseData.updateById(update) > 0;
|
${ClassName} ret = baseData.save(update);
|
||||||
|
if(ret == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,6 +105,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
||||||
if(isValid){
|
if(isValid){
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
return baseData.deleteBatchIds(ids) > 0;
|
baseData.deleteByIds(ids);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.javaField=='tenantId')
|
#if($column.javaField=='tenantId')
|
||||||
#set($IsTenant=1)
|
#set($IsTenant=1)
|
||||||
|
@ -22,7 +24,6 @@ import lombok.EqualsAndHashCode;
|
||||||
import ${import};
|
import ${import};
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}对象 ${tableName}
|
* ${functionName}对象 ${tableName}
|
||||||
|
@ -43,8 +44,7 @@ import java.io.Serial;
|
||||||
@AutoMapper(target = ${ClassName}.class)
|
@AutoMapper(target = ${ClassName}.class)
|
||||||
public class Tb${ClassName} extends ${Entity} {
|
public class Tb${ClassName} extends ${Entity} {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package ${packageName}.domain.vo;
|
package ${packageName}.dto.vo;
|
||||||
|
|
||||||
#foreach ($import in $importList)
|
#foreach ($import in $importList)
|
||||||
import ${import};
|
import ${import};
|
||||||
#end
|
#end
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.model.${ClassName};
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import cc.iotkit.common.excel.annotation.ExcelDictFormat;
|
import cc.iotkit.common.excel.annotation.ExcelDictFormat;
|
||||||
|
@ -28,7 +28,7 @@ import java.util.Date;
|
||||||
@AutoMapper(target = ${ClassName}.class)
|
@AutoMapper(target = ${ClassName}.class)
|
||||||
public class ${ClassName}Vo implements Serializable {
|
public class ${ClassName}Vo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
|
|
Loading…
Reference in New Issue