|
@@ -0,0 +1,162 @@
|
|
|
+<?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.fs.course.mapper.FsUserCompanyBindMapper">
|
|
|
+
|
|
|
+ <resultMap type="FsUserCompanyBind" id="FsUserCompanyBindResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="fsUserId" column="fs_user_id" />
|
|
|
+ <result property="companyUserId" column="company_user_id" />
|
|
|
+ <result property="companyId" column="company_id" />
|
|
|
+ <result property="projectId" column="project_id" />
|
|
|
+ <result property="qwUserId" column="qw_user_id" />
|
|
|
+ <result property="qwExternalContactId" column="qw_external_contact_id" />
|
|
|
+ <result property="qwCompanyId" column="qw_company_id" />
|
|
|
+ <result property="courseId" column="course_id" />
|
|
|
+ <result property="videoId" column="video_id" />
|
|
|
+ <result property="watchLogId" column="watch_log_id" />
|
|
|
+ <result property="logType" column="log_type" />
|
|
|
+ <result property="finishTime" column="finish_time" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectFsUserCompanyBindVo">
|
|
|
+ select id, fs_user_id, company_user_id, company_id, project_id, qw_user_id, qw_external_contact_id, qw_company_id, course_id, video_id, watch_log_id, log_type, finish_time, create_time, create_by, update_by, update_time, remark from fs_user_company_bind
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectFsUserCompanyBindList" parameterType="FsUserCompanyBind" resultMap="FsUserCompanyBindResult">
|
|
|
+ <include refid="selectFsUserCompanyBindVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="fsUserId != null "> and fs_user_id = #{fsUserId}</if>
|
|
|
+ <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
|
|
|
+ <if test="companyId != null "> and company_id = #{companyId}</if>
|
|
|
+ <if test="projectId != null "> and project_id = #{projectId}</if>
|
|
|
+ <if test="qwUserId != null "> and qw_user_id = #{qwUserId}</if>
|
|
|
+ <if test="qwExternalContactId != null "> and qw_external_contact_id = #{qwExternalContactId}</if>
|
|
|
+ <if test="qwCompanyId != null "> and qw_company_id = #{qwCompanyId}</if>
|
|
|
+ <if test="courseId != null "> and course_id = #{courseId}</if>
|
|
|
+ <if test="videoId != null "> and video_id = #{videoId}</if>
|
|
|
+ <if test="logType != null "> and log_type = #{logType}</if>
|
|
|
+ <if test="finishTime != null "> and finish_time = #{finishTime}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsUserCompanyBindById" parameterType="Long" resultMap="FsUserCompanyBindResult">
|
|
|
+ <include refid="selectFsUserCompanyBindVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertFsUserCompanyBind" parameterType="FsUserCompanyBind" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into fs_user_company_bind
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="fsUserId != null">fs_user_id,</if>
|
|
|
+ <if test="companyUserId != null">company_user_id,</if>
|
|
|
+ <if test="companyId != null">company_id,</if>
|
|
|
+ <if test="projectId != null">project_id,</if>
|
|
|
+ <if test="qwUserId != null">qw_user_id,</if>
|
|
|
+ <if test="qwExternalContactId != null">qw_external_contact_id,</if>
|
|
|
+ <if test="qwCompanyId != null">qw_company_id,</if>
|
|
|
+ <if test="courseId != null">course_id,</if>
|
|
|
+ <if test="videoId != null">video_id,</if>
|
|
|
+ <if test="watchLogId != null">watch_log_id,</if>
|
|
|
+ <if test="logType != null">log_type,</if>
|
|
|
+ <if test="finishTime != null">finish_time,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="fsUserId != null">#{fsUserId},</if>
|
|
|
+ <if test="companyUserId != null">#{companyUserId},</if>
|
|
|
+ <if test="companyId != null">#{companyId},</if>
|
|
|
+ <if test="projectId != null">#{projectId},</if>
|
|
|
+ <if test="qwUserId != null">#{qwUserId},</if>
|
|
|
+ <if test="qwExternalContactId != null">#{qwExternalContactId},</if>
|
|
|
+ <if test="qwCompanyId != null">#{qwCompanyId},</if>
|
|
|
+ <if test="courseId != null">#{courseId},</if>
|
|
|
+ <if test="videoId != null">#{videoId},</if>
|
|
|
+ <if test="watchLogId != null">#{watchLogId},</if>
|
|
|
+ <if test="logType != null">#{logType},</if>
|
|
|
+ <if test="finishTime != null">#{finishTime},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateFsUserCompanyBind" parameterType="FsUserCompanyBind">
|
|
|
+ update fs_user_company_bind
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
|
|
|
+ <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
|
|
|
+ <if test="companyId != null">company_id = #{companyId},</if>
|
|
|
+ <if test="projectId != null">project_id = #{projectId},</if>
|
|
|
+ <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
|
|
|
+ <if test="qwExternalContactId != null">qw_external_contact_id = #{qwExternalContactId},</if>
|
|
|
+ <if test="qwCompanyId != null">qw_company_id = #{qwCompanyId},</if>
|
|
|
+ <if test="courseId != null">course_id = #{courseId},</if>
|
|
|
+ <if test="videoId != null">video_id = #{videoId},</if>
|
|
|
+ <if test="watchLogId != null">watch_log_id = #{watchLogId},</if>
|
|
|
+ <if test="logType != null">log_type = #{logType},</if>
|
|
|
+ <if test="finishTime != null">finish_time = #{finishTime},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteFsUserCompanyBindById" parameterType="Long">
|
|
|
+ delete from fs_user_company_bind where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteFsUserCompanyBindByIds" parameterType="String">
|
|
|
+ delete from fs_user_company_bind where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="getWatchLogList" resultType="com.fs.course.vo.UserWatchLogListVo">
|
|
|
+ select
|
|
|
+ a.*,
|
|
|
+ b.nick_name fsUserName,
|
|
|
+ c.dict_label projectName,
|
|
|
+ e.course_name,
|
|
|
+ IF(g.company_user_id = #{userId}, g.qw_user_name, '其他') qwUserName,
|
|
|
+ f.title videoName
|
|
|
+ from
|
|
|
+ fs_user_company_bind a
|
|
|
+ left join fs_user b on a.fs_user_id = b.user_id
|
|
|
+ left join sys_dict_data c on c.dict_type = 'sys_course_project' and dict_value = a.project_id
|
|
|
+ left join fs_user_course e on a.course_id = e.course_id
|
|
|
+ left join fs_user_course_video f on a.video_id = f.video_id
|
|
|
+ left join qw_user g on g.id = a.qw_user_id
|
|
|
+ <where>
|
|
|
+ <if test="externalUserId != null">
|
|
|
+ and a.qw_external_contact_id = #{externalUserId}
|
|
|
+ </if>
|
|
|
+ <if test="fsUserId != null">
|
|
|
+ and a.fs_user_id = #{fsUserId}
|
|
|
+ </if>
|
|
|
+ <if test="courseId != null">
|
|
|
+ and a.course_id = #{courseId}
|
|
|
+ </if>
|
|
|
+ <if test="videoId != null">
|
|
|
+ and a.video_id = #{videoId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by create_time desc
|
|
|
+ </select>
|
|
|
+</mapper>
|