添加团购

This commit is contained in:
Menethil
2018-08-04 06:42:52 +08:00
parent 58fc87d2f0
commit c480e78e4f
22 changed files with 5503 additions and 176 deletions

View File

@@ -5,7 +5,7 @@ spring:
encoding: UTF-8
server:
port: 8080
port: 8082
logging:
level:

View File

@@ -0,0 +1,122 @@
package org.linlinjava.litemall.core.qcode;
import cn.binarywang.wx.miniapp.api.WxMaService;
import me.chanjar.weixin.common.error.WxErrorException;
import org.linlinjava.litemall.core.storage.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public abstract class QCodeBase {
@Autowired
protected WxMaService wxMaService;
@Autowired
protected StorageService storageService;
protected abstract String getKeyName(String id);
/**
* 获取图片地址
*
* @param id
* @return
*/
public String getShareImageUrl(String id) {
return storageService.generateUrl(getKeyName(id));
}
protected BufferedImage getQCode(String scene, String page) {
//创建该商品的二维码
File file = null;
try {
file = wxMaService.getQrcodeService().createWxaCodeUnlimit(scene, page);
FileInputStream inputStream = new FileInputStream(file);
BufferedImage qrCodeImage = ImageIO.read(inputStream);
return qrCodeImage;
} catch (WxErrorException | IOException e) {
e.printStackTrace();
}
return null;
}
protected void saveImage(String id, byte[] imageData) {
MultipartFile multipartFile = new MockMultipartFile(getKeyName(id), getKeyName(id), "image/jpeg", imageData);
//存储分享图
storageService.store(multipartFile, getKeyName(id));
}
/**
* 居中写文字
*
* @param baseImage
* @param textToWrite
* @param font
* @param color
* @param y
*/
protected void drawTextInImgCenter(BufferedImage baseImage, String textToWrite, Font font, Color color, int y) {
Graphics2D g2D = (Graphics2D) baseImage.getGraphics();
g2D.setColor(color);
g2D.setFont(font);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// 计算文字长度计算居中的x点坐标
FontMetrics fm = g2D.getFontMetrics(font);
int textWidth = fm.stringWidth(textToWrite);
int widthX = (baseImage.getWidth() - textWidth) / 2;
// 表示这段文字在图片上的位置(x,y) .第一个是你设置的内容。
g2D.drawString(textToWrite, widthX, y);
// 释放对象
g2D.dispose();
}
/**
* 写上文字
*
* @param baseImage
* @param textToWrite
* @param font
* @param color
* @param x
* @param y
*/
protected void drawTextInImg(BufferedImage baseImage, String textToWrite, Font font, Color color, int x, int y) {
Graphics2D g2D = (Graphics2D) baseImage.getGraphics();
g2D.setColor(color);
g2D.setFont(font);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2D.drawString(textToWrite, x, y);
g2D.dispose();
}
/**
* 画中画
*
* @param baseImage
* @param imageToWrite
* @param x
* @param y
* @param width
* @param height
*/
protected void drawImgInImg(BufferedImage baseImage, BufferedImage imageToWrite, int x, int y, int width, int height) {
Graphics2D g2D = (Graphics2D) baseImage.getGraphics();
g2D.drawImage(imageToWrite, x, y, width, height, null);
g2D.dispose();
}
}

View File

