225 lines
13 KiB
XML
225 lines
13 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.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper">
|
|
|
|
<resultMap type="SysCustomerPhysicalSigns" id="SysCustomerSignResult">
|
|
<result property="id" column="id" />
|
|
<result property="customerId" column="customer_id" />
|
|
<!-- 非持久化字段 -->
|
|
<result property="name" column="name"/>
|
|
<!-- 非持久化字段 -->
|
|
<result property="phone" column="phone" />
|
|
<result property="sex" column="sex" />
|
|
<result property="age" column="age" />
|
|
<result property="tall" column="tall" />
|
|
<result property="weight" column="weight" />
|
|
<result property="physicalSignsId" column="physical_signs_id" />
|
|
<result property="dishesIngredientId" column="dishes_ingredient_id" />
|
|
<result property="photo" column="photo" />
|
|
<result property="constipation" column="constipation" />
|
|
<result property="staylate" column="stayLate" />
|
|
<result property="motion" column="motion" />
|
|
<result property="makeFoodType" column="make_food_type" />
|
|
<result property="makeFoodTaste" column="make_food_taste" />
|
|
<result property="walk" column="walk" />
|
|
<result property="difficulty" column="difficulty" />
|
|
<result property="weakness" column="weakness" />
|
|
<result property="rebound" column="rebound" />
|
|
<result property="crux" column="crux" />
|
|
<result property="position" column="position" />
|
|
<result property="sleepTime" column="sleep_time" />
|
|
<result property="getupTime" column="getup_time" />
|
|
<result property="connectTime" column="connect_time" />
|
|
<result property="remarks" column="remarks" />
|
|
<result property="remark" column="remark" />
|
|
<result property="bloodData" column="blood_data" />
|
|
<result property="moistureDate" column="moisture_date" />
|
|
<result property="vocation" column="vocation" />
|
|
<result property="night" column="night" />
|
|
<result property="experience" column="experience" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="comments" column="comments"/>
|
|
<result property="avoidFood" column="avoid_food" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler" />
|
|
<!-- column是传的参数, select是调用的查询 -->
|
|
<association property="signList" column="physical_signs_id" select="getSignByIds"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectSysCustomerPhysicalSigns">
|
|
select scps.id,scps.customer_id,scps.sex, scps.age, scps.tall, scps.weight, scps.physical_signs_id, scps.dishes_ingredient_id, scps.photo, scps.constipation,
|
|
scps.stayLate, scps.motion, scps.make_food_type, scps.make_food_taste, scps.walk, scps.difficulty, scps.weakness, scps.rebound, scps.crux, scps.position,
|
|
scps.sleep_time, scps.getup_time, scps.connect_time, scps.remarks, scps.remark, scps.avoid_food, scps.blood_data, scps.moisture_date, scps.vocation,
|
|
scps.night, scps.experience, scps.comments, scps.create_time, sc.name, sc.phone
|
|
from sys_customer_physical_signs scps
|
|
left join sys_customer sc on scps.customer_id = sc.id
|
|
</sql>
|
|
|
|
<select id="selectSysCustomerAndSignList" parameterType="SysCustomerPhysicalSigns" resultMap="SysCustomerSignResult">
|
|
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0
|
|
<if test="name != null and name != ''"> and sc.name like concat('%', #{name}, '%')</if>
|
|
<if test="phone != null and phone != ''"> and sc.phone like concat('%', #{phone}, '%')</if>
|
|
order by scps.create_time desc
|
|
</select>
|
|
|
|
<select id="selectSysCustomerPhysicalSignsById" parameterType="Long" resultMap="SysCustomerSignResult">
|
|
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id}
|
|
</select>
|
|
|
|
<!-- 根据客户ID查询用户体征 -->
|
|
<select id="selectSysCustomerPhysicalSignsByCusId" parameterType="Long" resultMap="SysCustomerSignResult">
|
|
<include refid="selectSysCustomerPhysicalSigns"/>
|
|
where scps.del_flag = 0 and sc.del_flag = 0 and scps.customer_id = #{id}
|
|
order by scps.id desc limit 1
|
|
</select>
|
|
|
|
<insert id="insertSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns" useGeneratedKeys="true" keyProperty="id">
|
|
insert into sys_customer_physical_signs
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="customerId != null">customer_id,</if>
|
|
<if test="sex != null">sex,</if>
|
|
<if test="age != null">age,</if>
|
|
<if test="tall != null">tall,</if>
|
|
<if test="weight != null">weight,</if>
|
|
<if test="physicalSignsId != null">physical_signs_id,</if>
|
|
<if test="dishesIngredientId != null">dishes_ingredient_id,</if>
|
|
<if test="photo != null">photo,</if>
|
|
<if test="constipation != null">constipation,</if>
|
|
<if test="staylate != null">stayLate,</if>
|
|
<if test="motion != null">motion,</if>
|
|
<if test="makeFoodType != null">make_food_type,</if>
|
|
<if test="makeFoodTaste != null">make_food_taste,</if>
|
|
<if test="walk != null">walk,</if>
|
|
<if test="difficulty != null">difficulty,</if>
|
|
<if test="weakness != null">weakness,</if>
|
|
<if test="rebound != null">rebound,</if>
|
|
<if test="crux != null">crux,</if>
|
|
<if test="position != null">position,</if>
|
|
<if test="sleepTime != null">sleep_time,</if>
|
|
<if test="getupTime != null">getup_time,</if>
|
|
<if test="connectTime != null">connect_time,</if>
|
|
<if test="remarks != null">remarks,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="bloodData != null">blood_data,</if>
|
|
<if test="moistureDate != null">moisture_date,</if>
|
|
<if test="vocation != null">vocation,</if>
|
|
<if test="night != null">night,</if>
|
|
<if test="experience != null">experience,</if>
|
|
<if test="comments != null">comments,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="avoidFood != null">avoid_food,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="customerId != null">#{customerId},</if>
|
|
<if test="sex != null">#{sex},</if>
|
|
<if test="age != null">#{age},</if>
|
|
<if test="tall != null">#{tall},</if>
|
|
<if test="weight != null">#{weight},</if>
|
|
<if test="physicalSignsId != null">#{physicalSignsId},</if>
|
|
<if test="dishesIngredientId != null">#{dishesIngredientId},</if>
|
|
<if test="photo != null">#{photo},</if>
|
|
<if test="constipation != null">#{constipation},</if>
|
|
<if test="staylate != null">#{staylate},</if>
|
|
<if test="motion != null">#{motion},</if>
|
|
<if test="makeFoodType != null">#{makeFoodType},</if>
|
|
<if test="makeFoodTaste != null">#{makeFoodTaste},</if>
|
|
<if test="walk != null">#{walk},</if>
|
|
<if test="difficulty != null">#{difficulty},</if>
|
|
<if test="weakness != null">#{weakness},</if>
|
|
<if test="rebound != null">#{rebound},</if>
|
|
<if test="crux != null">#{crux},</if>
|
|
<if test="position != null">#{position},</if>
|
|
<if test="sleepTime != null">#{sleepTime},</if>
|
|
<if test="getupTime != null">#{getupTime},</if>
|
|
<if test="connectTime != null">#{connectTime},</if>
|
|
<if test="remarks != null">#{remarks},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="bloodData != null">#{bloodData},</if>
|
|
<if test="moistureDate != null">#{moistureDate},</if>
|
|
<if test="vocation != null">#{vocation},</if>
|
|
<if test="night != null">#{night},</if>
|
|
<if test="experience != null">#{experience},</if>
|
|
<if test="comments != null">#{comments},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="avoidFood != null">#{avoid_food, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns">
|
|
update sys_customer_physical_signs
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="customerId != null">customer_id = #{customerId},</if>
|
|
<if test="sex != null">sex = #{sex},</if>
|
|
<if test="age != null">age = #{age},</if>
|
|
<if test="tall != null">tall = #{tall},</if>
|
|
<if test="weight != null">weight = #{weight},</if>
|
|
<if test="physicalSignsId != null">physical_signs_id = #{physicalSignsId},</if>
|
|
<if test="dishesIngredientId != null">dishes_ingredient_id = #{dishesIngredientId},</if>
|
|
<if test="photo != null">photo = #{photo},</if>
|
|
<if test="constipation != null">constipation = #{constipation},</if>
|
|
<if test="staylate != null">stayLate = #{staylate},</if>
|
|
<if test="motion != null">motion = #{motion},</if>
|
|
<if test="makeFoodType != null">make_food_type = #{makeFoodType},</if>
|
|
<if test="makeFoodTaste != null">make_food_taste = #{makeFoodTaste},</if>
|
|
<if test="walk != null">walk = #{walk},</if>
|
|
<if test="difficulty != null">difficulty = #{difficulty},</if>
|
|
<if test="weakness != null">weakness = #{weakness},</if>
|
|
<if test="rebound != null">rebound = #{rebound},</if>
|
|
<if test="crux != null">crux = #{crux},</if>
|
|
<if test="position != null">position = #{position},</if>
|
|
<if test="sleepTime != null">sleep_time = #{sleepTime},</if>
|
|
<if test="getupTime != null">getup_time = #{getupTime},</if>
|
|
<if test="connectTime != null">connect_time = #{connectTime},</if>
|
|
<if test="remarks != null">remarks = #{remarks},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="bloodData != null">blood_data = #{bloodData},</if>
|
|
<if test="moistureDate != null">moisture_date = #{moistureDate},</if>
|
|
<if test="vocation != null">vocation = #{vocation},</if>
|
|
<if test="night != null">night = #{night},</if>
|
|
<if test="experience != null">experience = #{experience},</if>
|
|
<if test="comments != null">comments = #{comments},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="avoidFood != null">avoid_food = #{avoidFood, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteSysCustomerPhysicalSignsById" parameterType="Long">
|
|
update sys_customer_physical_signs set del_flag = 1 where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteSysCustomerPhysicalSignsByIds" parameterType="String">
|
|
update sys_customer_physical_signs set del_flag = 1 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 根据体征id获取体征 -->
|
|
<select id="getSignByIds" parameterType="String" resultType="SysPhysicalSigns">
|
|
select * from sys_physical_signs sps where FIND_IN_SET(id, #{physical_signs_id})
|
|
</select>
|
|
|
|
<!-- 根据手机号查询体征 -->
|
|
<select id="selectSysCustomerAndSignByPhone" parameterType="String" resultMap="SysCustomerSignResult">
|
|
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1
|
|
</select>
|
|
|
|
<!-- 根据客户ID删除对应体征信息 -->
|
|
<update id="delCustomerSignByCustomerId" parameterType="Long">
|
|
update sys_customer_physical_signs set del_flag = 1 where customer_id = #{customerId}
|
|
</update>
|
|
|
|
</mapper> |