接口213132123123123123123123123123
This commit is contained in:
parent
6268a5c374
commit
829111209f
@ -584,7 +584,7 @@ public class UrlAndCateController {
|
||||
}
|
||||
|
||||
@RequestMapping("/insertCateByUser")
|
||||
public String disposeBookmarkToJsonByUserId(UrlCateList urlCateList)
|
||||
public String insertCateByUser(UrlCateList urlCateList)
|
||||
{
|
||||
int flag = 0;
|
||||
Date date = new Date();
|
||||
|
@ -1,15 +1,25 @@
|
||||
package com.lovenav.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.lovenav.entity.UrlCateList;
|
||||
import com.lovenav.entity.UrlList;
|
||||
import com.lovenav.service.UrlCateListService;
|
||||
import com.lovenav.service.UrlListService;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
public class UrlListController {
|
||||
@Autowired
|
||||
UrlListService urlListService;
|
||||
@Autowired
|
||||
UrlCateListService urlCateListService;
|
||||
//后台修改网站状态
|
||||
@RequestMapping("/admin/weblist/alterUrlStatus")
|
||||
public String setUrlStatus(UrlList urlList){
|
||||
@ -20,4 +30,75 @@ public class UrlListController {
|
||||
return "修改失败";
|
||||
}
|
||||
}
|
||||
@RequestMapping("/admin/weblist/deleteUrl")
|
||||
public String deleteUrl(String urlId)
|
||||
{
|
||||
int flag = 0;
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
UrlList urlList = urlListService.selectUrlListByUrlId(Long.valueOf(urlId));
|
||||
String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId());
|
||||
String [] parentList = parentString.split(",");
|
||||
System.out.println(parentString);
|
||||
for(String parent : parentList)
|
||||
{
|
||||
if(parent.equals("0")){
|
||||
continue;
|
||||
}
|
||||
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(parent));
|
||||
if(urlCateListService.updateByUrlCateList(urlCateList) == 0)
|
||||
{
|
||||
flag = 0;
|
||||
}else{
|
||||
flag = 1;
|
||||
}
|
||||
}
|
||||
if(flag == 1)
|
||||
{
|
||||
result.put("code", 200);
|
||||
result.put("msg", "处理成功");
|
||||
}else{
|
||||
result.put("code", 500);
|
||||
result.put("msg", "处理失败");
|
||||
}
|
||||
|
||||
return JSONObject.toJSONString(result);
|
||||
}
|
||||
@RequestMapping("/admin/weblist/insertUrlByUser")
|
||||
public String insertUrlByUser(UrlList urlList)
|
||||
{
|
||||
int flag = 0;
|
||||
Date date = new Date();
|
||||
urlList.setCreatetime(date.getTime());
|
||||
urlList.setViews(Long.valueOf(0));
|
||||
urlList.setNeedLogin(Byte.valueOf(flag+""));
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
flag = urlListService.insertUrlByUser(urlList);
|
||||
String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId());
|
||||
String [] parentList = parentString.split(",");
|
||||
System.out.println(parentString);
|
||||
for(String parent : parentList)
|
||||
{
|
||||
if(parent.equals("0")){
|
||||
continue;
|
||||
}
|
||||
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(parent));
|
||||
if(urlCateListService.updateByUrlCateList(urlCateList) == 0)
|
||||
{
|
||||
flag = 0;
|
||||
}else{
|
||||
flag = 1;
|
||||
}
|
||||
}
|
||||
if(flag == 1)
|
||||
{
|
||||
result.put("code", 200);
|
||||
result.put("msg", "处理成功");
|
||||
|
||||
}else{
|
||||
result.put("code", 500);
|
||||
result.put("msg", "处理失败");
|
||||
|
||||
}
|
||||
return JSONObject.toJSONString(result);
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,6 @@ public interface UrlCateListService {
|
||||
public UrlCateList selectByPrimaryKey(Integer id);
|
||||
|
||||
public int insertSelective(UrlCateList urlCateList);
|
||||
public int updateByUrlCateList(UrlCateList urlCateList);
|
||||
|
||||
}
|
||||
|
@ -14,4 +14,5 @@ public interface UrlListService {
|
||||
public int updateUrlStatusListById(UrlList urlList);
|
||||
|
||||
public List<UrlList> selectUrListByNeedLogin();
|
||||
public int insertUrlByUser(UrlList urlList);
|
||||
}
|
||||
|
@ -67,6 +67,11 @@ public class UrlCateListServiceImpl implements UrlCateListService {
|
||||
{
|
||||
return urlCateListDao.insertSelective(urlCateList);
|
||||
}
|
||||
|
||||
public int updateByUrlCateList(UrlCateList urlCateList)
|
||||
{
|
||||
return urlCateListDao.updateByPrimaryKeySelective(urlCateList);
|
||||
}
|
||||
public UrlCateList selectByPrimaryKey(Integer id)
|
||||
{
|
||||
return urlCateListDao.selectByPrimaryKey(id);
|
||||
|
@ -56,7 +56,7 @@ public class UrlLiserServiceImpl implements UrlListService {
|
||||
return urlListDao.selectUrListByNeedLogin();
|
||||
}
|
||||
|
||||
|
||||
public int insertUrlByUser(UrlList urlList){return urlListDao.insertSelective(urlList);}
|
||||
|
||||
public UrlList selectUrListByInput(String input)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user