package ${packageName}.service.impl; import java.util.List; #foreach ($column in $columns) #if($column.javaField == 'createTime' || $column.javaField == 'updateTime') import com.ruoyi.common.utils.DateUtils; #break #end #end import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.ArrayList; import java.util.Map; import com.ruoyi.common.utils.StringUtils; #if($table.sub) import org.springframework.transaction.annotation.Transactional; import ${packageName}.domain.${subClassName}; #end import ${packageName}.mapper.${ClassName}Mapper; import ${packageName}.domain.${ClassName}; import ${packageName}.service.I${ClassName}Service; /** * ${functionName}Service业务层处理 * * @author ${author} * @date ${datetime} */ @Service public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service { /** * 查询${functionName}列表 * * @param ${className} ${functionName} * @return ${functionName} */ @Override public List<${ClassName}> queryList(${ClassName} ${className}) { LambdaQueryWrapper<${ClassName}> wrappers = 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())){ wrappers.eq(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #else if (${className}.get$AttrName() != null){ wrappers.eq(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #end #elseif($queryType == "NE") #if($javaType == 'String') if (StringUtils.isNotBlank(${className}.get$AttrName())){ wrappers.ne(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #else if (${className}.get$AttrName() != null){ wrappers.ne(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #end #elseif($queryType == "GT") #if($javaType == 'String') if (StringUtils.isNotBlank(${className}.get$AttrName())){ wrappers.gt(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #else if (${className}.get$AttrName() != null){ wrappers.gt(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #end #elseif($queryType == "GTE") #if($javaType == 'String') if (StringUtils.isNotBlank(${className}.get$AttrName())){ wrappers.ge(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #else if (${className}.get$AttrName() != null){ wrappers.ge(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #end #elseif($queryType == "LT") #if($javaType == 'String') if (StringUtils.isNotBlank(${className}.get$AttrName())){ wrappers.lt(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #else if (${className}.get$AttrName() != null){ wrappers.lt(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #end #elseif($queryType == "LTE") #if($javaType == 'String') if (StringUtils.isNotBlank(${className}.get$AttrName())){ wrappers.le(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #else if (${className}.get$AttrName() != null){ wrappers.le(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #end #elseif($queryType == "LIKE") #if($javaType == 'String') if (StringUtils.isNotBlank(${className}.get$AttrName())){ wrappers.like(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #else if (${className}.get$AttrName() != null){ wrappers.like(${ClassName}::get$AttrName ,${className}.get$AttrName()); } #end #elseif($queryType == "BETWEEN") Map params = ${className}.getParams(); if (params.get("begin$AttrName") != null && params.get("end$AttrName") != null) { wrappers.between(${ClassName}::get$AttrName ,params.get("begin$AttrName"),params.get("end$AttrName")); } #end #end #end return this.list(wrappers); } }