You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
5.0 KiB

6 months ago
<?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="yq.system.mapper.MineHealthMapper">
6 months ago
<resultMap type="mineHealthVo" id="MineHealthResult">
6 months ago
<result property="id" column="id" />
<result property="bpHigh" column="bp_high" />
<result property="bpLow" column="bp_low" />
<result property="br" column="br" />
<result property="hr" column="hr" />
<result property="hrv" column="hrv" />
<result property="temperature" column="temperature" />
<result property="isWork" column="is_work" />
<result property="createTime" column="create_time" />
<result property="mineGroupName" column="mine_group_name" />
<result property="faceName" column="face_name" />
6 months ago
<result property="facePhone" column="face_phone" />
<result property="age" column="age" />
6 months ago
</resultMap>
<sql id="selectMineHealthVo">
SELECT
mh.id,
mh.bp_high,
mh.bp_low,
mh.br,
mh.hr,
mh.hrv,
mh.temperature,
mh.is_work,
mh.create_time,
mf.face_name,
6 months ago
mf.face_phone ,
mf.age ,
6 months ago
mg.mine_group_name
FROM
mine_health mh
INNER JOIN mine_face mf
on mf.id =mh.face_id
INNER JOIN mine_group mg
on mg.id =mf.group_id
</sql>
6 months ago
<select id="selectMineHealthList" parameterType="mineHealthVo" resultMap="MineHealthResult">
6 months ago
<include refid="selectMineHealthVo"/>
<where>
<if test="mineGroupName != null and mineGroupName != ''"> and mg.mine_group_name like concat('%', #{mineGroupName}, '%')</if>
<if test="faceName != null and faceName != ''"> and mf.face_name like concat('%', #{faceName}, '%')</if>
<if test="bpHigh != null "> and mh.bp_high = #{bpHigh}</if>
<if test="bpLow != null "> and mh.bp_low = #{bpLow}</if>
<if test="br != null "> and mh.br = #{br}</if>
<if test="hr != null "> and mh.hr = #{hr}</if>
<if test="hrv != null "> and mh.hrv = #{hrv}</if>
<if test="temperature != null and temperature != ''"> and mh.temperature = #{temperature}</if>
<if test="isWork != null "> and mf.is_work = #{isWork}</if>
</where>
</select>
<select id="selectMineHealthById" parameterType="Long" resultMap="MineHealthResult">
<include refid="selectMineHealthVo"/>
where mh.id = #{id}
</select>
<insert id="insertMineHealth" parameterType="MineHealth" useGeneratedKeys="true" keyProperty="id">
insert into mine_health
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bpHigh != null">bp_high,</if>
<if test="bpLow != null">bp_low,</if>
<if test="br != null">br,</if>
<if test="hr != null">hr,</if>
<if test="faceId != null">face_id,</if>
<if test="hrv != null">hrv,</if>
<if test="temperature != null">temperature,</if>
<if test="isWork != null">is_work,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bpHigh != null">#{bpHigh},</if>
<if test="faceId != null">face_id,</if>
<if test="bpLow != null">#{bpLow},</if>
<if test="br != null">#{br},</if>
<if test="hr != null">#{hr},</if>
<if test="hrv != null">#{hrv},</if>
<if test="temperature != null">#{temperature},</if>
<if test="isWork != null">#{isWork},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateMineHealth" parameterType="MineHealth">
update mine_health
<trim prefix="SET" suffixOverrides=",">
<if test="faceId != null">face_id=#{faceId}</if>
<if test="bpHigh != null">bp_high = #{bpHigh},</if>
<if test="bpLow != null">bp_low = #{bpLow},</if>
<if test="br != null">br = #{br},</if>
<if test="hr != null">hr = #{hr},</if>
<if test="hrv != null">hrv = #{hrv},</if>
<if test="temperature != null">temperature = #{temperature},</if>
<if test="isWork != null">is_work = #{isWork},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMineHealthById" parameterType="Long">
delete from mine_health where id = #{id}
</delete>
<delete id="deleteMineHealthByIds" parameterType="String">
delete from mine_health where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>