OrganizationInfoMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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.goafanti.common.dao.OrganizationInfoMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.OrganizationInfo" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="identity_type" property="identityType" jdbcType="VARCHAR" />
  8. <result column="company_name" property="companyName" jdbcType="VARCHAR" />
  9. <result column="location_province" property="locationProvince" jdbcType="INTEGER" />
  10. <result column="location_city" property="locationCity" jdbcType="INTEGER" />
  11. <result column="location_area" property="locationArea" jdbcType="INTEGER" />
  12. <result column="unit_size" property="unitSize" jdbcType="VARCHAR" />
  13. <result column="company_introduction" property="companyIntroduction" jdbcType="VARCHAR" />
  14. <result column="home_unit" property="homeUnit" jdbcType="VARCHAR" />
  15. <result column="logo_url" property="logoUrl" jdbcType="VARCHAR" />
  16. <result column="publicity_picture_url" property="publicityPictureUrl" jdbcType="VARCHAR" />
  17. <result column="country_name_zh" jdbcType="VARCHAR" property="countryNameZh" />
  18. <result column="company_type" property="companyType" jdbcType="INTEGER"/>
  19. </resultMap>
  20. <sql id="Base_Column_List" >
  21. id, uid, identity_type, company_name, location_province, location_city,location_area,
  22. unit_size, company_introduction,
  23. home_unit, logo_url, publicity_picture_url,country_name_zh,company_type
  24. </sql>
  25. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  26. select
  27. <include refid="Base_Column_List" />
  28. from organization_info
  29. where id = #{id,jdbcType=VARCHAR}
  30. </select>
  31. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  32. delete from organization_info
  33. where id = #{id,jdbcType=VARCHAR}
  34. </delete>
  35. <insert id="insert" parameterType="com.goafanti.common.model.OrganizationInfo" >
  36. insert into organization_info (id, uid, identity_type,
  37. company_name, location_province, location_city,location_area,
  38. unit_size,
  39. company_introduction, home_unit,
  40. logo_url, publicity_picture_url,country_name_zh,company_type)
  41. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{identityType,jdbcType=VARCHAR},
  42. #{companyName,jdbcType=VARCHAR},
  43. #{locationProvince,jdbcType=INTEGER}, #{locationCity,jdbcType=INTEGER}, #{locationArea,jdbcType=INTEGER},
  44. #{unitSize,jdbcType=VARCHAR},
  45. #{companyIntroduction,jdbcType=VARCHAR}, #{homeUnit,jdbcType=VARCHAR},
  46. #{logoUrl,jdbcType=VARCHAR}, #{publicityPictureUrl,jdbcType=VARCHAR}, #{countryNameZh,jdbcType=VARCHAR},
  47. #{companyType,jdbcType=INTEGER})
  48. </insert>
  49. <insert id="insertSelective" parameterType="com.goafanti.common.model.OrganizationInfo" >
  50. insert into organization_info
  51. <trim prefix="(" suffix=")" suffixOverrides="," >
  52. <if test="id != null" >
  53. id,
  54. </if>
  55. <if test="uid != null" >
  56. uid,
  57. </if>
  58. <if test="identityType != null" >
  59. identity_type,
  60. </if>
  61. <if test="companyName != null" >
  62. company_name,
  63. </if>
  64. <if test="locationProvince != null" >
  65. location_province,
  66. </if>
  67. <if test="locationCity != null" >
  68. location_city,
  69. </if>
  70. <if test="locationArea != null" >
  71. location_area,
  72. </if>
  73. <if test="unitSize != null" >
  74. unit_size,
  75. </if>
  76. <if test="companyIntroduction != null" >
  77. company_introduction,
  78. </if>
  79. <if test="homeUnit != null" >
  80. home_unit,
  81. </if>
  82. <if test="logoUrl != null" >
  83. logo_url,
  84. </if>
  85. <if test="publicityPictureUrl != null" >
  86. publicity_picture_url,
  87. </if>
  88. <if test="countryNameZh != null">
  89. country_name_zh,
  90. </if>
  91. <if test="companyType != null">
  92. company_type,
  93. </if>
  94. </trim>
  95. <trim prefix="values (" suffix=")" suffixOverrides="," >
  96. <if test="id != null" >
  97. #{id,jdbcType=VARCHAR},
  98. </if>
  99. <if test="uid != null" >
  100. #{uid,jdbcType=VARCHAR},
  101. </if>
  102. <if test="identityType != null" >
  103. #{identityType,jdbcType=VARCHAR},
  104. </if>
  105. <if test="companyName != null" >
  106. #{companyName,jdbcType=VARCHAR},
  107. </if>
  108. <if test="locationProvince != null" >
  109. #{locationProvince,jdbcType=INTEGER},
  110. </if>
  111. <if test="locationCity != null" >
  112. #{locationCity,jdbcType=INTEGER},
  113. </if>
  114. <if test="locationArea != null" >
  115. #{locationArea,jdbcType=INTEGER},
  116. </if>
  117. <if test="unitSize != null" >
  118. #{unitSize,jdbcType=VARCHAR},
  119. </if>
  120. <if test="companyIntroduction != null" >
  121. #{companyIntroduction,jdbcType=VARCHAR},
  122. </if>
  123. <if test="homeUnit != null" >
  124. #{homeUnit,jdbcType=VARCHAR},
  125. </if>
  126. <if test="logoUrl != null" >
  127. #{logoUrl,jdbcType=VARCHAR},
  128. </if>
  129. <if test="publicityPictureUrl != null" >
  130. #{publicityPictureUrl,jdbcType=VARCHAR},
  131. </if>
  132. <if test="countryNameZh != null">
  133. #{countryNameZh,jdbcType=VARCHAR},
  134. </if>
  135. <if test="companyType != null">
  136. #{companyType,jdbcType=INTEGER}
  137. </if>
  138. </trim>
  139. </insert>
  140. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrganizationInfo" >
  141. update organization_info
  142. <set >
  143. <if test="uid != null" >
  144. uid = #{uid,jdbcType=VARCHAR},
  145. </if>
  146. <if test="identityType != null" >
  147. identity_type = #{identityType,jdbcType=VARCHAR},
  148. </if>
  149. <if test="companyName != null" >
  150. company_name = #{companyName,jdbcType=VARCHAR},
  151. </if>
  152. <if test="locationProvince != null" >
  153. location_Province = #{locationProvince,jdbcType=INTEGER},
  154. </if>
  155. <if test="locationCity != null" >
  156. location_City = #{locationCity,jdbcType=INTEGER},
  157. </if>
  158. <if test="locationArea != null" >
  159. location_Area = #{locationArea,jdbcType=INTEGER},
  160. </if>
  161. <if test="unitSize != null" >
  162. unit_size = #{unitSize,jdbcType=VARCHAR},
  163. </if>
  164. <if test="companyIntroduction != null" >
  165. company_introduction = #{companyIntroduction,jdbcType=VARCHAR},
  166. </if>
  167. <if test="homeUnit != null" >
  168. home_unit = #{homeUnit,jdbcType=VARCHAR},
  169. </if>
  170. <if test="logoUrl != null" >
  171. logo_url = #{logoUrl,jdbcType=VARCHAR},
  172. </if>
  173. <if test="publicityPictureUrl != null" >
  174. publicity_picture_url = #{publicityPictureUrl,jdbcType=VARCHAR},
  175. </if>
  176. <if test="countryNameZh != null">
  177. country_name_zh = #{countryNameZh,jdbcType=VARCHAR},
  178. </if>
  179. <if test="companyType != null">
  180. company_type = #{companyType,jdbcType=INTEGER}
  181. </if>
  182. </set>
  183. where id = #{id,jdbcType=VARCHAR}
  184. </update>
  185. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrganizationInfo" >
  186. update organization_info
  187. set uid = #{uid,jdbcType=VARCHAR},
  188. identity_type = #{identityType,jdbcType=VARCHAR},
  189. company_name = #{companyName,jdbcType=VARCHAR},
  190. location_province = #{locationProvince,jdbcType=INTEGER},
  191. location_city = #{locationCity,jdbcType=INTEGER},
  192. location_area = #{locationArea,jdbcType=INTEGER},
  193. unit_size = #{unitSize,jdbcType=VARCHAR},
  194. company_introduction = #{companyIntroduction,jdbcType=VARCHAR},
  195. home_unit = #{homeUnit,jdbcType=VARCHAR},
  196. logo_url = #{logoUrl,jdbcType=VARCHAR},
  197. publicity_picture_url = #{publicityPictureUrl,jdbcType=VARCHAR},
  198. country_name_zh = #{countryNameZh,jdbcType=VARCHAR},
  199. company_typ e= #{companyType,jdbcType=INTEGER}
  200. where id = #{id,jdbcType=VARCHAR}
  201. </update>
  202. <select id="selectOrgInfoByUserId" parameterType="java.lang.String" resultMap="BaseResultMap">
  203. select
  204. <include refid="Base_Column_List" />
  205. from organization_info
  206. where uid = #{uid,jdbcType=VARCHAR}
  207. </select>
  208. <select id="selectRecommendCompany" resultType="com.goafanti.portal.bo.FinancialListBo">
  209. select
  210. b.id,
  211. b.company_name as companyName,
  212. b.logo_url as logoUrl,
  213. b.publicity_picture_url as publicityPictureUrl,
  214. b.company_introduction as companyIntroduction
  215. from
  216. user a
  217. left join
  218. organization_info b
  219. on
  220. a.id = b.uid
  221. left join
  222. user_identity c
  223. on
  224. a.id = c.uid
  225. where b.id is not null
  226. and c.audit_status = 5 and a.type = 1 and b.identity_type = '企业' <!-- and b.company_type = 1 -->
  227. order by
  228. a.create_time asc
  229. limit 0,10
  230. </select>
  231. <select id="selectFinancialByPage" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.FinancialListBo">
  232. select
  233. b.id,
  234. b.company_name as companyName,
  235. b.logo_url as logoUrl,
  236. b.publicity_picture_url as publicityPictureUrl,
  237. b.company_introduction as companyIntroduction
  238. from
  239. user a
  240. left join
  241. organization_info b
  242. on
  243. a.id = b.uid
  244. left join
  245. user_identity c
  246. on
  247. a.id = c.uid
  248. where
  249. a.type = 1 and b.id is not null
  250. <!-- and c.audit_status = 5 -->
  251. and a.type = 1 and b.identity_type = '企业' and b.company_type = 1
  252. <if test="provinceId != null and provinceId != ''">
  253. and b.location_province = #{provinceId,jdbcType=VARCHAR}
  254. </if>
  255. <if test="keyword != null and keyword !=''">
  256. and b.company_name like concat('%',#{keyword},'%')
  257. </if>
  258. order by
  259. a.create_time desc
  260. <if test="page_sql != null">
  261. ${page_sql}
  262. </if>
  263. </select>
  264. <select id="selectFinancialCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  265. select
  266. count(0)
  267. from
  268. user a
  269. left join
  270. organization_info b
  271. on
  272. a.id = b.uid
  273. left join
  274. user_identity c
  275. on
  276. a.id = c.uid
  277. where
  278. a.type = 1 and b.id is not null
  279. <!-- and c.audit_status = 5 -->
  280. and a.type = 1 and b.identity_type = '企业' and b.company_type = 1
  281. <if test="provinceId != null and provinceId != ''">
  282. and b.location_province = #{provinceId,jdbcType=VARCHAR}
  283. </if>
  284. <if test="keyword != null and keyword !=''">
  285. and b.company_name like concat('%',#{keyword},'%')
  286. </if>
  287. </select>
  288. <select id="selectCompanyDetai" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.FinancialListBo">
  289. select
  290. b.company_name as companyName,
  291. b.logo_url as logoUrl,
  292. b.publicity_picture_url as publicityPictureUrl,
  293. b.company_introduction as companyIntroduction,
  294. d.ability_label as abilityLabel,
  295. e.name as companyLocation
  296. from user a
  297. left join organization_info b on a.id = b.uid
  298. left join user_identity c on a.id = c.uid
  299. left join user_ability d on a.id = d.uid
  300. left join district_glossory e on b.location_province = e.id
  301. where b.id = #{organizationId,jdbcType=VARCHAR}
  302. </select>
  303. </mapper>