123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?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.qw.mapper.QwContactWayLogsMapper">
- <resultMap type="QwContactWayLogs" id="QwContactWayLogsResult">
- <result property="id" column="id" />
- <result property="wayId" column="way_id" />
- <result property="userId" column="user_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="type" column="type" />
- <result property="msg" column="msg" />
- <result property="corpId" column="corp_id" />
- <result property="externalUserId" column="external_user_id" />
- <result property="companyId" column="company_id" />
- <result property="createTime" column="create_time" />
- <result property="informationId" column="information_id" />
- </resultMap>
- <sql id="selectQwContactWayLogsVo">
- select id, way_id,information_id, user_id, company_user_id, type, msg, external_user_id, company_id, create_time,corp_id from qw_contact_way_logs
- </sql>
- <select id="selectQwContactWayLogsList" parameterType="QwContactWayLogs" resultType="QwContactWayLogs">
- select a.*,b.name,b.avatar,b.gender,b.is_repeat,c.nick_name from qw_contact_way_logs a
- inner join qw_external_contact b on a.external_user_id = b.id
- inner join company_user c on b.company_user_id = c.user_id
- <where>
- <if test="wayId != null "> and a.way_id = #{wayId}</if>
- <if test="userId != null "> and a.user_id = #{userId}</if>
- <if test="companyUserId != null "> and b.company_user_id = #{companyUserId}</if>
- <if test="type != null "> and a.type = #{type}</if>
- <if test="msg != null and msg != ''"> and a.msg = #{msg}</if>
- <if test="corpId != null "> and a.corp_id = #{corpId}</if>
- <if test="externalUserId != null "> and a.external_user_id = #{externalUserId}</if>
- <if test="companyId != null "> and a.company_id = #{companyId}</if>
- <if test="beginTime != null"><!-- 开始时间检索 -->
- AND date_format(a.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="endTime != null"><!-- 结束时间检索 -->
- AND date_format(a.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
- </if>
- </where>
- </select>
- <select id="selectQwContactWayLogsById" parameterType="Long" resultMap="QwContactWayLogsResult">
- <include refid="selectQwContactWayLogsVo"/>
- where id = #{id}
- </select>
- <insert id="insertQwContactWayLogs" parameterType="QwContactWayLogs" useGeneratedKeys="true" keyProperty="id">
- insert into qw_contact_way_logs
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="wayId != null">way_id,</if>
- <if test="userId != null">user_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="type != null">type,</if>
- <if test="msg != null">msg,</if>
- <if test="corpId != null">corp_id,</if>
- <if test="externalUserId != null">external_user_id,</if>
- <if test="companyId != null">company_id,</if>
- <if test="createTime != null">create_time,</if>
- <if test="informationId != null">information_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="wayId != null">#{wayId},</if>
- <if test="userId != null">#{userId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="type != null">#{type},</if>
- <if test="msg != null">#{msg},</if>
- <if test="corpId != null">#{corpId},</if>
- <if test="externalUserId != null">#{externalUserId},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="informationId != null">#{informationId},</if>
- </trim>
- </insert>
- <update id="updateQwContactWayLogs" parameterType="QwContactWayLogs">
- update qw_contact_way_logs
- <trim prefix="SET" suffixOverrides=",">
- <if test="wayId != null">way_id = #{wayId},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="type != null">type = #{type},</if>
- <if test="msg != null">msg = #{msg},</if>
- <if test="corpId != null">corp_id = #{corpId},</if>
- <if test="externalUserId != null">external_user_id = #{externalUserId},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="informationId != null">information_id = #{informationId},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteQwContactWayLogsById" parameterType="Long">
- delete from qw_contact_way_logs where id = #{id}
- </delete>
- <delete id="deleteQwContactWayLogsByIds" parameterType="String">
- delete from qw_contact_way_logs where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|