Mybatis Mysql

Bean

package com.weshop.service.bean;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.weshop.core.dao.QueryModel;
import com.weshop.web.util.BaseEnums.OrderStatus;


public class Order extends QueryModel implements Serializable {
    
	private static final long serialVersionUID = 1L;
    private String orderid;
    private String merchantid;
    private Date receivedate;
    private String memberid;
    private Date paymentdate;
    private Integer orderstatus;
    private Date deliverdate;

    private BigDecimal paymentfee;

    private String paymentname;

    private String posttype;

    private String invoicename;

    private String invoicecontent;

    private Boolean invoicetype;

    private Date createdate;

    private Date modifydate;

    private String createuser;

    private String modifieduser;

    private String customermessage;
     
    private String statusstr;
    
    private Integer reviewstatus;
	
    private String shopName;
    
    private String orderinfo;
    
    private long readability;
    
    private String OrderproductName;
    
    private String  userphone;
    
    private String  servicephone;
    
	public String getServicephone() {
		return servicephone;
	}

	public void setServicephone(String servicephone) {
		this.servicephone = servicephone;
	}

	public String getUserphone() {
		return userphone;
	}

	public void setUserphone(String userphone) {
		this.userphone = userphone;
	}

	public String getOrderproductName() {
		return OrderproductName;
	}

	public void setOrderproductName(String orderproductName) {
		OrderproductName = "%"+orderproductName+"%";
	}

	private List<ExpressInfo> erxpressInfo = new ArrayList<ExpressInfo>();
   

	public List<ExpressInfo> getErxpressInfo() {
		return erxpressInfo;
	}

	public void setErxpressInfo(List<ExpressInfo> erxpressInfo) {
		this.erxpressInfo = erxpressInfo;
	}

	public long getReadability() {
		return readability;
	}

	public void setReadability(long readability) {
		this.readability = readability;
	}

	public String getOrderinfo() {
		return orderinfo;
	}

	public void setOrderinfo(String orderinfo) {
		this.orderinfo = orderinfo;
	}

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}


	public Integer getReviewstatus() {
		return reviewstatus;
	}

	public void setReviewstatus(Integer reviewstatus) {
		this.reviewstatus = reviewstatus;
	}

	public String getStatusstr() {
		return statusstr=OrderStatus.getName(orderstatus+"");
	}

	public void setStatusstr(String statusstr) {
		this.statusstr = statusstr;
	}

	private List<OrderProduct> orderProductlist = new ArrayList<OrderProduct>(); 
    

