30 lines
676 B
Java
30 lines
676 B
Java
package com.cym.service;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import com.cym.bean.Page;
|
|
import com.cym.model.Example;
|
|
import com.cym.utils.ConditionAndWrapper;
|
|
import com.cym.utils.JpaHelper;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
@Service
|
|
public class ExampleService {
|
|
@Autowired
|
|
JpaHelper jpaHelper;
|
|
|
|
public Page search(Page page, String keyword) {
|
|
ConditionAndWrapper conditionAndWrapper = new ConditionAndWrapper();
|
|
if (StrUtil.isNotEmpty(keyword)) {
|
|
conditionAndWrapper.like(Example::getName, keyword);
|
|
}
|
|
|
|
page = jpaHelper.findPageByQuery(page, Example.class);
|
|
|
|
return page;
|
|
}
|
|
|
|
}
|