ContactsMapper.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.management.platform.mapper.ContactsMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.management.platform.entity.Contacts">
  6. <id column="id" property="id" />
  7. <result column="company_id" property="companyId" />
  8. <result column="sex" property="sex" />
  9. <result column="name" property="name" />
  10. <result column="custom_id" property="customId" />
  11. <result column="email" property="email" />
  12. <result column="phone" property="phone" />
  13. <result column="owner_id" property="ownerId" />
  14. <result column="creator_id" property="creatorId" />
  15. <result column="address" property="address" />
  16. <result column="remark" property="remark" />
  17. <result column="is_delete" property="isDelete" />
  18. <result column="create_time" property="createTime" />
  19. <result column="range" property="range" />
  20. <result column="plate1" property="plate1" />
  21. <result column="plate2" property="plate2" />
  22. <result column="plate3" property="plate3" />
  23. <result column="plate4" property="plate4" />
  24. <result column="plate5" property="plate5" />
  25. </resultMap>
  26. <!-- 通用查询结果列 -->
  27. <sql id="Base_Column_List">
  28. id, company_id, sex, name, custom_id, email, phone, owner_id, creator_id, address, remark, is_delete, create_time, range, plate1, plate2, plate3, plate4, plate5
  29. </sql>
  30. <select id="pageContacts" parameterType="java.util.Map" resultType="com.management.platform.entity.vo.ContactsVo">
  31. SELECT c.*, cust.custom_name as customName, own.name as ownerName
  32. FROM contacts c
  33. LEFT JOIN custom cust ON c.custom_id = cust.id
  34. LEFT JOIN user own ON c.owner_id = own.id
  35. <where>
  36. <if test="map.isDelete != null ">
  37. AND c.is_delete =#{map.isDelete}
  38. </if>
  39. <if test="map.customName != null and map.customName != ''">
  40. AND cust.custom_name LIKE CONCAT('%', #{map.customName}, '%')
  41. </if>
  42. <if test="map.ownerName != null and map.ownerName != ''">
  43. AND own.name LIKE CONCAT('%', #{map.ownerName}, '%')
  44. </if>
  45. <if test="map.creatorName != null and map.creatorName != ''">
  46. AND own.name LIKE CONCAT('%', #{map.creatorName}, '%')
  47. </if>
  48. <if test="map.phone != null and map.phone != ''">
  49. AND c.phone LIKE CONCAT('%', #{map.phone}, '%')
  50. </if>
  51. <if test="map.name != null and map.name != ''">
  52. AND c.name LIKE CONCAT('%', #{map.name}, '%')
  53. </if>
  54. <if test="map.email != null and map.email != ''">
  55. AND c.email LIKE CONCAT('%', #{map.email}, '%')
  56. </if>
  57. <if test="map.companyId != null">
  58. AND c.company_id=#{map.companyId}
  59. </if>
  60. </where>
  61. order by create_time desc
  62. </select>
  63. </mapper>