Browse Source

代码提交

master
parent
commit
6c188dd393
  1. 22
      ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcAreaServiceImpl.java
  2. 9
      ruoyi-plan/src/main/resources/mapper/dhc/DhcAreaMapper.xml
  3. 24
      ruoyi-system/src/main/java/com/ruoyi/dhc/mapper/SysUserRoleMapper.java
  4. 10
      sql/基础功能.sql

22
ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcAreaServiceImpl.java

@ -4,7 +4,6 @@ import com.ruoyi.common.core.domain.TreeSelect; @@ -4,7 +4,6 @@ import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.DhcArea;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.dhc.mapper.DhcAreaMapper;
import com.ruoyi.dhc.service.IDhcAreaService;
import org.springframework.beans.factory.annotation.Autowired;
@ -36,7 +35,12 @@ public class DhcAreaServiceImpl implements IDhcAreaService @@ -36,7 +35,12 @@ public class DhcAreaServiceImpl implements IDhcAreaService
@Override
public DhcArea selectDhcAreaByAreaId(Long areaId)
{
return dhcAreaMapper.selectDhcAreaByAreaId(areaId);
DhcArea area = dhcAreaMapper.selectDhcAreaByAreaId(areaId);
if (area != null && area.getParentId() != null && area.getParentId() != 0L) {
DhcArea parentArea = dhcAreaMapper.selectDhcAreaByAreaId(area.getParentId());
area.setParentName(parentArea.getAreaName());
}
return area;
}
/**
@ -61,8 +65,9 @@ public class DhcAreaServiceImpl implements IDhcAreaService @@ -61,8 +65,9 @@ public class DhcAreaServiceImpl implements IDhcAreaService
public int insertDhcArea(DhcArea dhcArea)
{
dhcArea.setCreateTime(DateUtils.getNowDate());
dhcArea.setDelFlag("0");
Integer count = dhcAreaMapper.selectCount(dhcArea);
if (count > 1) {
if (count > 0) {
return -1;
} else {
return dhcAreaMapper.insertDhcArea(dhcArea);
@ -79,8 +84,9 @@ public class DhcAreaServiceImpl implements IDhcAreaService @@ -79,8 +84,9 @@ public class DhcAreaServiceImpl implements IDhcAreaService
public int updateDhcArea(DhcArea dhcArea)
{
dhcArea.setUpdateTime(DateUtils.getNowDate());
dhcArea.setDelFlag("0");
Integer count = dhcAreaMapper.selectCount(dhcArea);
if (count > 1) {
if (count > 0) {
return -1;
} else {
return dhcAreaMapper.updateDhcArea(dhcArea);
@ -108,8 +114,16 @@ public class DhcAreaServiceImpl implements IDhcAreaService @@ -108,8 +114,16 @@ public class DhcAreaServiceImpl implements IDhcAreaService
@Override
public int deleteDhcAreaByAreaId(Long areaId)
{
DhcArea dhcArea = new DhcArea();
dhcArea.setParentId(areaId);
dhcArea.setDelFlag("0");
Integer count = dhcAreaMapper.selectCount(dhcArea);
if (count > 0) {
return -1;
} else {
return dhcAreaMapper.deleteDhcAreaByAreaId(areaId);
}
}
/**
* 查询区域树结构信息

9
ruoyi-plan/src/main/resources/mapper/dhc/DhcAreaMapper.xml

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="parentId" column="parent_id" />
<result property="areaCode" column="area_code" />
<result property="areaName" column="area_name" />
<result property="productLineCode" column="product_line_code" />
<result property="areaType" column="area_type" />
<result property="areaLevel" column="area_level" />
<result property="orderNum" column="order_num" />
@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDhcAreaVo">
select area_id, parent_id, area_code, area_name, area_type, area_level, order_num, area_desc, status, del_flag, create_by, create_time, update_by, update_time from dhc_area
select area_id, parent_id, area_code, area_name, product_line_code, area_type, area_level, order_num, area_desc, status, del_flag, create_by, create_time, update_by, update_time from dhc_area
</sql>
<select id="selectDhcAreaList" parameterType="DhcArea" resultMap="DhcAreaResult">
@ -36,11 +37,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -36,11 +37,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="areaDesc != null and areaDesc != ''"> and area_desc = #{areaDesc}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="productLineCode != null and productLineCode != ''"> and product_line_code = #{productLineCode}</if>
</where>
order BY order_num
</select>
<select id="selectCount" parameterType="DhcArea" resultType="integer">
select count(area_id) from dhc_area
<where>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
<if test="areaId != null and areaId != ''"> and area_id != #{areaId}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
@ -57,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -57,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null">parent_id,</if>
<if test="areaCode != null">area_code,</if>
<if test="areaName != null">area_name,</if>
<if test="productLineCode != null">product_line_code,</if>
<if test="areaType != null">area_type,</if>
<if test="areaLevel != null">area_level,</if>
<if test="orderNum != null">order_num,</if>
@ -72,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -72,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null">#{parentId},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="areaName != null">#{areaName},</if>
<if test="productLineCode != null">#{productLineCode},</if>
<if test="areaType != null">#{areaType},</if>
<if test="areaLevel != null">#{areaLevel},</if>
<if test="orderNum != null">#{orderNum},</if>
@ -91,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -91,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="areaName != null">area_name = #{areaName},</if>
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
<if test="areaType != null">area_type = #{areaType},</if>
<if test="areaLevel != null">area_level = #{areaLevel},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>

24
ruoyi-system/src/main/java/com/ruoyi/dhc/mapper/SysUserRoleMapper.java

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
package com.ruoyi.dhc.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.dhc.domain.SysUserRole;
@ -59,4 +60,27 @@ public interface SysUserRoleMapper @@ -59,4 +60,27 @@ public interface SysUserRoleMapper
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
/**
* 批量取消角色权限控制点
*
* @param roleId 角色ID
* @param authNodes 需要删除的角色权限控制点
* @return 结果
*/
public int deleteRoleAuthNodesInfos(@Param("roleId") Long roleId, @Param("authNodes") String[] authNodes);
/**
* 批量角色权限控制点
*
* @param roleAuthNodeList 角色权限控制点列表
* @return 结果
*/
public int batchRoleAuthNodes(List<DhcRoleAuthNode> roleAuthNodeList);
/**
* 根据条角色ID查询控制点信息
*
* @param roleId 角色ID
* @return 结果
*/
public List<String> getRoleAuthNodes(Long roleId);
}

10
sql/基础功能.sql

@ -31,6 +31,7 @@ create table dhc_area ( @@ -31,6 +31,7 @@ create table dhc_area (
parent_id bigint(20) default 0 comment '父区域id',
area_code varchar(32) default '' comment '区域编码',
area_name varchar(64) default '' comment '区域名称',
product_line_code varchar(32) default '' comment '产品线编码',
area_type varchar(32) default '' comment '区域类型',
area_level varchar(32) default '' comment '区域层级',
order_num int(4) default 0 comment '显示顺序',
@ -102,12 +103,3 @@ create table dhc_supplier ( @@ -102,12 +103,3 @@ create table dhc_supplier (
update_time datetime comment '更新时间',
primary key (supplier_id)
) engine=innodb auto_increment=1 comment = '供应商信息表';
-- ----------------------------
-- 8、角色-权限控制点关系表
-- ----------------------------
drop table if exists dhc_role_auth;
create table dhc_role_auth (
role_id bigint(20) NOT NULL comment '角色ID',
auth_node varchar(32) NOT NULL comment '权限控制点',
primary key (role_id, auth_node)
) engine=innodb auto_increment=1 comment = '角色-权限控制点关系表';
Loading…
Cancel
Save