TacInspYearBatchGroupMegDao.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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="cn.com.goldenwater.dcproj.dao.TacInspYearBatchGroupMegDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupMeg" id="tacInspYearBatchGroupMegResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="yearBatchId" column="YEAR_BATCH_ID"/>
  7. <result property="year" column="YEAR"/>
  8. <result property="batch" column="BATCH"/>
  9. <result property="groupId" column="GROUP_ID"/>
  10. <result property="groupNm" column="GROUP_NM"/>
  11. <result property="exptId" column="EXPT_ID"/>
  12. <result property="exptNm" column="EXPT_NM"/>
  13. <result property="exptPhone" column="EXPT_PHONE"/>
  14. <result property="noticeInfo" column="NOTICE_INFO"/>
  15. <result property="assId" column="ASS_ID"/>
  16. <result property="assNm" column="ASS_NM"/>
  17. <result property="assPhone" column="ASS_PHONE"/>
  18. <result property="sdPersId" column="SD_PERS_ID"/>
  19. <result property="sdTm" column="SD_TM"/>
  20. <result property="sdState" column="SD_STATE"/>
  21. <result property="inTm" column="IN_TM"/>
  22. <result property="upTm" column="UP_TM"/>
  23. <result property="dataStat" column="DATA_STAT"/>
  24. </resultMap>
  25. <sql id="table_columns">
  26. ID,
  27. YEAR_BATCH_ID,
  28. YEAR,
  29. BATCH,
  30. GROUP_ID,
  31. GROUP_NM,
  32. EXPT_ID,
  33. EXPT_NM,
  34. EXPT_PHONE,
  35. NOTICE_INFO,
  36. ASS_ID,
  37. ASS_NM,
  38. ASS_PHONE,
  39. SD_PERS_ID,
  40. SD_TM,
  41. SD_STATE,
  42. IN_TM,
  43. UP_TM,
  44. DATA_STAT
  45. </sql>
  46. <sql id="entity_properties">
  47. #{id},
  48. #{yearBatchId},
  49. #{year},
  50. #{batch},
  51. #{groupId},
  52. #{groupNm},
  53. #{exptId},
  54. #{exptNm},
  55. #{exptPhone},
  56. #{noticeInfo},
  57. #{assId},
  58. #{assNm},
  59. #{assPhone},
  60. #{sdPersId},
  61. #{sdTm},
  62. #{sdState},
  63. #{inTm},
  64. #{upTm},
  65. #{dataStat}
  66. </sql>
  67. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  68. <sql id="page_where">
  69. <trim prefix="where" prefixOverrides="and | or ">
  70. <if test="yearBatchId != null and yearBatchId != ''">and YEAR_BATCH_ID = #{yearBatchId}</if>
  71. <if test="year != null and year != ''">and YEAR = #{year}</if>
  72. <if test="batch != null and batch != ''">and BATCH = #{batch}</if>
  73. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  74. <if test="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</if>
  75. <if test="exptId != null and exptId != ''">and EXPT_ID = #{exptId}</if>
  76. <if test="exptNm != null and exptNm != ''">and EXPT_NM = #{exptNm}</if>
  77. <if test="exptPhone != null and exptPhone != ''">and EXPT_PHONE = #{exptPhone}</if>
  78. <if test="noticeInfo != null and noticeInfo != ''">and NOTICE_INFO = #{noticeInfo}</if>
  79. <if test="assId != null and assId != ''">and ASS_ID = #{assId}</if>
  80. <if test="assNm != null and assNm != ''">and ASS_NM = #{assNm}</if>
  81. <if test="assPhone != null and assPhone != ''">and ASS_PHONE = #{assPhone}</if>
  82. <if test="sdPersId != null and sdPersId != ''">and SD_PERS_ID = #{sdPersId}</if>
  83. <if test="sdTm != null">and SD_TM = #{sdTm}</if>
  84. <if test="sdState != null and sdState != ''">and SD_STATE = #{sdState}</if>
  85. <if test="inTm != null">and IN_TM = #{inTm}</if>
  86. <if test="upTm != null">and UP_TM = #{upTm}</if>
  87. </trim>
  88. </sql>
  89. <select id="get" resultMap="tacInspYearBatchGroupMegResultMap" parameterType="String" >
  90. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP_MEG where ID = #{id}
  91. </select>
  92. <select id="getBy" resultMap="tacInspYearBatchGroupMegResultMap">
  93. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP_MEG <include refid="page_where" />
  94. </select>
  95. <select id="findAll" resultMap="tacInspYearBatchGroupMegResultMap">
  96. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP_MEG
  97. </select>
  98. <select id="findList" resultMap="tacInspYearBatchGroupMegResultMap">
  99. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP_MEG <include refid="page_where" />
  100. </select>
  101. <select id="selectCount" resultType="int" >
  102. select count(ID) from TAC_INSP_YEAR_BATCH_GROUP_MEG <include refid="page_where" />
  103. </select>
  104. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupMeg">
  105. insert into TAC_INSP_YEAR_BATCH_GROUP_MEG( <include refid="table_columns" /> )
  106. values ( <include refid="entity_properties" /> )
  107. </insert>
  108. <delete id="delete" parameterType="java.lang.String">
  109. delete from TAC_INSP_YEAR_BATCH_GROUP_MEG where ID = #{id}
  110. </delete>
  111. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupMeg">
  112. delete from TAC_INSP_YEAR_BATCH_GROUP_MEG <include refid="page_where" />
  113. </delete>
  114. <update id="deleteInFlag" parameterType="java.lang.String">
  115. update TAC_INSP_YEAR_BATCH_GROUP_MEG set flag_valid = 0 where ID = #{id}
  116. </update>
  117. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupMeg">
  118. update TAC_INSP_YEAR_BATCH_GROUP_MEG
  119. <trim prefix="set" suffixOverrides=",">
  120. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  121. <if test="year != null and year != ''">YEAR = #{year},</if>
  122. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  123. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  124. <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
  125. <if test="exptId != null and exptId != ''">EXPT_ID = #{exptId},</if>
  126. <if test="exptNm != null and exptNm != ''">EXPT_NM = #{exptNm},</if>
  127. <if test="exptPhone != null and exptPhone != ''">EXPT_PHONE = #{exptPhone},</if>
  128. <if test="noticeInfo != null and noticeInfo != ''">NOTICE_INFO = #{noticeInfo},</if>
  129. <if test="assId != null and assId != ''">ASS_ID = #{assId},</if>
  130. <if test="assNm != null and assNm != ''">ASS_NM = #{assNm},</if>
  131. <if test="assPhone != null and assPhone != ''">ASS_PHONE = #{assPhone},</if>
  132. <if test="sdPersId != null and sdPersId != ''">SD_PERS_ID = #{sdPersId},</if>
  133. <if test="sdTm != null">SD_TM = #{sdTm},</if>
  134. <if test="sdState != null and sdState != ''">SD_STATE = #{sdState},</if>
  135. <if test="inTm != null">IN_TM = #{inTm},</if>
  136. <if test="upTm != null">UP_TM = #{upTm},</if>
  137. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  138. </trim>
  139. <where>ID = #{id}</where>
  140. </update>
  141. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupMeg">
  142. update TAC_INSP_YEAR_BATCH_GROUP_MEG
  143. <trim prefix="set" suffixOverrides=",">
  144. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  145. <if test="year != null and year != ''">YEAR = #{year},</if>
  146. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  147. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  148. <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
  149. <if test="exptId != null and exptId != ''">EXPT_ID = #{exptId},</if>
  150. <if test="exptNm != null and exptNm != ''">EXPT_NM = #{exptNm},</if>
  151. <if test="exptPhone != null and exptPhone != ''">EXPT_PHONE = #{exptPhone},</if>
  152. <if test="noticeInfo != null and noticeInfo != ''">NOTICE_INFO = #{noticeInfo},</if>
  153. <if test="assId != null and assId != ''">ASS_ID = #{assId},</if>
  154. <if test="assNm != null and assNm != ''">ASS_NM = #{assNm},</if>
  155. <if test="assPhone != null and assPhone != ''">ASS_PHONE = #{assPhone},</if>
  156. <if test="sdPersId != null and sdPersId != ''">SD_PERS_ID = #{sdPersId},</if>
  157. <if test="sdTm != null">SD_TM = #{sdTm},</if>
  158. <if test="sdState != null and sdState != ''">SD_STATE = #{sdState},</if>
  159. <if test="inTm != null">IN_TM = #{inTm},</if>
  160. <if test="upTm != null">UP_TM = #{upTm},</if>
  161. </trim>
  162. <include refid="page_where" />
  163. </update>
  164. <!-- 其他自定义SQL -->
  165. <select id="getGroupMegListBySize" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupMegParam" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupMeg">
  166. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP_MEG
  167. where EXPT_ID in (Select id from tac_worker_b where login_id =#{persId})
  168. <if test="year != null">
  169. and YEAR = #{year}
  170. </if>
  171. order by UP_TM desc
  172. </select>
  173. </mapper>