| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <?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.company.mapper.CompanyWxClientMapper">
-
- <resultMap type="CompanyWxClient" id="CompanyWxClientResult">
- <result property="id" column="id" />
- <result property="roboticWxId" column="robotic_wx_id" />
- <result property="nickName" column="nick_name" />
- <result property="avatar" column="avatar" />
- <result property="phone" column="phone" />
- <result property="wxNo" column="wx_no" />
- <result property="isAdd" column="is_add" />
- <result property="addTime" column="add_time" />
- <result property="remark" column="remark" />
- <result property="createTime" column="create_time" />
- </resultMap>
- <sql id="selectCompanyWxClientVo">
- select a.* from company_wx_client a
- </sql>
- <select id="selectCompanyWxClientList" resultType="com.fs.company.domain.CompanyWxClient">
- select a.*,b.wx_nick_name,c.name as dialogName,robotic.name roboticName from company_wx_client a
- inner join company_voice_robotic_wx wx on a.robotic_wx_id = wx.id
- inner join company_wx_account b on wx.account_id = b.id
- inner join company_wx_dialog c on a.dialog_id = c.id
- inner join company_voice_robotic robotic on a.robotic_id = robotic.id
- <where>
- <if test="roboticId != null "> and a.robotic_id = #{roboticId}</if>
- <if test="roboticWxId != null "> and b.id = #{roboticWxId}</if>
- <if test="customerId != null "> and a.customer_id = #{customerId}</if>
- <if test="dialogId != null "> and a.dialog_id = #{dialogId}</if>
- <if test="nickName != null and nickName != ''"> and a.nick_name = #{nickName}</if>
- <if test="avatar != null and avatar != ''"> and a.avatar = #{avatar}</if>
- <if test="phone != null and phone != ''"> and a.phone = #{phone}</if>
- <if test="wxNo != null and wxNo != ''"> and a.wx_no = #{wxNo}</if>
- <if test="isAdd != null "> and a.is_add = #{isAdd}</if>
- <if test="addTime != null "> and a.add_time = #{addTime}</if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- and date_format(a.add_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
- AND date_format(a.add_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
- </if>
- </where>
- </select>
- <select id="selectCompanyWxClientListCompany" resultType="com.fs.company.domain.CompanyWxClient">
- select a.*,b.wx_nick_name,c.name as dialogName,robotic.name roboticName from company_wx_client a
- inner join company_voice_robotic_wx wx on a.robotic_wx_id = wx.id
- inner join company_wx_account b on wx.account_id = b.id
- inner join company_user u on b.company_user_id = u.user_id
- inner join company_dept d on u.dept_id = d.dept_id
- inner join company_wx_dialog c on a.dialog_id = c.id
- inner join company_voice_robotic robotic on a.robotic_id = robotic.id
- <where>
- <if test="roboticId != null "> and a.robotic_id = #{roboticId}</if>
- <if test="roboticWxId != null "> and b.id = #{roboticWxId}</if>
- <if test="customerId != null "> and a.customer_id = #{customerId}</if>
- <if test="dialogId != null "> and a.dialog_id = #{dialogId}</if>
- <if test="nickName != null and nickName != ''"> and a.nick_name = #{nickName}</if>
- <if test="avatar != null and avatar != ''"> and a.avatar = #{avatar}</if>
- <if test="phone != null and phone != ''"> and a.phone = #{phone}</if>
- <if test="wxNo != null and wxNo != ''"> and a.wx_no = #{wxNo}</if>
- <if test="isAdd != null "> and a.is_add = #{isAdd}</if>
- <if test="addTime != null "> and a.add_time = #{addTime}</if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- and date_format(a.add_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
- AND date_format(a.add_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
- </if>
- ${params.dataScope}
- </where>
- </select>
-
- <select id="selectCompanyWxClientById" parameterType="Long" resultMap="CompanyWxClientResult">
- <include refid="selectCompanyWxClientVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertCompanyWxClient" parameterType="CompanyWxClient" useGeneratedKeys="true" keyProperty="id">
- insert into company_wx_client
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="roboticWxId != null">robotic_wx_id,</if>
- <if test="nickName != null">nick_name,</if>
- <if test="avatar != null">avatar,</if>
- <if test="phone != null">phone,</if>
- <if test="wxNo != null">wx_no,</if>
- <if test="isAdd != null">is_add,</if>
- <if test="addTime != null">add_time,</if>
- <if test="remark != null">remark,</if>
- <if test="createTime != null">create_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="roboticWxId != null">#{roboticWxId},</if>
- <if test="nickName != null">#{nickName},</if>
- <if test="avatar != null">#{avatar},</if>
- <if test="phone != null">#{phone},</if>
- <if test="wxNo != null">#{wxNo},</if>
- <if test="isAdd != null">#{isAdd},</if>
- <if test="addTime != null">#{addTime},</if>
- <if test="remark != null">#{remark},</if>
- <if test="createTime != null">#{createTime},</if>
- </trim>
- </insert>
- <update id="updateCompanyWxClient" parameterType="CompanyWxClient">
- update company_wx_client
- <trim prefix="SET" suffixOverrides=",">
- <if test="roboticWxId != null">robotic_wx_id = #{roboticWxId},</if>
- <if test="nickName != null">nick_name = #{nickName},</if>
- <if test="avatar != null">avatar = #{avatar},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="wxNo != null">wx_no = #{wxNo},</if>
- <if test="isAdd != null">is_add = #{isAdd},</if>
- <if test="addTime != null">add_time = #{addTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCompanyWxClientById" parameterType="Long">
- delete from company_wx_client where id = #{id}
- </delete>
- <delete id="deleteCompanyWxClientByIds" parameterType="String">
- delete from company_wx_client where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="toDayAddWxAccountList" resultType="com.fs.company.domain.CompanyWxClient">
- select a.*,b.wx_nick_name,c.name as dialogName,c.template_details,d.name roboticName from company_wx_client a
- inner join company_voice_robotic_wx wx on a.robotic_wx_id = wx.id
- inner join company_wx_account b on wx.account_id = b.id
- inner join company_wx_dialog c on a.dialog_id = c.id
- inner join company_voice_robotic d on a.robotic_id = d.id
- where b.id = #{accountId} and b.company_user_id = #{companyId} and a.is_add = #{addType}
- </select>
- <select id="selectCompanyByAccountId" resultType="com.fs.company.domain.CompanyUser">
- select c.* from company_voice_robotic_wx a
- inner join company_wx_account b on a.account_id = b.id
- inner join company_user c on b.company_user_id = c.user_id
- where a.id = #{wxId}
- </select>
- <select id="listCompanyIds" resultType="com.fs.company.domain.CompanyWxClient">
- select a.*,b.company_user_id from
- company_wx_client a
- inner join company_wx_account b on a.account_id = b.id
- where b.company_user_id in <foreach collection="ids" open="(" separator="," close=")" item="item">#{item}</foreach>
- </select>
- <select id="getAddWxList" resultType="com.fs.company.domain.CompanyWxClient">
- SELECT * FROM company_wx_client where is_add = 0 and account_id is not null
- <if test="accountIdList != null and !accountIdList.isEmpty()">
- and account_id in <foreach collection="accountIdList" open="(" separator="," close=")" item="item">#{item}</foreach>
- </if>
- group by account_id
- </select>
- <select id="selectWx" resultType="com.fs.company.domain.CompanyWxClient">
- select * from company_wx_client where account_id = #{accountId} and wx_v3 = #{v3}
- </select>
- <select id="selectListByRoboticId" resultType="com.fs.company.domain.CompanyWxClient">
- select * from company_wx_client where robotic_id = #{roboticId}
- </select>
- <select id="selectOneByRoboticIdAndUserId" resultType="com.fs.company.domain.CompanyWxClient">
- select * from company_wx_client where robotic_id = #{roboticId} and customer_id = #{customerId}
- </select>
- </mapper>
|