CustomerDetailMapper.xml 8.16 KB
<?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="cn.com.glsx.entmicro.mapper.CustomerDetailMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.CustomerDetail">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="customer_id" jdbcType="INTEGER" property="customerId"/>
        <result column="id_card" jdbcType="INTEGER" property="idCard"/>
        <result column="audi" jdbcType="VARCHAR" property="audi"/>
        <result column="car_type" jdbcType="VARCHAR" property="carType"/>
        <result column="buy_date" jdbcType="TIMESTAMP" property="buyDate"/>
        <result column="work_uid" jdbcType="CHAR" property="workUid"/>
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
        <result column="created_by" jdbcType="INTEGER" property="createdBy"/>
        <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
        <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
        <result column="maintenance_date" jdbcType="TIMESTAMP" property="maintenanceDate"/>
        <result column="arrival_date" jdbcType="TIMESTAMP" property="arrivalDate"/>
        <result column="com_insurance_endtime" jdbcType="TIMESTAMP" property="comInsuranceEndtime"/>
        <result column="car_Brand" jdbcType="TIMESTAMP" property="carBrand"/>
        <result column="car_Vin" jdbcType="TIMESTAMP" property="carVin"/>
        <result column="car_number" jdbcType="TIMESTAMP" property="carNumber"/>
        <result column="oneId" jdbcType="TIMESTAMP" property="oneId"/>
        <result column="car_Brand" jdbcType="TIMESTAMP" property="carBrand"/>
        <result column="car_Vin" jdbcType="TIMESTAMP" property="carVin"/>
        <result column="car_number" jdbcType="TIMESTAMP" property="carNumber"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        id, customer_id, id_card, audi, car_type, buy_date, work_uid, del_flag, created_by,
        created_time, updated_by, updated_time, maintenance_date, arrival_date, com_insurance_endtime,
        com_insurance_starttime
    </sql>

    <update id="batchUpdate">
        <foreach collection="datalist" item="item" index="index" open="" close="" separator=";">
            update scrm_customer_detail
            <trim prefix="set" suffixOverrides=",">
                <!--身份证-->
                <if test="item.idCard != null and item.idCard !=''">
                    id_card = #{item.idCard},
                </if>
                <!--车系-->
                <if test="item.audi != null and item.audi !=''">
                    audi = #{item.audi},
                </if>
                <!--车型-->
                <if test="item.carType != null and item.carType !=''">
                    car_type = #{item.carType},
                </if>
                <!--购买时间-->
                <if test="item.buyDate != null">
                    buy_date = #{item.buyDate},
                </if>
                <!--是否删除-->
                <if test="item.delFlag != null">
                    del_flag = #{item.delFlag},
                </if>
                <!--更新人-->
                <if test="item.updatedBy != null">
                    updated_by = #{item.updatedBy},
                </if>
                <!--更新时间-->
                <if test="item.updatedTime != null">
                    updated_time = #{item.updatedTime},
                </if>
                <!--近期保养日期-->
                <if test="item.maintenanceDate != null">
                    maintenance_date = #{item.maintenanceDate},
                </if>
                <!--到店日期-->
                <if test="item.arrivalDate != null">
                    arrival_date = #{item.arrivalDate},
                </if>
                <!--商业险结束日期-->
                <if test="item.comInsuranceEndtime != null">
                    com_insurance_endtime = #{item.comInsuranceEndtime},
                </if>

                <!--商业险生效日期-->
                <if test="item.comInsuranceStarttime != null">
                    com_insurance_starttime = #{item.comInsuranceStarttime},
                </if>
                <if test="item.carBrand != null">
                    car_brand = #{item.carBrand},
                </if>
                <if test="item.carBrandIds != null">
                    car_brand_ids = #{item.carBrandIds},
                </if>
                <if test="item.carVin != null">
                    car_vin = #{item.carVin},
                </if>
                <if test="item.carNumber != null">
                    car_number = #{item.carNumber},
                </if>
            </trim>
            where customer_id = #{item.customerId}
        </foreach>
    </update>

    <update id="updateByCustId" parameterType="cn.com.glsx.entmicro.entity.CustomerDetail">
        update scrm_customer_detail
        <trim prefix="set" suffixOverrides=",">
            <!--身份证-->
            <if test="idCard != null and idCard !=''">
                `id_card` = #{idCard},
            </if>
            <!--车系-->
            <if test="audi != null and audi !=''">
                `audi` = #{audi},
            </if>
            <!--车型-->
            <if test="carType != null and carType !=''">
                `car_type` = #{carType},
            </if>
            <!--购买时间-->
            <if test="buyDate != null">
                `buy_date` = #{buyDate},
            </if>
            <!--是否删除-->
            <if test="delFlag != null">
                `del_flag` = #{delFlag},
            </if>
            <!--更新人-->
            <if test="updatedBy != null">
                `updated_by` = #{updatedBy},
            </if>
            <!--更新时间-->
            <if test="updatedTime != null">
                `updated_time` = #{updatedTime},
            </if>
            <!--近期保养日期-->
            <if test="maintenanceDate != null">
                `maintenance_date` = #{maintenanceDate},
            </if>
            <!--到店日期-->
            <if test="arrivalDate != null">
                `arrival_date` = #{arrivalDate},
            </if>
            <!--商业险结束日期-->
            <if test="comInsuranceEndtime != null">
                `com_insurance_endtime` = #{comInsuranceEndtime},
            </if>

            <!--商业险生效日期-->
            <if test="comInsuranceStarttime != null">
                `com_insurance_starttime` = #{comInsuranceStarttime},
            </if>
        </trim>
        where `customer_id` = #{customerId}
    </update>
    <select id="selectByCustomerId" resultMap="BaseResultMap">
        select * from scrm_customer_detail where `customer_id` = #{customerId}
    </select>

    <select id="selectByCustomerIds" resultMap="BaseResultMap">
        select * from scrm_customer_detail where `customer_id` in
        <foreach collection="customerIds" index="index" open="(" close=")" separator="," item="id">
            #{id}
        </foreach>
    </select>

    <select id="selectByOneIds" resultMap="BaseResultMap">
        select t1.*,t2.one_Id as oneId from scrm_customer_detail t1
        left join scrm_customer t2 on t1.customer_id=t2.id
        where t2.one_Id in
        <foreach collection="oneIds" index="index" open="(" close=")" separator="," item="id">
            #{id}
        </foreach>
    </select>

    <!-- <insert id="batchInsert" useGeneratedKeys="true" keyProperty="id">
       insert into scrm_customer_detail (`customer_name`,`customer_phone`,`customer_sex`,`created_by`,`created_time`,`del_flag`,`merchantId`,`add_way`)
       values
       <foreach collection="customers" item="item" index="index" open="" close="" separator=",">
         (#{item.customerName}, #{item.customerPhone}, #{item.customerSex}, #{item.createdBy}, #{item.createdTime}, #{item.delFlag}, #{item.merchantid}, #{item.addWay})
       </foreach>
     </insert>-->
</mapper>