优惠券接口修改

This commit is contained in:
zhh 2018-11-09 16:16:17 +08:00
parent 483721db8f
commit 7d3b72bd93
14 changed files with 1874 additions and 1336 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -73,6 +73,14 @@ public class PmsProductController {
return new CommonResult().pageSuccess(productList);
}
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public Object getList(String keyword) {
List<PmsProduct> productList = productService.list(keyword);
return new CommonResult().success(productList);
}
@ApiOperation("批量修改审核状态")
@RequestMapping(value = "/update/verifyStatus",method = RequestMethod.POST)
@ResponseBody

View File

@ -46,11 +46,28 @@ public interface PmsProductService {
@Transactional
int updateVerifyStatus(List<Long> ids, Integer verifyStatus, String detail);
/**
* 批量修改商品上架状态
*/
int updatePublishStatus(List<Long> ids, Integer publishStatus);
/**
* 批量修改商品推荐状态
*/
int updateRecommendStatus(List<Long> ids, Integer recommendStatus);
/**
* 批量修改新品状态
*/
int updateNewStatus(List<Long> ids, Integer newStatus);
/**
* 批量删除商品
*/
int updateDeleteStatus(List<Long> ids, Integer deleteStatus);
/**
* 根据商品名称或者货号模糊查询
*/
List<PmsProduct> list(String keyword);
}

View File

@ -248,6 +248,18 @@ public class PmsProductServiceImpl implements PmsProductService {
return productMapper.updateByExampleSelective(record, example);
}
@Override
public List<PmsProduct> list(String keyword) {
PmsProductExample productExample = new PmsProductExample();
PmsProductExample.Criteria criteria = productExample.createCriteria();
criteria.andDeleteStatusEqualTo(0);
if(!StringUtils.isEmpty(keyword)){
criteria.andNameLike("%" + keyword + "%");
productExample.or().andDeleteStatusEqualTo(0).andProductSnLike("%" + keyword + "%");
}
return productMapper.selectByExample(productExample);
}
/**
* @deprecated 旧版创建
*/

View File

@ -12,8 +12,12 @@
c.*,
cpr.id cpr_id,
cpr.product_id cpr_product_id,
cpr.product_name cpr_product_name,
cpr.product_sn cpr_product_sn,
cpcr.id cpcr_id,
cpcr.product_category_id cpcr_product_category_id
cpcr.product_category_id cpcr_product_category_id,
cpcr.product_category_name cpcr_product_category_name,
cpcr.parent_category_name cpcr_parent_category_name
FROM
sms_coupon c
LEFT JOIN sms_coupon_product_relation cpr ON c.id = cpr.coupon_id

View File

@ -2,10 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.dao.SmsCouponProductCategoryRelationDao">
<insert id="insertList">
INSERT INTO sms_coupon_product_category_relation (product_category_id,coupon_id) VALUES
INSERT INTO sms_coupon_product_category_relation (product_category_id,product_category_name,parent_category_name,coupon_id) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.productCategoryId,jdbcType=BIGINT},
#{item.couponId,jdbcType=INTEGER})
#{item.productCategoryName,jdbcType=VARCHAR},
#{item.parentCategoryName,jdbcType=VARCHAR},
#{item.couponId,jdbcType=BIGINT})
</foreach>
</insert>
</mapper>

View File

@ -2,9 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.dao.SmsCouponProductRelationDao">
<insert id="insertList">
INSERT INTO sms_coupon_product_relation (product_id,coupon_id) VALUES
INSERT INTO sms_coupon_product_relation (product_id,product_name,product_sn,coupon_id) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.productId,jdbcType=BIGINT},
#{item.productName,jdbcType=VARCHAR},
#{item.productSn,jdbcType=VARCHAR},
#{item.couponId,jdbcType=INTEGER})
</foreach>
</insert>

View File

