导航,附件,拦截器
This commit is contained in:
9
src/main/java/com/lovenav/service/AttachmentService.java
Normal file
9
src/main/java/com/lovenav/service/AttachmentService.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.lovenav.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public interface AttachmentService {
|
||||
// public HashMap<String,String>storeFile(MultipartFile multipartFile);
|
||||
}
|
12
src/main/java/com/lovenav/service/ConfigService.java
Normal file
12
src/main/java/com/lovenav/service/ConfigService.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.lovenav.service;
|
||||
|
||||
import com.lovenav.entity.Config;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public interface ConfigService {
|
||||
public HashMap<String,Object>getAllConfig();
|
||||
public int updateConfis(Config config);
|
||||
|
||||
public String addConfig(Config config);
|
||||
}
|
12
src/main/java/com/lovenav/service/NavService.java
Normal file
12
src/main/java/com/lovenav/service/NavService.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.lovenav.service;
|
||||
|
||||
import com.lovenav.entity.Nav;
|
||||
|
||||
public interface NavService {
|
||||
public String deleteNav(Nav nav);
|
||||
public String updateNav(Nav nav);
|
||||
public String selectNav(Nav nav);
|
||||
public String addNav(Nav nav);
|
||||
|
||||
String selectAllNav();
|
||||
}
|
@@ -10,4 +10,8 @@ public interface UrlListService {
|
||||
public List<UrlList> selectUrList();
|
||||
public UrlList selectUrListByInput(String input);
|
||||
public UrlList selectUrlListByUrlId(Long urlId);
|
||||
|
||||
public int updateUrlStatusListById(UrlList urlList);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,58 @@
|
||||
package com.lovenav.service.serviceImpl;
|
||||
|
||||
import com.lovenav.service.AttachmentService;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
|
||||
public class AttachmentServiceImpl implements AttachmentService {
|
||||
// @Override
|
||||
// public HashMap<String, String> storeFile(MultipartFile multipartFile) {
|
||||
// HashMap<String,String> map = new HashMap<>();
|
||||
// }
|
||||
// File path = null;
|
||||
//// try {
|
||||
// path = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
// File upload = new File(path.getAbsolutePath(),"static/img/");
|
||||
// Date date=new Date();
|
||||
//
|
||||
// DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// String date1=format.format(date);
|
||||
// String fileName = multipartFile.getOriginalFilename();//文件全名
|
||||
// File parentDir = new File(upload.getAbsolutePath()+"/" + date1);
|
||||
// System.out.println(upload.getAbsolutePath());
|
||||
// System.out.println(fileName);
|
||||
// map
|
||||
// return
|
||||
// if(!upload.exists()){
|
||||
// upload.mkdirs();
|
||||
// }
|
||||
// if(!parentDir.exists()){
|
||||
// parentDir.mkdirs();
|
||||
// }
|
||||
// String suffix = suffix(fileName);//文件后缀
|
||||
// String relPath = "/" + yearMonth + "/" + "-" + UUID.randomUUID().toString().replaceAll("-","") + suffix;
|
||||
// File fileUp = new File(upload.getAbsolutePath()+ relPath);
|
||||
// file.transferTo(fileUp);
|
||||
// Map<String, String> map = new HashMap();
|
||||
// map.put("url", "/img" + relPath);
|
||||
// log.info(relPath);
|
||||
// return map;
|
||||
// } catch (FileNotFoundException e) {
|
||||
// throw e;
|
||||
// } catch (IOException e) {
|
||||
// throw e;
|
||||
// }
|
||||
// }
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.lovenav.service.serviceImpl;
|
||||
|
||||
import com.lovenav.dao.ConfigDao;
|
||||
import com.lovenav.entity.Config;
|
||||
import com.lovenav.service.ConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@Service
|
||||
public class ConfigServiceImpl implements ConfigService {
|
||||
@Autowired
|
||||
ConfigDao configDao;
|
||||
@Override
|
||||
public HashMap<String, Object> getAllConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateConfis(Config config) {
|
||||
return configDao.updateByName(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addConfig(Config config) {
|
||||
if(configDao.selectByName(config.getName())!=null){
|
||||
return "该配置文件已经存在!";
|
||||
}else {
|
||||
int result=configDao.insertSelective(config);
|
||||
if (result==1){
|
||||
return "添加成功!";
|
||||
}else {
|
||||
return "添加失败!";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package com.lovenav.service.serviceImpl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.lovenav.dao.NavDao;
|
||||
import com.lovenav.entity.Nav;
|
||||
import com.lovenav.service.NavService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NavServiceImpl implements NavService {
|
||||
@Autowired
|
||||
NavDao navDao;
|
||||
@Override
|
||||
public String deleteNav(Nav nav) {
|
||||
if (navDao.selectAlreadyExist(nav)==null) {
|
||||
return "没有该记录";
|
||||
}
|
||||
int nav1=navDao.deleteByNavName(nav.getNavName());
|
||||
if (nav1==1){
|
||||
return "删除成功";
|
||||
}else {
|
||||
return "删除失败";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateNav(Nav nav) {
|
||||
if (navDao.selectAlreadyExist(nav)==null) {
|
||||
return "没有该记录";
|
||||
}
|
||||
int result=navDao.updateByName(nav);
|
||||
if (result==1){
|
||||
return "更新成功";
|
||||
}else {
|
||||
return "更新失败";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectNav(Nav nav) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addNav(Nav nav) {
|
||||
int result;
|
||||
if(navDao.selectAlreadyExist(nav)!=null){
|
||||
return "已经有相同名称的导航!";
|
||||
}
|
||||
result=navDao.insertSelective(nav);
|
||||
if (result==1){
|
||||
return "添加成功";
|
||||
}else {
|
||||
return "添加失败";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectAllNav() {
|
||||
return (String) JSON.toJSON(navDao.selectAllNav());
|
||||
}
|
||||
}
|
@@ -60,4 +60,14 @@ public class UrlLiserServiceImpl implements UrlListService {
|
||||
urlListDao.updateByPrimaryKeySelective(urlList);
|
||||
return urlList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUrlStatusListById(UrlList urlList) {
|
||||
if (urlListDao.updateByPrimaryKey(urlList)==1){
|
||||
return 1;
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Transactional
|
||||
|
||||
@Service("userService")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@@ -72,7 +72,6 @@ public class UserServiceImpl implements UserService {
|
||||
user.setUserRegistered(date);
|
||||
|
||||
|
||||
|
||||
return userDao.insert(user);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user