You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.5 KiB
39 lines
1.5 KiB
package ${packageName}.${moduleName}.service.impl;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import ${packageName}.${moduleName}.entity.${className};
|
|
import ${packageName}.${moduleName}.mapper.${className}Mapper;
|
|
import ${packageName}.${moduleName}.service.${className}Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
/**
|
|
* ${tableComment} 服务实现类
|
|
*
|
|
* @author ${author}
|
|
* @since ${date}
|
|
*/
|
|
@Service
|
|
public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${className}> implements ${className}Service {
|
|
|
|
@Override
|
|
public IPage<${className}> selectPage(Page<${className}> page, ${className} entity) {
|
|
QueryWrapper<${className}> queryWrapper = new QueryWrapper<>();
|
|
// 添加查询条件
|
|
<% for(field in fields) { %>
|
|
<% if(field.fieldName != 'id' && field.fieldName != 'createTime' && field.fieldName != 'updateTime') { %>
|
|
if (entity.get${field.propertyName?cap_first}() != null) {
|
|
<% if(field.fieldType == 'String') { %>
|
|
queryWrapper.like("${field.fieldName}", entity.get${field.propertyName?cap_first}());
|
|
<% } else { %>
|
|
queryWrapper.eq("${field.fieldName}", entity.get${field.propertyName?cap_first}());
|
|
<% } %>
|
|
}
|
|
<% } %>
|
|
<% } %>
|
|
|
|
return this.page(page, queryWrapper);
|
|
}
|
|
}
|