TacProvincePlanDictDao.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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.TacProvincePlanDictDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacProvincePlanDict" id="tacProvincePlanDictResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="adCode" column="AD_CODE"/>
  7. <result property="persId" column="PERS_ID"/>
  8. <result property="intm" column="INTM"/>
  9. <result property="uptm" column="UPTM"/>
  10. <result property="note" column="NOTE"/>
  11. <result property="dataStat" column="DATA_STAT"/>
  12. <result property="state" column="STATE"/>
  13. <result property="orgId" column="ORG_ID"/>
  14. <result property="sortNo" column="SORT_NO"/>
  15. <result property="orgName" column="ORG_NAME"/>
  16. <result property="processName" column="PROCESS_NAME"/>
  17. <result property="processDesc" column="process_desc"/>
  18. </resultMap>
  19. <sql id="table_columns">
  20. ID,PROCESS_NAME,process_desc,
  21. AD_CODE,
  22. PERS_ID,
  23. INTM,
  24. UPTM,
  25. NOTE,
  26. DATA_STAT,
  27. STATE,
  28. ORG_ID,
  29. SORT_NO,
  30. ORG_NAME
  31. </sql>
  32. <sql id="entity_properties">
  33. #{id},#{processName},#{processDesc},
  34. #{adCode},
  35. #{persId},
  36. #{intm},
  37. #{uptm},
  38. #{note},
  39. #{dataStat},
  40. #{state},
  41. #{orgId},
  42. #{sortNo},
  43. #{orgName}
  44. </sql>
  45. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  46. <sql id="page_where">
  47. <trim prefix="where" prefixOverrides="and | or ">
  48. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  49. <if test="processName != null and processName != ''">and process_Name = #{processName}</if>
  50. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  51. <if test="intm != null">and INTM = #{intm}</if>
  52. <if test="uptm != null">and UPTM = #{uptm}</if>
  53. <if test="note != null and note != ''">and NOTE = #{note}</if>
  54. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  55. <if test="state != null and state != ''">and STATE = #{state}</if>
  56. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  57. <if test="sortNo != null and sortNo != ''">and SORT_NO = #{sortNo}</if>
  58. <if test="id != null and id != ''">and ID = #{id}</if>
  59. <if test="orgName != null and orgName != ''">and ORG_NAME = #{orgName}</if>
  60. <if test="processDesc != null and processDesc != ''">and process_Desc = #{processDesc}</if>
  61. </trim>
  62. </sql>
  63. <select id="findNotAddList" resultMap="tacProvincePlanDictResultMap" >
  64. select <include refid="table_columns" /> from TAC_PROVINCE_PLAN_DICT t where t.org_id=#{orgId} and t.ID not in (
  65. select now_id from TAC_PROVINCE_PLAN_PROCESS s where s.org_id=#{orgId}
  66. )
  67. </select>
  68. <select id="get" resultMap="tacProvincePlanDictResultMap" parameterType="String" >
  69. select <include refid="table_columns" /> from TAC_PROVINCE_PLAN_DICT where ID = #{id}
  70. </select>
  71. <select id="getMaxNextNo" resultType="int" parameterType="cn.com.goldenwater.dcproj.param.TacProvincePlanDictParam">
  72. select IFNULL(MAX(sort_no), 0) as sortNo from TAC_PROVINCE_PLAN_DICT <include refid="page_where" />
  73. </select>
  74. <select id="getBy" resultMap="tacProvincePlanDictResultMap">
  75. select <include refid="table_columns" /> from TAC_PROVINCE_PLAN_DICT <include refid="page_where" />
  76. </select>
  77. <select id="findAll" resultMap="tacProvincePlanDictResultMap">
  78. select <include refid="table_columns" /> from TAC_PROVINCE_PLAN_DICT
  79. </select>
  80. <select id="findList" resultMap="tacProvincePlanDictResultMap">
  81. select <include refid="table_columns" /> from TAC_PROVINCE_PLAN_DICT <include refid="page_where" />
  82. order by sort_no asc
  83. </select>
  84. <select id="selectCount" resultType="int" >
  85. select count(ID) from TAC_PROVINCE_PLAN_DICT <include refid="page_where" />
  86. </select>
  87. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacProvincePlanDict">
  88. insert into TAC_PROVINCE_PLAN_DICT( <include refid="table_columns" /> )
  89. values ( <include refid="entity_properties" /> )
  90. </insert>
  91. <delete id="delete" parameterType="java.lang.String">
  92. delete from TAC_PROVINCE_PLAN_DICT where ID = #{id}
  93. </delete>
  94. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacProvincePlanDict">
  95. delete from TAC_PROVINCE_PLAN_DICT <include refid="page_where" />
  96. </delete>
  97. <update id="deleteInFlag" parameterType="java.lang.String">
  98. update TAC_PROVINCE_PLAN_DICT set flag_valid = 0 where ID = #{id}
  99. </update>
  100. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacProvincePlanDict">
  101. update TAC_PROVINCE_PLAN_DICT
  102. <trim prefix="set" suffixOverrides=",">
  103. <if test="processName != null and processName != ''"> process_Name = #{processName},</if>
  104. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  105. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  106. <if test="intm != null">INTM = #{intm},</if>
  107. <if test="uptm != null">UPTM = #{uptm},</if>
  108. <if test="note != null and note != ''">NOTE = #{note},</if>
  109. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  110. <if test="state != null and state != ''">STATE = #{state},</if>
  111. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  112. <if test="sortNo != null and sortNo != ''">SORT_NO = #{sortNo},</if>
  113. <if test="orgName != null and orgName != ''">ORG_NAME = #{orgName},</if>
  114. <if test="processDesc != null and processDesc != ''"> process_Desc = #{processDesc},</if>
  115. </trim>
  116. <where>ID = #{id}</where>
  117. </update>
  118. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacProvincePlanDict">
  119. update TAC_PROVINCE_PLAN_DICT
  120. <trim prefix="set" suffixOverrides=",">
  121. <if test="processName != null and processName != ''"> process_Name = #{processName},</if>
  122. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  123. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  124. <if test="intm != null">INTM = #{intm},</if>
  125. <if test="uptm != null">UPTM = #{uptm},</if>
  126. <if test="note != null and note != ''">NOTE = #{note},</if>
  127. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  128. <if test="state != null and state != ''">STATE = #{state},</if>
  129. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  130. <if test="sortNo != null and sortNo != ''">SORT_NO = #{sortNo},</if>
  131. <if test="orgName != null and orgName != ''">ORG_NAME = #{orgName},</if>
  132. <if test="processDesc != null and processDesc != ''"> process_Desc = #{processDesc},</if>
  133. </trim>
  134. <include refid="page_where" />
  135. </update>
  136. <!-- 其他自定义SQL -->
  137. <select id="getJcStepId" resultType="String">
  138. SELECT NOW_ID
  139. FROM TAC_PROVINCE_PLAN_PROCESS
  140. WHERE NEXT_ID = '1'
  141. <if test="orgId != null and orgId != ''">AND ORG_ID = #{orgId}</if>
  142. <if test="province != null and province != ''">AND AD_CODE LIKE '${province}%'</if>
  143. </select>
  144. <select id="getJcStepIdZj" resultType="String">
  145. SELECT NOW_ID FROM TAC_PROVINCE_PLAN_PROCESS
  146. WHERE NEXT_ID=(
  147. SELECT NOW_ID FROM TAC_PROVINCE_PLAN_PROCESS
  148. WHERE NEXT_ID = '1'
  149. <if test="orgId != null and orgId != ''">AND ORG_ID = #{orgId}</if>
  150. <if test="province != null and province != ''">AND AD_CODE LIKE '${province}%'</if>
  151. )
  152. </select>
  153. </mapper>