<?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.ruixuan.salesLeads.mapper.SaleClueCallRecordMapper">


	<!--  -->
	<insert id="addSaleCallRecord">
		replace into sale_clue_call_record(
		content
	)
		values
			(
			#{content}

			)

	</insert>


<!-- 查询 导入记录-->
	<select id="getSaleClueCallRecordInfo" resultType="com.ruixuan.salesLeads.pojo.SaleClueCallRecordPojo">
		SELECT
		id,content,create_user_id,create_time,task_id,
		(SELECT u.nick_name from sys_user u where u.user_id = create_user_id) createUserName
		FROM
		sale_clue_call_record
		ORDER BY create_time DESC
	</select>

<!-- 查询 最新 导入记录-->
	<select id="selectCallRecordInfo" resultType="com.ruixuan.salesLeads.pojo.SaleClueCallRecordPojo">
		SELECT
		id,content,create_user_id,create_time,task_id,
		(SELECT u.nick_name from sys_user u where u.user_id = create_user_id) createUserName
		FROM
		sale_clue_call_record
		ORDER BY create_time DESC
		limit 1
	</select>


	<!-- 修改用户id -->
	<update id="updateCallRecordUser">
		UPDATE sale_clue_call_record
		SET create_user_id = #{userId},
		    task_id = #{taskId}
			ORDER BY
		create_time DESC
		LIMIT 1
	</update>



</mapper> 