| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.yami.trading.bean.cms.Infomation; |
| | | import com.yami.trading.bean.cms.News; |
| | | import com.yami.trading.common.domain.Result; |
| | | import com.yami.trading.common.util.StringUtils; |
| | | import com.yami.trading.service.cms.InfomationService; |
| | | import com.yami.trading.service.cms.NewsSerivce; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | public static final String action = "/api/information!"; |
| | | @Autowired |
| | | private InfomationService infomationService; |
| | | @Autowired |
| | | private NewsSerivce newsSerivce; |
| | | /** |
| | | * 返回自选币种的行情 |
| | | */ |
| | | @ApiOperation("查看实时咨询数据") |
| | | @GetMapping(action + "list.action") |
| | | public Result<List<Infomation>> list(@RequestParam(required =false ) Integer limit, @RequestParam(required =false ) String language) { |
| | | if(StringUtils.isEmptyString(language)){ |
| | | language = "en"; |
| | | } |
| | | if(limit == null){ |
| | | limit = 50; |
| | | } |
| | | if(limit>=200){ |
| | | limit = 200; |
| | | } |
| | | QueryWrapper<Infomation> infomationQueryWrapper = new QueryWrapper<>(); |
| | | infomationQueryWrapper.eq("lang", language); |
| | | public Result<List<News>> list(@RequestParam(required =false ) Integer limit, @RequestParam(required =false ) String language) { |
| | | |
| | | QueryWrapper<News> infomationQueryWrapper = new QueryWrapper<>(); |
| | | infomationQueryWrapper.orderByDesc("create_time"); |
| | | infomationQueryWrapper.last("LIMIT "+limit); |
| | | return Result.ok(infomationService.list(infomationQueryWrapper)); |
| | | infomationQueryWrapper.last("LIMIT 15"); |
| | | return Result.ok(newsSerivce.list(infomationQueryWrapper)); |
| | | |
| | | } |
| | | |