FsHealthLifeMapper.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.FsHealthLifeMapper">
  6. <resultMap type="FsHealthLife" id="FsHealthLifeResult">
  7. <result property="id" column="id" />
  8. <result property="type" column="type" />
  9. <result property="userId" column="user_id" />
  10. <result property="formJson" column="form_json" />
  11. <result property="createTime" column="create_time" />
  12. </resultMap>
  13. <sql id="selectFsHealthLifeVo">
  14. select id, type, user_id, form_json, create_time from fs_health_life
  15. </sql>
  16. <select id="selectFsHealthLifeList" parameterType="FsHealthLife" resultMap="FsHealthLifeResult">
  17. <include refid="selectFsHealthLifeVo"/>
  18. <where>
  19. <if test="type != null "> and type = #{type}</if>
  20. <if test="userId != null "> and user_id = #{userId}</if>
  21. <if test="formJson != null and formJson != ''"> and form_json = #{formJson}</if>
  22. </where>
  23. </select>
  24. <select id="selectFsHealthLifeById" parameterType="Long" resultMap="FsHealthLifeResult">
  25. <include refid="selectFsHealthLifeVo"/>
  26. where id = #{id}
  27. </select>
  28. <insert id="insertFsHealthLife" parameterType="FsHealthLife" useGeneratedKeys="true" keyProperty="id">
  29. insert into fs_health_life
  30. <trim prefix="(" suffix=")" suffixOverrides=",">
  31. <if test="type != null">type,</if>
  32. <if test="userId != null">user_id,</if>
  33. <if test="formJson != null">form_json,</if>
  34. <if test="createTime != null">create_time,</if>
  35. </trim>
  36. <trim prefix="values (" suffix=")" suffixOverrides=",">
  37. <if test="type != null">#{type},</if>
  38. <if test="userId != null">#{userId},</if>
  39. <if test="formJson != null">#{formJson},</if>
  40. <if test="createTime != null">#{createTime},</if>
  41. </trim>
  42. </insert>
  43. <update id="updateFsHealthLife" parameterType="FsHealthLife">
  44. update fs_health_life
  45. <trim prefix="SET" suffixOverrides=",">
  46. <if test="type != null">type = #{type},</if>
  47. <if test="userId != null">user_id = #{userId},</if>
  48. <if test="formJson != null">form_json = #{formJson},</if>
  49. <if test="createTime != null">create_time = #{createTime},</if>
  50. </trim>
  51. where id = #{id}
  52. </update>
  53. <delete id="deleteFsHealthLifeById" parameterType="Long">
  54. delete from fs_health_life where id = #{id}
  55. </delete>
  56. <delete id="deleteFsHealthLifeByIds" parameterType="String">
  57. delete from fs_health_life where id in
  58. <foreach item="id" collection="array" open="(" separator="," close=")">
  59. #{id}
  60. </foreach>
  61. </delete>
  62. </mapper>