| | |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import ${packageName}.mapper.${ClassName}Mapper; |
| | | import ${packageName}.domain.${ClassName}; |
| | | import ${packageName}.service.I${ClassName}Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ${functionName}Service业务层处理 |
| | |
| | | @Service |
| | | public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service { |
| | | |
| | | @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") |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.eq(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.eq(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #elseif($queryType == "NE") |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.ne(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.ne(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #elseif($queryType == "GT") |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.gt(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.gt(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #elseif($queryType == "GTE") |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.ge(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.ge(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #elseif($queryType == "LT") |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.lt(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | 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") |
| | | #end |
| | | #end |
| | | #end |
| | | return this.list(lqw); |
| | | } |
| | | } |