@ -9,6 +9,20 @@ public class SmsCouponProductCategoryRelation implements Serializable {
private Long productCategoryId;
/**
* 产品分类名称
*
* @mbggenerated
*/
private String productCategoryName;
/**
* 父分类名称
*
* @mbggenerated
*/
private String parentCategoryName;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -35,6 +49,22 @@ public class SmsCouponProductCategoryRelation implements Serializable {
this.productCategoryId = productCategoryId;
}
public String getProductCategoryName() {
return productCategoryName;
}
public void setProductCategoryName(String productCategoryName) {
this.productCategoryName = productCategoryName;
}
public String getParentCategoryName() {
return parentCategoryName;
}
public void setParentCategoryName(String parentCategoryName) {
this.parentCategoryName = parentCategoryName;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -44,6 +74,8 @@ public class SmsCouponProductCategoryRelation implements Serializable {
sb.append(", id=").append(id);
sb.append(", couponId=").append(couponId);
sb.append(", productCategoryId=").append(productCategoryId);
sb.append(", productCategoryName=").append(productCategoryName);
sb.append(", parentCategoryName=").append(parentCategoryName);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -283,6 +283,146 @@ public class SmsCouponProductCategoryRelationExample {
addCriterion("product_category_id not between", value1, value2, "productCategoryId");
return (Criteria) this;
}
public Criteria andProductCategoryNameIsNull() {
addCriterion("product_category_name is null");
return (Criteria) this;
}
public Criteria andProductCategoryNameIsNotNull() {
addCriterion("product_category_name is not null");
return (Criteria) this;
}
public Criteria andProductCategoryNameEqualTo(String value) {
addCriterion("product_category_name =", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameNotEqualTo(String value) {
addCriterion("product_category_name <>", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameGreaterThan(String value) {
addCriterion("product_category_name >", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameGreaterThanOrEqualTo(String value) {
addCriterion("product_category_name >=", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameLessThan(String value) {
addCriterion("product_category_name <", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameLessThanOrEqualTo(String value) {
addCriterion("product_category_name <=", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameLike(String value) {
addCriterion("product_category_name like", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameNotLike(String value) {
addCriterion("product_category_name not like", value, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameIn(List<String> values) {
addCriterion("product_category_name in", values, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameNotIn(List<String> values) {
addCriterion("product_category_name not in", values, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameBetween(String value1, String value2) {
addCriterion("product_category_name between", value1, value2, "productCategoryName");
return (Criteria) this;
}
public Criteria andProductCategoryNameNotBetween(String value1, String value2) {
addCriterion("product_category_name not between", value1, value2, "productCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameIsNull() {
addCriterion("parent_category_name is null");
return (Criteria) this;
}
public Criteria andParentCategoryNameIsNotNull() {
addCriterion("parent_category_name is not null");
return (Criteria) this;
}
public Criteria andParentCategoryNameEqualTo(String value) {
addCriterion("parent_category_name =", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameNotEqualTo(String value) {
addCriterion("parent_category_name <>", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameGreaterThan(String value) {
addCriterion("parent_category_name >", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameGreaterThanOrEqualTo(String value) {
addCriterion("parent_category_name >=", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameLessThan(String value) {
addCriterion("parent_category_name <", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameLessThanOrEqualTo(String value) {
addCriterion("parent_category_name <=", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameLike(String value) {
addCriterion("parent_category_name like", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameNotLike(String value) {
addCriterion("parent_category_name not like", value, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameIn(List<String> values) {
addCriterion("parent_category_name in", values, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameNotIn(List<String> values) {
addCriterion("parent_category_name not in", values, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameBetween(String value1, String value2) {
addCriterion("parent_category_name between", value1, value2, "parentCategoryName");
return (Criteria) this;
}
public Criteria andParentCategoryNameNotBetween(String value1, String value2) {
addCriterion("parent_category_name not between", value1, value2, "parentCategoryName");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -9,6 +9,20 @@ public class SmsCouponProductRelation implements Serializable {
private Long productId;
/**
* 商品名称
*
* @mbggenerated
*/
private String productName;
/**
* 商品编码
*
* @mbggenerated
*/
private String productSn;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -35,6 +49,22 @@ public class SmsCouponProductRelation implements Serializable {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductSn() {
return productSn;
}
public void setProductSn(String productSn) {
this.productSn = productSn;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -44,6 +74,8 @@ public class SmsCouponProductRelation implements Serializable {
sb.append(", id=").append(id);
sb.append(", couponId=").append(couponId);
sb.append(", productId=").append(productId);
sb.append(", productName=").append(productName);
sb.append(", productSn=").append(productSn);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -283,6 +283,146 @@ public class SmsCouponProductRelationExample {
addCriterion("product_id not between", value1, value2, "productId");
return (Criteria) this;
}
public Criteria andProductNameIsNull() {
addCriterion("product_name is null");
return (Criteria) this;
}
public Criteria andProductNameIsNotNull() {
addCriterion("product_name is not null");
return (Criteria) this;
}
public Criteria andProductNameEqualTo(String value) {
addCriterion("product_name =", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotEqualTo(String value) {
addCriterion("product_name <>", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameGreaterThan(String value) {
addCriterion("product_name >", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameGreaterThanOrEqualTo(String value) {
addCriterion("product_name >=", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameLessThan(String value) {
addCriterion("product_name <", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameLessThanOrEqualTo(String value) {
addCriterion("product_name <=", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameLike(String value) {
addCriterion("product_name like", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotLike(String value) {
addCriterion("product_name not like", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameIn(List<String> values) {
addCriterion("product_name in", values, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotIn(List<String> values) {
addCriterion("product_name not in", values, "productName");
return (Criteria) this;
}
public Criteria andProductNameBetween(String value1, String value2) {
addCriterion("product_name between", value1, value2, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotBetween(String value1, String value2) {
addCriterion("product_name not between", value1, value2, "productName");
return (Criteria) this;
}
public Criteria andProductSnIsNull() {
addCriterion("product_sn is null");
return (Criteria) this;
}
public Criteria andProductSnIsNotNull() {
addCriterion("product_sn is not null");
return (Criteria) this;
}
public Criteria andProductSnEqualTo(String value) {
addCriterion("product_sn =", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnNotEqualTo(String value) {
addCriterion("product_sn <>", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnGreaterThan(String value) {
addCriterion("product_sn >", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnGreaterThanOrEqualTo(String value) {
addCriterion("product_sn >=", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnLessThan(String value) {
addCriterion("product_sn <", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnLessThanOrEqualTo(String value) {
addCriterion("product_sn <=", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnLike(String value) {
addCriterion("product_sn like", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnNotLike(String value) {
addCriterion("product_sn not like", value, "productSn");
return (Criteria) this;
}
public Criteria andProductSnIn(List<String> values) {
addCriterion("product_sn in", values, "productSn");
return (Criteria) this;
}
public Criteria andProductSnNotIn(List<String> values) {
addCriterion("product_sn not in", values, "productSn");
return (Criteria) this;
}
public Criteria andProductSnBetween(String value1, String value2) {
addCriterion("product_sn between", value1, value2, "productSn");
return (Criteria) this;
}
public Criteria andProductSnNotBetween(String value1, String value2) {
addCriterion("product_sn not between", value1, value2, "productSn");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -5,6 +5,8 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="product_category_id" jdbcType="BIGINT" property="productCategoryId" />
<result column="product_category_name" jdbcType="VARCHAR" property="productCategoryName" />
<result column="parent_category_name" jdbcType="VARCHAR" property="parentCategoryName" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -65,7 +67,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, coupon_id, product_category_id
id, coupon_id, product_category_id, product_category_name, parent_category_name
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.SmsCouponProductCategoryRelationExample" resultMap="BaseResultMap">
select
@ -101,8 +103,10 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sms_coupon_product_category_relation (coupon_id, product_category_id)
values (#{couponId,jdbcType=BIGINT}, #{productCategoryId,jdbcType=BIGINT})
insert into sms_coupon_product_category_relation (coupon_id, product_category_id, product_category_name,
parent_category_name)
values (#{couponId,jdbcType=BIGINT}, #{productCategoryId,jdbcType=BIGINT}, #{productCategoryName,jdbcType=VARCHAR},
#{parentCategoryName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.SmsCouponProductCategoryRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@ -116,6 +120,12 @@
<if test="productCategoryId != null">
product_category_id,
</if>
<if test="productCategoryName != null">
product_category_name,
</if>
<if test="parentCategoryName != null">
parent_category_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="couponId != null">
@ -124,6 +134,12 @@
<if test="productCategoryId != null">
#{productCategoryId,jdbcType=BIGINT},
</if>
<if test="productCategoryName != null">
#{productCategoryName,jdbcType=VARCHAR},
</if>
<if test="parentCategoryName != null">
#{parentCategoryName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.SmsCouponProductCategoryRelationExample" resultType="java.lang.Integer">
@ -144,6 +160,12 @@
<if test="record.productCategoryId != null">
product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
</if>
<if test="record.productCategoryName != null">
product_category_name = #{record.productCategoryName,jdbcType=VARCHAR},
</if>
<if test="record.parentCategoryName != null">
parent_category_name = #{record.parentCategoryName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -153,7 +175,9 @@
update sms_coupon_product_category_relation
set id = #{record.id,jdbcType=BIGINT},
coupon_id = #{record.couponId,jdbcType=BIGINT},
product_category_id = #{record.productCategoryId,jdbcType=BIGINT}
product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
product_category_name = #{record.productCategoryName,jdbcType=VARCHAR},
parent_category_name = #{record.parentCategoryName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -167,13 +191,21 @@
<if test="productCategoryId != null">
product_category_id = #{productCategoryId,jdbcType=BIGINT},
</if>
<if test="productCategoryName != null">
product_category_name = #{productCategoryName,jdbcType=VARCHAR},
</if>
<if test="parentCategoryName != null">
parent_category_name = #{parentCategoryName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.SmsCouponProductCategoryRelation">
update sms_coupon_product_category_relation
set coupon_id = #{couponId,jdbcType=BIGINT},
product_category_id = #{productCategoryId,jdbcType=BIGINT}
product_category_id = #{productCategoryId,jdbcType=BIGINT},
product_category_name = #{productCategoryName,jdbcType=VARCHAR},
parent_category_name = #{parentCategoryName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -5,6 +5,8 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="product_id" jdbcType="BIGINT" property="productId" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="product_sn" jdbcType="VARCHAR" property="productSn" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -65,7 +67,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, coupon_id, product_id
id, coupon_id, product_id, product_name, product_sn
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.SmsCouponProductRelationExample" resultMap="BaseResultMap">
select
@ -101,8 +103,10 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sms_coupon_product_relation (coupon_id, product_id)
values (#{couponId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT})
insert into sms_coupon_product_relation (coupon_id, product_id, product_name,
product_sn)
values (#{couponId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT}, #{productName,jdbcType=VARCHAR},
#{productSn,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.SmsCouponProductRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@ -116,6 +120,12 @@
<if test="productId != null">
product_id,
</if>
<if test="productName != null">
product_name,
</if>
<if test="productSn != null">
product_sn,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="couponId != null">
@ -124,6 +134,12 @@
<if test="productId != null">
#{productId,jdbcType=BIGINT},
</if>
<if test="productName != null">
#{productName,jdbcType=VARCHAR},
</if>
<if test="productSn != null">
#{productSn,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.SmsCouponProductRelationExample" resultType="java.lang.Integer">
@ -144,6 +160,12 @@
<if test="record.productId != null">
product_id = #{record.productId,jdbcType=BIGINT},
</if>
<if test="record.productName != null">
product_name = #{record.productName,jdbcType=VARCHAR},
</if>
<if test="record.productSn != null">
product_sn = #{record.productSn,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -153,7 +175,9 @@
update sms_coupon_product_relation
set id = #{record.id,jdbcType=BIGINT},
coupon_id = #{record.couponId,jdbcType=BIGINT},
product_id = #{record.productId,jdbcType=BIGINT}
product_id = #{record.productId,jdbcType=BIGINT},
product_name = #{record.productName,jdbcType=VARCHAR},
product_sn = #{record.productSn,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -167,13 +191,21 @@
<if test="productId != null">
product_id = #{productId,jdbcType=BIGINT},
</if>
<if test="productName != null">
product_name = #{productName,jdbcType=VARCHAR},
</if>
<if test="productSn != null">
product_sn = #{productSn,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.SmsCouponProductRelation">
update sms_coupon_product_relation
set coupon_id = #{couponId,jdbcType=BIGINT},
product_id = #{productId,jdbcType=BIGINT}
product_id = #{productId,jdbcType=BIGINT},
product_name = #{productName,jdbcType=VARCHAR},
product_sn = #{productSn,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>