BdglDailyInspectMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.BdglDailyInspectMapper">
  6. <resultMap type="BdglDailyInspect" id="BdglDailyInspectResult">
  7. <result property="id" column="id" />
  8. <result property="peopleId" column="people_id" />
  9. <result property="diaryId" column="diary_id" />
  10. <result property="peopleName" column="people_name" />
  11. <result property="sentryId" column="sentry_id" />
  12. <result property="sentryName" column="sentry_name" />
  13. <result property="foremanId" column="foreman_id" />
  14. <result property="foremanName" column="foreman_name" />
  15. <result property="unitId" column="unit_id" />
  16. <result property="testName" column="test_name" />
  17. <result property="dialogue" column="dialogue" />
  18. <result property="createtime" column="createtime" />
  19. <result property="updatetime" column="updatetime" />
  20. <result property="field1" column="field1" />
  21. <result property="examineDate" column="examine_date" />
  22. <result property="contents" column="contents" />
  23. </resultMap>
  24. <sql id="selectBdglDailyInspectVo">
  25. select id, people_id, diary_id, people_name, sentry_id, sentry_name, foreman_id, foreman_name, unit_id, test_name, dialogue, createtime, updatetime, field1, examine_date, contents from bdgl_daily_inspect
  26. </sql>
  27. <select id="selectBdglDailyInspectList" parameterType="BdglDailyInspect" resultMap="BdglDailyInspectResult">
  28. <include refid="selectBdglDailyInspectVo"/>
  29. <where>
  30. <if test="peopleId != null "> and people_id = #{peopleId}</if>
  31. <if test="diaryId != null "> and diary_id = #{diaryId}</if>
  32. <if test="peopleName != null and peopleName != ''"> and people_name like concat('%', #{peopleName}, '%')</if>
  33. <if test="sentryId != null "> and sentry_id = #{sentryId}</if>
  34. <if test="sentryName != null and sentryName != ''"> and sentry_name like concat('%', #{sentryName}, '%')</if>
  35. <if test="foremanId != null "> and foreman_id = #{foremanId}</if>
  36. <if test="foremanName != null and foremanName != ''"> and foreman_name like concat('%', #{foremanName}, '%')</if>
  37. <if test="unitId != null "> and unit_id = #{unitId}</if>
  38. <if test="testName != null and testName != ''"> and test_name like concat('%', #{testName}, '%')</if>
  39. <if test="dialogue != null and dialogue != ''"> and dialogue = #{dialogue}</if>
  40. <if test="createtime != null "> and createtime like concat('%', #{createtime}, '%')</if>
  41. <if test="updatetime != null "> and updatetime = #{updatetime}</if>
  42. <if test="field1 != null and field1 != ''"> and field1 = #{field1}</if>
  43. <if test="examineDate != null "> and examine_date = #{examineDate}</if>
  44. <if test="contents != null and contents != ''"> and contents = #{contents}</if>
  45. <if test="diaryIdList!=null and diaryIdList.size()>0">
  46. and diary_id in
  47. <foreach collection="diaryIdList" item="id" open="(" separator="," close=")">
  48. #{id}
  49. </foreach>
  50. </if>
  51. </where>
  52. </select>
  53. <select id="selectBdglDailyInspectById" parameterType="Integer" resultMap="BdglDailyInspectResult">
  54. <include refid="selectBdglDailyInspectVo"/>
  55. where id = #{id}
  56. </select>
  57. <insert id="insertBdglDailyInspect" parameterType="BdglDailyInspect" useGeneratedKeys="true" keyProperty="id">
  58. insert into bdgl_daily_inspect
  59. <trim prefix="(" suffix=")" suffixOverrides=",">
  60. <if test="peopleId != null">people_id,</if>
  61. <if test="diaryId != null">diary_id,</if>
  62. <if test="peopleName != null">people_name,</if>
  63. <if test="sentryId != null">sentry_id,</if>
  64. <if test="sentryName != null">sentry_name,</if>
  65. <if test="foremanId != null">foreman_id,</if>
  66. <if test="foremanName != null">foreman_name,</if>
  67. <if test="unitId != null">unit_id,</if>
  68. <if test="testName != null">test_name,</if>
  69. <if test="dialogue != null">dialogue,</if>
  70. <if test="createtime != null">createtime,</if>
  71. <if test="updatetime != null">updatetime,</if>
  72. <if test="field1 != null">field1,</if>
  73. <if test="examineDate != null">examine_date,</if>
  74. <if test="contents != null">contents,</if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test="peopleId != null">#{peopleId},</if>
  78. <if test="diaryId != null">#{diaryId},</if>
  79. <if test="peopleName != null">#{peopleName},</if>
  80. <if test="sentryId != null">#{sentryId},</if>
  81. <if test="sentryName != null">#{sentryName},</if>
  82. <if test="foremanId != null">#{foremanId},</if>
  83. <if test="foremanName != null">#{foremanName},</if>
  84. <if test="unitId != null">#{unitId},</if>
  85. <if test="testName != null">#{testName},</if>
  86. <if test="dialogue != null">#{dialogue},</if>
  87. <if test="createtime != null">#{createtime},</if>
  88. <if test="updatetime != null">#{updatetime},</if>
  89. <if test="field1 != null">#{field1},</if>
  90. <if test="examineDate != null">#{examineDate},</if>
  91. <if test="contents != null">#{contents},</if>
  92. </trim>
  93. </insert>
  94. <update id="updateBdglDailyInspect" parameterType="BdglDailyInspect">
  95. update bdgl_daily_inspect
  96. <trim prefix="SET" suffixOverrides=",">
  97. <if test="peopleId != null">people_id = #{peopleId},</if>
  98. <if test="diaryId != null">diary_id = #{diaryId},</if>
  99. <if test="peopleName != null">people_name = #{peopleName},</if>
  100. <if test="sentryId != null">sentry_id = #{sentryId},</if>
  101. <if test="sentryName != null">sentry_name = #{sentryName},</if>
  102. <if test="foremanId != null">foreman_id = #{foremanId},</if>
  103. <if test="foremanName != null">foreman_name = #{foremanName},</if>
  104. <if test="unitId != null">unit_id = #{unitId},</if>
  105. <if test="testName != null">test_name = #{testName},</if>
  106. <if test="dialogue != null">dialogue = #{dialogue},</if>
  107. <if test="createtime != null">createtime = #{createtime},</if>
  108. <if test="updatetime != null">updatetime = #{updatetime},</if>
  109. <if test="field1 != null">field1 = #{field1},</if>
  110. <if test="examineDate != null">examine_date = #{examineDate},</if>
  111. <if test="contents != null">contents = #{contents},</if>
  112. </trim>
  113. where id = #{id}
  114. </update>
  115. <delete id="deleteBdglDailyInspectById" parameterType="Integer">
  116. delete from bdgl_daily_inspect where id = #{id}
  117. </delete>
  118. <delete id="deleteBdglDailyInspectByIds" parameterType="String">
  119. delete from bdgl_daily_inspect where id in
  120. <foreach item="id" collection="array" open="(" separator="," close=")">
  121. #{id}
  122. </foreach>
  123. </delete>
  124. <delete id="deleteBdglDailyInspect">
  125. delete from bdgl_daily_inspect where diary_id = #{diaryId}
  126. </delete>
  127. <select id="selectBdglDailyInspectListByTime" resultMap="BdglDailyInspectResult">
  128. SELECT people_name FROM bdgl_daily_inspect WHERE createtime &gt;= #{starttime} AND createtime &lt;= #{endtime} AND unit_id = #{unitid}
  129. </select>
  130. <select id="selectBdglDailyInspects" resultMap="BdglDailyInspectResult">
  131. SELECT people_name FROM bdgl_daily_inspect WHERE createtime like concat('%', #{timeParameter}, '%') AND unit_id = #{deptId}
  132. </select>
  133. </mapper>