123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?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.dgtly.order.mapper.CustomersStartMapper">
-
- <resultMap type="com.dgtly.order.domain.CustomersStart" id="CustomersStartResult">
- <result property="customersCode" column="customers_code" />
- <result property="customersName" column="customers_name" />
- <result property="onlineTime" column="online_time" />
- </resultMap>
- <sql id="selectCustomersStartVo">
- select customers_code, customers_name,online_time from customers_start
- </sql>
- <select id="selectCustomersStartList" parameterType="com.dgtly.order.domain.CustomersStart" resultMap="CustomersStartResult">
- <include refid="selectCustomersStartVo"/>
- <where>
- <if test="customersCode != null and customersCode != ''"> and customers_code like concat('%', #{customersCode}, '%')</if>
- <if test="customersName != null and customersName != ''"> and customers_name like concat('%', #{customersName}, '%')</if>
- <if test="onlineTime != null"> and online_time = #{onlineTime}</if>
- </where>
- order by online_time desc
- </select>
-
- <select id="selectCustomersStartByCustomersCode" parameterType="String" resultMap="CustomersStartResult">
- <include refid="selectCustomersStartVo"/>
- where customers_code = #{customersCode}
- </select>
- <select id="selectcustomersList" resultType="com.dgtly.order.domain.OrderCustomers" parameterType="com.dgtly.order.domain.OrderCustomers">
- select id, chains_code as chainsCode, chains_name as chainsName from customers
- where is_delete = 0
- and chains_code is not null
- and chains_name is not null
- <if test="chainsCode != null and chainsCode != ''">
- AND chains_code like concat('%', #{chainsCode}, '%')
- </if>
- <if test="chainsName != null and chainsName != ''">
- AND chains_name like concat('%', #{chainsName}, '%')
- </if>
- GROUP BY chains_code,chains_name
- </select>
- <select id="selectCustomersById" resultType="com.dgtly.order.domain.OrderCustomers" parameterType="Long">
- select id, chains_name as chainsName, chains_code as chainsCode, state_name as stateName, city_name as cityName
- from customers
- where is_delete = 0
- and chains_code is not null
- and chains_name is not null
- and id = #{id}
- </select>
- <select id="selectCustomerAuthList" resultType="com.dgtly.order.domain.CustomerAuthModel">
- SELECT
- mds.Org3code companyCode,
- mds.Org3name companyName,
- mds.Org4code saleCode,
- mds.Org4name saleName,
- mds.Org5code officeCode,
- mds.Org5name officeName,
- osc.suboffice_code subOfficeCode,
- osc.suboffice_name subOfficeName,
- osc.customer_id customerCode,
- osc.customer_name customerName,
- ce.org_attestation_time authTime
- FROM
- customers_ext ce
- LEFT JOIN order_sales_customer osc ON ce.chains_code = osc.customer_id
- LEFT JOIN meta_diy_salesorgtree mds ON osc.suboffice_code = mds.Org5code
- WHERE
- ce.org_attestation_time IS NOT NULL
- GROUP BY
- osc.customer_id
- ORDER BY mds.Org3name DESC
- </select>
- <insert id="insertCustomersStart" parameterType="com.dgtly.order.domain.CustomersStart">
- insert into customers_start
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="customersCode != null and customersCode != ''">customers_code,</if>
- <if test="customersName != null and customersName != ''">customers_name,</if>
- <if test="onlineTime != null">online_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="customersCode != null and customersCode != ''">#{customersCode},</if>
- <if test="customersName != null and customersName != ''">#{customersName},</if>
- <if test="onlineTime != null">#{onlineTime},</if>
- </trim>
- </insert>
- <update id="updateCustomersStart" parameterType="com.dgtly.order.domain.CustomersStart">
- update customers_start
- <trim prefix="SET" suffixOverrides=",">
- <if test="customersName != null and customersName != ''">customers_name = #{customersName},</if>
- </trim>
- where customers_code = #{customersCode}
- </update>
- <delete id="deleteCustomersStartById" parameterType="String">
- delete from customers_start where customers_code = #{customersCode}
- </delete>
- <delete id="deleteCustomersStartByIds" parameterType="String">
- delete from customers_start where customers_code in
- <foreach item="customersCode" collection="array" open="(" separator="," close=")">
- #{customersCode}
- </foreach>
- </delete>
-
- </mapper>
|