1.文件上传地址

2.分类
master
ck 5 years ago
parent 643c29ff98
commit 6812969b7d

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.jingcheng.cms.service.ArticleSerive; import com.jingcheng.cms.service.ArticleSerive;
import com.jingcheng.cms.util.AjaxResult; import com.jingcheng.cms.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -16,7 +17,8 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/api/article") @RequestMapping("/api/article")
public class ArticleController { public class ArticleController {
@Value("${localFilePath}")
private String localFilePath;
@Autowired @Autowired
private ArticleSerive articleSerive; private ArticleSerive articleSerive;
@ -104,7 +106,7 @@ public class ArticleController {
} }
//文件名称 //文件名称
String realFileName = file.getOriginalFilename(); String realFileName = file.getOriginalFilename();
String path ="D:/cktest/"; String path =localFilePath;
//检查该路径对应的目录是否存在. 如果不存在则创建目录 //检查该路径对应的目录是否存在. 如果不存在则创建目录
File dir=new File(path); File dir=new File(path);
if (!dir.exists()) { if (!dir.exists()) {

@ -72,4 +72,23 @@ public class CategoryController {
ajaxResult= categoryService.delCategory(id); ajaxResult= categoryService.delCategory(id);
return ajaxResult; return ajaxResult;
} }
/**
*
* @param jsonObject
* @return
*/
@RequestMapping("/category-list-by-level")
public AjaxResult getCategoryByLevel(@RequestBody JSONObject jsonObject) {
AjaxResult ajaxResult = new AjaxResult();
Integer level = jsonObject.getInteger("level");
if (null == level){
ajaxResult.setRetmsg("等级不可为空");
ajaxResult.setRetcode(AjaxResult.FAILED);
return ajaxResult;
}
List<Category> categories= categoryService.getCategoryByLevel(level);
ajaxResult.setData(categories);
return ajaxResult;
}
} }

@ -36,4 +36,6 @@ public interface CategoryService {
* @return * @return
*/ */
AjaxResult delCategory(Long id); AjaxResult delCategory(Long id);
List<Category> getCategoryByLevel(Integer level);
} }

@ -119,5 +119,15 @@ public class CategoryServiceImpl implements CategoryService {
} }
} }
@Override
public List<Category> getCategoryByLevel(Integer level) {
Category findCategory = new Category();
findCategory.setLevel(level);
findCategory.setState(Constants.STATE_VALID);
List<Category> categories = categoryMapper.select(findCategory);
return categories;
}
} }

@ -7,7 +7,7 @@ server:
max-http-header-size: 16000 max-http-header-size: 16000
spring: spring:
datasource: datasource:
url: jdbc:sqlite:D:/Sqlitedb/training.db url: jdbc:sqlite:D:/documentManager/Sqlitedb/training.db
username: root username: root
password: 123456 password: 123456
driver-class-name: org.sqlite.JDBC driver-class-name: org.sqlite.JDBC
@ -59,6 +59,8 @@ upload:
export: export:
path: /tmp/export/ path: /tmp/export/
localFilePath: D:/documentManager/upload
wx: wx:
BASE_URI: https://api.weixin.qq.com BASE_URI: https://api.weixin.qq.com
ACCESS_TOKEN_URL: https://api.weixin.qq.com/cgi-bin/token ACCESS_TOKEN_URL: https://api.weixin.qq.com/cgi-bin/token

Loading…
Cancel
Save