修改查询条件
This commit is contained in:
parent
98d8b99d82
commit
7e6e73eeca
@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardFule.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
||||
@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -49,8 +51,31 @@ public class CardFuelDieselController extends BaseController {
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardFuelDiesel cardFuelDiesel) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
//构建查询条件
|
||||
LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.orderByDesc(CardFuelDiesel::getCreateTime);
|
||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getOilType())){
|
||||
queryWrapper.eq(CardFuelDiesel::getOilType,cardFuelDiesel.getOilType());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cardFuelDiesel.getStatus())){
|
||||
queryWrapper.eq(CardFuelDiesel::getStatus,cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getType())) {
|
||||
queryWrapper.eq(CardFuelDiesel::getType,cardFuelDiesel.getType());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardFuelDiesel::getCreateTime);
|
||||
IPage page1 = this.cardFuelDieselService.page(page, queryWrapper);
|
||||
List<CardFuelDiesel> records = page1.getRecords();
|
||||
//返回囤油卡状态
|
||||
for (CardFuelDiesel record : records) {
|
||||
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
|
||||
if("1".equals(record.getActiveTime())){
|
||||
record.setActiveStatus(record.getActiveTime().equals("1") ? "1" : "0");
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(record.getStartTime()) && ObjectUtils.isNotEmpty(record.getEndTime())){
|
||||
record.setActiveStatus(record.getStartTime().getTime() > new Date().getTime() ? "0" : "1");
|
||||
record.setActiveStatus(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2");
|
||||
}
|
||||
}
|
||||
return getSuccessResult(this.cardFuelDieselService.page(page, queryWrapper));
|
||||
}
|
||||
|
||||
@ -78,6 +103,7 @@ public class CardFuelDieselController extends BaseController {
|
||||
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||
return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel));
|
||||
}
|
||||
|
||||
@ -89,6 +115,7 @@ public class CardFuelDieselController extends BaseController {
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardFuelDiesel cardFuelDiesel) {
|
||||
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||
return getSuccessResult(this.cardFuelDieselService.updateById(cardFuelDiesel));
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -39,8 +41,10 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
|
||||
//活动时间 1:不限时间 2:自定义时间
|
||||
private String activeTime;
|
||||
//活动开始时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
//活动结束时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
//活动进度
|
||||
private String activityProgress;
|
||||
@ -49,10 +53,12 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
|
@ -4,12 +4,15 @@ package com.fuint.business.marketingActivity.cardGift.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||
import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import com.fuint.utils.ObjectUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -45,7 +48,20 @@ public class CardGiftController extends BaseController {
|
||||
@Param("cardGift") CardGift cardGift) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.orderByDesc(CardGift::getCreateTime);
|
||||
//构建查询条件
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getNumber())){
|
||||
queryWrapper.like(CardGift::getNumber,cardGift.getNumber());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getRemark())){
|
||||
queryWrapper.like(CardGift::getRemark,cardGift.getRemark());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getActivateStatus())) {
|
||||
queryWrapper.eq(CardGift::getActivateStatus,cardGift.getActivateStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getActivateStatus())) {
|
||||
queryWrapper.eq(CardGift::getStatus,cardGift.getStatus());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardGift::getCreateTime);
|
||||
return getSuccessResult(this.cardGiftService.page(page, queryWrapper));
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ package com.fuint.business.marketingActivity.cardGift.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@ -40,8 +42,10 @@ public class CardGift extends Model<CardGift> {
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//更新者
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
|
@ -3,11 +3,9 @@ package com.fuint.business.marketingActivity.cardValue.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
||||
import com.fuint.business.store.entity.MtStore;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
@ -51,6 +49,10 @@ public class CardValueController extends BaseController {
|
||||
@Param("cardValue") CardValue cardValue) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
LambdaQueryWrapper<CardValue> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//构建查询条件
|
||||
if (ObjectUtils.isNotEmpty(cardValue.getIsonline())){
|
||||
queryWrapper.eq(CardValue::getIsonline,cardValue.getIsonline());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardValue::getCreateTime);
|
||||
return getSuccessResult(this.cardValueService.page(page, queryWrapper));
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -24,6 +26,8 @@ public class CardValue extends Model<CardValue> {
|
||||
private Integer storeId;
|
||||
//储值卡状态 1:在用 2:挂失 3:停用
|
||||
private String status;
|
||||
//是否在线 0:在线 1: 下线
|
||||
private String isonline;
|
||||
//储值卡面值
|
||||
private Double bidBalance;
|
||||
//储值卡实际售价
|
||||
@ -53,8 +57,10 @@ public class CardValue extends Model<CardValue> {
|
||||
//活动时间 1:不限时间 2:自定义时间
|
||||
private String activeTime;
|
||||
//活动开始时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
//活动结束时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
//活动状态 1:启用 2:禁用
|
||||
private String activeStatus;
|
||||
@ -69,10 +75,12 @@ public class CardValue extends Model<CardValue> {
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
@ -100,6 +108,14 @@ public class CardValue extends Model<CardValue> {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getIsonline() {
|
||||
return isonline;
|
||||
}
|
||||
|
||||
public void setIsonline(String isonline) {
|
||||
this.isonline = isonline;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -59,10 +61,12 @@ public class CardValueRecord extends Model<CardValueRecord> {
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user