Stephen小右
2021-07-28 15:32
采纳率: 95%
浏览 15
已结题

在数据库表中添加三个数据: 运动量、批次、 状态,并显示在postman上

img
springboot中要对某个表添加数据元素(添加三列),我对实体类,mapper,service,controller都进行了修改,增加了三种数据元素,但postman上还是看不到增加的status状态,exercise运动量,times批次。不知道为什么postman上仍然显示不出来这三个数据。
内容:

img

实体类MachineLogEntity:

package com.ywyl.sh.platform.entity;
import...
@Table(name = "sh_machine_log")
public class MachineLogEntity {
    @Id
    private String id;
    private String machineId;
    private String spo2;
    private Integer ppg;
    private String lbslat;
    private String lbslng;
    private String gpslat;
    private String gpslng;
    private String altitude;
    private Integer battery;
    private Integer sos;
    private Date insertTime;
    private String status;
    private String exercise;
    private String times;

    public MachineLogEntity(String id, String machineId, String spo2, Integer ppg, String lbslat, String lbslng, String gpslat, String gpslng, String altitude, Integer battery, Integer sos, Date insertTime, String status, String exercise,String times) {
        this.id = id;
        this.machineId = machineId;
        this.spo2 = spo2;
        this.ppg = ppg;
        this.sos = sos;
        this.lbslat = lbslat;
        this.lbslng = lbslng;
        this.gpslat = gpslat;
        this.gpslng = gpslng;
        this.altitude = altitude;
        this.battery = battery;
        this.insertTime = insertTime;
        this.status = status;
        this.times=times;
        this.exercise=exercise;
    }
    public MachineLogEntity() {
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getMachineId() {
        return machineId;
    }
    public void setMachineId(String machineId) {
        this.machineId = machineId;
    }
    public String getSpo2() {
        return spo2;
    }
    public void setSpo2(String spo2) {
        this.spo2 = spo2;
    }
    public Integer getPpg() {
        return ppg;
    }
    public void setPpg(Integer ppg) {
        this.ppg = ppg;
    }

    public String getLbslat() {
        return lbslat;
    }
    public void setLbslat(String lbslat) {
        this.lbslat = lbslat;
    }
    public String getLbslng() {
        return lbslng;
    }
    public void setLbslng(String lbslng) {
        this.lbslng = lbslng;
    }
    public String getGpslat() {
        return gpslat;
    }
    public void setGpslat(String gpslat) {
        this.gpslat = gpslat;
    }

    public String getGpslng() {
        return gpslng;
    }
    public void setGpslng(String gpslng) {
        this.gpslng = gpslng;
    }

    public String getAltitude() {
        return altitude;
    }

    public void setAltitude(String altitude) {
        this.altitude = altitude;
    }
    public Integer getBattery() {
        return battery;
    }
    public void setBattery(Integer battery) {
        this.battery = battery;
    }
    public Integer getSos() {
        return sos;
    }
    public void setSos(Integer sos) {
        this.sos = sos;
    }
    public Date getInsertTime() {
        return insertTime;
    }
    public void setInsertTime(Date insertTime) {
        this.insertTime = insertTime;
    }
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
    public String getExercise() {
        return exercise;
    }
    public void setExercise(String exercise) {
        this.exercise = exercise;
    }
    public String getTimes() {
        return times;
    }
    public void setTimes(String times) {
        this.times = times;
    }
}

对应的service里的功能:

  public PageInfo pageSelectMachineLog(String machineId,int currentPage,int pageSize){
        PageHelper.startPage(currentPage,pageSize);
        List<MachineLogEntity> machineLogEntityList = machineLogMapper.selectMachineLogsByMachineId(machineId);
        PageInfo pageInfo = new PageInfo<>(machineLogEntityList);
        return pageInfo;
    }

对应controller里面:

    @GetMapping("pageSelectMachineLog")
    public @ResponseBody String pageSelectMachineLog(@RequestParam("machineId")String machineId,
                                                     @RequestParam("currentPage")int currentPage,
                                                     @RequestParam("pageSize")int pageSize,
                                                     HttpServletRequest request){
        return toJson(machineLogService.pageSelectMachineLog(machineId,currentPage,pageSize),request);
    }

  • 点赞
  • 收藏

相关推荐 更多相似问题