|
@@ -1,6 +1,7 @@
|
|
|
package com.museum.dao.Provide;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.museum.domain.request.UserPageRequest;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
|
|
|
/**
|
|
@@ -10,15 +11,22 @@ import lombok.extern.log4j.Log4j2;
|
|
|
@Log4j2
|
|
|
public class UserProvider {
|
|
|
|
|
|
- public String findBySearchKey(String searchKey){
|
|
|
+ public String findBySearchKey(UserPageRequest param){
|
|
|
StringBuffer sql = new StringBuffer("" +
|
|
|
"SELECT * FROM tb_user where rec_status = 'A' ");
|
|
|
+ String searchKey = param.getSearchKey();
|
|
|
if(StrUtil.isNotBlank(searchKey)){
|
|
|
sql.append(" and (");
|
|
|
sql.append(" user_name like '%").append(searchKey).append("%'");
|
|
|
sql.append(" or phone like '%").append(searchKey).append("%'");
|
|
|
sql.append( ")");
|
|
|
}
|
|
|
+
|
|
|
+ Integer status = param.getStatus();
|
|
|
+ if (status != null) {
|
|
|
+ sql.append("and status = ").append(status);
|
|
|
+ }
|
|
|
+
|
|
|
sql.append(" ORDER BY create_time DESC");
|
|
|
log.info("sql: {}", sql.toString());
|
|
|
return sql.toString();
|