proj_name
stringclasses 131
values | relative_path
stringlengths 30
228
| class_name
stringlengths 1
68
| func_name
stringlengths 1
48
| masked_class
stringlengths 78
9.82k
| func_body
stringlengths 46
9.61k
| len_input
int64 29
2.01k
| len_output
int64 14
1.94k
| total
int64 55
2.05k
| relevant_context
stringlengths 0
38.4k
|
|---|---|---|---|---|---|---|---|---|---|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberLoginLog.java
|
UmsMemberLoginLog
|
toString
|
class UmsMemberLoginLog implements Serializable {
private Long id;
private Long memberId;
private Date createTime;
private String ip;
private String city;
@ApiModelProperty(value = "登录类型:0->PC;1->android;2->ios;3->小程序")
private Integer loginType;
private String province;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public Integer getLoginType() {
return loginType;
}
public void setLoginType(Integer loginType) {
this.loginType = loginType;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", createTime=").append(createTime);
sb.append(", ip=").append(ip);
sb.append(", city=").append(city);
sb.append(", loginType=").append(loginType);
sb.append(", province=").append(province);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 442
| 187
| 629
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberMemberTagRelation.java
|
UmsMemberMemberTagRelation
|
toString
|
class UmsMemberMemberTagRelation implements Serializable {
private Long id;
private Long memberId;
private Long tagId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getTagId() {
return tagId;
}
public void setTagId(Long tagId) {
this.tagId = tagId;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", tagId=").append(tagId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 208
| 128
| 336
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberMemberTagRelationExample.java
|
GeneratedCriteria
|
addCriterion
|
class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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) {<FILL_FUNCTION_BODY>}
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 andMemberIdIsNull() {
addCriterion("member_id is null");
return (Criteria) this;
}
public Criteria andMemberIdIsNotNull() {
addCriterion("member_id is not null");
return (Criteria) this;
}
public Criteria andMemberIdEqualTo(Long value) {
addCriterion("member_id =", value, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdNotEqualTo(Long value) {
addCriterion("member_id <>", value, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdGreaterThan(Long value) {
addCriterion("member_id >", value, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdGreaterThanOrEqualTo(Long value) {
addCriterion("member_id >=", value, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdLessThan(Long value) {
addCriterion("member_id <", value, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdLessThanOrEqualTo(Long value) {
addCriterion("member_id <=", value, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdIn(List<Long> values) {
addCriterion("member_id in", values, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdNotIn(List<Long> values) {
addCriterion("member_id not in", values, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdBetween(Long value1, Long value2) {
addCriterion("member_id between", value1, value2, "memberId");
return (Criteria) this;
}
public Criteria andMemberIdNotBetween(Long value1, Long value2) {
addCriterion("member_id not between", value1, value2, "memberId");
return (Criteria) this;
}
public Criteria andTagIdIsNull() {
addCriterion("tag_id is null");
return (Criteria) this;
}
public Criteria andTagIdIsNotNull() {
addCriterion("tag_id is not null");
return (Criteria) this;
}
public Criteria andTagIdEqualTo(Long value) {
addCriterion("tag_id =", value, "tagId");
return (Criteria) this;
}
public Criteria andTagIdNotEqualTo(Long value) {
addCriterion("tag_id <>", value, "tagId");
return (Criteria) this;
}
public Criteria andTagIdGreaterThan(Long value) {
addCriterion("tag_id >", value, "tagId");
return (Criteria) this;
}
public Criteria andTagIdGreaterThanOrEqualTo(Long value) {
addCriterion("tag_id >=", value, "tagId");
return (Criteria) this;
}
public Criteria andTagIdLessThan(Long value) {
addCriterion("tag_id <", value, "tagId");
return (Criteria) this;
}
public Criteria andTagIdLessThanOrEqualTo(Long value) {
addCriterion("tag_id <=", value, "tagId");
return (Criteria) this;
}
public Criteria andTagIdIn(List<Long> values) {
addCriterion("tag_id in", values, "tagId");
return (Criteria) this;
}
public Criteria andTagIdNotIn(List<Long> values) {
addCriterion("tag_id not in", values, "tagId");
return (Criteria) this;
}
public Criteria andTagIdBetween(Long value1, Long value2) {
addCriterion("tag_id between", value1, value2, "tagId");
return (Criteria) this;
}
public Criteria andTagIdNotBetween(Long value1, Long value2) {
addCriterion("tag_id not between", value1, value2, "tagId");
return (Criteria) this;
}
}
|
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
| 1,967
| 60
| 2,027
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberProductCategoryRelation.java
|
UmsMemberProductCategoryRelation
|
toString
|
class UmsMemberProductCategoryRelation implements Serializable {
private Long id;
private Long memberId;
private Long productCategoryId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getProductCategoryId() {
return productCategoryId;
}
public void setProductCategoryId(Long productCategoryId) {
this.productCategoryId = productCategoryId;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", productCategoryId=").append(productCategoryId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 215
| 130
| 345
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberReceiveAddress.java
|
UmsMemberReceiveAddress
|
toString
|
class UmsMemberReceiveAddress implements Serializable {
private Long id;
private Long memberId;
@ApiModelProperty(value = "收货人名称")
private String name;
private String phoneNumber;
@ApiModelProperty(value = "是否为默认")
private Integer defaultStatus;
@ApiModelProperty(value = "邮政编码")
private String postCode;
@ApiModelProperty(value = "省份/直辖市")
private String province;
@ApiModelProperty(value = "城市")
private String city;
@ApiModelProperty(value = "区")
private String region;
@ApiModelProperty(value = "详细地址(街道)")
private String detailAddress;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Integer getDefaultStatus() {
return defaultStatus;
}
public void setDefaultStatus(Integer defaultStatus) {
this.defaultStatus = defaultStatus;
}
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getDetailAddress() {
return detailAddress;
}
public void setDetailAddress(String detailAddress) {
this.detailAddress = detailAddress;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", name=").append(name);
sb.append(", phoneNumber=").append(phoneNumber);
sb.append(", defaultStatus=").append(defaultStatus);
sb.append(", postCode=").append(postCode);
sb.append(", province=").append(province);
sb.append(", city=").append(city);
sb.append(", region=").append(region);
sb.append(", detailAddress=").append(detailAddress);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 663
| 233
| 896
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberRuleSetting.java
|
UmsMemberRuleSetting
|
toString
|
class UmsMemberRuleSetting implements Serializable {
private Long id;
@ApiModelProperty(value = "连续签到天数")
private Integer continueSignDay;
@ApiModelProperty(value = "连续签到赠送数量")
private Integer continueSignPoint;
@ApiModelProperty(value = "每消费多少元获取1个点")
private BigDecimal consumePerPoint;
@ApiModelProperty(value = "最低获取点数的订单金额")
private BigDecimal lowOrderAmount;
@ApiModelProperty(value = "每笔订单最高获取点数")
private Integer maxPointPerOrder;
@ApiModelProperty(value = "类型:0->积分规则;1->成长值规则")
private Integer type;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getContinueSignDay() {
return continueSignDay;
}
public void setContinueSignDay(Integer continueSignDay) {
this.continueSignDay = continueSignDay;
}
public Integer getContinueSignPoint() {
return continueSignPoint;
}
public void setContinueSignPoint(Integer continueSignPoint) {
this.continueSignPoint = continueSignPoint;
}
public BigDecimal getConsumePerPoint() {
return consumePerPoint;
}
public void setConsumePerPoint(BigDecimal consumePerPoint) {
this.consumePerPoint = consumePerPoint;
}
public BigDecimal getLowOrderAmount() {
return lowOrderAmount;
}
public void setLowOrderAmount(BigDecimal lowOrderAmount) {
this.lowOrderAmount = lowOrderAmount;
}
public Integer getMaxPointPerOrder() {
return maxPointPerOrder;
}
public void setMaxPointPerOrder(Integer maxPointPerOrder) {
this.maxPointPerOrder = maxPointPerOrder;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", continueSignDay=").append(continueSignDay);
sb.append(", continueSignPoint=").append(continueSignPoint);
sb.append(", consumePerPoint=").append(consumePerPoint);
sb.append(", lowOrderAmount=").append(lowOrderAmount);
sb.append(", maxPointPerOrder=").append(maxPointPerOrder);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 593
| 203
| 796
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberStatisticsInfo.java
|
UmsMemberStatisticsInfo
|
toString
|
class UmsMemberStatisticsInfo implements Serializable {
private Long id;
private Long memberId;
@ApiModelProperty(value = "累计消费金额")
private BigDecimal consumeAmount;
@ApiModelProperty(value = "订单数量")
private Integer orderCount;
@ApiModelProperty(value = "优惠券数量")
private Integer couponCount;
@ApiModelProperty(value = "评价数")
private Integer commentCount;
@ApiModelProperty(value = "退货数量")
private Integer returnOrderCount;
@ApiModelProperty(value = "登录次数")
private Integer loginCount;
@ApiModelProperty(value = "关注数量")
private Integer attendCount;
@ApiModelProperty(value = "粉丝数量")
private Integer fansCount;
private Integer collectProductCount;
private Integer collectSubjectCount;
private Integer collectTopicCount;
private Integer collectCommentCount;
private Integer inviteFriendCount;
@ApiModelProperty(value = "最后一次下订单时间")
private Date recentOrderTime;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public BigDecimal getConsumeAmount() {
return consumeAmount;
}
public void setConsumeAmount(BigDecimal consumeAmount) {
this.consumeAmount = consumeAmount;
}
public Integer getOrderCount() {
return orderCount;
}
public void setOrderCount(Integer orderCount) {
this.orderCount = orderCount;
}
public Integer getCouponCount() {
return couponCount;
}
public void setCouponCount(Integer couponCount) {
this.couponCount = couponCount;
}
public Integer getCommentCount() {
return commentCount;
}
public void setCommentCount(Integer commentCount) {
this.commentCount = commentCount;
}
public Integer getReturnOrderCount() {
return returnOrderCount;
}
public void setReturnOrderCount(Integer returnOrderCount) {
this.returnOrderCount = returnOrderCount;
}
public Integer getLoginCount() {
return loginCount;
}
public void setLoginCount(Integer loginCount) {
this.loginCount = loginCount;
}
public Integer getAttendCount() {
return attendCount;
}
public void setAttendCount(Integer attendCount) {
this.attendCount = attendCount;
}
public Integer getFansCount() {
return fansCount;
}
public void setFansCount(Integer fansCount) {
this.fansCount = fansCount;
}
public Integer getCollectProductCount() {
return collectProductCount;
}
public void setCollectProductCount(Integer collectProductCount) {
this.collectProductCount = collectProductCount;
}
public Integer getCollectSubjectCount() {
return collectSubjectCount;
}
public void setCollectSubjectCount(Integer collectSubjectCount) {
this.collectSubjectCount = collectSubjectCount;
}
public Integer getCollectTopicCount() {
return collectTopicCount;
}
public void setCollectTopicCount(Integer collectTopicCount) {
this.collectTopicCount = collectTopicCount;
}
public Integer getCollectCommentCount() {
return collectCommentCount;
}
public void setCollectCommentCount(Integer collectCommentCount) {
this.collectCommentCount = collectCommentCount;
}
public Integer getInviteFriendCount() {
return inviteFriendCount;
}
public void setInviteFriendCount(Integer inviteFriendCount) {
this.inviteFriendCount = inviteFriendCount;
}
public Date getRecentOrderTime() {
return recentOrderTime;
}
public void setRecentOrderTime(Date recentOrderTime) {
this.recentOrderTime = recentOrderTime;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", consumeAmount=").append(consumeAmount);
sb.append(", orderCount=").append(orderCount);
sb.append(", couponCount=").append(couponCount);
sb.append(", commentCount=").append(commentCount);
sb.append(", returnOrderCount=").append(returnOrderCount);
sb.append(", loginCount=").append(loginCount);
sb.append(", attendCount=").append(attendCount);
sb.append(", fansCount=").append(fansCount);
sb.append(", collectProductCount=").append(collectProductCount);
sb.append(", collectSubjectCount=").append(collectSubjectCount);
sb.append(", collectTopicCount=").append(collectTopicCount);
sb.append(", collectCommentCount=").append(collectCommentCount);
sb.append(", inviteFriendCount=").append(inviteFriendCount);
sb.append(", recentOrderTime=").append(recentOrderTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 1,116
| 358
| 1,474
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberTag.java
|
UmsMemberTag
|
toString
|
class UmsMemberTag implements Serializable {
private Long id;
private String name;
@ApiModelProperty(value = "自动打标签完成订单数量")
private Integer finishOrderCount;
@ApiModelProperty(value = "自动打标签完成订单金额")
private BigDecimal finishOrderAmount;
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 Integer getFinishOrderCount() {
return finishOrderCount;
}
public void setFinishOrderCount(Integer finishOrderCount) {
this.finishOrderCount = finishOrderCount;
}
public BigDecimal getFinishOrderAmount() {
return finishOrderAmount;
}
public void setFinishOrderAmount(BigDecimal finishOrderAmount) {
this.finishOrderAmount = finishOrderAmount;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
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(", finishOrderCount=").append(finishOrderCount);
sb.append(", finishOrderAmount=").append(finishOrderAmount);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 316
| 148
| 464
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMemberTask.java
|
UmsMemberTask
|
toString
|
class UmsMemberTask implements Serializable {
private Long id;
private String name;
@ApiModelProperty(value = "赠送成长值")
private Integer growth;
@ApiModelProperty(value = "赠送积分")
private Integer intergration;
@ApiModelProperty(value = "任务类型:0->新手任务;1->日常任务")
private Integer type;
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 Integer getGrowth() {
return growth;
}
public void setGrowth(Integer growth) {
this.growth = growth;
}
public Integer getIntergration() {
return intergration;
}
public void setIntergration(Integer intergration) {
this.intergration = intergration;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
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(", growth=").append(growth);
sb.append(", intergration=").append(intergration);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 361
| 157
| 518
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsMenu.java
|
UmsMenu
|
toString
|
class UmsMenu implements Serializable {
private Long id;
@ApiModelProperty(value = "父级ID")
private Long parentId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "菜单名称")
private String title;
@ApiModelProperty(value = "菜单级数")
private Integer level;
@ApiModelProperty(value = "菜单排序")
private Integer sort;
@ApiModelProperty(value = "前端名称")
private String name;
@ApiModelProperty(value = "前端图标")
private String icon;
@ApiModelProperty(value = "前端隐藏")
private Integer hidden;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getHidden() {
return hidden;
}
public void setHidden(Integer hidden) {
this.hidden = hidden;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", parentId=").append(parentId);
sb.append(", createTime=").append(createTime);
sb.append(", title=").append(title);
sb.append(", level=").append(level);
sb.append(", sort=").append(sort);
sb.append(", name=").append(name);
sb.append(", icon=").append(icon);
sb.append(", hidden=").append(hidden);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 605
| 212
| 817
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsPermission.java
|
UmsPermission
|
toString
|
class UmsPermission implements Serializable {
private Long id;
@ApiModelProperty(value = "父级权限id")
private Long pid;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "权限值")
private String value;
@ApiModelProperty(value = "图标")
private String icon;
@ApiModelProperty(value = "权限类型:0->目录;1->菜单;2->按钮(接口绑定权限)")
private Integer type;
@ApiModelProperty(value = "前端资源路径")
private String uri;
@ApiModelProperty(value = "启用状态;0->禁用;1->启用")
private Integer status;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "排序")
private Integer sort;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPid() {
return pid;
}
public void setPid(Long pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
sb.append(", value=").append(value);
sb.append(", icon=").append(icon);
sb.append(", type=").append(type);
sb.append(", uri=").append(uri);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", sort=").append(sort);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 697
| 224
| 921
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsResource.java
|
UmsResource
|
toString
|
class UmsResource implements Serializable {
private Long id;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty(value = "资源URL")
private String url;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "资源分类ID")
private Long categoryId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", createTime=").append(createTime);
sb.append(", name=").append(name);
sb.append(", url=").append(url);
sb.append(", description=").append(description);
sb.append(", categoryId=").append(categoryId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 412
| 170
| 582
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsResourceCategory.java
|
UmsResourceCategory
|
toString
|
class UmsResourceCategory implements Serializable {
private Long id;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "分类名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", createTime=").append(createTime);
sb.append(", name=").append(name);
sb.append(", sort=").append(sort);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 285
| 140
| 425
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsRole.java
|
UmsRole
|
toString
|
class UmsRole implements Serializable {
private Long id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "后台用户数量")
private Integer adminCount;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "启用状态:0->禁用;1->启用")
private Integer status;
private Integer sort;
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 getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getAdminCount() {
return adminCount;
}
public void setAdminCount(Integer adminCount) {
this.adminCount = adminCount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
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(", description=").append(description);
sb.append(", adminCount=").append(adminCount);
sb.append(", createTime=").append(createTime);
sb.append(", status=").append(status);
sb.append(", sort=").append(sort);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 473
| 184
| 657
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsRoleMenuRelation.java
|
UmsRoleMenuRelation
|
toString
|
class UmsRoleMenuRelation implements Serializable {
private Long id;
@ApiModelProperty(value = "角色ID")
private Long roleId;
@ApiModelProperty(value = "菜单ID")
private Long menuId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", roleId=").append(roleId);
sb.append(", menuId=").append(menuId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 234
| 128
| 362
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsRoleMenuRelationExample.java
|
GeneratedCriteria
|
addCriterion
|
class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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) {<FILL_FUNCTION_BODY>}
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 andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Long value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Long value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Long value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Long value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Long value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Long value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Long> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Long> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Long value1, Long value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Long value1, Long value2) {
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andMenuIdIsNull() {
addCriterion("menu_id is null");
return (Criteria) this;
}
public Criteria andMenuIdIsNotNull() {
addCriterion("menu_id is not null");
return (Criteria) this;
}
public Criteria andMenuIdEqualTo(Long value) {
addCriterion("menu_id =", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotEqualTo(Long value) {
addCriterion("menu_id <>", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdGreaterThan(Long value) {
addCriterion("menu_id >", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdGreaterThanOrEqualTo(Long value) {
addCriterion("menu_id >=", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdLessThan(Long value) {
addCriterion("menu_id <", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdLessThanOrEqualTo(Long value) {
addCriterion("menu_id <=", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdIn(List<Long> values) {
addCriterion("menu_id in", values, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotIn(List<Long> values) {
addCriterion("menu_id not in", values, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdBetween(Long value1, Long value2) {
addCriterion("menu_id between", value1, value2, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotBetween(Long value1, Long value2) {
addCriterion("menu_id not between", value1, value2, "menuId");
return (Criteria) this;
}
}
|
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
| 1,979
| 48
| 2,027
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsRolePermissionRelation.java
|
UmsRolePermissionRelation
|
toString
|
class UmsRolePermissionRelation implements Serializable {
private Long id;
private Long roleId;
private Long permissionId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getPermissionId() {
return permissionId;
}
public void setPermissionId(Long permissionId) {
this.permissionId = permissionId;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", roleId=").append(roleId);
sb.append(", permissionId=").append(permissionId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 207
| 128
| 335
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsRolePermissionRelationExample.java
|
GeneratedCriteria
|
andRoleIdNotBetween
|
class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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 andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Long value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Long value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Long value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Long value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Long value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Long value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Long> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Long> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Long value1, Long value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Long value1, Long value2) {<FILL_FUNCTION_BODY>}
public Criteria andPermissionIdIsNull() {
addCriterion("permission_id is null");
return (Criteria) this;
}
public Criteria andPermissionIdIsNotNull() {
addCriterion("permission_id is not null");
return (Criteria) this;
}
public Criteria andPermissionIdEqualTo(Long value) {
addCriterion("permission_id =", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdNotEqualTo(Long value) {
addCriterion("permission_id <>", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdGreaterThan(Long value) {
addCriterion("permission_id >", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdGreaterThanOrEqualTo(Long value) {
addCriterion("permission_id >=", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdLessThan(Long value) {
addCriterion("permission_id <", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdLessThanOrEqualTo(Long value) {
addCriterion("permission_id <=", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdIn(List<Long> values) {
addCriterion("permission_id in", values, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdNotIn(List<Long> values) {
addCriterion("permission_id not in", values, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdBetween(Long value1, Long value2) {
addCriterion("permission_id between", value1, value2, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdNotBetween(Long value1, Long value2) {
addCriterion("permission_id not between", value1, value2, "permissionId");
return (Criteria) this;
}
}
|
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
| 1,992
| 35
| 2,027
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsRoleResourceRelation.java
|
UmsRoleResourceRelation
|
toString
|
class UmsRoleResourceRelation implements Serializable {
private Long id;
@ApiModelProperty(value = "角色ID")
private Long roleId;
@ApiModelProperty(value = "资源ID")
private Long resourceId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getResourceId() {
return resourceId;
}
public void setResourceId(Long resourceId) {
this.resourceId = resourceId;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", roleId=").append(roleId);
sb.append(", resourceId=").append(resourceId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
| 233
| 128
| 361
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-mbg/src/main/java/com/macro/mall/model/UmsRoleResourceRelationExample.java
|
GeneratedCriteria
|
andIdNotBetween
|
class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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) {<FILL_FUNCTION_BODY>}
public Criteria andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Long value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Long value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Long value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Long value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Long value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Long value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Long> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Long> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Long value1, Long value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Long value1, Long value2) {
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andResourceIdIsNull() {
addCriterion("resource_id is null");
return (Criteria) this;
}
public Criteria andResourceIdIsNotNull() {
addCriterion("resource_id is not null");
return (Criteria) this;
}
public Criteria andResourceIdEqualTo(Long value) {
addCriterion("resource_id =", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotEqualTo(Long value) {
addCriterion("resource_id <>", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdGreaterThan(Long value) {
addCriterion("resource_id >", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdGreaterThanOrEqualTo(Long value) {
addCriterion("resource_id >=", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdLessThan(Long value) {
addCriterion("resource_id <", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdLessThanOrEqualTo(Long value) {
addCriterion("resource_id <=", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdIn(List<Long> values) {
addCriterion("resource_id in", values, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotIn(List<Long> values) {
addCriterion("resource_id not in", values, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdBetween(Long value1, Long value2) {
addCriterion("resource_id between", value1, value2, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotBetween(Long value1, Long value2) {
addCriterion("resource_id not between", value1, value2, "resourceId");
return (Criteria) this;
}
}
|
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
| 1,995
| 32
| 2,027
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-monitor/src/main/java/com/macro/mall/config/SecuritySecureConfig.java
|
SecuritySecureConfig
|
configure
|
class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
@Override
protected void configure(HttpSecurity http) throws Exception {<FILL_FUNCTION_BODY>}
}
|
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/");
http.authorizeRequests()
//1.配置所有静态资源和登录页可以公开访问
.antMatchers(adminContextPath + "/assets/**").permitAll()
.antMatchers(adminContextPath + "/login").permitAll()
.anyRequest().authenticated()
.and()
//2.配置登录和登出路径
.formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and()
.logout().logoutUrl(adminContextPath + "/logout").and()
//3.开启http basic支持,admin-client注册时需要使用
.httpBasic().and()
.csrf()
//4.开启基于cookie的csrf保护
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
//5.忽略这些路径的csrf保护以便admin-client注册
.ignoringAntMatchers(
adminContextPath + "/instances",
adminContextPath + "/actuator/**"
);
| 91
| 312
| 403
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/component/CancelOrderSender.java
|
CancelOrderSender
|
sendMessage
|
class CancelOrderSender {
private static Logger LOGGER =LoggerFactory.getLogger(CancelOrderSender.class);
@Autowired
private AmqpTemplate amqpTemplate;
public void sendMessage(Long orderId,final long delayTimes){<FILL_FUNCTION_BODY>}
}
|
//给延迟队列发送消息
amqpTemplate.convertAndSend(QueueEnum.QUEUE_TTL_ORDER_CANCEL.getExchange(), QueueEnum.QUEUE_TTL_ORDER_CANCEL.getRouteKey(), orderId, new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws AmqpException {
//给消息设置延迟毫秒值
message.getMessageProperties().setExpiration(String.valueOf(delayTimes));
return message;
}
});
LOGGER.info("send orderId:{}",orderId);
| 79
| 151
| 230
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/config/JacksonConfig.java
|
JacksonConfig
|
jacksonObjectMapper
|
class JacksonConfig {
@Bean
@Primary
@ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {<FILL_FUNCTION_BODY>}
}
|
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
// 通过该方法对mapper对象进行设置,所有序列化的对象都将按改规则进行系列化
// Include.Include.ALWAYS 默认
// Include.NON_DEFAULT 属性为默认值不序列化
// Include.NON_EMPTY 属性为 空("") 或者为 NULL 都不序列化,则返回的json是没有这个字段的。这样对移动端会更省流量
// Include.NON_NULL 属性为NULL 不序列化,就是为null的字段不参加序列化
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
// 字段保留,将null值转为""
// objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>()
// {
// @Override
// public void serialize(Object o, JsonGenerator jsonGenerator,
// SerializerProvider serializerProvider)
// throws IOException, JsonProcessingException
// {
// jsonGenerator.writeString("");
// }
// });
return objectMapper;
| 60
| 303
| 363
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/config/SwaggerConfig.java
|
SwaggerConfig
|
swaggerProperties
|
class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {<FILL_FUNCTION_BODY>}
@Bean
public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return generateBeanPostProcessor();
}
}
|
return SwaggerProperties.builder()
.apiBasePackage("com.macro.mall.portal.controller")
.title("mall前台系统")
.description("mall前台相关接口文档")
.contactName("macro")
.version("1.0")
.enableSecurity(true)
.build();
| 74
| 89
| 163
|
<methods>public non-sealed void <init>() ,public Docket createRestApi() ,public BeanPostProcessor generateBeanPostProcessor() ,public abstract com.macro.mall.common.domain.SwaggerProperties swaggerProperties() <variables>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/AlipayController.java
|
AlipayController
|
notify
|
class AlipayController {
@Autowired
private AlipayConfig alipayConfig;
@Autowired
private AlipayService alipayService;
@ApiOperation("支付宝电脑网站支付")
@RequestMapping(value = "/pay", method = RequestMethod.GET)
public void pay(AliPayParam aliPayParam, HttpServletResponse response) throws IOException {
response.setContentType("text/html;charset=" + alipayConfig.getCharset());
response.getWriter().write(alipayService.pay(aliPayParam));
response.getWriter().flush();
response.getWriter().close();
}
@ApiOperation("支付宝手机网站支付")
@RequestMapping(value = "/webPay", method = RequestMethod.GET)
public void webPay(AliPayParam aliPayParam, HttpServletResponse response) throws IOException {
response.setContentType("text/html;charset=" + alipayConfig.getCharset());
response.getWriter().write(alipayService.webPay(aliPayParam));
response.getWriter().flush();
response.getWriter().close();
}
@ApiOperation(value = "支付宝异步回调",notes = "必须为POST请求,执行成功返回success,执行失败返回failure")
@RequestMapping(value = "/notify", method = RequestMethod.POST)
public String notify(HttpServletRequest request){<FILL_FUNCTION_BODY>}
@ApiOperation(value = "支付宝统一收单线下交易查询",notes = "订单支付成功返回交易状态:TRADE_SUCCESS")
@RequestMapping(value = "/query", method = RequestMethod.GET)
@ResponseBody
public CommonResult<String> query(String outTradeNo, String tradeNo){
return CommonResult.success(alipayService.query(outTradeNo,tradeNo));
}
}
|
Map<String, String> params = new HashMap<>();
Map<String, String[]> requestParams = request.getParameterMap();
for (String name : requestParams.keySet()) {
params.put(name, request.getParameter(name));
}
return alipayService.notify(params);
| 477
| 80
| 557
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/MemberAttentionController.java
|
MemberAttentionController
|
delete
|
class MemberAttentionController {
@Autowired
private MemberAttentionService memberAttentionService;
@ApiOperation("添加品牌关注")
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody MemberBrandAttention memberBrandAttention) {
int count = memberAttentionService.add(memberBrandAttention);
if(count>0){
return CommonResult.success(count);
}else{
return CommonResult.failed();
}
}
@ApiOperation("取消关注")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(Long brandId) {<FILL_FUNCTION_BODY>}
@ApiOperation("显示关注列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<MemberBrandAttention>> list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
Page<MemberBrandAttention> page = memberAttentionService.list(pageNum,pageSize);
return CommonResult.success(CommonPage.restPage(page));
}
@ApiOperation("显示关注品牌详情")
@RequestMapping(value = "/detail", method = RequestMethod.GET)
@ResponseBody
public CommonResult<MemberBrandAttention> detail(@RequestParam Long brandId) {
MemberBrandAttention memberBrandAttention = memberAttentionService.detail(brandId);
return CommonResult.success(memberBrandAttention);
}
@ApiOperation("清空关注列表")
@RequestMapping(value = "/clear", method = RequestMethod.POST)
@ResponseBody
public CommonResult clear() {
memberAttentionService.clear();
return CommonResult.success(null);
}
}
|
int count = memberAttentionService.delete(brandId);
if(count>0){
return CommonResult.success(count);
}else{
return CommonResult.failed();
}
| 495
| 52
| 547
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/MemberProductCollectionController.java
|
MemberProductCollectionController
|
delete
|
class MemberProductCollectionController {
@Autowired
private MemberCollectionService memberCollectionService;
@ApiOperation("添加商品收藏")
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody MemberProductCollection productCollection) {
int count = memberCollectionService.add(productCollection);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("删除收藏商品")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(Long productId) {<FILL_FUNCTION_BODY>}
@ApiOperation("显示收藏列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<MemberProductCollection>> list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
Page<MemberProductCollection> page = memberCollectionService.list(pageNum,pageSize);
return CommonResult.success(CommonPage.restPage(page));
}
@ApiOperation("显示收藏商品详情")
@RequestMapping(value = "/detail", method = RequestMethod.GET)
@ResponseBody
public CommonResult<MemberProductCollection> detail(@RequestParam Long productId) {
MemberProductCollection memberProductCollection = memberCollectionService.detail(productId);
return CommonResult.success(memberProductCollection);
}
@ApiOperation("清空收藏列表")
@RequestMapping(value = "/clear", method = RequestMethod.POST)
@ResponseBody
public CommonResult clear() {
memberCollectionService.clear();
return CommonResult.success(null);
}
}
|
int count = memberCollectionService.delete(productId);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 473
| 52
| 525
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/MemberReadHistoryController.java
|
MemberReadHistoryController
|
delete
|
class MemberReadHistoryController {
@Autowired
private MemberReadHistoryService memberReadHistoryService;
@ApiOperation("创建浏览记录")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody MemberReadHistory memberReadHistory) {
int count = memberReadHistoryService.create(memberReadHistory);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("删除浏览记录")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<String> ids) {<FILL_FUNCTION_BODY>}
@ApiOperation("清空除浏览记录")
@RequestMapping(value = "/clear", method = RequestMethod.POST)
@ResponseBody
public CommonResult clear() {
memberReadHistoryService.clear();
return CommonResult.success(null);
}
@ApiOperation("分页获取用户浏览记录")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<MemberReadHistory>> list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
Page<MemberReadHistory> page = memberReadHistoryService.list(pageNum, pageSize);
return CommonResult.success(CommonPage.restPage(page));
}
}
|
int count = memberReadHistoryService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 410
| 52
| 462
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java
|
OmsCartItemController
|
delete
|
class OmsCartItemController {
@Autowired
private OmsCartItemService cartItemService;
@Autowired
private UmsMemberService memberService;
@ApiOperation("添加商品到购物车")
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody OmsCartItem cartItem) {
int count = cartItemService.add(cartItem);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取某个会员的购物车列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<OmsCartItem>> list() {
List<OmsCartItem> cartItemList = cartItemService.list(memberService.getCurrentMember().getId());
return CommonResult.success(cartItemList);
}
@ApiOperation("获取某个会员的购物车列表,包括促销信息")
@RequestMapping(value = "/list/promotion", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<CartPromotionItem>> listPromotion(@RequestParam(required = false) List<Long> cartIds) {
List<CartPromotionItem> cartPromotionItemList = cartItemService.listPromotion(memberService.getCurrentMember().getId(), cartIds);
return CommonResult.success(cartPromotionItemList);
}
@ApiOperation("修改购物车中某个商品的数量")
@RequestMapping(value = "/update/quantity", method = RequestMethod.GET)
@ResponseBody
public CommonResult updateQuantity(@RequestParam Long id,
@RequestParam Integer quantity) {
int count = cartItemService.updateQuantity(id, memberService.getCurrentMember().getId(), quantity);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取购物车中某个商品的规格,用于重选规格")
@RequestMapping(value = "/getProduct/{productId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CartProduct> getCartProduct(@PathVariable Long productId) {
CartProduct cartProduct = cartItemService.getCartProduct(productId);
return CommonResult.success(cartProduct);
}
@ApiOperation("修改购物车中商品的规格")
@RequestMapping(value = "/update/attr", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateAttr(@RequestBody OmsCartItem cartItem) {
int count = cartItemService.updateAttr(cartItem);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除购物车中的某个商品")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {<FILL_FUNCTION_BODY>}
@ApiOperation("清空购物车")
@RequestMapping(value = "/clear", method = RequestMethod.POST)
@ResponseBody
public CommonResult clear() {
int count = cartItemService.clear(memberService.getCurrentMember().getId());
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
}
|
int count = cartItemService.delete(memberService.getCurrentMember().getId(), ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 880
| 56
| 936
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsPortalOrderReturnApplyController.java
|
OmsPortalOrderReturnApplyController
|
create
|
class OmsPortalOrderReturnApplyController {
@Autowired
private OmsPortalOrderReturnApplyService returnApplyService;
@ApiOperation("申请退货")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody OmsOrderReturnApplyParam returnApply) {<FILL_FUNCTION_BODY>}
}
|
int count = returnApplyService.create(returnApply);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 99
| 47
| 146
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/PmsPortalProductController.java
|
PmsPortalProductController
|
search
|
class PmsPortalProductController {
@Autowired
private PmsPortalProductService portalProductService;
@ApiOperation(value = "综合搜索、筛选、排序")
@ApiImplicitParam(name = "sort", value = "排序字段:0->按相关度;1->按新品;2->按销量;3->价格从低到高;4->价格从高到低",
defaultValue = "0", allowableValues = "0,1,2,3,4", paramType = "query", dataType = "integer")
@RequestMapping(value = "/search", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> search(@RequestParam(required = false) String keyword,
@RequestParam(required = false) Long brandId,
@RequestParam(required = false) Long productCategoryId,
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
@RequestParam(required = false, defaultValue = "5") Integer pageSize,
@RequestParam(required = false, defaultValue = "0") Integer sort) {<FILL_FUNCTION_BODY>}
@ApiOperation("以树形结构获取所有商品分类")
@RequestMapping(value = "/categoryTreeList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProductCategoryNode>> categoryTreeList() {
List<PmsProductCategoryNode> list = portalProductService.categoryTreeList();
return CommonResult.success(list);
}
@ApiOperation("获取前台商品详情")
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsPortalProductDetail> detail(@PathVariable Long id) {
PmsPortalProductDetail productDetail = portalProductService.detail(id);
return CommonResult.success(productDetail);
}
}
|
List<PmsProduct> productList = portalProductService.search(keyword, brandId, productCategoryId, pageNum, pageSize, sort);
return CommonResult.success(CommonPage.restPage(productList));
| 486
| 54
| 540
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/UmsMemberCouponController.java
|
UmsMemberCouponController
|
listCart
|
class UmsMemberCouponController {
@Autowired
private UmsMemberCouponService memberCouponService;
@Autowired
private OmsCartItemService cartItemService;
@Autowired
private UmsMemberService memberService;
@ApiOperation("领取指定优惠券")
@RequestMapping(value = "/add/{couponId}", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@PathVariable Long couponId) {
memberCouponService.add(couponId);
return CommonResult.success(null,"领取成功");
}
@ApiOperation("获取用户优惠券历史列表")
@ApiImplicitParam(name = "useStatus", value = "优惠券筛选类型:0->未使用;1->已使用;2->已过期",
allowableValues = "0,1,2", paramType = "query", dataType = "integer")
@RequestMapping(value = "/listHistory", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsCouponHistory>> listHistory(@RequestParam(value = "useStatus", required = false) Integer useStatus) {
List<SmsCouponHistory> couponHistoryList = memberCouponService.listHistory(useStatus);
return CommonResult.success(couponHistoryList);
}
@ApiOperation("获取用户优惠券列表")
@ApiImplicitParam(name = "useStatus", value = "优惠券筛选类型:0->未使用;1->已使用;2->已过期",
allowableValues = "0,1,2", paramType = "query", dataType = "integer")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsCoupon>> list(@RequestParam(value = "useStatus", required = false) Integer useStatus) {
List<SmsCoupon> couponList = memberCouponService.list(useStatus);
return CommonResult.success(couponList);
}
@ApiOperation("获取登录会员购物车的相关优惠券")
@ApiImplicitParam(name = "type", value = "使用可用:0->不可用;1->可用",
defaultValue = "1", allowableValues = "0,1", paramType = "query", dataType = "integer")
@RequestMapping(value = "/list/cart/{type}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsCouponHistoryDetail>> listCart(@PathVariable Integer type) {<FILL_FUNCTION_BODY>}
@ApiOperation("获取当前商品相关优惠券")
@RequestMapping(value = "/listByProduct/{productId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsCoupon>> listByProduct(@PathVariable Long productId) {
List<SmsCoupon> couponHistoryList = memberCouponService.listByProduct(productId);
return CommonResult.success(couponHistoryList);
}
}
|
List<CartPromotionItem> cartPromotionItemList = cartItemService.listPromotion(memberService.getCurrentMember().getId(), null);
List<SmsCouponHistoryDetail> couponHistoryList = memberCouponService.listCart(cartPromotionItemList, type);
return CommonResult.success(couponHistoryList);
| 773
| 83
| 856
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/controller/UmsMemberReceiveAddressController.java
|
UmsMemberReceiveAddressController
|
add
|
class UmsMemberReceiveAddressController {
@Autowired
private UmsMemberReceiveAddressService memberReceiveAddressService;
@ApiOperation("添加收货地址")
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody UmsMemberReceiveAddress address) {<FILL_FUNCTION_BODY>}
@ApiOperation("删除收货地址")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = memberReceiveAddressService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改收货地址")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsMemberReceiveAddress address) {
int count = memberReceiveAddressService.update(id, address);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("显示所有收货地址")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMemberReceiveAddress>> list() {
List<UmsMemberReceiveAddress> addressList = memberReceiveAddressService.list();
return CommonResult.success(addressList);
}
@ApiOperation("获取收货地址详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsMemberReceiveAddress> getItem(@PathVariable Long id) {
UmsMemberReceiveAddress address = memberReceiveAddressService.getItem(id);
return CommonResult.success(address);
}
}
|
int count = memberReceiveAddressService.add(address);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 497
| 48
| 545
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/AlipayServiceImpl.java
|
AlipayServiceImpl
|
notify
|
class AlipayServiceImpl implements AlipayService {
@Autowired
private AlipayConfig alipayConfig;
@Autowired
private AlipayClient alipayClient;
@Autowired
private OmsOrderMapper orderMapper;
@Autowired
private OmsPortalOrderService portalOrderService;
@Override
public String pay(AliPayParam aliPayParam) {
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
if(StrUtil.isNotEmpty(alipayConfig.getNotifyUrl())){
//异步接收地址,公网可访问
request.setNotifyUrl(alipayConfig.getNotifyUrl());
}
if(StrUtil.isNotEmpty(alipayConfig.getReturnUrl())){
//同步跳转地址
request.setReturnUrl(alipayConfig.getReturnUrl());
}
//******必传参数******
JSONObject bizContent = new JSONObject();
//商户订单号,商家自定义,保持唯一性
bizContent.put("out_trade_no", aliPayParam.getOutTradeNo());
//支付金额,最小值0.01元
bizContent.put("total_amount", aliPayParam.getTotalAmount());
//订单标题,不可使用特殊符号
bizContent.put("subject", aliPayParam.getSubject());
//电脑网站支付场景固定传值FAST_INSTANT_TRADE_PAY
bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY");
request.setBizContent(bizContent.toString());
String formHtml = null;
try {
formHtml = alipayClient.pageExecute(request).getBody();
} catch (AlipayApiException e) {
e.printStackTrace();
}
return formHtml;
}
@Override
public String notify(Map<String, String> params) {<FILL_FUNCTION_BODY>}
@Override
public String query(String outTradeNo, String tradeNo) {
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
//******必传参数******
JSONObject bizContent = new JSONObject();
//设置查询参数,out_trade_no和trade_no至少传一个
if(StrUtil.isNotEmpty(outTradeNo)){
bizContent.put("out_trade_no",outTradeNo);
}
if(StrUtil.isNotEmpty(tradeNo)){
bizContent.put("trade_no",tradeNo);
}
//交易结算信息: trade_settle_info
String[] queryOptions = {"trade_settle_info"};
bizContent.put("query_options", queryOptions);
request.setBizContent(bizContent.toString());
AlipayTradeQueryResponse response = null;
try {
response = alipayClient.execute(request);
} catch (AlipayApiException e) {
log.error("查询支付宝账单异常!",e);
}
if(response.isSuccess()){
log.info("查询支付宝账单成功!");
if("TRADE_SUCCESS".equals(response.getTradeStatus())){
portalOrderService.paySuccessByOrderSn(outTradeNo,1);
}
} else {
log.error("查询支付宝账单失败!");
}
//交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款)
return response.getTradeStatus();
}
@Override
public String webPay(AliPayParam aliPayParam) {
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest ();
if(StrUtil.isNotEmpty(alipayConfig.getNotifyUrl())){
//异步接收地址,公网可访问
request.setNotifyUrl(alipayConfig.getNotifyUrl());
}
if(StrUtil.isNotEmpty(alipayConfig.getReturnUrl())){
//同步跳转地址
request.setReturnUrl(alipayConfig.getReturnUrl());
}
//******必传参数******
JSONObject bizContent = new JSONObject();
//商户订单号,商家自定义,保持唯一性
bizContent.put("out_trade_no", aliPayParam.getOutTradeNo());
//支付金额,最小值0.01元
bizContent.put("total_amount", aliPayParam.getTotalAmount());
//订单标题,不可使用特殊符号
bizContent.put("subject", aliPayParam.getSubject());
//手机网站支付默认传值FAST_INSTANT_TRADE_PAY
bizContent.put("product_code", "QUICK_WAP_WAY");
request.setBizContent(bizContent.toString());
String formHtml = null;
try {
formHtml = alipayClient.pageExecute(request).getBody();
} catch (AlipayApiException e) {
e.printStackTrace();
}
return formHtml;
}
}
|
String result = "failure";
boolean signVerified = false;
try {
//调用SDK验证签名
signVerified = AlipaySignature.rsaCheckV1(params, alipayConfig.getAlipayPublicKey(), alipayConfig.getCharset(), alipayConfig.getSignType());
} catch (AlipayApiException e) {
log.error("支付回调签名校验异常!",e);
e.printStackTrace();
}
if (signVerified) {
String tradeStatus = params.get("trade_status");
if("TRADE_SUCCESS".equals(tradeStatus)){
result = "success";
log.info("notify方法被调用了,tradeStatus:{}",tradeStatus);
String outTradeNo = params.get("out_trade_no");
portalOrderService.paySuccessByOrderSn(outTradeNo,1);
}else{
log.warn("订单未支付成功,trade_status:{}",tradeStatus);
}
} else {
log.warn("支付回调签名校验失败!");
}
return result;
| 1,403
| 296
| 1,699
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/HomeServiceImpl.java
|
HomeServiceImpl
|
getHomeFlashPromotion
|
class HomeServiceImpl implements HomeService {
@Autowired
private SmsHomeAdvertiseMapper advertiseMapper;
@Autowired
private HomeDao homeDao;
@Autowired
private SmsFlashPromotionMapper flashPromotionMapper;
@Autowired
private SmsFlashPromotionSessionMapper promotionSessionMapper;
@Autowired
private PmsProductMapper productMapper;
@Autowired
private PmsProductCategoryMapper productCategoryMapper;
@Autowired
private CmsSubjectMapper subjectMapper;
@Override
public HomeContentResult content() {
HomeContentResult result = new HomeContentResult();
//获取首页广告
result.setAdvertiseList(getHomeAdvertiseList());
//获取推荐品牌
result.setBrandList(homeDao.getRecommendBrandList(0,6));
//获取秒杀信息
result.setHomeFlashPromotion(getHomeFlashPromotion());
//获取新品推荐
result.setNewProductList(homeDao.getNewProductList(0,4));
//获取人气推荐
result.setHotProductList(homeDao.getHotProductList(0,4));
//获取推荐专题
result.setSubjectList(homeDao.getRecommendSubjectList(0,4));
return result;
}
@Override
public List<PmsProduct> recommendProductList(Integer pageSize, Integer pageNum) {
// TODO: 2019/1/29 暂时默认推荐所有商品
PageHelper.startPage(pageNum,pageSize);
PmsProductExample example = new PmsProductExample();
example.createCriteria()
.andDeleteStatusEqualTo(0)
.andPublishStatusEqualTo(1);
return productMapper.selectByExample(example);
}
@Override
public List<PmsProductCategory> getProductCateList(Long parentId) {
PmsProductCategoryExample example = new PmsProductCategoryExample();
example.createCriteria()
.andShowStatusEqualTo(1)
.andParentIdEqualTo(parentId);
example.setOrderByClause("sort desc");
return productCategoryMapper.selectByExample(example);
}
@Override
public List<CmsSubject> getSubjectList(Long cateId, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
CmsSubjectExample example = new CmsSubjectExample();
CmsSubjectExample.Criteria criteria = example.createCriteria();
criteria.andShowStatusEqualTo(1);
if(cateId!=null){
criteria.andCategoryIdEqualTo(cateId);
}
return subjectMapper.selectByExample(example);
}
@Override
public List<PmsProduct> hotProductList(Integer pageNum, Integer pageSize) {
int offset = pageSize * (pageNum - 1);
return homeDao.getHotProductList(offset, pageSize);
}
@Override
public List<PmsProduct> newProductList(Integer pageNum, Integer pageSize) {
int offset = pageSize * (pageNum - 1);
return homeDao.getNewProductList(offset, pageSize);
}
private HomeFlashPromotion getHomeFlashPromotion() {<FILL_FUNCTION_BODY>}
//获取下一个场次信息
private SmsFlashPromotionSession getNextFlashPromotionSession(Date date) {
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
sessionExample.createCriteria()
.andStartTimeGreaterThan(date);
sessionExample.setOrderByClause("start_time asc");
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
if (!CollectionUtils.isEmpty(promotionSessionList)) {
return promotionSessionList.get(0);
}
return null;
}
private List<SmsHomeAdvertise> getHomeAdvertiseList() {
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
example.createCriteria().andTypeEqualTo(1).andStatusEqualTo(1);
example.setOrderByClause("sort desc");
return advertiseMapper.selectByExample(example);
}
//根据时间获取秒杀活动
private SmsFlashPromotion getFlashPromotion(Date date) {
Date currDate = DateUtil.getDate(date);
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
example.createCriteria()
.andStatusEqualTo(1)
.andStartDateLessThanOrEqualTo(currDate)
.andEndDateGreaterThanOrEqualTo(currDate);
List<SmsFlashPromotion> flashPromotionList = flashPromotionMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(flashPromotionList)) {
return flashPromotionList.get(0);
}
return null;
}
//根据时间获取秒杀场次
private SmsFlashPromotionSession getFlashPromotionSession(Date date) {
Date currTime = DateUtil.getTime(date);
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
sessionExample.createCriteria()
.andStartTimeLessThanOrEqualTo(currTime)
.andEndTimeGreaterThanOrEqualTo(currTime);
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
if (!CollectionUtils.isEmpty(promotionSessionList)) {
return promotionSessionList.get(0);
}
return null;
}
}
|
HomeFlashPromotion homeFlashPromotion = new HomeFlashPromotion();
//获取当前秒杀活动
Date now = new Date();
SmsFlashPromotion flashPromotion = getFlashPromotion(now);
if (flashPromotion != null) {
//获取当前秒杀场次
SmsFlashPromotionSession flashPromotionSession = getFlashPromotionSession(now);
if (flashPromotionSession != null) {
homeFlashPromotion.setStartTime(flashPromotionSession.getStartTime());
homeFlashPromotion.setEndTime(flashPromotionSession.getEndTime());
//获取下一个秒杀场次
SmsFlashPromotionSession nextSession = getNextFlashPromotionSession(homeFlashPromotion.getStartTime());
if(nextSession!=null){
homeFlashPromotion.setNextStartTime(nextSession.getStartTime());
homeFlashPromotion.setNextEndTime(nextSession.getEndTime());
}
//获取秒杀商品
List<FlashPromotionProduct> flashProductList = homeDao.getFlashProductList(flashPromotion.getId(), flashPromotionSession.getId());
homeFlashPromotion.setProductList(flashProductList);
}
}
return homeFlashPromotion;
| 1,463
| 326
| 1,789
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/MemberAttentionServiceImpl.java
|
MemberAttentionServiceImpl
|
add
|
class MemberAttentionServiceImpl implements MemberAttentionService {
@Autowired
private MemberBrandAttentionRepository memberBrandAttentionRepository;
@Autowired
private UmsMemberService memberService;
@Override
public int add(MemberBrandAttention memberBrandAttention) {<FILL_FUNCTION_BODY>}
@Override
public int delete(Long brandId) {
UmsMember member = memberService.getCurrentMember();
return memberBrandAttentionRepository.deleteByMemberIdAndBrandId(member.getId(),brandId);
}
@Override
public Page<MemberBrandAttention> list(Integer pageNum, Integer pageSize) {
UmsMember member = memberService.getCurrentMember();
Pageable pageable = PageRequest.of(pageNum-1,pageSize);
return memberBrandAttentionRepository.findByMemberId(member.getId(),pageable);
}
@Override
public MemberBrandAttention detail(Long brandId) {
UmsMember member = memberService.getCurrentMember();
return memberBrandAttentionRepository.findByMemberIdAndBrandId(member.getId(), brandId);
}
@Override
public void clear() {
UmsMember member = memberService.getCurrentMember();
memberBrandAttentionRepository.deleteAllByMemberId(member.getId());
}
}
|
int count = 0;
UmsMember member = memberService.getCurrentMember();
memberBrandAttention.setMemberId(member.getId());
memberBrandAttention.setMemberNickname(member.getNickname());
memberBrandAttention.setMemberIcon(member.getIcon());
memberBrandAttention.setCreateTime(new Date());
MemberBrandAttention findAttention = memberBrandAttentionRepository.findByMemberIdAndBrandId(memberBrandAttention.getMemberId(), memberBrandAttention.getBrandId());
if (findAttention == null) {
memberBrandAttentionRepository.save(memberBrandAttention);
count = 1;
}
return count;
| 344
| 183
| 527
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/MemberCollectionServiceImpl.java
|
MemberCollectionServiceImpl
|
add
|
class MemberCollectionServiceImpl implements MemberCollectionService {
@Autowired
private MemberProductCollectionRepository productCollectionRepository;
@Autowired
private UmsMemberService memberService;
@Override
public int add(MemberProductCollection productCollection) {<FILL_FUNCTION_BODY>}
@Override
public int delete(Long productId) {
UmsMember member = memberService.getCurrentMember();
return productCollectionRepository.deleteByMemberIdAndProductId(member.getId(), productId);
}
@Override
public Page<MemberProductCollection> list(Integer pageNum, Integer pageSize) {
UmsMember member = memberService.getCurrentMember();
Pageable pageable = PageRequest.of(pageNum - 1, pageSize);
return productCollectionRepository.findByMemberId(member.getId(), pageable);
}
@Override
public MemberProductCollection detail(Long productId) {
UmsMember member = memberService.getCurrentMember();
return productCollectionRepository.findByMemberIdAndProductId(member.getId(), productId);
}
@Override
public void clear() {
UmsMember member = memberService.getCurrentMember();
productCollectionRepository.deleteAllByMemberId(member.getId());
}
}
|
int count = 0;
UmsMember member = memberService.getCurrentMember();
productCollection.setMemberId(member.getId());
productCollection.setMemberNickname(member.getNickname());
productCollection.setMemberIcon(member.getIcon());
MemberProductCollection findCollection = productCollectionRepository.findByMemberIdAndProductId(productCollection.getMemberId(), productCollection.getProductId());
if (findCollection == null) {
productCollectionRepository.save(productCollection);
count = 1;
}
return count;
| 315
| 138
| 453
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/MemberReadHistoryServiceImpl.java
|
MemberReadHistoryServiceImpl
|
create
|
class MemberReadHistoryServiceImpl implements MemberReadHistoryService {
@Autowired
private MemberReadHistoryRepository memberReadHistoryRepository;
@Autowired
private UmsMemberService memberService;
@Override
public int create(MemberReadHistory memberReadHistory) {<FILL_FUNCTION_BODY>}
@Override
public int delete(List<String> ids) {
List<MemberReadHistory> deleteList = new ArrayList<>();
for(String id:ids){
MemberReadHistory memberReadHistory = new MemberReadHistory();
memberReadHistory.setId(id);
deleteList.add(memberReadHistory);
}
memberReadHistoryRepository.deleteAll(deleteList);
return ids.size();
}
@Override
public Page<MemberReadHistory> list(Integer pageNum, Integer pageSize) {
UmsMember member = memberService.getCurrentMember();
Pageable pageable = PageRequest.of(pageNum-1, pageSize);
return memberReadHistoryRepository.findByMemberIdOrderByCreateTimeDesc(member.getId(),pageable);
}
@Override
public void clear() {
UmsMember member = memberService.getCurrentMember();
memberReadHistoryRepository.deleteAllByMemberId(member.getId());
}
}
|
UmsMember member = memberService.getCurrentMember();
memberReadHistory.setMemberId(member.getId());
memberReadHistory.setMemberNickname(member.getNickname());
memberReadHistory.setMemberIcon(member.getIcon());
memberReadHistory.setId(null);
memberReadHistory.setCreateTime(new Date());
memberReadHistoryRepository.save(memberReadHistory);
return 1;
| 318
| 108
| 426
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsCartItemServiceImpl.java
|
OmsCartItemServiceImpl
|
clear
|
class OmsCartItemServiceImpl implements OmsCartItemService {
@Autowired
private OmsCartItemMapper cartItemMapper;
@Autowired
private PortalProductDao productDao;
@Autowired
private OmsPromotionService promotionService;
@Autowired
private UmsMemberService memberService;
@Override
public int add(OmsCartItem cartItem) {
int count;
UmsMember currentMember =memberService.getCurrentMember();
cartItem.setMemberId(currentMember.getId());
cartItem.setMemberNickname(currentMember.getNickname());
cartItem.setDeleteStatus(0);
OmsCartItem existCartItem = getCartItem(cartItem);
if (existCartItem == null) {
cartItem.setCreateDate(new Date());
count = cartItemMapper.insert(cartItem);
} else {
cartItem.setModifyDate(new Date());
existCartItem.setQuantity(existCartItem.getQuantity() + cartItem.getQuantity());
count = cartItemMapper.updateByPrimaryKey(existCartItem);
}
return count;
}
/**
* 根据会员id,商品id和规格获取购物车中商品
*/
private OmsCartItem getCartItem(OmsCartItem cartItem) {
OmsCartItemExample example = new OmsCartItemExample();
OmsCartItemExample.Criteria criteria = example.createCriteria().andMemberIdEqualTo(cartItem.getMemberId())
.andProductIdEqualTo(cartItem.getProductId()).andDeleteStatusEqualTo(0);
if (cartItem.getProductSkuId()!=null) {
criteria.andProductSkuIdEqualTo(cartItem.getProductSkuId());
}
List<OmsCartItem> cartItemList = cartItemMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(cartItemList)) {
return cartItemList.get(0);
}
return null;
}
@Override
public List<OmsCartItem> list(Long memberId) {
OmsCartItemExample example = new OmsCartItemExample();
example.createCriteria().andDeleteStatusEqualTo(0).andMemberIdEqualTo(memberId);
return cartItemMapper.selectByExample(example);
}
@Override
public List<CartPromotionItem> listPromotion(Long memberId, List<Long> cartIds) {
List<OmsCartItem> cartItemList = list(memberId);
if(CollUtil.isNotEmpty(cartIds)){
cartItemList = cartItemList.stream().filter(item->cartIds.contains(item.getId())).collect(Collectors.toList());
}
List<CartPromotionItem> cartPromotionItemList = new ArrayList<>();
if(!CollectionUtils.isEmpty(cartItemList)){
cartPromotionItemList = promotionService.calcCartPromotion(cartItemList);
}
return cartPromotionItemList;
}
@Override
public int updateQuantity(Long id, Long memberId, Integer quantity) {
OmsCartItem cartItem = new OmsCartItem();
cartItem.setQuantity(quantity);
OmsCartItemExample example = new OmsCartItemExample();
example.createCriteria().andDeleteStatusEqualTo(0)
.andIdEqualTo(id).andMemberIdEqualTo(memberId);
return cartItemMapper.updateByExampleSelective(cartItem, example);
}
@Override
public int delete(Long memberId, List<Long> ids) {
OmsCartItem record = new OmsCartItem();
record.setDeleteStatus(1);
OmsCartItemExample example = new OmsCartItemExample();
example.createCriteria().andIdIn(ids).andMemberIdEqualTo(memberId);
return cartItemMapper.updateByExampleSelective(record, example);
}
@Override
public CartProduct getCartProduct(Long productId) {
return productDao.getCartProduct(productId);
}
@Override
public int updateAttr(OmsCartItem cartItem) {
//删除原购物车信息
OmsCartItem updateCart = new OmsCartItem();
updateCart.setId(cartItem.getId());
updateCart.setModifyDate(new Date());
updateCart.setDeleteStatus(1);
cartItemMapper.updateByPrimaryKeySelective(updateCart);
cartItem.setId(null);
add(cartItem);
return 1;
}
@Override
public int clear(Long memberId) {<FILL_FUNCTION_BODY>}
}
|
OmsCartItem record = new OmsCartItem();
record.setDeleteStatus(1);
OmsCartItemExample example = new OmsCartItemExample();
example.createCriteria().andMemberIdEqualTo(memberId);
return cartItemMapper.updateByExampleSelective(record,example);
| 1,174
| 77
| 1,251
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderReturnApplyServiceImpl.java
|
OmsPortalOrderReturnApplyServiceImpl
|
create
|
class OmsPortalOrderReturnApplyServiceImpl implements OmsPortalOrderReturnApplyService {
@Autowired
private OmsOrderReturnApplyMapper returnApplyMapper;
@Override
public int create(OmsOrderReturnApplyParam returnApply) {<FILL_FUNCTION_BODY>}
}
|
OmsOrderReturnApply realApply = new OmsOrderReturnApply();
BeanUtils.copyProperties(returnApply,realApply);
realApply.setCreateTime(new Date());
realApply.setStatus(0);
return returnApplyMapper.insert(realApply);
| 74
| 69
| 143
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/PmsPortalProductServiceImpl.java
|
PmsPortalProductServiceImpl
|
covert
|
class PmsPortalProductServiceImpl implements PmsPortalProductService {
@Autowired
private PmsProductMapper productMapper;
@Autowired
private PmsProductCategoryMapper productCategoryMapper;
@Autowired
private PmsBrandMapper brandMapper;
@Autowired
private PmsProductAttributeMapper productAttributeMapper;
@Autowired
private PmsProductAttributeValueMapper productAttributeValueMapper;
@Autowired
private PmsSkuStockMapper skuStockMapper;
@Autowired
private PmsProductLadderMapper productLadderMapper;
@Autowired
private PmsProductFullReductionMapper productFullReductionMapper;
@Autowired
private PortalProductDao portalProductDao;
@Override
public List<PmsProduct> search(String keyword, Long brandId, Long productCategoryId, Integer pageNum, Integer pageSize, Integer sort) {
PageHelper.startPage(pageNum, pageSize);
PmsProductExample example = new PmsProductExample();
PmsProductExample.Criteria criteria = example.createCriteria();
criteria.andDeleteStatusEqualTo(0);
if (StrUtil.isNotEmpty(keyword)) {
criteria.andNameLike("%" + keyword + "%");
}
if (brandId != null) {
criteria.andBrandIdEqualTo(brandId);
}
if (productCategoryId != null) {
criteria.andProductCategoryIdEqualTo(productCategoryId);
}
//1->按新品;2->按销量;3->价格从低到高;4->价格从高到低
if (sort == 1) {
example.setOrderByClause("id desc");
} else if (sort == 2) {
example.setOrderByClause("sale desc");
} else if (sort == 3) {
example.setOrderByClause("price asc");
} else if (sort == 4) {
example.setOrderByClause("price desc");
}
return productMapper.selectByExample(example);
}
@Override
public List<PmsProductCategoryNode> categoryTreeList() {
PmsProductCategoryExample example = new PmsProductCategoryExample();
List<PmsProductCategory> allList = productCategoryMapper.selectByExample(example);
List<PmsProductCategoryNode> result = allList.stream()
.filter(item -> item.getParentId().equals(0L))
.map(item -> covert(item, allList)).collect(Collectors.toList());
return result;
}
@Override
public PmsPortalProductDetail detail(Long id) {
PmsPortalProductDetail result = new PmsPortalProductDetail();
//获取商品信息
PmsProduct product = productMapper.selectByPrimaryKey(id);
result.setProduct(product);
//获取品牌信息
PmsBrand brand = brandMapper.selectByPrimaryKey(product.getBrandId());
result.setBrand(brand);
//获取商品属性信息
PmsProductAttributeExample attributeExample = new PmsProductAttributeExample();
attributeExample.createCriteria().andProductAttributeCategoryIdEqualTo(product.getProductAttributeCategoryId());
List<PmsProductAttribute> productAttributeList = productAttributeMapper.selectByExample(attributeExample);
result.setProductAttributeList(productAttributeList);
//获取商品属性值信息
if(CollUtil.isNotEmpty(productAttributeList)){
List<Long> attributeIds = productAttributeList.stream().map(PmsProductAttribute::getId).collect(Collectors.toList());
PmsProductAttributeValueExample attributeValueExample = new PmsProductAttributeValueExample();
attributeValueExample.createCriteria().andProductIdEqualTo(product.getId())
.andProductAttributeIdIn(attributeIds);
List<PmsProductAttributeValue> productAttributeValueList = productAttributeValueMapper.selectByExample(attributeValueExample);
result.setProductAttributeValueList(productAttributeValueList);
}
//获取商品SKU库存信息
PmsSkuStockExample skuExample = new PmsSkuStockExample();
skuExample.createCriteria().andProductIdEqualTo(product.getId());
List<PmsSkuStock> skuStockList = skuStockMapper.selectByExample(skuExample);
result.setSkuStockList(skuStockList);
//商品阶梯价格设置
if(product.getPromotionType()==3){
PmsProductLadderExample ladderExample = new PmsProductLadderExample();
ladderExample.createCriteria().andProductIdEqualTo(product.getId());
List<PmsProductLadder> productLadderList = productLadderMapper.selectByExample(ladderExample);
result.setProductLadderList(productLadderList);
}
//商品满减价格设置
if(product.getPromotionType()==4){
PmsProductFullReductionExample fullReductionExample = new PmsProductFullReductionExample();
fullReductionExample.createCriteria().andProductIdEqualTo(product.getId());
List<PmsProductFullReduction> productFullReductionList = productFullReductionMapper.selectByExample(fullReductionExample);
result.setProductFullReductionList(productFullReductionList);
}
//商品可用优惠券
result.setCouponList(portalProductDao.getAvailableCouponList(product.getId(),product.getProductCategoryId()));
return result;
}
/**
* 初始对象转化为节点对象
*/
private PmsProductCategoryNode covert(PmsProductCategory item, List<PmsProductCategory> allList) {<FILL_FUNCTION_BODY>}
}
|
PmsProductCategoryNode node = new PmsProductCategoryNode();
BeanUtils.copyProperties(item, node);
List<PmsProductCategoryNode> children = allList.stream()
.filter(subItem -> subItem.getParentId().equals(item.getId()))
.map(subItem -> covert(subItem, allList)).collect(Collectors.toList());
node.setChildren(children);
return node;
| 1,443
| 111
| 1,554
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/PortalBrandServiceImpl.java
|
PortalBrandServiceImpl
|
recommendList
|
class PortalBrandServiceImpl implements PortalBrandService {
@Autowired
private HomeDao homeDao;
@Autowired
private PmsBrandMapper brandMapper;
@Autowired
private PmsProductMapper productMapper;
@Override
public List<PmsBrand> recommendList(Integer pageNum, Integer pageSize) {<FILL_FUNCTION_BODY>}
@Override
public PmsBrand detail(Long brandId) {
return brandMapper.selectByPrimaryKey(brandId);
}
@Override
public CommonPage<PmsProduct> productList(Long brandId, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
PmsProductExample example = new PmsProductExample();
example.createCriteria().andDeleteStatusEqualTo(0)
.andBrandIdEqualTo(brandId);
List<PmsProduct> productList = productMapper.selectByExample(example);
return CommonPage.restPage(productList);
}
}
|
int offset = (pageNum - 1) * pageSize;
return homeDao.getRecommendBrandList(offset, pageSize);
| 264
| 39
| 303
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberReceiveAddressServiceImpl.java
|
UmsMemberReceiveAddressServiceImpl
|
getItem
|
class UmsMemberReceiveAddressServiceImpl implements UmsMemberReceiveAddressService {
@Autowired
private UmsMemberService memberService;
@Autowired
private UmsMemberReceiveAddressMapper addressMapper;
@Override
public int add(UmsMemberReceiveAddress address) {
UmsMember currentMember = memberService.getCurrentMember();
address.setMemberId(currentMember.getId());
return addressMapper.insert(address);
}
@Override
public int delete(Long id) {
UmsMember currentMember = memberService.getCurrentMember();
UmsMemberReceiveAddressExample example = new UmsMemberReceiveAddressExample();
example.createCriteria().andMemberIdEqualTo(currentMember.getId()).andIdEqualTo(id);
return addressMapper.deleteByExample(example);
}
@Override
public int update(Long id, UmsMemberReceiveAddress address) {
address.setId(null);
UmsMember currentMember = memberService.getCurrentMember();
UmsMemberReceiveAddressExample example = new UmsMemberReceiveAddressExample();
example.createCriteria().andMemberIdEqualTo(currentMember.getId()).andIdEqualTo(id);
if(address.getDefaultStatus()==1){
//先将原来的默认地址去除
UmsMemberReceiveAddress record= new UmsMemberReceiveAddress();
record.setDefaultStatus(0);
UmsMemberReceiveAddressExample updateExample = new UmsMemberReceiveAddressExample();
updateExample.createCriteria()
.andMemberIdEqualTo(currentMember.getId())
.andDefaultStatusEqualTo(1);
addressMapper.updateByExampleSelective(record,updateExample);
}
return addressMapper.updateByExampleSelective(address,example);
}
@Override
public List<UmsMemberReceiveAddress> list() {
UmsMember currentMember = memberService.getCurrentMember();
UmsMemberReceiveAddressExample example = new UmsMemberReceiveAddressExample();
example.createCriteria().andMemberIdEqualTo(currentMember.getId());
return addressMapper.selectByExample(example);
}
@Override
public UmsMemberReceiveAddress getItem(Long id) {<FILL_FUNCTION_BODY>}
}
|
UmsMember currentMember = memberService.getCurrentMember();
UmsMemberReceiveAddressExample example = new UmsMemberReceiveAddressExample();
example.createCriteria().andMemberIdEqualTo(currentMember.getId()).andIdEqualTo(id);
List<UmsMemberReceiveAddress> addressList = addressMapper.selectByExample(example);
if(!CollectionUtils.isEmpty(addressList)){
return addressList.get(0);
}
return null;
| 568
| 117
| 685
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberServiceImpl.java
|
UmsMemberServiceImpl
|
updatePassword
|
class UmsMemberServiceImpl implements UmsMemberService {
private static final Logger LOGGER = LoggerFactory.getLogger(UmsMemberServiceImpl.class);
@Autowired
private UmsMemberMapper memberMapper;
@Autowired
private UmsMemberLevelMapper memberLevelMapper;
@Autowired
private UmsMemberCacheService memberCacheService;
@Value("${redis.key.authCode}")
private String REDIS_KEY_PREFIX_AUTH_CODE;
@Value("${redis.expire.authCode}")
private Long AUTH_CODE_EXPIRE_SECONDS;
@Autowired
private AuthService authService;
@Autowired
private HttpServletRequest request;
@Override
public UmsMember getByUsername(String username) {
UmsMemberExample example = new UmsMemberExample();
example.createCriteria().andUsernameEqualTo(username);
List<UmsMember> memberList = memberMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(memberList)) {
return memberList.get(0);
}
return null;
}
@Override
public UmsMember getById(Long id) {
return memberMapper.selectByPrimaryKey(id);
}
@Override
public void register(String username, String password, String telephone, String authCode) {
//验证验证码
if(!verifyAuthCode(authCode,telephone)){
Asserts.fail("验证码错误");
}
//查询是否已有该用户
UmsMemberExample example = new UmsMemberExample();
example.createCriteria().andUsernameEqualTo(username);
example.or(example.createCriteria().andPhoneEqualTo(telephone));
List<UmsMember> umsMembers = memberMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(umsMembers)) {
Asserts.fail("该用户已经存在");
}
//没有该用户进行添加操作
UmsMember umsMember = new UmsMember();
umsMember.setUsername(username);
umsMember.setPhone(telephone);
umsMember.setPassword(BCrypt.hashpw(password));
umsMember.setCreateTime(new Date());
umsMember.setStatus(1);
//获取默认会员等级并设置
UmsMemberLevelExample levelExample = new UmsMemberLevelExample();
levelExample.createCriteria().andDefaultStatusEqualTo(1);
List<UmsMemberLevel> memberLevelList = memberLevelMapper.selectByExample(levelExample);
if (!CollectionUtils.isEmpty(memberLevelList)) {
umsMember.setMemberLevelId(memberLevelList.get(0).getId());
}
memberMapper.insert(umsMember);
umsMember.setPassword(null);
}
@Override
public String generateAuthCode(String telephone) {
StringBuilder sb = new StringBuilder();
Random random = new Random();
for(int i=0;i<6;i++){
sb.append(random.nextInt(10));
}
memberCacheService.setAuthCode(telephone,sb.toString());
return sb.toString();
}
@Override
public void updatePassword(String telephone, String password, String authCode) {<FILL_FUNCTION_BODY>}
@Override
public UmsMember getCurrentMember() {
String userStr = request.getHeader(AuthConstant.USER_TOKEN_HEADER);
if(StrUtil.isEmpty(userStr)){
Asserts.fail(ResultCode.UNAUTHORIZED);
}
UserDto userDto = JSONUtil.toBean(userStr, UserDto.class);
UmsMember member = memberCacheService.getMember(userDto.getId());
if(member!=null){
return member;
}else{
member = getById(userDto.getId());
memberCacheService.setMember(member);
return member;
}
}
@Override
public void updateIntegration(Long id, Integer integration) {
UmsMember record=new UmsMember();
record.setId(id);
record.setIntegration(integration);
memberMapper.updateByPrimaryKeySelective(record);
memberCacheService.delMember(id);
}
@Override
public UserDto loadUserByUsername(String username) {
UmsMember member = getByUsername(username);
if(member!=null){
UserDto userDto = new UserDto();
BeanUtil.copyProperties(member,userDto);
userDto.setRoles(CollUtil.toList("前台会员"));
return userDto;
}
return null;
}
@Override
public CommonResult login(String username, String password) {
if(StrUtil.isEmpty(username)||StrUtil.isEmpty(password)){
Asserts.fail("用户名或密码不能为空!");
}
Map<String, String> params = new HashMap<>();
params.put("client_id", AuthConstant.PORTAL_CLIENT_ID);
params.put("client_secret","123456");
params.put("grant_type","password");
params.put("username",username);
params.put("password",password);
return authService.getAccessToken(params);
}
//对输入的验证码进行校验
private boolean verifyAuthCode(String authCode, String telephone){
if(StringUtils.isEmpty(authCode)){
return false;
}
String realAuthCode = memberCacheService.getAuthCode(telephone);
return authCode.equals(realAuthCode);
}
}
|
UmsMemberExample example = new UmsMemberExample();
example.createCriteria().andPhoneEqualTo(telephone);
List<UmsMember> memberList = memberMapper.selectByExample(example);
if(CollectionUtils.isEmpty(memberList)){
Asserts.fail("该账号不存在");
}
//验证验证码
if(!verifyAuthCode(authCode,telephone)){
Asserts.fail("验证码错误");
}
UmsMember umsMember = memberList.get(0);
umsMember.setPassword(BCrypt.hashpw(password));
memberMapper.updateByPrimaryKeySelective(umsMember);
memberCacheService.delMember(umsMember.getId());
| 1,449
| 182
| 1,631
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-portal/src/main/java/com/macro/mall/portal/util/DateUtil.java
|
DateUtil
|
getTime
|
class DateUtil {
/**
* 从Date类型的时间中提取日期部分
*/
public static Date getDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime();
}
/**
* 从Date类型的时间中提取时间部分
*/
public static Date getTime(Date date) {<FILL_FUNCTION_BODY>}
}
|
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.YEAR, 1970);
calendar.set(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
return calendar.getTime();
| 161
| 80
| 241
|
<no_super_class>
|
macrozheng_mall-swarm
|
mall-swarm/mall-search/src/main/java/com/macro/mall/search/config/SwaggerConfig.java
|
SwaggerConfig
|
swaggerProperties
|
class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {<FILL_FUNCTION_BODY>}
@Bean
public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return generateBeanPostProcessor();
}
}
|
return SwaggerProperties.builder()
.apiBasePackage("com.macro.mall.search.controller")
.title("mall搜索系统")
.description("mall搜索相关接口文档")
.contactName("macro")
.version("1.0")
.enableSecurity(false)
.build();
| 74
| 86
| 160
|
<methods>public non-sealed void <init>() ,public Docket createRestApi() ,public BeanPostProcessor generateBeanPostProcessor() ,public abstract com.macro.mall.common.domain.SwaggerProperties swaggerProperties() <variables>
|
macrozheng_mall-swarm
|
mall-swarm/mall-search/src/main/java/com/macro/mall/search/controller/EsProductController.java
|
EsProductController
|
create
|
class EsProductController {
@Autowired
private EsProductService esProductService;
@ApiOperation(value = "导入所有数据库中商品到ES")
@RequestMapping(value = "/importAll", method = RequestMethod.POST)
@ResponseBody
public CommonResult<Integer> importAllList() {
int count = esProductService.importAll();
return CommonResult.success(count);
}
@ApiOperation(value = "根据id删除商品")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<Object> delete(@PathVariable Long id) {
esProductService.delete(id);
return CommonResult.success(null);
}
@ApiOperation(value = "根据id批量删除商品")
@RequestMapping(value = "/delete/batch", method = RequestMethod.POST)
@ResponseBody
public CommonResult<Object> delete(@RequestParam("ids") List<Long> ids) {
esProductService.delete(ids);
return CommonResult.success(null);
}
@ApiOperation(value = "根据id创建商品")
@RequestMapping(value = "/create/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult<EsProduct> create(@PathVariable Long id) {<FILL_FUNCTION_BODY>}
@ApiOperation(value = "简单搜索")
@RequestMapping(value = "/search/simple", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> search(@RequestParam(required = false) String keyword,
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
@RequestParam(required = false, defaultValue = "5") Integer pageSize) {
Page<EsProduct> esProductPage = esProductService.search(keyword, pageNum, pageSize);
return CommonResult.success(CommonPage.restPage(esProductPage));
}
@ApiOperation(value = "综合搜索、筛选、排序")
@ApiImplicitParam(name = "sort", value = "排序字段:0->按相关度;1->按新品;2->按销量;3->价格从低到高;4->价格从高到低",
defaultValue = "0", allowableValues = "0,1,2,3,4", paramType = "query", dataType = "integer")
@RequestMapping(value = "/search", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> search(@RequestParam(required = false) String keyword,
@RequestParam(required = false) Long brandId,
@RequestParam(required = false) Long productCategoryId,
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
@RequestParam(required = false, defaultValue = "5") Integer pageSize,
@RequestParam(required = false, defaultValue = "0") Integer sort) {
Page<EsProduct> esProductPage = esProductService.search(keyword, brandId, productCategoryId, pageNum, pageSize, sort);
return CommonResult.success(CommonPage.restPage(esProductPage));
}
@ApiOperation(value = "根据商品id推荐商品")
@RequestMapping(value = "/recommend/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> recommend(@PathVariable Long id,
@RequestParam(required = false, defaultValue = "0") Integer pageNum,
@RequestParam(required = false, defaultValue = "5") Integer pageSize) {
Page<EsProduct> esProductPage = esProductService.recommend(id, pageNum, pageSize);
return CommonResult.success(CommonPage.restPage(esProductPage));
}
@ApiOperation(value = "获取搜索的相关品牌、分类及筛选属性")
@RequestMapping(value = "/search/relate", method = RequestMethod.GET)
@ResponseBody
public CommonResult<EsProductRelatedInfo> searchRelatedInfo(@RequestParam(required = false) String keyword) {
EsProductRelatedInfo productRelatedInfo = esProductService.searchRelatedInfo(keyword);
return CommonResult.success(productRelatedInfo);
}
}
|
EsProduct esProduct = esProductService.create(id);
if (esProduct != null) {
return CommonResult.success(esProduct);
} else {
return CommonResult.failed();
}
| 1,072
| 56
| 1,128
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/config/GlobalCorsConfig.java
|
GlobalCorsConfig
|
corsFilter
|
class GlobalCorsConfig {
/**
* 允许跨域调用的过滤器
*/
@Bean
public CorsFilter corsFilter() {<FILL_FUNCTION_BODY>}
}
|
CorsConfiguration config = new CorsConfiguration();
//允许所有域名进行跨域调用
config.addAllowedOriginPattern("*");
//允许跨越发送cookie
config.setAllowCredentials(true);
//放行全部原始头信息
config.addAllowedHeader("*");
//允许所有请求方法跨域调用
config.addAllowedMethod("*");
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
| 55
| 146
| 201
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/config/MallSecurityConfig.java
|
MallSecurityConfig
|
loadDataSource
|
class MallSecurityConfig {
@Autowired
private UmsAdminService adminService;
@Autowired
private UmsResourceService resourceService;
@Bean
public UserDetailsService userDetailsService() {
//获取登录用户信息
return username -> adminService.loadUserByUsername(username);
}
@Bean
public DynamicSecurityService dynamicSecurityService() {
return new DynamicSecurityService() {
@Override
public Map<String, ConfigAttribute> loadDataSource() {<FILL_FUNCTION_BODY>}
};
}
}
|
Map<String, ConfigAttribute> map = new ConcurrentHashMap<>();
List<UmsResource> resourceList = resourceService.listAll();
for (UmsResource resource : resourceList) {
map.put(resource.getUrl(), new org.springframework.security.access.SecurityConfig(resource.getId() + ":" + resource.getName()));
}
return map;
| 149
| 94
| 243
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/config/SwaggerConfig.java
|
SwaggerConfig
|
swaggerProperties
|
class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {<FILL_FUNCTION_BODY>}
@Bean
public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return generateBeanPostProcessor();
}
}
|
return SwaggerProperties.builder()
.apiBasePackage("com.macro.mall.controller")
.title("mall后台系统")
.description("mall后台相关接口文档")
.contactName("macro")
.version("1.0")
.enableSecurity(true)
.build();
| 75
| 86
| 161
|
<methods>public non-sealed void <init>() ,public Docket createRestApi() ,public BeanPostProcessor generateBeanPostProcessor() ,public abstract com.macro.mall.common.domain.SwaggerProperties swaggerProperties() <variables>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/MinioController.java
|
MinioController
|
upload
|
class MinioController {
private static final Logger LOGGER = LoggerFactory.getLogger(MinioController.class);
@Value("${minio.endpoint}")
private String ENDPOINT;
@Value("${minio.bucketName}")
private String BUCKET_NAME;
@Value("${minio.accessKey}")
private String ACCESS_KEY;
@Value("${minio.secretKey}")
private String SECRET_KEY;
@ApiOperation("文件上传")
@RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody
public CommonResult upload(@RequestPart("file") MultipartFile file) {<FILL_FUNCTION_BODY>}
/**
* 创建存储桶的访问策略,设置为只读权限
*/
private BucketPolicyConfigDto createBucketPolicyConfigDto(String bucketName) {
BucketPolicyConfigDto.Statement statement = BucketPolicyConfigDto.Statement.builder()
.Effect("Allow")
.Principal("*")
.Action("s3:GetObject")
.Resource("arn:aws:s3:::"+bucketName+"/*.**").build();
return BucketPolicyConfigDto.builder()
.Version("2012-10-17")
.Statement(CollUtil.toList(statement))
.build();
}
@ApiOperation("文件删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("objectName") String objectName) {
try {
MinioClient minioClient = MinioClient.builder()
.endpoint(ENDPOINT)
.credentials(ACCESS_KEY,SECRET_KEY)
.build();
minioClient.removeObject(RemoveObjectArgs.builder().bucket(BUCKET_NAME).object(objectName).build());
return CommonResult.success(null);
} catch (Exception e) {
e.printStackTrace();
}
return CommonResult.failed();
}
}
|
try {
//创建一个MinIO的Java客户端
MinioClient minioClient =MinioClient.builder()
.endpoint(ENDPOINT)
.credentials(ACCESS_KEY,SECRET_KEY)
.build();
boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(BUCKET_NAME).build());
if (isExist) {
LOGGER.info("存储桶已经存在!");
} else {
//创建存储桶并设置只读权限
minioClient.makeBucket(MakeBucketArgs.builder().bucket(BUCKET_NAME).build());
BucketPolicyConfigDto bucketPolicyConfigDto = createBucketPolicyConfigDto(BUCKET_NAME);
SetBucketPolicyArgs setBucketPolicyArgs = SetBucketPolicyArgs.builder()
.bucket(BUCKET_NAME)
.config(JSONUtil.toJsonStr(bucketPolicyConfigDto))
.build();
minioClient.setBucketPolicy(setBucketPolicyArgs);
}
String filename = file.getOriginalFilename();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
// 设置存储对象名称
String objectName = sdf.format(new Date()) + "/" + filename;
// 使用putObject上传一个文件到存储桶中
PutObjectArgs putObjectArgs = PutObjectArgs.builder()
.bucket(BUCKET_NAME)
.object(objectName)
.contentType(file.getContentType())
.stream(file.getInputStream(), file.getSize(), ObjectWriteArgs.MIN_MULTIPART_SIZE).build();
minioClient.putObject(putObjectArgs);
LOGGER.info("文件上传成功!");
MinioUploadDto minioUploadDto = new MinioUploadDto();
minioUploadDto.setName(filename);
minioUploadDto.setUrl(ENDPOINT + "/" + BUCKET_NAME + "/" + objectName);
return CommonResult.success(minioUploadDto);
} catch (Exception e) {
e.printStackTrace();
LOGGER.info("上传发生错误: {}!", e.getMessage());
}
return CommonResult.failed();
| 535
| 575
| 1,110
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderController.java
|
OmsOrderController
|
delivery
|
class OmsOrderController {
@Autowired
private OmsOrderService orderService;
@ApiOperation("查询订单")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrder>> list(OmsOrderQueryParam queryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<OmsOrder> orderList = orderService.list(queryParam, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(orderList));
}
@ApiOperation("批量发货")
@RequestMapping(value = "/update/delivery", method = RequestMethod.POST)
@ResponseBody
public CommonResult delivery(@RequestBody List<OmsOrderDeliveryParam> deliveryParamList) {<FILL_FUNCTION_BODY>}
@ApiOperation("批量关闭订单")
@RequestMapping(value = "/update/close", method = RequestMethod.POST)
@ResponseBody
public CommonResult close(@RequestParam("ids") List<Long> ids, @RequestParam String note) {
int count = orderService.close(ids, note);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除订单")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = orderService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取订单详情:订单信息、商品信息、操作记录")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderDetail> detail(@PathVariable Long id) {
OmsOrderDetail orderDetailResult = orderService.detail(id);
return CommonResult.success(orderDetailResult);
}
@ApiOperation("修改收货人信息")
@RequestMapping(value = "/update/receiverInfo", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateReceiverInfo(@RequestBody OmsReceiverInfoParam receiverInfoParam) {
int count = orderService.updateReceiverInfo(receiverInfoParam);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改订单费用信息")
@RequestMapping(value = "/update/moneyInfo", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateReceiverInfo(@RequestBody OmsMoneyInfoParam moneyInfoParam) {
int count = orderService.updateMoneyInfo(moneyInfoParam);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("备注订单")
@RequestMapping(value = "/update/note", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNote(@RequestParam("id") Long id,
@RequestParam("note") String note,
@RequestParam("status") Integer status) {
int count = orderService.updateNote(id, note, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
}
|
int count = orderService.delivery(deliveryParamList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 916
| 49
| 965
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderReturnApplyController.java
|
OmsOrderReturnApplyController
|
delete
|
class OmsOrderReturnApplyController {
@Autowired
private OmsOrderReturnApplyService returnApplyService;
@ApiOperation("分页查询退货申请")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrderReturnApply>> list(OmsReturnApplyQueryParam queryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<OmsOrderReturnApply> returnApplyList = returnApplyService.list(queryParam, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(returnApplyList));
}
@ApiOperation("批量删除退货申请")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {<FILL_FUNCTION_BODY>}
@ApiOperation("获取退货申请详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult getItem(@PathVariable Long id) {
OmsOrderReturnApplyResult result = returnApplyService.getItem(id);
return CommonResult.success(result);
}
@ApiOperation("修改退货申请状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestBody OmsUpdateStatusParam statusParam) {
int count = returnApplyService.updateStatus(id, statusParam);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
}
|
int count = returnApplyService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 464
| 46
| 510
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderReturnReasonController.java
|
OmsOrderReturnReasonController
|
update
|
class OmsOrderReturnReasonController {
@Autowired
private OmsOrderReturnReasonService orderReturnReasonService;
@ApiOperation("添加退货原因")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody OmsOrderReturnReason returnReason) {
int count = orderReturnReasonService.create(returnReason);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改退货原因")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderReturnReason returnReason) {<FILL_FUNCTION_BODY>}
@ApiOperation("批量删除退货原因")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = orderReturnReasonService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询退货原因")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrderReturnReason>> list(@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<OmsOrderReturnReason> reasonList = orderReturnReasonService.list(pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(reasonList));
}
@ApiOperation("获取单个退货原因详情信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderReturnReason> getItem(@PathVariable Long id) {
OmsOrderReturnReason reason = orderReturnReasonService.getItem(id);
return CommonResult.success(reason);
}
@ApiOperation("修改退货原因启用状态")
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@RequestParam(value = "status") Integer status,
@RequestParam("ids") List<Long> ids) {
int count = orderReturnReasonService.updateStatus(ids, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
}
|
int count = orderReturnReasonService.update(id, returnReason);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 677
| 50
| 727
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderSettingController.java
|
OmsOrderSettingController
|
update
|
class OmsOrderSettingController {
@Autowired
private OmsOrderSettingService orderSettingService;
@ApiOperation("获取指定订单设置")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderSetting> getItem(@PathVariable Long id) {
OmsOrderSetting orderSetting = orderSettingService.getItem(id);
return CommonResult.success(orderSetting);
}
@ApiOperation("修改指定订单设置")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderSetting orderSetting) {<FILL_FUNCTION_BODY>}
}
|
int count = orderSettingService.update(id,orderSetting);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
| 195
| 48
| 243
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/PmsBrandController.java
|
PmsBrandController
|
update
|
class PmsBrandController {
@Autowired
private PmsBrandService brandService;
@ApiOperation(value = "获取全部品牌列表")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsBrand>> getList() {
return CommonResult.success(brandService.listAllBrand());
}
@ApiOperation(value = "添加品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@Validated @RequestBody PmsBrandParam pmsBrand) {
CommonResult commonResult;
int count = brandService.createBrand(pmsBrand);
if (count == 1) {
commonResult = CommonResult.success(count);
} else {
commonResult = CommonResult.failed();
}
return commonResult;
}
@ApiOperation(value = "更新品牌")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable("id") Long id,
@Validated @RequestBody PmsBrandParam pmsBrandParam) {<FILL_FUNCTION_BODY>}
@ApiOperation(value = "删除品牌")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult delete(@PathVariable("id") Long id) {
int count = brandService.deleteBrand(id);
if (count == 1) {
return CommonResult.success(null);
} else {
return CommonResult.failed();
}
}
@ApiOperation(value = "根据品牌名称分页获取品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> getList(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "showStatus",required = false) Integer showStatus,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
List<PmsBrand> brandList = brandService.listBrand(keyword,showStatus,pageNum, pageSize);
return CommonResult.success(CommonPage.restPage(brandList));
}
@ApiOperation(value = "根据编号查询品牌信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsBrand> getItem(@PathVariable("id") Long id) {
return CommonResult.success(brandService.getBrand(id));
}
@ApiOperation(value = "批量删除品牌")
@RequestMapping(value = "/delete/batch", method = RequestMethod.POST)
@ResponseBody
public CommonResult deleteBatch(@RequestParam("ids") List<Long> ids) {
int count = brandService.deleteBrand(ids);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation(value = "批量更新显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("showStatus") Integer showStatus) {
int count = brandService.updateShowStatus(ids, showStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation(value = "批量更新厂家制造商状态")
@RequestMapping(value = "/update/factoryStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateFactoryStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("factoryStatus") Integer factoryStatus) {
int count = brandService.updateFactoryStatus(ids, factoryStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}
|
CommonResult commonResult;
int count = brandService.updateBrand(id, pmsBrandParam);
if (count == 1) {
commonResult = CommonResult.success(count);
} else {
commonResult = CommonResult.failed();
}
return commonResult;
| 1,089
| 75
| 1,164
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/PmsProductAttributeCategoryController.java
|
PmsProductAttributeCategoryController
|
delete
|
class PmsProductAttributeCategoryController {
@Autowired
private PmsProductAttributeCategoryService productAttributeCategoryService;
@ApiOperation("添加商品属性分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestParam String name) {
int count = productAttributeCategoryService.create(name);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改商品属性分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestParam String name) {
int count = productAttributeCategoryService.update(id, name);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("删除单个商品属性分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {<FILL_FUNCTION_BODY>}
@ApiOperation("获取单个商品属性分类信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttributeCategory> getItem(@PathVariable Long id) {
PmsProductAttributeCategory productAttributeCategory = productAttributeCategoryService.getItem(id);
return CommonResult.success(productAttributeCategory);
}
@ApiOperation("分页获取所有商品属性分类")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttributeCategory>> getList(@RequestParam(defaultValue = "5") Integer pageSize, @RequestParam(defaultValue = "1") Integer pageNum) {
List<PmsProductAttributeCategory> productAttributeCategoryList = productAttributeCategoryService.getList(pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productAttributeCategoryList));
}
@ApiOperation("获取所有商品属性分类及其下属性")
@RequestMapping(value = "/list/withAttr", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProductAttributeCategoryItem>> getListWithAttr() {
List<PmsProductAttributeCategoryItem> productAttributeCategoryResultList = productAttributeCategoryService.getListWithAttr();
return CommonResult.success(productAttributeCategoryResultList);
}
}
|
int count = productAttributeCategoryService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 655
| 52
| 707
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/PmsProductCategoryController.java
|
PmsProductCategoryController
|
updateShowStatus
|
class PmsProductCategoryController {
@Autowired
private PmsProductCategoryService productCategoryService;
@ApiOperation("添加商品分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam) {
int count = productCategoryService.create(productCategoryParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改商品分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@Validated
@RequestBody PmsProductCategoryParam productCategoryParam) {
int count = productCategoryService.update(id, productCategoryParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页查询商品分类")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductCategory>> getList(@PathVariable Long parentId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<PmsProductCategory> productCategoryList = productCategoryService.getList(parentId, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productCategoryList));
}
@ApiOperation("根据id获取商品分类")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductCategory> getItem(@PathVariable Long id) {
PmsProductCategory productCategory = productCategoryService.getItem(id);
return CommonResult.success(productCategory);
}
@ApiOperation("删除商品分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = productCategoryService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改导航栏显示状态")
@RequestMapping(value = "/update/navStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
int count = productCategoryService.updateNavStatus(ids, navStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {<FILL_FUNCTION_BODY>}
@ApiOperation("查询所有一级分类及子分类")
@RequestMapping(value = "/list/withChildren", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProductCategoryWithChildrenItem>> listWithChildren() {
List<PmsProductCategoryWithChildrenItem> list = productCategoryService.listWithChildren();
return CommonResult.success(list);
}
}
|
int count = productCategoryService.updateShowStatus(ids, showStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 927
| 56
| 983
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/PmsProductController.java
|
PmsProductController
|
create
|
class PmsProductController {
@Autowired
private PmsProductService productService;
@ApiOperation("创建商品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody PmsProductParam productParam) {<FILL_FUNCTION_BODY>}
@ApiOperation("根据商品id获取商品编辑信息")
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id) {
PmsProductResult productResult = productService.getUpdateInfo(id);
return CommonResult.success(productResult);
}
@ApiOperation("更新商品")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductParam productParam) {
int count = productService.update(id, productParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> getList(PmsProductQueryParam productQueryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<PmsProduct> productList = productService.list(productQueryParam, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productList));
}
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getList(String keyword) {
List<PmsProduct> productList = productService.list(keyword);
return CommonResult.success(productList);
}
@ApiOperation("批量修改审核状态")
@RequestMapping(value = "/update/verifyStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateVerifyStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("verifyStatus") Integer verifyStatus,
@RequestParam("detail") String detail) {
int count = productService.updateVerifyStatus(ids, verifyStatus, detail);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量上下架商品")
@RequestMapping(value = "/update/publishStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePublishStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("publishStatus") Integer publishStatus) {
int count = productService.updatePublishStatus(ids, publishStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量推荐商品")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("recommendStatus") Integer recommendStatus) {
int count = productService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量设为新品")
@RequestMapping(value = "/update/newStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNewStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("newStatus") Integer newStatus) {
int count = productService.updateNewStatus(ids, newStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量修改删除状态")
@RequestMapping(value = "/update/deleteStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateDeleteStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("deleteStatus") Integer deleteStatus) {
int count = productService.updateDeleteStatus(ids, deleteStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}
|
int count = productService.create(productParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 1,220
| 51
| 1,271
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/PmsSkuStockController.java
|
PmsSkuStockController
|
update
|
class PmsSkuStockController {
@Autowired
private PmsSkuStockService skuStockService;
@ApiOperation("根据商品ID及sku编码模糊搜索sku库存")
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsSkuStock>> getList(@PathVariable Long pid, @RequestParam(value = "keyword",required = false) String keyword) {
List<PmsSkuStock> skuStockList = skuStockService.getList(pid, keyword);
return CommonResult.success(skuStockList);
}
@ApiOperation("批量更新sku库存信息")
@RequestMapping(value ="/update/{pid}",method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long pid,@RequestBody List<PmsSkuStock> skuStockList){<FILL_FUNCTION_BODY>}
}
|
int count = skuStockService.update(pid,skuStockList);
if(count>0){
return CommonResult.success(count);
}else{
return CommonResult.failed();
}
| 252
| 58
| 310
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsCouponController.java
|
SmsCouponController
|
delete
|
class SmsCouponController {
@Autowired
private SmsCouponService couponService;
@ApiOperation("添加优惠券")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody SmsCouponParam couponParam) {
int count = couponService.create(couponParam);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除优惠券")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {<FILL_FUNCTION_BODY>}
@ApiOperation("修改优惠券")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,@RequestBody SmsCouponParam couponParam) {
int count = couponService.update(id,couponParam);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("根据优惠券名称和类型分页获取优惠券列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsCoupon>> list(
@RequestParam(value = "name",required = false) String name,
@RequestParam(value = "type",required = false) Integer type,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsCoupon> couponList = couponService.list(name,type,pageSize,pageNum);
return CommonResult.success(CommonPage.restPage(couponList));
}
@ApiOperation("获取单个优惠券的详细信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsCouponParam> getItem(@PathVariable Long id) {
SmsCouponParam couponParam = couponService.getItem(id);
return CommonResult.success(couponParam);
}
}
|
int count = couponService.delete(id);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
| 590
| 44
| 634
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsCouponHistoryController.java
|
SmsCouponHistoryController
|
list
|
class SmsCouponHistoryController {
@Autowired
private SmsCouponHistoryService historyService;
@ApiOperation("根据优惠券id,使用状态,订单编号分页获取领取记录")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsCouponHistory>> list(@RequestParam(value = "couponId", required = false) Long couponId,
@RequestParam(value = "useStatus", required = false) Integer useStatus,
@RequestParam(value = "orderSn", required = false) String orderSn,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
List<SmsCouponHistory> historyList = historyService.list(couponId, useStatus, orderSn, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(historyList));
| 217
| 55
| 272
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsFlashPromotionController.java
|
SmsFlashPromotionController
|
update
|
class SmsFlashPromotionController {
@Autowired
private SmsFlashPromotionService flashPromotionService;
@ApiOperation("添加活动")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsFlashPromotion flashPromotion) {
int count = flashPromotionService.create(flashPromotion);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("编辑活动")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotion flashPromotion) {
int count = flashPromotionService.update(id, flashPromotion);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除活动")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = flashPromotionService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改上下线状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, Integer status) {<FILL_FUNCTION_BODY>}
@ApiOperation("获取活动详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotion> getItem(@PathVariable Long id) {
SmsFlashPromotion flashPromotion = flashPromotionService.getItem(id);
return CommonResult.success(flashPromotion);
}
@ApiOperation("根据活动名称分页查询")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsFlashPromotion>> getItem(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsFlashPromotion> flashPromotionList = flashPromotionService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(flashPromotionList));
}
}
|
int count = flashPromotionService.updateStatus(id, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 681
| 50
| 731
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsFlashPromotionProductRelationController.java
|
SmsFlashPromotionProductRelationController
|
create
|
class SmsFlashPromotionProductRelationController {
@Autowired
private SmsFlashPromotionProductRelationService relationService;
@ApiOperation("批量选择商品添加关联")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsFlashPromotionProductRelation> relationList) {<FILL_FUNCTION_BODY>}
@ApiOperation("修改关联信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionProductRelation relation) {
int count = relationService.update(id, relation);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除关联")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = relationService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取关联商品促销信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotionProductRelation> getItem(@PathVariable Long id) {
SmsFlashPromotionProductRelation relation = relationService.getItem(id);
return CommonResult.success(relation);
}
@ApiOperation("分页查询不同场次关联及商品信息")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsFlashPromotionProduct>> list(@RequestParam(value = "flashPromotionId") Long flashPromotionId,
@RequestParam(value = "flashPromotionSessionId") Long flashPromotionSessionId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsFlashPromotionProduct> flashPromotionProductList = relationService.list(flashPromotionId, flashPromotionSessionId, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(flashPromotionProductList));
}
}
|
int count = relationService.create(relationList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 632
| 46
| 678
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsFlashPromotionSessionController.java
|
SmsFlashPromotionSessionController
|
updateStatus
|
class SmsFlashPromotionSessionController {
@Autowired
private SmsFlashPromotionSessionService flashPromotionSessionService;
@ApiOperation("添加场次")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsFlashPromotionSession promotionSession) {
int count = flashPromotionSessionService.create(promotionSession);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改场次")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionSession promotionSession) {
int count = flashPromotionSessionService.update(id, promotionSession);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改启用状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, Integer status) {<FILL_FUNCTION_BODY>}
@ApiOperation("删除场次")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = flashPromotionSessionService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取场次详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotionSession> getItem(@PathVariable Long id) {
SmsFlashPromotionSession promotionSession = flashPromotionSessionService.getItem(id);
return CommonResult.success(promotionSession);
}
@ApiOperation("获取全部场次")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsFlashPromotionSession>> list() {
List<SmsFlashPromotionSession> promotionSessionList = flashPromotionSessionService.list();
return CommonResult.success(promotionSessionList);
}
@ApiOperation("获取全部可选场次及其数量")
@RequestMapping(value = "/selectList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsFlashPromotionSessionDetail>> selectList(Long flashPromotionId) {
List<SmsFlashPromotionSessionDetail> promotionSessionList = flashPromotionSessionService.selectList(flashPromotionId);
return CommonResult.success(promotionSessionList);
}
}
|
int count = flashPromotionSessionService.updateStatus(id, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 731
| 51
| 782
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsHomeAdvertiseController.java
|
SmsHomeAdvertiseController
|
list
|
class SmsHomeAdvertiseController {
@Autowired
private SmsHomeAdvertiseService advertiseService;
@ApiOperation("添加广告")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsHomeAdvertise advertise) {
int count = advertiseService.create(advertise);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("删除广告")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = advertiseService.delete(ids);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("修改上下线状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, Integer status) {
int count = advertiseService.updateStatus(id, status);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("获取广告详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsHomeAdvertise> getItem(@PathVariable Long id) {
SmsHomeAdvertise advertise = advertiseService.getItem(id);
return CommonResult.success(advertise);
}
@ApiOperation("修改广告")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsHomeAdvertise advertise) {
int count = advertiseService.update(id, advertise);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("分页查询广告")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeAdvertise>> list(@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
List<SmsHomeAdvertise> advertiseList = advertiseService.list(name, type, endTime, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(advertiseList));
| 696
| 56
| 752
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsHomeBrandController.java
|
SmsHomeBrandController
|
updateSort
|
class SmsHomeBrandController {
@Autowired
private SmsHomeBrandService homeBrandService;
@ApiOperation("添加首页推荐品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeBrand> homeBrandList) {
int count = homeBrandService.create(homeBrandList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改推荐品牌排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {<FILL_FUNCTION_BODY>}
@ApiOperation("批量删除推荐品牌")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = homeBrandService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量修改推荐品牌状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = homeBrandService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询推荐品牌")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeBrand>> list(@RequestParam(value = "brandName", required = false) String brandName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeBrand> homeBrandList = homeBrandService.list(brandName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeBrandList));
}
}
|
int count = homeBrandService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 640
| 50
| 690
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsHomeNewProductController.java
|
SmsHomeNewProductController
|
delete
|
class SmsHomeNewProductController {
@Autowired
private SmsHomeNewProductService homeNewProductService;
@ApiOperation("添加首页新品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeNewProduct> homeNewProductList) {
int count = homeNewProductService.create(homeNewProductList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改首页新品排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
int count = homeNewProductService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除首页新品")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {<FILL_FUNCTION_BODY>}
@ApiOperation("批量修改首页新品状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = homeNewProductService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询首页新品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeNewProduct>> list(@RequestParam(value = "productName", required = false) String productName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeNewProduct> homeNewProductList = homeNewProductService.list(productName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeNewProductList));
}
}
|
int count = homeNewProductService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 651
| 47
| 698
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsHomeRecommendProductController.java
|
SmsHomeRecommendProductController
|
create
|
class SmsHomeRecommendProductController {
@Autowired
private SmsHomeRecommendProductService recommendProductService;
@ApiOperation("添加首页推荐")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeRecommendProduct> homeRecommendProductList) {<FILL_FUNCTION_BODY>}
@ApiOperation("修改推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
int count = recommendProductService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = recommendProductService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量修改推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = recommendProductService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询推荐")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeRecommendProduct>> list(@RequestParam(value = "productName", required = false) String productName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeRecommendProduct> homeRecommendProductList = recommendProductService.list(productName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeRecommendProductList));
}
}
|
int count = recommendProductService.create(homeRecommendProductList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 646
| 51
| 697
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/SmsHomeRecommendSubjectController.java
|
SmsHomeRecommendSubjectController
|
list
|
class SmsHomeRecommendSubjectController {
@Autowired
private SmsHomeRecommendSubjectService recommendSubjectService;
@ApiOperation("添加首页推荐专题")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeRecommendSubject> homeRecommendSubjectList) {
int count = recommendSubjectService.create(homeRecommendSubjectList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
int count = recommendSubjectService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = recommendSubjectService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量修改推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = recommendSubjectService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询推荐")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeRecommendSubject>> list(@RequestParam(value = "subjectName", required = false) String subjectName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
List<SmsHomeRecommendSubject> homeRecommendSubjectList = recommendSubjectService.list(subjectName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeRecommendSubjectList));
| 638
| 61
| 699
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/UmsAdminController.java
|
UmsAdminController
|
delete
|
class UmsAdminController {
@Value("${jwt.tokenHeader}")
private String tokenHeader;
@Value("${jwt.tokenHead}")
private String tokenHead;
@Autowired
private UmsAdminService adminService;
@Autowired
private UmsRoleService roleService;
@ApiOperation(value = "用户注册")
@RequestMapping(value = "/register", method = RequestMethod.POST)
@ResponseBody
public CommonResult<UmsAdmin> register(@Validated @RequestBody UmsAdminParam umsAdminParam) {
UmsAdmin umsAdmin = adminService.register(umsAdminParam);
if (umsAdmin == null) {
return CommonResult.failed();
}
return CommonResult.success(umsAdmin);
}
@ApiOperation(value = "登录以后返回token")
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public CommonResult login(@Validated @RequestBody UmsAdminLoginParam umsAdminLoginParam) {
String token = adminService.login(umsAdminLoginParam.getUsername(), umsAdminLoginParam.getPassword());
if (token == null) {
return CommonResult.validateFailed("用户名或密码错误");
}
Map<String, String> tokenMap = new HashMap<>();
tokenMap.put("token", token);
tokenMap.put("tokenHead", tokenHead);
return CommonResult.success(tokenMap);
}
@ApiOperation(value = "刷新token")
@RequestMapping(value = "/refreshToken", method = RequestMethod.GET)
@ResponseBody
public CommonResult refreshToken(HttpServletRequest request) {
String token = request.getHeader(tokenHeader);
String refreshToken = adminService.refreshToken(token);
if (refreshToken == null) {
return CommonResult.failed("token已经过期!");
}
Map<String, String> tokenMap = new HashMap<>();
tokenMap.put("token", refreshToken);
tokenMap.put("tokenHead", tokenHead);
return CommonResult.success(tokenMap);
}
@ApiOperation(value = "获取当前登录用户信息")
@RequestMapping(value = "/info", method = RequestMethod.GET)
@ResponseBody
public CommonResult getAdminInfo(Principal principal) {
if(principal==null){
return CommonResult.unauthorized(null);
}
String username = principal.getName();
UmsAdmin umsAdmin = adminService.getAdminByUsername(username);
Map<String, Object> data = new HashMap<>();
data.put("username", umsAdmin.getUsername());
data.put("menus", roleService.getMenuList(umsAdmin.getId()));
data.put("icon", umsAdmin.getIcon());
List<UmsRole> roleList = adminService.getRoleList(umsAdmin.getId());
if(CollUtil.isNotEmpty(roleList)){
List<String> roles = roleList.stream().map(UmsRole::getName).collect(Collectors.toList());
data.put("roles",roles);
}
return CommonResult.success(data);
}
@ApiOperation(value = "登出功能")
@RequestMapping(value = "/logout", method = RequestMethod.POST)
@ResponseBody
public CommonResult logout() {
return CommonResult.success(null);
}
@ApiOperation("根据用户名或姓名分页获取用户列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsAdmin> adminList = adminService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(adminList));
}
@ApiOperation("获取指定用户信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsAdmin> getItem(@PathVariable Long id) {
UmsAdmin admin = adminService.getItem(id);
return CommonResult.success(admin);
}
@ApiOperation("修改指定用户信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsAdmin admin) {
int count = adminService.update(id, admin);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改指定用户密码")
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePassword(@Validated @RequestBody UpdateAdminPasswordParam updatePasswordParam) {
int status = adminService.updatePassword(updatePasswordParam);
if (status > 0) {
return CommonResult.success(status);
} else if (status == -1) {
return CommonResult.failed("提交参数不合法");
} else if (status == -2) {
return CommonResult.failed("找不到该用户");
} else if (status == -3) {
return CommonResult.failed("旧密码错误");
} else {
return CommonResult.failed();
}
}
@ApiOperation("删除指定用户信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {<FILL_FUNCTION_BODY>}
@ApiOperation("修改帐号状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status) {
UmsAdmin umsAdmin = new UmsAdmin();
umsAdmin.setStatus(status);
int count = adminService.update(id,umsAdmin);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("给用户分配角色")
@RequestMapping(value = "/role/update", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRole(@RequestParam("adminId") Long adminId,
@RequestParam("roleIds") List<Long> roleIds) {
int count = adminService.updateRole(adminId, roleIds);
if (count >= 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取指定用户的角色")
@RequestMapping(value = "/role/{adminId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsRole>> getRoleList(@PathVariable Long adminId) {
List<UmsRole> roleList = adminService.getRoleList(adminId);
return CommonResult.success(roleList);
}
}
|
int count = adminService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 1,839
| 45
| 1,884
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/UmsMenuController.java
|
UmsMenuController
|
update
|
class UmsMenuController {
@Autowired
private UmsMenuService menuService;
@ApiOperation("添加后台菜单")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsMenu umsMenu) {
int count = menuService.create(umsMenu);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台菜单")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsMenu umsMenu) {<FILL_FUNCTION_BODY>}
@ApiOperation("根据ID获取菜单详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsMenu> getItem(@PathVariable Long id) {
UmsMenu umsMenu = menuService.getItem(id);
return CommonResult.success(umsMenu);
}
@ApiOperation("根据ID删除后台菜单")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = menuService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页查询后台菜单")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsMenu>> list(@PathVariable Long parentId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsMenu> menuList = menuService.list(parentId, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(menuList));
}
@ApiOperation("树形结构返回所有菜单列表")
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenuNode>> treeList() {
List<UmsMenuNode> list = menuService.treeList();
return CommonResult.success(list);
}
@ApiOperation("修改菜单显示状态")
@RequestMapping(value = "/updateHidden/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateHidden(@PathVariable Long id, @RequestParam("hidden") Integer hidden) {
int count = menuService.updateHidden(id, hidden);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}
|
int count = menuService.update(id, umsMenu);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 767
| 54
| 821
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/UmsResourceCategoryController.java
|
UmsResourceCategoryController
|
update
|
class UmsResourceCategoryController {
@Autowired
private UmsResourceCategoryService resourceCategoryService;
@ApiOperation("查询所有后台资源分类")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResourceCategory>> listAll() {
List<UmsResourceCategory> resourceList = resourceCategoryService.listAll();
return CommonResult.success(resourceList);
}
@ApiOperation("添加后台资源分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResourceCategory umsResourceCategory) {
int count = resourceCategoryService.create(umsResourceCategory);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台资源分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsResourceCategory umsResourceCategory) {<FILL_FUNCTION_BODY>}
@ApiOperation("根据ID删除后台资源分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = resourceCategoryService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}
|
int count = resourceCategoryService.update(id, umsResourceCategory);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 410
| 56
| 466
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/UmsResourceController.java
|
UmsResourceController
|
create
|
class UmsResourceController {
@Autowired
private UmsResourceService resourceService;
@Autowired
private DynamicSecurityMetadataSource dynamicSecurityMetadataSource;
@ApiOperation("添加后台资源")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResource umsResource) {<FILL_FUNCTION_BODY>}
@ApiOperation("修改后台资源")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsResource umsResource) {
int count = resourceService.update(id, umsResource);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据ID获取资源详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsResource> getItem(@PathVariable Long id) {
UmsResource umsResource = resourceService.getItem(id);
return CommonResult.success(umsResource);
}
@ApiOperation("根据ID删除后台资源")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = resourceService.delete(id);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页模糊查询后台资源")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsResource>> list(@RequestParam(required = false) Long categoryId,
@RequestParam(required = false) String nameKeyword,
@RequestParam(required = false) String urlKeyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsResource> resourceList = resourceService.list(categoryId,nameKeyword, urlKeyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(resourceList));
}
@ApiOperation("查询所有后台资源")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listAll() {
List<UmsResource> resourceList = resourceService.listAll();
return CommonResult.success(resourceList);
}
}
|
int count = resourceService.create(umsResource);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
| 725
| 62
| 787
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/controller/UmsRoleController.java
|
UmsRoleController
|
delete
|
class UmsRoleController {
@Autowired
private UmsRoleService roleService;
@ApiOperation("添加角色")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsRole role) {
int count = roleService.create(role);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改角色")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsRole role) {
int count = roleService.update(id, role);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除角色")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {<FILL_FUNCTION_BODY>}
@ApiOperation("获取所有角色")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsRole>> listAll() {
List<UmsRole> roleList = roleService.list();
return CommonResult.success(roleList);
}
@ApiOperation("根据角色名称分页获取角色列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsRole>> list(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsRole> roleList = roleService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(roleList));
}
@ApiOperation("修改角色状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestParam(value = "status") Integer status) {
UmsRole umsRole = new UmsRole();
umsRole.setStatus(status);
int count = roleService.update(id, umsRole);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取角色相关菜单")
@RequestMapping(value = "/listMenu/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenu>> listMenu(@PathVariable Long roleId) {
List<UmsMenu> roleList = roleService.listMenu(roleId);
return CommonResult.success(roleList);
}
@ApiOperation("获取角色相关资源")
@RequestMapping(value = "/listResource/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listResource(@PathVariable Long roleId) {
List<UmsResource> roleList = roleService.listResource(roleId);
return CommonResult.success(roleList);
}
@ApiOperation("给角色分配菜单")
@RequestMapping(value = "/allocMenu", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocMenu(@RequestParam Long roleId, @RequestParam List<Long> menuIds) {
int count = roleService.allocMenu(roleId, menuIds);
return CommonResult.success(count);
}
@ApiOperation("给角色分配资源")
@RequestMapping(value = "/allocResource", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocResource(@RequestParam Long roleId, @RequestParam List<Long> resourceIds) {
int count = roleService.allocResource(roleId, resourceIds);
return CommonResult.success(count);
}
}
|
int count = roleService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
| 1,050
| 45
| 1,095
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/CmsSubjectServiceImpl.java
|
CmsSubjectServiceImpl
|
list
|
class CmsSubjectServiceImpl implements CmsSubjectService {
@Autowired
private CmsSubjectMapper subjectMapper;
@Override
public List<CmsSubject> listAll() {
return subjectMapper.selectByExample(new CmsSubjectExample());
}
@Override
public List<CmsSubject> list(String keyword, Integer pageNum, Integer pageSize) {<FILL_FUNCTION_BODY>}
}
|
PageHelper.startPage(pageNum, pageSize);
CmsSubjectExample example = new CmsSubjectExample();
CmsSubjectExample.Criteria criteria = example.createCriteria();
if (!StrUtil.isEmpty(keyword)) {
criteria.andTitleLike("%" + keyword + "%");
}
return subjectMapper.selectByExample(example);
| 108
| 89
| 197
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderReturnApplyServiceImpl.java
|
OmsOrderReturnApplyServiceImpl
|
updateStatus
|
class OmsOrderReturnApplyServiceImpl implements OmsOrderReturnApplyService {
@Autowired
private OmsOrderReturnApplyDao returnApplyDao;
@Autowired
private OmsOrderReturnApplyMapper returnApplyMapper;
@Override
public List<OmsOrderReturnApply> list(OmsReturnApplyQueryParam queryParam, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
return returnApplyDao.getList(queryParam);
}
@Override
public int delete(List<Long> ids) {
OmsOrderReturnApplyExample example = new OmsOrderReturnApplyExample();
example.createCriteria().andIdIn(ids).andStatusEqualTo(3);
return returnApplyMapper.deleteByExample(example);
}
@Override
public int updateStatus(Long id, OmsUpdateStatusParam statusParam) {<FILL_FUNCTION_BODY>}
@Override
public OmsOrderReturnApplyResult getItem(Long id) {
return returnApplyDao.getDetail(id);
}
}
|
Integer status = statusParam.getStatus();
OmsOrderReturnApply returnApply = new OmsOrderReturnApply();
if(status.equals(1)){
//确认退货
returnApply.setId(id);
returnApply.setStatus(1);
returnApply.setReturnAmount(statusParam.getReturnAmount());
returnApply.setCompanyAddressId(statusParam.getCompanyAddressId());
returnApply.setHandleTime(new Date());
returnApply.setHandleMan(statusParam.getHandleMan());
returnApply.setHandleNote(statusParam.getHandleNote());
}else if(status.equals(2)){
//完成退货
returnApply.setId(id);
returnApply.setStatus(2);
returnApply.setReceiveTime(new Date());
returnApply.setReceiveMan(statusParam.getReceiveMan());
returnApply.setReceiveNote(statusParam.getReceiveNote());
}else if(status.equals(3)){
//拒绝退货
returnApply.setId(id);
returnApply.setStatus(3);
returnApply.setHandleTime(new Date());
returnApply.setHandleMan(statusParam.getHandleMan());
returnApply.setHandleNote(statusParam.getHandleNote());
}else{
return 0;
}
return returnApplyMapper.updateByPrimaryKeySelective(returnApply);
| 272
| 345
| 617
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderReturnReasonServiceImpl.java
|
OmsOrderReturnReasonServiceImpl
|
list
|
class OmsOrderReturnReasonServiceImpl implements OmsOrderReturnReasonService {
@Autowired
private OmsOrderReturnReasonMapper returnReasonMapper;
@Override
public int create(OmsOrderReturnReason returnReason) {
returnReason.setCreateTime(new Date());
return returnReasonMapper.insert(returnReason);
}
@Override
public int update(Long id, OmsOrderReturnReason returnReason) {
returnReason.setId(id);
return returnReasonMapper.updateByPrimaryKey(returnReason);
}
@Override
public int delete(List<Long> ids) {
OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
example.createCriteria().andIdIn(ids);
return returnReasonMapper.deleteByExample(example);
}
@Override
public List<OmsOrderReturnReason> list(Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
@Override
public int updateStatus(List<Long> ids, Integer status) {
if(!status.equals(0)&&!status.equals(1)){
return 0;
}
OmsOrderReturnReason record = new OmsOrderReturnReason();
record.setStatus(status);
OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
example.createCriteria().andIdIn(ids);
return returnReasonMapper.updateByExampleSelective(record,example);
}
@Override
public OmsOrderReturnReason getItem(Long id) {
return returnReasonMapper.selectByPrimaryKey(id);
}
}
|
PageHelper.startPage(pageNum,pageSize);
OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
example.setOrderByClause("sort desc");
return returnReasonMapper.selectByExample(example);
| 405
| 61
| 466
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderServiceImpl.java
|
OmsOrderServiceImpl
|
delivery
|
class OmsOrderServiceImpl implements OmsOrderService {
@Autowired
private OmsOrderMapper orderMapper;
@Autowired
private OmsOrderDao orderDao;
@Autowired
private OmsOrderOperateHistoryDao orderOperateHistoryDao;
@Autowired
private OmsOrderOperateHistoryMapper orderOperateHistoryMapper;
@Override
public List<OmsOrder> list(OmsOrderQueryParam queryParam, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
return orderDao.getList(queryParam);
}
@Override
public int delivery(List<OmsOrderDeliveryParam> deliveryParamList) {<FILL_FUNCTION_BODY>}
@Override
public int close(List<Long> ids, String note) {
OmsOrder record = new OmsOrder();
record.setStatus(4);
OmsOrderExample example = new OmsOrderExample();
example.createCriteria().andDeleteStatusEqualTo(0).andIdIn(ids);
int count = orderMapper.updateByExampleSelective(record, example);
List<OmsOrderOperateHistory> historyList = ids.stream().map(orderId -> {
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(orderId);
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(4);
history.setNote("订单关闭:"+note);
return history;
}).collect(Collectors.toList());
orderOperateHistoryDao.insertList(historyList);
return count;
}
@Override
public int delete(List<Long> ids) {
OmsOrder record = new OmsOrder();
record.setDeleteStatus(1);
OmsOrderExample example = new OmsOrderExample();
example.createCriteria().andDeleteStatusEqualTo(0).andIdIn(ids);
return orderMapper.updateByExampleSelective(record, example);
}
@Override
public OmsOrderDetail detail(Long id) {
return orderDao.getDetail(id);
}
@Override
public int updateReceiverInfo(OmsReceiverInfoParam receiverInfoParam) {
OmsOrder order = new OmsOrder();
order.setId(receiverInfoParam.getOrderId());
order.setReceiverName(receiverInfoParam.getReceiverName());
order.setReceiverPhone(receiverInfoParam.getReceiverPhone());
order.setReceiverPostCode(receiverInfoParam.getReceiverPostCode());
order.setReceiverDetailAddress(receiverInfoParam.getReceiverDetailAddress());
order.setReceiverProvince(receiverInfoParam.getReceiverProvince());
order.setReceiverCity(receiverInfoParam.getReceiverCity());
order.setReceiverRegion(receiverInfoParam.getReceiverRegion());
order.setModifyTime(new Date());
int count = orderMapper.updateByPrimaryKeySelective(order);
//插入操作记录
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(receiverInfoParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(receiverInfoParam.getStatus());
history.setNote("修改收货人信息");
orderOperateHistoryMapper.insert(history);
return count;
}
@Override
public int updateMoneyInfo(OmsMoneyInfoParam moneyInfoParam) {
OmsOrder order = new OmsOrder();
order.setId(moneyInfoParam.getOrderId());
order.setFreightAmount(moneyInfoParam.getFreightAmount());
order.setDiscountAmount(moneyInfoParam.getDiscountAmount());
order.setModifyTime(new Date());
int count = orderMapper.updateByPrimaryKeySelective(order);
//插入操作记录
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(moneyInfoParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(moneyInfoParam.getStatus());
history.setNote("修改费用信息");
orderOperateHistoryMapper.insert(history);
return count;
}
@Override
public int updateNote(Long id, String note, Integer status) {
OmsOrder order = new OmsOrder();
order.setId(id);
order.setNote(note);
order.setModifyTime(new Date());
int count = orderMapper.updateByPrimaryKeySelective(order);
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(id);
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(status);
history.setNote("修改备注信息:"+note);
orderOperateHistoryMapper.insert(history);
return count;
}
}
|
//批量发货
int count = orderDao.delivery(deliveryParamList);
//添加操作记录
List<OmsOrderOperateHistory> operateHistoryList = deliveryParamList.stream()
.map(omsOrderDeliveryParam -> {
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(omsOrderDeliveryParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(2);
history.setNote("完成发货");
return history;
}).collect(Collectors.toList());
orderOperateHistoryDao.insertList(operateHistoryList);
return count;
| 1,318
| 188
| 1,506
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/OssServiceImpl.java
|
OssServiceImpl
|
policy
|
class OssServiceImpl implements OssService {
private static final Logger LOGGER = LoggerFactory.getLogger(OssServiceImpl.class);
@Value("${aliyun.oss.policy.expire}")
private int ALIYUN_OSS_EXPIRE;
@Value("${aliyun.oss.maxSize}")
private int ALIYUN_OSS_MAX_SIZE;
@Value("${aliyun.oss.callback}")
private String ALIYUN_OSS_CALLBACK;
@Value("${aliyun.oss.bucketName}")
private String ALIYUN_OSS_BUCKET_NAME;
@Value("${aliyun.oss.endpoint}")
private String ALIYUN_OSS_ENDPOINT;
@Value("${aliyun.oss.dir.prefix}")
private String ALIYUN_OSS_DIR_PREFIX;
@Autowired
private OSSClient ossClient;
/**
* 签名生成
*/
@Override
public OssPolicyResult policy() {<FILL_FUNCTION_BODY>}
@Override
public OssCallbackResult callback(HttpServletRequest request) {
OssCallbackResult result= new OssCallbackResult();
String filename = request.getParameter("filename");
filename = "http://".concat(ALIYUN_OSS_BUCKET_NAME).concat(".").concat(ALIYUN_OSS_ENDPOINT).concat("/").concat(filename);
result.setFilename(filename);
result.setSize(request.getParameter("size"));
result.setMimeType(request.getParameter("mimeType"));
result.setWidth(request.getParameter("width"));
result.setHeight(request.getParameter("height"));
return result;
}
}
|
OssPolicyResult result = new OssPolicyResult();
// 存储目录
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String dir = ALIYUN_OSS_DIR_PREFIX+sdf.format(new Date());
// 签名有效期
long expireEndTime = System.currentTimeMillis() + ALIYUN_OSS_EXPIRE * 1000;
Date expiration = new Date(expireEndTime);
// 文件大小
long maxSize = ALIYUN_OSS_MAX_SIZE * 1024 * 1024;
// 回调
OssCallbackParam callback = new OssCallbackParam();
callback.setCallbackUrl(ALIYUN_OSS_CALLBACK);
callback.setCallbackBody("filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}");
callback.setCallbackBodyType("application/x-www-form-urlencoded");
// 提交节点
String action = "http://" + ALIYUN_OSS_BUCKET_NAME + "." + ALIYUN_OSS_ENDPOINT;
try {
PolicyConditions policyConds = new PolicyConditions();
policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, maxSize);
policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, dir);
String postPolicy = ossClient.generatePostPolicy(expiration, policyConds);
byte[] binaryData = postPolicy.getBytes("utf-8");
String policy = BinaryUtil.toBase64String(binaryData);
String signature = ossClient.calculatePostSignature(postPolicy);
String callbackData = BinaryUtil.toBase64String(JSONUtil.parse(callback).toString().getBytes("utf-8"));
// 返回结果
result.setAccessKeyId(ossClient.getCredentialsProvider().getCredentials().getAccessKeyId());
result.setPolicy(policy);
result.setSignature(signature);
result.setDir(dir);
result.setCallback(callbackData);
result.setHost(action);
} catch (Exception e) {
LOGGER.error("签名生成失败", e);
}
return result;
| 459
| 626
| 1,085
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/PmsBrandServiceImpl.java
|
PmsBrandServiceImpl
|
updateFactoryStatus
|
class PmsBrandServiceImpl implements PmsBrandService {
@Autowired
private PmsBrandMapper brandMapper;
@Autowired
private PmsProductMapper productMapper;
@Override
public List<PmsBrand> listAllBrand() {
return brandMapper.selectByExample(new PmsBrandExample());
}
@Override
public int createBrand(PmsBrandParam pmsBrandParam) {
PmsBrand pmsBrand = new PmsBrand();
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
//如果创建时首字母为空,取名称的第一个为首字母
if (StrUtil.isEmpty(pmsBrand.getFirstLetter())) {
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
}
return brandMapper.insertSelective(pmsBrand);
}
@Override
public int updateBrand(Long id, PmsBrandParam pmsBrandParam) {
PmsBrand pmsBrand = new PmsBrand();
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
pmsBrand.setId(id);
//如果创建时首字母为空,取名称的第一个为首字母
if (StrUtil.isEmpty(pmsBrand.getFirstLetter())) {
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
}
//更新品牌时要更新商品中的品牌名称
PmsProduct product = new PmsProduct();
product.setBrandName(pmsBrand.getName());
PmsProductExample example = new PmsProductExample();
example.createCriteria().andBrandIdEqualTo(id);
productMapper.updateByExampleSelective(product,example);
return brandMapper.updateByPrimaryKeySelective(pmsBrand);
}
@Override
public int deleteBrand(Long id) {
return brandMapper.deleteByPrimaryKey(id);
}
@Override
public int deleteBrand(List<Long> ids) {
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.deleteByExample(pmsBrandExample);
}
@Override
public List<PmsBrand> listBrand(String keyword, Integer showStatus, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.setOrderByClause("sort desc");
PmsBrandExample.Criteria criteria = pmsBrandExample.createCriteria();
if (!StrUtil.isEmpty(keyword)) {
criteria.andNameLike("%" + keyword + "%");
}
if(showStatus!=null){
criteria.andShowStatusEqualTo(showStatus);
}
return brandMapper.selectByExample(pmsBrandExample);
}
@Override
public PmsBrand getBrand(Long id) {
return brandMapper.selectByPrimaryKey(id);
}
@Override
public int updateShowStatus(List<Long> ids, Integer showStatus) {
PmsBrand pmsBrand = new PmsBrand();
pmsBrand.setShowStatus(showStatus);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
@Override
public int updateFactoryStatus(List<Long> ids, Integer factoryStatus) {<FILL_FUNCTION_BODY>}
}
|
PmsBrand pmsBrand = new PmsBrand();
pmsBrand.setFactoryStatus(factoryStatus);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
| 984
| 95
| 1,079
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/PmsProductAttributeCategoryServiceImpl.java
|
PmsProductAttributeCategoryServiceImpl
|
update
|
class PmsProductAttributeCategoryServiceImpl implements PmsProductAttributeCategoryService {
@Autowired
private PmsProductAttributeCategoryMapper productAttributeCategoryMapper;
@Autowired
private PmsProductAttributeCategoryDao productAttributeCategoryDao;
@Override
public int create(String name) {
PmsProductAttributeCategory productAttributeCategory = new PmsProductAttributeCategory();
productAttributeCategory.setName(name);
return productAttributeCategoryMapper.insertSelective(productAttributeCategory);
}
@Override
public int update(Long id, String name) {<FILL_FUNCTION_BODY>}
@Override
public int delete(Long id) {
return productAttributeCategoryMapper.deleteByPrimaryKey(id);
}
@Override
public PmsProductAttributeCategory getItem(Long id) {
return productAttributeCategoryMapper.selectByPrimaryKey(id);
}
@Override
public List<PmsProductAttributeCategory> getList(Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
return productAttributeCategoryMapper.selectByExample(new PmsProductAttributeCategoryExample());
}
@Override
public List<PmsProductAttributeCategoryItem> getListWithAttr() {
return productAttributeCategoryDao.getListWithAttr();
}
}
|
PmsProductAttributeCategory productAttributeCategory = new PmsProductAttributeCategory();
productAttributeCategory.setName(name);
productAttributeCategory.setId(id);
return productAttributeCategoryMapper.updateByPrimaryKeySelective(productAttributeCategory);
| 330
| 62
| 392
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/PmsProductAttributeServiceImpl.java
|
PmsProductAttributeServiceImpl
|
getList
|
class PmsProductAttributeServiceImpl implements PmsProductAttributeService {
@Autowired
private PmsProductAttributeMapper productAttributeMapper;
@Autowired
private PmsProductAttributeCategoryMapper productAttributeCategoryMapper;
@Autowired
private PmsProductAttributeDao productAttributeDao;
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
@Override
public int create(PmsProductAttributeParam pmsProductAttributeParam) {
PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
BeanUtils.copyProperties(pmsProductAttributeParam, pmsProductAttribute);
int count = productAttributeMapper.insertSelective(pmsProductAttribute);
//新增商品属性以后需要更新商品属性分类数量
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
if(pmsProductAttribute.getType()==0){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()+1);
}else if(pmsProductAttribute.getType()==1){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()+1);
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
@Override
public int update(Long id, PmsProductAttributeParam productAttributeParam) {
PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
pmsProductAttribute.setId(id);
BeanUtils.copyProperties(productAttributeParam, pmsProductAttribute);
return productAttributeMapper.updateByPrimaryKeySelective(pmsProductAttribute);
}
@Override
public PmsProductAttribute getItem(Long id) {
return productAttributeMapper.selectByPrimaryKey(id);
}
@Override
public int delete(List<Long> ids) {
//获取分类
PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
Integer type = pmsProductAttribute.getType();
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.createCriteria().andIdIn(ids);
int count = productAttributeMapper.deleteByExample(example);
//删除完成后修改数量
if(type==0){
if(pmsProductAttributeCategory.getAttributeCount()>=count){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
}else{
pmsProductAttributeCategory.setAttributeCount(0);
}
}else if(type==1){
if(pmsProductAttributeCategory.getParamCount()>=count){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
}else{
pmsProductAttributeCategory.setParamCount(0);
}
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
@Override
public List<ProductAttrInfo> getProductAttrInfo(Long productCategoryId) {
return productAttributeDao.getProductAttrInfo(productCategoryId);
}
}
|
PageHelper.startPage(pageNum, pageSize);
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.setOrderByClause("sort desc");
example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
return productAttributeMapper.selectByExample(example);
| 858
| 84
| 942
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/PmsProductCategoryServiceImpl.java
|
PmsProductCategoryServiceImpl
|
setCategoryLevel
|
class PmsProductCategoryServiceImpl implements PmsProductCategoryService {
@Autowired
private PmsProductCategoryMapper productCategoryMapper;
@Autowired
private PmsProductMapper productMapper;
@Autowired
private PmsProductCategoryAttributeRelationDao productCategoryAttributeRelationDao;
@Autowired
private PmsProductCategoryAttributeRelationMapper productCategoryAttributeRelationMapper;
@Autowired
private PmsProductCategoryDao productCategoryDao;
@Override
public int create(PmsProductCategoryParam pmsProductCategoryParam) {
PmsProductCategory productCategory = new PmsProductCategory();
productCategory.setProductCount(0);
BeanUtils.copyProperties(pmsProductCategoryParam, productCategory);
//没有父分类时为一级分类
setCategoryLevel(productCategory);
int count = productCategoryMapper.insertSelective(productCategory);
//创建筛选属性关联
List<Long> productAttributeIdList = pmsProductCategoryParam.getProductAttributeIdList();
if(!CollectionUtils.isEmpty(productAttributeIdList)){
insertRelationList(productCategory.getId(), productAttributeIdList);
}
return count;
}
/**
* 批量插入商品分类与筛选属性关系表
* @param productCategoryId 商品分类id
* @param productAttributeIdList 相关商品筛选属性id集合
*/
private void insertRelationList(Long productCategoryId, List<Long> productAttributeIdList) {
List<PmsProductCategoryAttributeRelation> relationList = new ArrayList<>();
for (Long productAttrId : productAttributeIdList) {
PmsProductCategoryAttributeRelation relation = new PmsProductCategoryAttributeRelation();
relation.setProductAttributeId(productAttrId);
relation.setProductCategoryId(productCategoryId);
relationList.add(relation);
}
productCategoryAttributeRelationDao.insertList(relationList);
}
@Override
public int update(Long id, PmsProductCategoryParam pmsProductCategoryParam) {
PmsProductCategory productCategory = new PmsProductCategory();
productCategory.setId(id);
BeanUtils.copyProperties(pmsProductCategoryParam, productCategory);
setCategoryLevel(productCategory);
//更新商品分类时要更新商品中的名称
PmsProduct product = new PmsProduct();
product.setProductCategoryName(productCategory.getName());
PmsProductExample example = new PmsProductExample();
example.createCriteria().andProductCategoryIdEqualTo(id);
productMapper.updateByExampleSelective(product,example);
//同时更新筛选属性的信息
if(!CollectionUtils.isEmpty(pmsProductCategoryParam.getProductAttributeIdList())){
PmsProductCategoryAttributeRelationExample relationExample = new PmsProductCategoryAttributeRelationExample();
relationExample.createCriteria().andProductCategoryIdEqualTo(id);
productCategoryAttributeRelationMapper.deleteByExample(relationExample);
insertRelationList(id,pmsProductCategoryParam.getProductAttributeIdList());
}else{
PmsProductCategoryAttributeRelationExample relationExample = new PmsProductCategoryAttributeRelationExample();
relationExample.createCriteria().andProductCategoryIdEqualTo(id);
productCategoryAttributeRelationMapper.deleteByExample(relationExample);
}
return productCategoryMapper.updateByPrimaryKeySelective(productCategory);
}
@Override
public List<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
PmsProductCategoryExample example = new PmsProductCategoryExample();
example.setOrderByClause("sort desc");
example.createCriteria().andParentIdEqualTo(parentId);
return productCategoryMapper.selectByExample(example);
}
@Override
public int delete(Long id) {
return productCategoryMapper.deleteByPrimaryKey(id);
}
@Override
public PmsProductCategory getItem(Long id) {
return productCategoryMapper.selectByPrimaryKey(id);
}
@Override
public int updateNavStatus(List<Long> ids, Integer navStatus) {
PmsProductCategory productCategory = new PmsProductCategory();
productCategory.setNavStatus(navStatus);
PmsProductCategoryExample example = new PmsProductCategoryExample();
example.createCriteria().andIdIn(ids);
return productCategoryMapper.updateByExampleSelective(productCategory, example);
}
@Override
public int updateShowStatus(List<Long> ids, Integer showStatus) {
PmsProductCategory productCategory = new PmsProductCategory();
productCategory.setShowStatus(showStatus);
PmsProductCategoryExample example = new PmsProductCategoryExample();
example.createCriteria().andIdIn(ids);
return productCategoryMapper.updateByExampleSelective(productCategory, example);
}
@Override
public List<PmsProductCategoryWithChildrenItem> listWithChildren() {
return productCategoryDao.listWithChildren();
}
/**
* 根据分类的parentId设置分类的level
*/
private void setCategoryLevel(PmsProductCategory productCategory) {<FILL_FUNCTION_BODY>}
}
|
//没有父分类时为一级分类
if (productCategory.getParentId() == 0) {
productCategory.setLevel(0);
} else {
//有父分类时选择根据父分类level设置
PmsProductCategory parentCategory = productCategoryMapper.selectByPrimaryKey(productCategory.getParentId());
if (parentCategory != null) {
productCategory.setLevel(parentCategory.getLevel() + 1);
} else {
productCategory.setLevel(0);
}
}
| 1,317
| 131
| 1,448
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/PmsSkuStockServiceImpl.java
|
PmsSkuStockServiceImpl
|
getList
|
class PmsSkuStockServiceImpl implements PmsSkuStockService {
@Autowired
private PmsSkuStockMapper skuStockMapper;
@Autowired
private PmsSkuStockDao skuStockDao;
@Override
public List<PmsSkuStock> getList(Long pid, String keyword) {<FILL_FUNCTION_BODY>}
@Override
public int update(Long pid, List<PmsSkuStock> skuStockList) {
List<PmsSkuStock> filterSkuList = skuStockList.stream()
.filter(item -> pid.equals(item.getProductId()))
.collect(Collectors.toList());
return skuStockDao.replaceList(filterSkuList);
}
}
|
PmsSkuStockExample example = new PmsSkuStockExample();
PmsSkuStockExample.Criteria criteria = example.createCriteria().andProductIdEqualTo(pid);
if (!StrUtil.isEmpty(keyword)) {
criteria.andSkuCodeLike("%" + keyword + "%");
}
return skuStockMapper.selectByExample(example);
| 210
| 97
| 307
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsCouponHistoryServiceImpl.java
|
SmsCouponHistoryServiceImpl
|
list
|
class SmsCouponHistoryServiceImpl implements SmsCouponHistoryService {
@Autowired
private SmsCouponHistoryMapper historyMapper;
@Override
public List<SmsCouponHistory> list(Long couponId, Integer useStatus, String orderSn, Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
PageHelper.startPage(pageNum,pageSize);
SmsCouponHistoryExample example = new SmsCouponHistoryExample();
SmsCouponHistoryExample.Criteria criteria = example.createCriteria();
if(couponId!=null){
criteria.andCouponIdEqualTo(couponId);
}
if(useStatus!=null){
criteria.andUseStatusEqualTo(useStatus);
}
if(!StrUtil.isEmpty(orderSn)){
criteria.andOrderSnEqualTo(orderSn);
}
return historyMapper.selectByExample(example);
| 91
| 153
| 244
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsCouponServiceImpl.java
|
SmsCouponServiceImpl
|
create
|
class SmsCouponServiceImpl implements SmsCouponService {
@Autowired
private SmsCouponMapper couponMapper;
@Autowired
private SmsCouponProductRelationMapper productRelationMapper;
@Autowired
private SmsCouponProductCategoryRelationMapper productCategoryRelationMapper;
@Autowired
private SmsCouponProductRelationDao productRelationDao;
@Autowired
private SmsCouponProductCategoryRelationDao productCategoryRelationDao;
@Autowired
private SmsCouponDao couponDao;
@Override
public int create(SmsCouponParam couponParam) {<FILL_FUNCTION_BODY>}
@Override
public int delete(Long id) {
//删除优惠券
int count = couponMapper.deleteByPrimaryKey(id);
//删除商品关联
deleteProductRelation(id);
//删除商品分类关联
deleteProductCategoryRelation(id);
return count;
}
private void deleteProductCategoryRelation(Long id) {
SmsCouponProductCategoryRelationExample productCategoryRelationExample = new SmsCouponProductCategoryRelationExample();
productCategoryRelationExample.createCriteria().andCouponIdEqualTo(id);
productCategoryRelationMapper.deleteByExample(productCategoryRelationExample);
}
private void deleteProductRelation(Long id) {
SmsCouponProductRelationExample productRelationExample = new SmsCouponProductRelationExample();
productRelationExample.createCriteria().andCouponIdEqualTo(id);
productRelationMapper.deleteByExample(productRelationExample);
}
@Override
public int update(Long id, SmsCouponParam couponParam) {
couponParam.setId(id);
int count =couponMapper.updateByPrimaryKey(couponParam);
//删除后插入优惠券和商品关系表
if(couponParam.getUseType().equals(2)){
for(SmsCouponProductRelation productRelation:couponParam.getProductRelationList()){
productRelation.setCouponId(couponParam.getId());
}
deleteProductRelation(id);
productRelationDao.insertList(couponParam.getProductRelationList());
}
//删除后插入优惠券和商品分类关系表
if(couponParam.getUseType().equals(1)){
for (SmsCouponProductCategoryRelation couponProductCategoryRelation : couponParam.getProductCategoryRelationList()) {
couponProductCategoryRelation.setCouponId(couponParam.getId());
}
deleteProductCategoryRelation(id);
productCategoryRelationDao.insertList(couponParam.getProductCategoryRelationList());
}
return count;
}
@Override
public List<SmsCoupon> list(String name, Integer type, Integer pageSize, Integer pageNum) {
SmsCouponExample example = new SmsCouponExample();
SmsCouponExample.Criteria criteria = example.createCriteria();
if(!StrUtil.isEmpty(name)){
criteria.andNameLike("%"+name+"%");
}
if(type!=null){
criteria.andTypeEqualTo(type);
}
PageHelper.startPage(pageNum,pageSize);
return couponMapper.selectByExample(example);
}
@Override
public SmsCouponParam getItem(Long id) {
return couponDao.getItem(id);
}
}
|
couponParam.setCount(couponParam.getPublishCount());
couponParam.setUseCount(0);
couponParam.setReceiveCount(0);
//插入优惠券表
int count = couponMapper.insert(couponParam);
//插入优惠券和商品关系表
if(couponParam.getUseType().equals(2)){
for(SmsCouponProductRelation productRelation:couponParam.getProductRelationList()){
productRelation.setCouponId(couponParam.getId());
}
productRelationDao.insertList(couponParam.getProductRelationList());
}
//插入优惠券和商品分类关系表
if(couponParam.getUseType().equals(1)){
for (SmsCouponProductCategoryRelation couponProductCategoryRelation : couponParam.getProductCategoryRelationList()) {
couponProductCategoryRelation.setCouponId(couponParam.getId());
}
productCategoryRelationDao.insertList(couponParam.getProductCategoryRelationList());
}
return count;
| 917
| 276
| 1,193
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsFlashPromotionProductRelationServiceImpl.java
|
SmsFlashPromotionProductRelationServiceImpl
|
getCount
|
class SmsFlashPromotionProductRelationServiceImpl implements SmsFlashPromotionProductRelationService {
@Autowired
private SmsFlashPromotionProductRelationMapper relationMapper;
@Autowired
private SmsFlashPromotionProductRelationDao relationDao;
@Override
public int create(List<SmsFlashPromotionProductRelation> relationList) {
for (SmsFlashPromotionProductRelation relation : relationList) {
relationMapper.insert(relation);
}
return relationList.size();
}
@Override
public int update(Long id, SmsFlashPromotionProductRelation relation) {
relation.setId(id);
return relationMapper.updateByPrimaryKey(relation);
}
@Override
public int delete(Long id) {
return relationMapper.deleteByPrimaryKey(id);
}
@Override
public SmsFlashPromotionProductRelation getItem(Long id) {
return relationMapper.selectByPrimaryKey(id);
}
@Override
public List<SmsFlashPromotionProduct> list(Long flashPromotionId, Long flashPromotionSessionId, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
return relationDao.getList(flashPromotionId,flashPromotionSessionId);
}
@Override
public long getCount(Long flashPromotionId, Long flashPromotionSessionId) {<FILL_FUNCTION_BODY>}
}
|
SmsFlashPromotionProductRelationExample example = new SmsFlashPromotionProductRelationExample();
example.createCriteria()
.andFlashPromotionIdEqualTo(flashPromotionId)
.andFlashPromotionSessionIdEqualTo(flashPromotionSessionId);
return relationMapper.countByExample(example);
| 381
| 85
| 466
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsFlashPromotionServiceImpl.java
|
SmsFlashPromotionServiceImpl
|
list
|
class SmsFlashPromotionServiceImpl implements SmsFlashPromotionService {
@Autowired
private SmsFlashPromotionMapper flashPromotionMapper;
@Override
public int create(SmsFlashPromotion flashPromotion) {
flashPromotion.setCreateTime(new Date());
return flashPromotionMapper.insert(flashPromotion);
}
@Override
public int update(Long id, SmsFlashPromotion flashPromotion) {
flashPromotion.setId(id);
return flashPromotionMapper.updateByPrimaryKey(flashPromotion);
}
@Override
public int delete(Long id) {
return flashPromotionMapper.deleteByPrimaryKey(id);
}
@Override
public int updateStatus(Long id, Integer status) {
SmsFlashPromotion flashPromotion = new SmsFlashPromotion();
flashPromotion.setId(id);
flashPromotion.setStatus(status);
return flashPromotionMapper.updateByPrimaryKeySelective(flashPromotion);
}
@Override
public SmsFlashPromotion getItem(Long id) {
return flashPromotionMapper.selectByPrimaryKey(id);
}
@Override
public List<SmsFlashPromotion> list(String keyword, Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
PageHelper.startPage(pageNum, pageSize);
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
if (!StrUtil.isEmpty(keyword)) {
example.createCriteria().andTitleLike("%" + keyword + "%");
}
return flashPromotionMapper.selectByExample(example);
| 348
| 84
| 432
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsFlashPromotionSessionServiceImpl.java
|
SmsFlashPromotionSessionServiceImpl
|
updateStatus
|
class SmsFlashPromotionSessionServiceImpl implements SmsFlashPromotionSessionService {
@Autowired
private SmsFlashPromotionSessionMapper promotionSessionMapper;
@Autowired
private SmsFlashPromotionProductRelationService relationService;
@Override
public int create(SmsFlashPromotionSession promotionSession) {
promotionSession.setCreateTime(new Date());
return promotionSessionMapper.insert(promotionSession);
}
@Override
public int update(Long id, SmsFlashPromotionSession promotionSession) {
promotionSession.setId(id);
return promotionSessionMapper.updateByPrimaryKey(promotionSession);
}
@Override
public int updateStatus(Long id, Integer status) {<FILL_FUNCTION_BODY>}
@Override
public int delete(Long id) {
return promotionSessionMapper.deleteByPrimaryKey(id);
}
@Override
public SmsFlashPromotionSession getItem(Long id) {
return promotionSessionMapper.selectByPrimaryKey(id);
}
@Override
public List<SmsFlashPromotionSession> list() {
SmsFlashPromotionSessionExample example = new SmsFlashPromotionSessionExample();
return promotionSessionMapper.selectByExample(example);
}
@Override
public List<SmsFlashPromotionSessionDetail> selectList(Long flashPromotionId) {
List<SmsFlashPromotionSessionDetail> result = new ArrayList<>();
SmsFlashPromotionSessionExample example = new SmsFlashPromotionSessionExample();
example.createCriteria().andStatusEqualTo(1);
List<SmsFlashPromotionSession> list = promotionSessionMapper.selectByExample(example);
for (SmsFlashPromotionSession promotionSession : list) {
SmsFlashPromotionSessionDetail detail = new SmsFlashPromotionSessionDetail();
BeanUtils.copyProperties(promotionSession, detail);
long count = relationService.getCount(flashPromotionId, promotionSession.getId());
detail.setProductCount(count);
result.add(detail);
}
return result;
}
}
|
SmsFlashPromotionSession promotionSession = new SmsFlashPromotionSession();
promotionSession.setId(id);
promotionSession.setStatus(status);
return promotionSessionMapper.updateByPrimaryKeySelective(promotionSession);
| 544
| 62
| 606
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsHomeAdvertiseServiceImpl.java
|
SmsHomeAdvertiseServiceImpl
|
list
|
class SmsHomeAdvertiseServiceImpl implements SmsHomeAdvertiseService {
@Autowired
private SmsHomeAdvertiseMapper advertiseMapper;
@Override
public int create(SmsHomeAdvertise advertise) {
advertise.setClickCount(0);
advertise.setOrderCount(0);
return advertiseMapper.insert(advertise);
}
@Override
public int delete(List<Long> ids) {
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
example.createCriteria().andIdIn(ids);
return advertiseMapper.deleteByExample(example);
}
@Override
public int updateStatus(Long id, Integer status) {
SmsHomeAdvertise record = new SmsHomeAdvertise();
record.setId(id);
record.setStatus(status);
return advertiseMapper.updateByPrimaryKeySelective(record);
}
@Override
public SmsHomeAdvertise getItem(Long id) {
return advertiseMapper.selectByPrimaryKey(id);
}
@Override
public int update(Long id, SmsHomeAdvertise advertise) {
advertise.setId(id);
return advertiseMapper.updateByPrimaryKeySelective(advertise);
}
@Override
public List<SmsHomeAdvertise> list(String name, Integer type, String endTime, Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
PageHelper.startPage(pageNum, pageSize);
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
SmsHomeAdvertiseExample.Criteria criteria = example.createCriteria();
if (!StrUtil.isEmpty(name)) {
criteria.andNameLike("%" + name + "%");
}
if (type != null) {
criteria.andTypeEqualTo(type);
}
if (!StrUtil.isEmpty(endTime)) {
String startStr = endTime + " 00:00:00";
String endStr = endTime + " 23:59:59";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date start = null;
try {
start = sdf.parse(startStr);
} catch (ParseException e) {
e.printStackTrace();
}
Date end = null;
try {
end = sdf.parse(endStr);
} catch (ParseException e) {
e.printStackTrace();
}
if (start != null && end != null) {
criteria.andEndTimeBetween(start, end);
}
}
example.setOrderByClause("sort desc");
return advertiseMapper.selectByExample(example);
| 386
| 338
| 724
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsHomeBrandServiceImpl.java
|
SmsHomeBrandServiceImpl
|
list
|
class SmsHomeBrandServiceImpl implements SmsHomeBrandService {
@Autowired
private SmsHomeBrandMapper homeBrandMapper;
@Override
public int create(List<SmsHomeBrand> homeBrandList) {
for (SmsHomeBrand smsHomeBrand : homeBrandList) {
smsHomeBrand.setRecommendStatus(1);
smsHomeBrand.setSort(0);
homeBrandMapper.insert(smsHomeBrand);
}
return homeBrandList.size();
}
@Override
public int updateSort(Long id, Integer sort) {
SmsHomeBrand homeBrand = new SmsHomeBrand();
homeBrand.setId(id);
homeBrand.setSort(sort);
return homeBrandMapper.updateByPrimaryKeySelective(homeBrand);
}
@Override
public int delete(List<Long> ids) {
SmsHomeBrandExample example = new SmsHomeBrandExample();
example.createCriteria().andIdIn(ids);
return homeBrandMapper.deleteByExample(example);
}
@Override
public int updateRecommendStatus(List<Long> ids, Integer recommendStatus) {
SmsHomeBrandExample example = new SmsHomeBrandExample();
example.createCriteria().andIdIn(ids);
SmsHomeBrand record = new SmsHomeBrand();
record.setRecommendStatus(recommendStatus);
return homeBrandMapper.updateByExampleSelective(record,example);
}
@Override
public List<SmsHomeBrand> list(String brandName, Integer recommendStatus, Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
PageHelper.startPage(pageNum,pageSize);
SmsHomeBrandExample example = new SmsHomeBrandExample();
SmsHomeBrandExample.Criteria criteria = example.createCriteria();
if(!StrUtil.isEmpty(brandName)){
criteria.andBrandNameLike("%"+brandName+"%");
}
if(recommendStatus!=null){
criteria.andRecommendStatusEqualTo(recommendStatus);
}
example.setOrderByClause("sort desc");
return homeBrandMapper.selectByExample(example);
| 451
| 146
| 597
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsHomeNewProductServiceImpl.java
|
SmsHomeNewProductServiceImpl
|
create
|
class SmsHomeNewProductServiceImpl implements SmsHomeNewProductService {
@Autowired
private SmsHomeNewProductMapper homeNewProductMapper;
@Override
public int create(List<SmsHomeNewProduct> homeNewProductList) {<FILL_FUNCTION_BODY>}
@Override
public int updateSort(Long id, Integer sort) {
SmsHomeNewProduct homeNewProduct = new SmsHomeNewProduct();
homeNewProduct.setId(id);
homeNewProduct.setSort(sort);
return homeNewProductMapper.updateByPrimaryKeySelective(homeNewProduct);
}
@Override
public int delete(List<Long> ids) {
SmsHomeNewProductExample example = new SmsHomeNewProductExample();
example.createCriteria().andIdIn(ids);
return homeNewProductMapper.deleteByExample(example);
}
@Override
public int updateRecommendStatus(List<Long> ids, Integer recommendStatus) {
SmsHomeNewProductExample example = new SmsHomeNewProductExample();
example.createCriteria().andIdIn(ids);
SmsHomeNewProduct record = new SmsHomeNewProduct();
record.setRecommendStatus(recommendStatus);
return homeNewProductMapper.updateByExampleSelective(record,example);
}
@Override
public List<SmsHomeNewProduct> list(String productName, Integer recommendStatus, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
SmsHomeNewProductExample example = new SmsHomeNewProductExample();
SmsHomeNewProductExample.Criteria criteria = example.createCriteria();
if(!StrUtil.isEmpty(productName)){
criteria.andProductNameLike("%"+productName+"%");
}
if(recommendStatus!=null){
criteria.andRecommendStatusEqualTo(recommendStatus);
}
example.setOrderByClause("sort desc");
return homeNewProductMapper.selectByExample(example);
}
}
|
for (SmsHomeNewProduct SmsHomeNewProduct : homeNewProductList) {
SmsHomeNewProduct.setRecommendStatus(1);
SmsHomeNewProduct.setSort(0);
homeNewProductMapper.insert(SmsHomeNewProduct);
}
return homeNewProductList.size();
| 515
| 81
| 596
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsHomeRecommendProductServiceImpl.java
|
SmsHomeRecommendProductServiceImpl
|
list
|
class SmsHomeRecommendProductServiceImpl implements SmsHomeRecommendProductService {
@Autowired
private SmsHomeRecommendProductMapper recommendProductMapper;
@Override
public int create(List<SmsHomeRecommendProduct> homeRecommendProductList) {
for (SmsHomeRecommendProduct recommendProduct : homeRecommendProductList) {
recommendProduct.setRecommendStatus(1);
recommendProduct.setSort(0);
recommendProductMapper.insert(recommendProduct);
}
return homeRecommendProductList.size();
}
@Override
public int updateSort(Long id, Integer sort) {
SmsHomeRecommendProduct recommendProduct = new SmsHomeRecommendProduct();
recommendProduct.setId(id);
recommendProduct.setSort(sort);
return recommendProductMapper.updateByPrimaryKeySelective(recommendProduct);
}
@Override
public int delete(List<Long> ids) {
SmsHomeRecommendProductExample example = new SmsHomeRecommendProductExample();
example.createCriteria().andIdIn(ids);
return recommendProductMapper.deleteByExample(example);
}
@Override
public int updateRecommendStatus(List<Long> ids, Integer recommendStatus) {
SmsHomeRecommendProductExample example = new SmsHomeRecommendProductExample();
example.createCriteria().andIdIn(ids);
SmsHomeRecommendProduct record = new SmsHomeRecommendProduct();
record.setRecommendStatus(recommendStatus);
return recommendProductMapper.updateByExampleSelective(record,example);
}
@Override
public List<SmsHomeRecommendProduct> list(String productName, Integer recommendStatus, Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
}
|
PageHelper.startPage(pageNum,pageSize);
SmsHomeRecommendProductExample example = new SmsHomeRecommendProductExample();
SmsHomeRecommendProductExample.Criteria criteria = example.createCriteria();
if(!StrUtil.isEmpty(productName)){
criteria.andProductNameLike("%"+productName+"%");
}
if(recommendStatus!=null){
criteria.andRecommendStatusEqualTo(recommendStatus);
}
example.setOrderByClause("sort desc");
return recommendProductMapper.selectByExample(example);
| 468
| 150
| 618
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/SmsHomeRecommendSubjectServiceImpl.java
|
SmsHomeRecommendSubjectServiceImpl
|
updateRecommendStatus
|
class SmsHomeRecommendSubjectServiceImpl implements SmsHomeRecommendSubjectService {
@Autowired
private SmsHomeRecommendSubjectMapper smsHomeRecommendSubjectMapper;
@Override
public int create(List<SmsHomeRecommendSubject> recommendSubjectList) {
for (SmsHomeRecommendSubject recommendSubject : recommendSubjectList) {
recommendSubject.setRecommendStatus(1);
recommendSubject.setSort(0);
smsHomeRecommendSubjectMapper.insert(recommendSubject);
}
return recommendSubjectList.size();
}
@Override
public int updateSort(Long id, Integer sort) {
SmsHomeRecommendSubject recommendSubject = new SmsHomeRecommendSubject();
recommendSubject.setId(id);
recommendSubject.setSort(sort);
return smsHomeRecommendSubjectMapper.updateByPrimaryKeySelective(recommendSubject);
}
@Override
public int delete(List<Long> ids) {
SmsHomeRecommendSubjectExample example = new SmsHomeRecommendSubjectExample();
example.createCriteria().andIdIn(ids);
return smsHomeRecommendSubjectMapper.deleteByExample(example);
}
@Override
public int updateRecommendStatus(List<Long> ids, Integer recommendStatus) {<FILL_FUNCTION_BODY>}
@Override
public List<SmsHomeRecommendSubject> list(String subjectName, Integer recommendStatus, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
SmsHomeRecommendSubjectExample example = new SmsHomeRecommendSubjectExample();
SmsHomeRecommendSubjectExample.Criteria criteria = example.createCriteria();
if(!StrUtil.isEmpty(subjectName)){
criteria.andSubjectNameLike("%"+subjectName+"%");
}
if(recommendStatus!=null){
criteria.andRecommendStatusEqualTo(recommendStatus);
}
example.setOrderByClause("sort desc");
return smsHomeRecommendSubjectMapper.selectByExample(example);
}
}
|
SmsHomeRecommendSubjectExample example = new SmsHomeRecommendSubjectExample();
example.createCriteria().andIdIn(ids);
SmsHomeRecommendSubject record = new SmsHomeRecommendSubject();
record.setRecommendStatus(recommendStatus);
return smsHomeRecommendSubjectMapper.updateByExampleSelective(record,example);
| 543
| 96
| 639
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminCacheServiceImpl.java
|
UmsAdminCacheServiceImpl
|
delResourceListByResource
|
class UmsAdminCacheServiceImpl implements UmsAdminCacheService {
@Autowired
private UmsAdminService adminService;
@Autowired
private RedisService redisService;
@Autowired
private UmsAdminRoleRelationMapper adminRoleRelationMapper;
@Autowired
private UmsAdminRoleRelationDao adminRoleRelationDao;
@Value("${redis.database}")
private String REDIS_DATABASE;
@Value("${redis.expire.common}")
private Long REDIS_EXPIRE;
@Value("${redis.key.admin}")
private String REDIS_KEY_ADMIN;
@Value("${redis.key.resourceList}")
private String REDIS_KEY_RESOURCE_LIST;
@Override
public void delAdmin(Long adminId) {
UmsAdmin admin = adminService.getItem(adminId);
if (admin != null) {
String key = REDIS_DATABASE + ":" + REDIS_KEY_ADMIN + ":" + admin.getUsername();
redisService.del(key);
}
}
@Override
public void delResourceList(Long adminId) {
String key = REDIS_DATABASE + ":" + REDIS_KEY_RESOURCE_LIST + ":" + adminId;
redisService.del(key);
}
@Override
public void delResourceListByRole(Long roleId) {
UmsAdminRoleRelationExample example = new UmsAdminRoleRelationExample();
example.createCriteria().andRoleIdEqualTo(roleId);
List<UmsAdminRoleRelation> relationList = adminRoleRelationMapper.selectByExample(example);
if (CollUtil.isNotEmpty(relationList)) {
String keyPrefix = REDIS_DATABASE + ":" + REDIS_KEY_RESOURCE_LIST + ":";
List<String> keys = relationList.stream().map(relation -> keyPrefix + relation.getAdminId()).collect(Collectors.toList());
redisService.del(keys);
}
}
@Override
public void delResourceListByRoleIds(List<Long> roleIds) {
UmsAdminRoleRelationExample example = new UmsAdminRoleRelationExample();
example.createCriteria().andRoleIdIn(roleIds);
List<UmsAdminRoleRelation> relationList = adminRoleRelationMapper.selectByExample(example);
if (CollUtil.isNotEmpty(relationList)) {
String keyPrefix = REDIS_DATABASE + ":" + REDIS_KEY_RESOURCE_LIST + ":";
List<String> keys = relationList.stream().map(relation -> keyPrefix + relation.getAdminId()).collect(Collectors.toList());
redisService.del(keys);
}
}
@Override
public void delResourceListByResource(Long resourceId) {<FILL_FUNCTION_BODY>}
@Override
public UmsAdmin getAdmin(String username) {
String key = REDIS_DATABASE + ":" + REDIS_KEY_ADMIN + ":" + username;
return (UmsAdmin) redisService.get(key);
}
@Override
public void setAdmin(UmsAdmin admin) {
String key = REDIS_DATABASE + ":" + REDIS_KEY_ADMIN + ":" + admin.getUsername();
redisService.set(key, admin, REDIS_EXPIRE);
}
@Override
public List<UmsResource> getResourceList(Long adminId) {
String key = REDIS_DATABASE + ":" + REDIS_KEY_RESOURCE_LIST + ":" + adminId;
return (List<UmsResource>) redisService.get(key);
}
@Override
public void setResourceList(Long adminId, List<UmsResource> resourceList) {
String key = REDIS_DATABASE + ":" + REDIS_KEY_RESOURCE_LIST + ":" + adminId;
redisService.set(key, resourceList, REDIS_EXPIRE);
}
}
|
List<Long> adminIdList = adminRoleRelationDao.getAdminIdList(resourceId);
if (CollUtil.isNotEmpty(adminIdList)) {
String keyPrefix = REDIS_DATABASE + ":" + REDIS_KEY_RESOURCE_LIST + ":";
List<String> keys = adminIdList.stream().map(adminId -> keyPrefix + adminId).collect(Collectors.toList());
redisService.del(keys);
}
| 1,069
| 123
| 1,192
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/UmsMenuServiceImpl.java
|
UmsMenuServiceImpl
|
treeList
|
class UmsMenuServiceImpl implements UmsMenuService {
@Autowired
private UmsMenuMapper menuMapper;
@Override
public int create(UmsMenu umsMenu) {
umsMenu.setCreateTime(new Date());
updateLevel(umsMenu);
return menuMapper.insert(umsMenu);
}
/**
* 修改菜单层级
*/
private void updateLevel(UmsMenu umsMenu) {
if (umsMenu.getParentId() == 0) {
//没有父菜单时为一级菜单
umsMenu.setLevel(0);
} else {
//有父菜单时选择根据父菜单level设置
UmsMenu parentMenu = menuMapper.selectByPrimaryKey(umsMenu.getParentId());
if (parentMenu != null) {
umsMenu.setLevel(parentMenu.getLevel() + 1);
} else {
umsMenu.setLevel(0);
}
}
}
@Override
public int update(Long id, UmsMenu umsMenu) {
umsMenu.setId(id);
updateLevel(umsMenu);
return menuMapper.updateByPrimaryKeySelective(umsMenu);
}
@Override
public UmsMenu getItem(Long id) {
return menuMapper.selectByPrimaryKey(id);
}
@Override
public int delete(Long id) {
return menuMapper.deleteByPrimaryKey(id);
}
@Override
public List<UmsMenu> list(Long parentId, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
UmsMenuExample example = new UmsMenuExample();
example.setOrderByClause("sort desc");
example.createCriteria().andParentIdEqualTo(parentId);
return menuMapper.selectByExample(example);
}
@Override
public List<UmsMenuNode> treeList() {<FILL_FUNCTION_BODY>}
@Override
public int updateHidden(Long id, Integer hidden) {
UmsMenu umsMenu = new UmsMenu();
umsMenu.setId(id);
umsMenu.setHidden(hidden);
return menuMapper.updateByPrimaryKeySelective(umsMenu);
}
/**
* 将UmsMenu转化为UmsMenuNode并设置children属性
*/
private UmsMenuNode covertMenuNode(UmsMenu menu, List<UmsMenu> menuList) {
UmsMenuNode node = new UmsMenuNode();
BeanUtils.copyProperties(menu, node);
List<UmsMenuNode> children = menuList.stream()
.filter(subMenu -> subMenu.getParentId().equals(menu.getId()))
.map(subMenu -> covertMenuNode(subMenu, menuList)).collect(Collectors.toList());
node.setChildren(children);
return node;
}
}
|
List<UmsMenu> menuList = menuMapper.selectByExample(new UmsMenuExample());
List<UmsMenuNode> result = menuList.stream()
.filter(menu -> menu.getParentId().equals(0L))
.map(menu -> covertMenuNode(menu, menuList))
.collect(Collectors.toList());
return result;
| 750
| 96
| 846
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/UmsResourceCategoryServiceImpl.java
|
UmsResourceCategoryServiceImpl
|
listAll
|
class UmsResourceCategoryServiceImpl implements UmsResourceCategoryService {
@Autowired
private UmsResourceCategoryMapper resourceCategoryMapper;
@Override
public List<UmsResourceCategory> listAll() {<FILL_FUNCTION_BODY>}
@Override
public int create(UmsResourceCategory umsResourceCategory) {
umsResourceCategory.setCreateTime(new Date());
return resourceCategoryMapper.insert(umsResourceCategory);
}
@Override
public int update(Long id, UmsResourceCategory umsResourceCategory) {
umsResourceCategory.setId(id);
return resourceCategoryMapper.updateByPrimaryKeySelective(umsResourceCategory);
}
@Override
public int delete(Long id) {
return resourceCategoryMapper.deleteByPrimaryKey(id);
}
}
|
UmsResourceCategoryExample example = new UmsResourceCategoryExample();
example.setOrderByClause("sort desc");
return resourceCategoryMapper.selectByExample(example);
| 206
| 45
| 251
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/UmsResourceServiceImpl.java
|
UmsResourceServiceImpl
|
list
|
class UmsResourceServiceImpl implements UmsResourceService {
@Autowired
private UmsResourceMapper resourceMapper;
@Autowired
private UmsAdminCacheService adminCacheService;
@Override
public int create(UmsResource umsResource) {
umsResource.setCreateTime(new Date());
return resourceMapper.insert(umsResource);
}
@Override
public int update(Long id, UmsResource umsResource) {
umsResource.setId(id);
int count = resourceMapper.updateByPrimaryKeySelective(umsResource);
adminCacheService.delResourceListByResource(id);
return count;
}
@Override
public UmsResource getItem(Long id) {
return resourceMapper.selectByPrimaryKey(id);
}
@Override
public int delete(Long id) {
int count = resourceMapper.deleteByPrimaryKey(id);
adminCacheService.delResourceListByResource(id);
return count;
}
@Override
public List<UmsResource> list(Long categoryId, String nameKeyword, String urlKeyword, Integer pageSize, Integer pageNum) {<FILL_FUNCTION_BODY>}
@Override
public List<UmsResource> listAll() {
return resourceMapper.selectByExample(new UmsResourceExample());
}
}
|
PageHelper.startPage(pageNum,pageSize);
UmsResourceExample example = new UmsResourceExample();
UmsResourceExample.Criteria criteria = example.createCriteria();
if(categoryId!=null){
criteria.andCategoryIdEqualTo(categoryId);
}
if(StrUtil.isNotEmpty(nameKeyword)){
criteria.andNameLike('%'+nameKeyword+'%');
}
if(StrUtil.isNotEmpty(urlKeyword)){
criteria.andUrlLike('%'+urlKeyword+'%');
}
return resourceMapper.selectByExample(example);
| 341
| 158
| 499
|
<no_super_class>
|
macrozheng_mall
|
mall/mall-admin/src/main/java/com/macro/mall/service/impl/UmsRoleServiceImpl.java
|
UmsRoleServiceImpl
|
allocMenu
|
class UmsRoleServiceImpl implements UmsRoleService {
@Autowired
private UmsRoleMapper roleMapper;
@Autowired
private UmsRoleMenuRelationMapper roleMenuRelationMapper;
@Autowired
private UmsRoleResourceRelationMapper roleResourceRelationMapper;
@Autowired
private UmsRoleDao roleDao;
@Autowired
private UmsAdminCacheService adminCacheService;
@Override
public int create(UmsRole role) {
role.setCreateTime(new Date());
role.setAdminCount(0);
role.setSort(0);
return roleMapper.insert(role);
}
@Override
public int update(Long id, UmsRole role) {
role.setId(id);
return roleMapper.updateByPrimaryKeySelective(role);
}
@Override
public int delete(List<Long> ids) {
UmsRoleExample example = new UmsRoleExample();
example.createCriteria().andIdIn(ids);
int count = roleMapper.deleteByExample(example);
adminCacheService.delResourceListByRoleIds(ids);
return count;
}
@Override
public List<UmsRole> list() {
return roleMapper.selectByExample(new UmsRoleExample());
}
@Override
public List<UmsRole> list(String keyword, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
UmsRoleExample example = new UmsRoleExample();
if (!StrUtil.isEmpty(keyword)) {
example.createCriteria().andNameLike("%" + keyword + "%");
}
return roleMapper.selectByExample(example);
}
@Override
public List<UmsMenu> getMenuList(Long adminId) {
return roleDao.getMenuList(adminId);
}
@Override
public List<UmsMenu> listMenu(Long roleId) {
return roleDao.getMenuListByRoleId(roleId);
}
@Override
public List<UmsResource> listResource(Long roleId) {
return roleDao.getResourceListByRoleId(roleId);
}
@Override
public int allocMenu(Long roleId, List<Long> menuIds) {<FILL_FUNCTION_BODY>}
@Override
public int allocResource(Long roleId, List<Long> resourceIds) {
//先删除原有关系
UmsRoleResourceRelationExample example=new UmsRoleResourceRelationExample();
example.createCriteria().andRoleIdEqualTo(roleId);
roleResourceRelationMapper.deleteByExample(example);
//批量插入新关系
for (Long resourceId : resourceIds) {
UmsRoleResourceRelation relation = new UmsRoleResourceRelation();
relation.setRoleId(roleId);
relation.setResourceId(resourceId);
roleResourceRelationMapper.insert(relation);
}
adminCacheService.delResourceListByRole(roleId);
return resourceIds.size();
}
}
|
//先删除原有关系
UmsRoleMenuRelationExample example=new UmsRoleMenuRelationExample();
example.createCriteria().andRoleIdEqualTo(roleId);
roleMenuRelationMapper.deleteByExample(example);
//批量插入新关系
for (Long menuId : menuIds) {
UmsRoleMenuRelation relation = new UmsRoleMenuRelation();
relation.setRoleId(roleId);
relation.setMenuId(menuId);
roleMenuRelationMapper.insert(relation);
}
return menuIds.size();
| 787
| 147
| 934
|
<no_super_class>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.