FsHealthSurfaceMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.his.mapper.FsHealthSurfaceMapper">
  6. <resultMap type="FsHealthSurface" id="FsHealthSurfaceResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="name" column="name" />
  10. <result property="sex" column="sex" />
  11. <result property="age" column="age" />
  12. <result property="status" column="status" />
  13. <result property="surfaceUrl" column="surface_url" />
  14. <result property="complexionResult" column="complexion_result" />
  15. <result property="complexionTypes" column="complexion_types" />
  16. <result property="spotProblems" column="spot_problems" />
  17. <result property="swellingProblems" column="swelling_problems" />
  18. <result property="glowResult" column="glow_result" />
  19. <result property="diagnosisSummary" column="diagnosis_summary" />
  20. <result property="healthSuggestions" column="health_suggestions" />
  21. <result property="createTime" column="create_time" />
  22. <result property="remark" column="remark" />
  23. </resultMap>
  24. <sql id="selectFsHealthSurfaceVo">
  25. select id, user_id, name, sex, age, status, surface_url, complexion_result, complexion_types, spot_problems, swelling_problems, glow_result, diagnosis_summary, health_suggestions,create_time,remark from fs_health_surface
  26. </sql>
  27. <select id="selectFsHealthSurfaceList" parameterType="FsHealthSurface" resultMap="FsHealthSurfaceResult">
  28. <include refid="selectFsHealthSurfaceVo"/>
  29. <where>
  30. <if test="userId != null "> and user_id = #{userId}</if>
  31. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  32. <if test="sex != null "> and sex = #{sex}</if>
  33. <if test="age != null "> and age = #{age}</if>
  34. <if test="status != null "> and status = #{status}</if>
  35. <if test="surfaceUrl != null and surfaceUrl != ''"> and surface_url = #{surfaceUrl}</if>
  36. <if test="complexionResult != null and complexionResult != ''"> and complexion_result = #{complexionResult}</if>
  37. <if test="complexionTypes != null and complexionTypes != ''"> and complexion_types = #{complexionTypes}</if>
  38. <if test="spotProblems != null and spotProblems != ''"> and spot_problems = #{spotProblems}</if>
  39. <if test="swellingProblems != null and swellingProblems != ''"> and swelling_problems = #{swellingProblems}</if>
  40. <if test="glowResult != null and glowResult != ''"> and glow_result = #{glowResult}</if>
  41. <if test="diagnosisSummary != null and diagnosisSummary != ''"> and diagnosis_summary = #{diagnosisSummary}</if>
  42. <if test="healthSuggestions != null and healthSuggestions != ''"> and health_suggestions = #{healthSuggestions}</if>
  43. <if test="createTime != null and createTime != ''"> and create_time = #{createTime}</if>
  44. <if test="remark != null and remark != ''"> and remark = #{remark}</if>
  45. </where>
  46. </select>
  47. <select id="selectFsHealthSurfaceById" parameterType="Long" resultMap="FsHealthSurfaceResult">
  48. <include refid="selectFsHealthSurfaceVo"/>
  49. where id = #{id}
  50. </select>
  51. <select id="selectFsHealthSurfaceListVO" resultType="com.fs.his.vo.FsHealthSurfaceListVO">
  52. select * from fs_health_surface where user_id=#{userId}
  53. <if test="createDay != null and createDay !=''">
  54. AND DATE(create_time) = #{createDay}
  55. </if>
  56. order by create_time desc
  57. </select>
  58. <select id="selectListByDateAndUserId" resultType="java.lang.String">
  59. select DATE(create_time) from fs_health_surface
  60. <where>
  61. <if test="startDate != null">
  62. and create_time <![CDATA[>=]]> #{startDate}
  63. </if>
  64. <if test="endDate != null">
  65. and create_time <![CDATA[<=]]> #{endDate}
  66. </if>
  67. <if test="userId != null">
  68. and user_id= #{userId}
  69. </if>
  70. </where>
  71. GROUP BY DATE(create_time)
  72. </select>
  73. <insert id="insertFsHealthSurface" parameterType="FsHealthSurface" useGeneratedKeys="true" keyProperty="id">
  74. insert into fs_health_surface
  75. <trim prefix="(" suffix=")" suffixOverrides=",">
  76. <if test="userId != null">user_id,</if>
  77. <if test="name != null">name,</if>
  78. <if test="sex != null">sex,</if>
  79. <if test="age != null">age,</if>
  80. <if test="status != null">status,</if>
  81. <if test="surfaceUrl != null">surface_url,</if>
  82. <if test="complexionResult != null">complexion_result,</if>
  83. <if test="complexionTypes != null">complexion_types,</if>
  84. <if test="spotProblems != null">spot_problems,</if>
  85. <if test="swellingProblems != null">swelling_problems,</if>
  86. <if test="glowResult != null">glow_result,</if>
  87. <if test="diagnosisSummary != null">diagnosis_summary,</if>
  88. <if test="healthSuggestions != null">health_suggestions,</if>
  89. <if test="createTime != null">create_time,</if>
  90. <if test="remark != null">remark,</if>
  91. </trim>
  92. <trim prefix="values (" suffix=")" suffixOverrides=",">
  93. <if test="userId != null">#{userId},</if>
  94. <if test="name != null">#{name},</if>
  95. <if test="sex != null">#{sex},</if>
  96. <if test="age != null">#{age},</if>
  97. <if test="status != null">#{status},</if>
  98. <if test="surfaceUrl != null">#{surfaceUrl},</if>
  99. <if test="complexionResult != null">#{complexionResult},</if>
  100. <if test="complexionTypes != null">#{complexionTypes},</if>
  101. <if test="spotProblems != null">#{spotProblems},</if>
  102. <if test="swellingProblems != null">#{swellingProblems},</if>
  103. <if test="glowResult != null">#{glowResult},</if>
  104. <if test="diagnosisSummary != null">#{diagnosisSummary},</if>
  105. <if test="healthSuggestions != null">#{healthSuggestions},</if>
  106. <if test="createTime != null">#{createTime},</if>
  107. <if test="remark != null">#{remark},</if>
  108. </trim>
  109. </insert>
  110. <update id="updateFsHealthSurface" parameterType="FsHealthSurface">
  111. update fs_health_surface
  112. <trim prefix="SET" suffixOverrides=",">
  113. <if test="userId != null">user_id = #{userId},</if>
  114. <if test="name != null">name = #{name},</if>
  115. <if test="sex != null">sex = #{sex},</if>
  116. <if test="age != null">age = #{age},</if>
  117. <if test="status != null">status = #{status},</if>
  118. <if test="surfaceUrl != null">surface_url = #{surfaceUrl},</if>
  119. <if test="complexionResult != null">complexion_result = #{complexionResult},</if>
  120. <if test="complexionTypes != null">complexion_types = #{complexionTypes},</if>
  121. <if test="spotProblems != null">spot_problems = #{spotProblems},</if>
  122. <if test="swellingProblems != null">swelling_problems = #{swellingProblems},</if>
  123. <if test="glowResult != null">glow_result = #{glowResult},</if>
  124. <if test="diagnosisSummary != null">diagnosis_summary = #{diagnosisSummary},</if>
  125. <if test="healthSuggestions != null">health_suggestions = #{healthSuggestions},</if>
  126. <if test="createTime != null">create_time = #{createTime},</if>
  127. <if test="remark != null">remark = #{remark},</if>
  128. </trim>
  129. where id = #{id}
  130. </update>
  131. <delete id="deleteFsHealthSurfaceById" parameterType="Long">
  132. delete from fs_health_surface where id = #{id}
  133. </delete>
  134. <delete id="deleteFsHealthSurfaceByIds" parameterType="String">
  135. delete from fs_health_surface where id in
  136. <foreach item="id" collection="array" open="(" separator="," close=")">
  137. #{id}
  138. </foreach>
  139. </delete>
  140. </mapper>