diff --git a/hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java b/hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java
new file mode 100644
index 00000000..00f747a1
--- /dev/null
+++ b/hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java
@@ -0,0 +1,68 @@
+package cc.hiver.core.base;
+
+import cc.hiver.core.common.constant.CommonConstant;
+import cc.hiver.core.common.utils.SnowFlakeUtil;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.data.annotation.CreatedBy;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedBy;
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.persistence.EntityListeners;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@MappedSuperclass
+@EntityListeners(AuditingEntityListener.class)
+@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
+public abstract class HiverBaseMallEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @TableId
+ @ApiModelProperty(value = "唯一标识")
+ private String id = SnowFlakeUtil.nextId().toString();
+
+ @ApiModelProperty("店铺id")
+ private String mallId;
+
+ @ApiModelProperty("办公区域")
+ private String region;
+
+ @ApiModelProperty(value = "创建者")
+ @CreatedBy
+ @TableField(fill = FieldFill.INSERT)
+ private String createBy;
+
+ @CreatedDate
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty(value = "创建时间")
+ private Date createTime;
+
+ @ApiModelProperty(value = "更新者")
+ @LastModifiedBy
+ @TableField(fill = FieldFill.UPDATE)
+ private String updateBy;
+
+ @LastModifiedDate
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty(value = "更新时间")
+ @TableField(fill = FieldFill.UPDATE)
+ private Date updateTime;
+
+ @ApiModelProperty(value = "删除标志 默认0")
+ private Integer delFlag = CommonConstant.STATUS_NORMAL;
+}
\ No newline at end of file
diff --git a/hiver-core/src/main/java/cc/hiver/core/base/HiverBasePageQuery.java b/hiver-core/src/main/java/cc/hiver/core/base/HiverBasePageQuery.java
new file mode 100644
index 00000000..b307a246
--- /dev/null
+++ b/hiver-core/src/main/java/cc/hiver/core/base/HiverBasePageQuery.java
@@ -0,0 +1,33 @@
+/*
+Copyright [2022] [https://hiver.cc]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+package cc.hiver.core.base;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author Yazhi Li
+ */
+@Data
+@ApiModel
+public class HiverBasePageQuery {
+ @ApiModelProperty(value = "页码", example = "1")
+ private int pageNum = 1;
+
+ @ApiModelProperty(value = "每页记录数", example = "10")
+ private int pageSize = 10;
+}
diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/CommonConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/CommonConstant.java
index dced3c78..09c228e9 100644
--- a/hiver-core/src/main/java/cc/hiver/core/common/constant/CommonConstant.java
+++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/CommonConstant.java
@@ -125,4 +125,14 @@ public interface CommonConstant {
* 部门负责人类型 副负责人
*/
Integer HEADER_TYPE_VICE = 1;
+
+ /**
+ * 是
+ */
+ Integer STATUS_YES = 1;
+
+ /**
+ * 否
+ */
+ Integer STATUS_NO = 0;
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java
new file mode 100644
index 00000000..7fd4524b
--- /dev/null
+++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java
@@ -0,0 +1,48 @@
+package cc.hiver.core.common.constant;
+
+/**
+ * 商城静态常量
+ *
+ * @author Yazhi Li
+ */
+public interface MallConstant {
+ /**
+ * 上架
+ */
+ Integer GOODS_PUT_ON_SALE = 0;
+
+ /**
+ * 下架
+ */
+ Integer GOODS_PULL_ON_SALE = -1;
+
+ /**
+ * 销售单处理中
+ */
+ Integer SALES_ORDER_PROCESS = 0;
+
+ /**
+ * 销售单临时保存
+ */
+ Integer SALES_ORDER_SAVED = 1;
+
+ /**
+ * 订单锁定的商品列表key前缀
+ */
+ String ORDER_LOCKED_SKUS_PREFIX = "order:locked:goods:";
+
+ /**
+ * 商品分布式锁key前缀
+ */
+ String SKU_LOCK_PREFIX = "product:stock:lock:";
+
+ /**
+ * 临时规格ID前缀
+ */
+ String SPEC_TEMP_ID_PREFIX = "tid_";
+
+ /**
+ * 会员购物车缓存KEY前缀
+ */
+ String MEMBER_CART_PREFIX = "MEMBER:CART:";
+}
diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/ShopConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/ShopConstant.java
new file mode 100644
index 00000000..1039e895
--- /dev/null
+++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/ShopConstant.java
@@ -0,0 +1,19 @@
+package cc.hiver.core.common.constant;
+
+/**
+ * 店铺常量
+ *
+ * @author cc
+ */
+public interface ShopConstant {
+
+ /**
+ * 用户正常状态
+ */
+ Integer SHOP_STATUS_NORMAL = 1;
+ /**
+ * 用户禁用状态
+ */
+ Integer SHOP_STATUS_LOCK = 0;
+
+}
diff --git a/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java b/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java
index f3ff568e..cda5acd2 100644
--- a/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java
+++ b/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java
@@ -4,6 +4,7 @@ import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.core.entity.User;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
import java.util.List;
@@ -64,4 +65,7 @@ public interface UserDao extends HiverBaseDao
{
@Modifying
@Query("update User u set u.departmentTitle=?2 where u.departmentId=?1")
void updateDepartmentTitle(String departmentId, String departmentTitle);
+
+ @Query(value = "select * from t_user where id in (select user_id from t_user_role where role_id = (select id from t_role where name = ? ))",nativeQuery = true)
+ List findByRoleName( String roleName);
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/service/UserService.java b/hiver-core/src/main/java/cc/hiver/core/service/UserService.java
index 484ad4e1..9353bef2 100644
--- a/hiver-core/src/main/java/cc/hiver/core/service/UserService.java
+++ b/hiver-core/src/main/java/cc/hiver/core/service/UserService.java
@@ -7,6 +7,8 @@ import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
import java.util.List;
@@ -75,4 +77,12 @@ public interface UserService extends HiverBaseService {
* @param departmentTitle
*/
void updateDepartmentTitle(String departmentId, String departmentTitle);
+
+ /**
+ * 通过角色名搜索
+ *
+ * @param roleName
+ * @return
+ */
+ List findByRoleName(@Param("roleName") String roleName);
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java b/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
index f08bd7df..265cba4b 100644
--- a/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
+++ b/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
@@ -177,4 +177,9 @@ public class UserServiceImpl implements UserService {
public void updateDepartmentTitle(String departmentId, String departmentTitle) {
userDao.updateDepartmentTitle(departmentId, departmentTitle);
}
+
+ @Override
+ public List findByRoleName(String roleName) {
+ return userDao.findByRoleName(roleName);
+ }
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/vo/Option.java b/hiver-core/src/main/java/cc/hiver/core/vo/Option.java
new file mode 100644
index 00000000..1bcd9ee6
--- /dev/null
+++ b/hiver-core/src/main/java/cc/hiver/core/vo/Option.java
@@ -0,0 +1,52 @@
+/*
+Copyright [2022] [https://hiver.cc]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+package cc.hiver.core.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author Yazhi Li
+ */
+@ApiModel("下拉选项对象")
+@Data
+@NoArgsConstructor
+public class Option {
+ public Option(T value, String label) {
+ this.value = value;
+ this.label = label;
+ }
+
+ public Option(T value, String label, List