sql

<?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.goldmantis.common.lms.mapper.SalecluesMapper">

<resultMap id="SalecluesResult" type="com.goldmantis.common.lms.model.Saleclues">
<result property="id" column="id"/>
<result property="houseId" column="house_id"/>
<result property="customerManager" column="customer_manager"/>
<result property="contactDate" column="contact_date"/>
<result property="lastContactDate" column="last_contact_date"/>
<result property="sourceCd" column="source_cd"/>
<result property="statusCd" column="status_cd"/>
<result property="natureCd" column="nature_cd"/>
<result property="isTmallOrder" column="is_tmall_order"/>
<result property="tmallOrderNo" column="tmall_order_no"/>
<result property="isRecommand" column="is_recommand"/>
<result property="recommandBy" column="recommand_by"/>
<result property="recommandRemark" column="recommand_remark"/>
<result property="intentionsCd" column="intentions_cd"/>
<result property="expectedTransDate" column="expected_trans_date"/>
<result property="constructPackage" column="construct_package"/>
<result property="constructPackageRemark" column="construct_package_remark"/>
<result property="standardPlanPrice" column="standard_plan_price"/>
<result property="materialPackageRemark" column="material_package_remark"/>
<result property="softPackageRemark" column="soft_package_remark"/>
<result property="stationId" column="station_id"/>
<result property="weshopId" column="weshop_id"/>
<result property="orderNo" column="order_no"/>
<result property="actMeasureDate" column="act_measure_date"/>
<result property="blueprintDate" column="blueprint_date"/>
<result property="reserveOrderDate" column="reserve_order_date"/>
<result property="attentionFactorCd" column="attention_factor_cd"/>
<result property="stylePreferenceCd" column="style_preference_cd"/>
<result property="colorPreferenceCd" column="color_preference_cd"/>
<result property="materialPackageCd" column="material_package_cd"/>
<result property="softPackageCd" column="soft_package_cd"/>
<result property="budget" column="budget"/>
<result property="closeReason" column="close_reason"/>
<result property="deleted" column="deleted"/>
<result property="createDt" column="create_dt"/>
<result property="updateDt" column="update_dt"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
</resultMap>

<resultMap id="SalecluesFollowResult" type="com.goldmantis.common.lms.model.SalecluesFollow">
<result property="id" column="id"/>
<result property="salecluesId" column="saleclues_id"/>
<result property="followWayCd" column="follow_way_cd"/>
<result property="nextFollowDate" column="next_follow_date"/>
<result property="followRecord" column="follow_record"/>
<result property="followDate" column="follow_date"/>
<result property="followBy" column="follow_by"/>
<result property="typeCd" column="type_cd"/>
<result property="deleted" column="deleted"/>
<result property="createDt" column="create_dt"/>
<result property="updateDt" column="update_dt"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
</resultMap>

<resultMap id="SalecluesIncludeFollowlogResult" type="com.goldmantis.common.lms.model.Saleclues" extends="SalecluesResult">
<collection property="followList" ofType="com.goldmantis.common.lms.model.SalecluesFollow" select="getFollowlogListBySalecluesId" column="id"/>
</resultMap>

<sql id="searchColumns">
t.id,
t.house_id houseId,
t.customer_manager customerManager,
t.contact_date contactDate,
t.last_contact_date lastContactDate,
t.source_cd sourceCd,
t.status_cd statusCd,
t.nature_cd natureCd,
t.is_tmall_order isTmallOrder,
t.tmall_order_no tmallOrderNo,
t.is_recommand isRecommand,
t.recommand_by recommandBy,
t.recommand_remark recommandRemark,
t.intentions_cd intentionsCd,
t.expected_trans_date expectedTransDate,
t.construct_package constructPackage,
t.construct_package_remark constructPackageRemark,
t.standard_plan_price standardPlanPrice,
t.material_package_remark materialPackageRemark,
t.soft_package_remark softPackageRemark,
t.station_id stationId,
t.weshop_id weshopId,
t.order_no orderNo,
t.act_measure_date actMeasureDate,
t.blueprint_date blueprintDate,
t.reserve_order_date reserveOrderDate,
t.attention_factor_cd attentionFactorCd,
t.style_preference_cd stylePreferenceCd,
t.color_preference_cd colorPreferenceCd,
t.material_package_cd materialPackageCd,
t.soft_package_cd softPackageCd,
t.budget,
t.close_reason closeReason,
t.deleted,
t.create_dt createDt,
t.update_dt updateDt,
t.create_by createBy,
t.update_by updateBy
</sql>

