TaPersonIntentionRecordMapper.xml 1.2KB

12345678910111213141516171819202122232425262728293031323334
  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.huiju.estateagents.mapper.TaPersonIntentionRecordMapper">
  4. <select id="selectAll" resultType="com.huiju.estateagents.entity.TaPersonIntentionRecord">
  5. SELECT
  6. *,
  7. tp.phone as phone,
  8. SUM(tpir.intention) as intentionCount
  9. FROM
  10. ta_person_intention_record tpir
  11. LEFT JOIN ta_person tp ON tpir.person_id = tp.person_id
  12. GROUP BY tpir.person_id
  13. </select>
  14. <select id="selectIntentionUser" resultType="map">
  15. SELECT
  16. tpir.person_name as personName,
  17. tp.phone as phone,
  18. tpir.building_name as buildingName,
  19. SUM(tpir.intention) as intention
  20. FROM
  21. ta_person_intention_record tpir
  22. LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
  23. <where>
  24. <if test="buildingId != null and buildingId != ''">
  25. tpir.building_id = #{buildingId}
  26. </if>
  27. </where>
  28. GROUP BY
  29. tpir.person_id, tpir.building_id
  30. </select>
  31. </mapper>