资讯前端接口

main
mhsnet 1 year ago
parent 96da0e2be9
commit 8a718bcb61

@ -0,0 +1,33 @@
package org.jeecg.modules.demo.yxgwf.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.yxgwf.service.INewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Api(tags="云息官网Web-资讯动态")
@RestController
@RequestMapping("/yxgwf/news")
@Slf4j
public class NewsController {
@Autowired
private INewsService newsService;
@ApiOperation(value="资讯列表", notes="资讯列表")
@GetMapping("/list")
public Result<?> getStr() {
return Result.OK(this.newsService.query().select("id","title","type","des","img","date").list());
}
@ApiOperation(value="资讯详情", notes="资讯详情")
@GetMapping("/info")
public Result<?> getInfo(@RequestParam(name="id",required=true) String id) {
return Result.OK(this.newsService.query().eq("id",id).one());
}
}

@ -0,0 +1,81 @@
package org.jeecg.modules.demo.yxgwf.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2023-05-23
* @Version: V1.0
*/
@Data
@TableName("yxgw_news")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="yxgw_news对象", description="资讯动态")
public class News implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**标题*/
@Excel(name = "标题", width = 15)
@ApiModelProperty(value = "标题")
private String title;
/**类型*/
@Excel(name = "类型", width = 15)
@ApiModelProperty(value = "类型")
private String type;
/**日期*/
@Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "日期")
private Date date;
/**图片*/
@Excel(name = "图片", width = 15)
@ApiModelProperty(value = "图片")
private String img;
/**描述*/
@Excel(name = "描述", width = 15)
@ApiModelProperty(value = "描述")
private String des;
/**详情*/
@Excel(name = "详情", width = 15)
@ApiModelProperty(value = "详情")
private String info;
}

@ -0,0 +1,14 @@
package org.jeecg.modules.demo.yxgwf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.demo.yxgwf.entity.News;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2023-05-23
* @Version: V1.0
*/
public interface NewsMapper extends BaseMapper<News> {
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.NewsMapper">
</mapper>

@ -0,0 +1,14 @@
package org.jeecg.modules.demo.yxgwf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.demo.yxgwf.entity.News;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2023-05-23
* @Version: V1.0
*/
public interface INewsService extends IService<News> {
}

@ -0,0 +1,18 @@
package org.jeecg.modules.demo.yxgwf.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.demo.yxgwf.entity.News;
import org.jeecg.modules.demo.yxgwf.mapper.NewsMapper;
import org.jeecg.modules.demo.yxgwf.service.INewsService;
import org.springframework.stereotype.Service;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2023-05-23
* @Version: V1.0
*/
@Service
public class NewsServiceImpl extends ServiceImpl<NewsMapper, News> implements INewsService {
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.demo.yxgwf.mapper.NewsMapper">
</mapper>
Loading…
Cancel
Save