<select id="listSaleclues" parameterType="map" resultMap="SalecluesResult">
select
<include refid="searchColumns"/>
from
lms_saleclues t
<where>
<if test="id !=null and id != ''">
and t.id = #{id}
</if>
<if test="houseId !=null and houseId != ''">
and t.house_id = #{houseId}
</if>
<if test="customerManager !=null and customerManager != ''">
and t.customer_manager = #{customerManager}
</if>
<if test="contactDate !=null">
and t.contact_date = #{contactDate}
</if>
<if test="lastContactDate !=null">
and t.last_contact_date = #{lastContactDate}
</if>
<if test="sourceCd !=null and sourceCd != ''">
and t.source_cd = #{sourceCd}
</if>
<if test="statusCd !=null and statusCd != ''">
and t.status_cd = #{statusCd}
</if>
<if test="natureCd !=null and natureCd != ''">
and t.nature_cd = #{natureCd}
</if>
<if test="isTmallOrder !=null and isTmallOrder != ''">
and t.is_tmall_order = #{isTmallOrder}
</if>
<if test="tmallOrderNo !=null and tmallOrderNo != ''">
and t.tmall_order_no = #{tmallOrderNo}
</if>
<if test="isRecommand !=null and isRecommand != ''">
and t.is_recommand = #{isRecommand}
</if>
<if test="recommandBy !=null and recommandBy != ''">
and t.recommand_by = #{recommandBy}
</if>
<if test="recommandRemark !=null and recommandRemark != ''">
and t.recommand_remark = #{recommandRemark}
</if>
<if test="intentionsCd !=null and intentionsCd != ''">
and t.intentions_cd = #{intentionsCd}
</if>
<if test="expectedTransDate !=null">
and t.expected_trans_date = #{expectedTransDate}
</if>
<if test="constructPackage !=null and constructPackage != ''">
and t.construct_package = #{constructPackage}
</if>
<if test="constructPackageRemark !=null and constructPackageRemark != ''">
and t.construct_package_remark = #{constructPackageRemark}
</if>
<if test="standardPlanPrice !=null">
and t.standard_plan_price = #{standardPlanPrice}
</if>
<if test="materialPackageRemark !=null and materialPackageRemark != ''">
and t.material_package_remark = #{materialPackageRemark}
</if>
<if test="softPackageRemark !=null and softPackageRemark != ''">
and t.soft_package_remark = #{softPackageRemark}
</if>
<if test="stationId !=null and stationId != ''">
and t.station_id = #{stationId}
</if>
<if test="weshopId !=null and weshopId != ''">
and t.weshop_id = #{weshopId}
</if>
<if test="orderNo !=null and orderNo != ''">
and t.order_no = #{orderNo}
</if>
<if test="actMeasureDate !=null">
and t.act_measure_date = #{actMeasureDate}
</if>
<if test="blueprintDate !=null">
and t.blueprint_date = #{blueprintDate}
</if>
<if test="reserveOrderDate !=null">
and t.reserve_order_date = #{reserveOrderDate}
</if>
<if test="attentionFactorCd !=null and attentionFactorCd != ''">
and t.attention_factor_cd = #{attentionFactorCd}
</if>
<if test="stylePreferenceCd !=null and stylePreferenceCd != ''">
and t.style_preference_cd = #{stylePreferenceCd}
</if>
<if test="colorPreferenceCd !=null and colorPreferenceCd != ''">
and t.color_preference_cd = #{colorPreferenceCd}
</if>
<if test="materialPackageCd !=null and materialPackageCd != ''">
and t.material_package_cd = #{materialPackageCd}
</if>
<if test="softPackageCd !=null and softPackageCd != ''">
and t.soft_package_cd = #{softPackageCd}
</if>
<if test="budget !=null and budget != ''">
and t.budget = #{budget}
</if>
<if test="closeReason !=null and closeReason != ''">
and t.close_reason = #{closeReason}
</if>
<if test="deleted !=null and deleted != ''">
and t.deleted = #{deleted}
</if>
<if test="createDt !=null">
and t.create_dt = #{createDt}
</if>
<if test="updateDt !=null">
and t.update_dt = #{updateDt}
</if>
<if test="createBy !=null and createBy != ''">
and t.create_by = #{createBy}
</if>
<if test="updateBy !=null and updateBy != ''">
and t.update_by = #{updateBy}
</if>
</where>
</select>

