中扬CRM客户关系管理系统
#
luxiaotao1123
2022-09-16 17362f5075d91d26bca2231396c624902049e12d
src/main/resources/mapper/CstmrMapper.xml
@@ -33,8 +33,39 @@
    </resultMap>
    <select id="selectCstmrByNewestUuid" resultMap="BaseResultMap">
        select * from man_cstmr where 1=1 order by uuid + 0 desc
    <select id="selectByUuid" resultMap="BaseResultMap">
        select * from man_cstmr
        where 1=1
        and uuid = #{uuid}
        <if test="hostId != null">
            and host_id = #{hostId}
        </if>
    </select>
    <select id="selectCstmrByNewestUuid" resultMap="BaseResultMap">
        select top 1 * from man_cstmr
        where 1=1
        <if test="hostId != null">
            and host_id = #{hostId}
        </if>
        order by uuid + 0 desc
    </select>
    <select id="listByPage" resultMap="BaseResultMap">
        SELECT
        mc.*
        FROM man_cstmr mc
        LEFT JOIN sys_dept sd ON mc.dept_id = sd.id
        WHERE 1=1
        AND (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId})
        <if test="hostId != null and hostId != ''">
            and mc.host_id = #{hostId}
        </if>
        <if test="condition != null and condition != ''">
            and mc.name like concat('%',#{condition},'%')
        </if>
        ORDER BY mc.create_time DESC
    </select>
</mapper>