MyAppMapper.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233
  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.MyAppMapper">
  4. <select id="countCollections" parameterType="String" resultType="org.springframework.ui.ModelMap">
  5. select
  6. (select count(1) from achievement_interest ai where ai.uid=#{uid,jdbcType=VARCHAR}) as achievement,
  7. (select count(1) from demand_interest di where di.uid=#{uid,jdbcType=VARCHAR}) as demand,
  8. (SELECT count(1) FROM user_interest uin left join user u on uin.to_uid=u.id where u.type=0 and uin.from_uid=#{uid,jdbcType=VARCHAR}) as expert,
  9. (SELECT count(1) FROM user_interest uin left join organization_info oi on uin.to_uid=oi.uid where oi.identity_type='企业' and uin.from_uid=#{uid,jdbcType=VARCHAR}) as company,
  10. (SELECT count(1) FROM user_interest uin left join organization_info oi on uin.to_uid=oi.uid where oi.identity_type='院校' and uin.from_uid=#{uid,jdbcType=VARCHAR}) as school,
  11. (SELECT count(1) FROM user_interest uin left join organization_info oi on uin.to_uid=oi.uid where oi.identity_type='研究机构' and uin.from_uid=#{uid,jdbcType=VARCHAR}) as institute
  12. </select>
  13. <select id="countOrders" parameterType="String" resultType="org.springframework.ui.ModelMap">
  14. select
  15. (select count(1) from org_cognizance where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as hightech,
  16. (select count(1) from tech_project where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as program,
  17. (SELECT count(1) FROM patent_info where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as patent,
  18. (SELECT count(1) FROM value_evaluation where uid=#{uid,jdbcType=VARCHAR}) as evalution,
  19. (SELECT count(1) FROM activity_user where uid=#{uid,jdbcType=VARCHAR}) as activity,
  20. (SELECT count(1) FROM demand_order where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as demand,
  21. (SELECT count(1) FROM copyright_info where uid=#{uid,jdbcType=VARCHAR} and delete_sign=0) as copyright
  22. </select>
  23. <select id="countMyTech" parameterType="String" resultType="org.springframework.ui.ModelMap">
  24. select
  25. (select count(1) from achievement a left join achievement_demand ad on a.id=ad.achievement_id where ad.demand_id is not null and a.owner_id=#{uid,jdbcType=VARCHAR}) as `match`
  26. </select>
  27. <select id="countMyDemand" parameterType="String" resultType="org.springframework.ui.ModelMap">
  28. select
  29. (select count(1) from demand d left join achievement_demand ad on d.id=ad.demand_id where ad.demand_id is not null and d.employer_id=#{uid,jdbcType=VARCHAR}) as `match`,
  30. (select count(1) from demand d left join demand_order `do` on d.id=`do`.demand_id where d.employer_id=#{uid,jdbcType=VARCHAR} and `do`.status <![CDATA[ > ]]> 5 and (`do`.service_money <![CDATA[ > ]]> 0 or `do`.commission <![CDATA[ > ]]> 0 or `do`.intention_money <![CDATA[ > ]]> 0)) as `deal`,
  31. (select count(1) from demand d left join demand_order `ido` on d.id=`ido`.demand_id where d.employer_id=#{uid,jdbcType=VARCHAR} and `ido`.status <![CDATA[ < ]]> 6) as `intention`
  32. </select>
  33. </mapper>