|
@@ -1,11 +1,9 @@
|
|
|
package ${packageName}.${moduleName}.${busName}.service.impl;
|
|
package ${packageName}.${moduleName}.${busName}.service.impl;
|
|
|
|
|
|
|
|
-import ${packageName}.${moduleName}.mapper.${busName}.${className}Mapper;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
|
|
+import cn.hutool.core.util.*;
|
|
|
import cn.tr.plugin.mybatis.pojo.BetweenQuery;
|
|
import cn.tr.plugin.mybatis.pojo.BetweenQuery;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -13,8 +11,9 @@ import ${packageName}.${moduleName}.${busName}.repository.${className}Repository
|
|
|
import ${packageName}.${moduleName}.${busName}.po.${className}PO;
|
|
import ${packageName}.${moduleName}.${busName}.po.${className}PO;
|
|
|
import ${packageName}.${moduleName}.${busName}.dto.${className}DTO;
|
|
import ${packageName}.${moduleName}.${busName}.dto.${className}DTO;
|
|
|
import ${packageName}.${moduleName}.${busName}.dto.${className}QueryDTO;
|
|
import ${packageName}.${moduleName}.${busName}.dto.${className}QueryDTO;
|
|
|
-import java.util.List;
|
|
|
|
|
-
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import ${packageName}.${moduleName}.${busName}.service.${className}Service;
|
|
|
|
|
+import ${packageName}.${moduleName}.mapper.${className}Mapper;
|
|
|
/**
|
|
/**
|
|
|
* ${functionName}Service接口实现类
|
|
* ${functionName}Service接口实现类
|
|
|
*
|
|
*
|
|
@@ -28,44 +27,45 @@ public class ${className}ServiceImpl implements ${className}Service {
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 根据条件查询{functionName}
|
|
|
|
|
|
|
+ * 根据条件查询${functionName}
|
|
|
* @param query 查询参数
|
|
* @param query 查询参数
|
|
|
* @author ${authorName}
|
|
* @author ${authorName}
|
|
|
* @date ${genTime}
|
|
* @date ${genTime}
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Override
|
|
|
public List<${className}DTO> select${className}List(${className}QueryDTO query){
|
|
public List<${className}DTO> select${className}List(${className}QueryDTO query){
|
|
|
return ${className}Mapper.INSTANCE.convertDtoList(
|
|
return ${className}Mapper.INSTANCE.convertDtoList(
|
|
|
baseRepository.selectList(new LambdaQueryWrapper<${className}PO>()
|
|
baseRepository.selectList(new LambdaQueryWrapper<${className}PO>()
|
|
|
<% for(var i = 0; i < configList.~size; i++) { %>
|
|
<% for(var i = 0; i < configList.~size; i++) { %>
|
|
|
<% if(configList[i].queryWhether != null && configList[i].queryWhether ) { %>
|
|
<% if(configList[i].queryWhether != null && configList[i].queryWhether ) { %>
|
|
|
<% if(configList[i].queryType == "like"){ %>
|
|
<% if(configList[i].queryType == "like"){ %>
|
|
|
- .like(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,
|
|
|
|
|
-query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .like(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},
|
|
|
|
|
+query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "notLike"){ %>
|
|
<% if(configList[i].queryType == "notLike"){ %>
|
|
|
- .notLike(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .notLike(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "eq"){ %>
|
|
<% if(configList[i].queryType == "eq"){ %>
|
|
|
- .eq(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .eq(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "ne"){ %>
|
|
<% if(configList[i].queryType == "ne"){ %>
|
|
|
- .ne(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .ne(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "gt"){ %>
|
|
<% if(configList[i].queryType == "gt"){ %>
|
|
|
- .gt(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .gt(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "ge"){ %>
|
|
<% if(configList[i].queryType == "ge"){ %>
|
|
|
- .ge(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .ge(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "lt"){ %>
|
|
<% if(configList[i].queryType == "lt"){ %>
|
|
|
- .lt(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .lt(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "le"){ %>
|
|
<% if(configList[i].queryType == "le"){ %>
|
|
|
- .le(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper()),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
|
|
|
|
+ .le(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% if(configList[i].queryType == "BETWEEN"){ %>
|
|
<% if(configList[i].queryType == "BETWEEN"){ %>
|
|
|
- .le(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())&&Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper().getMax(),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper().getMax()))
|
|
|
|
|
- .ge(Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())&&Objects.nonNull(query.get<%%>configList[i].fieldNameCamelCaseFirstUpper().getMin(),${className}PO::get<%%>configList[i].fieldNameCamelCaseFirstUpper,query.get<%%>configList[i].fieldNameCamelCaseFirstUpper().getMin()))
|
|
|
|
|
|
|
+ .le(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}())&&Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}().getMax()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}().getMax())
|
|
|
|
|
+ .ge(Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}())&&Objects.nonNull(query.get${configList[i].fieldNameCamelCaseFirstUpper}().getMin()),${className}PO::get${configList[i].fieldNameCamelCaseFirstUpper},query.get${configList[i].fieldNameCamelCaseFirstUpper}().getMin())
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% } %>
|
|
<% } %>
|
|
|
<% } %>
|
|
<% } %>
|
|
@@ -74,12 +74,13 @@ query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 根据id查询{functionName}
|
|
|
|
|
|
|
+ * 根据id查询${functionName}
|
|
|
* @param id 主键id
|
|
* @param id 主键id
|
|
|
* @author ${authorName}
|
|
* @author ${authorName}
|
|
|
* @date ${genTime}
|
|
* @date ${genTime}
|
|
|
*/
|
|
*/
|
|
|
- public ${className}CommonDTO select${className}ById(String id){
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ${className}DTO select${className}ById(String id){
|
|
|
return ${className}Mapper.INSTANCE.convertDto(baseRepository.selectById(id));
|
|
return ${className}Mapper.INSTANCE.convertDto(baseRepository.selectById(id));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -90,27 +91,30 @@ query.get<%%>configList[i].fieldNameCamelCaseFirstUpper())
|
|
|
* @date ${genTime}
|
|
* @date ${genTime}
|
|
|
*/
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @Override
|
|
|
public boolean update${className}ById(${className}DTO source){
|
|
public boolean update${className}ById(${className}DTO source){
|
|
|
return baseRepository.updateById(${className}Mapper.INSTANCE.convertPO(source))!=0;
|
|
return baseRepository.updateById(${className}Mapper.INSTANCE.convertPO(source))!=0;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 新增{functionName}
|
|
|
|
|
|
|
+ * 新增${functionName}
|
|
|
* @param source 新增实体类
|
|
* @param source 新增实体类
|
|
|
* @author ${authorName}
|
|
* @author ${authorName}
|
|
|
* @date ${genTime}
|
|
* @date ${genTime}
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean insert${className}(${className}AddDTO source){
|
|
|
|
|
|
|
+ public boolean insert${className}(${className}DTO source){
|
|
|
return baseRepository.insert(${className}Mapper.INSTANCE.convertPO(source))!=0;
|
|
return baseRepository.insert(${className}Mapper.INSTANCE.convertPO(source))!=0;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 删除{functionName}详情
|
|
|
|
|
|
|
+ * 删除${functionName}详情
|
|
|
* @param ids 删除主键集合
|
|
* @param ids 删除主键集合
|
|
|
* @author ${authorName}
|
|
* @author ${authorName}
|
|
|
* @date ${genTime}
|
|
* @date ${genTime}
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int delete${className}ByIds(Collection<String> ids){
|
|
public int delete${className}ByIds(Collection<String> ids){
|
|
|
return baseRepository.deleteBatchIds(ids);
|
|
return baseRepository.deleteBatchIds(ids);
|