Browse Source

collect 全套

master
453530270@qq.com 2 years ago
parent
commit
342d64e835
  1. 86
      mis-service/main/java/bc/mm/mis/core/bean/Collect.java
  2. 18
      mis-service/main/java/bc/mm/mis/core/dao/CollectDao.java
  3. 15
      mis-service/main/java/bc/mm/mis/core/service/CollectService.java
  4. 24
      mis-service/main/java/bc/mm/mis/core/service/impl/CollectServiceImpl.java
  5. 26
      mis-web/src/main/java/bc/mm/mis/v1/CollectController.java

86
mis-service/main/java/bc/mm/mis/core/bean/Collect.java

@ -0,0 +1,86 @@
package bc.mm.mis.core.bean;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "collect")
public class Collect {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "user_id")
@JsonProperty("user_id")
private Integer userId;
@Column(name = "pair_id")
private Integer pairId;
@Column(name = "pair_name")
@JsonProperty("pair_name")
private String pairName;
@Column(name = "created_at")
@JsonProperty("created_at")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createdAt;
@Column(name = "updated_at")
@JsonProperty("updated_at")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
// @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getPairId() {
return pairId;
}
public void setPairId(Integer pairId) {
this.pairId = pairId;
}
public String getPairName() {
return pairName;
}
public void setPairName(String pairName) {
this.pairName = pairName;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
}

18
mis-service/main/java/bc/mm/mis/core/dao/CollectDao.java

@ -0,0 +1,18 @@
package bc.mm.mis.core.dao;
import bc.mm.mis.core.bean.Collect;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CollectDao extends JpaRepository<Collect,Integer> {
/**
*
* @param pageable
* @return
*/
Page<Collect> findAll(Pageable pageable);
}

15
mis-service/main/java/bc/mm/mis/core/service/CollectService.java

@ -0,0 +1,15 @@
package bc.mm.mis.core.service;
import bc.mm.mis.core.bean.Collect;
import java.util.List;
public interface CollectService {
/**
*
* @param page
* @param size
* @return
*/
List<Collect> aclist(int page, int size);
}

24
mis-service/main/java/bc/mm/mis/core/service/impl/CollectServiceImpl.java

@ -0,0 +1,24 @@
package bc.mm.mis.core.service.impl;
import bc.mm.mis.core.bean.Collect;
import bc.mm.mis.core.dao.CollectDao;
import bc.mm.mis.core.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CollectServiceImpl implements CollectService {
@Autowired
private CollectDao collectDao;
@Override
public List<Collect> aclist(int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
Page<Collect> collectPage = collectDao.findAll(pageRequest);
return collectPage.getContent();
}
}

26
mis-web/src/main/java/bc/mm/mis/v1/CollectController.java

@ -0,0 +1,26 @@
package bc.mm.mis.v1;
import bc.mm.mis.core.bean.Collect;
import bc.mm.mis.core.service.CollectService;
import bc.mm.mis.utils.AjaxResult;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/v1/pair")
public class CollectController {
@Autowired
CollectService collectService;
@RequestMapping("/list/{page}/{size}")
public JSONObject clist(@PathVariable("page")int page,@PathVariable("size") int size){
List<Collect> collectList = collectService.aclist(page,size);
return AjaxResult.success("success",collectList);
}
}
Loading…
Cancel
Save