更新搜索历史
This commit is contained in:
@@ -139,12 +139,13 @@ public class UserDao {
|
|||||||
* */
|
* */
|
||||||
public String selectLabel(String name){
|
public String selectLabel(String name){
|
||||||
String label;
|
String label;
|
||||||
|
userEntity userEntity1;
|
||||||
try {
|
try {
|
||||||
Connection conn = JdbcUtils.getConnection();
|
Connection conn = JdbcUtils.getConnection();
|
||||||
QueryRunner runner = new QueryRunner();
|
QueryRunner runner = new QueryRunner();
|
||||||
String sql = "select searchHistory from user where userName=?";
|
String sql = "select searchHistory from user where userName=?";
|
||||||
label = runner.query(conn, sql, new BeanHandler<>(String.class),name);
|
userEntity1 = runner.query(conn, sql, new BeanHandler<>(userEntity.class),name);
|
||||||
|
label=userEntity1.getSearchHistory();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,13 @@ public class selectByInputServlet extends HttpServlet {
|
|||||||
userEntity userEntity= null;
|
userEntity userEntity= null;
|
||||||
userEntity=(userEntity)session.getAttribute("user");
|
userEntity=(userEntity)session.getAttribute("user");
|
||||||
if(userEntity == null)
|
if(userEntity == null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(projectEntityList.size() == 0 ){
|
if(projectEntityList.size() == 0 ){
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.hellogithub.servlet;
|
package com.hellogithub.servlet;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hellogithub.entity.userEntity;
|
||||||
import com.hellogithub.service.UserService;
|
import com.hellogithub.service.UserService;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.annotation.WebServlet;
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
@@ -32,7 +33,9 @@ public class selectUserLabelServlet extends HttpServlet {
|
|||||||
|
|
||||||
//返回所有的历史记录
|
//返回所有的历史记录
|
||||||
PrintWriter writer = resp.getWriter();
|
PrintWriter writer = resp.getWriter();
|
||||||
String name = req.getParameter("xxxxx");
|
HttpSession session = req.getSession();
|
||||||
|
userEntity userEntity=(userEntity)session.getAttribute("user");
|
||||||
|
String name = userEntity.getUserName();
|
||||||
String jsonString = JSONObject.toJSONString(userService.selectLabel(name));
|
String jsonString = JSONObject.toJSONString(userService.selectLabel(name));
|
||||||
writer.println(jsonString);
|
writer.println(jsonString);
|
||||||
setResultOK("success",writer);
|
setResultOK("success",writer);
|
||||||
|
Reference in New Issue
Block a user