更改返回标签
This commit is contained in:
@@ -131,18 +131,19 @@ public class UserDao {
|
|||||||
String sql = "select searchHistory from user where userName=? and isValid = 1";
|
String sql = "select searchHistory from user where userName=? and isValid = 1";
|
||||||
userEntity = runner.query(conn, sql, new BeanHandler<>(userEntity.class),name);
|
userEntity = runner.query(conn, sql, new BeanHandler<>(userEntity.class),name);
|
||||||
l = userEntity.getSearchHistory().split(";");
|
l = userEntity.getSearchHistory().split(";");
|
||||||
|
List<String> sss= new ArrayList<>(Arrays.asList(l));
|
||||||
for(int i=0;i<l.length;i++)
|
for(int i=0;i<sss.size();i++)
|
||||||
{
|
{
|
||||||
if(l[i].equals(str))
|
if(sss.get(i).equals(str))
|
||||||
{
|
{
|
||||||
l[i]="";
|
sss.remove(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
label = String.join(";",l)+";";
|
if(sss.size()!=0)
|
||||||
if(l.length == 1)
|
|
||||||
{
|
{
|
||||||
|
label = String.join(";",sss)+";";
|
||||||
|
}else{
|
||||||
label="";
|
label="";
|
||||||
}
|
}
|
||||||
sql="UPDATE user SET searchHistory = ? WHERE userName= ?";
|
sql="UPDATE user SET searchHistory = ? WHERE userName= ?";
|
||||||
|
@@ -44,7 +44,7 @@ public class selectUserLabelServlet extends HttpServlet {
|
|||||||
String name = userEntity.getUserName();
|
String name = userEntity.getUserName();
|
||||||
List<String> stringList = userService.selectLabel(name);
|
List<String> stringList = userService.selectLabel(name);
|
||||||
if(stringList.get(0).equals("无搜索历史")){
|
if(stringList.get(0).equals("无搜索历史")){
|
||||||
writer.println(jsonString);
|
writer.println("null");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
jsonString = JSONObject.toJSONString(stringList);
|
jsonString = JSONObject.toJSONString(stringList);
|
||||||
|
Reference in New Issue
Block a user