Merge branch 'master' of https://github.com/wangtianrui/OldPeopleHome
This commit is contained in:
1096
server/OldPeopleHome/.idea/workspace.xml
generated
1096
server/OldPeopleHome/.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 10:16
|
||||
* Description:
|
||||
*/
|
||||
public interface ChildDao {
|
||||
|
||||
Child findById(long childId);
|
||||
Child findByLongId(String childLongId);
|
||||
Child findByName(String childName);
|
||||
List<Child> findAll();
|
||||
void delete(long childId);
|
||||
void update(Child child);
|
||||
void insert(Child child);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
import com.oldpeoplehome.entity.ChildParent;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 14:20
|
||||
* Description:
|
||||
*/
|
||||
public interface ChildParentDao {
|
||||
List<Parent> findByChild(long childId);
|
||||
List<Child> findByParent(long parentId);
|
||||
void insert(ChildParent childParent);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.dto.HeartRateFilter;
|
||||
import com.oldpeoplehome.dto.RoomStateFilter;
|
||||
import com.oldpeoplehome.entity.HeartRate;
|
||||
import com.oldpeoplehome.entity.RoomState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:44
|
||||
* Description:
|
||||
*/
|
||||
public interface HeartRateDao {
|
||||
|
||||
List<HeartRate> findByParent(HeartRateFilter rateFilter);
|
||||
List<HeartRate> findByTime(HeartRateFilter rateFilter);
|
||||
List<HeartRate> findByParentAndTime(HeartRateFilter rateFilter);
|
||||
|
||||
void insert(HeartRate heartRate);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.dto.MotionFilter;
|
||||
import com.oldpeoplehome.entity.Motion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 15:58
|
||||
* Description:
|
||||
*/
|
||||
public interface MotionDao {
|
||||
|
||||
List<Motion> findByParentId(MotionFilter motionFilter);
|
||||
List<Motion> findByParentIdAndDate(MotionFilter motionFilter);
|
||||
List<Motion> findByDate(MotionFilter motionFilter);
|
||||
|
||||
|
||||
void insert(Motion motion);
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
public interface RoomDao {
|
||||
//通过id查房间
|
||||
Room findById(int roomId);
|
||||
List<Room> findEmptyRoom();
|
||||
//查所有房间
|
||||
List<Room> findAll();
|
||||
//添加房间
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.dto.RoomStateFilter;
|
||||
import com.oldpeoplehome.entity.RoomState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 17:28
|
||||
* Description:
|
||||
*/
|
||||
public interface RoomStateDao {
|
||||
|
||||
List<RoomState> findByRoom(RoomStateFilter roomStateFilter);
|
||||
List<RoomState> findByTime(RoomStateFilter roomStateFilter);
|
||||
List<RoomState> findByRoomAndTime(RoomStateFilter roomStateFilter);
|
||||
|
||||
void insert(RoomState roomState);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.dto.MotionFilter;
|
||||
import com.oldpeoplehome.dto.SleepFilter;
|
||||
import com.oldpeoplehome.entity.Motion;
|
||||
import com.oldpeoplehome.entity.Sleep;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 16:55
|
||||
* Description:
|
||||
*/
|
||||
public interface SleepDao {
|
||||
|
||||
List<Sleep> findByParentId(SleepFilter sleepFilter);
|
||||
List<Sleep> findByParentIdAndDate(SleepFilter sleepFilter);
|
||||
List<Sleep> findByDate(SleepFilter sleepFilter);
|
||||
|
||||
void insert(Sleep Sleep);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.oldpeoplehome.dto;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 9:44
|
||||
* Description:
|
||||
*/
|
||||
public class ChangeRoom {
|
||||
|
||||
private Timestamp startDate;
|
||||
private Timestamp endDate;
|
||||
private long parentId;
|
||||
|
||||
public ChangeRoom() {
|
||||
}
|
||||
|
||||
public ChangeRoom(long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public ChangeRoom(Timestamp startDate, long parentId) {
|
||||
this.startDate = startDate;
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public ChangeRoom(Timestamp startDate, Timestamp endDate, long parentId) {
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Timestamp getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Timestamp startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Timestamp getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Timestamp endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChangeRoom{" +
|
||||
"startDate=" + startDate +
|
||||
", endDate=" + endDate +
|
||||
", parentId=" + parentId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.oldpeoplehome.dto;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:45
|
||||
* Description:
|
||||
*/
|
||||
public class HeartRateFilter {
|
||||
|
||||
private long parentId;
|
||||
private Timestamp startDate;
|
||||
private Timestamp endDate;
|
||||
|
||||
public HeartRateFilter() {
|
||||
}
|
||||
|
||||
public HeartRateFilter(long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public HeartRateFilter(Timestamp startDate,long parentId) {
|
||||
this.parentId = parentId;
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public HeartRateFilter( String startDate,long parentId) {
|
||||
this.parentId = parentId;
|
||||
this.startDate = Timestamp.valueOf(startDate);
|
||||
}
|
||||
public HeartRateFilter(String startDate, String endDate,long parentId) {
|
||||
this.parentId = parentId;
|
||||
this.startDate = Timestamp.valueOf(startDate);
|
||||
this.endDate = Timestamp.valueOf(endDate);
|
||||
}
|
||||
public HeartRateFilter(Timestamp startDate, Timestamp endDate,long parentId) {
|
||||
this.parentId = parentId;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Timestamp getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Timestamp startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Timestamp getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Timestamp endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HeartRateFilter{" +
|
||||
"parentId=" + parentId +
|
||||
", startDate=" + startDate +
|
||||
", endDate=" + endDate +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.oldpeoplehome.dto;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 17:13
|
||||
* Description:
|
||||
*/
|
||||
public class MotionFilter {
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private long motionParentId;
|
||||
|
||||
public MotionFilter() {
|
||||
}
|
||||
|
||||
public MotionFilter(long motionParentId) {
|
||||
this.motionParentId = motionParentId;
|
||||
}
|
||||
|
||||
public MotionFilter(Date startDate, long motionParentId) {
|
||||
this.startDate = startDate;
|
||||
this.motionParentId = motionParentId;
|
||||
}
|
||||
|
||||
public MotionFilter(Date startDate, Date endDate, long motionParentId) {
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.motionParentId = motionParentId;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = Date.valueOf(startDate);
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = Date.valueOf(endDate);
|
||||
}
|
||||
|
||||
public long getMotionParentId() {
|
||||
return motionParentId;
|
||||
}
|
||||
|
||||
public void setMotionParentId(long motionParentId) {
|
||||
this.motionParentId = motionParentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MotionFilter{" +
|
||||
"startDate=" + startDate +
|
||||
", endDate=" + endDate +
|
||||
", parentId=" + motionParentId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.oldpeoplehome.dto;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 17:29
|
||||
* Description:
|
||||
*/
|
||||
public class RoomStateFilter {
|
||||
|
||||
private Timestamp startDate;
|
||||
private Timestamp endDate;
|
||||
private int roomId;
|
||||
|
||||
public RoomStateFilter(Timestamp startDate, Timestamp endDate, int roomId) {
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public RoomStateFilter(Timestamp startDate, int roomId) {
|
||||
this.startDate = startDate;
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public RoomStateFilter() {
|
||||
}
|
||||
|
||||
public RoomStateFilter(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public Timestamp getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Timestamp startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Timestamp getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Timestamp endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RoomStateFilter{" +
|
||||
"startDate=" + startDate +
|
||||
", endDate=" + endDate +
|
||||
", roomId=" + roomId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.oldpeoplehome.dto;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 16:56
|
||||
* Description:
|
||||
*/
|
||||
public class SleepFilter {
|
||||
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private long parentId;
|
||||
|
||||
public SleepFilter(long motionParentId) {
|
||||
this.parentId = motionParentId;
|
||||
}
|
||||
|
||||
public SleepFilter(Date startDate, long motionParentId) {
|
||||
this.startDate = startDate;
|
||||
this.parentId = motionParentId;
|
||||
}
|
||||
|
||||
public SleepFilter(Date startDate, Date endDate, long motionParentId) {
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.parentId = motionParentId;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = Date.valueOf(startDate);
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = Date.valueOf(endDate);
|
||||
}
|
||||
|
||||
public long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SleepFilter{" +
|
||||
"startDate=" + startDate +
|
||||
", endDate=" + endDate +
|
||||
", parentId=" + parentId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.oldpeoplehome.entity;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 10:18
|
||||
* Description:
|
||||
*/
|
||||
public class Child {
|
||||
|
||||
private long childId;
|
||||
private String childLongId;
|
||||
private String childName;
|
||||
private String childSex;
|
||||
private String childAccount;
|
||||
private String childPassword;
|
||||
private String childPhone;
|
||||
private Parent parent;
|
||||
|
||||
public Child() {
|
||||
}
|
||||
|
||||
public Child(String childLongId, String childName, String childSex, String childAccount, String childPassword, String childPhone) {
|
||||
this.childLongId = childLongId;
|
||||
this.childName = childName;
|
||||
this.childSex = childSex;
|
||||
this.childAccount = childAccount;
|
||||
this.childPassword = childPassword;
|
||||
this.childPhone = childPhone;
|
||||
}
|
||||
|
||||
public Child(Long childId, String childLongId, String childName, String childSex, String childAccount, String childPassword, String childPhone) {
|
||||
this.childId = childId;
|
||||
this.childLongId = childLongId;
|
||||
this.childName = childName;
|
||||
this.childSex = childSex;
|
||||
this.childAccount = childAccount;
|
||||
this.childPassword = childPassword;
|
||||
this.childPhone = childPhone;
|
||||
}
|
||||
|
||||
public long getChildId() {
|
||||
return childId;
|
||||
}
|
||||
|
||||
public void setChildId(long childId) {
|
||||
this.childId = childId;
|
||||
}
|
||||
|
||||
public String getChildLongId() {
|
||||
return childLongId;
|
||||
}
|
||||
|
||||
public void setChildLongId(String childLongId) {
|
||||
this.childLongId = childLongId;
|
||||
}
|
||||
|
||||
public String getChildName() {
|
||||
return childName;
|
||||
}
|
||||
|
||||
public void setChildName(String childName) {
|
||||
this.childName = childName;
|
||||
}
|
||||
|
||||
public String getChildSex() {
|
||||
return childSex;
|
||||
}
|
||||
|
||||
public void setChildSex(String childSex) {
|
||||
this.childSex = childSex;
|
||||
}
|
||||
|
||||
public String getChildAccount() {
|
||||
return childAccount;
|
||||
}
|
||||
|
||||
public void setChildAccount(String childAccount) {
|
||||
this.childAccount = childAccount;
|
||||
}
|
||||
|
||||
public String getChildPassword() {
|
||||
return childPassword;
|
||||
}
|
||||
|
||||
public void setChildPassword(String childPassword) {
|
||||
this.childPassword = childPassword;
|
||||
}
|
||||
|
||||
public String getChildPhone() {
|
||||
return childPhone;
|
||||
}
|
||||
|
||||
public void setChildPhone(String childPhone) {
|
||||
this.childPhone = childPhone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Child{" +
|
||||
"childId=" + childId +
|
||||
", childLongId='" + childLongId + '\'' +
|
||||
", childName='" + childName + '\'' +
|
||||
", childSex='" + childSex + '\'' +
|
||||
", childAccount='" + childAccount + '\'' +
|
||||
", childPassword='" + childPassword + '\'' +
|
||||
", childPhone='" + childPhone + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.oldpeoplehome.entity;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 15:06
|
||||
* Description:
|
||||
*/
|
||||
public class ChildParent {
|
||||
|
||||
private long parentId;
|
||||
private long childId;
|
||||
private String relation;
|
||||
|
||||
public ChildParent() {
|
||||
}
|
||||
|
||||
public ChildParent(long parentId, long childId, String relation) {
|
||||
this.parentId = parentId;
|
||||
this.childId = childId;
|
||||
this.relation = relation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChildParent{" +
|
||||
"parentId=" + parentId +
|
||||
", childId=" + childId +
|
||||
", relation='" + relation + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.oldpeoplehome.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:41
|
||||
* Description:
|
||||
*/
|
||||
public class HeartRate {
|
||||
|
||||
private long parentId;
|
||||
private Timestamp time;
|
||||
private double rate;
|
||||
|
||||
public HeartRate() {
|
||||
}
|
||||
|
||||
public HeartRate(long parentId, String time, double rate) {
|
||||
this.parentId = parentId;
|
||||
this.time = Timestamp.valueOf(time);
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
public HeartRate(long parentId, Timestamp time, double rate) {
|
||||
this.parentId = parentId;
|
||||
this.time = time;
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
public long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
public Timestamp getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Timestamp time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public double getRate() {
|
||||
return rate;
|
||||
}
|
||||
|
||||
public void setRate(double rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HeartRateDao{" +
|
||||
"parentId=" + parentId +
|
||||
", time=" + time +
|
||||
", rate=" + rate +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.oldpeoplehome.entity;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 15:58
|
||||
* Description:
|
||||
*/
|
||||
public class Motion {
|
||||
private long motionParentId;
|
||||
private Date motionDate;
|
||||
private long motionCount;
|
||||
private double motionDistance;
|
||||
private Time motionTime;
|
||||
|
||||
public Motion() {
|
||||
}
|
||||
|
||||
public Motion(long motionParentId, String motionDate, long motionCount, double motionDistance, String motionTime) {
|
||||
this.motionParentId = motionParentId;
|
||||
this.motionDate = Date.valueOf(motionDate);
|
||||
this.motionCount = motionCount;
|
||||
this.motionDistance = motionDistance;
|
||||
this.motionTime = Time.valueOf(motionTime);
|
||||
}
|
||||
|
||||
public Motion(long motionParentId, Date motionDate, long motionCount, double motionDistance, Time motionTime) {
|
||||
this.motionParentId = motionParentId;
|
||||
this.motionDate = motionDate;
|
||||
this.motionCount = motionCount;
|
||||
this.motionDistance = motionDistance;
|
||||
this.motionTime = motionTime;
|
||||
}
|
||||
|
||||
|
||||
public long getMotionParentId() {
|
||||
return motionParentId;
|
||||
}
|
||||
|
||||
public void setMotionParentId(long parentId) {
|
||||
this.motionParentId = parentId;
|
||||
}
|
||||
|
||||
public Date getMotionDate() {
|
||||
return motionDate;
|
||||
}
|
||||
|
||||
public void setMotionDate(Date motionDate) {
|
||||
this.motionDate = motionDate;
|
||||
}
|
||||
public void setMotionDate(String motionDate) {
|
||||
this.motionDate = Date.valueOf(motionDate);
|
||||
}
|
||||
|
||||
public long getMotionCount() {
|
||||
return motionCount;
|
||||
}
|
||||
|
||||
public void setMotionCount(long motionCount) {
|
||||
this.motionCount = motionCount;
|
||||
}
|
||||
|
||||
public double getMotionDistance() {
|
||||
return motionDistance;
|
||||
}
|
||||
|
||||
public void setMotionDistance(double motionDistance) {
|
||||
this.motionDistance = motionDistance;
|
||||
}
|
||||
|
||||
public Time getMotionTime() {
|
||||
return motionTime;
|
||||
}
|
||||
|
||||
public void setMotionTime(Time motionTime) {
|
||||
this.motionTime = motionTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Motion{" +
|
||||
"parentId=" + motionParentId +
|
||||
", motionDate=" + motionDate +
|
||||
", motionCount=" + motionCount +
|
||||
", motionDistance=" + motionDistance +
|
||||
", motionTime=" + motionTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -20,24 +20,36 @@ public class Parent {
|
||||
private String parentPhone;
|
||||
private int parentRoomId;
|
||||
private Room parentRoom;
|
||||
private Child child;
|
||||
|
||||
public Parent() {
|
||||
}
|
||||
|
||||
public Parent(String parentLongId, String parentName, String parentSex, String parentAccount, String parentPassword, Double parentHeight, Double parentWeight, Date parentBirth, String parentPhone, Integer parentRoomId, Room parentRoom) {
|
||||
this.parentLongId = parentLongId;
|
||||
this.parentName = parentName;
|
||||
this.parentSex = parentSex;
|
||||
this.parentAccount = parentAccount;
|
||||
this.parentPassword = parentPassword;
|
||||
this.parentHeight = parentHeight;
|
||||
this.parentWeight = parentWeight;
|
||||
this.parentBirth = parentBirth;
|
||||
this.parentPhone = parentPhone;
|
||||
this.parentRoomId = parentRoomId;
|
||||
this.parentRoom = parentRoom;
|
||||
}
|
||||
public Parent(Long parentId, String parentLongId, String parentName, String parentSex, String parentAccount, String parentPassword, Double parentHeight, Double parentWeight, Date parentBirth, String parentPhone, Integer parentRoomId, Room parentRoom) {
|
||||
public Parent(long parentId, String parentLongId, String parentName, String parentSex, String parentAccount, String parentPassword, double parentHeight, double parentWeight, Date parentBirth, String parentPhone) {
|
||||
this.parentId = parentId;
|
||||
this.parentLongId = parentLongId;
|
||||
this.parentName = parentName;
|
||||
this.parentSex = parentSex;
|
||||
this.parentAccount = parentAccount;
|
||||
this.parentPassword = parentPassword;
|
||||
this.parentHeight = parentHeight;
|
||||
this.parentWeight = parentWeight;
|
||||
this.parentBirth = parentBirth;
|
||||
this.parentPhone = parentPhone;
|
||||
}
|
||||
|
||||
public Parent(String parentLongId, String parentName, String parentSex, String parentAccount, String parentPassword, Double parentHeight, Double parentWeight, Date parentBirth, String parentPhone) {
|
||||
this.parentLongId = parentLongId;
|
||||
this.parentName = parentName;
|
||||
this.parentSex = parentSex;
|
||||
this.parentAccount = parentAccount;
|
||||
this.parentPassword = parentPassword;
|
||||
this.parentHeight = parentHeight;
|
||||
this.parentWeight = parentWeight;
|
||||
this.parentBirth = parentBirth;
|
||||
this.parentPhone = parentPhone;
|
||||
}
|
||||
public Parent(Long parentId, String parentLongId, String parentName, String parentSex, String parentAccount, String parentPassword, Double parentHeight, Double parentWeight, Date parentBirth, String parentPhone) {
|
||||
this.parentId = parentId;
|
||||
this.parentLongId = parentLongId;
|
||||
this.parentName = parentName;
|
||||
@@ -48,8 +60,6 @@ public class Parent {
|
||||
this.parentWeight = parentWeight;
|
||||
this.parentBirth = parentBirth;
|
||||
this.parentPhone = parentPhone;
|
||||
this.parentRoomId = parentRoomId;
|
||||
this.parentRoom = parentRoom;
|
||||
}
|
||||
|
||||
public long getParentId() {
|
||||
@@ -164,8 +174,6 @@ public class Parent {
|
||||
", parentWeight=" + parentWeight +
|
||||
", parentBirth=" + parentBirth +
|
||||
", parentPhone=" + parentPhone +
|
||||
", parentRoomId=" + parentRoomId +
|
||||
", parentRoom=" + parentRoom +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ public class Room {
|
||||
private int roomId;
|
||||
private String roomLocation;
|
||||
private String roomName;
|
||||
private long parentId;
|
||||
private Parent parent;
|
||||
|
||||
public Room() {
|
||||
}
|
||||
@@ -18,10 +20,17 @@ public class Room {
|
||||
this.roomName = roomName;
|
||||
}
|
||||
|
||||
public Room(Integer roomId, String roomLocation, String roomName) {
|
||||
public Room(String roomLocation, String roomName, Long parentId) {
|
||||
this.roomLocation = roomLocation;
|
||||
this.roomName = roomName;
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Room(Integer roomId, String roomLocation, String roomName, Long parentId) {
|
||||
this.roomId = roomId;
|
||||
this.roomName = roomName;
|
||||
this.roomLocation = roomLocation;
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
@@ -48,12 +57,22 @@ public class Room {
|
||||
this.roomLocation = roomLocation;
|
||||
}
|
||||
|
||||
public long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Room{" +
|
||||
"roomId=" + roomId +
|
||||
", roomName='" + roomName + '\'' +
|
||||
", roomLocation='" + roomLocation + '\'' +
|
||||
", roomName='" + roomName + '\'' +
|
||||
", parentId=" + parentId +
|
||||
", parent=" + parent +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.oldpeoplehome.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 17:22
|
||||
* Description:
|
||||
*/
|
||||
public class RoomState {
|
||||
|
||||
private int roomId;
|
||||
private Timestamp time;
|
||||
private double temperature;
|
||||
private double humidity;
|
||||
private int isin;
|
||||
|
||||
public RoomState() {
|
||||
}
|
||||
|
||||
public RoomState(int rid, String time, double temperature, double humidity, int isin) {
|
||||
this.roomId = rid;
|
||||
this.time = Timestamp.valueOf(time);
|
||||
this.temperature = temperature;
|
||||
this.humidity = humidity;
|
||||
this.isin = isin;
|
||||
}
|
||||
public RoomState(int rid, Timestamp time, double temperature, double humidity, int isin) {
|
||||
this.roomId = rid;
|
||||
this.time = time;
|
||||
this.temperature = temperature;
|
||||
this.humidity = humidity;
|
||||
this.isin = isin;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
public Timestamp getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Timestamp time) {
|
||||
this.time = time;
|
||||
}
|
||||
public void setTime(String time) {
|
||||
this.time = Timestamp.valueOf(time);
|
||||
}
|
||||
|
||||
public double getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
public void setTemperature(double temperature) {
|
||||
this.temperature = temperature;
|
||||
}
|
||||
|
||||
public double getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(double humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
public int getIsin() {
|
||||
return isin;
|
||||
}
|
||||
|
||||
public void setIsin(int isin) {
|
||||
this.isin = isin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RoomState{" +
|
||||
"rid=" + roomId +
|
||||
", time=" + time +
|
||||
", temperature=" + temperature +
|
||||
", humidity=" + humidity +
|
||||
", isin=" + isin +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.oldpeoplehome.entity;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 16:51
|
||||
* Description:
|
||||
*/
|
||||
public class Sleep {
|
||||
|
||||
private long parentId;
|
||||
private Date date;
|
||||
private Time lightTime;
|
||||
private Time deepTime;
|
||||
private Time awakeTime;
|
||||
|
||||
public Sleep() {
|
||||
}
|
||||
|
||||
public Sleep(long parentId, String date, String lightTime, String deepTime, String awakeTime) {
|
||||
this.parentId = parentId;
|
||||
this.date = Date.valueOf(date);
|
||||
this.lightTime = Time.valueOf(lightTime);
|
||||
this.deepTime = Time.valueOf(deepTime);
|
||||
this.awakeTime = Time.valueOf(awakeTime);
|
||||
}
|
||||
|
||||
public Sleep(long parentId, Date date, Time lightTime, Time deepTime, Time awakeTime) {
|
||||
this.parentId = parentId;
|
||||
this.date = date;
|
||||
this.lightTime = lightTime;
|
||||
this.deepTime = deepTime;
|
||||
this.awakeTime = awakeTime;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = Date.valueOf(date);
|
||||
}
|
||||
|
||||
public Time getLightTime() {
|
||||
return lightTime;
|
||||
}
|
||||
|
||||
public void setLightTime(Time lightTime) {
|
||||
this.lightTime = lightTime;
|
||||
}
|
||||
|
||||
public void setLightTime(String lightTime) {
|
||||
this.lightTime = Time.valueOf(lightTime);
|
||||
}
|
||||
|
||||
public Time getDeepTime() {
|
||||
return deepTime;
|
||||
}
|
||||
|
||||
public void setDeepTime(Time deepTime) {
|
||||
this.deepTime = deepTime;
|
||||
}
|
||||
|
||||
public void setDeepTime(String deepTime) {
|
||||
this.deepTime = Time.valueOf(deepTime);
|
||||
}
|
||||
|
||||
public Time getAwakeTime() {
|
||||
return awakeTime;
|
||||
}
|
||||
|
||||
public void setAwakeTime(Time awakeTime) {
|
||||
this.awakeTime = awakeTime;
|
||||
}
|
||||
|
||||
public void setAwakeTime(String awakeTime) {
|
||||
this.awakeTime = Time.valueOf(awakeTime);
|
||||
}
|
||||
|
||||
public long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Sleep{" +
|
||||
"parentId=" + parentId +
|
||||
", date=" + date +
|
||||
", lightTime=" + lightTime +
|
||||
", deepTime=" + deepTime +
|
||||
", awakeTime=" + awakeTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
import com.oldpeoplehome.entity.ChildParent;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 15:24
|
||||
* Description:
|
||||
*/
|
||||
public interface ChildParentService {
|
||||
|
||||
List<Parent> findByChild(long childId);
|
||||
List<Child> findByParent(long parentId);
|
||||
void combine(ChildParent childParent);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 11:14
|
||||
* Description:
|
||||
*/
|
||||
public interface ChildService {
|
||||
|
||||
Child findById(long childId);
|
||||
Child findByLongId(String childLongId);
|
||||
Child findByName(String childName);
|
||||
List<Child> findAll();
|
||||
void delete(long childId);
|
||||
void update(Child child);
|
||||
void insert(Child child);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.dto.HeartRateFilter;
|
||||
import com.oldpeoplehome.entity.HeartRate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:55
|
||||
* Description:
|
||||
*/
|
||||
public interface HeartRateService {
|
||||
|
||||
List<HeartRate> findByParent(HeartRateFilter rateFilter);
|
||||
List<HeartRate> findByTime(HeartRateFilter rateFilter);
|
||||
List<HeartRate> findByParentAndTime(HeartRateFilter rateFilter);
|
||||
|
||||
void insert(HeartRate heartRate);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.dto.MotionFilter;
|
||||
import com.oldpeoplehome.entity.Motion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 13:52
|
||||
* Description:
|
||||
*/
|
||||
public interface MotionService {
|
||||
|
||||
List<Motion> findByParentId(MotionFilter motionFilter);
|
||||
List<Motion> findByParentIdAndDate(MotionFilter motionFilter);
|
||||
List<Motion> findByDate(MotionFilter motionFilter);
|
||||
void insert(Motion motion);
|
||||
|
||||
}
|
||||
@@ -17,4 +17,5 @@ public interface ParentService {
|
||||
void insert(Parent parent);
|
||||
void update(Parent parent);
|
||||
void delete(long id);
|
||||
Parent changeRoom(Parent parent, int RoomId);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public interface RoomService {
|
||||
Room findById(int roomId);
|
||||
|
||||
List<Room> findAll();
|
||||
List<Room> findEmpty();
|
||||
|
||||
int insert(Room room);
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.dto.RoomStateFilter;
|
||||
import com.oldpeoplehome.entity.RoomState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:20
|
||||
* Description:
|
||||
*/
|
||||
public interface RoomStateService {
|
||||
|
||||
List<RoomState> findByRoom(RoomStateFilter roomStateFilter);
|
||||
List<RoomState> findByTime(RoomStateFilter roomStateFilter);
|
||||
List<RoomState> findByRoomAndTime(RoomStateFilter roomStateFilter);
|
||||
|
||||
void insert(RoomState roomState);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.dto.MotionFilter;
|
||||
import com.oldpeoplehome.dto.SleepFilter;
|
||||
import com.oldpeoplehome.entity.Motion;
|
||||
import com.oldpeoplehome.entity.Sleep;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 17:03
|
||||
* Description:
|
||||
*/
|
||||
public interface SleepService {
|
||||
List<Sleep> findByParentId(SleepFilter sleepFilter);
|
||||
List<Sleep> findByParentIdAndDate(SleepFilter sleepFilter);
|
||||
List<Sleep> findByDate(SleepFilter sleepFilter);
|
||||
|
||||
void insert(Sleep Sleep);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.oldpeoplehome.service.impl;
|
||||
|
||||
import com.oldpeoplehome.dao.ChildParentDao;
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
import com.oldpeoplehome.entity.ChildParent;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
import com.oldpeoplehome.service.ChildParentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 15:24
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class ChildParentServiceImpl implements ChildParentService {
|
||||
|
||||
@Autowired
|
||||
private ChildParentDao childParentDao;
|
||||
|
||||
@Override
|
||||
public List<Parent> findByChild(long childId) {
|
||||
return childParentDao.findByChild(childId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Child> findByParent(long parentId) {
|
||||
return childParentDao.findByParent(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void combine(ChildParent childParent) {
|
||||
childParentDao.insert(childParent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.oldpeoplehome.service.impl;
|
||||
|
||||
import com.oldpeoplehome.dao.ChildDao;
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
import com.oldpeoplehome.service.ChildService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 11:14
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class ChildServiceImpl implements ChildService {
|
||||
|
||||
@Autowired
|
||||
private ChildDao childDao;
|
||||
|
||||
@Override
|
||||
public Child findById(long childId) {
|
||||
return childDao.findById(childId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Child findByLongId(String childLongId) {
|
||||
return childDao.findByLongId(childLongId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Child findByName(String childName) {
|
||||
return childDao.findByName(childName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Child> findAll() {
|
||||
return childDao.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(long childId) {
|
||||
childDao.delete(childId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Child child) {
|
||||
childDao.update(child);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Child child) {
|
||||
childDao.insert(child);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.oldpeoplehome.service.impl;
|
||||
|
||||
import com.oldpeoplehome.dao.HeartRateDao;
|
||||
import com.oldpeoplehome.dto.HeartRateFilter;
|
||||
import com.oldpeoplehome.entity.HeartRate;
|
||||
import com.oldpeoplehome.service.HeartRateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:56
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class HeartRateServiceTest implements HeartRateService {
|
||||
|
||||
@Autowired
|
||||
private HeartRateDao heartRateDao;
|
||||
@Override
|
||||
public List<HeartRate> findByParent(HeartRateFilter rateFilter) {
|
||||
return heartRateDao.findByParent(rateFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HeartRate> findByTime(HeartRateFilter rateFilter) {
|
||||
return heartRateDao.findByTime(rateFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HeartRate> findByParentAndTime(HeartRateFilter rateFilter) {
|
||||
return heartRateDao.findByParentAndTime(rateFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(HeartRate heartRate) {
|
||||
heartRateDao.insert(heartRate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.oldpeoplehome.service.impl;
|
||||
|
||||
import com.oldpeoplehome.dao.MotionDao;
|
||||
import com.oldpeoplehome.dto.MotionFilter;
|
||||
import com.oldpeoplehome.entity.Motion;
|
||||
import com.oldpeoplehome.service.MotionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 14:02
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class MotionServiceImpl implements MotionService {
|
||||
|
||||
@Autowired
|
||||
private MotionDao motionDao;
|
||||
|
||||
@Override
|
||||
public List<Motion> findByParentId(MotionFilter motionFilter) {
|
||||
return motionDao.findByParentId(motionFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Motion> findByParentIdAndDate(MotionFilter motionFilter) {
|
||||
return motionDao.findByParentIdAndDate(motionFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Motion> findByDate(MotionFilter motionFilter) {
|
||||
return motionDao.findByDate(motionFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Motion motion) {
|
||||
motionDao.insert(motion);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,11 @@ public class ParentServiceImpl implements ParentService {
|
||||
return parentDao.findByRoomId(roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parent changeRoom(Parent parent, int RoomId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parent findByName(String name) {
|
||||
return parentDao.findByName(name);
|
||||
@@ -50,7 +55,7 @@ public class ParentServiceImpl implements ParentService {
|
||||
|
||||
@Override
|
||||
public void update(Parent parent) {
|
||||
parentDao.insert(parent);
|
||||
parentDao.update(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,6 +39,11 @@ public class RoomServiceImpl implements RoomService {
|
||||
return roomDao.updateRoom(room);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Room> findEmpty() {
|
||||
return roomDao.findEmptyRoom();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(int roomId) {
|
||||
return roomDao.deleteRoom(roomId);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.oldpeoplehome.service.impl;
|
||||
|
||||
import com.oldpeoplehome.dao.RoomStateDao;
|
||||
import com.oldpeoplehome.dto.RoomStateFilter;
|
||||
import com.oldpeoplehome.entity.RoomState;
|
||||
import com.oldpeoplehome.service.RoomStateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:20
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class RoomStateServiceImpl implements RoomStateService {
|
||||
|
||||
@Autowired
|
||||
private RoomStateDao roomStateDao;
|
||||
|
||||
@Override
|
||||
public List<RoomState> findByRoom(RoomStateFilter roomStateFilter) {
|
||||
return roomStateDao.findByRoom(roomStateFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoomState> findByTime(RoomStateFilter roomStateFilter) {
|
||||
return roomStateDao.findByTime(roomStateFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoomState> findByRoomAndTime(RoomStateFilter roomStateFilter) {
|
||||
return roomStateDao.findByRoomAndTime(roomStateFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(RoomState roomState) {
|
||||
roomStateDao.insert(roomState);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.oldpeoplehome.service.impl;
|
||||
|
||||
import com.oldpeoplehome.dao.SleepDao;
|
||||
import com.oldpeoplehome.dto.SleepFilter;
|
||||
import com.oldpeoplehome.entity.Sleep;
|
||||
import com.oldpeoplehome.service.SleepService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 17:04
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class SleepServiceImpl implements SleepService {
|
||||
@Autowired
|
||||
private SleepDao sleepDao;
|
||||
|
||||
@Override
|
||||
public List<Sleep> findByParentId(SleepFilter sleepFilter) {
|
||||
return sleepDao.findByParentId(sleepFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Sleep> findByParentIdAndDate(SleepFilter sleepFilter) {
|
||||
return sleepDao.findByParentIdAndDate(sleepFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Sleep> findByDate(SleepFilter sleepFilter) {
|
||||
return sleepDao.findByDate(sleepFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Sleep Sleep) {
|
||||
sleepDao.insert(Sleep);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.oldpeoplehome.web;
|
||||
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
import com.oldpeoplehome.service.ChildService;
|
||||
import com.oldpeoplehome.utils.MethodUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 11:18
|
||||
* Description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/child")
|
||||
public class ChildController {
|
||||
|
||||
@Autowired
|
||||
private ChildService childService;
|
||||
|
||||
@RequestMapping("/get/{id}")
|
||||
@ResponseBody
|
||||
public Child get(@PathVariable("id") String id){
|
||||
return childService.findById(Long.valueOf(id));
|
||||
}
|
||||
@RequestMapping("/get_longid/{longid}")
|
||||
@ResponseBody
|
||||
public Child getLong(@PathVariable("longid") String id){
|
||||
return childService.findByLongId(id);
|
||||
}
|
||||
@RequestMapping("/get_name/{name}")
|
||||
@ResponseBody
|
||||
public Child getName(@PathVariable("name") String name){
|
||||
return childService.findByName(name);
|
||||
}
|
||||
@RequestMapping("/list")
|
||||
@ResponseBody
|
||||
public List list() {
|
||||
return childService.findAll();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Child add(@RequestParam Map<String, Object> params){
|
||||
Child child = new Child();
|
||||
child.setChildSex(String.valueOf(params.get("childSex")));
|
||||
child.setChildPassword(String.valueOf(params.get("childPassword")));
|
||||
child.setChildAccount(String.valueOf(params.get("childAccount")));
|
||||
child.setChildName(String.valueOf(params.get("childName")));
|
||||
child.setChildLongId(String.valueOf(params.get("childLongId")));
|
||||
child.setChildPhone(String.valueOf(params.get("childPhone")));
|
||||
childService.insert(child);
|
||||
return childService.findByLongId(child.getChildLongId());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Child update(@RequestParam Map<String, Object> params, @PathVariable("id") String id) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
|
||||
Child child = childService.findById(Long.valueOf(id));
|
||||
MethodUtil.updateFields(child, params);
|
||||
childService.update(child);
|
||||
return child;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseBody
|
||||
public List<Child> delete(@PathVariable("id") String id){
|
||||
childService.delete(Long.valueOf(id));
|
||||
return childService.findAll();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.oldpeoplehome.web;
|
||||
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
import com.oldpeoplehome.entity.ChildParent;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
import com.oldpeoplehome.entity.Room;
|
||||
import com.oldpeoplehome.service.ChildParentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 15:45
|
||||
* Description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/child_parent")
|
||||
public class ChildParentController {
|
||||
|
||||
@Autowired
|
||||
private ChildParentService childParentService;
|
||||
|
||||
@RequestMapping("/child/{id}")
|
||||
@ResponseBody
|
||||
public List findByChild(@PathVariable("id") String id) {
|
||||
List<Parent> list = childParentService.findByChild(Long.valueOf(id));
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping("/parent/{id}")
|
||||
@ResponseBody
|
||||
public List findByParent(@PathVariable("id") String id) {
|
||||
List<Child> list = childParentService.findByParent(Long.valueOf(id));
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void add(@RequestParam Map<String, Object> params) {
|
||||
|
||||
long child = Long.valueOf(String.valueOf(params.get("child")));
|
||||
long parent = Long.valueOf(String.valueOf(params.get("parent")));
|
||||
String relation = String.valueOf(params.get("relation"));
|
||||
ChildParent childParent = new ChildParent(parent, child, relation);
|
||||
childParentService.combine(childParent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.oldpeoplehome.web;
|
||||
|
||||
import com.oldpeoplehome.dto.HeartRateFilter;
|
||||
import com.oldpeoplehome.dto.RoomStateFilter;
|
||||
import com.oldpeoplehome.entity.HeartRate;
|
||||
import com.oldpeoplehome.entity.RoomState;
|
||||
import com.oldpeoplehome.service.HeartRateService;
|
||||
import com.oldpeoplehome.service.RoomStateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:58
|
||||
* Description:
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/heartrate")
|
||||
public class HeartRateController {
|
||||
|
||||
@Autowired
|
||||
private HeartRateService heartRateService;
|
||||
|
||||
@RequestMapping("/get/{id}")
|
||||
@ResponseBody
|
||||
public List findByParentId(HttpServletRequest request, @PathVariable("id") String id) {
|
||||
List<HeartRate> list;
|
||||
String startDate = request.getParameter("start");
|
||||
String endDate = request.getParameter("end");
|
||||
if (endDate == null){
|
||||
if (startDate == null) {
|
||||
HeartRateFilter heartRateFilter = new HeartRateFilter(Long.valueOf(id));
|
||||
list = heartRateService.findByParent(heartRateFilter);
|
||||
}
|
||||
else {
|
||||
HeartRateFilter heartRateFilter = new HeartRateFilter(Timestamp.valueOf(startDate), Long.valueOf(id));
|
||||
list = heartRateService.findByParentAndTime(heartRateFilter);
|
||||
}
|
||||
}
|
||||
else{
|
||||
HeartRateFilter heartRateFilter = new HeartRateFilter(Timestamp.valueOf(startDate), Timestamp.valueOf(endDate), Long.valueOf(id));
|
||||
list = heartRateService.findByTime(heartRateFilter);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void add(@RequestParam Map<String, Object> params){
|
||||
long parentId = Long.valueOf(String.valueOf(params.get("parentId")));
|
||||
String time = String.valueOf(params.get("time"));
|
||||
double rate = Double.valueOf(String.valueOf(params.get("rate")));
|
||||
HeartRate heartRate = new HeartRate(parentId, time, rate);
|
||||
heartRateService.insert(heartRate);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.oldpeoplehome.web;
|
||||
|
||||
import com.oldpeoplehome.dto.MotionFilter;
|
||||
import com.oldpeoplehome.entity.Motion;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
import com.oldpeoplehome.service.MotionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 14:34
|
||||
* Description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/motion")
|
||||
public class MotionController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private MotionService motionService;
|
||||
|
||||
@RequestMapping("/get/{id}")
|
||||
@ResponseBody
|
||||
public List findByParentId(HttpServletRequest request, @PathVariable("id") String id) {
|
||||
List<Motion> list;
|
||||
String startDate = request.getParameter("start");
|
||||
String endDate = request.getParameter("end");
|
||||
if (endDate == null){
|
||||
if (startDate == null) {
|
||||
MotionFilter motionFilter = new MotionFilter(Long.valueOf(id));
|
||||
list = motionService.findByParentId(motionFilter);
|
||||
}
|
||||
else {
|
||||
MotionFilter motionFilter = new MotionFilter(Date.valueOf(startDate), Long.valueOf(id));
|
||||
list = motionService.findByParentIdAndDate(motionFilter);
|
||||
}
|
||||
}
|
||||
else{
|
||||
MotionFilter motionFilter = new MotionFilter(Date.valueOf(startDate), Date.valueOf(endDate), Long.valueOf(id));
|
||||
list = motionService.findByDate(motionFilter);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void add(@RequestParam Map<String, Object> params){
|
||||
long parentId = Long.valueOf(String.valueOf(params.get("parent")));
|
||||
String date = String.valueOf(params.get("date"));
|
||||
long count = Long.valueOf(String.valueOf(params.get("count")));
|
||||
double distance = Long.valueOf(String.valueOf(params.get("distance")));
|
||||
String time = String.valueOf(params.get("time"));
|
||||
Motion motion = new Motion(parentId, date, count, distance, time);
|
||||
motionService.insert(motion);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,22 +48,23 @@ public class ParentController {
|
||||
}
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Parent add(Map<String, Object> params){
|
||||
public Parent add(@RequestParam Map<String, Object> params){
|
||||
Parent parent = new Parent();
|
||||
System.out.println(params);
|
||||
parent.setParentSex(String.valueOf(params.get("parentSex")));
|
||||
parent.setParentPassword(String.valueOf(params.get("parentPassword")));
|
||||
parent.setParentAccount(String.valueOf(params.get("parentAccount")));
|
||||
parent.setParentName(String.valueOf(params.get("parentName")));
|
||||
parent.setParentBirth(String.valueOf(params.get("parentBirth")));
|
||||
parent.setParentRoomId(Integer.valueOf(String.valueOf(params.get("parentRoomId"))));
|
||||
parent.setParentLongId(String.valueOf(params.get("parentLongId")));
|
||||
parentService.insert(parent);
|
||||
return parentService.findByLongId(parent.getParentLongId());
|
||||
}
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Parent update(Map<String, Object> params, @PathVariable("id") String id) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
|
||||
public Parent update(@RequestParam Map<String, Object> params, @PathVariable("id") String id) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
|
||||
Parent parent = parentService.findByID(Long.valueOf(id));
|
||||
System.out.println(params);
|
||||
MethodUtil.updateFields(parent, params);
|
||||
parentService.update(parent);
|
||||
return parent;
|
||||
|
||||
@@ -40,6 +40,13 @@ public class RoomController {
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
@RequestMapping("/list/empty")
|
||||
@ResponseBody
|
||||
public List listEmpty() {
|
||||
List<Room> list = roomService.findEmpty();
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.oldpeoplehome.web;
|
||||
|
||||
import com.oldpeoplehome.dto.RoomStateFilter;
|
||||
import com.oldpeoplehome.entity.RoomState;
|
||||
import com.oldpeoplehome.service.RoomStateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 21:23
|
||||
* Description:
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/rstate")
|
||||
public class RoomStateController {
|
||||
|
||||
@Autowired
|
||||
private RoomStateService roomStateService;
|
||||
|
||||
@RequestMapping("/get/{id}")
|
||||
@ResponseBody
|
||||
public List findByParentId(HttpServletRequest request, @PathVariable("id") String id) {
|
||||
List<RoomState> list;
|
||||
String startDate = request.getParameter("start");
|
||||
String endDate = request.getParameter("end");
|
||||
if (endDate == null){
|
||||
if (startDate == null) {
|
||||
RoomStateFilter roomStateFilter = new RoomStateFilter(Integer.valueOf(id));
|
||||
list = roomStateService.findByRoom(roomStateFilter);
|
||||
}
|
||||
else {
|
||||
RoomStateFilter roomStateFilter = new RoomStateFilter(Timestamp.valueOf(startDate), Integer.valueOf(id));
|
||||
list = roomStateService.findByRoomAndTime(roomStateFilter);
|
||||
}
|
||||
}
|
||||
else{
|
||||
RoomStateFilter roomStateFilter = new RoomStateFilter(Timestamp.valueOf(startDate), Timestamp.valueOf(endDate), Integer.valueOf(id));
|
||||
list = roomStateService.findByTime(roomStateFilter);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void add(@RequestParam Map<String, Object> params){
|
||||
int roomId = Integer.valueOf(String.valueOf(params.get("roomId")));
|
||||
String time = String.valueOf(params.get("time"));
|
||||
Double temperature = Double.valueOf(String.valueOf(params.get("temperature")));
|
||||
double humidity = Double.valueOf(String.valueOf(params.get("humidity")));
|
||||
int isin = Integer.valueOf(String.valueOf(params.get("isin")));
|
||||
RoomState roomState = new RoomState(roomId, time, temperature, humidity, isin);
|
||||
roomStateService.insert(roomState);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.oldpeoplehome.web;
|
||||
|
||||
import com.oldpeoplehome.dto.SleepFilter;
|
||||
import com.oldpeoplehome.entity.Sleep;
|
||||
import com.oldpeoplehome.service.SleepService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/22 17:06
|
||||
* Description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sleep")
|
||||
public class SleepController {
|
||||
@Autowired
|
||||
private SleepService sleepService;
|
||||
|
||||
@RequestMapping("/get/{id}")
|
||||
@ResponseBody
|
||||
public List findByParentId(HttpServletRequest request, @PathVariable("id") String id) {
|
||||
List<Sleep> list;
|
||||
String startDate = request.getParameter("start");
|
||||
String endDate = request.getParameter("end");
|
||||
if (endDate == null){
|
||||
if (startDate == null) {
|
||||
SleepFilter sleepFilter = new SleepFilter(Long.valueOf(id));
|
||||
list = sleepService.findByParentId(sleepFilter);
|
||||
}
|
||||
else {
|
||||
SleepFilter sleepFilter = new SleepFilter(Date.valueOf(startDate), Long.valueOf(id));
|
||||
list = sleepService.findByParentIdAndDate(sleepFilter);
|
||||
}
|
||||
}
|
||||
else{
|
||||
SleepFilter sleepFilter = new SleepFilter(Date.valueOf(startDate), Date.valueOf(endDate), Long.valueOf(id));
|
||||
list = sleepService.findByDate(sleepFilter);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void add(@RequestParam Map<String, Object> params){
|
||||
long parentId = Long.valueOf(String.valueOf(params.get("parent")));
|
||||
String date = String.valueOf(params.get("date"));
|
||||
String deep = String.valueOf(params.get("deep"));
|
||||
String light = String.valueOf(params.get("light"));
|
||||
String awake = String.valueOf(params.get("awake"));
|
||||
Sleep sleep = new Sleep(parentId, date, deep, light, awake);
|
||||
sleepService.insert(sleep);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
jdbc.driver=com.mysql.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://localhost:3306/ssmtest?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
|
||||
jdbc.username=root
|
||||
jdbc.password=root
|
||||
jdbc.password=想看?的密码?滚!
|
||||
|
||||
51
server/OldPeopleHome/src/main/resources/mapper/ChildDao.xml
Normal file
51
server/OldPeopleHome/src/main/resources/mapper/ChildDao.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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="com.oldpeoplehome.dao.ChildDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.Child">
|
||||
<id column="id" property="childId" jdbcType="BIGINT"/>
|
||||
<result column="longid" property="childLongId" jdbcType="CHAR"/>
|
||||
<result column="name" property="childName" jdbcType="VARCHAR"/>
|
||||
<result column="sex" property="childSex" jdbcType="VARCHAR"/>
|
||||
<result column="account" property="childAccount" jdbcType="VARCHAR"/>
|
||||
<result column="password" property="childPassword" jdbcType="VARCHAR"/>
|
||||
<result column="phone" property="childPhone" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" resultMap="BaseResultMap" parameterType="long">
|
||||
select * from child where id = #{childId}
|
||||
</select>
|
||||
<select id="findByLongId" resultMap="BaseResultMap" parameterType="String">
|
||||
select * from child where longid = #{childLongId}
|
||||
</select>
|
||||
<select id="findByName" resultMap="BaseResultMap" parameterType="String">
|
||||
select * from child where name = #{childName}
|
||||
</select>
|
||||
|
||||
<select id="findAll" resultMap="BaseResultMap">
|
||||
select * from child
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="childId" parameterType="Child">
|
||||
insert into child(longid,name,sex,account,password,phone)
|
||||
values (#{childLongId},#{childName},#{childSex},#{childAccount},#{childPassword},#{childPhone})
|
||||
</insert>
|
||||
|
||||
<delete id="delete" parameterType="long">
|
||||
delete from child where id = #{childId}
|
||||
</delete>
|
||||
|
||||
<update id="update" parameterType="Child">
|
||||
update child
|
||||
set longid = #{childLongId},
|
||||
name = #{childName},
|
||||
sex = #{childSex},
|
||||
account = #{childAccount},
|
||||
password = #{childPassword},
|
||||
phone = #{childPhone}
|
||||
where id =#{childId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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="com.oldpeoplehome.dao.ChildParentDao">
|
||||
<resultMap id="ParentResultMap" type="com.oldpeoplehome.entity.Parent">
|
||||
<id column="id" property="parentId" jdbcType="BIGINT"/>
|
||||
<result column="longid" property="parentLongId" jdbcType="CHAR"/>
|
||||
<result column="name" property="parentName" jdbcType="VARCHAR"/>
|
||||
<result column="sex" property="parentSex" jdbcType="VARCHAR"/>
|
||||
<result column="account" property="parentAccount" jdbcType="VARCHAR"/>
|
||||
<result column="password" property="parentPassword" jdbcType="VARCHAR"/>
|
||||
<result column="height" property="parentHeight" jdbcType="DOUBLE"/>
|
||||
<result column="weight" property="parentWeight" jdbcType="DOUBLE"/>
|
||||
<result column="birth" property="parentBirth" jdbcType="DATE"/>
|
||||
<result column="phone" property="parentPhone" jdbcType="CHAR"/>
|
||||
<association property="child" javaType="Child">
|
||||
<id column="cid" property="childId" jdbcType="BIGINT"/>
|
||||
<result column="clongid" property="childLongId" jdbcType="CHAR"/>
|
||||
<result column="cname" property="childName" jdbcType="VARCHAR"/>
|
||||
<result column="csex" property="childSex" jdbcType="VARCHAR"/>
|
||||
<result column="caccount" property="childAccount" jdbcType="VARCHAR"/>
|
||||
<result column="cpassword" property="childPassword" jdbcType="VARCHAR"/>
|
||||
<result column="cphone" property="childPhone" jdbcType="VARCHAR"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
<resultMap id="ChildResultMap" type="com.oldpeoplehome.entity.Child">
|
||||
<id column="id" property="childId" jdbcType="BIGINT"/>
|
||||
<result column="longid" property="childLongId" jdbcType="CHAR"/>
|
||||
<result column="name" property="childName" jdbcType="VARCHAR"/>
|
||||
<result column="sex" property="childSex" jdbcType="VARCHAR"/>
|
||||
<result column="account" property="childAccount" jdbcType="VARCHAR"/>
|
||||
<result column="password" property="childPassword" jdbcType="VARCHAR"/>
|
||||
<result column="phone" property="childPhone" jdbcType="VARCHAR"/>
|
||||
<association property="parent" javaType="Parent">
|
||||
<id column="pid" property="parentId" jdbcType="BIGINT"/>
|
||||
<result column="plongid" property="parentLongId" jdbcType="CHAR"/>
|
||||
<result column="pname" property="parentName" jdbcType="VARCHAR"/>
|
||||
<result column="psex" property="parentSex" jdbcType="VARCHAR"/>
|
||||
<result column="paccount" property="parentAccount" jdbcType="VARCHAR"/>
|
||||
<result column="ppassword" property="parentPassword" jdbcType="VARCHAR"/>
|
||||
<result column="pheight" property="parentHeight" jdbcType="DOUBLE"/>
|
||||
<result column="pweight" property="parentWeight" jdbcType="DOUBLE"/>
|
||||
<result column="pbirth" property="parentBirth" jdbcType="DATE"/>
|
||||
<result column="pphone" property="parentPhone" jdbcType="CHAR"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
<select id="findByChild" resultMap="ParentResultMap" parameterType="long">
|
||||
select c.*, p.* from cp c left join parent p on c.pid = p.id where c.cid = #{childId}
|
||||
</select>
|
||||
<select id="findByParent" resultMap="ChildResultMap" parameterType="long">
|
||||
select c.*, p.* from cp c left join child p on c.pid = p.id where c.pid = #{parentId}
|
||||
</select>
|
||||
<insert id="insert" parameterType="ChildParent">
|
||||
insert into cp(pid, cid, relation)
|
||||
values (#{parentId}, #{childId}, #{relation})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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="com.oldpeoplehome.dao.HeartRateDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.HeartRate">
|
||||
<id column="pid" property="parentId" jdbcType="BIGINT"/>
|
||||
<result column="time" property="time" jdbcType="TIMESTAMP"/>
|
||||
<result column="rate" property="rate" jdbcType="DOUBLE"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByParent" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.HeartRateFilter">
|
||||
select *
|
||||
from heartrate where pid = #{parentId}
|
||||
</select>
|
||||
<select id="findByTime" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.HeartRateFilter">
|
||||
select *
|
||||
from heartrate where pid = #{parentId} and DATE_FORMAT(date,'%Y-%m-%d %T') between #{startDate} and #{endDate}
|
||||
</select>
|
||||
<select id="findByParentAndTime" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.HeartRateFilter">
|
||||
select h.*, p.* from heartrate h left join parent p on h.pid = p.id where h.pid = #{parentId} and h.date = #{startDate}
|
||||
</select>
|
||||
<insert id="insert" parameterType="HeartRate">
|
||||
insert into heartrate(pid, time, rate)
|
||||
values (#{parentId}, #{time}, #{rate})
|
||||
</insert>
|
||||
</mapper>
|
||||
30
server/OldPeopleHome/src/main/resources/mapper/MotionDao.xml
Normal file
30
server/OldPeopleHome/src/main/resources/mapper/MotionDao.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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="com.oldpeoplehome.dao.MotionDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.Motion">
|
||||
<id column="pid" property="motionParentId" jdbcType="BIGINT"/>
|
||||
<result column="date" property="motionDate" jdbcType="DATE"/>
|
||||
<result column="count" property="motionCount" jdbcType="BIGINT"/>
|
||||
<result column="distance" property="motionDistance" jdbcType="DOUBLE"/>
|
||||
<result column="time" property="motionTime" jdbcType="TIME"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByParentId" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.MotionFilter">
|
||||
select m.*
|
||||
from motion m where pid = #{motionParentId}
|
||||
</select>
|
||||
<select id="findByDate" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.MotionFilter">
|
||||
select *
|
||||
from motion where pid = #{motionParentId} and DATE_FORMAT(date,'%Y-%m-%d') between #{startDate} and #{endDate}
|
||||
</select>
|
||||
<select id="findByParentIdAndDate" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.MotionFilter">
|
||||
select m.*, p.* from motion m left join parent p on m.pid = p.id where m.pid = #{motionParentId} and m.date = #{startDate}
|
||||
</select>
|
||||
<insert id="insert" parameterType="Motion">
|
||||
insert into motion(pid, date, count, distance, time)
|
||||
values (#{motionParentId}, #{motionDate}, #{motionCount}, #{motionDistance}, #{motionTime})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -14,8 +14,7 @@
|
||||
<result column="weight" property="parentWeight" jdbcType="DOUBLE"/>
|
||||
<result column="birth" property="parentBirth" jdbcType="DATE"/>
|
||||
<result column="phone" property="parentPhone" jdbcType="CHAR"/>
|
||||
<result column="room" property="parentRoomId" jdbcType="INTEGER"/>
|
||||
<association property="parentRoom" column="room" javaType="Room">
|
||||
<association property="parentRoom" javaType="Room">
|
||||
<id column="rid" property="roomId" jdbcType="INTEGER"/>
|
||||
<result column="rlocation" property="roomLocation" jdbcType="VARCHAR"/>
|
||||
<result column="rname" property="roomName" jdbcType="VARCHAR"/>
|
||||
@@ -29,7 +28,7 @@
|
||||
select p.*,r.id rid,r.name rname, r.location rlocation from parent p left join room r on p.id=r.id where p.longid=#{parentLongId}
|
||||
</select>
|
||||
<select id="findByRoomId" parameterType="int" resultMap="BaseResultMap">
|
||||
select p.*,r.id rid,r.name rname, r.location rlocation from parent p left join room r on p.id=r.id where p.room=#{p.parentRoomId}
|
||||
select p.*,r.id rid,r.name rname, r.location rlocation from room r left join parent p on p.id=r.id where r.id=#{r.roomId}
|
||||
</select>
|
||||
<select id="findByName" parameterType="String" resultMap="BaseResultMap">
|
||||
select p.*,r.id rid,r.name rname, r.location rlocation from parent p left join room r on p.id=r.id where p.name=#{p.parentName}
|
||||
@@ -39,14 +38,14 @@
|
||||
select p.*,r.id rid,r.name rname, r.location rlocation from parent p left join room r on p.id=r.id
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="Parent" useGeneratedKeys="true" keyColumn="id" keyProperty="roomId">
|
||||
insert into parent(longid,name,sex,account,password,height,weight,birth,phone,room)
|
||||
values (#{parentLongId}, #{parentName}, #{parentSex}, #{parentAccount}, #{parentPassword}, #{parentHeight}, #{parentWeight}, #{parentBirth}, #{parentPhone}, #{parentRoomId})
|
||||
<insert id="insert" parameterType="Parent" useGeneratedKeys="true" keyColumn="id">
|
||||
insert into parent(longid,name,sex,account,password,height,weight,birth,phone)
|
||||
values (#{parentLongId}, #{parentName}, #{parentSex}, #{parentAccount}, #{parentPassword}, #{parentHeight}, #{parentWeight}, #{parentBirth}, #{parentPhone})
|
||||
</insert>
|
||||
|
||||
<update id="update" keyColumn="id">
|
||||
update parent
|
||||
set longid=#{parentLongId}, name=#{parentName}, sex=#{parentSex}, account=#{parentAccount}, password=#{parentPassword}, height=#{parentHeight}, weight=#{parentWeight}, birth=#{parentBirth}, phone=#{parentPhone}, room=#{parentRoomId}
|
||||
set longid=#{parentLongId}, name=#{parentName}, sex=#{parentSex}, account=#{parentAccount}, password=#{parentPassword}, height=#{parentHeight}, weight=#{parentWeight}, birth=#{parentBirth}, phone=#{parentPhone}
|
||||
where id=#{parentId}
|
||||
</update>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<id column="id" property="roomId" jdbcType="INTEGER"/>
|
||||
<result column="location" property="roomLocation" jdbcType="VARCHAR"/>
|
||||
<result column="name" property="roomName" jdbcType="VARCHAR"/>
|
||||
<result column="pid" property="parentId" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" resultMap="BaseResultMap" parameterType="int">
|
||||
@@ -18,6 +19,10 @@
|
||||
select * from room
|
||||
</select>
|
||||
|
||||
<select id="findEmptyRoom" resultMap="BaseResultMap">
|
||||
select * from room where pid is null
|
||||
</select>
|
||||
|
||||
<insert id="insertRoom" useGeneratedKeys="true" keyColumn="id" keyProperty="roomId" parameterType="Room">
|
||||
insert into room(location, name) values (#{roomLocation}, #{roomName})
|
||||
</insert>
|
||||
@@ -29,7 +34,8 @@
|
||||
<update id="updateRoom" parameterType="Room">
|
||||
update room
|
||||
set location = #{roomLocation},
|
||||
name = #{roomName}
|
||||
name = #{roomName},
|
||||
pid = #{parentId}
|
||||
where id =#{roomId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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="com.oldpeoplehome.dao.RoomStateDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.RoomState">
|
||||
<id column="rid" property="roomId" jdbcType="BIGINT"/>
|
||||
<result column="time" property="time" jdbcType="TIMESTAMP"/>
|
||||
<result column="temperature" property="temperature" jdbcType="DOUBLE"/>
|
||||
<result column="humidity" property="humidity" jdbcType="DOUBLE"/>
|
||||
<result column="isin" property="isin" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByRoom" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.RoomStateFilter">
|
||||
select *
|
||||
from rstate where rid = #{roomId}
|
||||
</select>
|
||||
<select id="findByTime" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.RoomStateFilter">
|
||||
select *
|
||||
from rstate where rid = #{roomId} and DATE_FORMAT(time,'%Y-%m-%d %H:%i:%s')between #{startDate} and #{endDate}
|
||||
</select>
|
||||
<select id="findByRoomAndTime" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.RoomStateFilter">
|
||||
select r.*, room.* from rstate r left join room on r.rid = room.id where r.rid = #{roomId} and r.time = #{startDate}
|
||||
</select>
|
||||
<insert id="insert" parameterType="RoomState">
|
||||
insert into rstate(rid, time, temperature, humidity, isin)
|
||||
values (#{roomId}, #{time}, #{temperature}, #{humidity}, #{isin})
|
||||
</insert>
|
||||
</mapper>
|
||||
30
server/OldPeopleHome/src/main/resources/mapper/SleepDao.xml
Normal file
30
server/OldPeopleHome/src/main/resources/mapper/SleepDao.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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="com.oldpeoplehome.dao.SleepDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.Sleep">
|
||||
<id column="pid" property="parentId" jdbcType="BIGINT"/>
|
||||
<result column="date" property="date" jdbcType="DATE"/>
|
||||
<result column="deep" property="lightTime" jdbcType="TIME"/>
|
||||
<result column="light" property="deepTime" jdbcType="TIME"/>
|
||||
<result column="awake" property="awakeTime" jdbcType="TIME"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByParentId" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.SleepFilter">
|
||||
select *
|
||||
from sleep where pid = #{parentId}
|
||||
</select>
|
||||
<select id="findByDate" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.SleepFilter">
|
||||
select *
|
||||
from sleep where pid = #{parentId} and DATE_FORMAT(date,'%Y-%m-%d') between #{startDate} and #{endDate}
|
||||
</select>
|
||||
<select id="findByParentIdAndDate" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.SleepFilter">
|
||||
select s.*, p.* from sleep s left join parent p on s.pid = p.id where s.pid = #{parentId} and s.date = #{startDate}
|
||||
</select>
|
||||
<insert id="insert" parameterType="Sleep">
|
||||
insert into sleep(pid, date, deep, light, awake)
|
||||
values (#{parentId}, #{date}, #{lightTime}, #{deepTime}, #{awakeTime})
|
||||
</insert>
|
||||
</mapper>
|
||||
94
server/OldPeopleHome/src/main/sql/add_table.sql
Normal file
94
server/OldPeopleHome/src/main/sql/add_table.sql
Normal file
@@ -0,0 +1,94 @@
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP TABLE IF EXISTS `child`;
|
||||
DROP TABLE IF EXISTS `cp`;
|
||||
DROP TABLE IF EXISTS `heartrate`;
|
||||
DROP TABLE IF EXISTS `motion`;
|
||||
DROP TABLE IF EXISTS `parent`;
|
||||
DROP TABLE IF EXISTS `room`;
|
||||
DROP TABLE IF EXISTS `rstate`;
|
||||
DROP TABLE IF EXISTS `sleep`;
|
||||
CREATE TABLE `parent` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '老人id',
|
||||
`longid` char(18) NOT NULL COMMENT '老人身份证',
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '姓名',
|
||||
`sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '性别',
|
||||
`account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '账号',
|
||||
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '密码',
|
||||
`height` double DEFAULT NULL COMMENT '身高',
|
||||
`weight` double DEFAULT NULL COMMENT '体重',
|
||||
`birth` date NOT NULL COMMENT '生日',
|
||||
`phone` char(11) DEFAULT NULL COMMENT '电话号码',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `index_longid` (`longid`) USING BTREE,
|
||||
KEY `index_name` (`name`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||
CREATE TABLE `room` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '房间id',
|
||||
`location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '房间位置',
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '房间名称(房间号)',
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT '房间住人id',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `index` (`pid`) USING BTREE,
|
||||
CONSTRAINT `room_fk_1` FOREIGN KEY (`pid`) REFERENCES `parent` (`id`) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE TABLE `child` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`longid` char(18) NOT NULL COMMENT '身份证',
|
||||
`name` varchar(255) NOT NULL COMMENT '姓名',
|
||||
`sex` varchar(255) NOT NULL COMMENT '性别',
|
||||
`account` varchar(255) NOT NULL COMMENT '账号',
|
||||
`password` varchar(255) NOT NULL COMMENT '密码',
|
||||
`phone` varchar(255) NOT NULL COMMENT '电话',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `index _longid` (`longid`) USING BTREE,
|
||||
KEY `index_name` (`name`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
CREATE TABLE `cp` (
|
||||
`pid` bigint(20) DEFAULT NULL,
|
||||
`cid` bigint(20) DEFAULT NULL,
|
||||
`relation` varchar(255) DEFAULT NULL,
|
||||
KEY `index_pid` (`pid`) USING BTREE,
|
||||
KEY `index_cid` (`cid`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
CREATE TABLE `heartrate` (
|
||||
`pid` bigint(20) DEFAULT NULL,
|
||||
`time` datetime DEFAULT NULL,
|
||||
`rate` double DEFAULT NULL,
|
||||
KEY `index_pid` (`pid`) USING BTREE,
|
||||
KEY `time` (`time`) USING BTREE,
|
||||
CONSTRAINT `fk_pid2` FOREIGN KEY (`pid`) REFERENCES `parent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
CREATE TABLE `motion` (
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT 'parent id',
|
||||
`date` date DEFAULT NULL COMMENT '当日日期',
|
||||
`count` bigint(20) DEFAULT NULL COMMENT '步数',
|
||||
`distance` double DEFAULT NULL COMMENT '距离',
|
||||
`time` time DEFAULT NULL COMMENT '运动时长',
|
||||
KEY `index_date` (`date`) USING BTREE,
|
||||
KEY `index_pid` (`pid`) USING BTREE,
|
||||
CONSTRAINT `fk_pid` FOREIGN KEY (`pid`) REFERENCES `parent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
CREATE TABLE `rstate` (
|
||||
`rid` int(11) DEFAULT NULL,
|
||||
`time` timestamp NULL DEFAULT NULL,
|
||||
`temperature` double DEFAULT NULL,
|
||||
`humidity` double DEFAULT NULL,
|
||||
`isin` int(11) DEFAULT NULL,
|
||||
KEY `index_rid` (`rid`) USING BTREE,
|
||||
KEY `index_time` (`time`) USING BTREE,
|
||||
CONSTRAINT `fk_rid1` FOREIGN KEY (`rid`) REFERENCES `room` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
CREATE TABLE `sleep` (
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT 'parent id',
|
||||
`date` date DEFAULT NULL COMMENT '当天日期',
|
||||
`deep` time DEFAULT NULL COMMENT '深睡时长',
|
||||
`light` time DEFAULT NULL COMMENT '浅睡时长',
|
||||
`awake` time DEFAULT NULL COMMENT '清醒时长',
|
||||
KEY `index_date` (`date`) USING BTREE,
|
||||
KEY `index_pid` (`pid`) USING BTREE,
|
||||
KEY `index_pid_date` (`pid`,`date`) USING BTREE,
|
||||
CONSTRAINT `fk_pid1` FOREIGN KEY (`pid`) REFERENCES `parent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.BaseTest;
|
||||
import com.oldpeoplehome.entity.Child;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 10:57
|
||||
* Description:
|
||||
*/
|
||||
public class ChildDaoTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
private ChildDao childDao;
|
||||
|
||||
@Test
|
||||
public void testInsert(){
|
||||
Child child = new Child("519404401440404404", "鲍欠日", "女", "bao", "123", "12345678900");
|
||||
childDao.insert(child);
|
||||
}
|
||||
@Test
|
||||
public void testFInd(){
|
||||
System.out.println("name:"+ childDao.findAll());
|
||||
System.out.println("id"+childDao.findById(1));
|
||||
System.out.println("name"+childDao.findByName("鲍欠月"));
|
||||
System.out.println("longid"+childDao.findByLongId("519404400440404404"));
|
||||
}
|
||||
@Test
|
||||
public void testUpdate(){
|
||||
Child child = childDao.findById(1);
|
||||
child.setChildPhone("1020");
|
||||
childDao.update(child);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDelete(){
|
||||
childDao.delete(2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.BaseTest;
|
||||
import com.oldpeoplehome.entity.ChildParent;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 14:33
|
||||
* Description:
|
||||
*/
|
||||
public class ChildParentDaoTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
private ChildParentDao childParentDao;
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
System.out.println(childParentDao.findByChild(1));
|
||||
System.out.println(childParentDao.findByParent(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsert(){
|
||||
ChildParent childParent = new ChildParent(3,2,"养子");
|
||||
childParentDao.insert(childParent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.BaseTest;
|
||||
import com.oldpeoplehome.dto.MotionFilter;
|
||||
import com.oldpeoplehome.entity.Motion;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 17:30
|
||||
* Description:
|
||||
*/
|
||||
public class MotionDaoTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
private MotionDao motionDao;
|
||||
@Test
|
||||
public void test(){
|
||||
MotionFilter motionFilter = new MotionFilter(1);
|
||||
|
||||
// System.out.println(motionDao.findByParentId(motionFilter));
|
||||
// motionFilter = new MotionFilter(Date.valueOf("2019-8-21"), 1);
|
||||
// System.out.println(motionDao.findByParentIdAndDate(motionFilter));
|
||||
motionFilter = new MotionFilter( Date.valueOf("2019-8-21"), Date.valueOf("2019-8-23"), 1);
|
||||
System.out.println(motionDao.findByDate(motionFilter));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsert(){
|
||||
Motion motion = new Motion(2, "2019-2-2", 1239, 11, "1:1:1");
|
||||
motionDao.insert(motion);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.oldpeoplehome.dao;
|
||||
|
||||
import com.oldpeoplehome.BaseTest;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
import com.oldpeoplehome.entity.Room;
|
||||
import com.oldpeoplehome.utils.StringUtil;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,6 +20,8 @@ import java.util.Map;
|
||||
public class ParentDaoTest extends BaseTest {
|
||||
@Autowired
|
||||
private ParentDao parentDao;
|
||||
@Autowired
|
||||
private RoomDao roomDao;
|
||||
|
||||
@Test
|
||||
public void testFindById(){
|
||||
@@ -43,17 +46,21 @@ public class ParentDaoTest extends BaseTest {
|
||||
@Test
|
||||
public void testInsert(){
|
||||
Parent parent = new Parent();
|
||||
parent.setParentLongId("510703199701230019");
|
||||
parent.setParentBirth(Date.valueOf("1993-4-5"));
|
||||
parent.setParentName("丁丁娃");
|
||||
parent.setParentAccount("ding");
|
||||
parent.setParentHeight(1232.1);
|
||||
parent.setParentWeight(1312.1);
|
||||
parent.setParentLongId("510703199701213123");
|
||||
parent.setParentBirth(Date.valueOf("1927-4-5"));
|
||||
parent.setParentName("当当娃");
|
||||
parent.setParentAccount("dang");
|
||||
parent.setParentHeight(12.1);
|
||||
parent.setParentWeight(3112.1);
|
||||
parent.setParentPassword("123");
|
||||
parent.setParentRoomId(17);
|
||||
parent.setParentSex("女");
|
||||
parent.setParentPhone("12312312312");
|
||||
Room room = roomDao.findById(1);
|
||||
System.out.println(room);
|
||||
parentDao.insert(parent);
|
||||
parent = parentDao.findByLongId(parent.getParentLongId());
|
||||
room.setParentId(parent.getParentId());
|
||||
roomDao.updateRoom(room);
|
||||
System.out.println(parent);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -63,12 +64,19 @@ public class RoomDaoTest extends BaseTest {
|
||||
System.out.println(room);
|
||||
roomDao.updateRoom(room);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindEmpty(){
|
||||
System.out.println(roomDao.findEmptyRoom());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testA(){
|
||||
Parent parent = new Parent();
|
||||
System.out.println(parent.getClass());
|
||||
Object obj = parent;
|
||||
System.out.println(obj.getClass());
|
||||
System.out.println(Timestamp.valueOf("2018-2-2 1:1:1"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.BaseTest;
|
||||
import com.oldpeoplehome.dto.HeartRateFilter;
|
||||
import com.oldpeoplehome.entity.HeartRate;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/23 13:34
|
||||
* Description:
|
||||
*/
|
||||
public class HeartRateServiceTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
private HeartRateService heartRateService;
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
// HeartRate heartRate = new HeartRate(1, "2019-8-22 10:00:00", 20.3);
|
||||
// heartRateService.insert(heartRate);
|
||||
HeartRateFilter heartRateFilter = new HeartRateFilter(1);
|
||||
System.out.println(heartRateService.findByParent(heartRateFilter));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.oldpeoplehome.service;
|
||||
|
||||
import com.oldpeoplehome.BaseTest;
|
||||
import com.oldpeoplehome.entity.Parent;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Created By Jiangyuwei on 2019/8/21 12:10
|
||||
* Description:
|
||||
*/
|
||||
public class ParentServiceTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
private ParentService parentService;
|
||||
|
||||
@Test
|
||||
public void testFind(){
|
||||
System.out.println(parentService.findByID(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsert(){
|
||||
Parent parent = new Parent();
|
||||
parent.setParentSex("a");
|
||||
parent.setParentPassword("a");
|
||||
parent.setParentAccount("a");
|
||||
parent.setParentName("a");
|
||||
parent.setParentBirth("2011-2-2");
|
||||
parent.setParentLongId("a");
|
||||
parentService.insert(parent);
|
||||
System.out.println(parentService.findByLongId("a"));
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user