parent
58aa47a77f
commit
7458b9f070
@ -0,0 +1,227 @@ |
||||
package com.bweb.controller.discount; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
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.CouponDiscount; |
||||
import com.hfkj.entity.CouponDiscountGoodsRel; |
||||
import com.hfkj.entity.GoodsMsg; |
||||
import com.hfkj.entity.GoodsSpecs; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.SecUserSessionObject; |
||||
import com.hfkj.model.discount.DiscountGoodsModel; |
||||
import com.hfkj.service.discount.CouponDiscountService; |
||||
import com.hfkj.service.goods.impl.GoodsMsgServiceImpl; |
||||
import com.hfkj.service.goods.impl.GoodsSpecsServiceImpl; |
||||
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.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.*; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/discount") |
||||
@Api(value="优惠券") |
||||
public class DiscountController { |
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DiscountController.class); |
||||
|
||||
@Resource |
||||
private CouponDiscountService couponDiscountService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
@Autowired |
||||
private GoodsMsgServiceImpl goodsMsgService; |
||||
@Autowired |
||||
private GoodsSpecsServiceImpl goodsSpecsService; |
||||
|
||||
@RequestMapping(value="/editDiscount",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑商品品牌") |
||||
public ResponseData editDiscount(@RequestBody CouponDiscount body, HttpServletRequest request) { |
||||
|
||||
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); |
||||
|
||||
if (body == null |
||||
|| body.getImg() == null |
||||
|| body.getType() == null |
||||
|| body.getEffectiveNum() == null |
||||
|| body.getEffectiveDay() == null |
||||
|| body.getSalesEndTime() == null |
||||
|| StringUtils.isBlank(body.getName())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
if (body.getType() == 1 ){ |
||||
if ( body.getCondition() == null || body.getPrice() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
} |
||||
if (body.getType() == 2 ){ |
||||
if (body.getPrice() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
} |
||||
if (body.getType() == 3){ |
||||
if ( body.getPercentage() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
} |
||||
|
||||
CouponDiscount couponDiscount; |
||||
|
||||
if (body.getId() != null) { |
||||
// 查询品牌
|
||||
couponDiscount = couponDiscountService.queryDetail(body.getId()); |
||||
if (couponDiscount == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.CONTENT_NOT_FOUND, ""); |
||||
} |
||||
} else { |
||||
couponDiscount = new CouponDiscount(); |
||||
couponDiscount.setCreateTime(new Date()); |
||||
couponDiscount.setLimitNum(0); |
||||
} |
||||
|
||||
couponDiscount.setUpdateTime(new Date()); |
||||
couponDiscount.setStatus(1); |
||||
couponDiscount.setType(body.getType()); |
||||
couponDiscount.setEffectiveNum(body.getEffectiveNum()); |
||||
couponDiscount.setName(body.getName()); |
||||
couponDiscount.setPercentage(body.getPercentage()); |
||||
couponDiscount.setPrice(body.getPrice()); |
||||
couponDiscount.setCondition(body.getCondition()); |
||||
couponDiscount.setSalesEndTime(body.getSalesEndTime()); |
||||
couponDiscount.setEffectiveDay(body.getEffectiveDay()); |
||||
couponDiscount.setImg(body.getImg()); |
||||
couponDiscount.setOpId(userModel.getAccount().getId()); |
||||
couponDiscount.setOpName(userModel.getAccount().getUserName()); |
||||
|
||||
if (body.getId() != null) { |
||||
couponDiscountService.update(couponDiscount); |
||||
} else { |
||||
couponDiscountService.create(couponDiscount); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
} |
||||
|
||||
|
||||
@RequestMapping(value="/getListDiscount",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData getListDiscount(@RequestParam(value = "name" , required = false) String name, |
||||
@RequestParam(value = "type" , required = false) Integer type, |
||||
@RequestParam(value = "status" , required = false) Integer status, |
||||
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||
try { |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("name", name); |
||||
map.put("type", type); |
||||
map.put("status", status); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(couponDiscountService.getList(map))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/delete",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除") |
||||
public ResponseData delete(@RequestParam(value = "id" , required = false) Long id) { |
||||
try { |
||||
|
||||
couponDiscountService.delete(id , false); |
||||
|
||||
return ResponseMsgUtil.success("删除成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getListDiscountGoodsRel",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData getListDiscountGoodsRel(@RequestParam(value = "discountId" , required = false) Long discountId) { |
||||
try { |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("discountId", discountId); |
||||
|
||||
List<CouponDiscountGoodsRel> list = couponDiscountService.getListGoodsRel(map); |
||||
|
||||
List<DiscountGoodsModel> discountGoodsModelList = new ArrayList<>(); |
||||
|
||||
|
||||
for (CouponDiscountGoodsRel goodsRel : list) { |
||||
DiscountGoodsModel discountGoodsModel = new DiscountGoodsModel(); |
||||
GoodsSpecs goodsSpecs = goodsSpecsService.queryDetail(goodsRel.getSpecsId()); |
||||
GoodsMsg goodsMsg = goodsMsgService.queryDetail(goodsSpecs.getGoodsId()); |
||||
|
||||
BeanUtils.copyProperties(goodsRel, discountGoodsModel); |
||||
discountGoodsModel.setSalePrice(goodsSpecs.getSalePrice()); |
||||
discountGoodsModel.setGoodsName(goodsMsg.getTitle()); |
||||
discountGoodsModel.setSpecsName(goodsSpecs.getName()); |
||||
discountGoodsModelList.add(discountGoodsModel); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success(discountGoodsModelList); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/bindDiscountSpecs",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "绑定优惠券规格") |
||||
public ResponseData bindDiscountSpecs(@RequestBody JSONObject body) { |
||||
|
||||
if (body == null |
||||
|| body.getLong("discountId") == null |
||||
|| StringUtils.isBlank(body.getString("specsIds"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
couponDiscountService.deleteDiscountGoodsRelDiscountId(body.getLong("discountId")); |
||||
|
||||
String[] specsIds = body.getString("specsIds").split(","); |
||||
|
||||
for (String specsId : specsIds) { |
||||
CouponDiscountGoodsRel goodsRel = new CouponDiscountGoodsRel(); |
||||
goodsRel.setDiscountId(body.getLong("discountId")); |
||||
goodsRel.setSpecsId(Long.valueOf(specsId)); |
||||
goodsRel.setCreateTime(new Date()); |
||||
goodsRel.setStatus(1); |
||||
|
||||
couponDiscountService.createGoodsRel(goodsRel); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,211 @@ |
||||
package com.cweb.controller.goods; |
||||
|
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
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.PageUtil; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.entity.GoodsMsg; |
||||
import com.hfkj.entity.GoodsSpecs; |
||||
import com.hfkj.entity.GoodsType; |
||||
import com.hfkj.entity.GoodsVpd; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.SecUserSessionObject; |
||||
import com.hfkj.model.goods.GoodsModel; |
||||
import com.hfkj.model.goods.GoodsModelSpecs; |
||||
import com.hfkj.model.goods.GoodsTypeModel; |
||||
import com.hfkj.service.goods.*; |
||||
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
||||
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.beans.BeanUtils; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.math.BigDecimal; |
||||
import java.util.*; |
||||
import java.util.stream.Collectors; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/goods") |
||||
@Api(value="商品信息") |
||||
public class GoodsController { |
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GoodsController.class); |
||||
|
||||
@Resource |
||||
private GoodsTypeService goodsTypeService; |
||||
|
||||
@Resource |
||||
private GoodsBrandService goodsBrandService; |
||||
|
||||
@Resource |
||||
private GoodsMsgService goodsMsgService; |
||||
|
||||
@Resource |
||||
private GoodsSpecsService goodsSpecsService; |
||||
|
||||
@Resource |
||||
private GoodsVpdService goodsVpdService; |
||||
|
||||
|
||||
@RequestMapping(value="/getListGoodsType",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询商品分类列表") |
||||
public ResponseData getListGoodsType() { |
||||
try { |
||||
|
||||
List<GoodsType> list = goodsTypeService.getList(new HashMap<>()); |
||||
|
||||
List<GoodsTypeModel> goodsTypeModels = goodsTypeService.getGoodsTypeModelList(list); |
||||
|
||||
return ResponseMsgUtil.success(goodsTypeModels); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getListBrand",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询品牌列表") |
||||
public ResponseData getListBrand(@RequestParam(value = "title" , required = false) String title) { |
||||
try { |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("title", title); |
||||
|
||||
return ResponseMsgUtil.success(goodsBrandService.getList(map)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getListGoods", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询商品列表") |
||||
public ResponseData getListGoods( |
||||
@RequestParam(value = "title", required = false) String title, |
||||
@RequestParam(value = "goodsType", required = false) Long goodsType, |
||||
@RequestParam(value = "goodsBrand", required = false) Long goodsBrand, |
||||
@RequestParam(value = "price", required = false) Integer price, |
||||
@RequestParam(value = "saleNum", required = false) Integer saleNum, |
||||
@RequestParam(value = "time", required = false) Integer time, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize |
||||
) { |
||||
try { |
||||
|
||||
|
||||
Map<String, Object> map = new HashMap<>(); |
||||
|
||||
map.put("title", title); |
||||
map.put("goodsType", goodsType); |
||||
map.put("goodsBrand", goodsBrand); |
||||
map.put("saleNum", saleNum); |
||||
map.put("time", time); |
||||
map.put("status", 1); |
||||
|
||||
List<GoodsMsg> list = goodsMsgService.getList(map); |
||||
|
||||
List<GoodsModel> goodsModels = new ArrayList<>(); |
||||
|
||||
for (GoodsMsg goodsMsg : list) { |
||||
|
||||
GoodsModel goodsModel = new GoodsModel(); |
||||
|
||||
Map<String , Object> mapSpecs = new HashMap<>(); |
||||
mapSpecs.put("goodsId" , goodsMsg.getId()); |
||||
|
||||
List<GoodsSpecs> goodsSpecs = goodsSpecsService.getList(mapSpecs); |
||||
if (!goodsSpecs.isEmpty()) { |
||||
BigDecimal minPrice = goodsSpecs.get(0).getSalePrice(); |
||||
BigDecimal minOriginalPrice = goodsSpecs.get(0).getOriginalPrice(); |
||||
|
||||
for (GoodsSpecs specs : goodsSpecs) { |
||||
if (specs.getSalePrice().compareTo(minPrice) < 0) { |
||||
minPrice = specs.getSalePrice(); |
||||
minOriginalPrice = specs.getOriginalPrice(); |
||||
} |
||||
} |
||||
BeanUtils.copyProperties(goodsMsg, goodsModel); |
||||
goodsModel.setOriginalPrice(minOriginalPrice); |
||||
goodsModel.setPrice(minPrice); |
||||
|
||||
goodsModels.add(goodsModel); |
||||
|
||||
} |
||||
} |
||||
|
||||
if (price != null) { |
||||
if (price == 1) { |
||||
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice)).collect(Collectors.toList()); |
||||
} |
||||
if (price == 2) { |
||||
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice).reversed()).collect(Collectors.toList()); |
||||
} |
||||
} |
||||
|
||||
|
||||
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsModels.size(), pageSize, new PageInfo<>(goodsModels))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("GoodsDetailController --> getListUser() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
@RequestMapping(value="/getGoodsDetail",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询商品详情") |
||||
public ResponseData getGoodsDetail(@RequestParam(value = "id" , required = false) Long id) { |
||||
try { |
||||
|
||||
GoodsMsg goodsMsg = goodsMsgService.queryDetail(id); |
||||
|
||||
GoodsModel goodsModel = new GoodsModel(); |
||||
|
||||
BeanUtils.copyProperties(goodsMsg, goodsModel); |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("goodsId" , id); |
||||
|
||||
List<GoodsSpecs> goodsSpecs = goodsSpecsService.getList(map); |
||||
|
||||
List<GoodsModelSpecs> goodsModelSpecs = new ArrayList<>(); |
||||
|
||||
for (GoodsSpecs goodsSpec : goodsSpecs) { |
||||
GoodsModelSpecs goodsModelSpec = new GoodsModelSpecs(); |
||||
BeanUtils.copyProperties(goodsSpec, goodsModelSpec); |
||||
GoodsVpd goodsVpd = goodsVpdService.queryDetailBySpecsId(goodsSpec.getId()); |
||||
if (goodsVpd != null) { |
||||
BeanUtils.copyProperties(goodsVpd, goodsModelSpec); |
||||
} |
||||
goodsModelSpec.setSpecsId(goodsSpec.getId()); |
||||
goodsModelSpecs.add(goodsModelSpec); |
||||
} |
||||
|
||||
goodsModel.setGoodsModelSpecs(goodsModelSpecs); |
||||
|
||||
return ResponseMsgUtil.success(goodsModel); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,108 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.CouponDiscountGoodsRel; |
||||
import com.hfkj.entity.CouponDiscountGoodsRelExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface CouponDiscountGoodsRelMapper extends CouponDiscountGoodsRelMapperExt { |
||||
@SelectProvider(type=CouponDiscountGoodsRelSqlProvider.class, method="countByExample") |
||||
long countByExample(CouponDiscountGoodsRelExample example); |
||||
|
||||
@DeleteProvider(type=CouponDiscountGoodsRelSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(CouponDiscountGoodsRelExample example); |
||||
|
||||
@Delete({ |
||||
"delete from coupon_discount_goods_rel", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into coupon_discount_goods_rel (discount_id, create_time, ", |
||||
"specs_id, `status`, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values (#{discountId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, ", |
||||
"#{specsId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(CouponDiscountGoodsRel record); |
||||
|
||||
@InsertProvider(type=CouponDiscountGoodsRelSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(CouponDiscountGoodsRel record); |
||||
|
||||
@SelectProvider(type=CouponDiscountGoodsRelSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_id", property="discountId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="specs_id", property="specsId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<CouponDiscountGoodsRel> selectByExample(CouponDiscountGoodsRelExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, discount_id, create_time, specs_id, `status`, ext_1, ext_2, ext_3", |
||||
"from coupon_discount_goods_rel", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_id", property="discountId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="specs_id", property="specsId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
CouponDiscountGoodsRel selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=CouponDiscountGoodsRelSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") CouponDiscountGoodsRel record, @Param("example") CouponDiscountGoodsRelExample example); |
||||
|
||||
@UpdateProvider(type=CouponDiscountGoodsRelSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") CouponDiscountGoodsRel record, @Param("example") CouponDiscountGoodsRelExample example); |
||||
|
||||
@UpdateProvider(type=CouponDiscountGoodsRelSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(CouponDiscountGoodsRel record); |
||||
|
||||
@Update({ |
||||
"update coupon_discount_goods_rel", |
||||
"set discount_id = #{discountId,jdbcType=BIGINT},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"specs_id = #{specsId,jdbcType=BIGINT},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(CouponDiscountGoodsRel record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface CouponDiscountGoodsRelMapperExt { |
||||
} |
@ -0,0 +1,276 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.CouponDiscountGoodsRel; |
||||
import com.hfkj.entity.CouponDiscountGoodsRelExample.Criteria; |
||||
import com.hfkj.entity.CouponDiscountGoodsRelExample.Criterion; |
||||
import com.hfkj.entity.CouponDiscountGoodsRelExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class CouponDiscountGoodsRelSqlProvider { |
||||
|
||||
public String countByExample(CouponDiscountGoodsRelExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("coupon_discount_goods_rel"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(CouponDiscountGoodsRelExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("coupon_discount_goods_rel"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(CouponDiscountGoodsRel record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("coupon_discount_goods_rel"); |
||||
|
||||
if (record.getDiscountId() != null) { |
||||
sql.VALUES("discount_id", "#{discountId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getSpecsId() != null) { |
||||
sql.VALUES("specs_id", "#{specsId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(CouponDiscountGoodsRelExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("discount_id"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("specs_id"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("coupon_discount_goods_rel"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
CouponDiscountGoodsRel record = (CouponDiscountGoodsRel) parameter.get("record"); |
||||
CouponDiscountGoodsRelExample example = (CouponDiscountGoodsRelExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("coupon_discount_goods_rel"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountId() != null) { |
||||
sql.SET("discount_id = #{record.discountId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getSpecsId() != null) { |
||||
sql.SET("specs_id = #{record.specsId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("coupon_discount_goods_rel"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("discount_id = #{record.discountId,jdbcType=BIGINT}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("specs_id = #{record.specsId,jdbcType=BIGINT}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
CouponDiscountGoodsRelExample example = (CouponDiscountGoodsRelExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(CouponDiscountGoodsRel record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("coupon_discount_goods_rel"); |
||||
|
||||
if (record.getDiscountId() != null) { |
||||
sql.SET("discount_id = #{discountId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getSpecsId() != null) { |
||||
sql.SET("specs_id = #{specsId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, CouponDiscountGoodsRelExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,153 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.CouponDiscount; |
||||
import com.hfkj.entity.CouponDiscountExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface CouponDiscountMapper extends CouponDiscountMapperExt { |
||||
@SelectProvider(type=CouponDiscountSqlProvider.class, method="countByExample") |
||||
long countByExample(CouponDiscountExample example); |
||||
|
||||
@DeleteProvider(type=CouponDiscountSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(CouponDiscountExample example); |
||||
|
||||
@Delete({ |
||||
"delete from coupon_discount", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into coupon_discount (`name`, img, ", |
||||
"`type`, `condition`, ", |
||||
"price, percentage, ", |
||||
"limit_num, effective_day, ", |
||||
"effective_num, sales_end_time, ", |
||||
"create_time, update_time, ", |
||||
"op_id, op_name, `status`, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values (#{name,jdbcType=VARCHAR}, #{img,jdbcType=VARCHAR}, ", |
||||
"#{type,jdbcType=INTEGER}, #{condition,jdbcType=DECIMAL}, ", |
||||
"#{price,jdbcType=DECIMAL}, #{percentage,jdbcType=DECIMAL}, ", |
||||
"#{limitNum,jdbcType=INTEGER}, #{effectiveDay,jdbcType=INTEGER}, ", |
||||
"#{effectiveNum,jdbcType=INTEGER}, #{salesEndTime,jdbcType=TIMESTAMP}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(CouponDiscount record); |
||||
|
||||
@InsertProvider(type=CouponDiscountSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(CouponDiscount record); |
||||
|
||||
@SelectProvider(type=CouponDiscountSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="img", property="img", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="condition", property="condition", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="price", property="price", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="percentage", property="percentage", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="limit_num", property="limitNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="effective_day", property="effectiveDay", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="effective_num", property="effectiveNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<CouponDiscount> selectByExample(CouponDiscountExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, `name`, img, `type`, `condition`, price, percentage, limit_num, effective_day, ", |
||||
"effective_num, sales_end_time, create_time, update_time, op_id, op_name, `status`, ", |
||||
"ext_1, ext_2, ext_3", |
||||
"from coupon_discount", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="img", property="img", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="condition", property="condition", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="price", property="price", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="percentage", property="percentage", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="limit_num", property="limitNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="effective_day", property="effectiveDay", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="effective_num", property="effectiveNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
CouponDiscount selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=CouponDiscountSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") CouponDiscount record, @Param("example") CouponDiscountExample example); |
||||
|
||||
@UpdateProvider(type=CouponDiscountSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") CouponDiscount record, @Param("example") CouponDiscountExample example); |
||||
|
||||
@UpdateProvider(type=CouponDiscountSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(CouponDiscount record); |
||||
|
||||
@Update({ |
||||
"update coupon_discount", |
||||
"set `name` = #{name,jdbcType=VARCHAR},", |
||||
"img = #{img,jdbcType=VARCHAR},", |
||||
"`type` = #{type,jdbcType=INTEGER},", |
||||
"`condition` = #{condition,jdbcType=DECIMAL},", |
||||
"price = #{price,jdbcType=DECIMAL},", |
||||
"percentage = #{percentage,jdbcType=DECIMAL},", |
||||
"limit_num = #{limitNum,jdbcType=INTEGER},", |
||||
"effective_day = #{effectiveDay,jdbcType=INTEGER},", |
||||
"effective_num = #{effectiveNum,jdbcType=INTEGER},", |
||||
"sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"op_id = #{opId,jdbcType=BIGINT},", |
||||
"op_name = #{opName,jdbcType=VARCHAR},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(CouponDiscount record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface CouponDiscountMapperExt { |
||||
} |
@ -0,0 +1,430 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.CouponDiscount; |
||||
import com.hfkj.entity.CouponDiscountExample.Criteria; |
||||
import com.hfkj.entity.CouponDiscountExample.Criterion; |
||||
import com.hfkj.entity.CouponDiscountExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class CouponDiscountSqlProvider { |
||||
|
||||
public String countByExample(CouponDiscountExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("coupon_discount"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(CouponDiscountExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("coupon_discount"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(CouponDiscount record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("coupon_discount"); |
||||
|
||||
if (record.getName() != null) { |
||||
sql.VALUES("`name`", "#{name,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getImg() != null) { |
||||
sql.VALUES("img", "#{img,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getType() != null) { |
||||
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCondition() != null) { |
||||
sql.VALUES("`condition`", "#{condition,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPrice() != null) { |
||||
sql.VALUES("price", "#{price,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPercentage() != null) { |
||||
sql.VALUES("percentage", "#{percentage,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getLimitNum() != null) { |
||||
sql.VALUES("limit_num", "#{limitNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getEffectiveDay() != null) { |
||||
sql.VALUES("effective_day", "#{effectiveDay,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getEffectiveNum() != null) { |
||||
sql.VALUES("effective_num", "#{effectiveNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getSalesEndTime() != null) { |
||||
sql.VALUES("sales_end_time", "#{salesEndTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.VALUES("op_id", "#{opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.VALUES("op_name", "#{opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(CouponDiscountExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("`name`"); |
||||
sql.SELECT("img"); |
||||
sql.SELECT("`type`"); |
||||
sql.SELECT("`condition`"); |
||||
sql.SELECT("price"); |
||||
sql.SELECT("percentage"); |
||||
sql.SELECT("limit_num"); |
||||
sql.SELECT("effective_day"); |
||||
sql.SELECT("effective_num"); |
||||
sql.SELECT("sales_end_time"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("op_id"); |
||||
sql.SELECT("op_name"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("coupon_discount"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
CouponDiscount record = (CouponDiscount) parameter.get("record"); |
||||
CouponDiscountExample example = (CouponDiscountExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("coupon_discount"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getName() != null) { |
||||
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getImg() != null) { |
||||
sql.SET("img = #{record.img,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getType() != null) { |
||||
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCondition() != null) { |
||||
sql.SET("`condition` = #{record.condition,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPrice() != null) { |
||||
sql.SET("price = #{record.price,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPercentage() != null) { |
||||
sql.SET("percentage = #{record.percentage,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getLimitNum() != null) { |
||||
sql.SET("limit_num = #{record.limitNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getEffectiveDay() != null) { |
||||
sql.SET("effective_day = #{record.effectiveDay,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getEffectiveNum() != null) { |
||||
sql.SET("effective_num = #{record.effectiveNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getSalesEndTime() != null) { |
||||
sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("coupon_discount"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}"); |
||||
sql.SET("img = #{record.img,jdbcType=VARCHAR}"); |
||||
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); |
||||
sql.SET("`condition` = #{record.condition,jdbcType=DECIMAL}"); |
||||
sql.SET("price = #{record.price,jdbcType=DECIMAL}"); |
||||
sql.SET("percentage = #{record.percentage,jdbcType=DECIMAL}"); |
||||
sql.SET("limit_num = #{record.limitNum,jdbcType=INTEGER}"); |
||||
sql.SET("effective_day = #{record.effectiveDay,jdbcType=INTEGER}"); |
||||
sql.SET("effective_num = #{record.effectiveNum,jdbcType=INTEGER}"); |
||||
sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}"); |
||||
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
CouponDiscountExample example = (CouponDiscountExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(CouponDiscount record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("coupon_discount"); |
||||
|
||||
if (record.getName() != null) { |
||||
sql.SET("`name` = #{name,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getImg() != null) { |
||||
sql.SET("img = #{img,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getType() != null) { |
||||
sql.SET("`type` = #{type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCondition() != null) { |
||||
sql.SET("`condition` = #{condition,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPrice() != null) { |
||||
sql.SET("price = #{price,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPercentage() != null) { |
||||
sql.SET("percentage = #{percentage,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getLimitNum() != null) { |
||||
sql.SET("limit_num = #{limitNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getEffectiveDay() != null) { |
||||
sql.SET("effective_day = #{effectiveDay,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getEffectiveNum() != null) { |
||||
sql.SET("effective_num = #{effectiveNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getSalesEndTime() != null) { |
||||
sql.SET("sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.SET("op_id = #{opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.SET("op_name = #{opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, CouponDiscountExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,345 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* coupon_discount |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class CouponDiscount implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 优惠券名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 优惠券图片 |
||||
*/ |
||||
private String img; |
||||
|
||||
/** |
||||
* 卡卷类型 1:满减 2:抵扣 3:折扣 |
||||
*/ |
||||
private Integer type; |
||||
|
||||
/** |
||||
* 优惠券条件(满减价格) |
||||
*/ |
||||
private BigDecimal condition; |
||||
|
||||
/** |
||||
* 优惠券价格 |
||||
*/ |
||||
private BigDecimal price; |
||||
|
||||
/** |
||||
* 折扣百分比(折扣使用) |
||||
*/ |
||||
private BigDecimal percentage; |
||||
|
||||
/** |
||||
* 限制数量 |
||||
*/ |
||||
private Integer limitNum; |
||||
|
||||
/** |
||||
* 领取有效天数 |
||||
*/ |
||||
private Integer effectiveDay; |
||||
|
||||
/** |
||||
* 领取数量 |
||||
*/ |
||||
private Integer effectiveNum; |
||||
|
||||
/** |
||||
* 使用截止日期 |
||||
*/ |
||||
private Date salesEndTime; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 操作人id |
||||
*/ |
||||
private Long opId; |
||||
|
||||
/** |
||||
* 操作人名称 |
||||
*/ |
||||
private String opName; |
||||
|
||||
/** |
||||
* 状态:0.删除 1.编辑中 2.已上架 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getImg() { |
||||
return img; |
||||
} |
||||
|
||||
public void setImg(String img) { |
||||
this.img = img; |
||||
} |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public BigDecimal getCondition() { |
||||
return condition; |
||||
} |
||||
|
||||
public void setCondition(BigDecimal condition) { |
||||
this.condition = condition; |
||||
} |
||||
|
||||
public BigDecimal getPrice() { |
||||
return price; |
||||
} |
||||
|
||||
public void setPrice(BigDecimal price) { |
||||
this.price = price; |
||||
} |
||||
|
||||
public BigDecimal getPercentage() { |
||||
return percentage; |
||||
} |
||||
|
||||
public void setPercentage(BigDecimal percentage) { |
||||
this.percentage = percentage; |
||||
} |
||||
|
||||
public Integer getLimitNum() { |
||||
return limitNum; |
||||
} |
||||
|
||||
public void setLimitNum(Integer limitNum) { |
||||
this.limitNum = limitNum; |
||||
} |
||||
|
||||
public Integer getEffectiveDay() { |
||||
return effectiveDay; |
||||
} |
||||
|
||||
public void setEffectiveDay(Integer effectiveDay) { |
||||
this.effectiveDay = effectiveDay; |
||||
} |
||||
|
||||
public Integer getEffectiveNum() { |
||||
return effectiveNum; |
||||
} |
||||
|
||||
public void setEffectiveNum(Integer effectiveNum) { |
||||
this.effectiveNum = effectiveNum; |
||||
} |
||||
|
||||
public Date getSalesEndTime() { |
||||
return salesEndTime; |
||||
} |
||||
|
||||
public void setSalesEndTime(Date salesEndTime) { |
||||
this.salesEndTime = salesEndTime; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public Long getOpId() { |
||||
return opId; |
||||
} |
||||
|
||||
public void setOpId(Long opId) { |
||||
this.opId = opId; |
||||
} |
||||
|
||||
public String getOpName() { |
||||
return opName; |
||||
} |
||||
|
||||
public void setOpName(String opName) { |
||||
this.opName = opName; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
CouponDiscount other = (CouponDiscount) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) |
||||
&& (this.getImg() == null ? other.getImg() == null : this.getImg().equals(other.getImg())) |
||||
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) |
||||
&& (this.getCondition() == null ? other.getCondition() == null : this.getCondition().equals(other.getCondition())) |
||||
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice())) |
||||
&& (this.getPercentage() == null ? other.getPercentage() == null : this.getPercentage().equals(other.getPercentage())) |
||||
&& (this.getLimitNum() == null ? other.getLimitNum() == null : this.getLimitNum().equals(other.getLimitNum())) |
||||
&& (this.getEffectiveDay() == null ? other.getEffectiveDay() == null : this.getEffectiveDay().equals(other.getEffectiveDay())) |
||||
&& (this.getEffectiveNum() == null ? other.getEffectiveNum() == null : this.getEffectiveNum().equals(other.getEffectiveNum())) |
||||
&& (this.getSalesEndTime() == null ? other.getSalesEndTime() == null : this.getSalesEndTime().equals(other.getSalesEndTime())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId())) |
||||
&& (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); |
||||
result = prime * result + ((getImg() == null) ? 0 : getImg().hashCode()); |
||||
result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); |
||||
result = prime * result + ((getCondition() == null) ? 0 : getCondition().hashCode()); |
||||
result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode()); |
||||
result = prime * result + ((getPercentage() == null) ? 0 : getPercentage().hashCode()); |
||||
result = prime * result + ((getLimitNum() == null) ? 0 : getLimitNum().hashCode()); |
||||
result = prime * result + ((getEffectiveDay() == null) ? 0 : getEffectiveDay().hashCode()); |
||||
result = prime * result + ((getEffectiveNum() == null) ? 0 : getEffectiveNum().hashCode()); |
||||
result = prime * result + ((getSalesEndTime() == null) ? 0 : getSalesEndTime().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode()); |
||||
result = prime * result + ((getOpName() == null) ? 0 : getOpName().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@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(", name=").append(name); |
||||
sb.append(", img=").append(img); |
||||
sb.append(", type=").append(type); |
||||
sb.append(", condition=").append(condition); |
||||
sb.append(", price=").append(price); |
||||
sb.append(", percentage=").append(percentage); |
||||
sb.append(", limitNum=").append(limitNum); |
||||
sb.append(", effectiveDay=").append(effectiveDay); |
||||
sb.append(", effectiveNum=").append(effectiveNum); |
||||
sb.append(", salesEndTime=").append(salesEndTime); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", opId=").append(opId); |
||||
sb.append(", opName=").append(opName); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,168 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* coupon_discount_goods_rel |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class CouponDiscountGoodsRel implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 优惠券id |
||||
*/ |
||||
private Long discountId; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 规格id |
||||
*/ |
||||
private Long specsId; |
||||
|
||||
/** |
||||
* 状态 0:删除 1:正常 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getDiscountId() { |
||||
return discountId; |
||||
} |
||||
|
||||
public void setDiscountId(Long discountId) { |
||||
this.discountId = discountId; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Long getSpecsId() { |
||||
return specsId; |
||||
} |
||||
|
||||
public void setSpecsId(Long specsId) { |
||||
this.specsId = specsId; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
CouponDiscountGoodsRel other = (CouponDiscountGoodsRel) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getDiscountId() == null ? other.getDiscountId() == null : this.getDiscountId().equals(other.getDiscountId())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getSpecsId() == null ? other.getSpecsId() == null : this.getSpecsId().equals(other.getSpecsId())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getDiscountId() == null) ? 0 : getDiscountId().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getSpecsId() == null) ? 0 : getSpecsId().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@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(", discountId=").append(discountId); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", specsId=").append(specsId); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -0,0 +1,733 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
public class CouponDiscountGoodsRelExample { |
||||
protected String orderByClause; |
||||
|
||||
protected boolean distinct; |
||||
|
||||
protected List<Criteria> oredCriteria; |
||||
|
||||
private Integer limit; |
||||
|
||||
private Long offset; |
||||
|
||||
public CouponDiscountGoodsRelExample() { |
||||
oredCriteria = new ArrayList<Criteria>(); |
||||
} |
||||
|
||||
public void setOrderByClause(String orderByClause) { |
||||
this.orderByClause = orderByClause; |
||||
} |
||||
|
||||
public String getOrderByClause() { |
||||
return orderByClause; |
||||
} |
||||
|
||||
public void setDistinct(boolean distinct) { |
||||
this.distinct = distinct; |
||||
} |
||||
|
||||
public boolean isDistinct() { |
||||
return distinct; |
||||
} |
||||
|
||||
public List<Criteria> getOredCriteria() { |
||||
return oredCriteria; |
||||
} |
||||
|
||||
public void or(Criteria criteria) { |
||||
oredCriteria.add(criteria); |
||||
} |
||||
|
||||
public Criteria or() { |
||||
Criteria criteria = createCriteriaInternal(); |
||||
oredCriteria.add(criteria); |
||||
return criteria; |
||||
} |
||||
|
||||
public Criteria createCriteria() { |
||||
Criteria criteria = createCriteriaInternal(); |
||||
if (oredCriteria.size() == 0) { |
||||
oredCriteria.add(criteria); |
||||
} |
||||
return criteria; |
||||
} |
||||
|
||||
protected Criteria createCriteriaInternal() { |
||||
Criteria criteria = new Criteria(); |
||||
return criteria; |
||||
} |
||||
|
||||
public void clear() { |
||||
oredCriteria.clear(); |
||||
orderByClause = null; |
||||
distinct = false; |
||||
} |
||||
|
||||
public void setLimit(Integer limit) { |
||||
this.limit = limit; |
||||
} |
||||
|
||||
public Integer getLimit() { |
||||
return limit; |
||||
} |
||||
|
||||
public void setOffset(Long offset) { |
||||
this.offset = offset; |
||||
} |
||||
|
||||
public Long getOffset() { |
||||
return offset; |
||||
} |
||||
|
||||
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(Long value) { |
||||
addCriterion("id =", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdNotEqualTo(Long value) { |
||||
addCriterion("id <>", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdGreaterThan(Long value) { |
||||
addCriterion("id >", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) { |
||||
addCriterion("id >=", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdLessThan(Long value) { |
||||
addCriterion("id <", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) { |
||||
addCriterion("id <=", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdIn(List<Long> values) { |
||||
addCriterion("id in", values, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdNotIn(List<Long> values) { |
||||
addCriterion("id not in", values, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) { |
||||
addCriterion("id between", value1, value2, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) { |
||||
addCriterion("id not between", value1, value2, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdIsNull() { |
||||
addCriterion("discount_id is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdIsNotNull() { |
||||
addCriterion("discount_id is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdEqualTo(Long value) { |
||||
addCriterion("discount_id =", value, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdNotEqualTo(Long value) { |
||||
addCriterion("discount_id <>", value, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdGreaterThan(Long value) { |
||||
addCriterion("discount_id >", value, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdGreaterThanOrEqualTo(Long value) { |
||||
addCriterion("discount_id >=", value, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdLessThan(Long value) { |
||||
addCriterion("discount_id <", value, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdLessThanOrEqualTo(Long value) { |
||||
addCriterion("discount_id <=", value, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdIn(List<Long> values) { |
||||
addCriterion("discount_id in", values, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdNotIn(List<Long> values) { |
||||
addCriterion("discount_id not in", values, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdBetween(Long value1, Long value2) { |
||||
addCriterion("discount_id between", value1, value2, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andDiscountIdNotBetween(Long value1, Long value2) { |
||||
addCriterion("discount_id not between", value1, value2, "discountId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeIsNull() { |
||||
addCriterion("create_time is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeIsNotNull() { |
||||
addCriterion("create_time is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeEqualTo(Date value) { |
||||
addCriterion("create_time =", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeNotEqualTo(Date value) { |
||||
addCriterion("create_time <>", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeGreaterThan(Date value) { |
||||
addCriterion("create_time >", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { |
||||
addCriterion("create_time >=", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeLessThan(Date value) { |
||||
addCriterion("create_time <", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeLessThanOrEqualTo(Date value) { |
||||
addCriterion("create_time <=", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeIn(List<Date> values) { |
||||
addCriterion("create_time in", values, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeNotIn(List<Date> values) { |
||||
addCriterion("create_time not in", values, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeBetween(Date value1, Date value2) { |
||||
addCriterion("create_time between", value1, value2, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeNotBetween(Date value1, Date value2) { |
||||
addCriterion("create_time not between", value1, value2, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdIsNull() { |
||||
addCriterion("specs_id is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdIsNotNull() { |
||||
addCriterion("specs_id is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdEqualTo(Long value) { |
||||
addCriterion("specs_id =", value, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdNotEqualTo(Long value) { |
||||
addCriterion("specs_id <>", value, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdGreaterThan(Long value) { |
||||
addCriterion("specs_id >", value, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdGreaterThanOrEqualTo(Long value) { |
||||
addCriterion("specs_id >=", value, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdLessThan(Long value) { |
||||
addCriterion("specs_id <", value, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdLessThanOrEqualTo(Long value) { |
||||
addCriterion("specs_id <=", value, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdIn(List<Long> values) { |
||||
addCriterion("specs_id in", values, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdNotIn(List<Long> values) { |
||||
addCriterion("specs_id not in", values, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdBetween(Long value1, Long value2) { |
||||
addCriterion("specs_id between", value1, value2, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andSpecsIdNotBetween(Long value1, Long value2) { |
||||
addCriterion("specs_id not between", value1, value2, "specsId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusIsNull() { |
||||
addCriterion("`status` is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusIsNotNull() { |
||||
addCriterion("`status` is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusEqualTo(Integer value) { |
||||
addCriterion("`status` =", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusNotEqualTo(Integer value) { |
||||
addCriterion("`status` <>", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusGreaterThan(Integer value) { |
||||
addCriterion("`status` >", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusGreaterThanOrEqualTo(Integer value) { |
||||
addCriterion("`status` >=", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusLessThan(Integer value) { |
||||
addCriterion("`status` <", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusLessThanOrEqualTo(Integer value) { |
||||
addCriterion("`status` <=", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusIn(List<Integer> values) { |
||||
addCriterion("`status` in", values, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusNotIn(List<Integer> values) { |
||||
addCriterion("`status` not in", values, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusBetween(Integer value1, Integer value2) { |
||||
addCriterion("`status` between", value1, value2, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusNotBetween(Integer value1, Integer value2) { |
||||
addCriterion("`status` not between", value1, value2, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1IsNull() { |
||||
addCriterion("ext_1 is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1IsNotNull() { |
||||
addCriterion("ext_1 is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1EqualTo(String value) { |
||||
addCriterion("ext_1 =", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotEqualTo(String value) { |
||||
addCriterion("ext_1 <>", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1GreaterThan(String value) { |
||||
addCriterion("ext_1 >", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1GreaterThanOrEqualTo(String value) { |
||||
addCriterion("ext_1 >=", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1LessThan(String value) { |
||||
addCriterion("ext_1 <", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1LessThanOrEqualTo(String value) { |
||||
addCriterion("ext_1 <=", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1Like(String value) { |
||||
addCriterion("ext_1 like", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotLike(String value) { |
||||
addCriterion("ext_1 not like", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1In(List<String> values) { |
||||
addCriterion("ext_1 in", values, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotIn(List<String> values) { |
||||
addCriterion("ext_1 not in", values, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1Between(String value1, String value2) { |
||||
addCriterion("ext_1 between", value1, value2, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotBetween(String value1, String value2) { |
||||
addCriterion("ext_1 not between", value1, value2, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2IsNull() { |
||||
addCriterion("ext_2 is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2IsNotNull() { |
||||
addCriterion("ext_2 is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2EqualTo(String value) { |
||||
addCriterion("ext_2 =", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotEqualTo(String value) { |
||||
addCriterion("ext_2 <>", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2GreaterThan(String value) { |
||||
addCriterion("ext_2 >", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2GreaterThanOrEqualTo(String value) { |
||||
addCriterion("ext_2 >=", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2LessThan(String value) { |
||||
addCriterion("ext_2 <", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2LessThanOrEqualTo(String value) { |
||||
addCriterion("ext_2 <=", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2Like(String value) { |
||||
addCriterion("ext_2 like", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotLike(String value) { |
||||
addCriterion("ext_2 not like", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2In(List<String> values) { |
||||
addCriterion("ext_2 in", values, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotIn(List<String> values) { |
||||
addCriterion("ext_2 not in", values, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2Between(String value1, String value2) { |
||||
addCriterion("ext_2 between", value1, value2, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotBetween(String value1, String value2) { |
||||
addCriterion("ext_2 not between", value1, value2, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3IsNull() { |
||||
addCriterion("ext_3 is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3IsNotNull() { |
||||
addCriterion("ext_3 is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3EqualTo(String value) { |
||||
addCriterion("ext_3 =", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotEqualTo(String value) { |
||||
addCriterion("ext_3 <>", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3GreaterThan(String value) { |
||||
addCriterion("ext_3 >", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3GreaterThanOrEqualTo(String value) { |
||||
addCriterion("ext_3 >=", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3LessThan(String value) { |
||||
addCriterion("ext_3 <", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3LessThanOrEqualTo(String value) { |
||||
addCriterion("ext_3 <=", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3Like(String value) { |
||||
addCriterion("ext_3 like", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotLike(String value) { |
||||
addCriterion("ext_3 not like", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3In(List<String> values) { |
||||
addCriterion("ext_3 in", values, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotIn(List<String> values) { |
||||
addCriterion("ext_3 not in", values, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3Between(String value1, String value2) { |
||||
addCriterion("ext_3 between", value1, value2, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotBetween(String value1, String value2) { |
||||
addCriterion("ext_3 not between", value1, value2, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
*/ |
||||
public static class Criteria extends GeneratedCriteria { |
||||
|
||||
protected Criteria() { |
||||
super(); |
||||
} |
||||
} |
||||
|
||||
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); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.hfkj.model.discount; |
||||
|
||||
import com.hfkj.entity.CouponDiscountGoodsRel; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
@Data |
||||
public class DiscountGoodsModel extends CouponDiscountGoodsRel { |
||||
|
||||
/** |
||||
* 商品名称 |
||||
*/ |
||||
private String goodsName; |
||||
|
||||
/** |
||||
* sku名称 |
||||
*/ |
||||
private String SpecsName; |
||||
|
||||
/** |
||||
* 售价 |
||||
*/ |
||||
private BigDecimal salePrice; |
||||
|
||||
} |
@ -0,0 +1,118 @@ |
||||
package com.hfkj.service.discount; |
||||
|
||||
import com.hfkj.entity.CouponDiscount; |
||||
import com.hfkj.entity.CouponDiscountGoodsRel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @serviceName CouponDiscountService.java |
||||
* @author Sum1Dream |
||||
* @version 1.0.0 |
||||
* @Description // 优惠券管理
|
||||
* @createTime 15:07 2024/4/19 |
||||
**/ |
||||
public interface CouponDiscountService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name create |
||||
* @Description // 创建
|
||||
* @Date 15:11 2024/4/19 |
||||
* @Param CouponDiscount |
||||
* @return void |
||||
*/ |
||||
void create(CouponDiscount couponDiscount); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name update |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param CouponDiscount |
||||
* @return void |
||||
*/ |
||||
void update(CouponDiscount couponDiscount); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name delete |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return void |
||||
*/ |
||||
void delete(Long id , Boolean fullDelete); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetail |
||||
* @Description // 根据ID查询详情
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return com.hfkj.entity.CouponDiscount |
||||
*/ |
||||
CouponDiscount queryDetail(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetailByMap |
||||
* @Description // 根据多条件查询
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param map |
||||
* @return com.hfkj.entity.CouponDiscount |
||||
*/ |
||||
CouponDiscount queryDetailByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getList |
||||
* @Description // 根据多条件查询列表
|
||||
* @Date 15:13 2024/4/19 |
||||
* @Param map |
||||
* @return java.util.List<com.hfkj.entity.CouponDiscount> |
||||
*/ |
||||
List<CouponDiscount> getList(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getListGoodsRel |
||||
* @Description // 根据多条件查询列表
|
||||
* @Date 15:13 2024/4/19 |
||||
* @Param map |
||||
* @return java.util.List<com.hfkj.entity.CouponDiscountGoodsRel> |
||||
*/ |
||||
List<CouponDiscountGoodsRel> getListGoodsRel(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name create |
||||
* @Description // 创建
|
||||
* @Date 15:11 2024/4/19 |
||||
* @Param createGoodsRel |
||||
* @return void |
||||
*/ |
||||
void createGoodsRel(CouponDiscountGoodsRel couponDiscountGoodsRel); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name deleteDiscountGoodsRel |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return void |
||||
*/ |
||||
void deleteDiscountGoodsRel(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name deleteDiscountGoodsRelDiscountId |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return void |
||||
*/ |
||||
void deleteDiscountGoodsRelDiscountId(Long discountId); |
||||
|
||||
} |
@ -0,0 +1,107 @@ |
||||
package com.hfkj.service.discount.impl; |
||||
|
||||
import com.hfkj.dao.CouponDiscountGoodsRelMapper; |
||||
import com.hfkj.dao.CouponDiscountMapper; |
||||
import com.hfkj.entity.*; |
||||
import com.hfkj.service.discount.CouponDiscountService; |
||||
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("couponDiscountService") |
||||
public class CouponDiscountServiceImpl implements CouponDiscountService { |
||||
|
||||
@Resource |
||||
private CouponDiscountMapper couponDiscountMapper; |
||||
|
||||
@Resource |
||||
private CouponDiscountGoodsRelMapper couponDiscountGoodsRelMapper; |
||||
|
||||
@Override |
||||
public void create(CouponDiscount couponDiscount) { |
||||
couponDiscountMapper.insert(couponDiscount); |
||||
} |
||||
|
||||
@Override |
||||
public void update(CouponDiscount couponDiscount) { |
||||
couponDiscountMapper.updateByPrimaryKeySelective(couponDiscount); |
||||
} |
||||
|
||||
@Override |
||||
public void delete(Long id, Boolean fullDelete) { |
||||
if (fullDelete) { |
||||
couponDiscountMapper.deleteByPrimaryKey(id); |
||||
} else { |
||||
CouponDiscount couponDiscount = queryDetail(id); |
||||
couponDiscount.setStatus(0); |
||||
couponDiscount.setUpdateTime(new Date()); |
||||
update(couponDiscount); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CouponDiscount queryDetail(Long id) { |
||||
return couponDiscountMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public CouponDiscount queryDetailByMap(Map<String, Object> map) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<CouponDiscount> getList(Map<String, Object> map) { |
||||
|
||||
CouponDiscountExample example = new CouponDiscountExample(); |
||||
CouponDiscountExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getInteger(map, "type") != null) { |
||||
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); |
||||
} |
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "name"))) { |
||||
criteria.andNameLike("%"+MapUtils.getString(map, "name")+"%"); |
||||
} |
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
} else { |
||||
criteria.andStatusNotEqualTo(0); |
||||
} |
||||
|
||||
return couponDiscountMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public List<CouponDiscountGoodsRel> getListGoodsRel(Map<String, Object> map) { |
||||
CouponDiscountGoodsRelExample example = new CouponDiscountGoodsRelExample(); |
||||
CouponDiscountGoodsRelExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "discountId") != null) { |
||||
criteria.andDiscountIdEqualTo(MapUtils.getLong(map, "discountId")); |
||||
} |
||||
|
||||
return couponDiscountGoodsRelMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public void createGoodsRel(CouponDiscountGoodsRel couponDiscountGoodsRel) { |
||||
couponDiscountGoodsRelMapper.insert(couponDiscountGoodsRel); |
||||
} |
||||
|
||||
@Override |
||||
public void deleteDiscountGoodsRel(Long id) { |
||||
couponDiscountGoodsRelMapper.deleteByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public void deleteDiscountGoodsRelDiscountId(Long discountId) { |
||||
CouponDiscountGoodsRelExample example = new CouponDiscountGoodsRelExample(); |
||||
example.createCriteria().andDiscountIdEqualTo(discountId); |
||||
couponDiscountGoodsRelMapper.deleteByExample(example); |
||||
} |
||||
} |
Loading…
Reference in new issue