BizSqrEnterpriseApplyMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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="com.chinaitop.depot.sqr.mapper.BizSqrEnterpriseApplyMapper">
  4. <resultMap id="BaseResultMap" type="com.chinaitop.depot.sqr.model.vo.BizSqrEnterpriseApplyVO" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  7. <result column="create_user" property="createUser" jdbcType="VARCHAR" />
  8. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  9. <result column="update_user" property="updateUser" jdbcType="VARCHAR" />
  10. <result column="sqr_enterprise_id" property="sqrEnterpriseId" jdbcType="VARCHAR" />
  11. <result column="apply_type" property="applyType" jdbcType="INTEGER" />
  12. <result column="apply_status" property="applyStatus" jdbcType="INTEGER" />
  13. <result column="attachment" property="attachment" jdbcType="VARCHAR" />
  14. <result column="unitInfoId" property="unitInfoId" jdbcType="VARCHAR" />
  15. <result column="storage_expire_time" property="storageExpireTime" jdbcType="TIMESTAMP" />
  16. <result column="reissue_time" property="reissueTime" jdbcType="TIMESTAMP" />
  17. <result column="full_time_staff_count" property="fullTimeStaffCount" jdbcType="INTEGER" />
  18. <result column="certified_storekeeper_count" property="certifiedStorekeeperCount" jdbcType="INTEGER" />
  19. <result column="certified_inspector_count" property="certifiedInspectorCount" jdbcType="INTEGER" />
  20. <result column="warehouse_facility_situation" property="warehouseFacilitySituation" jdbcType="VARCHAR" />
  21. <result column="dwmc" property="dwmc" jdbcType="VARCHAR" />
  22. <result column="dwdm" property="dwdm" jdbcType="VARCHAR" />
  23. <result column="fddbr" property="fddbr" jdbcType="VARCHAR" />
  24. <result column="dwlx" property="dwlx" jdbcType="VARCHAR" />
  25. <result column="zcdz" property="zcdz" jdbcType="VARCHAR" />
  26. <result column="cfs" property="cfs" jdbcType="INTEGER" />
  27. <result column="ygs" property="ygs" jdbcType="INTEGER" />
  28. <result column="DICT_LABEL" property="dictLabel" jdbcType="VARCHAR" />
  29. <result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
  30. </resultMap>
  31. <sql id="Example_Where_Clause" >
  32. <where >
  33. <foreach collection="oredCriteria" item="criteria" separator="or" >
  34. <if test="criteria.valid" >
  35. <trim prefix="(" suffix=")" prefixOverrides="and" >
  36. <foreach collection="criteria.criteria" item="criterion" >
  37. <choose >
  38. <when test="criterion.noValue" >
  39. and ${criterion.condition}
  40. </when>
  41. <when test="criterion.singleValue" >
  42. and ${criterion.condition} #{criterion.value}
  43. </when>
  44. <when test="criterion.betweenValue" >
  45. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  46. </when>
  47. <when test="criterion.listValue" >
  48. and ${criterion.condition}
  49. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  50. #{listItem}
  51. </foreach>
  52. </when>
  53. </choose>
  54. </foreach>
  55. </trim>
  56. </if>
  57. </foreach>
  58. </where>
  59. </sql>
  60. <sql id="Update_By_Example_Where_Clause" >
  61. <where >
  62. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  63. <if test="criteria.valid" >
  64. <trim prefix="(" suffix=")" prefixOverrides="and" >
  65. <foreach collection="criteria.criteria" item="criterion" >
  66. <choose >
  67. <when test="criterion.noValue" >
  68. and ${criterion.condition}
  69. </when>
  70. <when test="criterion.singleValue" >
  71. and ${criterion.condition} #{criterion.value}
  72. </when>
  73. <when test="criterion.betweenValue" >
  74. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  75. </when>
  76. <when test="criterion.listValue" >
  77. and ${criterion.condition}
  78. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  79. #{listItem}
  80. </foreach>
  81. </when>
  82. </choose>
  83. </foreach>
  84. </trim>
  85. </if>
  86. </foreach>
  87. </where>
  88. </sql>
  89. <select id="findByPage" resultType="Map" resultMap="BaseResultMap">
  90. SELECT
  91. bgqa.id,A.id unitInfoId,A.dwmc,A.dwdm,A.fddbr,A.dwlx,A.DICT_LABEL,bgqa.apply_status,bgqa.apply_type,bgq.audit_status,bgqa.sqr_enterprise_id
  92. FROM
  93. province_all.biz_sqr_enterprise_apply bgqa
  94. LEFT JOIN(select bui.id,bui.dwmc,bui.dwdm,bui.fddbr,bui.dwlx,bui.zcdz,bui.cfs,bui.ygs,dict.DICT_LABEL from province_all.biz_unit_info bui left join province_all.dev_dict dict on bui.dwlx = dict.id)A ON bgqa.unit_info_id = A.id
  95. LEFT JOIN province_all.biz_audit_request bgq ON bgqa.id = bgq.request_id
  96. where bgqa.apply_type=#{applyType,jdbcType=INTEGER}
  97. <if test="dwmc != null and dwmc != ''">
  98. and bui.dwmc LIKE concat('%', #{dwmc}, '%')
  99. </if>
  100. ORDER BY bgqa.id desc
  101. </select>
  102. <select id="findById" resultType="Map" resultMap="BaseResultMap">
  103. SELECT DISTINCT
  104. bui.dwmc,
  105. bui.id unitInfoId,
  106. bui.dwdm,
  107. bui.fddbr,
  108. bui.dwlx,
  109. bui.zcdz,
  110. bui.cfs,
  111. bui.ygs,
  112. dict.DICT_LABEL,
  113. bse.certified_storekeeper_count,
  114. bse.certified_inspector_count,
  115. bse.warehouse_facility_situation,
  116. bse.full_time_staff_count,
  117. bse.storage_expire_time,
  118. bse.attachment attachment,
  119. SUM(oi.depot_area) depotArea,
  120. SUM(bs.actual_capacity)actualCapacity,
  121. bgqa.apply_status,bgqa.apply_type,bgqa.id
  122. FROM
  123. province_all.biz_unit_info bui
  124. LEFT JOIN province_all.dev_dict dict ON bui.dwlx = dict.id
  125. LEFT JOIN province_all.biz_sqr_enterprise bse ON bse.unit_info_id = bui.id
  126. left join province_all.biz_sqr_enterprise_apply bgqa on bgqa.sqr_enterprise_id =bse.id
  127. left join depot_qh.org_info oi on oi.unit_info_id=bui.id
  128. left join depot_qh.basic_storehouse bs on bs.org_id=oi.org_id
  129. WHERE
  130. bui.delete_flag = 'NOT_DELETE'
  131. and bui.id =#{unitInfoId,jdbcType=VARCHAR}
  132. </select>
  133. <select id="findById1" resultType="Map" resultMap="BaseResultMap">
  134. SELECT
  135. bgqa.id, A.dwmc,A.id unitInfoId, A.dwdm,A.fddbr,A.dwlx,A.zcdz,A.cfs,A.ygs,A.DICT_LABEL,bgqa.apply_status,bgqa.apply_type,
  136. bse.certified_storekeeper_count ,bse.certified_inspector_count ,bse.warehouse_facility_situation ,
  137. bse.full_time_staff_count ,bgqa.storage_expire_time ,bgqa.attachment attachment,bgqa.sqr_enterprise_id
  138. FROM
  139. province_all.biz_sqr_enterprise_apply bgqa
  140. left join province_all.biz_sqr_enterprise bse on bgqa.sqr_enterprise_id =bse.id
  141. left join(select bui.id,bui.dwmc,bui.dwdm,bui.fddbr,bui.dwlx,bui.zcdz,bui.cfs,bui.ygs,dict.DICT_LABEL from province_all.biz_unit_info bui left join province_all.dev_dict dict on bui.dwlx = dict.id
  142. <if test="unitInfoId != null and unitInfoId != ''">
  143. where bui.id =#{unitInfoId,jdbcType=VARCHAR}
  144. </if>
  145. )A on bgqa.unit_info_id = A.id
  146. where bgqa.id=#{id,jdbcType=INTEGER} and bgqa.apply_type=#{applyType,jdbcType=INTEGER}
  147. </select>
  148. <select id="findById4" resultType="Map" resultMap="BaseResultMap">
  149. SELECT
  150. bgqa.id, A.dwmc,A.id unitInfoId, A.dwdm,A.fddbr,A.dwlx,A.zcdz,A.cfs,A.ygs,A.DICT_LABEL,bgqa.apply_status,bgqa.apply_type,
  151. bgqa.certified_storekeeper_count ,bgqa.certified_inspector_count ,bgqa.warehouse_facility_situation ,bgqa.reissue_time,
  152. bgqa.full_time_staff_count ,bgqa.storage_expire_time ,bgqa.attachment attachment,bgqa.sqr_enterprise_id
  153. FROM
  154. province_all.biz_sqr_enterprise_apply bgqa
  155. left join province_all.biz_sqr_enterprise bse on bgqa.sqr_enterprise_id =bse.id
  156. left join(select bui.id,bui.dwmc,bui.dwdm,bui.fddbr,bui.dwlx,bui.zcdz,bui.cfs,bui.ygs,dict.DICT_LABEL from province_all.biz_unit_info bui left join province_all.dev_dict dict on bui.dwlx = dict.id
  157. <if test="unitInfoId != null and unitInfoId != ''">
  158. where bui.id =#{unitInfoId,jdbcType=VARCHAR}
  159. </if>
  160. )A on bgqa.unit_info_id = A.id
  161. where bgqa.id=#{id,jdbcType=INTEGER} and bgqa.apply_type=#{applyType,jdbcType=INTEGER}
  162. </select>
  163. <insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.chinaitop.depot.sqr.model.BizSqrEnterpriseApply">
  164. insert into province_all.biz_sqr_enterprise_apply (id,unit_info_id,apply_type,
  165. apply_status,storage_expire_time,attachment,sqr_enterprise_id,reissue_time,full_time_staff_count,
  166. certified_inspector_count,certified_storekeeper_count,warehouse_facility_situation,
  167. create_time,create_user,update_time,update_user)
  168. values (
  169. #{id,jdbcType=INTEGER},
  170. #{unitInfoId,jdbcType=VARCHAR},
  171. #{applyType,jdbcType=INTEGER},
  172. #{applyStatus,jdbcType=INTEGER},
  173. #{storageExpireTime,jdbcType=TIMESTAMP},
  174. #{attachment,jdbcType=VARCHAR},
  175. #{sqrEnterpriseId,jdbcType=VARCHAR},
  176. #{reissueTime,jdbcType=TIMESTAMP},
  177. #{fullTimeStaffCount,jdbcType=INTEGER},
  178. #{certifiedInspectorCount,jdbcType=INTEGER},
  179. #{certifiedStorekeeperCount,jdbcType=INTEGER},
  180. #{warehouseFacilitySituation,jdbcType=VARCHAR},
  181. #{createTime,jdbcType=TIMESTAMP},
  182. #{createUser,jdbcType=VARCHAR},
  183. #{updateTime,jdbcType=TIMESTAMP},
  184. #{updateUser,jdbcType=VARCHAR}
  185. )
  186. </insert>
  187. <select id="selectRequestfindByApplyId" resultType="java.lang.Integer">
  188. SELECT COUNT(*) FROM province_all.biz_audit_request WHERE type =3 and request_id=#{id,jdbcType=INTEGER}
  189. </select>
  190. <delete id="delete" parameterType="java.lang.Integer">
  191. DELETE FROM province_all.biz_sqr_enterprise_apply WHERE id = #{id,jdbcType=INTEGER}
  192. </delete>
  193. </mapper>