123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?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.minpay.db.table.own.mapper.CstInfMapper">
- <select id="selectPbcstinfQuery" resultType="hashmap" parameterType="java.util.Map">
- select
- CIF_CSTNO 'cstno',
- CIF_NAME 'name',
- CIF_PHONE 'phone',
- CIF_INDUSTRY 'industry',
- CIF_NUTURE 'nuture',
- CIF_LEVEL 'level',
- CIF_INVOICE_TYPE 'invoicetype',
- CIF_PROVINCE 'province',
- CIF_CITY 'city',
- CIF_AREA 'area',
- CIF_IS_GROUP 'isGroup',
- CIF_IS_IMPORTANT 'isImportant',
- CIF_IS_PROCOTOL 'isProcotol',
- CIF_COMPANY_ID 'companyId',
- CIF_SALE_ID 'saleId',
- CIF_PAY_TYPE 'payType',
- CIF_MIN_PAY_PERIOD 'minPayPeriod',
- CIF_MAX_PAY_PERIOD 'maxPayPeriod',
- CIF_PAY_PERIOD_STT 'periodStt',
- USR_NAME 'saleName',
- SCI_ACCNO 'accNo',
- (CASE WHEN SCI_VALUE IS NULL THEN 0 ELSE SCI_VALUE END) AS creditValue,
- CIF_GRADE 'creditGrade',
- CIF_DESC 'desc',
- CIF_GROUP_NAME 'groupName',
- d.add_name 'cityName',
- e.add_name 'areaName'
- from
- pb_cst_inf a
- LEFT JOIN
- im_user b ON CIF_SALE_ID = USR_ID
-
- LEFT JOIN
- hc_score_inf c ON CIF_CSTNO = SCI_CST
- <if test="cstType != null and cstType != ''">
- and SCI_TYPE = #{cstType,jdbcType=VARCHAR}
- </if>
- <if test="accType != null and accType != ''">
- and SCI_ACC_TYPE = #{accType,jdbcType=VARCHAR}
- </if>
- LEFT JOIN pub_address d on d.add_code = a.CIF_CITY
- LEFT JOIN pub_address e on e.add_code = a.CIF_CITY
- where
- 1=1
- <if test="saleName != null and saleName != ''">
- and USR_NAME like CONCAT('%', #{saleName,jdbcType=VARCHAR}, '%')
- </if>
- <if test="name != null and name != ''">
- and CIF_NAME like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
- </if>
- <if test="nuture != null and nuture != ''">
- and CIF_NUTURE = #{nuture,jdbcType=VARCHAR}
- </if>
- <if test="userId != null and userId != ''">
- and CIF_SALE_ID = #{userId,jdbcType=VARCHAR}
- </if>
- <if test="isDistribution != null and isDistribution != ''">
- AND ( CIF_SALE_ID IS NULL OR CIF_SALE_ID ='')
- </if>
- <if test="level != null and level != ''">
- and CIF_LEVEL = #{level,jdbcType=VARCHAR}
- </if>
- <if test="invoicetype != null and invoicetype != ''">
- and CIF_INVOICE_TYPE = #{invoicetype,jdbcType=VARCHAR}
- </if>
- <if test="group != null and group != ''">
- and CIF_SALE_ID in (select HGI_UESRID from hc_group_uesr_rel where 1=1 and HGI_GROUP = #{group,jdbcType=VARCHAR})
- </if>
- ORDER BY CIF_CSTNO DESC
- </select>
-
- <select id="queryApplyCustomer" resultType="hashmap" parameterType="java.util.Map">
- select
- a.DIS_ID "id",
- a.DIS_CST_ID "cstId",
- c.CIF_NAME "cstName",
- a.DIS_TYPE "type",
- a.DIS_OLD_USER "oldUser",
- a.DIS_NOW_USER "nowUser",
- a.DIS_OPER_TIME "operTime",
- a.DIS_OPER_USER "operUser",
- a.DIS_OPER_DESC "operDesc",
- b.USR_NAME "oldUserName",
- d.USR_NAME "nowUserName",
- e.USR_NAME "operUserName",
- f.HGI_NAME "oldGroupName",
- g.HGI_NAME "nowGroupName"
- from
- pb_cst_distribute_log a
- LEFT JOIN PB_CST_INF c ON a.DIS_CST_ID = c.CIF_CSTNO
- LEFT JOIN im_user b ON a.DIS_OLD_USER = b.USR_ID
- LEFT JOIN im_user d ON a.DIS_NOW_USER = d.USR_ID
- LEFT JOIN im_user e ON a.DIS_OPER_USER = e.USR_ID
- left join hc_group_inf f on f.hgi_id = a.DIS_OLD_GROUP
- left join hc_group_inf g on g.hgi_id = a.DIS_NOW_GROUP
- where
- 1=1
- <if test="saleName != null and saleName != ''">
- and d.USR_NAME like CONCAT('%', #{saleName,jdbcType=VARCHAR}, '%')
- </if>
- <if test="name != null and name != ''">
- and c.CIF_NAME like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
- </if>
-
- ORDER BY DIS_OPER_TIME DESC
-
- </select>
- <select id="queryScoreDetail" resultType="hashmap" parameterType="java.util.Map">
- select
- CSL_ID 'id',
- CSL_CHANGE_VALUE 'changeValue',
- CSL_VALUE 'value',
- CSL_DEAL_NO 'dealNo',
- CSL_CST_ID 'cstId',
- CSL_DESC 'desc',
- CSL_DEAL_TYPE 'dealType',
- CSL_CST_TYPE 'cstType',
- CSL_CREATEUSER 'createUser',
- CSL_CREATETIME 'createtime',
- CSL_ACCNO 'accNo'
- from
- hc_sco_log
- where
- 1=1
- and CSL_ACCNO = #{accNo,jdbcType=VARCHAR}
-
- ORDER BY CSL_CREATETIME DESC
-
- </select>
- <select id="queryContacts" resultType="hashmap" parameterType="java.util.Map">
- select
- CON_ID 'id',
- CON_NAME 'name',
- CON_DEPARTMENT 'department',
- CON_DUTY 'duty',
- CON_IS_DECISION 'isDecision',
- CON_PHONE 'phone',
- CON_CST_ID 'cstid',
- CON_DESC 'desc',
- CON_ADDRESS 'address'
- from
- pb_contact_inf
- where
- 1=1
- and CON_CST_ID = #{cstno,jdbcType=VARCHAR}
- and CON_CST_TYPE = '0'
-
- </select>
- <select id="queryProductRecord" resultType="hashmap" parameterType="java.util.Map">
- select
- q.QUD_ID 'id',
- q.QUD_QUOTATION_ID 'quotationId',
- q.QUD_GOODS_SUP_REL 'goodId',
- q.QUD_OFFER_STATUS 'status',
- q.QUD_MODEL 'model',
- q.QUD_NAME 'name',
- q.QUD_BRAND 'brand',
- q.QUD_NUMBER 'number',
- q.QUD_ORDER_COUNT 'orderNumber',
- q.QUD_NOT_ORDER_COUNT 'notOrderNumber',
- q.QUD_NOT_ORDER_COUNT 'toOrderNumber',
- q.QUD_CST_ID 'cstId',
- b.CIF_NAME 'cstName',
- a.HGI_NAME 'goodName'
- from
- hc_quotation_detail q
- left join hc_goods_inf a on a.HGI_ID = q.QUD_GOODS_SUP_REL
- left join pb_cst_inf b on b.CIF_CSTNO = q.QUD_CST_ID
- where 1=1
- <if test="goodName != null and goodName != ''">
- and a.HGI_NAME like CONCAT('%', #{goodName,jdbcType=VARCHAR}, '%')
- </if>
- <if test="cstName != null and cstName != ''">
- and b.CIF_NAME like CONCAT('%', #{cstName,jdbcType=VARCHAR}, '%')
- </if>
- ORDER BY QUD_ID DESC
- </select>
- </mapper>
|