//	private List<OrderProduct> orderProducts= new ArrayList<OrderProduct>();
//    
//  public List<OrderProduct> getOrerProducts() {
//		return orderProducts;
//	}
//
//	public void setOrerProducts(List<OrderProduct> orderProducts) {
//		this.orderProducts = orderProducts;
//	}

	
    public List<OrderProduct> getOrderProductlist() {
		return orderProductlist;
	}

	public void setOrderProductlist(List<OrderProduct> orderProductlist) {
		this.orderProductlist = orderProductlist;
	}

	public String getOrderid() {
        return orderid;
    }

    public void setOrderid(String orderid) {
        this.orderid = orderid == null ? null : orderid.trim();
    }

    public String getMerchantid() {
        return merchantid;
    }

    public void setMerchantid(String merchantid) {
        this.merchantid = merchantid == null ? null : merchantid.trim();
    }

    public Date getReceivedate() {
        return receivedate;
    }

    public void setReceivedate(Date receivedate) {
        this.receivedate = receivedate;
    }

    public String getMemberid() {
        return memberid;
    }

    public void setMemberid(String memberid) {
        this.memberid = memberid == null ? null : memberid.trim();
    }

    public Date getPaymentdate() {
        return paymentdate;
    }

    public void setPaymentdate(Date paymentdate) {
        this.paymentdate = paymentdate;
    }

    public Integer getOrderstatus() {
        return orderstatus;
    }

    public void setOrderstatus(Integer orderstatus) {
        this.orderstatus = orderstatus;
    }

    public Date getDeliverdate() {
        return deliverdate;
    }

    public void setDeliverdate(Date deliverdate) {
        this.deliverdate = deliverdate;
    }

    public BigDecimal getPaymentfee() {
        return paymentfee;
    }

    public void setPaymentfee(BigDecimal paymentfee) {
        this.paymentfee = paymentfee;
    }

    public String getPaymentname() {
        return paymentname;
    }

    public void setPaymentname(String paymentname) {
        this.paymentname = paymentname == null ? null : paymentname.trim();
    }

    public String getPosttype() {
        return posttype;
    }

    public void setPosttype(String posttype) {
        this.posttype = posttype == null ? null : posttype.trim();
    }

    public String getInvoicename() {
        return invoicename;
    }

    public void setInvoicename(String invoicename) {
        this.invoicename = invoicename == null ? null : invoicename.trim();
    }

    public String getInvoicecontent() {
        return invoicecontent;
    }

    public void setInvoicecontent(String invoicecontent) {
        this.invoicecontent = invoicecontent == null ? null : invoicecontent.trim();
    }

    public Boolean getInvoicetype() {
        return invoicetype;
    }

    public void setInvoicetype(Boolean invoicetype) {
        this.invoicetype = invoicetype;
    }

    public Date getCreatedate() {
        return createdate;
    }

    public void setCreatedate(Date createdate) {
        this.createdate = createdate;
    }

    public Date getModifydate() {
        return modifydate;
    }

    public void setModifydate(Date modifydate) {
        this.modifydate = modifydate;
    }

    public String getCreateuser() {
        return createuser;
    }

    public void setCreateuser(String createuser) {
        this.createuser = createuser == null ? null : createuser.trim();
    }

    public String getModifieduser() {
        return modifieduser;
    }

    public void setModifieduser(String modifieduser) {
        this.modifieduser = modifieduser == null ? null : modifieduser.trim();
    }

    public String getCustomermessage() {
        return customermessage;
    }

    public void setCustomermessage(String customermessage) {
        this.customermessage = customermessage == null ? null : customermessage.trim();
    }
}
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="OrderMapper">
	<resultMap id="BaseResultMap" type="com.weshop.service.bean.Order">
		<id column="orderId" property="orderid" jdbcType="VARCHAR" />
		<result column="merchantId" property="merchantid" jdbcType="VARCHAR" />
		<result column="receiveDate" property="receivedate" jdbcType="TIMESTAMP" />
		<result column="memberId" property="memberid" jdbcType="VARCHAR" />
		<result column="paymentDate" property="paymentdate" jdbcType="TIMESTAMP" />
		<result column="orderStatus" property="orderstatus" jdbcType="INTEGER" />
		<result column="deliverDate" property="deliverdate" jdbcType="TIMESTAMP" />
		<result column="paymentFee" property="paymentfee" jdbcType="DECIMAL" />
		<result column="paymentName" property="paymentname" jdbcType="VARCHAR" />
		<result column="postType" property="posttype" jdbcType="VARCHAR" />
		<result column="invoiceName" property="invoicename" jdbcType="VARCHAR" />
		<result column="invoiceContent" property="invoicecontent" jdbcType="VARCHAR" />
		<result column="invoiceType" property="invoicetype" jdbcType="BIT" />
		<result column="createDate" property="createdate" jdbcType="TIMESTAMP" />
		<result column="modifyDate" property="modifydate" jdbcType="TIMESTAMP" />
		<result column="createUser" property="createuser" jdbcType="VARCHAR" />
		<result column="modifiedUser" property="modifieduser" jdbcType="VARCHAR" />

		<result column="weShopName" property="shopName" jdbcType="VARCHAR" />
		<result column="orderInfo" property="orderinfo" jdbcType="VARCHAR" />
		<result column="productName" property="OrderproductName" jdbcType="VARCHAR" />
		<result column="phone" property="userphone" jdbcType="VARCHAR" />
		<result column="servicePhone" property="servicephone" jdbcType="VARCHAR" />
	</resultMap>
	<resultMap id="ResultMapWithBLOBs" type="com.weshop.service.bean.Order"
		extends="BaseResultMap">
		<result column="customerMessage" property="customermessage"
			jdbcType="LONGVARCHAR" />
	</resultMap>
	<resultMap type="com.weshop.service.bean.Order" id="queryForListMap"
		extends="BaseResultMap">
		<result column="customerMessage" property="customermessage"
			jdbcType="LONGVARCHAR" />

		<association property="erxpressInfo"
			javaType="com.weshop.service.bean.ExpressInfo">
			<id column="expressInfoId" property="expressinfoid" jdbcType="VARCHAR" />
			<result column="orderId" property="orderid" jdbcType="VARCHAR" />
			<result column="expressSN" property="expresssn" jdbcType="VARCHAR" />
			<result column="expressFee" property="expressfee" jdbcType="DECIMAL" />
			<result column="expressCompanyId" property="expresscompanyid"
				jdbcType="VARCHAR" />
			<result column="name" property="name" jdbcType="VARCHAR" />
			<result column="phone" property="phone" jdbcType="VARCHAR" />
			<result column="address" property="address" jdbcType="VARCHAR" />
			<result column="createDate" property="createdate" jdbcType="TIMESTAMP" />
			<result column="modifyDate" property="modifydate" jdbcType="TIMESTAMP" />
			<result column="createUser" property="createuser" jdbcType="VARCHAR" />
			<result column="modifiedUser" property="modifieduser"
				jdbcType="VARCHAR" />
			<result column="expressTime" property="expresstime" jdbcType="INTEGER" />
		</association>
		
		<collection property="orderProductlist" javaType="java.util.List"
			ofType="com.weshop.service.bean.OrderProduct">
			<id column="orderProductId" property="orderProductid" jdbcType="VARCHAR" />

			<result column="productPrice" property="productprice"
				jdbcType="DECIMAL" />
			<result column="productAmount" property="productamount"
				jdbcType="INTEGER" />
			<result column="productId" property="productid" jdbcType="VARCHAR" />
			<result column="isEevaluate" property="iseevaluate" jdbcType="BIT" />
			<result column="skuOptionBunch" property="skuoptionbunch"
				jdbcType="VARCHAR" />
			<result column="productName" property="productname" jdbcType="VARCHAR" />
			<result column="productImageUrl" property="productimageurl"
				jdbcType="VARCHAR" />
			<result column="createDate" property="createdate" jdbcType="TIMESTAMP" />
			<result column="modifyDate" property="modifydate" jdbcType="TIMESTAMP" />
			<result column="createUser" property="createuser" jdbcType="VARCHAR" />
			<result column="modifiedUser" property="modifieduser"
				jdbcType="VARCHAR" />
		</collection>
	</resultMap>

	<resultMap type="com.weshop.service.bean.OrderCount" id="countResultMap">
		<result column="count" property="count" jdbcType="INTEGER" />
		<result column="orderStatus" property="orderstatus" jdbcType="INTEGER" />
	</resultMap>

	<sql id="Base_Column_List">
		orderId, merchantId, receiveDate, memberId, paymentDate,
		orderStatus,
		deliverDate,
		paymentFee, paymentName, postType,
		invoiceName, invoiceContent, invoiceType,
		createDate,
		modifyDate,
		createUser, modifiedUser,orderInfo
	</sql>
	<sql id="Blob_Column_List">
		customerMessage
	</sql>
       
	<select id="selectPageListSeeks" resultMap="queryForListMap"
		parameterType="com.weshop.service.bean.Order">
       select o.*,p.*,e.*,(select weShopName from ws_merchant where merchantId=o.merchantId) as weshopname,(select servicePhone from ws_merchant where merchantId=o.merchantId) as servicephone from ws_order o left join ws_order_product p on o.orderId=p.orderId  left join ws_express_info e on p.orderId=e.orderId where 1=1 		
		<if test="userphone != null">
			and e.phone = #{userphone}
		</if>
		<if test="orderstatus != null">
			and o.orderStatus = #{orderstatus}
		</if>
		<if test="paymentname != null">
			and o.paymentName= #{paymentname}
		</if>
		<if test="OrderproductName != null">
			and (p.productName like #{OrderproductName} or o.orderId like #{OrderproductName})
		</if>
		<if test="reviewstatus == 1">
			and p.isEevaluate =false
		</if>
		<if test="orderid != null">
			and o.orderId=#{orderid}
		</if> 
		<if test="merchantid != null">
			and o.merchantId = #{merchantid}
		</if>
		<if test="receivedate != null">
			and receiveDate = #{receivedate}
		</if>
		<if test="memberid != null">
			and memberId = #{memberid}
		</if>
		<if test="paymentdate != null">
			and paymentDate = #{paymentdate}
		</if>
		<if test="deliverdate != null">
			and deliverDate =#{deliverdate}
		</if>
		<if test="paymentfee != null">
			and paymentFee =#{paymentfee}
		</if>
		<if test="posttype != null">
			and postType=#{posttype}
		</if>
		<if test="invoicename != null">
			and invoiceName=#{invoicename}
		</if>
		<if test="invoicecontent != null">
			and invoiceContent=#{invoicecontent}
		</if>
		<if test="invoicetype != null">
			and invoiceType =#{invoicetype}
		</if>
		<if test="startDate != null">
			and o.createDate >=#{startDate}
		</if>
		<if test="endDate != null">
			and o.createDate <=#{endDate}
		</if>
		<if test="modifydate != null">
			and modifyDate=#{modifydate}
		</if>
		<if test="createuser != null">
			and createUser=#{createuser}
		</if>
		<if test="modifieduser != null">
			and modifiedUser=#{modifieduser}
		</if>
		<if test="orderinfo != null">
			and orderInfo=#{orderinfo}
		</if>
		<if test="customermessage != null">
			and customerMessage =#{customermessage}
		</if>
		
		 order by o.createDate desc limit #{offset},#{pageSize}
	</select>
	
	 <select id="selectPagCounteSeeks" resultType="java.lang.Integer"
		parameterType="com.weshop.service.bean.Order">
		select count(*),o.*,p.*,e.*,(select weShopName from ws_merchant where merchantId=o.merchantId) as weshopname,(select servicePhone from ws_merchant where merchantId=o.merchantId) as servicephone from ws_order o left join ws_order_product p on o.orderId=p.orderId  left join ws_express_info e on p.orderId=e.orderId where 1=1 		
		<if test="userphone != null">
			and e.phone = #{userphone}
		</if>
		<if test="orderstatus != null">
			and o.orderStatus = #{orderstatus}
		</if>
		<if test="paymentname != null">
			and o.paymentName= #{paymentname}
		</if>
		<if test="OrderproductName != null">
			and (p.productName like #{OrderproductName} or o.orderId like #{OrderproductName})
		</if>
		<if test="reviewstatus == 1">
			and p.isEevaluate =false
		</if>
		<if test="orderid != null">
			and o.orderId=#{orderid}
		</if> 
		<if test="merchantid != null">
			and o.merchantId = #{merchantid}
		</if>
		<if test="receivedate != null">
			and receiveDate = #{receivedate}
		</if>
		<if test="memberid != null">
			and memberId = #{memberid}
		</if>
		<if test="paymentdate != null">
			and paymentDate = #{paymentdate}
		</if>
		<if test="deliverdate != null">
			and deliverDate =#{deliverdate}
		</if>
		<if test="paymentfee != null">
			and paymentFee =#{paymentfee}
		</if>
		<if test="posttype != null">
			and postType=#{posttype}
		</if>
		<if test="invoicename != null">
			and invoiceName=#{invoicename}
		</if>
		<if test="invoicecontent != null">
			and invoiceContent=#{invoicecontent}
		</if>
		<if test="invoicetype != null">
			and invoiceType =#{invoicetype}
		</if>
		<if test="startDate != null">
			and o.createDate >=#{startDate}
		</if>
		<if test="endDate != null">
			and o.createDate <=#{endDate}
		</if>
		<if test="modifydate != null">
			and modifyDate=#{modifydate}
		</if>
		<if test="createuser != null">
			and createUser=#{createuser}
		</if>
		<if test="modifieduser != null">
			and modifiedUser=#{modifieduser}
		</if>
		<if test="orderinfo != null">
			and orderInfo=#{orderinfo}
		</if>
		<if test="customermessage != null">
			and customerMessage =#{customermessage}
		</if>
	</select>
	
	
	
	<select id="selectPageList" resultMap="queryForListMap"
		parameterType="com.weshop.service.bean.Order">
		select o.*,p.*,e.*,(select weShopName from ws_merchant where merchantId=o.merchantId) as weshopname,(select servicePhone from ws_merchant where merchantId=o.merchantId) as servicephone from ws_order o left join ws_order_product p on o.orderId=p.orderId left join ws_express_info e on p.orderId=e.orderId where 1=1
		
		<if test="reviewstatus ==1 ">
			and p.isEevaluate =false
		</if>
		<if test="orderid != null">
			and orderId=#{orderid}
		</if>
		<if test="merchantid != null">
			and merchantId = #{merchantid}
		</if>
		<if test="receivedate != null">
			and receiveDate = #{receivedate}
		</if>
		<if test="memberid != null">
			and memberId = #{memberid}
		</if>
		<if test="paymentdate != null">
			and paymentDate = #{paymentdate}
		</if>
		<if test="orderstatus != null">
			and orderStatus = #{orderstatus}
		</if>
		<if test="deliverdate != null">
			and deliverDate =#{deliverdate}
		</if>
		<if test="paymentfee != null">
			and paymentFee =#{paymentfee}
		</if>
		<if test="paymentname != null">
			and paymentName= #{paymentname}
		</if>
		<if test="posttype != null">
			and postType=#{posttype}
		</if>
		<if test="invoicename != null">
			and invoiceName=#{invoicename}
		</if>
		<if test="invoicecontent != null">
			and invoiceContent=#{invoicecontent}
		</if>
		<if test="invoicetype != null">
			and invoiceType =#{invoicetype}
		</if>
		<if test="startDate != null">
			and createDate >=#{startDate}
		</if>
		<if test="endDate != null">
			and createDate <=#{endDate}
		</if>
		<if test="modifydate != null">
			and modifyDate=#{modifydate}
		</if>
		<if test="createuser != null">
			and createUser=#{createuser}
		</if>
		<if test="modifieduser != null">
			and modifiedUser=#{modifieduser}
		</if>
		<if test="orderinfo != null">
			and orderInfo=#{orderinfo}
		</if>
		<if test="customermessage != null">
			and customerMessage =#{customermessage}
		</if>
		order by o.createDate desc limit #{offset},#{pageSize}
	</select>

	<select id="selectOrderInfo" resultMap="queryForListMap"
		parameterType="com.weshop.service.bean.Order">
		select o.*,p.*,(select weShopName from ws_merchant where
		merchantId=o.merchantId) as weshopname from ws_order o left join
		ws_order_product p on o.orderId=p.orderId where
		o.orderId=#{orderid,jdbcType=VARCHAR}


	</select>
     <select id="queryOrderCount" resultType="java.lang.Integer"
		parameterType="com.weshop.service.bean.Order">
		select count(*) from ws_order where orderStatus not in(7,8) and memberId=#{memberid,jdbcType=VARCHAR}
	</select>
	<select id="selectCountByStatus" resultMap="countResultMap"
		parameterType="java.lang.String">
		select count(*) as count,orderStatus from ws_order a left join
		ws_order_product b on a.orderId=b.orderId where
		memberId=#{orderid,jdbcType=VARCHAR} and b.isEevaluate=false group by
		orderStatus;
	</select>
	
	<select id="selectCountByMerchant" resultMap="countResultMap" parameterType="java.lang.String">
	select count(*) as count,orderStatus from ws_order a right join
		ws_order_product b on a.orderId=b.orderId where
		merchantId=#{merchantid,jdbcType=VARCHAR}  group by
		orderStatus;
	</select>

	<select id="selectPageCount" resultType="java.lang.Integer"
		parameterType="com.weshop.service.bean.Order">
		select count(*) from ws_order where 1=1
		<if test="orderid != null">
			and orderId=#{orderid}
		</if>
		<if test="merchantid != null">
			and merchantId = #{merchantid}
		</if>
		<if test="receivedate != null">
			and receiveDate = #{receivedate}
		</if>
		<if test="memberid != null">
			and memberId = #{memberid}
		</if>
		<if test="paymentdate != null">
			and paymentDate = #{paymentdate}
		</if>
		<if test="orderstatus != null">
			and orderStatus = #{orderstatus}
		</if>
		<if test="deliverdate != null">
			and deliverDate =#{deliverdate}
		</if>
		<if test="paymentfee != null">
			and paymentFee =#{paymentfee}
		</if>
		<if test="paymentname != null">
			and paymentName= #{paymentname}
		</if>
		<if test="posttype != null">
			and postType=#{posttype}
		</if>
		<if test="invoicename != null">
			and invoiceName=#{invoicename}
		</if>
		<if test="invoicecontent != null">
			and invoiceContent=#{invoicecontent}
		</if>
		<if test="invoicetype != null">
			and invoiceType =#{invoicetype}
		</if>
		<if test="startDate != null">
			and createDate >=#{startDate}
		</if>
		<if test="endDate != null">
			and createDate <=#{endDate}
		</if>
		<if test="modifydate != null">
			and modifyDate=#{modifydate}
		</if>
		<if test="createuser != null">
			and createUser=#{createuser}
		</if>
		<if test="modifieduser != null">
			and modifiedUser=#{modifieduser}
		</if>
		<if test="orderinfo != null">
			and orderInfo=#{orderinfo}
		</if>
		<if test="customermessage != null">
			and customerMessage =#{customermessage}
		</if>
	</select>



	<select id="selectList" resultMap="ResultMapWithBLOBs"
		parameterType="com.weshop.service.bean.Order">
		select
		<include refid="Base_Column_List" />
		,
		<include refid="Blob_Column_List" />
		from ws_order where 1=1
		<if test="merchantid != null">
			and merchantId = #{merchantid,jdbcType=VARCHAR}
		</if>
		<if test="receivedate != null">
			and receiveDate = #{receivedate,jdbcType=DATE}
		</if>
		<if test="memberid != null">
			and memberId = #{memberid,jdbcType=VARCHAR}
		</if>
		<if test="paymentdate != null">
			and paymentDate = #{paymentdate,jdbcType=TIMESTAMP}
		</if>
		<if test="orderstatus != null">
			and orderStatus = #{orderstatus,jdbcType=INTEGER}
		</if>
		<if test="deliverdate != null">
			and deliverDate = #{deliverdate,jdbcType=TIMESTAMP}
		</if>
		<if test="paymentfee != null">
			and paymentFee = #{paymentfee,jdbcType=DECIMAL}
		</if>
		<if test="paymentname != null">
			and paymentName = #{paymentname,jdbcType=VARCHAR}
		</if>
		<if test="posttype != null">
			and postType = #{posttype,jdbcType=VARCHAR}
		</if>
		<if test="invoicename != null">
			and invoiceName = #{invoicename,jdbcType=VARCHAR}
		</if>
		<if test="invoicecontent != null">
			and invoiceContent = #{invoicecontent,jdbcType=VARCHAR}
		</if>
		<if test="invoicetype != null">
			and invoiceType = #{invoicetype,jdbcType=BIT}
		</if>
		<if test="createdate != null">
			and createDate = #{createdate,jdbcType=DATE}
		</if>
		<if test="modifydate != null">
			and modifyDate = #{modifydate,jdbcType=DATE}
		</if>
		<if test="createuser != null">
			and createUser = #{createuser,jdbcType=VARCHAR}
		</if>
		<if test="modifieduser != null">
			and modifiedUser = #{modifieduser,jdbcType=VARCHAR}
		</if>
		<if test="customermessage != null">
			customerMessage =
			#{customermessage,jdbcType=LONGVARCHAR},
		</if>
	</select>
	<select id="selectById" resultMap="ResultMapWithBLOBs"
		parameterType="java.lang.String">
		select
		<include refid="Base_Column_List" />
		,
		<include refid="Blob_Column_List" />
		from ws_order
		where orderId = #{orderid,jdbcType=VARCHAR}
	</select>
	<delete id="deleteById" parameterType="java.lang.String">
		delete from ws_order
		where
		orderId = #{orderid,jdbcType=VARCHAR}
	</delete>
	<insert id="insert" parameterType="com.weshop.service.bean.Order">
		insert into ws_order (orderId,
		merchantId, receiveDate,
		memberId, paymentDate, orderStatus,
		deliverDate, paymentFee, paymentName,
		postType, invoiceName,
		invoiceContent,
		invoiceType, createDate, modifyDate,
		createUser,
		modifiedUser, customerMessage
		)
		values (#{orderid,jdbcType=VARCHAR},
		#{merchantid,jdbcType=VARCHAR},
		#{receivedate,jdbcType=TIMESTAMP},
		#{memberid,jdbcType=VARCHAR}, #{paymentdate,jdbcType=TIMESTAMP},
		#{orderstatus,jdbcType=INTEGER},
		#{deliverdate,jdbcType=TIMESTAMP},
		#{paymentfee,jdbcType=DECIMAL},
		#{paymentname,jdbcType=VARCHAR},
		#{posttype,jdbcType=VARCHAR}, #{invoicename,jdbcType=VARCHAR},
		#{invoicecontent,jdbcType=VARCHAR},
		#{invoicetype,jdbcType=BIT},
		#{createdate,jdbcType=TIMESTAMP},
		#{modifydate,jdbcType=TIMESTAMP},
		#{createuser,jdbcType=VARCHAR}, #{modifieduser,jdbcType=VARCHAR},
		#{customermessage,jdbcType=LONGVARCHAR}
		)
	</insert>
	<insert id="insertSelective" parameterType="com.weshop.service.bean.Order">
		insert into ws_order
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="orderid != null">
				orderId,
			</if>
			<if test="merchantid != null">
				merchantId,
			</if>
			<if test="receivedate != null">
				receiveDate,
			</if>
			<if test="memberid != null">
				memberId,
			</if>
			<if test="paymentdate != null">
				paymentDate,
			</if>
			<if test="orderstatus != null">
				orderStatus,
			</if>
			<if test="deliverdate != null">
				deliverDate,
			</if>
			<if test="paymentfee != null">
				paymentFee,
			</if>
			<if test="paymentname != null">
				paymentName,
			</if>
			<if test="posttype != null">
				postType,
			</if>
			<if test="invoicename != null">
				invoiceName,
			</if>
			<if test="invoicecontent != null">
				invoiceContent,
			</if>
			<if test="invoicetype != null">
				invoiceType,
			</if>
			<if test="createdate != null">
				createDate,
			</if>
			<if test="modifydate != null">
				modifyDate,
			</if>
			<if test="createuser != null">
				createUser,
			</if>
			<if test="modifieduser != null">
				modifiedUser,
			</if>
			<if test="customermessage != null">
				customerMessage,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="orderid != null">
				#{orderid,jdbcType=VARCHAR},
			</if>
			<if test="merchantid != null">
				#{merchantid,jdbcType=VARCHAR},
			</if>
			<if test="receivedate != null">
				#{receivedate,jdbcType=TIMESTAMP},
			</if>
			<if test="memberid != null">
				#{memberid,jdbcType=VARCHAR},
			</if>
			<if test="paymentdate != null">
				#{paymentdate,jdbcType=TIMESTAMP},
			</if>
			<if test="orderstatus != null">
				#{orderstatus,jdbcType=INTEGER},
			</if>
			<if test="deliverdate != null">
				#{deliverdate,jdbcType=TIMESTAMP},
			</if>
			<if test="paymentfee != null">
				#{paymentfee,jdbcType=DECIMAL},
			</if>
			<if test="paymentname != null">
				#{paymentname,jdbcType=VARCHAR},
			</if>
			<if test="posttype != null">
				#{posttype,jdbcType=VARCHAR},
			</if>
			<if test="invoicename != null">
				#{invoicename,jdbcType=VARCHAR},
			</if>
			<if test="invoicecontent != null">
				#{invoicecontent,jdbcType=VARCHAR},
			</if>
			<if test="invoicetype != null">
				#{invoicetype,jdbcType=BIT},
			</if>
			<if test="createdate != null">
				#{createdate,jdbcType=TIMESTAMP},
			</if>
			<if test="modifydate != null">
				#{modifydate,jdbcType=TIMESTAMP},
			</if>
			<if test="createuser != null">
				#{createuser,jdbcType=VARCHAR},
			</if>
			<if test="modifieduser != null">
				#{modifieduser,jdbcType=VARCHAR},
			</if>
			<if test="customermessage != null">
				#{customermessage,jdbcType=LONGVARCHAR},
			</if>
		</trim>
	</insert>
	<update id="updateById" parameterType="com.weshop.service.bean.Order">
		update ws_order
		<set>
			<if test="orderinfo != null">
				orderInfo = #{orderinfo,jdbcType=VARCHAR},
			</if>
			<if test="merchantid != null">
				merchantId = #{merchantid,jdbcType=VARCHAR},
			</if>
			<if test="receivedate != null">
				receiveDate = #{receivedate,jdbcType=TIMESTAMP},
			</if>
			<if test="memberid != null">
				memberId = #{memberid,jdbcType=VARCHAR},
			</if>
			<if test="paymentdate != null">
				paymentDate = #{paymentdate,jdbcType=TIMESTAMP},
			</if>
			<if test="orderstatus != null">
				orderStatus = #{orderstatus,jdbcType=INTEGER},
			</if>
			<if test="deliverdate != null">
				deliverDate = #{deliverdate,jdbcType=TIMESTAMP},
			</if>
			<if test="paymentfee != null">
				paymentFee = #{paymentfee,jdbcType=DECIMAL},
			</if>
			<if test="paymentname != null">
				paymentName = #{paymentname,jdbcType=VARCHAR},
			</if>
			<if test="posttype != null">
				postType = #{posttype,jdbcType=VARCHAR},
			</if>
			<if test="invoicename != null">
				invoiceName = #{invoicename,jdbcType=VARCHAR},
			</if>
			<if test="invoicecontent != null">
				invoiceContent = #{invoicecontent,jdbcType=VARCHAR},
			</if>
			<if test="invoicetype != null">
				invoiceType = #{invoicetype,jdbcType=BIT},
			</if>
			<if test="createdate != null">
				createDate = #{createdate,jdbcType=TIMESTAMP},
			</if>
			<if test="modifydate != null">
				modifyDate = #{modifydate,jdbcType=TIMESTAMP},
			</if>
			<if test="createuser != null">
				createUser = #{createuser,jdbcType=VARCHAR},
			</if>
			<if test="modifieduser != null">
				modifiedUser = #{modifieduser,jdbcType=VARCHAR},
			</if>
			<if test="customermessage != null">
				customerMessage =
				#{customermessage,jdbcType=LONGVARCHAR},
			</if>
		</set>
		where orderId = #{orderid,jdbcType=VARCHAR}
	</update>
	<update id="updateByIdWithBLOBs" parameterType="com.weshop.service.bean.Order">
		update ws_order
		set merchantId = #{merchantid,jdbcType=VARCHAR},
		receiveDate =
		#{receivedate,jdbcType=TIMESTAMP},
		memberId =
		#{memberid,jdbcType=VARCHAR},
		paymentDate =
		#{paymentdate,jdbcType=TIMESTAMP},
		orderStatus =
		#{orderstatus,jdbcType=INTEGER},
		deliverDate =
		#{deliverdate,jdbcType=TIMESTAMP},
		paymentFee =
		#{paymentfee,jdbcType=DECIMAL},
		paymentName =
		#{paymentname,jdbcType=VARCHAR},
		postType =
		#{posttype,jdbcType=VARCHAR},
		invoiceName =
		#{invoicename,jdbcType=VARCHAR},
		invoiceContent =
		#{invoicecontent,jdbcType=VARCHAR},
		invoiceType =
		#{invoicetype,jdbcType=BIT},
		createDate =
		#{createdate,jdbcType=TIMESTAMP},
		modifyDate =
		#{modifydate,jdbcType=TIMESTAMP},
		createUser =
		#{createuser,jdbcType=VARCHAR},
		modifiedUser =
		#{modifieduser,jdbcType=VARCHAR},
		customerMessage =
		#{customermessage,jdbcType=LONGVARCHAR}
		where orderId =
		#{orderid,jdbcType=VARCHAR}
	</update>
	<!--用户已完成的订单 -->
	<select id="buyList" resultType="com.weshop.service.bean.Order"
		parameterType="String">
		SELECT * FROM ws_order WHERE memberId=#{memberId}
		AND orderStatus='8'
	</select>
	
	<select id="selectCancelList" parameterType="com.weshop.service.bean.Order" resultType="com.weshop.service.bean.Order">
	 select t.id from ws_order t where 1=1 and orderStatus=0  and createDate <= #{startDate} 
	</select>
	
 <update id="updateOrderByMap" parameterType="Map">
  	update ws_order set orderStatus = #{orderStatus}
  	where orderId = #{orderId}
  </update>
</mapper>

主要看里面的Sql用法管理查询和嵌套查询

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值