<select id="getFollowlogListBySalecluesId" parameterType="java.lang.String" resultMap="SalecluesFollowResult">
select
t.id,
t.saleclues_id salecluesId,
t.follow_way_cd followWayCd,
t.next_follow_date nextFollowDate,
t.follow_record followRecord,
t.follow_date followDate,
t.follow_by followBy,
t.type_cd typeCd,
t.deleted,
t.create_dt createDt,
t.update_dt updateDt,
t.create_by createBy,
t.update_by updateBy
from lms_saleclues_follow t
where saleclues_id = #{salecluesId}
</select>

<select id="getSalecluesById" parameterType="java.lang.String" resultType="com.goldmantis.common.lms.model.Saleclues">
select
<include refid="searchColumns"/>
from
lms_saleclues t
where id=#{id}
</select>

<insert id="addSaleclues" parameterType="com.goldmantis.common.lms.model.Saleclues">
insert into lms_saleclues (
id,
house_id,
customer_manager,
contact_date,
last_contact_date,
source_cd,
status_cd,
nature_cd,
is_tmall_order,
tmall_order_no,
is_recommand,
recommand_by,
recommand_remark,
intentions_cd,
expected_trans_date,
construct_package,
construct_package_remark,
standard_plan_price,
material_package_remark,
soft_package_remark,
station_id,
weshop_id,
order_no,
act_measure_date,
blueprint_date,
reserve_order_date,
attention_factor_cd,
style_preference_cd,
color_preference_cd,
material_package_cd,
soft_package_cd,
budget,
close_reason,
deleted,
create_dt,
update_dt,
create_by,
update_by
) values (
#{id},
#{houseId},
#{customerManager},
#{contactDate},
#{lastContactDate},
#{sourceCd},
#{statusCd},
#{natureCd},
#{isTmallOrder},
#{tmallOrderNo},
#{isRecommand},
#{recommandBy},
#{recommandRemark},
#{intentionsCd},
#{expectedTransDate},
#{constructPackage},
#{constructPackageRemark},
#{standardPlanPrice},
#{materialPackageRemark},
#{softPackageRemark},
#{stationId},
#{weshopId},
#{orderNo},
#{actMeasureDate},
#{blueprintDate},
#{reserveOrderDate},
#{attentionFactorCd},
#{stylePreferenceCd},
#{colorPreferenceCd},
#{materialPackageCd},
#{softPackageCd},
#{budget},
#{closeReason},
#{deleted},
#{createDt},
#{updateDt},
#{createBy},
#{updateBy}
)
</insert>

<update id="updateSaleclues" parameterType="com.goldmantis.common.lms.model.Saleclues">
update lms_saleclues
set
house_id = #{houseId},
customer_manager = #{customerManager},
contact_date = #{contactDate},
last_contact_date = #{lastContactDate},
source_cd = #{sourceCd},
status_cd = #{statusCd},
nature_cd = #{natureCd},
is_tmall_order = #{isTmallOrder},
tmall_order_no = #{tmallOrderNo},
is_recommand = #{isRecommand},
recommand_by = #{recommandBy},
recommand_remark = #{recommandRemark},
intentions_cd = #{intentionsCd},
expected_trans_date = #{expectedTransDate},
construct_package = #{constructPackage},
construct_package_remark = #{constructPackageRemark},
standard_plan_price = #{standardPlanPrice},
material_package_remark = #{materialPackageRemark},
soft_package_remark = #{softPackageRemark},
station_id = #{stationId},
weshop_id = #{weshopId},
order_no = #{orderNo},
act_measure_date = #{actMeasureDate},
blueprint_date = #{blueprintDate},
reserve_order_date = #{reserveOrderDate},
attention_factor_cd = #{attentionFactorCd},
style_preference_cd = #{stylePreferenceCd},
color_preference_cd = #{colorPreferenceCd},
material_package_cd = #{materialPackageCd},
soft_package_cd = #{softPackageCd},
budget = #{budget},
close_reason = #{closeReason},
deleted = #{deleted},
create_dt = #{createDt},
update_dt = #{updateDt},
create_by = #{createBy},
update_by = #{updateBy}
where id=#{id}
</update>

<update id="deleteSalecluesByIds" parameterType="java.lang.String">
update lms_saleclues set deleted=1
where id in
<foreach collection="array" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值