提交 d84f0ccf authored 作者: zgy's avatar zgy

完成汇率转换接口

上级 0bd9c725
......@@ -31,14 +31,16 @@ public class TbCfOrderController {
@ApiOperation("用户结算,返回订单")
@GetMapping("/settle")
public Result<TbCfOrderVo> settleAccount(@ApiParam("发放ID") @RequestParam(value = "toitableId",required = false) String toitableId) throws IOException, URISyntaxException, ExecutionException, InterruptedException, TimeoutException {
public Result<TbCfOrderVo> settleAccount(@ApiParam("发放ID") @RequestParam(value = "toitableId", required = false) String toitableId) throws IOException, URISyntaxException, ExecutionException, InterruptedException, TimeoutException {
return tbCfOrderService.settleAccount(toitableId);
}
@ApiOperation("用户确定下单")
@PostMapping("/place")
public Result placeOrder(@ApiParam("订单详情") @RequestBody TbCfOrderVo tbCfOrderVo,@ApiParam("发放ID") @RequestParam(value = "toitableId",required = false) String toitableId) throws IOException, URISyntaxException, ExecutionException, InterruptedException, TimeoutException {
return tbCfOrderService.placeOrder(tbCfOrderVo,toitableId);
public Result placeOrder(@ApiParam("订单详情") @RequestBody TbCfOrderVo tbCfOrderVo, @ApiParam("发放ID") @RequestParam(value = "toitableId", required = false) String toitableId) throws IOException, URISyntaxException, ExecutionException, InterruptedException, TimeoutException {
return tbCfOrderService.placeOrder(tbCfOrderVo, toitableId);
}
/**
* pageNum 页数
* pageSize 每页大小
......@@ -63,11 +65,13 @@ public class TbCfOrderController {
public Result payForOrder(@ApiParam("订单id") @PathVariable("orderId") String orderId, @ApiParam("支付token") @PathVariable("token") String token) {
return tbCfOrderService.payForOrder(orderId, token);
}
@ApiOperation("发起订单支付")
@PostMapping("/pay/{orderId}")
public Result rePayForOrder(@ApiParam("订单id") @PathVariable("orderId") String orderId) {
return tbCfOrderService.rePayForOrder(orderId);
}
@ApiOperation("根据订单id,查询物流详情")
@GetMapping("/express/{orderId}")
public Result queryOrderExpressInfo(@ApiParam("订单id") @PathVariable String orderId) throws IOException {
......@@ -81,11 +85,25 @@ public class TbCfOrderController {
}
/**
* 根据订单号获取详细订单数据
* 根据订单号获取详细订单数据
*/
@ApiOperation(value = "根据订单号获取详细订单数据")
@GetMapping(value = "/detail/{orderId}")
public Result getOrderDetail(@PathVariable("orderId") String orderId) {
return tbCfOrderService.getOrderDetail(orderId);
}
/**
* 汇率转换(美元转换成其他)
*
* @param price
* @param currency
* @return
*/
@ApiOperation("汇率转换")
@GetMapping("/currencyConversion")
public Result currencyConversion(@ApiParam("价格") @RequestParam("price") String price,
@ApiParam("兑换货币") @RequestParam("currency") String currency) {
return tbCfOrderService.currencyConversion(price, currency);
}
}
......@@ -17,27 +17,32 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
/**
* 获取用户订单数据
*
* @param userId
* @param orderStatus OrderStatusEnum
* @return
*/
List<TbCfOrderEntity> getUserOrderList(String userId,Integer orderStatus);
List<TbCfOrderEntity> getUserOrderList(String userId, Integer orderStatus);
/**
* 获取订单内商品
*
* @param orderId
* @return
*/
List<TbCfItemDetailEntity> getOrderItemList(String orderId);
/**
* 获取订单内商品
* 获取订单内商品
*
* @param orderId
* @return
*/
List<ItemEntity> getItemList(String orderId);
/**
* 获取付款订单
*
* @param beginDate
* @param endDate
* @return
......@@ -46,12 +51,14 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
/**
* 获取某段时间已发货订单数据
*
* @return
*/
List<TbCfItemShippedEntity> getDeliveryList(Date beginDate, Date endDate);
/**
* 根据订单id获取订单实体
*
* @param orderId
* @return
*/
......@@ -62,10 +69,19 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
/**
* 根据订单id和商品id查询订单记录id //后续根据此id 查询物流信息
*
* @param orderId
* @param itemId
* @return
*/
String getOrdersId(String orderId, String itemId);
/**
* 汇率转换
*
* @param currency
* @return
*/
TbCfExchangeEntity currencyConversion(String currency);
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 汇率管理实体
* 表名 tb_cf_exchange
*
* @author lipengjun
* @date 2019-12-10 15:29:22
*/
public class TbCfExchangeEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 转换类型
*/
private String type;
/**
* 货币
*/
private String currency;
/**
* 兑换货币
*/
private String exchangeCurrency;
/**
* 汇率
*/
private BigDecimal exchangeRate;
/**
* 删除标志 0:正常 1:已删除
*/
private Integer delFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 设置:ID
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取:ID
*/
public String getId() {
return id;
}
/**
* 设置:转换类型
*/
public void setType(String type) {
this.type = type;
}
/**
* 获取:转换类型
*/
public String getType() {
return type;
}
/**
* 设置:货币
*/
public void setCurrency(String currency) {
this.currency = currency;
}
/**
* 获取:货币
*/
public String getCurrency() {
return currency;
}
/**
* 设置:兑换货币
*/
public void setExchangeCurrency(String exchangeCurrency) {
this.exchangeCurrency = exchangeCurrency;
}
/**
* 获取:兑换货币
*/
public String getExchangeCurrency() {
return exchangeCurrency;
}
/**
* 设置:汇率
*/
public void setExchangeRate(BigDecimal exchangeRate) {
this.exchangeRate = exchangeRate;
}
/**
* 获取:汇率
*/
public BigDecimal getExchangeRate() {
return exchangeRate;
}
/**
* 设置:删除标志 0:正常 1:已删除
*/
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
/**
* 获取:删除标志 0:正常 1:已删除
*/
public Integer getDelFlag() {
return delFlag;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
}
......@@ -3,6 +3,8 @@ package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity;
import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.IOException;
import java.net.URISyntaxException;
......@@ -173,4 +175,6 @@ public interface TbCfOrderService {
Result getDescriptionById(String descriptionId);
Result rePayForOrder(String orderId);
Result currencyConversion(String price, String currency);
}
......@@ -185,8 +185,8 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
} else {
//获取下单的订单数据
TbCfOrderVo definiteOrder = ensureOrder(tbCfUserInfoVo, pageOrder, tbCfCartItemDetailList, toitableId);
for( TbCfCartItemDetailVo itemList: tbCfCartItemDetailList ){
TbCfItemOrderREntity tbCfItemOrderREntity=new TbCfItemOrderREntity();
for (TbCfCartItemDetailVo itemList : tbCfCartItemDetailList) {
TbCfItemOrderREntity tbCfItemOrderREntity = new TbCfItemOrderREntity();
tbCfItemOrderREntity.setOrderItemId(IdUtil.createIdbyUUID());
tbCfItemOrderREntity.setOrderId(definiteOrder.getOrderId());
tbCfItemOrderREntity.setItemId(itemList.getItemId());
......@@ -353,6 +353,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
/**
* 获取某段时间的付款订单数据
*
* @return
*/
@Override
......@@ -370,8 +371,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
}
return result;
}
/**
* 获取某段时间已发货订单数据
*
* @return
*/
@Override
......@@ -385,7 +388,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
Date endDate = new Date(endTime * 1000);
List<TbCfItemShippedEntity> orderList = tbCfOrderDao.getDeliveryList(beginDate, endDate);
// TODO 暂设为赞比亚
for(TbCfItemShippedEntity list:orderList ){
for (TbCfItemShippedEntity list : orderList) {
list.setCountry("赞比亚");
}
PageInfo<TbCfItemShippedEntity> pageInfo = new PageInfo<>(orderList);
......@@ -393,8 +396,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
}
return result;
}
/**
* 根据订单号获取详细订单数据 给第三方的接口
*
* @param orderId
* @return
*/
......@@ -427,6 +432,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
result.setData(orderEntity);
return result;
}
@Override
public Result deleteOrder(String orderId) {
Result result = new Result();
......@@ -467,8 +473,8 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
@Override
public Result getDescriptionById(String descriptionId) {
Result<ExpressTemplateVo> result = new Result<>();
ExpressTemplateVo tbCfExpressTemplateEntity= new ExpressTemplateVo();
ExpressTemplateVo expressTemplate=tbCfExpressTemplateDao.getDescriptionById(descriptionId);
ExpressTemplateVo tbCfExpressTemplateEntity = new ExpressTemplateVo();
ExpressTemplateVo expressTemplate = tbCfExpressTemplateDao.getDescriptionById(descriptionId);
tbCfExpressTemplateEntity.setDescriptionId(expressTemplate.getDescriptionId());
tbCfExpressTemplateEntity.setDescriptionName(expressTemplate.getDescriptionName());
tbCfExpressTemplateEntity.setExpressFee(expressTemplate.getExpressFee());
......@@ -480,11 +486,37 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
@Override
public Result rePayForOrder(String orderId) {
Result result=new Result();
TbCfOrderEntity order=tbCfOrderDao.queryObject(orderId);
Result result = new Result();
TbCfOrderEntity order = tbCfOrderDao.queryObject(orderId);
return result.setData(order);
}
/**
* 汇率转换
*
* @param price
* @param currency
* @return
*/
@Override
public Result currencyConversion(String price, String currency) {
Result result = new Result();
try {
if (!StringUtils.isBlank(price) && !StringUtils.isBlank(currency)) {
TbCfExchangeEntity exchangeEntity = tbCfOrderDao.currencyConversion(currency.toUpperCase());
BigDecimal rate = exchangeEntity.getExchangeRate();
BigDecimal oldPrice = new BigDecimal(price);
BigDecimal resultPrice = oldPrice.multiply(rate);
result.setData(resultPrice).setMessage(ResultCodeEnum.SUCCESS.getDesc());
} else {
result.setCode(ResultCodeEnum.QUERY_ERROR.getCode()).setMessage(ResultCodeEnum.QUERY_ERROR.getDesc());
}
} catch (Exception e) {
result.setCode(ResultCodeEnum.QUERY_ERROR.getCode()).setMessage(e.getMessage());
}
return result;
}
/**
* 记录财务流水
......@@ -735,14 +767,14 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
itemsPrice = itemsPrice.add(itemSourcePrice.multiply(itemNum));
//计算运费
BigDecimal expressCost = getExpressTemplate(tbCfCartItemDetailVo.getItemCategory());
BigDecimal continuationFee=getContinuationFee(tbCfCartItemDetailVo.getItemCategory());
BigDecimal continuationFee = getContinuationFee(tbCfCartItemDetailVo.getItemCategory());
//expressCost = expressCost.multiply(itemNum);
if("1".equals(itemNum)){
if ("1".equals(itemNum)) {
expressCost = expressCost.multiply(itemNum);
}else{
BigDecimal a= BigDecimal.valueOf(1);
} else {
BigDecimal a = BigDecimal.valueOf(1);
BigDecimal dj = continuationFee.multiply(itemNum.subtract(a));
expressCost =dj.add(expressCost);
expressCost = dj.add(expressCost);
}
totalExpressCost = totalExpressCost.add(expressCost);
}
......@@ -771,6 +803,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
TbCfExpressTemplateEntity tbCfExpressTemplateEntity = tbCfExpressTemplateDao.queryObject(templateId);
return tbCfExpressTemplateEntity.getExpressFee();
}
/**
* 获取运费 TODO 运费模板可改为缓存
*
......
......@@ -39,12 +39,12 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
# 测试环境
# url: jdbc:mysql://47.106.242.175:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
# username: root
# password: diaoyun666
url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
url: jdbc:mysql://47.106.242.175:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
username: root
password: Diaoyunnuli.8
password: diaoyun666
# url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
# username: root
# password: Diaoyunnuli.8
# 连接池配置
initial-size: 5
......
......@@ -3,39 +3,48 @@
<mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfOrderDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity" id="tbCfOrderMap">
<result property="orderId" column="order_id"/>
<result property="orderNo" column="order_no"/>
<result property="orderName" column="order_name"/>
<result property="orderTime" column="order_time"/>
<result property="updateTime" column="update_time"/>
<result property="dealTime" column="deal_time"/>
<result property="closeTime" column="close_time"/>
<result property="orderStatus" column="order_status"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="deliveryAddressId" column="delivery_address_id"/>
<result property="deliveryAddress" column="delivery_address"/>
<result property="deliveryName" column="delivery_name"/>
<result property="deliveryPhone" column="delivery_phone"/>
<result property="itemsPrice" column="items_price"/>
<result property="totalPrice" column="total_price"/>
<result property="realityPay" column="reality_pay"/>
<result property="deliveryFlag" column="delivery_flag"/>
<result property="deliveryTime" column="delivery_time"/>
<result property="expressCost" column="express_cost"/>
<result property="couponId" column="coupon_id"/>
<result property="couponTitle" column="coupon_title"/>
<result property="couponPrice" column="coupon_price"/>
<result property="fee" column="fee"/>
<result property="tax" column="tax"/>
<result property="payId" column="pay_id"/>
<result property="payStatus" column="pay_status"/>
<result property="enableFlag" column="enable_flag"/>
<result property="descripitionName" column="descripition_name"></result>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity" id="tbCfOrderMap">
<result property="orderId" column="order_id"/>
<result property="orderNo" column="order_no"/>
<result property="orderName" column="order_name"/>
<result property="orderTime" column="order_time"/>
<result property="updateTime" column="update_time"/>
<result property="dealTime" column="deal_time"/>
<result property="closeTime" column="close_time"/>
<result property="orderStatus" column="order_status"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="deliveryAddressId" column="delivery_address_id"/>
<result property="deliveryAddress" column="delivery_address"/>
<result property="deliveryName" column="delivery_name"/>
<result property="deliveryPhone" column="delivery_phone"/>
<result property="itemsPrice" column="items_price"/>
<result property="totalPrice" column="total_price"/>
<result property="realityPay" column="reality_pay"/>
<result property="deliveryFlag" column="delivery_flag"/>
<result property="deliveryTime" column="delivery_time"/>
<result property="expressCost" column="express_cost"/>
<result property="couponId" column="coupon_id"/>
<result property="couponTitle" column="coupon_title"/>
<result property="couponPrice" column="coupon_price"/>
<result property="fee" column="fee"/>
<result property="tax" column="tax"/>
<result property="payId" column="pay_id"/>
<result property="payStatus" column="pay_status"/>
<result property="enableFlag" column="enable_flag"/>
<result property="descripitionName" column="descripition_name"></result>
</resultMap>
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfExchangeEntity" id="tbCfExchangeMap">
<result property="id" column="id"/>
<result property="type" column="type"/>
<result property="currency" column="currency"/>
<result property="exchangeCurrency" column="exchange_currency"/>
<result property="exchangeRate" column="exchange_rate"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
select
`order_id`,
`order_no`,
......@@ -69,7 +78,7 @@
from tb_cf_order
where order_id = #{id}
</select>
<select id="getOrder" resultType="com.diaoyun.zion.chinafrica.entity.OrderEntity">
<select id="getOrder" resultType="com.diaoyun.zion.chinafrica.entity.OrderEntity">
select
r.order_item_id order_id,
o.order_no,
......@@ -81,7 +90,7 @@
where r.order_item_id = #{id}
</select>
<select id="getOrders" resultType="com.diaoyun.zion.chinafrica.entity.OrderEntity">
<select id="getOrders" resultType="com.diaoyun.zion.chinafrica.entity.OrderEntity">
select
r.order_item_id order_id,
o.order_no,
......@@ -93,67 +102,69 @@
where r.order_item_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
select
`order_id`,
`order_no`,
`order_name`,
`order_time`,
`update_time`,
`deal_time`,
`close_time`,
`order_status`,
`user_id`,
`user_name`,
`delivery_address_id`,
`delivery_address`,
`delivery_name`,
`delivery_phone`,
`items_price`,
`total_price`,
`reality_pay`,
`delivery_flag`,
`delivery_time`,
`express_cost`,
`coupon_id`,
`coupon_title`,
`coupon_price`,
`fee`,
`tax`,
`pay_id`,
`pay_status`,
`enable_flag`,
`descripition_name`
from tb_cf_order
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by order_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
select
`order_id`,
`order_no`,
`order_name`,
`order_time`,
`update_time`,
`deal_time`,
`close_time`,
`order_status`,
`user_id`,
`user_name`,
`delivery_address_id`,
`delivery_address`,
`delivery_name`,
`delivery_phone`,
`items_price`,
`total_price`,
`reality_pay`,
`delivery_flag`,
`delivery_time`,
`express_cost`,
`coupon_id`,
`coupon_title`,
`coupon_price`,
`fee`,
`tax`,
`pay_id`,
`pay_status`,
`enable_flag`,
`descripition_name`
from tb_cf_order
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by order_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_order
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<select id="queryCouponPrice" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_order
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<select id="queryCouponPrice" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select t2.* from tb_cf_toicoupon t1 left join tb_cf_coupon t2 on t2.coupon_id=t1.coupon_id where t1.toitable_id=#{toitableId}
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
<select id="currencyConversion" resultMap="tbCfExchangeMap">
SELECT * from tb_cf_exchange where exchange_currency=#{exchangeCurrency}
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
insert into tb_cf_order(
`order_id`,
`order_no`,
......@@ -216,90 +227,90 @@
#{descripitionName})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
update tb_cf_order
<set>
<if test="orderNo != null">`order_no` = #{orderNo}, </if>
<if test="orderName != null">`order_name` = #{orderName}, </if>
<if test="orderTime != null">`order_time` = #{orderTime}, </if>
<if test="updateTime != null">`update_time` = #{updateTime}, </if>
<if test="dealTime != null">`deal_time` = #{dealTime}, </if>
<if test="closeTime != null">`close_time` = #{closeTime}, </if>
<if test="orderStatus != null">`order_status` = #{orderStatus}, </if>
<if test="userId != null">`user_id` = #{userId}, </if>
<if test="userName != null">`user_name` = #{userName}, </if>
<if test="deliveryAddressId != null">`delivery_address_id` = #{deliveryAddressId}, </if>
<if test="deliveryAddress != null">`delivery_address` = #{deliveryAddress}, </if>
<if test="deliveryName != null">`delivery_name` = #{deliveryName}, </if>
<if test="deliveryPhone != null">`delivery_phone` = #{deliveryPhone}, </if>
<if test="itemsPrice != null">`items_price` = #{itemsPrice}, </if>
<if test="totalPrice != null">`total_price` = #{totalPrice}, </if>
<if test="realityPay != null">`reality_pay` = #{realityPay}, </if>
<if test="deliveryFlag != null">`delivery_flag` = #{deliveryFlag}, </if>
<if test="deliveryTime != null">`delivery_time` = #{deliveryTime}, </if>
<if test="expressCost != null">`express_cost` = #{expressCost}, </if>
<if test="couponId != null">`coupon_id` = #{couponId}, </if>
<if test="couponTitle != null">`coupon_title` = #{couponTitle}, </if>
<if test="couponPrice != null">`coupon_price` = #{couponPrice}, </if>
<if test="fee != null">`fee` = #{fee}, </if>
<if test="tax != null">`tax` = #{tax}, </if>
<if test="payId != null">`pay_id` = #{payId}, </if>
<if test="payStatus != null">`pay_status` = #{payStatus},</if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag},</if>
<if test="descripitionName != null">`descripition_name` = #{descripitionName}</if>
</set>
where order_id = #{orderId}
</update>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
update tb_cf_order
<set>
<if test="orderNo != null">`order_no` = #{orderNo},</if>
<if test="orderName != null">`order_name` = #{orderName},</if>
<if test="orderTime != null">`order_time` = #{orderTime},</if>
<if test="updateTime != null">`update_time` = #{updateTime},</if>
<if test="dealTime != null">`deal_time` = #{dealTime},</if>
<if test="closeTime != null">`close_time` = #{closeTime},</if>
<if test="orderStatus != null">`order_status` = #{orderStatus},</if>
<if test="userId != null">`user_id` = #{userId},</if>
<if test="userName != null">`user_name` = #{userName},</if>
<if test="deliveryAddressId != null">`delivery_address_id` = #{deliveryAddressId},</if>
<if test="deliveryAddress != null">`delivery_address` = #{deliveryAddress},</if>
<if test="deliveryName != null">`delivery_name` = #{deliveryName},</if>
<if test="deliveryPhone != null">`delivery_phone` = #{deliveryPhone},</if>
<if test="itemsPrice != null">`items_price` = #{itemsPrice},</if>
<if test="totalPrice != null">`total_price` = #{totalPrice},</if>
<if test="realityPay != null">`reality_pay` = #{realityPay},</if>
<if test="deliveryFlag != null">`delivery_flag` = #{deliveryFlag},</if>
<if test="deliveryTime != null">`delivery_time` = #{deliveryTime},</if>
<if test="expressCost != null">`express_cost` = #{expressCost},</if>
<if test="couponId != null">`coupon_id` = #{couponId},</if>
<if test="couponTitle != null">`coupon_title` = #{couponTitle},</if>
<if test="couponPrice != null">`coupon_price` = #{couponPrice},</if>
<if test="fee != null">`fee` = #{fee},</if>
<if test="tax != null">`tax` = #{tax},</if>
<if test="payId != null">`pay_id` = #{payId},</if>
<if test="payStatus != null">`pay_status` = #{payStatus},</if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag},</if>
<if test="descripitionName != null">`descripition_name` = #{descripitionName}</if>
</set>
where order_id = #{orderId}
</update>
<delete id="delete">
<delete id="delete">
delete from tb_cf_order where order_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_order where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
<delete id="deleteBatch">
delete from tb_cf_order where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
<!--获取用户订单数据-->
<select id="getUserOrderList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
select
o.order_id,
o.order_no,
o.order_name,
o.order_time,
o.deal_time,
o.user_id,
o.user_name,
o.delivery_address_id,
o.delivery_address,
o.delivery_name,
o.delivery_phone,
o.items_price,
o.total_price,
o.reality_pay,
o.express_cost,
o.coupon_id,
o.coupon_title,
o.coupon_price,
o.order_status,
o.fee,
o.tax,
o.pay_id,
o.pay_status,
o.enable_flag,
o.descripition_name
from tb_cf_order o
where o.user_id=#{userId} and o.enable_flag=1
<if test="orderStatus != null">and o.order_status = #{orderStatus}</if>
order by o.order_time desc
</select>
<select id="getOrdersId" resultType="String">
<!--获取用户订单数据-->
<select id="getUserOrderList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
select
o.order_id,
o.order_no,
o.order_name,
o.order_time,
o.deal_time,
o.user_id,
o.user_name,
o.delivery_address_id,
o.delivery_address,
o.delivery_name,
o.delivery_phone,
o.items_price,
o.total_price,
o.reality_pay,
o.express_cost,
o.coupon_id,
o.coupon_title,
o.coupon_price,
o.order_status,
o.fee,
o.tax,
o.pay_id,
o.pay_status,
o.enable_flag,
o.descripition_name
from tb_cf_order o
where o.user_id=#{userId} and o.enable_flag=1
<if test="orderStatus != null">and o.order_status = #{orderStatus}</if>
order by o.order_time desc
</select>
<select id="getOrdersId" resultType="String">
select r.order_item_id ordersId from tb_cf_item_order_r r where r.order_id=#{orderId} and r.item_id=#{itemId}
</select>
<!--根据订单id,获取订单内商品详情-->
<select id="getOrderItemList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity">
<!--根据订单id,获取订单内商品详情-->
<select id="getOrderItemList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity">
SELECT
t1.*
FROM
......@@ -309,8 +320,8 @@
WHERE
t2.enable_flag=1 and t2.order_id=#{order_id}
</select>
<!--根据订单id,获取订单内商品详情-->
<select id="getItemList" resultType="com.diaoyun.zion.chinafrica.entity.ItemEntity">
<!--根据订单id,获取订单内商品详情-->
<select id="getItemList" resultType="com.diaoyun.zion.chinafrica.entity.ItemEntity">
SELECT
t1.item_id,
t1.item_title,
......@@ -327,16 +338,16 @@
WHERE
t2.enable_flag = 1 and t2.order_item_id=#{orderId}
</select>
<!--获取付款订单-->
<select id="getOrderListByTime" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
<!--获取付款订单-->
<select id="getOrderListByTime" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
select o.user_id,r.order_item_id order_id,o.deal_time
from tb_cf_order o left join tb_cf_item_order_r r on r.order_id=o.order_id
where pay_status=20 and r.enable_flag=1
and deal_time <![CDATA[ >= ]]> #{beginDate} and deal_time <![CDATA[ < ]]> #{endDate}
</select>
<!--获取某段时间已发货订单数据-->
<select id="getDeliveryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfItemShippedEntity">
<!--获取某段时间已发货订单数据-->
<select id="getDeliveryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfItemShippedEntity">
select
DISTINCT
r.order_item_id orderId,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论