Commit 8421c5ff by 侯昆

更新

1 parent c7531497
......@@ -33,11 +33,13 @@ import com.dookay.coral.common.web.controller.BaseController;
import com.dookay.coral.common.web.response.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MimeTypeUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
......@@ -50,7 +52,7 @@ import java.util.stream.Collectors;
*/
@RestController
@RequestMapping("/home")
@Api("首页")
@Api(value = "首页")
@Slf4j
public class HomeController extends BaseController {
......@@ -69,9 +71,9 @@ public class HomeController extends BaseController {
* @author houkun
* @date 2018/1/9
*/
@RequestMapping(value = "/search", method = RequestMethod.POST)
@ApiOperation(value = "搜索词", nickname = "搜索词", httpMethod = "POST", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = WordDTO.class)
public JsonResult search(String keyword) {
@RequestMapping(value = "/search", method = RequestMethod.GET)
@ApiOperation(value = "搜索词", httpMethod = "GET", response = WordDTO.class)
public JsonResult search(@ApiParam(value = "搜索的关键词", required = true) @RequestParam String keyword) {
log.info("进入搜索:" + keyword);
if (StringUtils.isBlank(keyword)) {
return errorResult("搜索内容不能为空");
......@@ -113,8 +115,8 @@ public class HomeController extends BaseController {
* @date 2018/1/9
*/
@RequestMapping(value = "/image/search", method = RequestMethod.POST)
@ApiOperation(value = "图片搜索", nickname = "图片搜索", httpMethod = "POST", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = WordDTO.class)
public JsonResult imageSearch(MultipartFile image) {
@ApiOperation(value = "图片搜索", httpMethod = "POST", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = WordDTO.class)
public JsonResult imageSearch(@ApiParam(value = "图片文件", required = true) MultipartFile image) {
log.info("图片名称", image.getOriginalFilename());
try {
String encode = Base64Util.encode(image.getBytes());
......@@ -142,13 +144,13 @@ public class HomeController extends BaseController {
}
@RequestMapping(value = "/character", method = RequestMethod.GET)
@ApiOperation(value = "每日一字", nickname = "每日一字", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = OneCharacterDTO.class)
@ApiOperation(value = "每日一字", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = OneCharacterDTO.class)
public JsonResult oneCharacter() {
return successResult("每日一字", wordService.oneDayOnCharacter());
}
@RequestMapping(value = "/statement", method = RequestMethod.GET)
@ApiOperation(value = "推荐词条", nickname = "推荐词条", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = RecommendStatementDTO.class)
@ApiOperation(value = "推荐词条", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = RecommendStatementDTO.class)
public JsonResult recommendStatement() {
return successResult("推荐词条", wordService.RecomendStatement());
}
......
......@@ -22,9 +22,9 @@ import com.dookay.cihai.core.word.domain.WordDomain;
import com.dookay.cihai.core.word.service.IWordService;
import com.dookay.coral.common.web.controller.BaseController;
import com.dookay.coral.common.web.response.JsonResult;
import com.dookay.coral.common.web.utils.upload.model.ImageModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MimeTypeUtils;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -40,7 +40,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/word")
@Api("词")
@Api(value = "词")
public class WordController extends BaseController {
@Autowired
......@@ -53,8 +53,8 @@ public class WordController extends BaseController {
* @date 2018/1/9
*/
@RequestMapping(value = "/character/paraph/{id}", method = RequestMethod.GET)
@ApiOperation(value = "单字释义", nickname = "单字释义", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = CharacterParaphDTO.class)
public JsonResult characterParaph(@PathVariable("id") Long id) {
@ApiOperation(value = "单字释义", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = CharacterParaphDTO.class)
public JsonResult characterParaph(@PathVariable("id") @ApiParam(required = true) Long id) {
WordDomain character = wordService.get(id);
return successResult("success", CharacterParaphDTO.fromDomain(character));
}
......@@ -66,8 +66,8 @@ public class WordController extends BaseController {
* @date 2018/1/9
*/
@RequestMapping(value = "/character/baike/{id}", method = RequestMethod.GET)
@ApiOperation(value = "单字百科", nickname = "单字百科", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = CharacterBaikeDTO.class)
public JsonResult characterBaike(@PathVariable("id") Long id) {
@ApiOperation(value = "单字百科", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = CharacterBaikeDTO.class)
public JsonResult characterBaike(@PathVariable("id") @ApiParam(required = true) Long id) {
WordDomain character = wordService.get(id);
return successResult("success", CharacterBaikeDTO.fromDomain(character));
}
......@@ -79,8 +79,8 @@ public class WordController extends BaseController {
* @date 2018/1/9
*/
@RequestMapping(value = "/statement/paraph/{id}", method = RequestMethod.GET)
@ApiOperation(value = "词组释义", nickname = "词组释义", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = StatementParaphDTO.class)
public JsonResult statementParaph(@PathVariable("id") Long id) {
@ApiOperation(value = "词组释义", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = StatementParaphDTO.class)
public JsonResult statementParaph(@PathVariable("id") @ApiParam(required = true) Long id) {
WordDomain statement = wordService.get(id);
return successResult("success", StatementParaphDTO.fromDomain(statement));
}
......@@ -92,8 +92,8 @@ public class WordController extends BaseController {
* @date 2018/1/9
*/
@RequestMapping(value = "/statement/baike/{id}", method = RequestMethod.GET)
@ApiOperation(value = "词组百科", nickname = "词组百科", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = StatementBaikeDTO.class)
public JsonResult statementBaike(@PathVariable("id") Long id) {
@ApiOperation(value = "词组百科", httpMethod = "GET", produces = MimeTypeUtils.APPLICATION_JSON_VALUE, response = StatementBaikeDTO.class)
public JsonResult statementBaike(@PathVariable("id") @ApiParam(required = true) Long id) {
WordDomain statement = wordService.get(id);
return successResult("success", StatementBaikeDTO.fromDomain(statement));
}
......
......@@ -23,3 +23,5 @@ mybatis.mapper-locations=classpath*:mapper/*.xml
server.jetty.max-http-post-size=20971520
security.basic.enabled=false
security.enable-csrf=false
coral.monitor.enable=true
coral.monitor.git-short.path=/monitor/git
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!