You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
8.3 KiB

3 years ago
<?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.cyl.manager.oms.mapper.OrderMapper">
3 years ago
<resultMap type="Order" id="OrderResult">
<result property="id" column="id"/>
<result property="memberId" column="member_id"/>
<result property="memberUsername" column="member_username"/>
<result property="totalAmount" column="total_amount"/>
<result property="purchasePrice" column="purchase_price"/>
<result property="payAmount" column="pay_amount"/>
<result property="freightAmount" column="freight_amount"/>
<result property="payType" column="pay_type"/>
<result property="status" column="status"/>
<result property="aftersaleStatus" column="aftersale_status"/>
3 years ago
<result property="deliveryCompany" column="delivery_company"/>
<result property="deliverySn" column="delivery_sn"/>
<result property="autoConfirmDay" column="auto_confirm_day"/>
<result property="receiverName" column="receiver_name"/>
<result property="receiverPhone" column="receiver_phone"/>
<result property="receiverPostCode" column="receiver_post_code"/>
<result property="receiverProvince" column="receiver_province"/>
<result property="receiverCity" column="receiver_city"/>
<result property="receiverDistrict" column="receiver_district"/>
<result property="receiverProvinceId" column="receiver_province_id"/>
<result property="receiverCityId" column="receiver_city_id"/>
<result property="receiverDistrictId" column="receiver_district_id"/>
<result property="receiverDetailAddress" column="receiver_detail_address"/>
<result property="note" column="note"/>
<result property="confirmStatus" column="confirm_status"/>
<result property="deleteStatus" column="delete_status"/>
<result property="paymentTime" column="payment_time"/>
<result property="deliveryTime" column="delivery_time"/>
<result property="receiveTime" column="receive_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectOrderVo">
select id, member_id, member_username, total_amount, purchase_price, pay_amount, freight_amount, pay_type, status, aftersale_status, delivery_company, delivery_sn, auto_confirm_day, receiver_name, receiver_phone, receiver_post_code, receiver_province, receiver_city, receiver_district, receiver_province_id, receiver_city_id, receiver_district_id, receiver_detail_address, note, confirm_status, delete_status, payment_time, delivery_time, receive_time, create_by, create_time, update_by, update_time from oms_order
3 years ago
</sql>
<select id="selectByEntity" parameterType="Order" resultMap="OrderResult">
<include refid="selectOrderVo"/>
<where>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="memberUsername != null and memberUsername != ''"> and member_username like concat('%', #{memberUsername}, '%')</if>
<if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
<if test="purchasePrice != null "> and purchase_price = #{purchasePrice}</if>
<if test="payAmount != null "> and pay_amount = #{payAmount}</if>
<if test="freightAmount != null "> and freight_amount = #{freightAmount}</if>
<if test="payType != null "> and pay_type = #{payType}</if>
<if test="status != null "> and status = #{status}</if>
<if test="aftersaleStatus != null "> and aftersale_status = #{aftersaleStatus}</if>
3 years ago
<if test="deliveryCompany != null and deliveryCompany != ''"> and delivery_company = #{deliveryCompany}</if>
<if test="deliverySn != null and deliverySn != ''"> and delivery_sn = #{deliverySn}</if>
<if test="autoConfirmDay != null "> and auto_confirm_day = #{autoConfirmDay}</if>
<if test="receiverName != null and receiverName != ''"> and receiver_name like concat('%', #{receiverName}, '%')</if>
<if test="receiverPhone != null and receiverPhone != ''"> and receiver_phone = #{receiverPhone}</if>
<if test="receiverPostCode != null and receiverPostCode != ''"> and receiver_post_code = #{receiverPostCode}</if>
<if test="receiverProvince != null and receiverProvince != ''"> and receiver_province = #{receiverProvince}</if>
<if test="receiverCity != null and receiverCity != ''"> and receiver_city = #{receiverCity}</if>
<if test="receiverDistrict != null and receiverDistrict != ''"> and receiver_district = #{receiverDistrict}</if>
<if test="receiverProvinceId != null "> and receiver_province_id = #{receiverProvinceId}</if>
<if test="receiverCityId != null "> and receiver_city_id = #{receiverCityId}</if>
<if test="receiverDistrictId != null "> and receiver_district_id = #{receiverDistrictId}</if>
<if test="receiverDetailAddress != null and receiverDetailAddress != ''"> and receiver_detail_address = #{receiverDetailAddress}</if>
<if test="note != null and note != ''"> and note = #{note}</if>
<if test="confirmStatus != null "> and confirm_status = #{confirmStatus}</if>
<if test="deleteStatus != null "> and delete_status = #{deleteStatus}</if>
<if test="paymentTime != null "> and payment_time = #{paymentTime}</if>
<if test="deliveryTime != null "> and delivery_time = #{deliveryTime}</if>
<if test="receiveTime != null "> and receive_time = #{receiveTime}</if>
</where>
</select>
<select id="selectManagerOrderPage" resultType="com.cyl.manager.oms.pojo.vo.ManagerOrderVO">
select
a.id,
a.order_sn orderSn,
a.aftersale_status aftersaleStatus,
a.status,
a.member_username userName,
a.total_amount totalAmount,
a.pay_amount payAmount,
a.note,
a.create_time createTime,
a.payment_time payTime,
a.receive_time receiveTime,
a.pay_type payType,
a.receiver_name receiverName,
a.receiver_phone receiverPhone,
a.receiver_province receiverProvince,
a.receiver_city receiverCity,
a.receiver_district receiverDistrict,
a.receiver_detail_address receiverDetailAddress,
-- b.quantity buyNum,
-- b.pic,
-- b.sp_data spData,
-- b.product_id productId,
-- b.product_name productName,
c.phone userPhone,
c.nickname nickName
from oms_order a
-- left join oms_order_item b on a.id = b.order_id
left join ums_member c on a.member_id = c.id
where a.aftersale_status = 1
<if test="orderSn != null and orderSn != ''">
and a.order_sn = #{orderSn}
</if>
<!--<if test="productName != null and productName != ''">-->
<!--and instr(b.product_name, #{productName}) > 0-->
<!--</if>-->
<if test="receiverProvinceId != null ">
and a.receiver_province_id = #{receiverProvinceId}
</if>
<if test="receiverCityId != null">
and a.receiver_city_id = #{receiverCityId}
</if>
<if test="receiverDistrictId != null">
and a.receiver_district_id = #{receiverDistrictId}
</if>
<if test="userPhone != null and userPhone != ''">
and c.phone_encrypted=#{userPhone} > 0
</if>
<if test="status != null">
and a.status = #{status}
</if>
<if test="payType != null">
and a.pay_type=#{payType}
</if>
<if test="startTime != null and endTime != null">
and a.create_time between #{startTime} and #{endTime}
</if>
order by a.create_time desc
</select>
3 years ago
</mapper>