Files
intc-cloud/intc-modules/intc-health/src/main/resources/mapper/health/HealthPersonMapper.xml
2026-06-20 22:06:25 +08:00

135 lines
6.7 KiB
XML

<?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.intc.health.mapper.HealthPersonMapper">
<resultMap type="HealthPersonVo" id="HealthPersonResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="remark" column="remark" />
<result property="birthday" column="birthday" />
<result property="nickName" column="nick_name" />
<result property="height" column="height" />
<result property="weight" column="weight" />
<result property="ranking" column="ranking" />
<result property="sex" column="sex" />
<result property="identityCard" column="identity_card" />
<result property="phone" column="phone" />
</resultMap>
<sql id="selectHealthPersonVo">
select a.id, a.name, a.sex, a.identity_card, a.phone, a.type, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.remark, a.birthday, a.nick_name, a.height, a.weight, a.ranking from health_person a
</sql>
<select id="selectHealthPersonList" parameterType="HealthPersonDto" resultMap="HealthPersonResult">
<include refid="selectHealthPersonVo"/>
<where>
a.del_flag='0'
<if test="name != null and name != ''"> and a.name like '%'|| #{name}||'%'</if>
<if test="type != null and type != ''"> and a.type = #{type}</if>
<if test="nickName != null and nickName != ''"> and a.nick_name like '%'|| #{nickName}||'%'</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by a.ranking asc
</select>
<select id="selectHealthPersonById" parameterType="Long" resultMap="HealthPersonResult">
<include refid="selectHealthPersonVo"/>
where a.id = #{id} and a.del_flag = '0'
</select>
<insert id="insertHealthPerson" parameterType="HealthPerson">
insert into health_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="type != null and type != ''">type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
<if test="remark != null">remark,</if>
<if test="birthday != null">birthday,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="height != null">height,</if>
<if test="weight != null">weight,</if>
<if test="ranking != null">ranking,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="identityCard != null and identityCard != ''">identity_card,</if>
<if test="phone != null and phone != ''">phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="birthday != null">#{birthday},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="height != null">#{height},</if>
<if test="weight != null">#{weight},</if>
<if test="ranking != null">#{ranking},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="identityCard != null and identityCard != ''">#{identityCard},</if>
<if test="phone != null and phone != ''">#{phone},</if>
</trim>
</insert>
<update id="updateHealthPerson" parameterType="HealthPerson">
update health_person
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="height != null">height = #{height},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="ranking != null">ranking = #{ranking},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="identityCard != null and identityCard != ''">identity_card = #{identityCard},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteHealthPersonById" parameterType="Long">
delete from health_person where id = #{id}
</delete>
<delete id="deleteHealthPersonByIds" parameterType="String">
delete from health_person where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="removeHealthPersonById" parameterType="Long">
update health_person set del_flag='1' where id = #{id}
</update>
<update id="removeHealthPersonByIds" parameterType="String">
update health_person set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>