master
袁野 6 months ago
parent 283a9bd5ef
commit 8ab08a6941
  1. 233
      bweb/src/main/java/com/bweb/controller/discount/DiscountPackageController.java
  2. 26
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageMapper.java
  3. 30
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageRecordMapper.java
  4. 20
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageRecordSqlProvider.java
  5. 22
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageSqlProvider.java
  6. 22
      service/src/main/java/com/hfkj/entity/CouponDiscountPackage.java
  7. 68
      service/src/main/java/com/hfkj/entity/CouponDiscountPackageExample.java
  8. 22
      service/src/main/java/com/hfkj/entity/CouponDiscountPackageRecord.java
  9. 90
      service/src/main/java/com/hfkj/entity/CouponDiscountPackageRecordExample.java
  10. 32
      service/src/main/java/com/hfkj/service/discount/CouponDiscountPackageService.java
  11. 111
      service/src/main/java/com/hfkj/service/discount/impl/CouponDiscountPackageServiceImpl.java

@ -0,0 +1,233 @@
package com.bweb.controller.discount;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.discount.CouponDiscountPackageService;
import com.hfkj.service.discount.impl.CouponDiscountServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value="/discountPackage")
@Api(value="优惠券包")
public class DiscountPackageController {
private static final Logger log = LoggerFactory.getLogger(DiscountPackageController.class);
@Resource
private CouponDiscountPackageService couponDiscountPackageService;
@Resource
private UserCenter userCenter;
@Resource
private CouponDiscountServiceImpl couponDiscountService;
@RequestMapping(value = "/getDiscountPackageList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包列表")
public ResponseData getDiscountPackageList(
@RequestParam(name = "title", required = false) String title,
@RequestParam(name = "key", required = false) String key,
@RequestParam(name = "status", required = false) Integer status) {
try {
Map<String,Object> map = new HashMap<>();
map.put("title" , title);
map.put("key" , key);
map.put("status" , status);
return ResponseMsgUtil.success(couponDiscountPackageService.getList(map));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getDiscountPackageRecordList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包记录列表")
public ResponseData getDiscountPackageRecordList(@RequestParam(name = "discountPackageId", required = false) Long discountPackageId) {
try {
Map<String,Object> map = new HashMap<>();
map.put("discountPackageId" , discountPackageId);
return ResponseMsgUtil.success(couponDiscountPackageService.getListRecordByMap(map));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/editCouponPackageInfo", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增优惠券包基本信息")
public ResponseData editCouponPackageInfo(@RequestBody CouponDiscountPackage body, HttpServletRequest request) {
try {
//发布人员
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (StringUtils.isBlank(body.getTitle())
|| body.getEffectiveTime() == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
CouponDiscountPackage discountPackage;
if (body.getId() != null) {
// 查询
discountPackage = couponDiscountPackageService.queryDetail(body.getId());
if (discountPackage == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.CONTENT_NOT_FOUND, "");
}
} else {
discountPackage = new CouponDiscountPackage();
discountPackage.setCreatedUserId(userModel.getAccount().getId().intValue());
discountPackage.setStatus(1);
discountPackage.setTotalStock(0);
discountPackage.setSurplusStock(0);
discountPackage.setCreatedTime(new Date());
}
discountPackage.setUpdatedTime(new Date());
discountPackage.setUpdatedUserId(userModel.getAccount().getId().intValue());
if (body.getId() != null) {
couponDiscountPackageService.update(discountPackage);
} else {
couponDiscountPackageService.create(discountPackage);
}
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("HighAgentController --> insertCouponPackageInfo() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/insertCouponPackageDetail", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增优惠券包详情")
public ResponseData insertCouponPackageDetail(@RequestBody CouponDiscountPackageDetails discountPackageDetails, HttpServletRequest request) {
try {
if ( discountPackageDetails.getDiscountPackageId() == null
|| discountPackageDetails.getDiscountId() == null
|| discountPackageDetails.getNum() == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
CouponDiscount discount = couponDiscountService.queryDetail(discountPackageDetails.getDiscountId().longValue());
if (discount == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券不存在!");
}
discountPackageDetails.setStatus(1);
discountPackageDetails.setDiscountName(discount.getName());
discountPackageDetails.setCreatedTime(new Date());
discountPackageDetails.setUpdatedTime(new Date());
couponDiscountPackageService.createDetail(discountPackageDetails);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("HighAgentController --> insertAgent() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/deleteDetail", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除券包详情")
public ResponseData deleteDetail(@RequestParam(name = "detailId", required = false) Long detailId) {
try {
couponDiscountPackageService.deleteDetail(detailId);
return ResponseMsgUtil.success("删除成功!");
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/delete", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除券包")
public ResponseData delete(@RequestParam(name = "id", required = false) Long id) {
try {
couponDiscountPackageService.delete(id , false);
return ResponseMsgUtil.success("删除成功!");
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/discountPackageAudit",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "券包上下架")
public ResponseData discountPackageAudit(@RequestParam(value = "id" , required = false) Long id) {
try {
CouponDiscountPackage discountPackage = couponDiscountPackageService.queryDetail(id);
if (discountPackage.getStatus() == 1) {
discountPackage.setStatus(2);
discountPackage.setUpdatedTime(new Date());
} else if (discountPackage.getStatus() == 2) {
discountPackage.setStatus(3);
discountPackage.setUpdatedTime(new Date());
}
couponDiscountPackageService.update(discountPackage);
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -34,19 +34,19 @@ public interface CouponDiscountPackageMapper extends CouponDiscountPackageMapper
@Delete({
"delete from coupon_discount_package",
"where id = #{id,jdbcType=INTEGER}"
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Integer id);
int deleteByPrimaryKey(Long id);
@Insert({
"insert into coupon_discount_package (`key`, title, ",
"effective_tiem, created_user_id, ",
"effective_time, created_user_id, ",
"created_time, updated_user_id, ",
"updated_time, `status`, ",
"total_stock, surplus_stock, ",
"ext_1, ext_2, ext_3)",
"values (#{key,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, ",
"#{effectiveTiem,jdbcType=TIMESTAMP}, #{createdUserId,jdbcType=INTEGER}, ",
"#{effectiveTime,jdbcType=TIMESTAMP}, #{createdUserId,jdbcType=INTEGER}, ",
"#{createdTime,jdbcType=TIMESTAMP}, #{updatedUserId,jdbcType=INTEGER}, ",
"#{updatedTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{totalStock,jdbcType=INTEGER}, #{surplusStock,jdbcType=INTEGER}, ",
@ -61,10 +61,10 @@ public interface CouponDiscountPackageMapper extends CouponDiscountPackageMapper
@SelectProvider(type=CouponDiscountPackageSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="key", property="key", jdbcType=JdbcType.VARCHAR),
@Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
@Result(column="effective_tiem", property="effectiveTiem", jdbcType=JdbcType.TIMESTAMP),
@Result(column="effective_time", property="effectiveTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="created_user_id", property="createdUserId", jdbcType=JdbcType.INTEGER),
@Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="updated_user_id", property="updatedUserId", jdbcType=JdbcType.INTEGER),
@ -80,16 +80,16 @@ public interface CouponDiscountPackageMapper extends CouponDiscountPackageMapper
@Select({
"select",
"id, `key`, title, effective_tiem, created_user_id, created_time, updated_user_id, ",
"id, `key`, title, effective_time, created_user_id, created_time, updated_user_id, ",
"updated_time, `status`, total_stock, surplus_stock, ext_1, ext_2, ext_3",
"from coupon_discount_package",
"where id = #{id,jdbcType=INTEGER}"
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="key", property="key", jdbcType=JdbcType.VARCHAR),
@Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
@Result(column="effective_tiem", property="effectiveTiem", jdbcType=JdbcType.TIMESTAMP),
@Result(column="effective_time", property="effectiveTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="created_user_id", property="createdUserId", jdbcType=JdbcType.INTEGER),
@Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="updated_user_id", property="updatedUserId", jdbcType=JdbcType.INTEGER),
@ -101,7 +101,7 @@ public interface CouponDiscountPackageMapper extends CouponDiscountPackageMapper
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
CouponDiscountPackage selectByPrimaryKey(Integer id);
CouponDiscountPackage selectByPrimaryKey(Long id);
@UpdateProvider(type=CouponDiscountPackageSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") CouponDiscountPackage record, @Param("example") CouponDiscountPackageExample example);
@ -116,7 +116,7 @@ public interface CouponDiscountPackageMapper extends CouponDiscountPackageMapper
"update coupon_discount_package",
"set `key` = #{key,jdbcType=VARCHAR},",
"title = #{title,jdbcType=VARCHAR},",
"effective_tiem = #{effectiveTiem,jdbcType=TIMESTAMP},",
"effective_time = #{effectiveTime,jdbcType=TIMESTAMP},",
"created_user_id = #{createdUserId,jdbcType=INTEGER},",
"created_time = #{createdTime,jdbcType=TIMESTAMP},",
"updated_user_id = #{updatedUserId,jdbcType=INTEGER},",
@ -127,7 +127,7 @@ public interface CouponDiscountPackageMapper extends CouponDiscountPackageMapper
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=INTEGER}"
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(CouponDiscountPackage record);
}

@ -34,21 +34,21 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@Delete({
"delete from coupon_discount_package_record",
"where id = #{id,jdbcType=INTEGER}"
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Integer id);
int deleteByPrimaryKey(Long id);
@Insert({
"insert into coupon_discount_package_record (discount_package_title, discount_package_id, ",
"order_id, child_order_id, ",
"record_no, serial_no, ",
"`type`, user_id, user_phone, ",
"serial_no, `type`, ",
"user_id, user_phone, ",
"created_time, `status`, ",
"ext_1, ext_2, ext_3)",
"values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=INTEGER}, ",
"#{orderId,jdbcType=INTEGER}, #{childOrderId,jdbcType=INTEGER}, ",
"#{recordNo,jdbcType=VARCHAR}, #{serialNo,jdbcType=VARCHAR}, ",
"#{type,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{userPhone,jdbcType=VARCHAR}, ",
"#{serialNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, ",
"#{userId,jdbcType=INTEGER}, #{userPhone,jdbcType=VARCHAR}, ",
"#{createdTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@ -61,12 +61,11 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@SelectProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER),
@Result(column="record_no", property="recordNo", jdbcType=JdbcType.VARCHAR),
@Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER),
@ -81,19 +80,17 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@Select({
"select",
"id, discount_package_title, discount_package_id, order_id, child_order_id, record_no, ",
"serial_no, `type`, user_id, user_phone, created_time, `status`, ext_1, ext_2, ",
"ext_3",
"id, discount_package_title, discount_package_id, order_id, child_order_id, serial_no, ",
"`type`, user_id, user_phone, created_time, `status`, ext_1, ext_2, ext_3",
"from coupon_discount_package_record",
"where id = #{id,jdbcType=INTEGER}"
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER),
@Result(column="record_no", property="recordNo", jdbcType=JdbcType.VARCHAR),
@Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER),
@ -104,7 +101,7 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
CouponDiscountPackageRecord selectByPrimaryKey(Integer id);
CouponDiscountPackageRecord selectByPrimaryKey(Long id);
@UpdateProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") CouponDiscountPackageRecord record, @Param("example") CouponDiscountPackageRecordExample example);
@ -121,7 +118,6 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
"discount_package_id = #{discountPackageId,jdbcType=INTEGER},",
"order_id = #{orderId,jdbcType=INTEGER},",
"child_order_id = #{childOrderId,jdbcType=INTEGER},",
"record_no = #{recordNo,jdbcType=VARCHAR},",
"serial_no = #{serialNo,jdbcType=VARCHAR},",
"`type` = #{type,jdbcType=INTEGER},",
"user_id = #{userId,jdbcType=INTEGER},",
@ -131,7 +127,7 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=INTEGER}"
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(CouponDiscountPackageRecord record);
}

@ -44,10 +44,6 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.VALUES("child_order_id", "#{childOrderId,jdbcType=INTEGER}");
}
if (record.getRecordNo() != null) {
sql.VALUES("record_no", "#{recordNo,jdbcType=VARCHAR}");
}
if (record.getSerialNo() != null) {
sql.VALUES("serial_no", "#{serialNo,jdbcType=VARCHAR}");
}
@ -98,7 +94,6 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SELECT("discount_package_id");
sql.SELECT("order_id");
sql.SELECT("child_order_id");
sql.SELECT("record_no");
sql.SELECT("serial_no");
sql.SELECT("`type`");
sql.SELECT("user_id");
@ -126,7 +121,7 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.UPDATE("coupon_discount_package_record");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=INTEGER}");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getDiscountPackageTitle() != null) {
@ -145,10 +140,6 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SET("child_order_id = #{record.childOrderId,jdbcType=INTEGER}");
}
if (record.getRecordNo() != null) {
sql.SET("record_no = #{record.recordNo,jdbcType=VARCHAR}");
}
if (record.getSerialNo() != null) {
sql.SET("serial_no = #{record.serialNo,jdbcType=VARCHAR}");
}
@ -193,12 +184,11 @@ public class CouponDiscountPackageRecordSqlProvider {
SQL sql = new SQL();
sql.UPDATE("coupon_discount_package_record");
sql.SET("id = #{record.id,jdbcType=INTEGER}");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=INTEGER}");
sql.SET("order_id = #{record.orderId,jdbcType=INTEGER}");
sql.SET("child_order_id = #{record.childOrderId,jdbcType=INTEGER}");
sql.SET("record_no = #{record.recordNo,jdbcType=VARCHAR}");
sql.SET("serial_no = #{record.serialNo,jdbcType=VARCHAR}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("user_id = #{record.userId,jdbcType=INTEGER}");
@ -234,10 +224,6 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SET("child_order_id = #{childOrderId,jdbcType=INTEGER}");
}
if (record.getRecordNo() != null) {
sql.SET("record_no = #{recordNo,jdbcType=VARCHAR}");
}
if (record.getSerialNo() != null) {
sql.SET("serial_no = #{serialNo,jdbcType=VARCHAR}");
}
@ -274,7 +260,7 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=INTEGER}");
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}

@ -36,8 +36,8 @@ public class CouponDiscountPackageSqlProvider {
sql.VALUES("title", "#{title,jdbcType=VARCHAR}");
}
if (record.getEffectiveTiem() != null) {
sql.VALUES("effective_tiem", "#{effectiveTiem,jdbcType=TIMESTAMP}");
if (record.getEffectiveTime() != null) {
sql.VALUES("effective_time", "#{effectiveTime,jdbcType=TIMESTAMP}");
}
if (record.getCreatedUserId() != null) {
@ -92,7 +92,7 @@ public class CouponDiscountPackageSqlProvider {
}
sql.SELECT("`key`");
sql.SELECT("title");
sql.SELECT("effective_tiem");
sql.SELECT("effective_time");
sql.SELECT("created_user_id");
sql.SELECT("created_time");
sql.SELECT("updated_user_id");
@ -121,7 +121,7 @@ public class CouponDiscountPackageSqlProvider {
sql.UPDATE("coupon_discount_package");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=INTEGER}");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getKey() != null) {
@ -132,8 +132,8 @@ public class CouponDiscountPackageSqlProvider {
sql.SET("title = #{record.title,jdbcType=VARCHAR}");
}
if (record.getEffectiveTiem() != null) {
sql.SET("effective_tiem = #{record.effectiveTiem,jdbcType=TIMESTAMP}");
if (record.getEffectiveTime() != null) {
sql.SET("effective_time = #{record.effectiveTime,jdbcType=TIMESTAMP}");
}
if (record.getCreatedUserId() != null) {
@ -184,10 +184,10 @@ public class CouponDiscountPackageSqlProvider {
SQL sql = new SQL();
sql.UPDATE("coupon_discount_package");
sql.SET("id = #{record.id,jdbcType=INTEGER}");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("`key` = #{record.key,jdbcType=VARCHAR}");
sql.SET("title = #{record.title,jdbcType=VARCHAR}");
sql.SET("effective_tiem = #{record.effectiveTiem,jdbcType=TIMESTAMP}");
sql.SET("effective_time = #{record.effectiveTime,jdbcType=TIMESTAMP}");
sql.SET("created_user_id = #{record.createdUserId,jdbcType=INTEGER}");
sql.SET("created_time = #{record.createdTime,jdbcType=TIMESTAMP}");
sql.SET("updated_user_id = #{record.updatedUserId,jdbcType=INTEGER}");
@ -216,8 +216,8 @@ public class CouponDiscountPackageSqlProvider {
sql.SET("title = #{title,jdbcType=VARCHAR}");
}
if (record.getEffectiveTiem() != null) {
sql.SET("effective_tiem = #{effectiveTiem,jdbcType=TIMESTAMP}");
if (record.getEffectiveTime() != null) {
sql.SET("effective_time = #{effectiveTime,jdbcType=TIMESTAMP}");
}
if (record.getCreatedUserId() != null) {
@ -260,7 +260,7 @@ public class CouponDiscountPackageSqlProvider {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=INTEGER}");
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}

@ -16,7 +16,7 @@ public class CouponDiscountPackage implements Serializable {
/**
* 主键
*/
private Integer id;
private Long id;
/**
* 编码
@ -31,7 +31,7 @@ public class CouponDiscountPackage implements Serializable {
/**
* 有效期
*/
private Date effectiveTiem;
private Date effectiveTime;
/**
* 创建人
@ -85,11 +85,11 @@ public class CouponDiscountPackage implements Serializable {
private static final long serialVersionUID = 1L;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
@ -109,12 +109,12 @@ public class CouponDiscountPackage implements Serializable {
this.title = title;
}
public Date getEffectiveTiem() {
return effectiveTiem;
public Date getEffectiveTime() {
return effectiveTime;
}
public void setEffectiveTiem(Date effectiveTiem) {
this.effectiveTiem = effectiveTiem;
public void setEffectiveTime(Date effectiveTime) {
this.effectiveTime = effectiveTime;
}
public Integer getCreatedUserId() {
@ -212,7 +212,7 @@ public class CouponDiscountPackage implements Serializable {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getKey() == null ? other.getKey() == null : this.getKey().equals(other.getKey()))
&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
&& (this.getEffectiveTiem() == null ? other.getEffectiveTiem() == null : this.getEffectiveTiem().equals(other.getEffectiveTiem()))
&& (this.getEffectiveTime() == null ? other.getEffectiveTime() == null : this.getEffectiveTime().equals(other.getEffectiveTime()))
&& (this.getCreatedUserId() == null ? other.getCreatedUserId() == null : this.getCreatedUserId().equals(other.getCreatedUserId()))
&& (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime()))
&& (this.getUpdatedUserId() == null ? other.getUpdatedUserId() == null : this.getUpdatedUserId().equals(other.getUpdatedUserId()))
@ -232,7 +232,7 @@ public class CouponDiscountPackage implements Serializable {
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getKey() == null) ? 0 : getKey().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getEffectiveTiem() == null) ? 0 : getEffectiveTiem().hashCode());
result = prime * result + ((getEffectiveTime() == null) ? 0 : getEffectiveTime().hashCode());
result = prime * result + ((getCreatedUserId() == null) ? 0 : getCreatedUserId().hashCode());
result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
result = prime * result + ((getUpdatedUserId() == null) ? 0 : getUpdatedUserId().hashCode());
@ -255,7 +255,7 @@ public class CouponDiscountPackage implements Serializable {
sb.append(", id=").append(id);
sb.append(", key=").append(key);
sb.append(", title=").append(title);
sb.append(", effectiveTiem=").append(effectiveTiem);
sb.append(", effectiveTime=").append(effectiveTime);
sb.append(", createdUserId=").append(createdUserId);
sb.append(", createdTime=").append(createdTime);
sb.append(", updatedUserId=").append(updatedUserId);

@ -135,52 +135,52 @@ public class CouponDiscountPackageExample {
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
@ -325,63 +325,63 @@ public class CouponDiscountPackageExample {
return (Criteria) this;
}
public Criteria andEffectiveTiemIsNull() {
addCriterion("effective_tiem is null");
public Criteria andEffectiveTimeIsNull() {
addCriterion("effective_time is null");
return (Criteria) this;
}
public Criteria andEffectiveTiemIsNotNull() {
addCriterion("effective_tiem is not null");
public Criteria andEffectiveTimeIsNotNull() {
addCriterion("effective_time is not null");
return (Criteria) this;
}
public Criteria andEffectiveTiemEqualTo(Date value) {
addCriterion("effective_tiem =", value, "effectiveTiem");
public Criteria andEffectiveTimeEqualTo(Date value) {
addCriterion("effective_time =", value, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemNotEqualTo(Date value) {
addCriterion("effective_tiem <>", value, "effectiveTiem");
public Criteria andEffectiveTimeNotEqualTo(Date value) {
addCriterion("effective_time <>", value, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemGreaterThan(Date value) {
addCriterion("effective_tiem >", value, "effectiveTiem");
public Criteria andEffectiveTimeGreaterThan(Date value) {
addCriterion("effective_time >", value, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemGreaterThanOrEqualTo(Date value) {
addCriterion("effective_tiem >=", value, "effectiveTiem");
public Criteria andEffectiveTimeGreaterThanOrEqualTo(Date value) {
addCriterion("effective_time >=", value, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemLessThan(Date value) {
addCriterion("effective_tiem <", value, "effectiveTiem");
public Criteria andEffectiveTimeLessThan(Date value) {
addCriterion("effective_time <", value, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemLessThanOrEqualTo(Date value) {
addCriterion("effective_tiem <=", value, "effectiveTiem");
public Criteria andEffectiveTimeLessThanOrEqualTo(Date value) {
addCriterion("effective_time <=", value, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemIn(List<Date> values) {
addCriterion("effective_tiem in", values, "effectiveTiem");
public Criteria andEffectiveTimeIn(List<Date> values) {
addCriterion("effective_time in", values, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemNotIn(List<Date> values) {
addCriterion("effective_tiem not in", values, "effectiveTiem");
public Criteria andEffectiveTimeNotIn(List<Date> values) {
addCriterion("effective_time not in", values, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemBetween(Date value1, Date value2) {
addCriterion("effective_tiem between", value1, value2, "effectiveTiem");
public Criteria andEffectiveTimeBetween(Date value1, Date value2) {
addCriterion("effective_time between", value1, value2, "effectiveTime");
return (Criteria) this;
}
public Criteria andEffectiveTiemNotBetween(Date value1, Date value2) {
addCriterion("effective_tiem not between", value1, value2, "effectiveTiem");
public Criteria andEffectiveTimeNotBetween(Date value1, Date value2) {
addCriterion("effective_time not between", value1, value2, "effectiveTime");
return (Criteria) this;
}

@ -16,7 +16,7 @@ public class CouponDiscountPackageRecord implements Serializable {
/**
* 主键
*/
private Integer id;
private Long id;
/**
* 优惠券包名称
@ -38,11 +38,6 @@ public class CouponDiscountPackageRecord implements Serializable {
*/
private Integer childOrderId;
/**
* 记录订单
*/
private String recordNo;
/**
* 记录序号
*/
@ -90,11 +85,11 @@ public class CouponDiscountPackageRecord implements Serializable {
private static final long serialVersionUID = 1L;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
@ -130,14 +125,6 @@ public class CouponDiscountPackageRecord implements Serializable {
this.childOrderId = childOrderId;
}
public String getRecordNo() {
return recordNo;
}
public void setRecordNo(String recordNo) {
this.recordNo = recordNo;
}
public String getSerialNo() {
return serialNo;
}
@ -227,7 +214,6 @@ public class CouponDiscountPackageRecord implements Serializable {
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId()))
&& (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
&& (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId()))
&& (this.getRecordNo() == null ? other.getRecordNo() == null : this.getRecordNo().equals(other.getRecordNo()))
&& (this.getSerialNo() == null ? other.getSerialNo() == null : this.getSerialNo().equals(other.getSerialNo()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
@ -248,7 +234,6 @@ public class CouponDiscountPackageRecord implements Serializable {
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode());
result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().hashCode());
result = prime * result + ((getRecordNo() == null) ? 0 : getRecordNo().hashCode());
result = prime * result + ((getSerialNo() == null) ? 0 : getSerialNo().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
@ -272,7 +257,6 @@ public class CouponDiscountPackageRecord implements Serializable {
sb.append(", discountPackageId=").append(discountPackageId);
sb.append(", orderId=").append(orderId);
sb.append(", childOrderId=").append(childOrderId);
sb.append(", recordNo=").append(recordNo);
sb.append(", serialNo=").append(serialNo);
sb.append(", type=").append(type);
sb.append(", userId=").append(userId);

@ -135,52 +135,52 @@ public class CouponDiscountPackageRecordExample {
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
@ -435,76 +435,6 @@ public class CouponDiscountPackageRecordExample {
return (Criteria) this;
}
public Criteria andRecordNoIsNull() {
addCriterion("record_no is null");
return (Criteria) this;
}
public Criteria andRecordNoIsNotNull() {
addCriterion("record_no is not null");
return (Criteria) this;
}
public Criteria andRecordNoEqualTo(String value) {
addCriterion("record_no =", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoNotEqualTo(String value) {
addCriterion("record_no <>", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoGreaterThan(String value) {
addCriterion("record_no >", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoGreaterThanOrEqualTo(String value) {
addCriterion("record_no >=", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoLessThan(String value) {
addCriterion("record_no <", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoLessThanOrEqualTo(String value) {
addCriterion("record_no <=", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoLike(String value) {
addCriterion("record_no like", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoNotLike(String value) {
addCriterion("record_no not like", value, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoIn(List<String> values) {
addCriterion("record_no in", values, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoNotIn(List<String> values) {
addCriterion("record_no not in", values, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoBetween(String value1, String value2) {
addCriterion("record_no between", value1, value2, "recordNo");
return (Criteria) this;
}
public Criteria andRecordNoNotBetween(String value1, String value2) {
addCriterion("record_no not between", value1, value2, "recordNo");
return (Criteria) this;
}
public Criteria andSerialNoIsNull() {
addCriterion("serial_no is null");
return (Criteria) this;

@ -2,6 +2,8 @@ package com.hfkj.service.discount;
import com.hfkj.entity.CouponDiscount;
import com.hfkj.entity.CouponDiscountPackage;
import com.hfkj.entity.CouponDiscountPackageDetails;
import com.hfkj.entity.CouponDiscountPackageRecord;
import java.util.List;
import java.util.Map;
@ -68,4 +70,34 @@ public interface CouponDiscountPackageService {
*/
List<CouponDiscountPackage> getList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name getListRecordByMap
* @Description // 根据多条件查询列表
* @Date 15:13 2024/4/19
* @Param map
* @return java.util.List<com.hfkj.entity.CouponDiscountPackageRecord>
*/
List<CouponDiscountPackageRecord> getListRecordByMap(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name create
* @Description // 创建
* @Date 15:11 2024/4/19
* @Param CouponDiscount
* @return void
*/
void createDetail(CouponDiscountPackageDetails discountPackageDetails);
/**
* @Author Sum1Dream
* @Name delete
* @Description // 修改
* @Date 15:12 2024/4/19
* @Param id
* @return void
*/
void deleteDetail(Long id);
}

@ -0,0 +1,111 @@
package com.hfkj.service.discount.impl;
import com.hfkj.dao.CouponDiscountPackageDetailsMapper;
import com.hfkj.dao.CouponDiscountPackageMapper;
import com.hfkj.dao.CouponDiscountPackageRecordMapper;
import com.hfkj.entity.*;
import com.hfkj.service.discount.CouponDiscountPackageService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("couponDiscountPackageService")
public class CouponDiscountPackageServiceImpl implements CouponDiscountPackageService {
@Resource
private CouponDiscountPackageMapper couponDiscountPackageMapper;
@Resource
private CouponDiscountPackageRecordMapper couponDiscountPackageRecordMapper;
@Resource
private CouponDiscountPackageDetailsMapper couponDiscountPackageDetailsMapper;
@Override
public void create(CouponDiscountPackage discountPackage) {
couponDiscountPackageMapper.insert(discountPackage);
}
@Override
public void update(CouponDiscountPackage discountPackage) {
couponDiscountPackageMapper.updateByPrimaryKeySelective(discountPackage);
}
@Override
public void delete(Long id, Boolean fullDelete) {
if (fullDelete) {
couponDiscountPackageMapper.deleteByPrimaryKey(id);
} else {
CouponDiscountPackage discountPackage = queryDetail(id);
discountPackage.setStatus(0);
discountPackage.setUpdatedTime(new Date());
update(discountPackage);
}
}
@Override
public CouponDiscountPackage queryDetail(Long id) {
return null;
}
@Override
public CouponDiscountPackage queryDetailByMap(Map<String, Object> map) {
return null;
}
@Override
public List<CouponDiscountPackage> getList(Map<String, Object> map) {
CouponDiscountPackageExample example = new CouponDiscountPackageExample();
CouponDiscountPackageExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(MapUtils.getString(map, "title"))) {
criteria.andTitleLike("%"+MapUtils.getString(map, "title")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "key"))) {
criteria.andKeyEqualTo(MapUtils.getString(map, "key"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
} else {
criteria.andStatusNotEqualTo(0);
}
return couponDiscountPackageMapper.selectByExample(example);
}
@Override
public List<CouponDiscountPackageRecord> getListRecordByMap(Map<String, Object> map) {
CouponDiscountPackageRecordExample example = new CouponDiscountPackageRecordExample();
CouponDiscountPackageRecordExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "discountPackageId") != null) {
criteria.andDiscountPackageIdEqualTo(MapUtils.getInteger(map, "discountPackageId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
} else {
criteria.andStatusNotEqualTo(0);
}
return couponDiscountPackageRecordMapper.selectByExample(example);
}
@Override
public void createDetail(CouponDiscountPackageDetails discountPackageDetails) {
couponDiscountPackageDetailsMapper.insert(discountPackageDetails);
}
@Override
public void deleteDetail(Long id) {
CouponDiscountPackageDetails discountPackageDetails = new CouponDiscountPackageDetails();
}
}
Loading…
Cancel
Save