123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.management.platform.mapper.ContactsMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.management.platform.entity.Contacts">
- <id column="id" property="id" />
- <result column="company_id" property="companyId" />
- <result column="name" property="name" />
- <result column="custom_id" property="customId" />
- <result column="email" property="email" />
- <result column="phone" property="phone" />
- <result column="owner_id" property="ownerId" />
- <result column="plate1" property="plate1" />
- <result column="plate2" property="plate2" />
- <result column="plate3" property="plate3" />
- <result column="plate4" property="plate4" />
- <result column="plate5" property="plate5" />
- <result column="is_delete" property="isDelete" />
- <result column="create_time" property="createTime" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, company_id, name, custom_id, email, phone, owner_id, plate1, plate2, plate3, plate4, plate5, is_delete, create_time
- </sql>
- <select id="pageContacts" parameterType="java.util.Map" resultType="com.management.platform.entity.vo.ContactsVo">
- SELECT c.*, cust.custom_name as customName, own.name as ownerName
- FROM contacts c
- LEFT JOIN custom cust ON c.custom_id = cust.id
- LEFT JOIN user own ON c.owner_id = own.id
- <where>
- <if test="map.isDelete != null ">
- AND c.is_delete =#{map.isDelete}
- </if>
- <if test="map.customName != null and map.customName != ''">
- AND cust.custom_name LIKE CONCAT('%', #{map.customName}, '%')
- </if>
- <if test="map.ownerName != null and map.ownerName != ''">
- AND own.name LIKE CONCAT('%', #{map.ownerName}, '%')
- </if>
- <if test="map.phone != null and map.phone != ''">
- AND c.phone LIKE CONCAT('%', #{map.phone}, '%')
- </if>
- <if test="map.name != null and map.name != ''">
- AND c.name LIKE CONCAT('%', #{map.name}, '%')
- </if>
- <if test="map.companyId != null">
- AND c.company_id=#{map.companyId}
- </if>
- </where>
- order by create_time desc
- </select>
- </mapper>
|