Commit 0ec11126 by guojuxing

资源组接口调整

parent 8133f2de
package com.gic.auth.dto;
import java.io.Serializable;
import java.util.List;
/**
* 资源组用户域配置信息
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/1/11 2:04 PM

*/
public class CustomUserAreaDTO implements Serializable{
private static final long serialVersionUID = -7882456883745105099L;
/**
* 1:全部 2:部分 超管就是1全部
*/
private Integer type;
/**
* 用户域 0:不授予 1:授予
*/
private Integer customUser;
/**
* 用户域配置json转为类
*/
private List<ResourceGroupCustomUserDTO> customUserList;
/**
* 线下门店订单 1:用户在授权管辖门店范围内的订单 2:用户下所有订单
*/
private Integer storeOrderArea;
/**
* 微盟商城订单 1:用户在授权店铺范围内的订单 2:不授予
*/
private Integer weimobOrderArea;
/**
* 微盟店铺多选,weimob_order_area选择1时选择店铺
*/
private List<Long> weimobStoreId;
/**
* 短信签名
*/
private List<Long> smsId;
public Integer getType() {
return type;
}
public CustomUserAreaDTO setType(Integer type) {
this.type = type;
return this;
}
public Integer getCustomUser() {
return customUser;
}
public CustomUserAreaDTO setCustomUser(Integer customUser) {
this.customUser = customUser;
return this;
}
public List<ResourceGroupCustomUserDTO> getCustomUserList() {
return customUserList;
}
public CustomUserAreaDTO setCustomUserList(List<ResourceGroupCustomUserDTO> customUserList) {
this.customUserList = customUserList;
return this;
}
public Integer getStoreOrderArea() {
return storeOrderArea;
}
public CustomUserAreaDTO setStoreOrderArea(Integer storeOrderArea) {
this.storeOrderArea = storeOrderArea;
return this;
}
public Integer getWeimobOrderArea() {
return weimobOrderArea;
}
public CustomUserAreaDTO setWeimobOrderArea(Integer weimobOrderArea) {
this.weimobOrderArea = weimobOrderArea;
return this;
}
public List<Long> getWeimobStoreId() {
return weimobStoreId;
}
public CustomUserAreaDTO setWeimobStoreId(List<Long> weimobStoreId) {
this.weimobStoreId = weimobStoreId;
return this;
}
public List<Long> getSmsId() {
return smsId;
}
public CustomUserAreaDTO setSmsId(List<Long> smsId) {
this.smsId = smsId;
return this;
}
@Override
public String toString() {
return "CustomUserAreaDTO{" +
"type=" + type +
", customUser=" + customUser +
", customUserList=" + customUserList +
", storeOrderArea=" + storeOrderArea +
", weimobOrderArea=" + weimobOrderArea +
", weimobStoreId='" + weimobStoreId + '\'' +
", smsId='" + smsId + '\'' +
'}';
}
}
......@@ -89,6 +89,11 @@ public class ResourceGroupDTO implements Serializable{
*/
private Integer deleteFlag;
/**
* 授权管理员数量
*/
private Integer userResourceCount;
public Integer getResourceGroupId() {
return resourceGroupId;
}
......@@ -224,6 +229,15 @@ public class ResourceGroupDTO implements Serializable{
return this;
}
public Integer getUserResourceCount() {
return userResourceCount;
}
public ResourceGroupDTO setUserResourceCount(Integer userResourceCount) {
this.userResourceCount = userResourceCount;
return this;
}
@Override
public String toString() {
return "ResourceGroupDTO{" +
......@@ -242,6 +256,7 @@ public class ResourceGroupDTO implements Serializable{
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteFlag=" + deleteFlag +
", userResourceCount=" + userResourceCount +
'}';
}
}
package com.gic.auth.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.CustomUserAreaDTO;
import com.gic.auth.dto.ResourceGroupDTO;
import com.gic.auth.dto.StoreResourceDTO;
/**
* 资源组
......@@ -18,4 +21,49 @@ public interface ResourceGroupApiService {
* @return
*/
ServiceResponse<Integer> saveResourceGroup(ResourceGroupDTO resourceGroup);
/**
* 编辑资源组
* @param resourceGroup
* @return
*/
ServiceResponse<String> editResourceGroup(ResourceGroupDTO resourceGroup);
/**
* 分页查询
* @param name 资源组名称
* @param enterpriseId
* @param pageNum
* @param pageSize
* @return
*/
ServiceResponse<Page<ResourceGroupDTO>> pageResourceGroup(String name, Integer enterpriseId, Integer pageNum, Integer pageSize);
/**
* 查询详情
* @param resourceGroupId
* @return
*/
ServiceResponse<ResourceGroupDTO> getResourceGroup(Integer resourceGroupId);
/**
* 删除资源组
* @param resourceGroupId
* @return
*/
ServiceResponse<Void> deleteResourceGroup(Integer resourceGroupId);
/**
* 管理员的门店资源查询
* @param userId
* @return
*/
ServiceResponse<StoreResourceDTO> getStoreResourceByUserId(Integer userId);
/**
* 管理员的用户域配置信息
* @param userId
* @return
*/
ServiceResponse<CustomUserAreaDTO> getCustomUserByUserId(Integer userId);
}
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabSysResourceGroup;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 资源组
* @ClassName:
......@@ -49,4 +53,38 @@ public interface TabSysResourceGroupMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabSysResourceGroup record);
/**
* 分页查询
* @param name 资源组名称
* @param enterpriseId
* @return
*/
List<TabSysResourceGroup> pageResourceGroup(@Param("name") String name,
@Param("enterpriseId") Integer enterpriseId);
/**
* 详情
* @param resourceGroupId
* @return
*/
TabSysResourceGroup getResourceGroup(@Param("resourceGroupId") Integer resourceGroupId);
/**
* 删除
* @param resourceGroupId
* @return
*/
int deleteResourceGroup(@Param("resourceGroupId") Integer resourceGroupId);
/**
* 资源组名称重复数量
* @param resourceGroupId
* @param resourceGroupName
* @param enterpriseId
* @return
*/
int countRepeatResourceGroupName(@Param("resourceGroupId") Integer resourceGroupId,
@Param("resourceGroupName") String resourceGroupName,
@Param("enterpriseId") Integer enterpriseId);
}
\ No newline at end of file
package com.gic.auth.service;
import com.gic.auth.dto.ResourceGroupDTO;
import com.gic.auth.entity.TabSysResourceGroup;
import com.github.pagehelper.Page;
import java.util.List;
/**
* 资源组
* @ClassName:
......@@ -16,4 +21,45 @@ public interface ResourceGroupService {
* @return
*/
Integer saveResourceGroup(ResourceGroupDTO resourceGroup);
/**
* 编辑资源组
* @param resourceGroup
* @return 执行数量
*/
int editResourceGroup(ResourceGroupDTO resourceGroup);
/**
* 分页查询资源组
* @param name 资源组名称
* @param enterpriseId
* @param pageNum
* @param pageSize
* @return
*/
Page<TabSysResourceGroup> pageResourceGroup(String name, Integer enterpriseId, Integer pageNum, Integer pageSize);
/**
* 详情
* @param resourceGroupId
* @return
*/
TabSysResourceGroup getResourceGroup(Integer resourceGroupId);
/**
* 删除资源组
* @param resourceGroupId
* @return 执行数量
*/
int deleteResourceGroup(Integer resourceGroupId);
/**
* 是否重复资源组名称
* @param resourceGroupId
* @param resourceGroupName
* @param enterpriseId
* @return
*/
boolean isRepeatResourceGroupName(Integer resourceGroupId, String resourceGroupName, Integer enterpriseId);
}
package com.gic.auth.service.impl;
import com.gic.auth.constant.DeleteFlagConstants;
import com.gic.auth.dao.mapper.TabSysResourceGroupMapper;
import com.gic.auth.dto.ResourceGroupDTO;
import com.gic.auth.entity.TabSysResourceGroup;
import com.gic.auth.service.ResourceGroupService;
import com.gic.commons.util.EntityUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 资源组
* @ClassName:
......@@ -19,6 +28,50 @@ public class ResourceGroupServiceImpl implements ResourceGroupService{
@Override
public Integer saveResourceGroup(ResourceGroupDTO resourceGroup) {
return null;
TabSysResourceGroup record = EntityUtil.changeEntityNew(TabSysResourceGroup.class, resourceGroup);
record.setUpdateTime(new Date());
record.setCreateTime(new Date());
record.setDeleteFlag(DeleteFlagConstants.NORMAL_STATUS);
tabSysResourceGroupMapper.insert(record);
return record.getResourceGroupId();
}
@Override
public int editResourceGroup(ResourceGroupDTO resourceGroup) {
TabSysResourceGroup record = EntityUtil.changeEntityNew(TabSysResourceGroup.class, resourceGroup);
record.setUpdateTime(new Date());
return tabSysResourceGroupMapper.updateByPrimaryKeySelective(record);
}
@Override
public Page<TabSysResourceGroup> pageResourceGroup(String name, Integer enterpriseId, Integer pageNum, Integer pageSize) {
if (pageNum == null) {
pageNum = 1;
}
if (pageSize == null) {
pageSize = 20;
}
PageHelper.startPage(pageNum, pageSize);
List<TabSysResourceGroup> list = tabSysResourceGroupMapper.pageResourceGroup(name, enterpriseId);
return (Page<TabSysResourceGroup>) list;
}
@Override
public TabSysResourceGroup getResourceGroup(Integer resourceGroupId) {
return tabSysResourceGroupMapper.getResourceGroup(resourceGroupId);
}
@Override
public int deleteResourceGroup(Integer resourceGroupId) {
return tabSysResourceGroupMapper.deleteResourceGroup(resourceGroupId);
}
@Override
public boolean isRepeatResourceGroupName(Integer resourceGroupId, String resourceGroupName, Integer enterpriseId) {
int count = tabSysResourceGroupMapper.countRepeatResourceGroupName(resourceGroupId, resourceGroupName, enterpriseId);
if (count > 0) {
return true;
}
return false;
}
}
......@@ -28,7 +28,7 @@
from tab_sys_resource_group
where resource_group_id = #{resourceGroupId,jdbcType=INTEGER}
</select>
<insert id="insert" parameterType="com.gic.auth.entity.TabSysResourceGroup">
<insert id="insert" parameterType="com.gic.auth.entity.TabSysResourceGroup" keyProperty="resourceGroupId" useGeneratedKeys="true">
insert into tab_sys_resource_group (resource_group_id, resource_group_name,
enterprise_id, custom_user, custom_user_data,
store_resource, goods_resource_id, store_order_area,
......@@ -195,4 +195,36 @@
delete_flag = #{deleteFlag,jdbcType=INTEGER}
where resource_group_id = #{resourceGroupId,jdbcType=INTEGER}
</update>
<select id="pageResourceGroup" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_resource_group
where delete_flag = ${@com.gic.auth.constant.DeleteFlagConstants@NORMAL_STATUS}
and enterprise_id = #{enterpriseId}
<if test="name != null and name != ''">
and resource_group_name like concat('%', #{name}, '%')
</if>
order by create_time desc
</select>
<select id="getResourceGroup" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_resource_group
where resource_group_id = #{resourceGroupId}
</select>
<update id="deleteResourceGroup">
update tab_sys_resource_group set delete_flag = ${@com.gic.auth.constant.DeleteFlagConstants@DELETE_STATUS}
where resource_group_id = #{resourceGroupId}
</update>
<select id="countRepeatResourceGroupName">
select count(1) from tab_sys_resource_group
where delete_flag = ${@com.gic.auth.constant.DeleteFlagConstants@NORMAL_STATUS}
and resource_group_name = #{resourceGroupName}
and enterprise_id = #{enterpriseId}
<if test="resourceGroupId != null">
and resource_group_id &lt;&gt; #{resourceGroupId}
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment