TacEvalationInformDao.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.TacEvalationInformDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacEvalationInform" id="tacEvalationInformResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="type" column="TYPE"/>
  7. <result property="year" column="YEAR"/>
  8. <result property="batch" column="BATCH"/>
  9. <result property="cutTm" column="CUT_TM"/>
  10. <result property="zolPersId" column="ZOL_PERS_ID"/>
  11. <result property="informNum" column="INFORM_NUM"/>
  12. <result property="inTm" column="IN_TM"/>
  13. <result property="upTm" column="UP_TM"/>
  14. <result property="persId" column="PERS_ID"/>
  15. </resultMap>
  16. <sql id="table_columns">
  17. ID,
  18. TYPE,
  19. YEAR,
  20. BATCH,
  21. CUT_TM,
  22. ZOL_PERS_ID,
  23. INFORM_NUM,
  24. IN_TM,
  25. UP_TM,
  26. PERS_ID
  27. </sql>
  28. <sql id="entity_properties">
  29. #{id},
  30. #{type},
  31. #{year},
  32. #{batch},
  33. #{cutTm},
  34. #{zolPersId},
  35. #{informNum},
  36. #{inTm},
  37. #{upTm},
  38. #{persId}
  39. </sql>
  40. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  41. <sql id="page_where">
  42. <trim prefix="where" prefixOverrides="and | or ">
  43. <if test="type != null and type != ''">and TYPE = #{type}</if>
  44. <if test="year != null and year != ''">and YEAR = #{year}</if>
  45. <if test="batch != null and batch != ''">and BATCH = #{batch}</if>
  46. <if test="cutTm != null">and CUT_TM = #{cutTm}</if>
  47. <if test="zolPersId != null and zolPersId != ''">and ZOL_PERS_ID = #{zolPersId}</if>
  48. <if test="informNum != null and informNum != ''">and INFORM_NUM = #{informNum}</if>
  49. <if test="inTm != null">and IN_TM = #{inTm}</if>
  50. <if test="upTm != null">and UP_TM = #{upTm}</if>
  51. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  52. </trim>
  53. </sql>
  54. <select id="get" resultMap="tacEvalationInformResultMap" parameterType="String" >
  55. select <include refid="table_columns" /> from TAC_EVALATION_INFORM where ID = #{id}
  56. </select>
  57. <select id="getBy" resultMap="tacEvalationInformResultMap">
  58. select <include refid="table_columns" /> from TAC_EVALATION_INFORM <include refid="page_where" />
  59. </select>
  60. <select id="findAll" resultMap="tacEvalationInformResultMap">
  61. select <include refid="table_columns" /> from TAC_EVALATION_INFORM
  62. </select>
  63. <select id="findList" resultMap="tacEvalationInformResultMap">
  64. select <include refid="table_columns" /> from TAC_EVALATION_INFORM <include refid="page_where" />
  65. </select>
  66. <select id="selectCount" resultType="int" >
  67. select count(ID) from TAC_EVALATION_INFORM <include refid="page_where" />
  68. </select>
  69. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacEvalationInform">
  70. insert into TAC_EVALATION_INFORM( <include refid="table_columns" /> )
  71. values ( <include refid="entity_properties" /> )
  72. </insert>
  73. <delete id="delete" parameterType="java.lang.String">
  74. delete from TAC_EVALATION_INFORM where ID = #{id}
  75. </delete>
  76. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacEvalationInform">
  77. delete from TAC_EVALATION_INFORM <include refid="page_where" />
  78. </delete>
  79. <update id="deleteInFlag" parameterType="java.lang.String">
  80. update TAC_EVALATION_INFORM set flag_valid = 0 where ID = #{id}
  81. </update>
  82. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacEvalationInform">
  83. update TAC_EVALATION_INFORM
  84. <trim prefix="set" suffixOverrides=",">
  85. <if test="type != null and type != ''">TYPE = #{type},</if>
  86. <if test="year != null and year != ''">YEAR = #{year},</if>
  87. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  88. <if test="cutTm != null">CUT_TM = #{cutTm},</if>
  89. <if test="zolPersId != null and zolPersId != ''">ZOL_PERS_ID = #{zolPersId},</if>
  90. <if test="informNum != null and informNum != ''">INFORM_NUM = #{informNum},</if>
  91. <if test="inTm != null">IN_TM = #{inTm},</if>
  92. <if test="upTm != null">UP_TM = #{upTm},</if>
  93. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  94. </trim>
  95. <where>ID = #{id}</where>
  96. </update>
  97. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacEvalationInform">
  98. update TAC_EVALATION_INFORM
  99. <trim prefix="set" suffixOverrides=",">
  100. <if test="type != null and type != ''">TYPE = #{type},</if>
  101. <if test="year != null and year != ''">YEAR = #{year},</if>
  102. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  103. <if test="cutTm != null">CUT_TM = #{cutTm},</if>
  104. <if test="zolPersId != null and zolPersId != ''">ZOL_PERS_ID = #{zolPersId},</if>
  105. <if test="informNum != null and informNum != ''">INFORM_NUM = #{informNum},</if>
  106. <if test="inTm != null">IN_TM = #{inTm},</if>
  107. <if test="upTm != null">UP_TM = #{upTm},</if>
  108. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  109. </trim>
  110. <include refid="page_where" />
  111. </update>
  112. <!-- 其他自定义SQL -->
  113. <select id="getInformList" resultType="cn.com.goldenwater.dcproj.dto.TacEvalationInformDto" parameterType="cn.com.goldenwater.dcproj.param.TacEvalationInformParam">
  114. select * from (
  115. select DISTINCT b.id,b.name,b.age,b.mobilenumb,b.ID_NO,b.role_type,
  116. (case when i.id is null then '0' else '1' end) as state,i.INFORM_NUM as count
  117. from tac_insp_year_batch_group_pers p left join tac_worker_b b on p.pers_id = b.id left join ( select * from TAC_EVALATION_INFORM
  118. t where 1=1
  119. <if test="year != null">
  120. and t.year = #{year}
  121. </if>
  122. <if test="batch != null">
  123. and t.batch = #{batch}
  124. </if>
  125. )i on b.id = i.ZOL_PERS_ID
  126. where 1=1 and b.id is not null
  127. <if test="year != null">
  128. and p.year = #{year}
  129. </if>
  130. <if test="batch != null">
  131. and p.batch = ${batch}
  132. </if>
  133. <if test="roleType != null and roleType != ''"> and b.role_type = #{roleType}</if>
  134. <if test="notRoleType != null and notRoleType != ''"> and p.role_type not in (${notRoleType})</if>
  135. <if test="name != null and name != ''"> and b.name like '%${name}%'</if>
  136. ) t where 1=1
  137. <if test="state != null and state != ''">
  138. and t.state = #{state}
  139. </if>
  140. </select>
  141. <select id="getInformListBySize" resultType="cn.com.goldenwater.dcproj.model.TacEvalationInform" parameterType="cn.com.goldenwater.dcproj.param.TacEvalationInformParam">
  142. select <include refid="table_columns" /> from TAC_EVALATION_INFORM
  143. where ZOL_PERS_ID in (select id from tac_worker_b where login_id = #{persId})
  144. <if test="year != null">
  145. and year = #{year}
  146. </if>
  147. <if test="size != null">
  148. and rowNum &lt; #{size}
  149. </if>
  150. </select>
  151. </mapper>