@@ -0,0 +1,96 @@
package org.linlinjava.litemall.core.qcode;
import org.linlinjava.litemall.core.system.SystemConfig;
import org.springframework.core.io.ClassPathResource;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
public class QCodeGoodShare extends QCodeBase {
@Override
protected String getKeyName(String id) {
return "GOOD_QCODE_" + id + ".jpg";
}
/**
* 创建商品分享图
*
* @param goodId
* @param goodPicUrl
* @param goodName
*/
public void createGoodShareImage(String goodId, String goodPicUrl, String goodName) {
if (!SystemConfig.isAutoCreateShareImage())
return;
BufferedImage qrCodeImage = getQCode("goods," + goodId, "pages/index/index");
//将商品图片,商品名字,商城名字画到模版图中
byte[] imageData = new byte[0];
try {
imageData = drawPicture(qrCodeImage, goodPicUrl, goodName, SystemConfig.getMallName());
} catch (IOException e) {
e.printStackTrace();
}
saveImage(goodId, imageData);
}
/**
* 将商品图片,商品名字画到模版图中
*
* @param qrCodeImage 二维码图片
* @param goodPicUrl 商品图片地址
* @param goodName 商品名称
* @return
* @throws IOException
*/
private byte[] drawPicture(BufferedImage qrCodeImage, String goodPicUrl, String goodName, String shopName) throws IOException {
//底图
ClassPathResource redResource = new ClassPathResource("back.jpg");
BufferedImage red = ImageIO.read(redResource.getInputStream());
//商品图片
URL goodPic = new URL(goodPicUrl);
BufferedImage goodImage = ImageIO.read(goodPic);
// --- 画图 ---
//底层空白 bufferedImage
BufferedImage baseImage = new BufferedImage(red.getWidth(), red.getHeight(), BufferedImage.TYPE_4BYTE_ABGR_PRE);
//画上图片
drawImgInImg(baseImage, red, 0, 0, red.getWidth(), red.getHeight());
//画上商品图片
drawImgInImg(baseImage, goodImage, 56, 135, 720, 720);
//画上小程序二维码
drawImgInImg(baseImage, qrCodeImage, 442, 1006, 340, 340);
Font font = new Font("Microsoft YaHei", Font.PLAIN, 42);
Color color = new Color(167, 136, 69);
//写上商品名称
drawTextInImg(baseImage, goodName, font, color, 112, 955);
//写上商城名称
drawTextInImgCenter(baseImage, shopName, font, color, 98);
//转jpg
BufferedImage result = new BufferedImage(baseImage.getWidth(), baseImage
.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
result.getGraphics().drawImage(baseImage, 0, 0, null);
ByteArrayOutputStream bs = new ByteArrayOutputStream();
ImageIO.write(result, "jpg", bs);
//最终byte数组
return bs.toByteArray();
}
}

View File

@@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import me.chanjar.weixin.common.error.WxErrorException;
import org.linlinjava.litemall.core.storage.StorageService;
import org.linlinjava.litemall.core.system.SystemConfig;
import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mock.web.MockMultipartFile;
@@ -24,6 +25,29 @@ public class QCodeService {
@Autowired
private StorageService storageService;
public void createGrouponShareImage(String goodName, String goodPicUrl, LitemallGroupon groupon) {
try {
//创建该商品的二维码
File file = wxMaService.getQrcodeService().createWxaCodeUnlimit("groupon," + groupon.getId(), "pages/index/index");
FileInputStream inputStream = new FileInputStream(file);
//将商品图片,商品名字,商城名字画到模版图中
byte[] imageData = drawPicture(inputStream, goodPicUrl, goodName, SystemConfig.getMallName());
MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(), "image/jpeg", imageData);
//存储分享图
storageService.store(multipartFile, getKeyName(groupon.getId().toString()));
} catch (WxErrorException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (FontFormatException e) {
e.printStackTrace();
}
}
/**
* 创建商品分享图
*
@@ -37,7 +61,7 @@ public class QCodeService {
try {
//创建该商品的二维码
File file = wxMaService.getQrcodeService().createWxaCodeUnlimit(goodId, "pages/index/index");
File file = wxMaService.getQrcodeService().createWxaCodeUnlimit("goods," + goodId, "pages/index/index");
FileInputStream inputStream = new FileInputStream(file);
//将商品图片,商品名字,商城名字画到模版图中
byte[] imageData = drawPicture(inputStream, goodPicUrl, goodName, SystemConfig.getMallName());
@@ -103,7 +127,7 @@ public class QCodeService {
drawTextInImg(baseImage, goodName, 112, 955);
//写上商城名称
drawTextInImgCenter(baseImage, shopName, 112, 98);
drawTextInImgCenter(baseImage, shopName, 98);
//转jpg
@@ -117,7 +141,7 @@ public class QCodeService {
return bs.toByteArray();
}
private void drawTextInImgCenter(BufferedImage baseImage, String textToWrite, int x, int y) {
private void drawTextInImgCenter(BufferedImage baseImage, String textToWrite, int y) {
Graphics2D g2D = (Graphics2D) baseImage.getGraphics();
g2D.setColor(new Color(167, 136, 69));
@@ -133,12 +157,12 @@ public class QCodeService {
int widthX = (baseImage.getWidth() - textWidth) / 2;
// 表示这段文字在图片上的位置(x,y) .第一个是你设置的内容。
g2D.drawString(textToWrite, widthX, 100);
g2D.drawString(textToWrite, widthX, y);
// 释放对象
g2D.dispose();
}
private void drawTextInImg(BufferedImage baseImage, String textToWrite, int x, int y) throws IOException, FontFormatException {
private void drawTextInImg(BufferedImage baseImage, String textToWrite, int x, int y) {
Graphics2D g2D = (Graphics2D) baseImage.getGraphics();
g2D.setColor(new Color(167, 136, 69));

View File

@@ -45,9 +45,9 @@
<!--数据库连接信息-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/litemall?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;verifyServerCertificate=false&amp;useSSL=false"
userId="litemall"
password="litemall123456"/>
connectionURL="jdbc:mysql://127.0.0.1:3306/litemall2?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;verifyServerCertificate=false&amp;useSSL=false"
userId="root"
password="Menethil.2822"/>
<javaModelGenerator targetPackage="org.linlinjava.litemall.db.domain" targetProject="src/main/java"/>
@@ -172,5 +172,15 @@
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
<columnOverride javaType="java.time.LocalDateTime" column="expire_time"/>
</table>
<table tableName="litemall_groupon_rules">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
<columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
</table>
<table tableName="litemall_groupon">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
<columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
<columnOverride javaType="java.time.LocalDateTime" column="expire_time"/>
</table>
</context>
</generatorConfiguration>

View File

@@ -0,0 +1,159 @@
package org.linlinjava.litemall.db.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.linlinjava.litemall.db.domain.LitemallGrouponExample;
public interface LitemallGrouponMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
long countByExample(LitemallGrouponExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int deleteByExample(LitemallGrouponExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int insert(LitemallGroupon record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int insertSelective(LitemallGroupon record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGroupon selectOneByExample(LitemallGrouponExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGroupon selectOneByExampleSelective(@Param("example") LitemallGrouponExample example, @Param("selective") LitemallGroupon.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<LitemallGroupon> selectByExampleSelective(@Param("example") LitemallGrouponExample example, @Param("selective") LitemallGroupon.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
List<LitemallGroupon> selectByExample(LitemallGrouponExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGroupon selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallGroupon.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
LitemallGroupon selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGroupon selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") LitemallGroupon record, @Param("example") LitemallGrouponExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int updateByExample(@Param("record") LitemallGroupon record, @Param("example") LitemallGrouponExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(LitemallGroupon record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
int updateByPrimaryKey(LitemallGroupon record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByExample(@Param("example") LitemallGrouponExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByPrimaryKey(Integer id);
}

View File

@@ -0,0 +1,159 @@
package org.linlinjava.litemall.db.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.linlinjava.litemall.db.domain.LitemallGrouponRules;
import org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample;
public interface LitemallGrouponRulesMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
long countByExample(LitemallGrouponRulesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int deleteByExample(LitemallGrouponRulesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int insert(LitemallGrouponRules record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int insertSelective(LitemallGrouponRules record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGrouponRules selectOneByExample(LitemallGrouponRulesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGrouponRules selectOneByExampleSelective(@Param("example") LitemallGrouponRulesExample example, @Param("selective") LitemallGrouponRules.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<LitemallGrouponRules> selectByExampleSelective(@Param("example") LitemallGrouponRulesExample example, @Param("selective") LitemallGrouponRules.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
List<LitemallGrouponRules> selectByExample(LitemallGrouponRulesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGrouponRules selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallGrouponRules.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
LitemallGrouponRules selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallGrouponRules selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") LitemallGrouponRules record, @Param("example") LitemallGrouponRulesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int updateByExample(@Param("record") LitemallGrouponRules record, @Param("example") LitemallGrouponRulesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(LitemallGrouponRules record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
int updateByPrimaryKey(LitemallGrouponRules record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByExample(@Param("example") LitemallGrouponRulesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByPrimaryKey(Integer id);
}

View File

@@ -0,0 +1,660 @@
package org.linlinjava.litemall.db.domain;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
public class LitemallGroupon {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static final Boolean NOT_DELETED = false;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static final Boolean IS_DELETED = true;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.order_id
*
* @mbg.generated
*/
private Integer orderId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.groupon_id
*
* @mbg.generated
*/
private Integer grouponId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.rules_id
*
* @mbg.generated
*/
private Integer rulesId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.user_id
*
* @mbg.generated
*/
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.user_type
*
* @mbg.generated
*/
private Boolean userType;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.add_time
*
* @mbg.generated
*/
private LocalDateTime addTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.expire_time
*
* @mbg.generated
*/
private LocalDateTime expireTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.share_url
*
* @mbg.generated
*/
private String shareUrl;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.payed
*
* @mbg.generated
*/
private Boolean payed;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.deleted
*
* @mbg.generated
*/
private Boolean deleted;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.version
*
* @mbg.generated
*/
private Integer version;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.id
*
* @return the value of litemall_groupon.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.id
*
* @param id the value for litemall_groupon.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.order_id
*
* @return the value of litemall_groupon.order_id
*
* @mbg.generated
*/
public Integer getOrderId() {
return orderId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.order_id
*
* @param orderId the value for litemall_groupon.order_id
*
* @mbg.generated
*/
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.groupon_id
*
* @return the value of litemall_groupon.groupon_id
*
* @mbg.generated
*/
public Integer getGrouponId() {
return grouponId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.groupon_id
*
* @param grouponId the value for litemall_groupon.groupon_id
*
* @mbg.generated
*/
public void setGrouponId(Integer grouponId) {
this.grouponId = grouponId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.rules_id
*
* @return the value of litemall_groupon.rules_id
*
* @mbg.generated
*/
public Integer getRulesId() {
return rulesId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.rules_id
*
* @param rulesId the value for litemall_groupon.rules_id
*
* @mbg.generated
*/
public void setRulesId(Integer rulesId) {
this.rulesId = rulesId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.user_id
*
* @return the value of litemall_groupon.user_id
*
* @mbg.generated
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.user_id
*
* @param userId the value for litemall_groupon.user_id
*
* @mbg.generated
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.user_type
*
* @return the value of litemall_groupon.user_type
*
* @mbg.generated
*/
public Boolean getUserType() {
return userType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.user_type
*
* @param userType the value for litemall_groupon.user_type
*
* @mbg.generated
*/
public void setUserType(Boolean userType) {
this.userType = userType;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.add_time
*
* @return the value of litemall_groupon.add_time
*
* @mbg.generated
*/
public LocalDateTime getAddTime() {
return addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.add_time
*
* @param addTime the value for litemall_groupon.add_time
*
* @mbg.generated
*/
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.expire_time
*
* @return the value of litemall_groupon.expire_time
*
* @mbg.generated
*/
public LocalDateTime getExpireTime() {
return expireTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.expire_time
*
* @param expireTime the value for litemall_groupon.expire_time
*
* @mbg.generated
*/
public void setExpireTime(LocalDateTime expireTime) {
this.expireTime = expireTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.share_url
*
* @return the value of litemall_groupon.share_url
*
* @mbg.generated
*/
public String getShareUrl() {
return shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.share_url
*
* @param shareUrl the value for litemall_groupon.share_url
*
* @mbg.generated
*/
public void setShareUrl(String shareUrl) {
this.shareUrl = shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.payed
*
* @return the value of litemall_groupon.payed
*
* @mbg.generated
*/
public Boolean getPayed() {
return payed;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.payed
*
* @param payed the value for litemall_groupon.payed
*
* @mbg.generated
*/
public void setPayed(Boolean payed) {
this.payed = payed;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.deleted
*
* @return the value of litemall_groupon.deleted
*
* @mbg.generated
*/
public Boolean getDeleted() {
return deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.deleted
*
* @param deleted the value for litemall_groupon.deleted
*
* @mbg.generated
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.version
*
* @return the value of litemall_groupon.version
*
* @mbg.generated
*/
public Integer getVersion() {
return version;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.version
*
* @param version the value for litemall_groupon.version
*
* @mbg.generated
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", orderId=").append(orderId);
sb.append(", grouponId=").append(grouponId);
sb.append(", rulesId=").append(rulesId);
sb.append(", userId=").append(userId);
sb.append(", userType=").append(userType);
sb.append(", addTime=").append(addTime);
sb.append(", expireTime=").append(expireTime);
sb.append(", shareUrl=").append(shareUrl);
sb.append(", payed=").append(payed);
sb.append(", deleted=").append(deleted);
sb.append(", version=").append(version);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
LitemallGroupon other = (LitemallGroupon) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
&& (this.getGrouponId() == null ? other.getGrouponId() == null : this.getGrouponId().equals(other.getGrouponId()))
&& (this.getRulesId() == null ? other.getRulesId() == null : this.getRulesId().equals(other.getRulesId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUserType() == null ? other.getUserType() == null : this.getUserType().equals(other.getUserType()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
&& (this.getShareUrl() == null ? other.getShareUrl() == null : this.getShareUrl().equals(other.getShareUrl()))
&& (this.getPayed() == null ? other.getPayed() == null : this.getPayed().equals(other.getPayed()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
result = prime * result + ((getGrouponId() == null) ? 0 : getGrouponId().hashCode());
result = prime * result + ((getRulesId() == null) ? 0 : getRulesId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUserType() == null) ? 0 : getUserType().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode());
result = prime * result + ((getShareUrl() == null) ? 0 : getShareUrl().hashCode());
result = prime * result + ((getPayed() == null) ? 0 : getPayed().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public void andLogicalDeleted(boolean deleted) {
setDeleted(deleted ? IS_DELETED : NOT_DELETED);
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER"),
orderId("order_id", "orderId", "INTEGER"),
grouponId("groupon_id", "grouponId", "INTEGER"),
rulesId("rules_id", "rulesId", "INTEGER"),
userId("user_id", "userId", "INTEGER"),
userType("user_type", "userType", "BIT"),
addTime("add_time", "addTime", "TIMESTAMP"),
expireTime("expire_time", "expireTime", "TIMESTAMP"),
shareUrl("share_url", "shareUrl", "VARCHAR"),
payed("payed", "payed", "BIT"),
deleted("deleted", "deleted", "BIT"),
version("version", "version", "INTEGER");
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.column + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.column + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
}
}

View File

@@ -0,0 +1,550 @@
package org.linlinjava.litemall.db.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
public class LitemallGrouponRules {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static final Boolean NOT_DELETED = false;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static final Boolean IS_DELETED = true;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.goods_id
*
* @mbg.generated
*/
private Integer goodsId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.goods_name
*
* @mbg.generated
*/
private String goodsName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.pic_url
*
* @mbg.generated
*/
private String picUrl;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.discount
*
* @mbg.generated
*/
private BigDecimal discount;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.discount_member
*
* @mbg.generated
*/
private Integer discountMember;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.add_time
*
* @mbg.generated
*/
private LocalDateTime addTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.deleted
*
* @mbg.generated
*/
private Boolean deleted;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.version
*
* @mbg.generated
*/
private Integer version;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.id
*
* @return the value of litemall_groupon_rules.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.id
*
* @param id the value for litemall_groupon_rules.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.goods_id
*
* @return the value of litemall_groupon_rules.goods_id
*
* @mbg.generated
*/
public Integer getGoodsId() {
return goodsId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.goods_id
*
* @param goodsId the value for litemall_groupon_rules.goods_id
*
* @mbg.generated
*/
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.goods_name
*
* @return the value of litemall_groupon_rules.goods_name
*
* @mbg.generated
*/
public String getGoodsName() {
return goodsName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.goods_name
*
* @param goodsName the value for litemall_groupon_rules.goods_name
*
* @mbg.generated
*/
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.pic_url
*
* @return the value of litemall_groupon_rules.pic_url
*
* @mbg.generated
*/
public String getPicUrl() {
return picUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.pic_url
*
* @param picUrl the value for litemall_groupon_rules.pic_url
*
* @mbg.generated
*/
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.discount
*
* @return the value of litemall_groupon_rules.discount
*
* @mbg.generated
*/
public BigDecimal getDiscount() {
return discount;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.discount
*
* @param discount the value for litemall_groupon_rules.discount
*
* @mbg.generated
*/
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.discount_member
*
* @return the value of litemall_groupon_rules.discount_member
*
* @mbg.generated
*/
public Integer getDiscountMember() {
return discountMember;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.discount_member
*
* @param discountMember the value for litemall_groupon_rules.discount_member
*
* @mbg.generated
*/
public void setDiscountMember(Integer discountMember) {
this.discountMember = discountMember;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.add_time
*
* @return the value of litemall_groupon_rules.add_time
*
* @mbg.generated
*/
public LocalDateTime getAddTime() {
return addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.add_time
*
* @param addTime the value for litemall_groupon_rules.add_time
*
* @mbg.generated
*/
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.deleted
*
* @return the value of litemall_groupon_rules.deleted
*
* @mbg.generated
*/
public Boolean getDeleted() {
return deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.deleted
*
* @param deleted the value for litemall_groupon_rules.deleted
*
* @mbg.generated
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.version
*
* @return the value of litemall_groupon_rules.version
*
* @mbg.generated
*/
public Integer getVersion() {
return version;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.version
*
* @param version the value for litemall_groupon_rules.version
*
* @mbg.generated
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", goodsId=").append(goodsId);
sb.append(", goodsName=").append(goodsName);
sb.append(", picUrl=").append(picUrl);
sb.append(", discount=").append(discount);
sb.append(", discountMember=").append(discountMember);
sb.append(", addTime=").append(addTime);
sb.append(", deleted=").append(deleted);
sb.append(", version=").append(version);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
LitemallGrouponRules other = (LitemallGrouponRules) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId()))
&& (this.getGoodsName() == null ? other.getGoodsName() == null : this.getGoodsName().equals(other.getGoodsName()))
&& (this.getPicUrl() == null ? other.getPicUrl() == null : this.getPicUrl().equals(other.getPicUrl()))
&& (this.getDiscount() == null ? other.getDiscount() == null : this.getDiscount().equals(other.getDiscount()))
&& (this.getDiscountMember() == null ? other.getDiscountMember() == null : this.getDiscountMember().equals(other.getDiscountMember()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode());
result = prime * result + ((getGoodsName() == null) ? 0 : getGoodsName().hashCode());
result = prime * result + ((getPicUrl() == null) ? 0 : getPicUrl().hashCode());
result = prime * result + ((getDiscount() == null) ? 0 : getDiscount().hashCode());
result = prime * result + ((getDiscountMember() == null) ? 0 : getDiscountMember().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public void andLogicalDeleted(boolean deleted) {
setDeleted(deleted ? IS_DELETED : NOT_DELETED);
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER"),
goodsId("goods_id", "goodsId", "INTEGER"),
goodsName("goods_name", "goodsName", "VARCHAR"),
picUrl("pic_url", "picUrl", "VARCHAR"),
discount("discount", "discount", "DECIMAL"),
discountMember("discount_member", "discountMember", "INTEGER"),
addTime("add_time", "addTime", "TIMESTAMP"),
deleted("deleted", "deleted", "BIT"),
version("version", "version", "INTEGER");
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.column + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.column + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
}
}

View File

@@ -0,0 +1,965 @@
package org.linlinjava.litemall.db.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class LitemallGrouponRulesExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public LitemallGrouponRulesExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public LitemallGrouponRulesExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public LitemallGrouponRulesExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]);
if (i < orderByClauses.length - 1) {
sb.append(" , ");
}
}
this.setOrderByClause(sb.toString());
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andGoodsIdIsNull() {
addCriterion("goods_id is null");
return (Criteria) this;
}
public Criteria andGoodsIdIsNotNull() {
addCriterion("goods_id is not null");
return (Criteria) this;
}
public Criteria andGoodsIdEqualTo(Integer value) {
addCriterion("goods_id =", value, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdNotEqualTo(Integer value) {
addCriterion("goods_id <>", value, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdGreaterThan(Integer value) {
addCriterion("goods_id >", value, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdGreaterThanOrEqualTo(Integer value) {
addCriterion("goods_id >=", value, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdLessThan(Integer value) {
addCriterion("goods_id <", value, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdLessThanOrEqualTo(Integer value) {
addCriterion("goods_id <=", value, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdIn(List<Integer> values) {
addCriterion("goods_id in", values, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdNotIn(List<Integer> values) {
addCriterion("goods_id not in", values, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdBetween(Integer value1, Integer value2) {
addCriterion("goods_id between", value1, value2, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsIdNotBetween(Integer value1, Integer value2) {
addCriterion("goods_id not between", value1, value2, "goodsId");
return (Criteria) this;
}
public Criteria andGoodsNameIsNull() {
addCriterion("goods_name is null");
return (Criteria) this;
}
public Criteria andGoodsNameIsNotNull() {
addCriterion("goods_name is not null");
return (Criteria) this;
}
public Criteria andGoodsNameEqualTo(String value) {
addCriterion("goods_name =", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameNotEqualTo(String value) {
addCriterion("goods_name <>", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameGreaterThan(String value) {
addCriterion("goods_name >", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameGreaterThanOrEqualTo(String value) {
addCriterion("goods_name >=", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameLessThan(String value) {
addCriterion("goods_name <", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameLessThanOrEqualTo(String value) {
addCriterion("goods_name <=", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameLike(String value) {
addCriterion("goods_name like", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameNotLike(String value) {
addCriterion("goods_name not like", value, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameIn(List<String> values) {
addCriterion("goods_name in", values, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameNotIn(List<String> values) {
addCriterion("goods_name not in", values, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameBetween(String value1, String value2) {
addCriterion("goods_name between", value1, value2, "goodsName");
return (Criteria) this;
}
public Criteria andGoodsNameNotBetween(String value1, String value2) {
addCriterion("goods_name not between", value1, value2, "goodsName");
return (Criteria) this;
}
public Criteria andPicUrlIsNull() {
addCriterion("pic_url is null");
return (Criteria) this;
}
public Criteria andPicUrlIsNotNull() {
addCriterion("pic_url is not null");
return (Criteria) this;
}
public Criteria andPicUrlEqualTo(String value) {
addCriterion("pic_url =", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotEqualTo(String value) {
addCriterion("pic_url <>", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlGreaterThan(String value) {
addCriterion("pic_url >", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlGreaterThanOrEqualTo(String value) {
addCriterion("pic_url >=", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlLessThan(String value) {
addCriterion("pic_url <", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlLessThanOrEqualTo(String value) {
addCriterion("pic_url <=", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlLike(String value) {
addCriterion("pic_url like", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotLike(String value) {
addCriterion("pic_url not like", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlIn(List<String> values) {
addCriterion("pic_url in", values, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotIn(List<String> values) {
addCriterion("pic_url not in", values, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlBetween(String value1, String value2) {
addCriterion("pic_url between", value1, value2, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotBetween(String value1, String value2) {
addCriterion("pic_url not between", value1, value2, "picUrl");
return (Criteria) this;
}
public Criteria andDiscountIsNull() {
addCriterion("discount is null");
return (Criteria) this;
}
public Criteria andDiscountIsNotNull() {
addCriterion("discount is not null");
return (Criteria) this;
}
public Criteria andDiscountEqualTo(BigDecimal value) {
addCriterion("discount =", value, "discount");
return (Criteria) this;
}
public Criteria andDiscountNotEqualTo(BigDecimal value) {
addCriterion("discount <>", value, "discount");
return (Criteria) this;
}
public Criteria andDiscountGreaterThan(BigDecimal value) {
addCriterion("discount >", value, "discount");
return (Criteria) this;
}
public Criteria andDiscountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("discount >=", value, "discount");
return (Criteria) this;
}
public Criteria andDiscountLessThan(BigDecimal value) {
addCriterion("discount <", value, "discount");
return (Criteria) this;
}
public Criteria andDiscountLessThanOrEqualTo(BigDecimal value) {
addCriterion("discount <=", value, "discount");
return (Criteria) this;
}
public Criteria andDiscountIn(List<BigDecimal> values) {
addCriterion("discount in", values, "discount");
return (Criteria) this;
}
public Criteria andDiscountNotIn(List<BigDecimal> values) {
addCriterion("discount not in", values, "discount");
return (Criteria) this;
}
public Criteria andDiscountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("discount between", value1, value2, "discount");
return (Criteria) this;
}
public Criteria andDiscountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("discount not between", value1, value2, "discount");
return (Criteria) this;
}
public Criteria andDiscountMemberIsNull() {
addCriterion("discount_member is null");
return (Criteria) this;
}
public Criteria andDiscountMemberIsNotNull() {
addCriterion("discount_member is not null");
return (Criteria) this;
}
public Criteria andDiscountMemberEqualTo(Integer value) {
addCriterion("discount_member =", value, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberNotEqualTo(Integer value) {
addCriterion("discount_member <>", value, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberGreaterThan(Integer value) {
addCriterion("discount_member >", value, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberGreaterThanOrEqualTo(Integer value) {
addCriterion("discount_member >=", value, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberLessThan(Integer value) {
addCriterion("discount_member <", value, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberLessThanOrEqualTo(Integer value) {
addCriterion("discount_member <=", value, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberIn(List<Integer> values) {
addCriterion("discount_member in", values, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberNotIn(List<Integer> values) {
addCriterion("discount_member not in", values, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberBetween(Integer value1, Integer value2) {
addCriterion("discount_member between", value1, value2, "discountMember");
return (Criteria) this;
}
public Criteria andDiscountMemberNotBetween(Integer value1, Integer value2) {
addCriterion("discount_member not between", value1, value2, "discountMember");
return (Criteria) this;
}
public Criteria andAddTimeIsNull() {
addCriterion("add_time is null");
return (Criteria) this;
}
public Criteria andAddTimeIsNotNull() {
addCriterion("add_time is not null");
return (Criteria) this;
}
public Criteria andAddTimeEqualTo(LocalDateTime value) {
addCriterion("add_time =", value, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotEqualTo(LocalDateTime value) {
addCriterion("add_time <>", value, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeGreaterThan(LocalDateTime value) {
addCriterion("add_time >", value, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("add_time >=", value, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeLessThan(LocalDateTime value) {
addCriterion("add_time <", value, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("add_time <=", value, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeIn(List<LocalDateTime> values) {
addCriterion("add_time in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotIn(List<LocalDateTime> values) {
addCriterion("add_time not in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("add_time between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("add_time not between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andVersionIsNull() {
addCriterion("version is null");
return (Criteria) this;
}
public Criteria andVersionIsNotNull() {
addCriterion("version is not null");
return (Criteria) this;
}
public Criteria andVersionEqualTo(Integer value) {
addCriterion("version =", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotEqualTo(Integer value) {
addCriterion("version <>", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThan(Integer value) {
addCriterion("version >", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThanOrEqualTo(Integer value) {
addCriterion("version >=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThan(Integer value) {
addCriterion("version <", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThanOrEqualTo(Integer value) {
addCriterion("version <=", value, "version");
return (Criteria) this;
}
public Criteria andVersionIn(List<Integer> values) {
addCriterion("version in", values, "version");
return (Criteria) this;
}
public Criteria andVersionNotIn(List<Integer> values) {
addCriterion("version not in", values, "version");
return (Criteria) this;
}
public Criteria andVersionBetween(Integer value1, Integer value2) {
addCriterion("version between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andVersionNotBetween(Integer value1, Integer value2) {
addCriterion("version not between", value1, value2, "version");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table litemall_groupon_rules
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private LitemallGrouponRulesExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(LitemallGrouponRulesExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public LitemallGrouponRulesExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLogicalDeleted(boolean deleted) {
return deleted ? andDeletedEqualTo(LitemallGrouponRules.IS_DELETED) : andDeletedNotEqualTo(LitemallGrouponRules.IS_DELETED);
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -123,6 +123,15 @@ public class LitemallOrder {
*/
private BigDecimal integralPrice;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_order.groupon_price
*
* @mbg.generated
*/
private BigDecimal grouponPrice;
/**
*
* This field was generated by MyBatis Generator.
@@ -495,6 +504,30 @@ public class LitemallOrder {
this.integralPrice = integralPrice;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_order.groupon_price
*
* @return the value of litemall_order.groupon_price
*
* @mbg.generated
*/
public BigDecimal getGrouponPrice() {
return grouponPrice;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_order.groupon_price
*
* @param grouponPrice the value for litemall_order.groupon_price
*
* @mbg.generated
*/
public void setGrouponPrice(BigDecimal grouponPrice) {
this.grouponPrice = grouponPrice;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_order.order_price
@@ -806,6 +839,7 @@ public class LitemallOrder {
sb.append(", freightPrice=").append(freightPrice);
sb.append(", couponPrice=").append(couponPrice);
sb.append(", integralPrice=").append(integralPrice);
sb.append(", grouponPrice=").append(grouponPrice);
sb.append(", orderPrice=").append(orderPrice);
sb.append(", actualPrice=").append(actualPrice);
sb.append(", payId=").append(payId);
@@ -851,6 +885,7 @@ public class LitemallOrder {
&& (this.getFreightPrice() == null ? other.getFreightPrice() == null : this.getFreightPrice().equals(other.getFreightPrice()))
&& (this.getCouponPrice() == null ? other.getCouponPrice() == null : this.getCouponPrice().equals(other.getCouponPrice()))
&& (this.getIntegralPrice() == null ? other.getIntegralPrice() == null : this.getIntegralPrice().equals(other.getIntegralPrice()))
&& (this.getGrouponPrice() == null ? other.getGrouponPrice() == null : this.getGrouponPrice().equals(other.getGrouponPrice()))
&& (this.getOrderPrice() == null ? other.getOrderPrice() == null : this.getOrderPrice().equals(other.getOrderPrice()))
&& (this.getActualPrice() == null ? other.getActualPrice() == null : this.getActualPrice().equals(other.getActualPrice()))
&& (this.getPayId() == null ? other.getPayId() == null : this.getPayId().equals(other.getPayId()))
@@ -886,6 +921,7 @@ public class LitemallOrder {
result = prime * result + ((getFreightPrice() == null) ? 0 : getFreightPrice().hashCode());
result = prime * result + ((getCouponPrice() == null) ? 0 : getCouponPrice().hashCode());
result = prime * result + ((getIntegralPrice() == null) ? 0 : getIntegralPrice().hashCode());
result = prime * result + ((getGrouponPrice() == null) ? 0 : getGrouponPrice().hashCode());
result = prime * result + ((getOrderPrice() == null) ? 0 : getOrderPrice().hashCode());
result = prime * result + ((getActualPrice() == null) ? 0 : getActualPrice().hashCode());
result = prime * result + ((getPayId() == null) ? 0 : getPayId().hashCode());
@@ -931,6 +967,7 @@ public class LitemallOrder {
freightPrice("freight_price", "freightPrice", "DECIMAL"),
couponPrice("coupon_price", "couponPrice", "DECIMAL"),
integralPrice("integral_price", "integralPrice", "DECIMAL"),
grouponPrice("groupon_price", "grouponPrice", "DECIMAL"),
orderPrice("order_price", "orderPrice", "DECIMAL"),
actualPrice("actual_price", "actualPrice", "DECIMAL"),
payId("pay_id", "payId", "VARCHAR"),

View File

@@ -927,6 +927,66 @@ public class LitemallOrderExample {
return (Criteria) this;
}
public Criteria andGrouponPriceIsNull() {
addCriterion("groupon_price is null");
return (Criteria) this;
}
public Criteria andGrouponPriceIsNotNull() {
addCriterion("groupon_price is not null");
return (Criteria) this;
}
public Criteria andGrouponPriceEqualTo(BigDecimal value) {
addCriterion("groupon_price =", value, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceNotEqualTo(BigDecimal value) {
addCriterion("groupon_price <>", value, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceGreaterThan(BigDecimal value) {
addCriterion("groupon_price >", value, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("groupon_price >=", value, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceLessThan(BigDecimal value) {
addCriterion("groupon_price <", value, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceLessThanOrEqualTo(BigDecimal value) {
addCriterion("groupon_price <=", value, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceIn(List<BigDecimal> values) {
addCriterion("groupon_price in", values, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceNotIn(List<BigDecimal> values) {
addCriterion("groupon_price not in", values, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("groupon_price between", value1, value2, "grouponPrice");
return (Criteria) this;
}
public Criteria andGrouponPriceNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("groupon_price not between", value1, value2, "grouponPrice");
return (Criteria) this;
}
public Criteria andOrderPriceIsNull() {
addCriterion("order_price is null");
return (Criteria) this;

View File

@@ -0,0 +1,35 @@
package org.linlinjava.litemall.db.service;
import org.linlinjava.litemall.db.dao.LitemallGrouponRulesMapper;
import org.linlinjava.litemall.db.domain.LitemallGrouponRules;
import org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class LitemallGrouponRulesService {
@Resource
LitemallGrouponRulesMapper mapper;
public int createRules(LitemallGrouponRules rules) {
return mapper.insertSelective(rules);
}
public LitemallGrouponRules queryById(Integer id) {
return mapper.selectByPrimaryKey(id);
}
/**
* 查询某个商品关联的团购规则
*
* @param goodsId
* @return
*/
public List<LitemallGrouponRules> queryByGoodsId(Integer goodsId) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andGoodsIdEqualTo(goodsId).andDeletedEqualTo(false);
return mapper.selectByExample(example);
}
}

View File

@@ -0,0 +1,81 @@
package org.linlinjava.litemall.db.service;
import org.linlinjava.litemall.db.dao.LitemallGrouponMapper;
import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.linlinjava.litemall.db.domain.LitemallGrouponExample;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class LitemallGrouponService {
@Resource
LitemallGrouponMapper mapper;
/**
* 查询用户所有参与的团购
*
* @param userId
* @return
*/
public List<LitemallGroupon> queryByUserId(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false);
return mapper.selectByExample(example);
}
public LitemallGroupon queryByOrderId(Integer orderId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andOrderIdEqualTo(orderId).andDeletedEqualTo(false);
return mapper.selectOneByExample(example);
}
/**
* 根据ID查询记录
*
* @param id
* @return
*/
public LitemallGroupon queryById(Integer id) {
return mapper.selectByPrimaryKey(id);
}
/**
* 返回某个发起的团购参与人数
*
* @param grouponId
* @return
*/
public int countGroupon(Integer grouponId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andGrouponIdEqualTo(grouponId).andDeletedEqualTo(false);
return (int) mapper.countByExample(example);
}
/**
* 返回某个团购活动参与人数
*
* @param rulesId
* @return
*/
public int countRules(Integer rulesId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andRulesIdEqualTo(rulesId).andDeletedEqualTo(false);
return (int) mapper.countByExample(example);
}
public void update(LitemallGroupon groupon) {
mapper.updateByPrimaryKey(groupon);
}
/**
* 创建或参与一个团购
*
* @param groupon
* @return
*/
public int createGroupon(LitemallGroupon groupon) {
return mapper.insertSelective(groupon);
}
}

View File

@@ -0,0 +1,519 @@
<?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="org.linlinjava.litemall.db.dao.LitemallGrouponMapper">
<resultMap id="BaseResultMap" type="org.linlinjava.litemall.db.domain.LitemallGroupon">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="groupon_id" jdbcType="INTEGER" property="grouponId" />
<result column="rules_id" jdbcType="INTEGER" property="rulesId" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="user_type" jdbcType="BIT" property="userType" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
<result column="share_url" jdbcType="VARCHAR" property="shareUrl" />
<result column="payed" jdbcType="BIT" property="payed" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="version" jdbcType="INTEGER" property="version" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, order_id, groupon_id, rules_id, user_id, user_type, add_time, expire_time, share_url,
payed, deleted, version
</sql>
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from litemall_groupon
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.value}
</foreach>
</when>
<otherwise>
id, order_id, groupon_id, rules_id, user_id, user_type, add_time, expire_time, share_url,
payed, deleted, version
</otherwise>
</choose>
from litemall_groupon
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from litemall_groupon
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeyWithLogicalDelete" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from litemall_groupon
where id = #{id,jdbcType=INTEGER}
and deleted =
<choose>
<when test="andLogicalDeleted">
'1'
</when>
<otherwise>
'0'
</otherwise>
</choose>
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.value}
</foreach>
</when>
<otherwise>
id, order_id, groupon_id, rules_id, user_id, user_type, add_time, expire_time, share_url,
payed, deleted, version
</otherwise>
</choose>
from litemall_groupon
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_groupon
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_groupon
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="org.linlinjava.litemall.db.domain.LitemallGroupon">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_groupon (order_id, groupon_id, rules_id,
user_id, user_type, add_time,
expire_time, share_url, payed,
deleted, version)
values (#{orderId,jdbcType=INTEGER}, #{grouponId,jdbcType=INTEGER}, #{rulesId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER}, #{userType,jdbcType=BIT}, #{addTime,jdbcType=TIMESTAMP},
#{expireTime,jdbcType=TIMESTAMP}, #{shareUrl,jdbcType=VARCHAR}, #{payed,jdbcType=BIT},
#{deleted,jdbcType=BIT}, #{version,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallGroupon">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_groupon
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">
order_id,
</if>
<if test="grouponId != null">
groupon_id,
</if>
<if test="rulesId != null">
rules_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="userType != null">
user_type,
</if>
<if test="addTime != null">
add_time,
</if>
<if test="expireTime != null">
expire_time,
</if>
<if test="shareUrl != null">
share_url,
</if>
<if test="payed != null">
payed,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="version != null">
version,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">
#{orderId,jdbcType=INTEGER},
</if>
<if test="grouponId != null">
#{grouponId,jdbcType=INTEGER},
</if>
<if test="rulesId != null">
#{rulesId,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="userType != null">
#{userType,jdbcType=BIT},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
</if>
<if test="expireTime != null">
#{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="shareUrl != null">
#{shareUrl,jdbcType=VARCHAR},
</if>
<if test="payed != null">
#{payed,jdbcType=BIT},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from litemall_groupon
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.orderId != null">
order_id = #{record.orderId,jdbcType=INTEGER},
</if>
<if test="record.grouponId != null">
groupon_id = #{record.grouponId,jdbcType=INTEGER},
</if>
<if test="record.rulesId != null">
rules_id = #{record.rulesId,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=INTEGER},
</if>
<if test="record.userType != null">
user_type = #{record.userType,jdbcType=BIT},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.expireTime != null">
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
</if>
<if test="record.shareUrl != null">
share_url = #{record.shareUrl,jdbcType=VARCHAR},
</if>
<if test="record.payed != null">
payed = #{record.payed,jdbcType=BIT},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon
set id = #{record.id,jdbcType=INTEGER},
order_id = #{record.orderId,jdbcType=INTEGER},
groupon_id = #{record.grouponId,jdbcType=INTEGER},
rules_id = #{record.rulesId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
user_type = #{record.userType,jdbcType=BIT},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
share_url = #{record.shareUrl,jdbcType=VARCHAR},
payed = #{record.payed,jdbcType=BIT},
deleted = #{record.deleted,jdbcType=BIT},
version = #{record.version,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.litemall.db.domain.LitemallGroupon">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon
<set>
<if test="orderId != null">
order_id = #{orderId,jdbcType=INTEGER},
</if>
<if test="grouponId != null">
groupon_id = #{grouponId,jdbcType=INTEGER},
</if>
<if test="rulesId != null">
rules_id = #{rulesId,jdbcType=INTEGER},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="userType != null">
user_type = #{userType,jdbcType=BIT},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
</if>
<if test="expireTime != null">
expire_time = #{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="shareUrl != null">
share_url = #{shareUrl,jdbcType=VARCHAR},
</if>
<if test="payed != null">
payed = #{payed,jdbcType=BIT},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="org.linlinjava.litemall.db.domain.LitemallGroupon">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon
set order_id = #{orderId,jdbcType=INTEGER},
groupon_id = #{grouponId,jdbcType=INTEGER},
rules_id = #{rulesId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
user_type = #{userType,jdbcType=BIT},
add_time = #{addTime,jdbcType=TIMESTAMP},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
share_url = #{shareUrl,jdbcType=VARCHAR},
payed = #{payed,jdbcType=BIT},
deleted = #{deleted,jdbcType=BIT},
version = #{version,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
from litemall_groupon
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.value}
</foreach>
</when>
<otherwise>
id, order_id, groupon_id, rules_id, user_id, user_type, add_time, expire_time, share_url,
payed, deleted, version
</otherwise>
</choose>
from litemall_groupon
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
<update id="logicalDeleteByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_groupon set deleted = 1
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="logicalDeleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_groupon set deleted = 1
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@@ -0,0 +1,472 @@
<?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="org.linlinjava.litemall.db.dao.LitemallGrouponRulesMapper">
<resultMap id="BaseResultMap" type="org.linlinjava.litemall.db.domain.LitemallGrouponRules">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="goods_id" jdbcType="INTEGER" property="goodsId" />
<result column="goods_name" jdbcType="VARCHAR" property="goodsName" />
<result column="pic_url" jdbcType="VARCHAR" property="picUrl" />
<result column="discount" jdbcType="DECIMAL" property="discount" />
<result column="discount_member" jdbcType="INTEGER" property="discountMember" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="version" jdbcType="INTEGER" property="version" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, goods_id, goods_name, pic_url, discount, discount_member, add_time, deleted,
version
</sql>
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from litemall_groupon_rules
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.value}
</foreach>
</when>
<otherwise>
id, goods_id, goods_name, pic_url, discount, discount_member, add_time, deleted,
version
</otherwise>
</choose>
from litemall_groupon_rules
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from litemall_groupon_rules
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeyWithLogicalDelete" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from litemall_groupon_rules
where id = #{id,jdbcType=INTEGER}
and deleted =
<choose>
<when test="andLogicalDeleted">
'1'
</when>
<otherwise>
'0'
</otherwise>
</choose>
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.value}
</foreach>
</when>
<otherwise>
id, goods_id, goods_name, pic_url, discount, discount_member, add_time, deleted,
version
</otherwise>
</choose>
from litemall_groupon_rules
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_groupon_rules
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_groupon_rules
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRules">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_groupon_rules (goods_id, goods_name, pic_url,
discount, discount_member, add_time,
deleted, version)
values (#{goodsId,jdbcType=INTEGER}, #{goodsName,jdbcType=VARCHAR}, #{picUrl,jdbcType=VARCHAR},
#{discount,jdbcType=DECIMAL}, #{discountMember,jdbcType=INTEGER}, #{addTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=BIT}, #{version,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRules">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_groupon_rules
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="goodsId != null">
goods_id,
</if>
<if test="goodsName != null">
goods_name,
</if>
<if test="picUrl != null">
pic_url,
</if>
<if test="discount != null">
discount,
</if>
<if test="discountMember != null">
discount_member,
</if>
<if test="addTime != null">
add_time,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="version != null">
version,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="goodsId != null">
#{goodsId,jdbcType=INTEGER},
</if>
<if test="goodsName != null">
#{goodsName,jdbcType=VARCHAR},
</if>
<if test="picUrl != null">
#{picUrl,jdbcType=VARCHAR},
</if>
<if test="discount != null">
#{discount,jdbcType=DECIMAL},
</if>
<if test="discountMember != null">
#{discountMember,jdbcType=INTEGER},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from litemall_groupon_rules
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon_rules
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.goodsId != null">
goods_id = #{record.goodsId,jdbcType=INTEGER},
</if>
<if test="record.goodsName != null">
goods_name = #{record.goodsName,jdbcType=VARCHAR},
</if>
<if test="record.picUrl != null">
pic_url = #{record.picUrl,jdbcType=VARCHAR},
</if>
<if test="record.discount != null">
discount = #{record.discount,jdbcType=DECIMAL},
</if>
<if test="record.discountMember != null">
discount_member = #{record.discountMember,jdbcType=INTEGER},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon_rules
set id = #{record.id,jdbcType=INTEGER},
goods_id = #{record.goodsId,jdbcType=INTEGER},
goods_name = #{record.goodsName,jdbcType=VARCHAR},
pic_url = #{record.picUrl,jdbcType=VARCHAR},
discount = #{record.discount,jdbcType=DECIMAL},
discount_member = #{record.discountMember,jdbcType=INTEGER},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT},
version = #{record.version,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRules">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon_rules
<set>
<if test="goodsId != null">
goods_id = #{goodsId,jdbcType=INTEGER},
</if>
<if test="goodsName != null">
goods_name = #{goodsName,jdbcType=VARCHAR},
</if>
<if test="picUrl != null">
pic_url = #{picUrl,jdbcType=VARCHAR},
</if>
<if test="discount != null">
discount = #{discount,jdbcType=DECIMAL},
</if>
<if test="discountMember != null">
discount_member = #{discountMember,jdbcType=INTEGER},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRules">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_groupon_rules
set goods_id = #{goodsId,jdbcType=INTEGER},
goods_name = #{goodsName,jdbcType=VARCHAR},
pic_url = #{picUrl,jdbcType=VARCHAR},
discount = #{discount,jdbcType=DECIMAL},
discount_member = #{discountMember,jdbcType=INTEGER},
add_time = #{addTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=BIT},
version = #{version,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
from litemall_groupon_rules
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.value}
</foreach>
</when>
<otherwise>
id, goods_id, goods_name, pic_url, discount, discount_member, add_time, deleted,
version
</otherwise>
</choose>
from litemall_groupon_rules
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
<update id="logicalDeleteByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_groupon_rules set deleted = 1
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="logicalDeleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_groupon_rules set deleted = 1
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@@ -17,6 +17,7 @@
<result column="freight_price" jdbcType="DECIMAL" property="freightPrice" />
<result column="coupon_price" jdbcType="DECIMAL" property="couponPrice" />
<result column="integral_price" jdbcType="DECIMAL" property="integralPrice" />
<result column="groupon_price" jdbcType="DECIMAL" property="grouponPrice" />
<result column="order_price" jdbcType="DECIMAL" property="orderPrice" />
<result column="actual_price" jdbcType="DECIMAL" property="actualPrice" />
<result column="pay_id" jdbcType="VARCHAR" property="payId" />
@@ -102,8 +103,8 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, user_id, order_sn, order_status, consignee, mobile, address, goods_price, freight_price,
coupon_price, integral_price, order_price, actual_price, pay_id, pay_time, ship_sn,
ship_channel, ship_time, confirm_time, end_time, add_time, deleted, version
coupon_price, integral_price, groupon_price, order_price, actual_price, pay_id, pay_time,
ship_sn, ship_channel, ship_time, confirm_time, end_time, add_time, deleted, version
</sql>
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallOrderExample" resultMap="BaseResultMap">
<!--
@@ -141,8 +142,9 @@
</when>
<otherwise>
id, user_id, order_sn, order_status, consignee, mobile, address, goods_price, freight_price,
coupon_price, integral_price, order_price, actual_price, pay_id, pay_time, ship_sn,
ship_channel, ship_time, confirm_time, end_time, add_time, deleted, version
coupon_price, integral_price, groupon_price, order_price, actual_price, pay_id,
pay_time, ship_sn, ship_channel, ship_time, confirm_time, end_time, add_time, deleted,
version
</otherwise>
</choose>
from litemall_order
@@ -202,8 +204,9 @@
</when>
<otherwise>
id, user_id, order_sn, order_status, consignee, mobile, address, goods_price, freight_price,
coupon_price, integral_price, order_price, actual_price, pay_id, pay_time, ship_sn,
ship_channel, ship_time, confirm_time, end_time, add_time, deleted, version
coupon_price, integral_price, groupon_price, order_price, actual_price, pay_id,
pay_time, ship_sn, ship_channel, ship_time, confirm_time, end_time, add_time, deleted,
version
</otherwise>
</choose>
from litemall_order
@@ -238,19 +241,19 @@
insert into litemall_order (user_id, order_sn, order_status,
consignee, mobile, address,
goods_price, freight_price, coupon_price,
integral_price, order_price, actual_price,
pay_id, pay_time, ship_sn,
ship_channel, ship_time, confirm_time,
end_time, add_time, deleted,
version)
integral_price, groupon_price, order_price,
actual_price, pay_id, pay_time,
ship_sn, ship_channel, ship_time,
confirm_time, end_time, add_time,
deleted, version)
values (#{userId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{orderStatus,jdbcType=SMALLINT},
#{consignee,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
#{goodsPrice,jdbcType=DECIMAL}, #{freightPrice,jdbcType=DECIMAL}, #{couponPrice,jdbcType=DECIMAL},
#{integralPrice,jdbcType=DECIMAL}, #{orderPrice,jdbcType=DECIMAL}, #{actualPrice,jdbcType=DECIMAL},
#{payId,jdbcType=VARCHAR}, #{payTime,jdbcType=TIMESTAMP}, #{shipSn,jdbcType=VARCHAR},
#{shipChannel,jdbcType=VARCHAR}, #{shipTime,jdbcType=TIMESTAMP}, #{confirmTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{addTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT},
#{version,jdbcType=INTEGER})
#{integralPrice,jdbcType=DECIMAL}, #{grouponPrice,jdbcType=DECIMAL}, #{orderPrice,jdbcType=DECIMAL},
#{actualPrice,jdbcType=DECIMAL}, #{payId,jdbcType=VARCHAR}, #{payTime,jdbcType=TIMESTAMP},
#{shipSn,jdbcType=VARCHAR}, #{shipChannel,jdbcType=VARCHAR}, #{shipTime,jdbcType=TIMESTAMP},
#{confirmTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{addTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=BIT}, #{version,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallOrder">
<!--
@@ -292,6 +295,9 @@
<if test="integralPrice != null">
integral_price,
</if>
<if test="grouponPrice != null">
groupon_price,
</if>
<if test="orderPrice != null">
order_price,
</if>
@@ -360,6 +366,9 @@
<if test="integralPrice != null">
#{integralPrice,jdbcType=DECIMAL},
</if>
<if test="grouponPrice != null">
#{grouponPrice,jdbcType=DECIMAL},
</if>
<if test="orderPrice != null">
#{orderPrice,jdbcType=DECIMAL},
</if>
@@ -448,6 +457,9 @@
<if test="record.integralPrice != null">
integral_price = #{record.integralPrice,jdbcType=DECIMAL},
</if>
<if test="record.grouponPrice != null">
groupon_price = #{record.grouponPrice,jdbcType=DECIMAL},
</if>
<if test="record.orderPrice != null">
order_price = #{record.orderPrice,jdbcType=DECIMAL},
</if>
@@ -506,6 +518,7 @@
freight_price = #{record.freightPrice,jdbcType=DECIMAL},
coupon_price = #{record.couponPrice,jdbcType=DECIMAL},
integral_price = #{record.integralPrice,jdbcType=DECIMAL},
groupon_price = #{record.grouponPrice,jdbcType=DECIMAL},
order_price = #{record.orderPrice,jdbcType=DECIMAL},
actual_price = #{record.actualPrice,jdbcType=DECIMAL},
pay_id = #{record.payId,jdbcType=VARCHAR},
@@ -559,6 +572,9 @@
<if test="integralPrice != null">
integral_price = #{integralPrice,jdbcType=DECIMAL},
</if>
<if test="grouponPrice != null">
groupon_price = #{grouponPrice,jdbcType=DECIMAL},
</if>
<if test="orderPrice != null">
order_price = #{orderPrice,jdbcType=DECIMAL},
</if>
@@ -614,6 +630,7 @@
freight_price = #{freightPrice,jdbcType=DECIMAL},
coupon_price = #{couponPrice,jdbcType=DECIMAL},
integral_price = #{integralPrice,jdbcType=DECIMAL},
groupon_price = #{grouponPrice,jdbcType=DECIMAL},
order_price = #{orderPrice,jdbcType=DECIMAL},
actual_price = #{actualPrice,jdbcType=DECIMAL},
pay_id = #{payId,jdbcType=VARCHAR},
@@ -660,8 +677,9 @@
</when>
<otherwise>
id, user_id, order_sn, order_status, consignee, mobile, address, goods_price, freight_price,
coupon_price, integral_price, order_price, actual_price, pay_id, pay_time, ship_sn,
ship_channel, ship_time, confirm_time, end_time, add_time, deleted, version
coupon_price, integral_price, groupon_price, order_price, actual_price, pay_id,
pay_time, ship_sn, ship_channel, ship_time, confirm_time, end_time, add_time, deleted,
version
</otherwise>
</choose>
from litemall_order

View File

@@ -32,33 +32,33 @@ public class WxCartController {
@Autowired
private LitemallProductService productService;
@Autowired
private LitemallGoodsSpecificationService goodsSpecificationService;
@Autowired
private LitemallAddressService addressService;
@Autowired
private LitemallGrouponRulesService grouponRulesService;
/**
* 购物车
*
* @param userId 用户ID
* @return 购物车
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* cartList: xxx,
* cartTotal: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* cartList: xxx,
* cartTotal: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping("index")
public Object index(@LoginUser Integer userId) {
if(userId == null){
if (userId == null) {
return ResponseUtil.unlogin();
}
List<LitemallCart> cartList = cartService.queryByUid(userId);
Integer goodsCount = 0;
BigDecimal goodsAmount = new BigDecimal(0.00);
@@ -91,29 +91,29 @@ public class WxCartController {
* 否则添加新的购物车货品项。
*
* @param userId 用户ID
* @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx }
* @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx }
* @return 加入购物车操作结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@PostMapping("add")
public Object add(@LoginUser Integer userId, @RequestBody LitemallCart cart) {
if(userId == null){
if (userId == null) {
return ResponseUtil.unlogin();
}
if(cart == null){
if (cart == null) {
return ResponseUtil.badArgument();
}
Integer productId = cart.getProductId();
Integer number = cart.getNumber().intValue();
Integer goodsId = cart.getGoodsId();
if(!ObjectUtils.allNotNull(productId, number, goodsId)){
if (!ObjectUtils.allNotNull(productId, number, goodsId)) {
return ResponseUtil.badArgument();
}
@@ -126,9 +126,9 @@ public class WxCartController {
LitemallProduct product = productService.findById(productId);
//判断购物车中是否存在此规格商品
LitemallCart existCart = cartService.queryExist(goodsId, productId, userId);
if(existCart == null){
if (existCart == null) {
//取得规格的信息,判断规格库存
if(product == null || number > product.getNumber() ){
if (product == null || number > product.getNumber()) {
return ResponseUtil.fail(400, "库存不足");
}
@@ -141,14 +141,13 @@ public class WxCartController {
cart.setUserId(userId);
cart.setChecked(true);
cartService.add(cart);
}
else{
} else {
//取得规格的信息,判断规格库存
int num = existCart.getNumber() + number;
if(num > product.getNumber()){
if (num > product.getNumber()) {
return ResponseUtil.fail(400, "库存不足");
}
existCart.setNumber((short)num);
existCart.setNumber((short) num);
cartService.update(existCart);
}
@@ -157,35 +156,35 @@ public class WxCartController {
/**
* 立即购买商品
*
* <p>
* 和 前面一个方法add的区别在于
* 1. 如果购物车内已经存在购物车货品,前者的逻辑是数量添加,这里的逻辑是数量覆盖
* 2. 添加成功以后前者的逻辑是返回当前购物车商品数量这里的逻辑是返回对应购物车项的ID
*
* @param userId 用户ID
* @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx }
* @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx }
* @return 即购买操作结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@PostMapping("fastadd")
public Object fastadd(@LoginUser Integer userId, @RequestBody LitemallCart cart) {
if(userId == null){
if (userId == null) {
return ResponseUtil.unlogin();
}
if(cart == null){
if (cart == null) {
return ResponseUtil.badArgument();
}
Integer productId = cart.getProductId();
Integer number = cart.getNumber().intValue();
Integer goodsId = cart.getGoodsId();
if(!ObjectUtils.allNotNull(productId, number, goodsId)){
if (!ObjectUtils.allNotNull(productId, number, goodsId)) {
return ResponseUtil.badArgument();
}
@@ -198,9 +197,9 @@ public class WxCartController {
LitemallProduct product = productService.findById(productId);
//判断购物车中是否存在此规格商品
LitemallCart existCart = cartService.queryExist(goodsId, productId, userId);
if(existCart == null){
if (existCart == null) {
//取得规格的信息,判断规格库存
if(product == null || number > product.getNumber() ){
if (product == null || number > product.getNumber()) {
return ResponseUtil.fail(400, "库存不足");
}
@@ -213,14 +212,13 @@ public class WxCartController {
cart.setUserId(userId);
cart.setChecked(true);
cartService.add(cart);
}
else{
} else {
//取得规格的信息,判断规格库存
int num = number;
if(num > product.getNumber()){
if (num > product.getNumber()) {
return ResponseUtil.fail(400, "库存不足");
}
existCart.setNumber((short)num);
existCart.setNumber((short) num);
cartService.update(existCart);
}
@@ -232,39 +230,39 @@ public class WxCartController {
* 目前只支持修改商品的数量
*
* @param userId 用户ID
* @param cart 购物车商品信息, { id: xxx, goodsId: xxx, productId: xxx, number: xxx }
* @param cart 购物车商品信息, { id: xxx, goodsId: xxx, productId: xxx, number: xxx }
* @return 更新购物车操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@PostMapping("update")
public Object update(@LoginUser Integer userId, @RequestBody LitemallCart cart) {
if(userId == null){
if (userId == null) {
return ResponseUtil.unlogin();
}
if(cart == null){
if (cart == null) {
return ResponseUtil.badArgument();
}
Integer productId = cart.getProductId();
Integer number = cart.getNumber().intValue();
Integer goodsId = cart.getGoodsId();
Integer id = cart.getId();
if(!ObjectUtils.allNotNull(id, productId, number, goodsId)){
if (!ObjectUtils.allNotNull(id, productId, number, goodsId)) {
return ResponseUtil.badArgument();
}
//判断是否存在该订单
// 如果不存在,直接返回错误
LitemallCart existCart = cartService.findById(id);
if(existCart == null){
if (existCart == null) {
return ResponseUtil.badArgumentValue();
}
// 判断goodsId和productId是否与当前cart里的值一致
if(!existCart.getGoodsId().equals(goodsId)){
if (!existCart.getGoodsId().equals(goodsId)) {
return ResponseUtil.badArgumentValue();
}
if(!existCart.getProductId().equals(productId)){
if (!existCart.getProductId().equals(productId)) {
return ResponseUtil.badArgumentValue();
}
@@ -276,7 +274,7 @@ public class WxCartController {
//取得规格的信息,判断规格库存
LitemallProduct product = productService.findById(productId);
if(product == null || product.getNumber() < number){
if (product == null || product.getNumber() < number) {
return ResponseUtil.fail(403, "库存不足");
}
@@ -290,32 +288,32 @@ public class WxCartController {
* 如果原来没有勾选,则设置勾选状态;如果商品已经勾选,则设置非勾选状态。
*
* @param userId 用户ID
* @param body 购物车商品信息, { productIds: xxx }
* @param body 购物车商品信息, { productIds: xxx }
* @return 购物车信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@PostMapping("checked")
public Object checked(@LoginUser Integer userId, @RequestBody String body) {
if(userId == null){
if (userId == null) {
return ResponseUtil.unlogin();
}
if(body == null){
if (body == null) {
return ResponseUtil.badArgument();
}
List<Integer> productIds = JacksonUtil.parseIntegerList(body, "productIds");
if(productIds == null){
if (productIds == null) {
return ResponseUtil.badArgument();
}
Integer checkValue = JacksonUtil.parseInteger(body, "isChecked");
if(checkValue == null){
if (checkValue == null) {
return ResponseUtil.badArgument();
}
Boolean isChecked = (checkValue == 1);
@@ -328,28 +326,28 @@ public class WxCartController {
* 购物车商品删除
*
* @param userId 用户ID
* @param body 购物车商品信息, { productIds: xxx }
* @param body 购物车商品信息, { productIds: xxx }
* @return 购物车信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@PostMapping("delete")
public Object delete(@LoginUser Integer userId, @RequestBody String body) {
if(userId == null){
if (userId == null) {
return ResponseUtil.unlogin();
}
if(body == null){
if (body == null) {
return ResponseUtil.badArgument();
}
List<Integer> productIds = JacksonUtil.parseIntegerList(body, "productIds");
if(productIds == null || productIds.size() == 0){
if (productIds == null || productIds.size() == 0) {
return ResponseUtil.badArgument();
}
@@ -363,23 +361,23 @@ public class WxCartController {
*
* @param userId 用户ID
* @return 购物车商品数量
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping("goodscount")
public Object goodscount(@LoginUser Integer userId) {
if(userId == null){
if (userId == null) {
return ResponseUtil.ok(0);
}
int goodsCount = 0;
List<LitemallCart> cartList = cartService.queryByUid(userId);
for(LitemallCart cart : cartList){
for (LitemallCart cart : cartList) {
goodsCount += cart.getNumber();
}
@@ -389,61 +387,59 @@ public class WxCartController {
/**
* 购物车下单信息
*
* @param userId 用户ID
* @param cartId 购物车商品ID
* 如果购物车商品ID是空则下单当前用户所有购物车商品
* 如果购物车商品ID非空则只下单当前购物车商品。
* @param userId 用户ID
* @param cartId 购物车商品ID
* 如果购物车商品ID是空则下单当前用户所有购物车商品
* 如果购物车商品ID非空则只下单当前购物车商品。
* @param addressId 收货地址ID
* 如果收货地址ID是空则查询当前用户的默认地址。
* @param couponId 优惠券ID
* 目前不支持
* 如果收货地址ID是空则查询当前用户的默认地址。
* @param couponId 优惠券ID
* 目前不支持
* @return 购物车下单信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* addressId: xxx,
* checkedAddress: xxx,
* couponId: xxx,
* checkedCoupon: xxx,
* goodsTotalPrice: xxx,
* freightPrice: xxx,
* couponPrice: xxx,
* orderTotalPrice: xxx,
* actualPrice: xxx,
* checkedGoodsList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* addressId: xxx,
* checkedAddress: xxx,
* couponId: xxx,
* checkedCoupon: xxx,
* goodsTotalPrice: xxx,
* freightPrice: xxx,
* couponPrice: xxx,
* orderTotalPrice: xxx,
* actualPrice: xxx,
* checkedGoodsList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping("checkout")
public Object checkout(@LoginUser Integer userId, Integer cartId, Integer addressId, Integer couponId) {
if(userId == null){
public Object checkout(@LoginUser Integer userId, Integer cartId, Integer addressId, Integer couponId, Integer grouponId) {
if (userId == null) {
return ResponseUtil.unlogin();
}
// 收货地址
LitemallAddress checkedAddress = null;
if(addressId == null || addressId.equals(0)){
if (addressId == null || addressId.equals(0)) {
checkedAddress = addressService.findDefault(userId);
// 如果仍然没有地址,则是没有收获地址
// 返回一个空的地址id=0这样前端则会提醒添加地址
if(checkedAddress == null){
if (checkedAddress == null) {
checkedAddress = new LitemallAddress();
checkedAddress.setId(0);
addressId = 0;
}
else{
} else {
addressId = checkedAddress.getId();
}
}
else {
} else {
checkedAddress = addressService.findById(addressId);
// 如果null, 则报错
if(checkedAddress == null){
if (checkedAddress == null) {
return ResponseUtil.badArgumentValue();
}
}
@@ -454,12 +450,11 @@ public class WxCartController {
// 商品价格
List<LitemallCart> checkedGoodsList = null;
if(cartId == null || cartId.equals(0)) {
if (cartId == null || cartId.equals(0)) {
checkedGoodsList = cartService.queryByUidAndChecked(userId);
}
else {
} else {
LitemallCart cart = cartService.findById(cartId);
if (cart == null){
if (cart == null) {
return ResponseUtil.badArgumentValue();
}
checkedGoodsList = new ArrayList<>(1);
@@ -479,12 +474,20 @@ public class WxCartController {
// 可以使用的其他钱,例如用户积分
BigDecimal integralPrice = new BigDecimal(0.00);
// 团购优惠
BigDecimal grouponPrice = new BigDecimal(0.00);
LitemallGrouponRules grouponRules = grouponRulesService.queryById(grouponId);
if (grouponRules != null) {
grouponPrice = grouponRules.getDiscount();
}
// 订单费用
BigDecimal orderTotalPrice = checkedGoodsPrice.add(freightPrice).subtract(couponPrice);
BigDecimal orderTotalPrice = checkedGoodsPrice.add(freightPrice).subtract(couponPrice).subtract(grouponPrice);
BigDecimal actualPrice = orderTotalPrice.subtract(integralPrice);
Map<String, Object> data = new HashMap<>();
data.put("addressId", addressId);
data.put("grouponId", grouponId);
data.put("checkedAddress", checkedAddress);
data.put("couponId", couponId);
data.put("checkedCoupon", 0);
@@ -492,6 +495,7 @@ public class WxCartController {
data.put("goodsTotalPrice", checkedGoodsPrice);
data.put("freightPrice", freightPrice);
data.put("couponPrice", couponPrice);
data.put("grouponPrice", grouponPrice);
data.put("orderTotalPrice", orderTotalPrice);
data.put("actualPrice", actualPrice);
data.put("checkedGoodsList", checkedGoodsList);
@@ -504,17 +508,17 @@ public class WxCartController {
*
* @param userId 用户ID
* @return 商品优惠券信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping("checkedCouponList")
public Object checkedCouponList(@LoginUser Integer userId) {
if(userId == null){
if (userId == null) {
return ResponseUtil.unlogin();
}
return ResponseUtil.unsupport();

View File

@@ -54,6 +54,8 @@ public class WxGoodsController {
private LitemallSearchHistoryService searchHistoryService;
@Autowired
private LitemallGoodsSpecificationService goodsSpecificationService;
@Autowired
private LitemallGrouponRulesService rulesService;
/**
@@ -123,6 +125,9 @@ public class WxGoodsController {
commentList.put("count", commentCount);
commentList.put("data", commentsVo);
//团购信息
List<LitemallGrouponRules> rules = rulesService.queryByGoodsId(id);
// 用户收藏
int userHasCollect = 0;
if (userId != null) {
@@ -147,6 +152,7 @@ public class WxGoodsController {
data.put("productList", productList);
data.put("attribute", goodsAttributeList);
data.put("brand", brand);
data.put("groupon", rules);
//商品分享图片地址
data.put("shareImage", info.getShareUrl());
@@ -231,7 +237,7 @@ public class WxGoodsController {
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order){
@Order @RequestParam(defaultValue = "desc") String order) {
//添加到搜索历史
if (userId != null && !StringUtils.isNullOrEmpty(keyword)) {

View File

@@ -0,0 +1,157 @@
package org.linlinjava.litemall.wx.web;
import org.linlinjava.litemall.core.qcode.QCodeService;
import org.linlinjava.litemall.core.util.JacksonUtil;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.LitemallGoods;
import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.linlinjava.litemall.db.domain.LitemallGrouponRules;
import org.linlinjava.litemall.db.service.LitemallGoodsService;
import org.linlinjava.litemall.db.service.LitemallGrouponRulesService;
import org.linlinjava.litemall.db.service.LitemallGrouponService;
import org.linlinjava.litemall.wx.annotation.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/wx/groupon")
@Validated
public class WxGrouponController {
@Autowired
private LitemallGrouponRulesService rulesService;
@Autowired
private LitemallGrouponService grouponService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private QCodeService qCodeService;
@GetMapping("detail")
public Object detail(@LoginUser Integer userId, @NotNull Integer grouponId) {
if (userId == null) {
return ResponseUtil.unlogin();
}
LitemallGroupon groupon = grouponService.queryById(grouponId);
if (groupon == null) {
return ResponseUtil.badArgumentValue();
}
LitemallGrouponRules rules = rulesService.queryById(groupon.getRulesId());
if (rules == null) {
return ResponseUtil.badArgumentValue();
}
LitemallGoods goods = goodsService.findById(rules.getGoodsId());
int count = grouponService.countGroupon(grouponId);
Map<String, Object> groupInfo = new HashMap<>();
groupInfo.put("groupon", groupon);
groupInfo.put("rules", rules);
groupInfo.put("goods", goods);
groupInfo.put("count", count);
return ResponseUtil.ok(groupInfo);
}
@GetMapping("query")
public Object query(@NotNull Integer goodsId) {
LitemallGoods goods = goodsService.findById(goodsId);
if (goods == null) {
return ResponseUtil.fail(-1, "未找到对应的商品");
}
List<LitemallGrouponRules> rules = rulesService.queryByGoodsId(goodsId);
return ResponseUtil.ok(rules);
}
@RequestMapping("join")
public Object join(@LoginUser Integer userId, @RequestBody String body) {
if (userId == null) {
return ResponseUtil.unlogin();
}
Integer rulesId = JacksonUtil.parseInteger(body, "rulesId");
LitemallGrouponRules rules = rulesService.queryById(rulesId);
if (rules == null) {
return ResponseUtil.fail(-1, "未找到对应的团购规则");
}
Integer grouponId = JacksonUtil.parseInteger(body, "grouponId");
LitemallGroupon groupon = grouponService.queryById(grouponId);
if (groupon == null) {
return ResponseUtil.fail(-1, "未找到对应的团购活动");
}
LitemallGroupon groupon2 = new LitemallGroupon();
groupon2.setUserId(userId);
groupon2.setRulesId(rulesId);
groupon2.setShareUrl("");
//参与者
groupon2.setUserType(false);
groupon2.setGrouponId(grouponId);
groupon2.setAddTime(LocalDateTime.now());
//过期时间与创建一致
groupon2.setExpireTime(groupon.getExpireTime());
grouponService.createGroupon(groupon);
return ResponseUtil.ok();
}
@GetMapping("create")
public Object create(@LoginUser Integer userId, @NotNull Integer rulesId) {
if (userId == null) {
return ResponseUtil.unlogin();
}
LitemallGrouponRules rules = rulesService.queryById(rulesId);
if (rules == null) {
return ResponseUtil.fail(-1, "未找到对应的团购规则");
}
LitemallGroupon groupon = new LitemallGroupon();
groupon.setUserId(userId);
groupon.setRulesId(rulesId);
//发起者
groupon.setUserType(true);
groupon.setGrouponId(0);
groupon.setAddTime(LocalDateTime.now());
groupon.setExpireTime(LocalDateTime.now().plusDays(2));
grouponService.createGroupon(groupon);
qCodeService.createGrouponShareImage(rules.getGoodsName(), rules.getPicUrl(), groupon);
groupon.setShareUrl(qCodeService.getShareImageUrl(groupon.getId().toString()));
grouponService.update(groupon);
return ResponseUtil.ok();
}
@RequestMapping("list")
public Object list(@LoginUser Integer userId) {
if (userId == null) {
return ResponseUtil.unlogin();
}
List<LitemallGroupon> myGroupOn = grouponService.queryByUserId(userId);
return ResponseUtil.ok(myGroupOn);
}
}

View File

@@ -11,6 +11,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.linlinjava.litemall.core.notify.NotifyService;
import org.linlinjava.litemall.core.notify.NotifyType;
import org.linlinjava.litemall.core.qcode.QCodeService;
import org.linlinjava.litemall.core.util.DateTimeUtil;
import org.linlinjava.litemall.core.util.JacksonUtil;
import org.linlinjava.litemall.core.util.ResponseUtil;
@@ -82,15 +83,18 @@ public class WxOrderController {
private LitemallRegionService regionService;
@Autowired
private LitemallProductService productService;
@Autowired
private WxPayService wxPayService;
@Autowired
private NotifyService notifyService;
@Autowired
private LitemallUserFormIdService formIdService;
@Autowired
private LitemallGrouponRulesService grouponRulesService;
@Autowired
private LitemallGrouponService grouponService;
@Autowired
private QCodeService qCodeService;
public WxOrderController() {
}
@@ -267,6 +271,9 @@ public class WxOrderController {
Integer cartId = JacksonUtil.parseInteger(body, "cartId");
Integer addressId = JacksonUtil.parseInteger(body, "addressId");
Integer couponId = JacksonUtil.parseInteger(body, "couponId");
Integer grouponId = JacksonUtil.parseInteger(body, "grouponId");
Integer grouponLinkId = JacksonUtil.parseInteger(body, "grouponLinkId");
if (cartId == null || addressId == null || couponId == null) {
return ResponseUtil.badArgument();
}
@@ -304,9 +311,15 @@ public class WxOrderController {
// 可以使用的其他钱,例如用户积分
BigDecimal integralPrice = new BigDecimal(0.00);
// 团购优惠
BigDecimal grouponPrice = new BigDecimal(0.00);
LitemallGrouponRules grouponRules = grouponRulesService.queryById(grouponId);
if (grouponRules != null) {
grouponPrice = grouponRules.getDiscount();
}
// 订单费用
BigDecimal orderTotalPrice = checkedGoodsPrice.add(freightPrice).subtract(couponPrice);
BigDecimal orderTotalPrice = checkedGoodsPrice.add(freightPrice).subtract(couponPrice).subtract(grouponPrice);
BigDecimal actualPrice = orderTotalPrice.subtract(integralPrice);
// 开启事务管理
@@ -332,6 +345,14 @@ public class WxOrderController {
order.setIntegralPrice(integralPrice);
order.setOrderPrice(orderTotalPrice);
order.setActualPrice(actualPrice);
// 有团购活动
if (grouponRules != null) {
order.setGrouponPrice(grouponPrice); // 团购价格
} else {
order.setGrouponPrice(new BigDecimal(0.00)); // 团购价格
}
// 添加订单表项
orderService.add(order);
orderId = order.getId();
@@ -369,6 +390,29 @@ public class WxOrderController {
product.setNumber(remainNumber);
productService.updateById(product);
}
//如果是团购项目,添加团购信息
if (grouponId != null && grouponId > 0) {
LitemallGroupon groupon = new LitemallGroupon();
groupon.setOrderId(orderId);
groupon.setPayed(false);
groupon.setUserId(userId);
groupon.setRulesId(grouponId);
//参与者
if (grouponLinkId != null && grouponLinkId > 0) {
groupon.setUserType(false);
groupon.setGrouponId(grouponLinkId);
} else {
groupon.setUserType(true);
groupon.setGrouponId(0);
}
groupon.setAddTime(LocalDateTime.now());
groupon.setExpireTime(LocalDateTime.now().plusDays(2));
grouponService.createGroupon(groupon);
}
} catch (Exception ex) {
txManager.rollback(status);
logger.error("系统内部错误", ex);
@@ -545,6 +589,7 @@ public class WxOrderController {
String orderSn = result.getOutTradeNo();
String payId = result.getTransactionId();
// 分转化成元
String totalFee = BaseWxPayResult.fenToYuan(result.getTotalFee());
@@ -568,6 +613,20 @@ public class WxOrderController {
order.setOrderStatus(OrderUtil.STATUS_PAY);
orderService.updateById(order);
// 支付成功,有团购信息,更新团购信息
LitemallGroupon groupon = grouponService.queryByOrderId(order.getId());
if (groupon != null) {
LitemallGrouponRules grouponRules = grouponRulesService.queryById(groupon.getRulesId());
//仅当发起者才创建分享图片
if (groupon.getGrouponId() == 0) {
qCodeService.createGrouponShareImage(grouponRules.getGoodsName(), grouponRules.getPicUrl(), groupon);
groupon.setShareUrl(qCodeService.getShareImageUrl(groupon.getId().toString()));
}
groupon.setPayed(true);
grouponService.update(groupon);
}
//TODO 发送邮件和短信通知,这里采用异步发送
// 订单支付成功以后,会发送短信给用户,以及发送邮件给管理员
notifyService.notifyMail("新订单通知", order.toString());