| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?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.CompanyCompanyFsuserMapper">
- <resultMap type="CompanyCompanyFsuser" id="CompanyCompanyFsuserResult">
- <result property="id" column="id" />
- <result property="companyId" column="company_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="userId" column="user_id" />
- <result property="qwContactId" column="qw_contact_id" />
- <result property="bindType" column="bind_type" />
- <result property="status" column="status" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="selectCompanyCompanyFsuserVo">
- select id, company_id, company_user_id, user_id,qw_contact_id,bind_type, status, create_time, update_time from company_company_fsuser
- </sql>
- <select id="selectCompanyCompanyUserList" parameterType="CompanyCompanyFsuser" resultMap="CompanyCompanyFsuserResult">
- <include refid="selectCompanyCompanyFsuserVo"/>
- <where>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="qwContactId != null "> and qw_contact_id = #{qwContactId}</if>
- <if test="bindType != null "> and bind_type = #{bindType}</if>
- <if test="status != null "> and status = #{status}</if>
- </where>
- </select>
- <select id="selectCompanyCompanyUserById" parameterType="Long" resultMap="CompanyCompanyFsuserResult">
- <include refid="selectCompanyCompanyFsuserVo"/>
- where id = #{id}
- </select>
- <select id="getInfoByUserId" resultType="com.fs.company.domain.CompanyCompanyFsuser">
- <include refid="selectCompanyCompanyFsuserVo"/>
- where status = 1
- and user_id = #{userId}
- </select>
- <select id="selectNoHistoryApp" resultType="com.fs.company.domain.CompanyCompanyFsuser">
- select ccf.*
- from company_company_fsuser ccf
- left join fs_user f on ccf.user_id = f.user_id
- where ccf.status = 1 AND ccf.bind_type = 1
- AND DATE_ADD(ccf.create_time, INTERVAL #{limit} DAY) < NOW() -- 筛选创建时间加上5天后小于等于当前时间的数据
- AND f.history_app is null
- AND ccf.user_id is not null
- </select>
- <insert id="insertCompanyCompanyUser" parameterType="CompanyCompanyFsuser" useGeneratedKeys="true" keyProperty="id">
- insert into company_company_fsuser
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="companyId != null">company_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="userId != null">user_id,</if>
- <if test="qwContactId != null">qw_contact_id,</if>
- <if test="bindType != null">bind_type,</if>
- <if test="status != null">status,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="companyId != null">#{companyId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="userId != null">#{userId},</if>
- <if test="qwContactId != null">#{qwContactId},</if>
- <if test="bindType != null">#{bindType},</if>
- <if test="status != null">#{status},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- </trim>
- </insert>
- <update id="updateCompanyCompanyUser" parameterType="CompanyCompanyFsuser">
- update company_company_fsuser
- <trim prefix="SET" suffixOverrides=",">
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="qwContactId != null">qw_contact_id = #{qwContactId},</if>
- <if test="bindType != null">bind_type = #{bindType},</if>
- <if test="status != null">status = #{status},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCompanyCompanyUserById" parameterType="Long">
- delete from company_company_fsuser where id = #{id}
- </delete>
- <delete id="deleteCompanyCompanyUserByIds" parameterType="String">
- delete from company_company_fsuser where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|