返回cate和list数量

This commit is contained in:
2023-12-25 14:17:18 +08:00
parent 0f2a954882
commit a2fe05df1d
20 changed files with 158 additions and 40 deletions

View File

@@ -8,6 +8,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
@RestController
@@ -20,9 +21,9 @@ public class ConfigController {
@RequestMapping("/updateConfig")
public String updateConfig(Config config){
Date date=new Date();
int date1=Integer.valueOf(date.toString());
config.setUpdatetime(date1);
if (config==null){
try {
config.setUpdatetime(date.getTime());
if (config.getName().equals("")||config.getValue().equals("")){
return "配置文件不能为空!";
}
if (configService.updateConfig(config)==1){
@@ -32,18 +33,24 @@ public class ConfigController {
else if (configService.updateConfig(config)==2){
return "不存在名称为"+config.getName()+"的配置文件,请先添加!";
}
return "更新失败!";
return "更新失败!";}catch (NullPointerException e){
return "请输入配置信息!";
}
}
@RequestMapping("/addConfigString")
public String addConfig(Config config){
if (config.getName()==null||config.getValue()==null){
return "属性值不能为空";
}else {
Date date=new Date();
int date1=Integer.valueOf(date.toString());
config.setUpdatetime(date1);
return configService.addConfig(config);
try {
if (config.getName().equals("")||config.getValue().equals("")){
return "属性值不能为空";
}else {
Date date=new Date();
config.setUpdatetime(date.getTime());
return configService.addConfig(config);
}
}catch (NullPointerException e){
return "请输入配置信息";
}
}
}

View File

@@ -6,6 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@RestController
public class NavController {
@Autowired
@@ -34,7 +36,7 @@ public class NavController {
}
@RequestMapping("/selectAllNav")
public String selectAllNav(){
public HashMap<Integer, Object> selectAllNav(){
return navService.selectAllNav();
}

View File

@@ -675,4 +675,5 @@ public class UrlAndCateController {
return JSONObject.toJSONString(result);
}
}

View File

@@ -9,10 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
@RestController
public class UrlListController {
@@ -119,4 +116,19 @@ public class UrlListController {
result.put("data",urlListService.TopEight());
return JSONObject.toJSONString(result);
}
@RequestMapping("/getCateAndListNum")
public HashMap<String,String>getCateAndListNum(UrlCateList urlCateList){
HashMap<String,String>map=new HashMap<>();
if (urlCateList.getUserId()==null){
map.put("msg","用户ID不能为空");
return map;
}
List<Integer> ss=new ArrayList<>();
ss= (List<Integer>) urlCateListService.countAllCateByUser(urlCateList).get("cateNum");
map.put("cateNum", String.valueOf(ss.size()));
map.put("urlListNum", String.valueOf(urlListService.countUrlListByUserId(ss)));
return map;
}
}

View File

@@ -196,4 +196,27 @@ public class UserController {
return userService.getAllUsers();
}
@RequestMapping("/updateUserDetails")
public String updateUserDetails(User user){
if (user==null){
return "用户不能为空!";
}
return userService.updateUserMessage(user);
}
@RequestMapping("/deleteUser")
public String deleteUser(User user){
if (user==null){
return "请输入删除的用户的信息ID";
}
return userService.deleteUser(user);
}
// @RequestMapping("/updateStatus")
// public String updateStatus(User user){
// if (user==null){
// return "用户不能为空!";
// }
// return userService.updateUserMessage(user);
// }
}