TacInspYearBatchReasonDao.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.TacInspYearBatchReasonDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacInspYearBatchReason" id="tacInspYearBatchReasonResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="persId" column="PERS_ID"/>
  7. <result property="yearBatchId" column="YEAR_BATCH_ID"/>
  8. <result property="year" column="YEAR"/>
  9. <result property="batch" column="BATCH"/>
  10. <result property="roleType" column="ROLE_TYPE"/>
  11. <result property="ninReason" column="NIN_REASON"/>
  12. <result property="persId2" column="PERS_ID2"/>
  13. <result property="inTm" column="IN_TM"/>
  14. <result property="upTm" column="UP_TM"/>
  15. </resultMap>
  16. <sql id="table_columns">
  17. ID,
  18. PERS_ID,
  19. YEAR_BATCH_ID,
  20. YEAR,
  21. BATCH,
  22. ROLE_TYPE,
  23. NIN_REASON,
  24. PERS_ID2,
  25. IN_TM,
  26. UP_TM
  27. </sql>
  28. <sql id="entity_properties">
  29. #{id},
  30. #{persId},
  31. #{yearBatchId},
  32. #{year},
  33. #{batch},
  34. #{roleType},
  35. #{ninReason},
  36. #{persId2},
  37. #{inTm},
  38. #{upTm}
  39. </sql>
  40. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  41. <sql id="page_where">
  42. <trim prefix="where" prefixOverrides="and | or ">
  43. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  44. <if test="yearBatchId != null and yearBatchId != ''">and YEAR_BATCH_ID = #{yearBatchId}</if>
  45. <if test="year != null and year != ''">and YEAR = #{year}</if>
  46. <if test="batch != null and batch != ''">and BATCH = #{batch}</if>
  47. <if test="roleType != null and roleType != ''">and ROLE_TYPE = #{roleType}</if>
  48. <if test="ninReason != null and ninReason != ''">and NIN_REASON = #{ninReason}</if>
  49. <if test="persId2 != null and persId2 != ''">and PERS_ID2 = #{persId2}</if>
  50. <if test="inTm != null">and IN_TM = #{inTm}</if>
  51. <if test="upTm != null">and UP_TM = #{upTm}</if>
  52. </trim>
  53. </sql>
  54. <select id="get" resultMap="tacInspYearBatchReasonResultMap" parameterType="String" >
  55. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_REASON where ID = #{id}
  56. </select>
  57. <select id="getBy" resultMap="tacInspYearBatchReasonResultMap">
  58. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_REASON <include refid="page_where" />
  59. </select>
  60. <select id="findAll" resultMap="tacInspYearBatchReasonResultMap">
  61. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_REASON
  62. </select>
  63. <select id="findList" resultMap="tacInspYearBatchReasonResultMap">
  64. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_REASON <include refid="page_where" />
  65. </select>
  66. <select id="selectCount" resultType="int" >
  67. select count(ID) from TAC_INSP_YEAR_BATCH_REASON <include refid="page_where" />
  68. </select>
  69. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchReason">
  70. insert into TAC_INSP_YEAR_BATCH_REASON( <include refid="table_columns" /> )
  71. values ( <include refid="entity_properties" /> )
  72. </insert>
  73. <delete id="delete" parameterType="java.lang.String">
  74. delete from TAC_INSP_YEAR_BATCH_REASON where ID = #{id}
  75. </delete>
  76. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchReason">
  77. delete from TAC_INSP_YEAR_BATCH_REASON <include refid="page_where" />
  78. </delete>
  79. <update id="deleteInFlag" parameterType="java.lang.String">
  80. update TAC_INSP_YEAR_BATCH_REASON set flag_valid = 0 where ID = #{id}
  81. </update>
  82. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchReason">
  83. update TAC_INSP_YEAR_BATCH_REASON
  84. <trim prefix="set" suffixOverrides=",">
  85. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  86. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  87. <if test="year != null and year != ''">YEAR = #{year},</if>
  88. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  89. <if test="roleType != null and roleType != ''">ROLE_TYPE = #{roleType},</if>
  90. <if test="ninReason != null and ninReason != ''">NIN_REASON = #{ninReason},</if>
  91. <if test="persId2 != null and persId2 != ''">PERS_ID2 = #{persId2},</if>
  92. <if test="inTm != null">IN_TM = #{inTm},</if>
  93. <if test="upTm != null">UP_TM = #{upTm},</if>
  94. </trim>
  95. <where>ID = #{id}</where>
  96. </update>
  97. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchReason">
  98. update TAC_INSP_YEAR_BATCH_REASON
  99. <trim prefix="set" suffixOverrides=",">
  100. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  101. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  102. <if test="year != null and year != ''">YEAR = #{year},</if>
  103. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  104. <if test="roleType != null and roleType != ''">ROLE_TYPE = #{roleType},</if>
  105. <if test="ninReason != null and ninReason != ''">NIN_REASON = #{ninReason},</if>
  106. <if test="persId2 != null and persId2 != ''">PERS_ID2 = #{persId2},</if>
  107. <if test="inTm != null">IN_TM = #{inTm},</if>
  108. <if test="upTm != null">UP_TM = #{upTm},</if>
  109. </trim>
  110. <include refid="page_where" />
  111. </update>
  112. <!-- 其他自定义SQL -->
  113. <select id="getReasonList" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchReason" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchReasonParam">
  114. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_REASON t
  115. where 1=1
  116. <if test="year != null">
  117. and t.year = #{year}
  118. </if>
  119. <if test="persId2 != null and persId2 != ''">
  120. and t.pers_Id2 = #{persId2}
  121. </if>
  122. </select>
  123. </mapper>