Authored by csgyoho

no message

... ... @@ -14,4 +14,22 @@
<packaging>jar</packaging>
<name>ufo-platform-coupon</name>
<dependencies>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-dal</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>coupon-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.core</groupId>
<artifactId>yoho-core-dal</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
package com.yoho.ufo.coupon.controller;
import com.yoho.ufo.coupon.service.ICouponService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yohobuy.ufo.coupon.req.CouponQueryReq;
import com.yohobuy.ufo.coupon.req.CouponSaveUpdateReq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by shengguo.cai on 2018/11/20.
*/
@RestController
@RequestMapping(value = "/coupon")
public class CouponController {
private static final Logger LOGGER = LoggerFactory.getLogger(CouponController.class);
@Autowired
private ICouponService couponService;
@RequestMapping(value = "/queryCoupons")
public ApiResponse queryCoupons(CouponQueryReq req) {
LOGGER.info("enter queryCoupons,param is {}",req);
if(req == null){
return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
}
return this.couponService.queryCoupons(req);
}
@RequestMapping(value = "/saveOrUpdateCoupon")
public ApiResponse saveOrUpdateCoupon(CouponSaveUpdateReq req) {
LOGGER.info("enter saveOrUpdateCoupon,param is {}",req);
if(req == null){
return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
}
return this.couponService.saveOrUpdateCoupon(req);
}
@RequestMapping(value = "/getCouponInfo")
public ApiResponse getCouponInfo(Integer id) {
LOGGER.info("enter getCouponInfo,id is {}",id);
if(id == null){
return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
}
return this.couponService.getCouponInfo(id);
}
}
... ...
package com.yoho.ufo.coupon.service;
import com.yoho.ufo.service.model.ApiResponse;
import com.yohobuy.ufo.coupon.req.CouponQueryReq;
import com.yohobuy.ufo.coupon.req.CouponSaveUpdateReq;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public interface ICouponService {
ApiResponse queryCoupons(CouponQueryReq req);
ApiResponse saveOrUpdateCoupon(CouponSaveUpdateReq req);
ApiResponse getCouponInfo(Integer id);
}
... ...
package com.yoho.ufo.coupon.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.service.model.order.utils.MD5Utils;
import com.yoho.ufo.coupon.service.ICouponService;
import com.yoho.ufo.dal.CouponMapper;
import com.yoho.ufo.dal.CouponProductLimitMapper;
import com.yoho.ufo.model.coupon.Coupon;
import com.yoho.ufo.model.coupon.CouponProductLimit;
import com.yoho.ufo.service.model.ApiResponse;
import com.yohobuy.ufo.coupon.req.CouponQueryReq;
import com.yohobuy.ufo.coupon.req.CouponSaveUpdateReq;
import com.yohobuy.ufo.coupon.resp.CouponQueryResp;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Created by shengguo.cai on 2018/11/20.
*/
@Service
public class CouponServiceImpl implements ICouponService{
private static final Logger LOGGER = LoggerFactory.getLogger(CouponServiceImpl.class);
@Autowired
private CouponMapper couponMapper;
@Autowired
private CouponProductLimitMapper couponProductLimitMapper;
@Override
public ApiResponse queryCoupons(CouponQueryReq req) {
LOGGER.info("enter queryCoupons,param is {}",req);
int total = couponMapper.selectTotalByCondition(req);
JSONObject jsonObject = new JSONObject();
jsonObject.put("total",total);
if(total == 0){
return new ApiResponse.ApiResponseBuilder().data(jsonObject).build();
}
List<Coupon> coupons = couponMapper.selectByCondition(req);
List<CouponQueryResp> couponQueryResps = initCouponQueryResps(coupons);
jsonObject.put("coupons",couponQueryResps);
return new ApiResponse.ApiResponseBuilder().data(jsonObject).build();
}
@Override
public ApiResponse saveOrUpdateCoupon(CouponSaveUpdateReq req) {
LOGGER.info("enter saveOrUpdateCoupon,param is {}",req);
if(!checkSaveOrUpdateCouponParam(req)){
return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
}
if(req.getId() != null){
LOGGER.info("before saveOrUpdateCoupon#deleteByCouponId,couponId is {}",req.getId());
couponProductLimitMapper.deleteByCouponId(req.getId());
}
if(null == req.getId()){
req.setCouponToken(MD5Utils.md5(UUID.randomUUID().toString()));
req.setCreateTime(DateUtil.getCurrentTimeSecond());
//新增时暂时写死的值
req.setProductLimitType(Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT);
req.setCouponType(100);
}
couponMapper.insertOrUpdate(req);
LOGGER.info("after saveOrUpdateCoupon#couponMapper.insertOrUpdate,req is {}",req);
String[] productIds = req.getProductLimitValue().split(",");
LOGGER.info("before saveOrUpdateCoupon#couponProductLimitMapper.insertBatchByProductIds,productIds is {}",productIds);
couponProductLimitMapper.insertBatchByProductIds(productIds,Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT,req.getId());
return new ApiResponse();
}
@Override
public ApiResponse getCouponInfo(Integer id) {
LOGGER.info("enter getCouponInfo, id is {}",id);
Coupon coupon = couponMapper.selectById(id);
List<CouponProductLimit> productLimitList = couponProductLimitMapper.selectByCouponId(id);
JSONObject jsonObject = new JSONObject();
jsonObject.put("coupon",coupon);
jsonObject.put("productLimits",productLimitList);
return new ApiResponse.ApiResponseBuilder().data(jsonObject).build();
}
private boolean checkSaveOrUpdateCouponParam(CouponSaveUpdateReq req) {
if(req == null){
LOGGER.info("checkSaveOrUpdateCouponParam failed! req is null");
return false;
}
if(StringUtils.isBlank(req.getCouponName())){
LOGGER.info("checkSaveOrUpdateCouponParam failed! couponName is blank");
return false;
}
if(null == req.getCouponAmount() || req.getCouponAmount()<=0){
LOGGER.info("checkSaveOrUpdateCouponParam failed! couponAmount error! couponAmount is {}",req.getCouponAmount());
return false;
}
if(null == req.getCouponNum() || req.getCouponNum()<=0){
LOGGER.info("checkSaveOrUpdateCouponParam failed! couponNum error! couponNum is {}",req.getCouponNum());
return false;
}
if(null == req.getUseNum() || req.getUseNum()<=0){
LOGGER.info("checkSaveOrUpdateCouponParam failed! useNum error! useNum is {}",req.getUseNum());
return false;
}
if(null == req.getStartTime() || req.getStartTime()<=0){
LOGGER.info("checkSaveOrUpdateCouponParam failed! startTime error! startTime is {}",req.getStartTime());
return false;
}
if(null == req.getEndTime() || req.getEndTime()<=0){
LOGGER.info("checkSaveOrUpdateCouponParam failed! endTime error! endTime is {}",req.getEndTime());
return false;
}
if(req.getEndTime()<req.getStartTime()){
LOGGER.info("checkSaveOrUpdateCouponParam failed! endTime < startTime!endTime is {},startTime is {}"
,req.getEndTime(),req.getStartTime());
return false;
}
if(StringUtils.isBlank(req.getRemark())){
LOGGER.info("checkSaveOrUpdateCouponParam failed! remark is blank.");
return false;
}
if(StringUtils.isBlank(req.getProductLimitValue())){
LOGGER.info("checkSaveOrUpdateCouponParam failed! productLimitValue is blank.");
return false;
}
return checkUpdateCouponParam(req);
}
private boolean checkUpdateCouponParam(CouponSaveUpdateReq req) {
if(req.getId() == null){
return true;
}
Coupon coupon = couponMapper.selectById(req.getId());
if(coupon == null){
LOGGER.info("checkUpdateCouponParam failed! coupon is null.id is {}",req.getId());
return false;
}
if(coupon.getStartTime()< DateUtil.currentTimeSeconds()){
LOGGER.info("checkUpdateCouponParam failed! coupon is using! startTime is {}",coupon.getStartTime());
return false;
}
return true;
}
private List<CouponQueryResp> initCouponQueryResps(List<Coupon> coupons) {
if(CollectionUtils.isEmpty(coupons)){
return null;
}
List<CouponQueryResp> resps = new ArrayList<>();
for(Coupon coupon : coupons){
CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponAmount(),
coupon.getStartTime(),coupon.getEndTime(),coupon.getRemark(), Coupon.CouponStatusEnum.getKey(coupon.getStatus()));
resps.add(resp);
}
return resps;
}
}
... ...
... ... @@ -32,6 +32,10 @@
<artifactId>resource-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>coupon-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
</dependency>
... ...
package com.yoho.ufo.dal;
import com.yoho.ufo.model.coupon.Coupon;
import com.yohobuy.ufo.coupon.req.CouponQueryReq;
import com.yohobuy.ufo.coupon.req.CouponSaveUpdateReq;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public interface CouponMapper {
int selectTotalByCondition(@Param("param") CouponQueryReq param);
List<Coupon> selectByCondition(@Param("param") CouponQueryReq param);
Coupon selectById(@Param("id") Integer id);
void insertOrUpdate(@Param("param") CouponSaveUpdateReq param);
}
... ...
package com.yoho.ufo.dal;
import com.yoho.ufo.model.coupon.CouponProductLimit;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public interface CouponProductLimitMapper {
void deleteByCouponId(@Param("id") Integer id);
void insertBatchByProductIds(@Param("productIds") String[] productIds, @Param("limitType") int limitType, @Param("couponId") int couponId);
List<CouponProductLimit> selectByCouponId(@Param("id") Integer id);
}
... ...
package com.yoho.ufo.dal;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public interface CouponTypeMapper {
}
... ...
package com.yoho.ufo.dal;
import com.yoho.ufo.model.resource.ResourcesContentData;
import com.yohobuy.ufo.model.req.ResContentDataModifyBo;
import com.yohobuy.ufo.resource.req.ResContentDataModifyBo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
... ...
package com.yoho.ufo.dal;
import com.yoho.ufo.model.resource.ResourcesGoodsPool;
import com.yohobuy.ufo.model.req.ResGoodsPoolEditBo;
import com.yohobuy.ufo.resource.req.ResGoodsPoolEditBo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
... ...
package com.yoho.ufo.dal;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public interface UserCouponMapper {
}
... ...
package com.yoho.ufo.model.coupon;
import java.io.Serializable;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public class Coupon implements Serializable {
private Integer id;
private String couponToken;
private String couponName;
private Float couponAmount;
private Integer couponType;
private Integer couponNum;
private Integer useNum;
private Integer sendNum;
private Integer useLimitType;
private Integer useLimitValue;
private Integer productLimitType;
private String productLimitValue;
private Integer startTime;
private Integer endTime;
private Integer status;
private Integer createTime;
private Integer pid;
private String remark;
/**商品限制条件-特定商品*/
public static final int PRODUCTLIMITTYPE_SPECIALPRODUCT = 1;
public enum CouponStatusEnum {
//0:待审核,1:有效,2:审核驳回,3:作废
WAITE_CHECK(0,"待审核"),IN_EFFECT(1,"有效"),REVIEW_REJECTION(2,"审核驳回"),INVALID(3,"作废");
private int value;
private String key;
CouponStatusEnum(int value, String key) {
this.value = value;
this.key = key;
}
public static String getKey(int value){
for(CouponStatusEnum cs : values()){
if(cs.value == value){
return cs.key;
}
}
return null;
}
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCouponToken() {
return couponToken;
}
public void setCouponToken(String couponToken) {
this.couponToken = couponToken;
}
public String getCouponName() {
return couponName;
}
public void setCouponName(String couponName) {
this.couponName = couponName;
}
public Float getCouponAmount() {
return couponAmount;
}
public void setCouponAmount(Float couponAmount) {
this.couponAmount = couponAmount;
}
public Integer getCouponType() {
return couponType;
}
public void setCouponType(Integer couponType) {
this.couponType = couponType;
}
public Integer getCouponNum() {
return couponNum;
}
public void setCouponNum(Integer couponNum) {
this.couponNum = couponNum;
}
public Integer getUseNum() {
return useNum;
}
public void setUseNum(Integer useNum) {
this.useNum = useNum;
}
public Integer getSendNum() {
return sendNum;
}
public void setSendNum(Integer sendNum) {
this.sendNum = sendNum;
}
public Integer getUseLimitType() {
return useLimitType;
}
public void setUseLimitType(Integer useLimitType) {
this.useLimitType = useLimitType;
}
public Integer getUseLimitValue() {
return useLimitValue;
}
public void setUseLimitValue(Integer useLimitValue) {
this.useLimitValue = useLimitValue;
}
public Integer getProductLimitType() {
return productLimitType;
}
public void setProductLimitType(Integer productLimitType) {
this.productLimitType = productLimitType;
}
public String getProductLimitValue() {
return productLimitValue;
}
public void setProductLimitValue(String productLimitValue) {
this.productLimitValue = productLimitValue;
}
public Integer getStartTime() {
return startTime;
}
public void setStartTime(Integer startTime) {
this.startTime = startTime;
}
public Integer getEndTime() {
return endTime;
}
public void setEndTime(Integer endTime) {
this.endTime = endTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
... ...
package com.yoho.ufo.model.coupon;
import java.io.Serializable;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public class CouponProductLimit implements Serializable {
private Integer id;
private Integer couponId;
private Integer limitType;
private Integer productSkn;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCouponId() {
return couponId;
}
public void setCouponId(Integer couponId) {
this.couponId = couponId;
}
public Integer getLimitType() {
return limitType;
}
public void setLimitType(Integer limitType) {
this.limitType = limitType;
}
public Integer getProductSkn() {
return productSkn;
}
public void setProductSkn(Integer productSkn) {
this.productSkn = productSkn;
}
}
... ...
package com.yoho.ufo.model.coupon;
import java.io.Serializable;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public class CouponType implements Serializable {
private Integer id;
private String caption;
private String alphabet;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
public String getAlphabet() {
return alphabet;
}
public void setAlphabet(String alphabet) {
this.alphabet = alphabet;
}
}
... ...
package com.yoho.ufo.model.coupon;
import java.io.Serializable;
/**
* Created by shengguo.cai on 2018/11/20.
*/
public class UserCoupon implements Serializable {
private Integer id;
private Integer uid;
private Integer couponId;
private Integer couponType;
private String couponCode;
private Integer status;
private Integer orderCode;
private Integer useTime;
private Integer startTime;
private Integer endTime;
private Integer createTime;
private String couponToken;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getCouponId() {
return couponId;
}
public void setCouponId(Integer couponId) {
this.couponId = couponId;
}
public Integer getCouponType() {
return couponType;
}
public void setCouponType(Integer couponType) {
this.couponType = couponType;
}
public String getCouponCode() {
return couponCode;
}
public void setCouponCode(String couponCode) {
this.couponCode = couponCode;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOrderCode() {
return orderCode;
}
public void setOrderCode(Integer orderCode) {
this.orderCode = orderCode;
}
public Integer getUseTime() {
return useTime;
}
public void setUseTime(Integer useTime) {
this.useTime = useTime;
}
public Integer getStartTime() {
return startTime;
}
public void setStartTime(Integer startTime) {
this.startTime = startTime;
}
public Integer getEndTime() {
return endTime;
}
public void setEndTime(Integer endTime) {
this.endTime = endTime;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public String getCouponToken() {
return couponToken;
}
public void setCouponToken(String couponToken) {
this.couponToken = couponToken;
}
}
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.ufo.dal.CouponMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.coupon.Coupon">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="coupon_token" property="couponToken" jdbcType="VARCHAR" />
<result column="coupon_name" property="couponName" jdbcType="VARCHAR" />
<result column="coupon_amount" property="couponAmount" jdbcType="FLOAT" />
<result column="coupon_type" property="couponType" jdbcType="INTEGER" />
<result column="coupon_num" property="couponNum" jdbcType="INTEGER" />
<result column="use_num" property="useNum" jdbcType="INTEGER" />
<result column="send_num" property="sendNum" jdbcType="INTEGER" />
<result column="use_limit_type" property="useLimitType" jdbcType="INTEGER" />
<result column="use_limit_value" property="useLimitValue" jdbcType="INTEGER" />
<result column="product_limit_type" property="productLimitType" jdbcType="INTEGER" />
<result column="product_limit_value" property="productLimitValue" jdbcType="VARCHAR" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="pid" property="pid" jdbcType="INTEGER" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num,
use_limit_type,use_limit_value,product_limit_type,product_limit_value,start_time,
end_time,status,create_time,pid,remark
</sql>
<insert id="insertOrUpdate" useGeneratedKeys="true" keyProperty="id">
insert into coupon(id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num,
use_limit_type,
<if test="param.useLimitType == 2">
use_limit_value,
</if>
product_limit_type,
<if test="param.productLimitType != 1">
product_limit_value,
</if>
start_time,end_time,status,create_time,pid,remark)
values(#{param.id},#{param.couponToken},#{param.couponName},#{param.couponAmount},#{param.couponType}
,#{param.couponNum},#{param.useNum},#{param.sendNum},#{param.useLimitType},
<if test="param.useLimitType == 2">
#{param.useLimitValue},
</if>
#{param.productLimitType},
<if test="param.productLimitType != 1">
#{param.productLimitValue},
</if>
#{param.startTime},#{param.endTime},#{param.status},#{param.createTime},#{param.pid},#{param.remark})
on duplicate key update
coupon_name=#{param.couponName},coupon_amount=#{param.couponAmount},coupon_type=#{param.couponType},coupon_num=#{param.couponNum}
,use_num=#{param.useNum},send_num=#{param.sendNum},
use_limit_type=#{param.useLimitType},
<if test="param.useLimitType == 2">
use_limit_value=#{param.useLimitValue},
</if>
product_limit_type=#{param.productLimitType},
<if test="param.productLimitType != 1">
product_limit_value=#{param.productLimitValue},
</if>
start_time=#{param.startTime},end_time=#{param.endTime},status=#{param.status},pid=#{param.pid},remark=#{param.remark}
</insert>
<select id="selectTotalByCondition" resultType="java.lang.Integer">
select count(1) from coupon where 1=1
<if test="param.id != null">
and id=#{param.id}
</if>
<if test="param.couponName != null">
and coupon_name=#{param.couponName}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
<if test="param.startTime != null">
and start_time>=#{param.startTime}
</if>
<if test="param.endTime != null">
and end_time <![CDATA[<= ]]> #{param.endTime}
</if>
</select>
<select id="selectByCondition" resultType="com.yoho.ufo.model.coupon.Coupon">
select <include refid="Base_Column_List" /> from coupon where 1=1
<if test="param.id != null">
and id=#{param.id}
</if>
<if test="param.couponName != null">
and coupon_name=#{param.couponName}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
<if test="param.startTime != null">
and start_time>=#{param.startTime}
</if>
<if test="param.endTime != null">
and end_time <![CDATA[<= ]]> #{param.endTime}
</if>
order by id desc
limit #{param.start},#{param.size}
</select>
<select id="selectById" resultType="com.yoho.ufo.model.coupon.Coupon">
select <include refid="Base_Column_List" /> from coupon where id=#{id} limit 1;
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.ufo.dal.CouponProductLimitMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.coupon.CouponProductLimit">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="coupon_id" property="couponId" jdbcType="INTEGER" />
<result column="limit_type" property="limitType" jdbcType="INTEGER" />
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id,coupon_id,limit_type,product_skn
</sql>
<insert id="insertBatchByProductIds">
insert into coupon_product_limit(
coupon_id,
limit_type,
product_id)values
<foreach collection="productIds" separator="," item="productId">
(#{couponId},#{limitType},#{productId})
</foreach>
</insert>
<delete id="deleteByCouponId">
delete from coupon_product_limit where coupon_id=#{id}
</delete>
<select id="selectByCouponId" resultType="com.yoho.ufo.model.coupon.CouponProductLimit">
select <include refid="Base_Column_List" /> from coupon_product_limit where coupon_id=#{id}
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.ufo.dal.CouponTypeMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.coupon.CouponType">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="caption" property="caption" jdbcType="VARCHAR" />
<result column="alphabet" property="alphabet" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id,caption,alphabet
</sql>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.ufo.dal.UserCouponMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.coupon.UserCoupon">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="coupon_id" property="couponId" jdbcType="INTEGER" />
<result column="coupon_type" property="couponType" jdbcType="INTEGER" />
<result column="coupon_code" property="couponCode" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="INTEGER" />
<result column="use_time" property="useTime" jdbcType="INTEGER" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="coupon_token" property="couponToken" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id,uid,coupon_id,coupon_type,coupon_code,status,order_code,use_time,start_time,end_time,create_time,coupon_token
</sql>
</mapper>
\ No newline at end of file
... ...
... ... @@ -45,6 +45,11 @@
<version>${ufo.model.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>coupon-ufo-model</artifactId>
<version>${ufo.model.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-dal</artifactId>
<version>${project.version}</version>
... ...
... ... @@ -4,9 +4,9 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.ufo.resource.service.IResourceService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.PageRequestBO;
import com.yohobuy.ufo.model.req.ResContentDataModifyBo;
import com.yohobuy.ufo.model.req.ResGoodsPoolEditBo;
import com.yohobuy.ufo.model.resp.ResourceGetBo;
import com.yohobuy.ufo.resource.req.ResContentDataModifyBo;
import com.yohobuy.ufo.resource.req.ResGoodsPoolEditBo;
import com.yohobuy.ufo.resource.resp.ResourceGetBo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ...
... ... @@ -2,9 +2,9 @@ package com.yoho.ufo.resource.service;
import com.alibaba.fastjson.JSONObject;
import com.yoho.ufo.service.model.PageRequestBO;
import com.yohobuy.ufo.model.req.ResContentDataModifyBo;
import com.yohobuy.ufo.model.req.ResGoodsPoolEditBo;
import com.yohobuy.ufo.model.resp.ResourceGetBo;
import com.yohobuy.ufo.resource.req.ResContentDataModifyBo;
import com.yohobuy.ufo.resource.req.ResGoodsPoolEditBo;
import com.yohobuy.ufo.resource.resp.ResourceGetBo;
import java.util.List;
... ...
... ... @@ -41,6 +41,10 @@
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-coupon</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
</dependency>
<dependency>
... ...