FsUserWatchMapper.xml 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.FsUserWatchMapper">
  6. <resultMap type="FsUserWatch" id="FsUserWatchResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="companyId" column="company_id" />
  10. <result property="companyUserId" column="company_user_id" />
  11. <result property="doctorId" column="doctor_id" />
  12. <result property="storeOrderId" column="store_order_id" />
  13. <result property="status" column="status" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateTime" column="update_time" />
  16. </resultMap>
  17. <sql id="selectFsUserWatchVo">
  18. select id, user_id, company_id, company_user_id, doctor_id, store_order_id, status, create_time, update_time from fs_user_watch
  19. </sql>
  20. <select id="selectFsUserWatchList" parameterType="FsUserWatch" resultMap="FsUserWatchResult">
  21. <include refid="selectFsUserWatchVo"/>
  22. <where>
  23. <if test="userId != null "> and user_id = #{userId}</if>
  24. <if test="companyId != null "> and company_id = #{companyId}</if>
  25. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  26. <if test="doctorId != null "> and doctor_id = #{doctorId}</if>
  27. <if test="storeOrderId != null "> and store_order_id = #{storeOrderId}</if>
  28. <if test="status != null "> and status = #{status}</if>
  29. </where>
  30. order by create_time desc
  31. </select>
  32. <select id="selectFsUserWatchById" parameterType="Long" resultMap="FsUserWatchResult">
  33. <include refid="selectFsUserWatchVo"/>
  34. where id = #{id}
  35. </select>
  36. <select id="getLastByUserId" resultType="com.fs.his.domain.FsUserWatch">
  37. <include refid="selectFsUserWatchVo"></include>
  38. where user_id = #{userId}
  39. order by create_time limit 1
  40. </select>
  41. <insert id="insertFsUserWatch" parameterType="FsUserWatch">
  42. insert into fs_user_watch
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="id != null">id,</if>
  45. <if test="userId != null">user_id,</if>
  46. <if test="companyId != null">company_id,</if>
  47. <if test="companyUserId != null">company_user_id,</if>
  48. <if test="doctorId != null">doctor_id,</if>
  49. <if test="storeOrderId != null">store_order_id,</if>
  50. <if test="status != null">status,</if>
  51. <if test="createTime != null">create_time,</if>
  52. <if test="updateTime != null">update_time,</if>
  53. </trim>
  54. <trim prefix="values (" suffix=")" suffixOverrides=",">
  55. <if test="id != null">#{id},</if>
  56. <if test="userId != null">#{userId},</if>
  57. <if test="companyId != null">#{companyId},</if>
  58. <if test="companyUserId != null">#{companyUserId},</if>
  59. <if test="doctorId != null">#{doctorId},</if>
  60. <if test="storeOrderId != null">#{storeOrderId},</if>
  61. <if test="status != null">#{status},</if>
  62. <if test="createTime != null">#{createTime},</if>
  63. <if test="updateTime != null">#{updateTime},</if>
  64. </trim>
  65. </insert>
  66. <update id="updateFsUserWatch" parameterType="FsUserWatch">
  67. update fs_user_watch
  68. <trim prefix="SET" suffixOverrides=",">
  69. <if test="userId != null">user_id = #{userId},</if>
  70. <if test="companyId != null">company_id = #{companyId},</if>
  71. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  72. <if test="doctorId != null">doctor_id = #{doctorId},</if>
  73. <if test="storeOrderId != null">store_order_id = #{storeOrderId},</if>
  74. <if test="status != null">status = #{status},</if>
  75. <if test="createTime != null">create_time = #{createTime},</if>
  76. <if test="updateTime != null">update_time = #{updateTime},</if>
  77. </trim>
  78. where id = #{id}
  79. </update>
  80. <delete id="deleteFsUserWatchById" parameterType="Long">
  81. delete from fs_user_watch where id = #{id}
  82. </delete>
  83. <delete id="deleteFsUserWatchByIds" parameterType="String">
  84. delete from fs_user_watch where id in
  85. <foreach item="id" collection="array" open="(" separator="," close=")">
  86. #{id}
  87. </foreach>
  88. </delete>
  89. </mapper>