BisInspYearInfoDao.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.BisInspYearInfoDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspYearInfo" id="bisInspYearInfoResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="orgId" column="ORG_ID"/>
  7. <result property="adCode" column="AD_CODE"/>
  8. <result property="year" column="YEAR"/>
  9. <result property="yearBath" column="YEAR_BATH"/>
  10. <result property="yearGroup" column="YEAR_GROUP"/>
  11. <result property="persId" column="PERS_ID"/>
  12. <result property="intm" column="INTM"/>
  13. <result property="uptm" column="UPTM"/>
  14. <result property="note" column="NOTE"/>
  15. <result property="dataStat" column="DATA_STAT"/>
  16. </resultMap>
  17. <sql id="table_columns">
  18. ID,
  19. ORG_ID,
  20. AD_CODE,
  21. YEAR,
  22. YEAR_BATH,
  23. YEAR_GROUP,
  24. PERS_ID,
  25. INTM,
  26. UPTM,
  27. NOTE,
  28. DATA_STAT
  29. </sql>
  30. <sql id="entity_properties">
  31. #{id},
  32. #{orgId},
  33. #{adCode},
  34. #{year},
  35. #{yearBath},
  36. #{yearGroup},
  37. #{persId},
  38. #{intm},
  39. #{uptm},
  40. #{note},
  41. #{dataStat}
  42. </sql>
  43. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  44. <sql id="page_where">
  45. <trim prefix="where" prefixOverrides="and | or ">
  46. <if test="id != null and id != ''">and ID = #{id}</if>
  47. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  48. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%' </if>
  49. <if test="year != null and year != ''">and YEAR = #{year}</if>
  50. <if test="yearBath != null and yearBath != ''">and YEAR_BATH = #{yearBath}</if>
  51. <if test="yearGroup != null and yearGroup != ''">and YEAR_GROUP = #{yearGroup}</if>
  52. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  53. <if test="intm != null">and TO_CHAR(INTM, 'yyyy-MM-dd') = TO_CHAR(#{intm}, 'yyyy-MM-dd') </if>
  54. <if test="uptm != null">and TO_CHAR(UPTM, 'yyyy-MM-dd') = TO_CHAR(#{uptm}, 'yyyy-MM-dd')</if>
  55. <if test="note != null and note != ''">and NOTE = #{note}</if>
  56. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  57. </trim>
  58. </sql>
  59. <select id="get" resultMap="bisInspYearInfoResultMap" parameterType="String" >
  60. select <include refid="table_columns" /> from BIS_INSP_YEAR_INFO where ID = #{id}
  61. </select>
  62. <select id="getBy" resultMap="bisInspYearInfoResultMap">
  63. select <include refid="table_columns" /> from BIS_INSP_YEAR_INFO <include refid="page_where" />
  64. </select>
  65. <select id="findAll" resultMap="bisInspYearInfoResultMap">
  66. select <include refid="table_columns" /> from BIS_INSP_YEAR_INFO
  67. </select>
  68. <select id="findList" resultMap="bisInspYearInfoResultMap">
  69. select <include refid="table_columns" /> from BIS_INSP_YEAR_INFO <include refid="page_where" />
  70. </select>
  71. <select id="selectCount" resultType="int" >
  72. select count(ID) from BIS_INSP_YEAR_INFO <include refid="page_where" />
  73. </select>
  74. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspYearInfo">
  75. insert into BIS_INSP_YEAR_INFO( <include refid="table_columns" /> )
  76. values ( <include refid="entity_properties" /> )
  77. </insert>
  78. <delete id="delete" parameterType="java.lang.String">
  79. update BIS_INSP_YEAR_INFO set DATA_STAT='9' where ID = #{id}
  80. </delete>
  81. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspYearInfo">
  82. delete from BIS_INSP_YEAR_INFO <include refid="page_where" />
  83. </delete>
  84. <update id="deleteInFlag" parameterType="java.lang.String">
  85. update BIS_INSP_YEAR_INFO set DATA_STAT='9' where ID = #{id}
  86. </update>
  87. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspYearInfo">
  88. update BIS_INSP_YEAR_INFO
  89. <trim prefix="set" suffixOverrides=",">
  90. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  91. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  92. <if test="year != null and year != ''">YEAR = #{year},</if>
  93. <if test="yearBath != null and yearBath != ''">YEAR_BATH = #{yearBath},</if>
  94. <if test="yearGroup != null and yearGroup != ''">YEAR_GROUP = #{yearGroup},</if>
  95. <if test="uptm != null">UPTM = #{uptm},</if>
  96. <if test="note != null and note != ''">NOTE = #{note},</if>
  97. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  98. </trim>
  99. <where>ID = #{id}</where>
  100. </update>
  101. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspYearInfo">
  102. update BIS_INSP_YEAR_INFO
  103. <trim prefix="set" suffixOverrides=",">
  104. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  105. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  106. <if test="year != null and year != ''">YEAR = #{year},</if>
  107. <if test="yearBath != null and yearBath != ''">YEAR_BATH = #{yearBath},</if>
  108. <if test="yearGroup != null and yearGroup != ''">YEAR_GROUP = #{yearGroup},</if>
  109. <if test="uptm != null">UPTM = #{uptm},</if>
  110. <if test="note != null and note != ''">NOTE = #{note},</if>
  111. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  112. </trim>
  113. <include refid="page_where" />
  114. </update>
  115. <!-- 其他自定义SQL -->
  116. </mapper>