Commit 3ab6e756 authored by shengnan hu's avatar shengnan hu
Browse files

init

parents
Pipeline #294 passed with stage
in 2 minutes and 13 seconds
<?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.mall4j.cloud.order.mapper.OrderAddrMapper">
<resultMap id="orderAddrMap" type="com.mall4j.cloud.order.model.OrderAddr">
<id column="order_addr_id" property="orderAddrId" />
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="user_id" property="userId"/>
<result column="consignee" property="consignee"/>
<result column="province_id" property="provinceId"/>
<result column="province" property="province"/>
<result column="city_id" property="cityId"/>
<result column="city" property="city"/>
<result column="area_id" property="areaId"/>
<result column="area" property="area"/>
<result column="addr" property="addr"/>
<result column="post_code" property="postCode"/>
<result column="mobile" property="mobile"/>
</resultMap>
<sql id="Vo_Column_List">
`order_addr_id`,`create_time`,`update_time`,`user_id`,`consignee`,`province_id`,`province`,`city_id`,`city`,`area_id`,`area`,`addr`,`post_code`,`mobile`
</sql>
<select id="list" resultType="com.mall4j.cloud.order.model.OrderAddr">
select <include refid="Vo_Column_List"/> from order_addr order by order_addr_id desc
</select>
<select id="getByOrderAddrId" resultType="com.mall4j.cloud.order.model.OrderAddr">
select <include refid="Vo_Column_List"/> from order_addr where order_addr_id = #{orderAddrId}
</select>
<insert id="save" useGeneratedKeys="true" keyProperty="orderAddr.orderAddrId">
insert into order_addr (`user_id`,`consignee`,`province_id`,`province`,`city_id`,`city`,`area_id`,`area`,`addr`,`post_code`,`mobile`)
values (#{orderAddr.userId},#{orderAddr.consignee},#{orderAddr.provinceId},#{orderAddr.province},#{orderAddr.cityId},#{orderAddr.city},#{orderAddr.areaId},#{orderAddr.area},#{orderAddr.addr},#{orderAddr.postCode},#{orderAddr.mobile});
</insert>
<update id="update">
update order_addr
<set>
<if test="orderAddr.userId != null">
`user_id` = #{orderAddr.userId},
</if>
<if test="orderAddr.consignee != null">
`consignee` = #{orderAddr.consignee},
</if>
<if test="orderAddr.provinceId != null">
`province_id` = #{orderAddr.provinceId},
</if>
<if test="orderAddr.province != null">
`province` = #{orderAddr.province},
</if>
<if test="orderAddr.cityId != null">
`city_id` = #{orderAddr.cityId},
</if>
<if test="orderAddr.city != null">
`city` = #{orderAddr.city},
</if>
<if test="orderAddr.areaId != null">
`area_id` = #{orderAddr.areaId},
</if>
<if test="orderAddr.area != null">
`area` = #{orderAddr.area},
</if>
<if test="orderAddr.addr != null">
`addr` = #{orderAddr.addr},
</if>
<if test="orderAddr.postCode != null">
`post_code` = #{orderAddr.postCode},
</if>
<if test="orderAddr.mobile != null">
`mobile` = #{orderAddr.mobile},
</if>
</set>
where order_addr_id = #{orderAddr.orderAddrId}
</update>
<delete id="deleteById">
delete from order_addr where order_addr_id = #{orderAddrId}
</delete>
</mapper>
<?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.mall4j.cloud.order.mapper.OrderItemMapper">
<resultMap id="orderItemMap" type="com.mall4j.cloud.order.model.OrderItem">
<id column="order_item_id" property="orderItemId"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="shop_id" property="shopId"/>
<result column="order_id" property="orderId"/>
<result column="spu_id" property="spuId"/>
<result column="sku_id" property="skuId"/>
<result column="user_id" property="userId"/>
<result column="count" property="count"/>
<result column="spu_name" property="spuName"/>
<result column="sku_name" property="skuName"/>
<result column="pic" property="pic"/>
<result column="delivery_type" property="deliveryType"/>
<result column="shop_cart_time" property="shopCartTime"/>
<result column="price" property="price"/>
<result column="spu_total_amount" property="spuTotalAmount"/>
</resultMap>
<sql id="Vo_Column_List">
`order_item_id`
,
`create_time`,
`update_time`,
`shop_id`,
`order_id`,
`spu_id`,
`sku_id`,
`user_id`,
`count`,
`spu_name`,
`sku_name`,
`pic`,
`delivery_type`,
`shop_cart_time`,
`price`,
`spu_total_amount`
</sql>
<insert id="save">
insert into order_item (`shop_id`, `order_id`, `spu_id`, `sku_id`, `user_id`, `count`,
`spu_name`, `sku_name`, `pic`, `delivery_type`,
`shop_cart_time`, `price`, `spu_total_amount`)
values (#{orderItem.shopId}, #{orderItem.orderId}, #{orderItem.spuId}, #{orderItem.skuId}, #{orderItem.userId},
#{orderItem.count}, #{orderItem.spuName}, #{orderItem.skuName}, #{orderItem.pic},
#{orderItem.deliveryType}, #{orderItem.shopCartTime}, #{orderItem.price}, #{orderItem.spuTotalAmount});
</insert>
<update id="update">
update order_item
<set>
<if test="orderItem.shopId != null">
`shop_id` = #{orderItem.shopId},
</if>
<if test="orderItem.orderId != null">
`order_id` = #{orderItem.orderId},
</if>
<if test="orderItem.spuId != null">
`spu_id` = #{orderItem.spuId},
</if>
<if test="orderItem.skuId != null">
`sku_id` = #{orderItem.skuId},
</if>
<if test="orderItem.userId != null">
`user_id` = #{orderItem.userId},
</if>
<if test="orderItem.count != null">
`count` = #{orderItem.count},
</if>
<if test="orderItem.spuName != null">
`spu_name` = #{orderItem.spuName},
</if>
<if test="orderItem.skuName != null">
`sku_name` = #{orderItem.skuName},
</if>
<if test="orderItem.pic != null">
`pic` = #{orderItem.pic},
</if>
<if test="orderItem.deliveryType != null">
`delivery_type` = #{orderItem.deliveryType},
</if>
<if test="orderItem.shopCartTime != null">
`shop_cart_time` = #{orderItem.shopCartTime},
</if>
<if test="orderItem.price != null">
`price` = #{orderItem.price},
</if>
<if test="orderItem.spuTotalAmount != null">
`spu_total_amount` = #{orderItem.spuTotalAmount}
</if>
</set>
where order_item_id = #{orderItem.orderItemId}
</update>
<delete id="deleteById">
delete
from order_item
where order_item_id = #{orderItemId}
</delete>
<insert id="saveBatch">
insert into order_item (`shop_id`, `order_id`, `spu_id`, `sku_id`, `user_id`, `count`, `spu_name`,
`sku_name`, `pic`,`delivery_type`, `shop_cart_time`,
`price`,`spu_total_amount`)
values
<foreach collection="orderItems" item="orderItem" separator=",">
(#{orderItem.shopId}, #{orderItem.orderId}, #{orderItem.spuId}, #{orderItem.skuId}, #{orderItem.userId},
#{orderItem.count}, #{orderItem.spuName},#{orderItem.skuName}, #{orderItem.pic},
#{orderItem.deliveryType}, #{orderItem.shopCartTime}, #{orderItem.price},#{orderItem.spuTotalAmount})
</foreach>
</insert>
<select id="listOrderItemsByOrderId" resultMap="orderItemMap">
select toi.*
from order_item toi
where toi.order_id = #{orderId}
</select>
<select id="getSpuNameListByOrderIds" resultType="java.lang.String">
select spu_name from order_item where order_id in
<foreach collection="orderIdList" item="orderId" separator="," close=")" open="(">
#{orderId}
</foreach>
</select>
<select id="countByOrderId" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM order_item
WHERE order_id = #{orderId}
</select>
</mapper>
<?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.mall4j.cloud.order.mapper.OrderMapper">
<resultMap id="orderMap" type="com.mall4j.cloud.order.model.Order">
<id column="order_id" property="orderId"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="shop_id" property="shopId"/>
<result column="user_id" property="userId"/>
<result column="order_addr_id" property="orderAddrId"/>
<result column="shop_name" property="shopName"/>
<result column="total" property="total"/>
<result column="status" property="status"/>
<result column="delivery_type" property="deliveryType"/>
<result column="close_type" property="closeType"/>
<result column="all_count" property="allCount"/>
<result column="pay_time" property="payTime"/>
<result column="delivery_time" property="deliveryTime"/>
<result column="finally_time" property="finallyTime"/>
<result column="cancel_time" property="cancelTime"/>
<result column="is_payed" property="isPayed"/>
<result column="delete_status" property="deleteStatus"/>
</resultMap>
<resultMap type="com.mall4j.cloud.order.model.Order" id="orderAndOrderItem" extends="orderMap">
<collection property="orderItems" columnPrefix="oi_" ofType="com.mall4j.cloud.order.model.OrderItem">
<id column="order_item_id" jdbcType="BIGINT" property="orderItemId"/>
<result column="shop_id" property="shopId"/>
<result column="order_id" property="orderId"/>
<result column="spu_id" property="spuId"/>
<result column="sku_id" property="skuId"/>
<result column="user_id" property="userId"/>
<result column="count" property="count"/>
<result column="spu_name" property="spuName"/>
<result column="sku_name" property="skuName"/>
<result column="pic" property="pic"/>
<result column="delivery_type" property="deliveryType"/>
<result column="shop_cart_time" property="shopCartTime"/>
<result column="price" property="price"/>
<result column="spu_total_amount" property="spuTotalAmount"/>
</collection>
</resultMap>
<resultMap type="com.mall4j.cloud.api.order.bo.EsOrderBO" id="esOrderAndOrderItemAndUserAddrMap" extends="orderMap">
<result column="mobile" jdbcType="VARCHAR" property="mobile"/>
<result column="consignee" jdbcType="VARCHAR" property="consignee"/>
<collection property="orderItems" columnPrefix="oi_" ofType="com.mall4j.cloud.order.model.OrderItem">
<id column="order_item_id" jdbcType="BIGINT" property="orderItemId"/>
<result column="shop_id" property="shopId"/>
<result column="order_id" property="orderId"/>
<result column="spu_id" property="spuId"/>
<result column="sku_id" property="skuId"/>
<result column="user_id" property="userId"/>
<result column="count" property="count"/>
<result column="spu_name" property="spuName"/>
<result column="sku_name" property="skuName"/>
<result column="pic" property="pic"/>
<result column="delivery_type" property="deliveryType"/>
<result column="shop_cart_time" property="shopCartTime"/>
<result column="price" property="price"/>
<result column="spu_total_amount" property="spuTotalAmount"/>
</collection>
</resultMap>
<sql id="Vo_Column_List">
`order_id`,
`create_time`,
`update_time`,
`shop_id`,
`user_id`,
`order_addr_id`,
`shop_name`,
`total`,
`status`,
`delivery_type`,
`close_type`,
`all_count`,
`pay_time`,
`delivery_time`,
`finally_time`,
`cancel_time`,
`is_payed`,
`delete_status`
</sql>
<update id="update">
update `order`
<set>
<if test="order.shopId != null">
`shop_id` = #{order.shopId},
</if>
<if test="order.shopName != null">
`shop_name` = #{order.shopName},
</if>
<if test="order.userId != null">
`user_id` = #{order.userId},
</if>
<if test="order.orderAddrId != null">
`order_addr_id` = #{order.orderAddrId},
</if>
<if test="order.total != null">
`total` = #{order.total},
</if>
<if test="order.status != null">
`status` = #{order.status},
</if>
<if test="order.deliveryType != null">
`delivery_type` = #{order.deliveryType},
</if>
<if test="order.closeType != null">
`close_type` = #{order.closeType},
</if>
<if test="order.allCount != null">
`all_count` = #{order.allCount},
</if>
<if test="order.payTime != null">
`pay_time` = #{order.payTime},
</if>
<if test="order.deliveryTime != null">
`delivery_time` = #{order.deliveryTime},
</if>
<if test="order.finallyTime != null">
`finally_time` = #{order.finallyTime},
</if>
<if test="order.cancelTime != null">
`cancel_time` = #{order.cancelTime},
</if>
<if test="order.isPayed != null">
`is_payed` = #{order.isPayed},
</if>
<if test="order.deleteStatus != null">
`delete_status` = #{order.deleteStatus}
</if>
</set>
where order_id = #{order.orderId}
</update>
<delete id="deleteById">
delete from `order` where order_id = #{orderId}
</delete>
<insert id="saveBatch">
insert into `order` (`order_id`, `shop_id`, `shop_name`, `user_id`, `order_addr_id`, `total`, `status`, `delivery_type`,`close_type`,
`all_count`, `pay_time`, `delivery_time`, `finally_time`, `cancel_time`, `is_payed`, `delete_status`)
values
<foreach collection="orders" item="order" separator=",">
(#{order.orderId}, #{order.shopId}, #{order.shopName}, #{order.userId}, #{order.orderAddrId}, #{order.total}, #{order.status}, #{order.deliveryType},
#{order.closeType}, #{order.allCount}, #{order.payTime}, #{order.deliveryTime}, #{order.finallyTime},
#{order.cancelTime}, #{order.isPayed}, #{order.deleteStatus})
</foreach>
</insert>
<select id="getOrdersStatus" resultType="com.mall4j.cloud.api.order.bo.OrderStatusBO">
select `status`, `order_id` from `order` where order_id in
<foreach collection="orderIds" open="(" item="orderId" close=")" separator=",">
#{orderId}
</foreach>
</select>
<select id="getOrdersActualAmount" resultType="com.mall4j.cloud.api.order.vo.OrderAmountVO">
select SUM(total) as payAmount from `order` where order_id in
<foreach collection="orderIds" open="(" item="orderId" close=")" separator=",">
#{orderId}
</foreach>
</select>
<update id="updateByToPaySuccess">
update `order` set `status` = 2,is_payed =1,update_time=NOW(),pay_time=NOW()
where order_id in
<foreach collection="orderIds" item="orderId" separator="," open="(" close=")">
#{orderId}
</foreach>
</update>
<select id="getOrdersSimpleAmountInfo" resultType="com.mall4j.cloud.api.order.bo.OrderSimpleAmountInfoBO">
select `shop_id`, `order_id`, actual_total, platform_amount,`status`,close_type
from `order`
where order_id in
<foreach collection="orderIds" open="(" item="orderId" close=")" separator=",">
#{orderId}
</foreach>
</select>
<update id="cancelOrders">
update `order` set `status`=6,cancel_time = NOW(),update_time=NOW() where is_payed = 0 and order_id in
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
#{orderId}
</foreach>
</update>
<select id="getOrderByOrderIdAndUserId" resultMap="orderMap">
select o.* from `order` o where o.order_id = #{orderId} and o.user_id = #{userId}
</select>
<update id="receiptOrder">
update `order`
set `status` = 5,
finally_time = NOW(),
update_time = NOW()
where order_id = #{orderId} and `status` = 3
</update>
<update id="deleteOrder">
UPDATE `order` SET `delete_status` = 2 where order_id = #{orderId}
</update>
<select id="getOrderByOrderIdAndShopId" resultMap="orderMap">
select o.* from `order` o where o.order_id = #{orderId} and o.shop_id = #{shopId}
</select>
<select id="getOrderAndOrderItemData" resultMap="orderAndOrderItem">
SELECT o.user_id,
o.*,
oi.`order_item_id` oi_order_item_id ,
oi.`shop_id` oi_shop_id,
oi.`order_id` oi_order_id,
oi.`spu_id` oi_spu_id,
oi.`sku_id` oi_sku_id,
oi.`user_id` oi_user_id,
oi.`count` oi_count,
oi.`spu_name` oi_spu_name,
oi.`sku_name` oi_sku_name,
oi.`pic` oi_pic,
oi.`delivery_type` oi_delivery_type,
oi.`shop_cart_time` oi_shop_cart_time,
oi.`price` oi_price,
oi.`spu_total_amount` oi_spu_total_amount
from `order` o
join order_item oi on o.order_id = oi.order_id
where o.order_id = #{orderId}
<if test="shopId != null">
and o.shop_id = #{shopId}
</if>
</select>
<select id="getSubmitOrderPayAmountInfo" resultType="com.mall4j.cloud.order.bo.SubmitOrderPayAmountInfoBO">
select sum(total) as totalFee, max(create_time) as createTime from `order` where order_id in
<foreach collection="orderIdList" item="orderId" separator="," close=")" open="(">
#{orderId}
</foreach>
</select>
<select id="getEsOrder" resultMap="esOrderAndOrderItemAndUserAddrMap">
SELECT o.user_id,
o.*,
oi.`order_item_id` oi_order_item_id,
oi.`shop_id` oi_shop_id,
oi.`order_id` oi_order_id,
oi.`spu_id` oi_spu_id,
oi.`sku_id` oi_sku_id,
oi.`user_id` oi_user_id,
oi.`count` oi_count,
oi.`spu_name` oi_spu_name,
oi.`sku_name` oi_sku_name,
oi.`pic` oi_pic,
oi.`delivery_type` oi_delivery_type,
oi.`shop_cart_time` oi_shop_cart_time,
oi.`price` oi_price,
oi.`spu_total_amount` oi_spu_total_amount,
oa.consignee,
oa.mobile
FROM `order` AS o
JOIN order_item oi ON o.order_id = oi.order_id
left JOIN order_addr oa on o.order_addr_id = oa.order_addr_id
where o.order_id = #{orderId}
</select>
<select id="countNumberOfStatus" resultType="com.mall4j.cloud.order.vo.OrderCountVO">
SELECT COUNT(o.order_id) as all_count,
COUNT(CASE WHEN o.status = 1 THEN o.order_id ELSE NULL END) AS unPay,
COUNT(CASE WHEN o.status = 2 THEN o.order_id ELSE NULL END) AS payed,
COUNT(CASE WHEN o.status = 3 THEN o.order_id ELSE NULL END) AS consignment,
COUNT(CASE WHEN o.status = 5 THEN o.order_id ELSE NULL END) AS success
FROM `order` o WHERE o.user_id = #{userId} AND o.delete_status = 0
</select>
</mapper>
<?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.mall4j.cloud.order.mapper.OrderPayInfoMapper">
<resultMap id="orderPayInfoMap" type="com.mall4j.cloud.order.model.OrderPayInfo">
<id column="pay_id" property="payId" />
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="user_id" property="userId"/>
<result column="biz_pay_no" property="bizPayNo"/>
<result column="sys_type" property="sysType"/>
<result column="pay_status" property="payStatus"/>
<result column="pay_amount" property="payAmount"/>
<result column="version" property="version"/>
<result column="callback_content" property="callbackContent"/>
<result column="callback_time" property="callbackTime"/>
<result column="confirm_time" property="confirmTime"/>
</resultMap>
<insert id="save">
insert into order_pay_info (`user_id`,`biz_pay_no`,`sys_type`,`pay_type`,`pay_status`,`pay_score`,`pay_amount`,`version`,`callback_content`,`callback_time`,`confirm_time`)
values (#{orderPayInfo.userId},#{orderPayInfo.bizPayNo},#{orderPayInfo.sysType},#{orderPayInfo.payType},#{orderPayInfo.payStatus},#{orderPayInfo.payScore},#{orderPayInfo.payAmount},#{orderPayInfo.version},#{orderPayInfo.callbackContent},#{orderPayInfo.callbackTime},#{orderPayInfo.confirmTime});
</insert>
<update id="update">
update order_pay_info
<set>
<if test="orderPayInfo.userId != null">
`user_id` = #{orderPayInfo.userId},
</if>
<if test="orderPayInfo.bizPayNo != null">
`biz_pay_no` = #{orderPayInfo.bizPayNo},
</if>
<if test="orderPayInfo.sysType != null">
`sys_type` = #{orderPayInfo.sysType},
</if>
<if test="orderPayInfo.payStatus != null">
`pay_status` = #{orderPayInfo.payStatus},
</if>
<if test="orderPayInfo.payAmount != null">
`pay_amount` = #{orderPayInfo.payAmount},
</if>
<if test="orderPayInfo.version != null">
`version` = #{orderPayInfo.version},
</if>
<if test="orderPayInfo.callbackContent != null">
`callback_content` = #{orderPayInfo.callbackContent},
</if>
<if test="orderPayInfo.callbackTime != null">
`callback_time` = #{orderPayInfo.callbackTime},
</if>
<if test="orderPayInfo.confirmTime != null">
`confirm_time` = #{orderPayInfo.confirmTime},
</if>
</set>
where pay_id = #{orderPayInfo.payId}
</update>
<delete id="deleteById">
delete from order_pay_info where pay_id = #{payId}
</delete>
</mapper>
server:
port: 9106
spring:
application:
name: mall4cloud-order
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:192.168.1.46}:${NACOS_PORT:8848}
username: nacos
password: nacos
config:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
file-extension: yml
namespace:
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: ${spring.cloud.nacos.discovery.username}
password: ${spring.cloud.nacos.discovery.password}
profiles:
active: dev
mall4cloud:
job:
executor:
# job的端口,比自己的端口小100,就不会冲突咯
appname: mall4cloud-order
port: 9006
logpath:
logretentiondays: 30
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment