61 lines
2.0 KiB
Plaintext
61 lines
2.0 KiB
Plaintext
|
|
package ${package.ServiceImpl};
|
|||
|
|
|
|||
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
|
|
import com.tiamo.dt.dev.db.pojo.page.PageParam;
|
|||
|
|
import com.tiamo.dt.dev.db.utils.MPUtil;
|
|||
|
|
import ${package.Entity}.${entity};
|
|||
|
|
import ${package.Mapper}.${table.mapperName};
|
|||
|
|
import ${package.Service}.${table.serviceName};
|
|||
|
|
import ${superServiceImplClassPackage};
|
|||
|
|
import org.springframework.stereotype.Service;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* $!{table.comment} 服务实现类
|
|||
|
|
*
|
|||
|
|
* @author ${author}
|
|||
|
|
* @since ${date}
|
|||
|
|
*/
|
|||
|
|
@Service
|
|||
|
|
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 通过实体类获取QueryWrapper
|
|||
|
|
* @param pageParam 分页参数
|
|||
|
|
* @param $!{table.entityPath} 实体信息
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public QueryWrapper<$!{entity}> getQueryWrapper(PageParam pageParam, $!{entity} $!{table.entityPath}){
|
|||
|
|
QueryWrapper<$!{entity}> queryWrapper = MPUtil.getQueryWrapper(pageParam);
|
|||
|
|
|
|||
|
|
if($!{table.entityPath} == null){
|
|||
|
|
return queryWrapper;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#foreach($field in ${table.fields})
|
|||
|
|
## 主键
|
|||
|
|
#if(${field.keyIdentityFlag})
|
|||
|
|
//主键
|
|||
|
|
if($!{table.entityPath}.get${field.capitalName}() != null){
|
|||
|
|
queryWrapper.lambda()
|
|||
|
|
.eq($!{entity}::get${field.capitalName}, $!{table.entityPath}.get${field.capitalName}());
|
|||
|
|
return queryWrapper;
|
|||
|
|
}
|
|||
|
|
#end
|
|||
|
|
#end
|
|||
|
|
|
|||
|
|
//TODO 此处可以根据各字段查询需求修改查询条件,eq、like、ge、gt、le、lt、ne...等等等
|
|||
|
|
queryWrapper.lambda()
|
|||
|
|
#foreach($field in ${table.fields})
|
|||
|
|
#if(!${field.keyIdentityFlag})
|
|||
|
|
#if($!{foreach.last})
|
|||
|
|
.eq($!{table.entityPath}.get${field.capitalName}() != null, $!{entity}::get${field.capitalName}, $!{table.entityPath}.get${field.capitalName}());
|
|||
|
|
#else
|
|||
|
|
.eq($!{table.entityPath}.get${field.capitalName}() != null, $!{entity}::get${field.capitalName}, $!{table.entityPath}.get${field.capitalName}())
|
|||
|
|
#end
|
|||
|
|
#end
|
|||
|
|
#end
|
|||
|
|
return queryWrapper;
|
|||
|
|
}
|
|||
|
|
}
|