sql语句修改

This commit is contained in:
2023-07-06 11:02:57 +08:00
parent cd365131f4
commit 38eb9a2a0a
2 changed files with 3 additions and 4 deletions

View File

@@ -148,7 +148,7 @@ public class projectDao {
try {
Connection conn = JdbcUtils.getConnection();
QueryRunner runner = new QueryRunner();
String sql = "SELECT * FROM project WHERE isValid = 1 and projectName LIKE %?%";
String sql = "SELECT * FROM project WHERE isValid = 1 and projectTitle LIKE \"%\"? \"%\"";
projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class), str);
conn.close();
} catch (SQLException e) {

View File

@@ -45,7 +45,7 @@ public class selectByInputServlet extends HttpServlet {
resp.setContentType("application/json;charset=UTF-8");
//添加搜索历史
PrintWriter writer = resp.getWriter();
String str = req.getParameter("xxxxx");
String str = req.getParameter("content");
List<projectEntity> projectEntityList = projectService.selectByInput(str);
HttpSession session = req.getSession();
@@ -59,7 +59,6 @@ public class selectByInputServlet extends HttpServlet {
else{
String jsonString = JSONObject.toJSONString(projectEntityList);
writer.println(jsonString);
setResultOK("success",writer);
}
}
else{
@@ -72,7 +71,7 @@ public class selectByInputServlet extends HttpServlet {
else{
String jsonString = JSONObject.toJSONString(projectEntityList);
writer.println(jsonString);
setResultOK("success",writer);
writer.close();
}
}