2020-02-13 10:48:51 +08:00
|
|
|
package ${packageName}.service.impl;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
2020-02-14 13:27:55 +08:00
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
2020-12-18 15:47:07 +08:00
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2020-02-13 10:48:51 +08:00
|
|
|
import ${packageName}.mapper.${ClassName}Mapper;
|
|
|
|
import ${packageName}.domain.${ClassName};
|
|
|
|
import ${packageName}.service.I${ClassName}Service;
|
|
|
|
|
2020-12-18 15:47:07 +08:00
|
|
|
import java.util.List;
|
2020-12-18 17:46:05 +08:00
|
|
|
import java.util.Map;
|
2020-12-18 15:47:07 +08:00
|
|
|
|
2020-02-13 10:48:51 +08:00
|
|
|
/**
|
|
|
|
* ${functionName}Service业务层处理
|
2020-02-14 13:27:55 +08:00
|
|
|
*
|
2020-02-13 10:48:51 +08:00
|
|
|
* @author ${author}
|
|
|
|
* @date ${datetime}
|
|
|
|
*/
|
|
|
|
@Service
|
2020-02-14 13:27:55 +08:00
|
|
|
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service {
|
2020-02-13 10:48:51 +08:00
|
|
|
|
2020-12-18 15:47:07 +08:00
|
|
|
@Override
|
|
|
|
public List<${ClassName}> queryList(${ClassName} ${className}) {
|
|
|
|
LambdaQueryWrapper<${ClassName}> lqw = Wrappers.lambdaQuery();
|
|
|
|
#foreach($column in $columns)
|
|
|
|
#set($queryType=$column.queryType)
|
|
|
|
#set($javaField=$column.javaField)
|
|
|
|
#set($javaType=$column.javaType)
|
|
|
|
#set($columnName=$column.columnName)
|
|
|
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
|
|
#if($column.query)
|
|
|
|
#if($column.queryType == "EQ")
|
2021-01-11 09:58:41 +08:00
|
|
|
#if($javaType == 'String')
|
2020-12-18 15:47:07 +08:00
|
|
|
if (StringUtils.isNotBlank(${className}.get$AttrName())){
|
|
|
|
lqw.eq(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
2021-01-11 09:58:41 +08:00
|
|
|
#else
|
2020-12-18 15:47:07 +08:00
|
|
|
if (${className}.get$AttrName() != null){
|
|
|
|
lqw.eq(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
#elseif($queryType == "NE")
|
2021-01-11 09:58:41 +08:00
|
|
|
#if($javaType == 'String')
|
2020-12-18 15:47:07 +08:00
|
|
|
if (StringUtils.isNotBlank(${className}.get$AttrName())){
|
|
|
|
lqw.ne(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
2021-01-11 09:58:41 +08:00
|
|
|
#else
|
2020-12-18 15:47:07 +08:00
|
|
|
if (${className}.get$AttrName() != null){
|
|
|
|
lqw.ne(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
2021-01-11 09:58:41 +08:00
|
|
|
#end
|
2020-12-18 15:47:07 +08:00
|
|
|
#elseif($queryType == "GT")
|
2021-01-11 09:58:41 +08:00
|
|
|
#if($javaType == 'String')
|
2020-12-18 15:47:07 +08:00
|
|
|
if (StringUtils.isNotBlank(${className}.get$AttrName())){
|
|
|
|
lqw.gt(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
2021-01-11 09:58:41 +08:00
|
|
|
#else
|
2020-12-18 15:47:07 +08:00
|
|
|
if (${className}.get$AttrName() != null){
|
|
|
|
lqw.gt(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
#elseif($queryType == "GTE")
|
2021-01-11 09:58:41 +08:00
|
|
|
#if($javaType == 'String')
|
2020-12-18 15:47:07 +08:00
|
|
|
if (StringUtils.isNotBlank(${className}.get$AttrName())){
|
|
|
|
lqw.ge(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
2021-01-11 09:58:41 +08:00
|
|
|
#else
|
2020-12-18 15:47:07 +08:00
|
|
|
if (${className}.get$AttrName() != null){
|
|
|
|
lqw.ge(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
#elseif($queryType == "LT")
|
2021-01-11 09:58:41 +08:00
|
|
|
#if($javaType == 'String')
|
2020-12-18 15:47:07 +08:00
|
|
|
if (StringUtils.isNotBlank(${className}.get$AttrName())){
|
|
|
|
lqw.lt(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
2021-01-11 09:58:41 +08:00
|
|
|
#else
|
2020-12-18 15:47:07 +08:00
|
|
|
if (${className}.get$AttrName() != null){
|
|
|
|
lqw.lt(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
#elseif($queryType == "LTE")
|
|
|
|
#if($javaType == 'String')
|
|
|
|
if (StringUtils.isNotBlank(${className}.get$AttrName())){
|
|
|
|
lqw.le(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (${className}.get$AttrName() != null){
|
|
|
|
lqw.le(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
#elseif($queryType == "LIKE")
|
|
|
|
#if($javaType == 'String')
|
|
|
|
if (StringUtils.isNotBlank(${className}.get$AttrName())){
|
|
|
|
lqw.like(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (${className}.get$AttrName() != null){
|
|
|
|
lqw.like(${ClassName}::get$AttrName ,${className}.get$AttrName());
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
#elseif($queryType == "BETWEEN")
|
2020-12-18 17:46:05 +08:00
|
|
|
Map<String, Object> params = ${className}.getParams();
|
|
|
|
if (params.get("begin$AttrName") != null && params.get("end$AttrName") != null) {
|
|
|
|
lqw.between(${ClassName}::get$AttrName ,params.get("begin$AttrName"),params.get("end$AttrName"));
|
|
|
|
}
|
2020-12-18 15:47:07 +08:00
|
|
|
#end
|
|
|
|
#end
|
|
|
|
#end
|
|
|
|
return this.list(lqw);
|
|
|
|
}
|
2020-02-13 10:48:51 +08:00
|
|
|
}
|