实现公告获取和输出
This commit is contained in:
@@ -48,6 +48,9 @@ public class DataController {
|
||||
@Autowired
|
||||
private VUserfileService vUserfileService;
|
||||
|
||||
@Autowired
|
||||
private NoticeService noticeService;
|
||||
|
||||
@Resource
|
||||
private HttpServletRequest httpServletRequest;
|
||||
|
||||
@@ -172,4 +175,9 @@ public class DataController {
|
||||
throw new UserException(ResultEnum.ILLEGAL_ACCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/home/findAllNotice")
|
||||
public List<TbNotice> findAllNotice(){
|
||||
return noticeService.findAll();
|
||||
}
|
||||
}
|
||||
|
||||
25
src/main/java/com/fjy/spring/domain/TbNotice.java
Normal file
25
src/main/java/com/fjy/spring/domain/TbNotice.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.fjy.spring.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
public class TbNotice {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Integer noticeid;
|
||||
|
||||
private Integer adminid;
|
||||
|
||||
@Column(name = "noticecontent")
|
||||
private String noticeContent;
|
||||
|
||||
@Column(name = "issuetime")
|
||||
private String issueTime;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
/*@Configuration*/
|
||||
public class WebAppConfig implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.fjy.spring.repository;
|
||||
|
||||
import com.fjy.spring.domain.TbNotice;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TbNoticeRepository extends JpaRepository<TbNotice,Integer> {
|
||||
|
||||
}
|
||||
20
src/main/java/com/fjy/spring/service/NoticeService.java
Normal file
20
src/main/java/com/fjy/spring/service/NoticeService.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.fjy.spring.service;
|
||||
|
||||
import com.fjy.spring.domain.TbNotice;
|
||||
import com.fjy.spring.repository.TbNoticeRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class NoticeService {
|
||||
|
||||
@Autowired
|
||||
private TbNoticeRepository noticeRepository;
|
||||
|
||||
public List<TbNotice> findAll(){
|
||||
return noticeRepository.findAll();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user