<?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.crm.globex.dao.mapper.UserInfoMapper">
    <select id="getComment"
            resultType="String">
		SELECT
		if(sales.ib_no!=agent.ib_no,concat(
					sales.ib_no,
					'-',
					agent.ib_no
				), if(agent.ib_no=NULL,sales.ib_no,agent.ib_no))
				 AS comment
			FROM user_info agent
			LEFT JOIN user_info sales ON sales.id = agent.sales_id
			where  agent.id=#{agentId};
    </select>

</mapper>