BdglStatisticsMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.supervision.grassrootsregistration.mapper.BdglStatisticsMapper">
  6. <resultMap type="BdglStatistics" id="BdglStatisticsResult">
  7. <result property="id" column="id" />
  8. <result property="unitId" column="unit_id" />
  9. <result property="actualArrival" column="actual_arrival" />
  10. <result property="unitName" column="unit_name" />
  11. <result property="title" column="title" />
  12. <result property="fileName" column="file_name" />
  13. <result property="filePath" column="file_path" />
  14. <result property="time" column="time" />
  15. </resultMap>
  16. <sql id="selectBdglStatisticsVo">
  17. select id, unit_id, actual_arrival, unit_name, title, file_name, file_path, time from bdgl_statistics
  18. </sql>
  19. <select id="selectBdglStatisticsList" parameterType="BdglStatistics" resultMap="BdglStatisticsResult">
  20. <include refid="selectBdglStatisticsVo"/>
  21. <where>
  22. <if test="unitId != null "> and unit_id = #{unitId}</if>
  23. <if test="actualArrival != null "> and actual_arrival = #{actualArrival}</if>
  24. <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
  25. <if test="title != null and title != ''"> and title = #{title}</if>
  26. <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
  27. <if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if>
  28. <if test="time != null "> and time = #{time}</if>
  29. </where>
  30. order by id desc
  31. </select>
  32. <select id="selectBdglStatisticsById" parameterType="Integer" resultMap="BdglStatisticsResult">
  33. <include refid="selectBdglStatisticsVo"/>
  34. where id = #{id}
  35. </select>
  36. <insert id="insertBdglStatistics" parameterType="BdglStatistics" useGeneratedKeys="true" keyProperty="id">
  37. insert into bdgl_statistics
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <if test="unitId != null">unit_id,</if>
  40. <if test="actualArrival != null">actual_arrival,</if>
  41. <if test="unitName != null">unit_name,</if>
  42. <if test="title != null">title,</if>
  43. <if test="fileName != null">file_name,</if>
  44. <if test="filePath != null">file_path,</if>
  45. <if test="time != null">time,</if>
  46. </trim>
  47. <trim prefix="values (" suffix=")" suffixOverrides=",">
  48. <if test="unitId != null">#{unitId},</if>
  49. <if test="actualArrival != null">#{actualArrival},</if>
  50. <if test="unitName != null">#{unitName},</if>
  51. <if test="title != null">#{title},</if>
  52. <if test="fileName != null">#{fileName},</if>
  53. <if test="filePath != null">#{filePath},</if>
  54. <if test="time != null">#{time},</if>
  55. </trim>
  56. </insert>
  57. <update id="updateBdglStatistics" parameterType="BdglStatistics">
  58. update bdgl_statistics
  59. <trim prefix="SET" suffixOverrides=",">
  60. <if test="unitId != null">unit_id = #{unitId},</if>
  61. <if test="actualArrival != null">actual_arrival = #{actualArrival},</if>
  62. <if test="unitName != null">unit_name = #{unitName},</if>
  63. <if test="title != null">title = #{title},</if>
  64. <if test="fileName != null">file_name = #{fileName},</if>
  65. <if test="filePath != null">file_path = #{filePath},</if>
  66. <if test="time != null">time = #{time},</if>
  67. </trim>
  68. where id = #{id}
  69. </update>
  70. <delete id="deleteBdglStatisticsById" parameterType="Integer">
  71. delete from bdgl_statistics where id = #{id}
  72. </delete>
  73. <delete id="deleteBdglStatisticsByIds" parameterType="String">
  74. delete from bdgl_statistics where id in
  75. <foreach item="id" collection="array" open="(" separator="," close=")">
  76. #{id}
  77. </foreach>
  78. </delete>
  79. </mapper>