Ver a proveniência

[A端][需求]:多商户模式的查询语句更改

release_toaliyun_real
hupeng há 7 anos
ascendente
cometimento
b4bafdd9f1
5 ficheiros alterados com 61 adições e 169 eliminações
  1. +6
    -6
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponMerchant.java
  2. +2
    -16
      mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java
  3. +7
    -94
      mallinkService/src/main/java/com/iformall/domain/vo/WxOrderCouponVo.java
  4. +35
    -4
      mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml
  5. +11
    -49
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml

+ 6
- 6
mallinkService/src/main/java/com/iformall/domain/po/WxCouponMerchant.java Ver ficheiro

@@ -41,8 +41,8 @@ public class WxCouponMerchant implements Serializable {




/***/ /***/
@io.swagger.annotations.ApiModelProperty(value="",name="couponId")
private Long couponId;
@io.swagger.annotations.ApiModelProperty(value="",name="productId")
private Long productId;
/***/ /***/
@io.swagger.annotations.ApiModelProperty(value="",name="merchantId") @io.swagger.annotations.ApiModelProperty(value="",name="merchantId")
private Long merchantId; private Long merchantId;
@@ -64,11 +64,11 @@ public class WxCouponMerchant implements Serializable {




public Long getCouponId() { public Long getCouponId() {
return couponId;
return productId;
} }


public void setCouponId(Long couponId) {
this.couponId = couponId;
public void setCouponId(Long productId) {
this.productId = productId;
} }


public Long getMerchantId() { public Long getMerchantId() {
@@ -114,7 +114,7 @@ public class WxCouponMerchant implements Serializable {
public static enum Field public static enum Field
{ {
Id_ASC("`id` ASC"),Id_DESC("`id` DESC") Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC")
,ProductId_ASC("`product_id` ASC"),ProductId_DESC("`product_id` DESC")
,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC")
,Parameter_ASC("`parameter` ASC"),Parameter_DESC("`description` DESC") ,Parameter_ASC("`parameter` ASC"),Parameter_DESC("`description` DESC")
,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")


+ 2
- 16
mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java Ver ficheiro

@@ -1,34 +1,20 @@
package com.iformall.domain.vo; package com.iformall.domain.vo;


import com.iformall.domain.po.WxCouponOrder;
import com.iformall.domain.po.WxOrder;

import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

public class WxMerchantVo extends WxCouponOrder{

/**
*
*/
private static final long serialVersionUID = 6687954932922444531L;


public class WxMerchantVo{
private static final long serialVersionUID = 6687964942922444531L;


@Id @Id
protected Long id; protected Long id;

public Long getId() { public Long getId() {
return id; return id;
} }

public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }





/*发券商户信息*/ /*发券商户信息*/
/*商户图片**/ /*商户图片**/
@io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl") @io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl")


+ 7
- 94
mallinkService/src/main/java/com/iformall/domain/vo/WxOrderCouponVo.java Ver ficheiro

@@ -1,29 +1,20 @@
package com.iformall.domain.vo; package com.iformall.domain.vo;


import com.iformall.domain.po.WxCouponOrder;
import com.iformall.domain.po.WxOrder;

import javax.persistence.Id;
import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;


public class WxOrderCouponVo extends WxCouponOrder{

@JsonIgnoreProperties(value = {"handler"})
public class WxOrderCouponVo {


/** /**
* *
*/ */
private static final long serialVersionUID = 6687954932922444531L;
private static final long serialVersionUID = 6687964932922444531L;



@Id
protected Long id; protected Long id;


@Transient
protected List<Long> ids;
@Transient
protected String sortColumns;

public Long getId() { public Long getId() {
return id; return id;
} }
@@ -32,18 +23,6 @@ public class WxOrderCouponVo extends WxCouponOrder{
this.id = id; this.id = id;
} }


public String getSortColumns() {
return sortColumns;
}

public List<Long> getIds() {
return ids;
}

public void setIds(List<Long> ids) {
this.ids = ids;
}



/* 基础购买到的券信息 */ /* 基础购买到的券信息 */


@@ -59,7 +38,7 @@ public class WxOrderCouponVo extends WxCouponOrder{


/*商户ID**/ /*商户ID**/
/*产品ID**/ /*产品ID**/
@io.swagger.annotations.ApiModelProperty(value="ID",name="productId")
@io.swagger.annotations.ApiModelProperty(value="产品ID",name="productId")
private Long productId; private Long productId;
/*0: 付款 1: 退款**/ /*0: 付款 1: 退款**/
@io.swagger.annotations.ApiModelProperty(value="0: 付款 1: 退款",name="paymentType") @io.swagger.annotations.ApiModelProperty(value="0: 付款 1: 退款",name="paymentType")
@@ -122,7 +101,7 @@ public class WxOrderCouponVo extends WxCouponOrder{
private String remark; private String remark;


/*发券商户信息*/ /*发券商户信息*/
@io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl")
@io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList")
private List<WxMerchantVo> merchantVoList; private List<WxMerchantVo> merchantVoList;




@@ -272,70 +251,4 @@ public class WxOrderCouponVo extends WxCouponOrder{
remark = _remark; remark = _remark;
} }


public static enum Field
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
,OrderNumber_ASC("`order_number` ASC"),OrderNumber_DESC("`order_number` DESC")
,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC")
,CouponId_ASC("`product_id` ASC"),CouponId_DESC("`product_id` DESC")
,PaymentType_ASC("`payment_type` ASC"),PaymentType_DESC("`payment_type` DESC")
,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC")
,PaymentTime_ASC("`payment_time` ASC"),PaymentTime_DESC("`payment_time` DESC")
,OrderStatus_ASC("`order_status` ASC"),OrderStatus_DESC("`order_status` DESC")
,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")
,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC")
,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC")
;
private String value;
Field(String value){
this.value = value;
}
public String getValue() {
return value;
}
public void setCol(String value) {
this.value = value;
}
@Override
public String toString() {
return this.getValue();
}
}

public void setSortColumns(WxOrder.Field... fields)
{
if (fields == null || fields.length == 0) {
return;
}
for (int k = 0; k < fields.length; k++) {
if (fields[k] == null) {
return;
}
}
StringBuilder sb = new StringBuilder(fields[0].toString());
for (int k = 1; k < fields.length; k++) {
sb.append(",");
sb.append(fields[k].toString());
}
this.sortColumns = sb.toString();
}

public void setSortColumns(String sortColumns)
{
if (sortColumns == null || "".equals(sortColumns.trim())) {
return;
}
if (sortColumns.contains(",")) {
String[] cols = sortColumns.split(",");
java.util.List<WxOrder.Field> fList = new java.util.ArrayList();
for (int k = 0; k < cols.length; k++) {
fList.add(WxOrder.Field.valueOf(cols[k]));
}
this.setSortColumns(fList.toArray(new WxOrder.Field[fList.size()]));
} else {
this.setSortColumns(WxOrder.Field.valueOf(sortColumns));
}
}

} }

+ 35
- 4
mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml Ver ficheiro

@@ -3,7 +3,7 @@
<mapper namespace="com.iformall.mapper.WxCouponMerchantMapper"> <mapper namespace="com.iformall.mapper.WxCouponMerchantMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponMerchant"> <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponMerchant">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="product_id" jdbcType="BIGINT" property="productId" />
<result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
<result column="parameter" jdbcType="VARCHAR" property="parameter" /> <result column="parameter" jdbcType="VARCHAR" property="parameter" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
@@ -23,8 +23,8 @@
</if> </if>
<if test=" null != couponId ">
and `coupon_id` = #{couponId}
<if test=" null != productId ">
and `product_id` = #{productId}
</if> </if>


@@ -62,5 +62,36 @@
<include refid="dynamicWhereConditions" /> <include refid="dynamicWhereConditions" />
</select> </select>


<sql id="allMerchantVoColumns">
m.id,
m.img_url,m.name,m.link_phone,m.status,
s.addr,s.shop_number,s.baidu_poi,
mb.building_name,mf.floor_name
</sql>

<resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
<result column="name" jdbcType="VARCHAR" property="merchantName"/>
<result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
<result column="status" jdbcType="VARCHAR" property="merchantStatus"/>

<result column="addr" jdbcType="VARCHAR" property="addr"/>
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
<result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
<result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
<result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
</resultMap>

<select id="findMerchantVoList" parameterType="java.util.Map" resultMap="MerchantVoResultMap">
select
<include refid="allMerchantVoColumns"/>
from wx_coupon_merchant cm
left join wx_merchant m on m.id = cm.merchant_id
left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
left join wx_shop s on ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where cm.product_id = #{productId}
</select>
</mapper> </mapper>

+ 11
- 49
mallinkService/src/main/resources/mapper/WxOrderMapper.xml Ver ficheiro

@@ -133,24 +133,14 @@


<sql id="allCUserOrderListColumns"> <sql id="allCUserOrderListColumns">
o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.unit,
c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit
</sql> </sql>


<sql id="allCUserOrderListMerchantColumns">
m.name
</sql>


<sql id="allCUserOrderDetailColumns"> <sql id="allCUserOrderDetailColumns">
o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.unit,co.detail,co.remark,
c.id as coupon_order_id,c.coupon_order_status
</sql>

<sql id="allCUserOrderDetailMerchantColumns">
m.id,
m.img_url,m.name,m.link_phone,m.status,
s.addr,s.shop_number,s.baidu_poi,
mb.building_name,mf.floor_name,
c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.detail,c.remark,
co.id as coupon_order_id,co.coupon_order_status
</sql> </sql>


<resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCouponVo"> <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCouponVo">
@@ -181,45 +171,18 @@
<result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId"/> <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId"/>
<result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus"/> <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus"/>


<collection property="merchantVoList"
<collection column="{productId=product_id}" property="merchantVoList"
ofType="com.iformall.domain.vo.WxMerchantVo" ofType="com.iformall.domain.vo.WxMerchantVo"
column="product_id"
select="com.iformall.mapper.WxOrderMapper.findMerchantList" >
javaType="java.util.ArrayList"
select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantVoList" >
</collection> </collection>
</resultMap> </resultMap>


<resultMap id="CVoMerchantResultMap" type="com.iformall.domain.vo.WxMerchantVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
<result column="name" jdbcType="VARCHAR" property="merchantName"/>
<result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
<result column="status" jdbcType="VARCHAR" property="merchantStatus"/>

<result column="addr" jdbcType="VARCHAR" property="addr"/>
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
<result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
<result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
<result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
</resultMap>

<select id="findMerchantList" parameterType="com.iformall.domain.vo.WxMerchantVo" resultMap="CVoMerchantResultMap">
select
<include refid="allCUserOrderDetailMerchantColumns"/>
from wx_coupon_merchant cm
left join wx_merchant m on m.id = cm.merchant_id
left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
left join wx_shop s on ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where cm.product_id = #{productId}
</select>

<select id="findListOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap"> <select id="findListOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap">
select select
<include refid="allCUserOrderListColumns"/> <include refid="allCUserOrderListColumns"/>
from wx_order o,wx_coupon co,wx_merchant m
where o.product_id = co.id
and co.merchant_id = m.id
from wx_order o,wx_coupon c
where o.product_id = c.id
<if test="cUserId != null"> <if test="cUserId != null">
and o.c_user_id = #{cUserId} and o.c_user_id = #{cUserId}
</if> </if>
@@ -236,9 +199,9 @@
select select
<include refid="allCUserOrderDetailColumns"/> <include refid="allCUserOrderDetailColumns"/>
FROM wx_order o FROM wx_order o
left join wx_coupon co ON o.product_id = co.id
left join wx_coupon_order c on o.id = c.order_id
where o.product_id = co.id
left join wx_coupon c ON o.product_id = c.id
left join wx_coupon_order co on o.id = co.order_id
where o.product_id = c.id
<if test="cUserId != null"> <if test="cUserId != null">
and o.c_user_id = #{cUserId} and o.c_user_id = #{cUserId}
</if> </if>
@@ -252,7 +215,6 @@
</select> </select>





<select id="dayMicroPayAmountList" parameterType="map" resultType="map"> <select id="dayMicroPayAmountList" parameterType="map" resultType="map">
select count(*) as count, IFNULL(sum(payment), 0) as total_price select count(*) as count, IFNULL(sum(payment), 0) as total_price
from wx_order from wx_order


Carregando…
Cancelar
Guardar