patentWall 添加日期范围查询方式

dev
IT-xiaoXiong 2021-12-09 10:14:59 +08:00
parent 401962fbe8
commit 83958015b2
2 changed files with 50 additions and 6 deletions

View File

@ -298,6 +298,26 @@ public class PatentWallService {
args.add(filterWhere.getValue());
continue;
}
if (filterWhere.getSearchType() == 7) {
// 日期等于
whereBuilder.append(" DATE_FORMAT(")
.append(filterWhere.getDbField())
.append(",'%y-%m-%d') = ")
.append("DATE_FORMAT(?,'%y-%m-%d')");
args.add(filterWhere.getValue());
continue;
}
if (filterWhere.getSearchType() == 8) {
// 日期范围
whereBuilder.append(" DATE_FORMAT(")
.append(filterWhere.getDbField())
.append(",'%y-%m-%d') between ")
.append("DATE_FORMAT(?,'%y-%m-%d')")
.append(" and DATE_FORMAT(?,'%y-%m-%d')");
args.add(filterWhere.getValue().split("&")[0]);
args.add(filterWhere.getValue().split("&")[1]);
continue;
}
}
return patentWallMapping.getListByFilterWhere(whereBuilder, args, tableName);
}

View File

@ -2,11 +2,13 @@ package customization.test;
import aiyh.utils.Util;
import aiyh.utils.fileUtil.ProperUtil;
import cn.hutool.core.util.URLUtil;
import com.alibaba.fastjson.JSON;
import com.api.aiyh_pcn.patentWall.service.PatentWallService;
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
import com.api.aiyh_pcn.patentWall.vo.SearchInputVO;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
@ -15,7 +17,6 @@ import weaver.general.GCONST;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -384,4 +385,27 @@ public class NewUtilTest {
System.out.println(var17.size());
System.out.println(var17);
}
@Test
public void testMessage() {
MessageType messageType = MessageType.newInstance(1146); //消息来源(见文档第四点补充)
Set<String> userIdList = new HashSet<>(); //接收人id
userIdList.add("22");
userIdList.add("23");
userIdList.add("24");
String title = "标题"; //标题
String context = "内容"; //内容
String linkUrl = ""; //PC端链接 纯文本就传空字符串
String linkMobileUrl = ""; //移动端链接 纯文本就传空字符串
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);//创建人id
//message.setBizState("0");需要修改消息状态时传入,表示消息最初状态为待处理
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id 需要修改消息状态时传入,这个字段是自定义的,和修改消息状态的时候传入相同的值,可做更新。
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
}