WeaRotaInfoMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.weather.mapper.WeaRotaInfoMapper">
  4. <resultMap type="WeaRotaInfo" id="WeaRotaInfoResult">
  5. <result property="id" column="id" />
  6. <result property="rotaPersonId" column="rota_person_id" />
  7. <result property="rotaDate" column="rota_date" />
  8. <result property="name" column="name" />
  9. <result property="createId" column="create_id" />
  10. <result property="createTime" column="create_time" />
  11. <result property="updateId" column="update_id" />
  12. <result property="updateTime" column="update_time" />
  13. <result property="rotaName" column="rota_name" />
  14. </resultMap>
  15. <sql id="selectWeaRotaInfoVo">
  16. select id, rota_person_id, rota_date, name, rota_name, create_id, create_time, update_id, update_time
  17. from wea_rota_info
  18. </sql>
  19. <select id="selectWeaRotaInfoById" parameterType="Long" resultMap="WeaRotaInfoResult">
  20. select id, rota_person_id, rota_date from wea_rota_info where id = #{id}
  21. </select>
  22. <select id="selectWeaRotaInfoByDate" parameterType="Date" resultMap="WeaRotaInfoResult">
  23. SELECT * FROM wea_rota_info WHERE rota_date BETWEEN #{startDate} AND #{endDate}
  24. </select>
  25. <!-- 插入数据 -->
  26. <insert id="insertWeaRotaInfo" parameterType="WeaRotaInfo">
  27. insert into wea_rota_info (
  28. id,
  29. <if test="rotaPersonId != null and rotaPersonId != '' ">rota_person_id, </if>
  30. <if test="rotaDate != null and rotaDate != '' ">rota_date, </if>
  31. create_id,
  32. create_time,
  33. update_id,
  34. update_time
  35. )values(
  36. #{id},
  37. <if test="rotaPersonId!= null and rotaPersonId != ''">#{rotaPersonId}, </if>
  38. <if test="rotaDate != null and rotaDate != ''">#{rotaDate}, </if>
  39. #{createId},
  40. NOW(),
  41. #{updateId},
  42. #{updateTime}
  43. )
  44. </insert>
  45. <!-- 更新数据 -->
  46. <update id="updateWeaRotaInfo" parameterType="WeaRotaInfo">
  47. update wea_rota_info
  48. <set>
  49. <if test="rotaPersonId != null and rotaPersonId != ''">rota_person_id = #{rotaPersonId}, </if>
  50. rota_date = #{rotaDate},
  51. create_time = #{createTime},
  52. create_id = #{createId},
  53. update_id = #{updateId},
  54. update_time = NOW()
  55. </set>
  56. where id = #{id}
  57. </update>
  58. <select id="selectWeaRotaInfoList" parameterType="WeaRotaInfo" resultMap="WeaRotaInfoResult">
  59. select id, rota_person_id, rota_date, name, rota_name, create_id, create_time, update_id, update_time
  60. from wea_rota_info
  61. <where>
  62. <if test="id!=null and id!=''">
  63. AND "id"=#{id},
  64. </if>
  65. <if test="rotaPersonId!=null and rotaPersonId!=''">
  66. AND "rota_person_id"=#{rotaPersonId},
  67. </if>
  68. <if test="rotaDate!=null and rotaDate!=''">
  69. AND "rota_date"=#{rotaDate},
  70. </if>
  71. <if test="name!=null and name!=''">
  72. AND "name"=#{name},
  73. </if>
  74. <if test="rotaName!=null and rotaName!=''">
  75. AND "rota_name"=#{rotaName},
  76. </if>
  77. <if test="createId!=null and createId!=''">
  78. AND "create_id"=#{createId},
  79. </if>
  80. <if test="createTime!=null and createTime!=''">
  81. AND "create_time"=#{createTime},
  82. </if>
  83. <if test="updateId!=null and updateId!=''">
  84. AND "update_id"=#{updateId},
  85. </if>
  86. <if test="updateTime!=null and updateTime!=''">
  87. AND "update_time"=#{updateTime}
  88. </if>
  89. </where>
  90. </select>
  91. <delete id="deleteWeaRotaInfoById" parameterType="Long">
  92. delete from wea_rota_info where id = #{id}
  93. </delete>
  94. </mapper>