Update README.md
This commit is contained in:
2
server/OldPeopleHome/.idea/workspace.xml
generated
2
server/OldPeopleHome/.idea/workspace.xml
generated
@@ -371,7 +371,7 @@
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1567826803643" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1567827241992" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
|
||||
@@ -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.url=jdbc:mysql://localhost:3306/oldpeople?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
|
||||
jdbc.username=root
|
||||
jdbc.password=root
|
||||
|
||||
BIN
server/OldPeopleHome/target/OldPeopleHome.war
Normal file
BIN
server/OldPeopleHome/target/OldPeopleHome.war
Normal file
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
Manifest-Version: 1.0
|
||||
Built-By: Jiangyuwei
|
||||
Created-By: IntelliJ IDEA
|
||||
Build-Jdk: 1.8.0_161
|
||||
|
||||
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.
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.
@@ -0,0 +1,4 @@
|
||||
jdbc.driver=com.mysql.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://localhost:3306/oldpeople?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
|
||||
jdbc.username=root
|
||||
jdbc.password=root
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="true">
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are by default assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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.AdminDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.Admin">
|
||||
<result column="account" property="adminAccount" jdbcType="VARCHAR"/>
|
||||
<result column="password" property="adminPassword" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByAccount" resultMap="BaseResultMap" parameterType="String">
|
||||
select * from admin where account=#{account}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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="findByAccount" parameterType="String" resultMap="BaseResultMap">
|
||||
select * from child where account = #{childAccount}
|
||||
</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,31 @@
|
||||
<?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"/>
|
||||
<result column="rate1" property="rate1" jdbcType="DOUBLE"/>
|
||||
<result column="rate2" property="rate2" jdbcType="DOUBLE"/>
|
||||
<result column="oxy" property="oxy" 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, rate1,rate2,oxy)
|
||||
values (#{parentId}, #{time},#{rate}, #{rate1}, #{rate2}, #{oxy})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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.LocationDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.Location">
|
||||
<id column="pid" property="parentId" jdbcType="BIGINT"/>
|
||||
<result column="longitude" property="longitude" jdbcType="BIGINT"/>
|
||||
<result column="latitude" property="latitude" jdbcType="BIGINT"/>
|
||||
<result column="time" property="time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByParent" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.LocationFilter">
|
||||
select *
|
||||
from location where pid = #{parentId}
|
||||
</select>
|
||||
<select id="findByTime" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.LocationFilter">
|
||||
select *
|
||||
from location where pid = #{parentId} and DATE_FORMAT(time,'%Y-%m-%d %T') between #{startTime} and #{endTime}
|
||||
</select>
|
||||
<select id="findByParentAndTime" resultMap="BaseResultMap" parameterType="com.oldpeoplehome.dto.LocationFilter">
|
||||
select l.*, p.* from location l left join parent p on l.pid = p.id where l.pid = #{parentId} and l.date = #{startTime}
|
||||
</select>
|
||||
<insert id="insert" parameterType="Location">
|
||||
insert into location(pid, longitude,latitude, time)
|
||||
values (#{parentId}, #{longitude},#{latitude}, #{time})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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="energy" property="motionEnergy" 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, energy, time)
|
||||
values (#{motionParentId}, #{motionDate}, #{motionCount}, #{motionDistance}, #{motionEnergy}, #{motionTime})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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.ParentDao">
|
||||
<resultMap id="BaseResultMap" 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="parentRoom" javaType="Room">
|
||||
<id column="rid" property="roomId" jdbcType="INTEGER"/>
|
||||
<result column="rlocation" property="roomLocation" jdbcType="VARCHAR"/>
|
||||
<result column="rname" property="roomName" jdbcType="VARCHAR"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByID" parameterType="long" 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.id=#{parentId}
|
||||
</select>
|
||||
<select id="findByLongId" 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.longid=#{parentLongId}
|
||||
</select>
|
||||
<select id="findByRoomId" parameterType="int" resultMap="BaseResultMap">
|
||||
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}
|
||||
</select>
|
||||
<select id="findByAccount" 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.account=#{p.parentAccount}
|
||||
</select>
|
||||
|
||||
<select id="findAll" 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
|
||||
</select>
|
||||
|
||||
<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}
|
||||
where id=#{parentId}
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="long">
|
||||
delete from parent where id=#{parentId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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.RoomDao">
|
||||
<resultMap id="BaseResultMap" type="com.oldpeoplehome.entity.Room">
|
||||
<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"/>
|
||||
<result column="temp" property="temp" jdbcType="FLOAT"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" resultMap="BaseResultMap" parameterType="int">
|
||||
select * from room where id = #{roomId}
|
||||
</select>
|
||||
|
||||
<select id="findAll" resultMap="BaseResultMap">
|
||||
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>
|
||||
|
||||
<delete id="deleteRoom" parameterType="int">
|
||||
delete from room where id = #{roomId}
|
||||
</delete>
|
||||
|
||||
<update id="updateRoom" parameterType="Room">
|
||||
update room
|
||||
set location = #{roomLocation},
|
||||
name = #{roomName},
|
||||
pid = #{parentId},
|
||||
temp = #{temp}
|
||||
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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 配置全局属性 -->
|
||||
<settings>
|
||||
<!-- 使用jdbc的getGeneratedKeys获取数据库自增主键值 -->
|
||||
<setting name="useGeneratedKeys" value="true" />
|
||||
|
||||
<!-- 使用列别名替换列名 默认:true -->
|
||||
<setting name="useColumnLabel" value="true" />
|
||||
|
||||
<!-- 开启驼峰命名转换:Table{create_time} -> Entity{createTime} -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true" />
|
||||
</settings>
|
||||
</configuration>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
<!--配置数据库相关参数 -->
|
||||
<context:property-placeholder location="classpath:jdbc.properties"/>
|
||||
<!-- 2.数据库连接池 -->
|
||||
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
|
||||
<!-- 配置连接池属性 -->
|
||||
<property name="driverClass" value="${jdbc.driver}"/>
|
||||
<property name="jdbcUrl" value="${jdbc.url}"/>
|
||||
<property name="user" value="${jdbc.username}"/>
|
||||
<property name="password" value="${jdbc.password}"/>
|
||||
|
||||
<!-- c3p0连接池的私有属性 -->
|
||||
<property name="maxPoolSize" value="30"/>
|
||||
<property name="minPoolSize" value="10"/>
|
||||
<!-- 关闭连接后不自动commit -->
|
||||
<property name="autoCommitOnClose" value="false"/>
|
||||
<!-- 获取连接超时时间 -->
|
||||
<property name="checkoutTimeout" value="10000"/>
|
||||
<!-- 当获取连接失败重试次数 -->
|
||||
<property name="acquireRetryAttempts" value="2"/>
|
||||
</bean>
|
||||
|
||||
<!-- 3.配置SqlSessionFactory对象 -->
|
||||
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<!-- 注入数据库连接池 -->
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
<!-- 配置MyBaties全局配置文件:mybatis-config.xml -->
|
||||
<property name="configLocation" value="classpath:mybatis-config.xml"/>
|
||||
<!-- 扫描entity包 使用别名 -->
|
||||
<property name="typeAliasesPackage" value="com.oldpeoplehome.entity"/>
|
||||
<!-- 扫描sql配置文件:mapper需要的xml文件 -->
|
||||
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
|
||||
</bean>
|
||||
|
||||
<!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到spring容器中 -->
|
||||
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||
<!-- 注入sqlSessionFactory -->
|
||||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
|
||||
<!-- 给出需要扫描Dao接口包 -->
|
||||
<property name="basePackage" value="com.oldpeoplehome.dao"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<!-- 扫描service包下所有使用注解的类型 -->
|
||||
<context:component-scan base-package="com.oldpeoplehome.service" />
|
||||
|
||||
<!-- 配置事务管理器 -->
|
||||
<bean id="transactionManager"
|
||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<!-- 注入数据库连接池 -->
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
<!-- 配置基于注解的声明式事务 -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<!-- 配置SpringMVC -->
|
||||
<!-- 1.开启SpringMVC注解模式 -->
|
||||
<!-- 简化配置:
|
||||
(1)自动注册DefaultAnootationHandlerMapping,AnotationMethodHandlerAdapter
|
||||
(2)提供一些列:数据绑定,数字和日期的format @NumberFormat, @DateTimeFormat, xml,json默认读写支持
|
||||
-->
|
||||
<mvc:annotation-driven />
|
||||
<!-- 2.静态资源默认servlet配置
|
||||
(1)加入对静态资源的处理:js,gif,png
|
||||
(2)允许使用"/"做整体映射
|
||||
-->
|
||||
<mvc:default-servlet-handler/>
|
||||
|
||||
<!-- 3.配置jsp 显示ViewResolver -->
|
||||
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
|
||||
<property name="prefix" value="/WEB-INF/jsp/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
|
||||
<!-- 4.扫描web相关的bean -->
|
||||
<context:component-scan base-package="com.oldpeoplehome.web" />
|
||||
<context:component-scan base-package="com.oldpeoplehome">
|
||||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
||||
</context:component-scan>
|
||||
</beans>
|
||||
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