parent
1113b70a0f
commit
aaa24e442b
@ -1,129 +0,0 @@
|
||||
package com.luoo.music.controller;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.luoo.music.client.UserClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.luoo.music.pojo.Article;
|
||||
import com.luoo.music.service.ArticleService;
|
||||
|
||||
import api.PageResult;
|
||||
import api.Result;
|
||||
|
||||
/**
|
||||
* 控制器层
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/article")
|
||||
public class ArticleController {
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
@Autowired
|
||||
private UserClient userClient;
|
||||
|
||||
@GetMapping("/admin")
|
||||
public Result findAdmin(){
|
||||
return userClient.findAll();
|
||||
}
|
||||
|
||||
@PutMapping("/examine/{articleId}")
|
||||
public Result<Void> examine (@PathVariable String articleId){
|
||||
|
||||
articleService.updateState(articleId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/thumbup/{articleId}")
|
||||
public Result<Void> thumbup (@PathVariable String articleId){
|
||||
|
||||
articleService.addThumbup(articleId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public Result<List<Article>> findAll(){
|
||||
return Result.success(articleService.findAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<Article> findById(@PathVariable String id){
|
||||
return Result.success(articleService.findById(id));
|
||||
}
|
||||
|
||||
@GetMapping("/findByVolid/{volid}")
|
||||
public Result<Article> findByVolid(@PathVariable String volid){
|
||||
return Result.success(articleService.findByVolid(volid));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页+多条件查询
|
||||
* @param searchMap 查询条件封装
|
||||
* @param page 页码
|
||||
* @param size 页大小
|
||||
* @return 分页结果
|
||||
*/
|
||||
@PostMapping("/search/{page}/{size}")
|
||||
public Result<PageResult<Article>> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
|
||||
Page<Article> pageList = articleService.findSearch(searchMap, page, size);
|
||||
return Result.success(new PageResult<Article>(pageList.getTotalElements(), pageList.getContent()) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询
|
||||
* @param searchMap
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/search")
|
||||
public Result<List<Article>> findSearch( @RequestBody Map searchMap){
|
||||
return Result.success(articleService.findSearch(searchMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加
|
||||
* @param article
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<Void> add(@RequestBody Article article ){
|
||||
articleService.add(article);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param article
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
public Result<Void> update(@RequestBody Article article, @PathVariable String id ){
|
||||
article.setId(id);
|
||||
articleService.update(article);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Void> delete(@PathVariable String id ){
|
||||
articleService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
package com.luoo.music.controller;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.luoo.music.pojo.Channel;
|
||||
import com.luoo.music.service.ChannelService;
|
||||
|
||||
import api.PageResult;
|
||||
import api.Result;
|
||||
|
||||
/**
|
||||
* 控制器层
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/channel")
|
||||
public class ChannelController {
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public Result<List<Channel>> findAll(){
|
||||
return Result.success(channelService.findAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<Channel> findById(@PathVariable String id){
|
||||
return Result.success(channelService.findById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页+多条件查询
|
||||
* @param searchMap 查询条件封装
|
||||
* @param page 页码
|
||||
* @param size 页大小
|
||||
* @return 分页结果
|
||||
*/
|
||||
@PostMapping("/search/{page}/{size}")
|
||||
public Result<PageResult<Channel>> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
|
||||
Page<Channel> pageList = channelService.findSearch(searchMap, page, size);
|
||||
return Result.success(new PageResult<Channel>(pageList.getTotalElements(), pageList.getContent()) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询
|
||||
* @param searchMap
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/search")
|
||||
public Result<List<Channel>> findSearch( @RequestBody Map searchMap){
|
||||
return Result.success(channelService.findSearch(searchMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加
|
||||
* @param channel
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<Void> add(@RequestBody Channel channel ){
|
||||
channelService.add(channel);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param channel
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
public Result<Void> update(@RequestBody Channel channel, @PathVariable String id ){
|
||||
channel.setId(id);
|
||||
channelService.update(channel);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Void> delete(@PathVariable String id ){
|
||||
channelService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
package com.luoo.music.controller;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.luoo.music.pojo.Column;
|
||||
import com.luoo.music.service.ColumnService;
|
||||
|
||||
import api.PageResult;
|
||||
import api.Result;
|
||||
|
||||
/**
|
||||
* 控制器层
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/column")
|
||||
public class ColumnController {
|
||||
|
||||
@Autowired
|
||||
private ColumnService columnService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public Result<List<Column>> findAll(){
|
||||
return Result.success(columnService.findAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<Column> findById(@PathVariable String id){
|
||||
return Result.success(columnService.findById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页+多条件查询
|
||||
* @param searchMap 查询条件封装
|
||||
* @param page 页码
|
||||
* @param size 页大小
|
||||
* @return 分页结果
|
||||
*/
|
||||
@PostMapping("/search/{page}/{size}")
|
||||
public Result<PageResult<Column>> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
|
||||
Page<Column> pageList = columnService.findSearch(searchMap, page, size);
|
||||
return Result.success(new PageResult<Column>(pageList.getTotalElements(), pageList.getContent()) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询
|
||||
* @param searchMap
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/search")
|
||||
public Result<List<Column>> findSearch( @RequestBody Map searchMap){
|
||||
return Result.success(columnService.findSearch(searchMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加
|
||||
* @param column
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<Void> add(@RequestBody Column column ){
|
||||
columnService.add(column);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param column
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
public Result<Void> update(@RequestBody Column column, @PathVariable String id ){
|
||||
column.setId(id);
|
||||
columnService.update(column);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Void> delete(@PathVariable String id ){
|
||||
columnService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
//package com.luoo.music.controller;
|
||||
//
|
||||
//
|
||||
//import api.Result;
|
||||
//import com.luoo.music.service.S3Service;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
//import org.springframework.web.bind.annotation.GetMapping;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//import org.springframework.web.multipart.MultipartFile;
|
||||
//
|
||||
//import java.io.UnsupportedEncodingException;
|
||||
//import java.text.SimpleDateFormat;
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@RestController
|
||||
//@CrossOrigin
|
||||
//public class S3Controller {
|
||||
//
|
||||
// @Autowired
|
||||
// private S3Service s3Service;
|
||||
//
|
||||
//
|
||||
// @GetMapping("/awstest")
|
||||
// public Result test() throws UnsupportedEncodingException {
|
||||
//
|
||||
//// s3Service.listObjects()
|
||||
// List list = s3Service.list();
|
||||
// return Result.success();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 文件存储目录规划
|
||||
// *
|
||||
// * music 存放期刊和期刊歌曲 二级目录为期刊期刊号 三级目录存放期刊歌曲和封面图片和歌曲图片
|
||||
// *
|
||||
// * song 存放通用歌曲
|
||||
// *
|
||||
// * image存放图片
|
||||
// *
|
||||
// * img
|
||||
// *
|
||||
// * user/avatar/111.jpg
|
||||
// *
|
||||
// *
|
||||
// *
|
||||
// *
|
||||
// */
|
||||
// @PostMapping("/awsUpload")
|
||||
// public Result upload(MultipartFile file) {
|
||||
//
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||
//// String fileName = UUID.randomUUID().toString().trim().replaceAll("-", "");
|
||||
//
|
||||
//
|
||||
// String filePath = sdf.format(new Date()) + "/" + file.getOriginalFilename();
|
||||
// try{
|
||||
// int code = s3Service.singleUpload("indie", filePath, file);
|
||||
//
|
||||
// } catch (Exception ex){
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return Result.success();
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/awsCopy")
|
||||
// public Result copy() {
|
||||
// s3Service.copy();
|
||||
// return Result.success();
|
||||
// }
|
||||
//}
|
Loading…
Reference in new issue