BisInspGroupDao.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.BisInspGroupDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspGroup" id="bisInspGroupResultMap">
  5. <result property="inspGroupId" column="INSP_GROUP_ID"/>
  6. <result property="plnaId" column="PLNA_ID"/>
  7. <result property="guid" column="GUID"/>
  8. <result property="inspGroupName" column="INSP_GROUP_NAME"/>
  9. <result property="downStat" column="DOWN_STAT"/>
  10. <result property="dataStat" column="DATA_STAT"/>
  11. <result property="collTime" column="COLL_TIME"/>
  12. <result property="recPers" column="REC_PERS"/>
  13. <result property="note" column="NOTE"/>
  14. </resultMap>
  15. <sql id="table_columns">
  16. INSP_GROUP_ID,
  17. PLNA_ID,
  18. GUID,
  19. INSP_GROUP_NAME,
  20. DOWN_STAT,
  21. DATA_STAT,
  22. COLL_TIME,
  23. REC_PERS,
  24. NOTE
  25. </sql>
  26. <sql id="entity_properties">
  27. #{inspGroupId},
  28. #{plnaId},
  29. #{guid},
  30. #{inspGroupName},
  31. #{downStat},
  32. #{dataStat},
  33. #{collTime},
  34. #{recPers},
  35. #{note}
  36. </sql>
  37. <sql id="entity_properties_insert">
  38. #{inspGroupId},
  39. #{plnaId},
  40. #{guid},
  41. #{inspGroupName},
  42. #{downStat},
  43. #{dataStat},
  44. DATE_FORMAT(#{collTime},'%Y-%m-%d'),
  45. #{recPers},
  46. #{note}
  47. </sql>
  48. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  49. <sql id="page_where">
  50. <trim prefix="where" prefixOverrides="and | or ">
  51. <if test="plnaId != null and plnaId != ''">and PLNA_ID = #{plnaId}</if>
  52. <if test="guid != null and guid != ''">and GUID = #{guid}</if>
  53. <if test="inspGroupName != null and inspGroupName != ''">and INSP_GROUP_NAME = #{inspGroupName}</if>
  54. <if test="downStat != null">and DOWN_STAT = #{downStat}</if>
  55. <if test="dataStat != null">and DATA_STAT = #{dataStat}</if>
  56. <if test="collTime != null">and COLL_TIME = #{collTime}</if>
  57. <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
  58. <if test="note != null and note != ''">and NOTE = #{note}</if>
  59. </trim>
  60. </sql>
  61. <select id="get" resultMap="bisInspGroupResultMap" parameterType="String">
  62. select
  63. <include refid="table_columns"/>
  64. from BIS_INSP_GROUP where GUID = #{id}
  65. </select>
  66. <select id="getBy" resultMap="bisInspGroupResultMap">
  67. select
  68. <include refid="table_columns"/>
  69. from BIS_INSP_GROUP
  70. <include refid="page_where"/>
  71. </select>
  72. <select id="findAll" resultMap="bisInspGroupResultMap">
  73. select
  74. <include refid="table_columns"/>
  75. from BIS_INSP_GROUP
  76. </select>
  77. <select id="findList" resultMap="bisInspGroupResultMap">
  78. select
  79. <include refid="table_columns"/>
  80. from BIS_INSP_GROUP
  81. <include refid="page_where"/>
  82. </select>
  83. <select id="selectCount" resultType="int">
  84. select count(ID) from BIS_INSP_GROUP
  85. <include refid="page_where"/>
  86. </select>
  87. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspGroup">
  88. insert into BIS_INSP_GROUP(
  89. <include refid="table_columns"/>
  90. )
  91. values (
  92. <include refid="entity_properties"/>
  93. )
  94. </insert>
  95. <delete id="delete" parameterType="java.lang.String">
  96. delete from BIS_INSP_GROUP where INSP_GROUP_ID = #{id}
  97. </delete>
  98. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspGroup">
  99. delete from BIS_INSP_GROUP
  100. <include refid="page_where"/>
  101. </delete>
  102. <update id="deleteInFlag" parameterType="java.lang.String">
  103. update BIS_INSP_GROUP set flag_valid = 0 where ID = #{id}
  104. </update>
  105. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspGroup">
  106. update BIS_INSP_GROUP
  107. <trim prefix="set" suffixOverrides=",">
  108. <if test="plnaId != null and plnaId != ''">PLNA_ID = #{plnaId},</if>
  109. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  110. <if test="inspGroupName != null and inspGroupName != ''">INSP_GROUP_NAME = #{inspGroupName},</if>
  111. <if test="downStat != null">DOWN_STAT = #{downStat},</if>
  112. <if test="dataStat != null">DATA_STAT = #{dataStat},</if>
  113. <if test="collTime != null">COLL_TIME = #{collTime},</if>
  114. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  115. <if test="note != null and note != ''">NOTE = #{note},</if>
  116. </trim>
  117. <where>INSP_GROUP_ID = #{inspGroupId}</where>
  118. </update>
  119. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspGroup">
  120. update BIS_INSP_GROUP
  121. <trim prefix="set" suffixOverrides=",">
  122. <if test="plnaId != null and plnaId != ''">PLNA_ID = #{plnaId},</if>
  123. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  124. <if test="inspGroupName != null and inspGroupName != ''">INSP_GROUP_NAME = #{inspGroupName},</if>
  125. <if test="downStat != null">DOWN_STAT = #{downStat},</if>
  126. <if test="dataStat != null">DATA_STAT = #{dataStat},</if>
  127. <if test="collTime != null">COLL_TIME = #{collTime},</if>
  128. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  129. <if test="note != null and note != ''">NOTE = #{note},</if>
  130. </trim>
  131. <include refid="page_where"/>
  132. </update>
  133. <!-- 其他自定义SQL -->
  134. <!--根据userid和批次id查询督查组-->
  135. <select id="findListByBatchIdAndUserId" resultType="cn.com.goldenwater.dcproj.model.BisInspGroup">
  136. select g.*
  137. from BIS_INSP_GROUP g
  138. left join REL_PERS_INSPGROUP rel
  139. on rel.insp_group_id = g.insp_group_id
  140. left join ATT_PERS_BASE p
  141. on p.guid = rel.pers_id
  142. left join GW_SYS_USER u
  143. on u.ofc_id = p.guid
  144. where g.DATA_STAT = '1'
  145. and u.id = #{userId}
  146. and g.plna_id = #{code}
  147. </select>
  148. </mapper>