Sfoglia il codice sorgente

[权限][新增]:获取自权限列表

release_toaliyun_real
Stormeye Wu 7 anni fa
parent
commit
1f18e1c1b5
5 ha cambiato i file con 127 aggiunte e 94 eliminazioni
  1. +7
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/MallPermissionController.java
  2. +13
    -0
      mallinkService/src/main/java/com/iformall/domain/po/MallPermission.java
  3. +10
    -2
      mallinkService/src/main/java/com/iformall/service/MallPermissionService.java
  4. +11
    -0
      mallinkService/src/main/java/com/iformall/service/impl/MallPermissionServiceImpl.java
  5. +86
    -92
      mallinkService/src/main/resources/mapper/MallPermissionMapper.xml

+ 7
- 0
mallinkAdmin/src/main/java/com/iformall/controller/MallPermissionController.java Vedi File

@@ -71,5 +71,12 @@ public class MallPermissionController extends BaseController {
return new ResultData(Result.SUCCESS, "成功", null); return new ResultData(Result.SUCCESS, "成功", null);
} }


@GetMapping("/findByParentId")
@SystemControllerLog(description = "用户管理-子权限查找")
public ResultData findByParentId(Long id) {
logger.debug("[" + getIpAddr() + "] MallPermissionController::findByParentId");
return new ResultData(Result.SUCCESS, "成功", mallPermissionService.getByParentId(id));
}



} }

+ 13
- 0
mallinkService/src/main/java/com/iformall/domain/po/MallPermission.java Vedi File

@@ -56,6 +56,19 @@ public class MallPermission implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="排序",name="sort") @io.swagger.annotations.ApiModelProperty(value="排序",name="sort")
private Integer sort; private Integer sort;


@Transient
private Integer sortFrom;
@Transient
private Integer sortTo;
@Transient
private Integer sortGte;
@Transient
private Integer sortGt;
@Transient
private Integer sortLte;
@Transient
private Integer sortLt;

public static enum Field public static enum Field
{ {
Id_ASC("`id` ASC"),Id_DESC("`id` DESC") Id_ASC("`id` ASC"),Id_DESC("`id` DESC")


+ 10
- 2
mallinkService/src/main/java/com/iformall/service/MallPermissionService.java Vedi File

@@ -11,8 +11,8 @@ public interface MallPermissionService {
* 根据实体查询分页列表 * 根据实体查询分页列表
* *
* @param record * @param record
* @param offset
* @param limit
* @param pageIndex
* @param pageSize
* @return * @return
*/ */
PageInfo<MallPermission> listAsPage(MallPermission record, Integer pageIndex, Integer pageSize); PageInfo<MallPermission> listAsPage(MallPermission record, Integer pageIndex, Integer pageSize);
@@ -24,6 +24,14 @@ public interface MallPermissionService {
* @return * @return
*/ */
MallPermission getById(Long id); MallPermission getById(Long id);

/**
* 根据parentId获得列表
*
* @param parentId
* @return
*/
List<MallPermission> getByParentId(Long parentId);
/** /**
* 保存或更新实体 * 保存或更新实体


+ 11
- 0
mallinkService/src/main/java/com/iformall/service/impl/MallPermissionServiceImpl.java Vedi File

@@ -31,6 +31,17 @@ public class MallPermissionServiceImpl implements MallPermissionService {
return mallPermissionMapper.selectByPrimaryKey(id); return mallPermissionMapper.selectByPrimaryKey(id);
} }


@Override
public List<MallPermission> getByParentId(Long parentId) {
if(parentId == null) {
parentId = 0L;
}
MallPermission mpQ = new MallPermission();
mpQ.setParentId(parentId);
mpQ.setSortColumns(MallPermission.Field.Sort_ASC);
return mallPermissionMapper.findList(mpQ);
}

@Override @Override
public void saveOrUpdate(MallPermission record) { public void saveOrUpdate(MallPermission record) {
if (record.getId() == null) { if (record.getId() == null) {


+ 86
- 92
mallinkService/src/main/resources/mapper/MallPermissionMapper.xml Vedi File

@@ -1,99 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.MallPermissionMapper"> <mapper namespace="com.iformall.mapper.MallPermissionMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.MallPermission">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="available" jdbcType="VARCHAR" property="available" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="parent_ids" jdbcType="VARCHAR" property="parentIds" />
<result column="permission" jdbcType="VARCHAR" property="permission" />
<result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</resultMap>
<sql id="allColumns">
`id`,`name`,`available`,`parent_id`,`parent_ids`,`permission`,`resource_type`,`url`,`sort`
<resultMap id="BaseResultMap" type="com.iformall.domain.po.MallPermission">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
<result column="available" jdbcType="VARCHAR" property="available"/>
<result column="permission" jdbcType="VARCHAR" property="permission"/>
<result column="resource_type" jdbcType="VARCHAR" property="resourceType"/>
<result column="module_color" jdbcType="VARCHAR" property="moduleColor"/>
<result column="module_color_num" jdbcType="VARCHAR" property="moduleColorNum"/>
<result column="url" jdbcType="VARCHAR" property="url"/>
<result column="icon" jdbcType="VARCHAR" property="icon"/>
<result column="version_type" jdbcType="VARCHAR" property="versionType"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
</resultMap>

<sql id="allColumns">
`id`,`name`,`parent_id`,`available`,`permission`,`resource_type`,`module_color`,`module_color_num`,`url`,`icon`,`sort`
</sql> </sql>


<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != name ">
and `name` = #{name}
</if>
<if test=" null != nameLike and '' != nameLike ">
and `name` like concat('%', #{nameLike},'%')
</if>

<if test=" null != parentId ">
and `parent_id` = #{parentId}
</if>

<if test=" null != available ">
and `available` like concat('%', #{available},'%')
</if>

<if test=" null != permission ">
and `permission` like concat('%', #{permission},'%')
</if>
<if test=" null != permissions ">
and `permission` in
<foreach collection="permissions" item="item_permission" open="(" close=")" separator=",">
#{item_permission}
</foreach>
</if>

<if test=" null != resourceType ">
and `resource_type` like concat('%', #{resourceType},'%')
</if>

<if test=" null != url ">
and `url` = #{url}
</if>

<if test=" null != icon ">
and `icon` = #{icon}
</if>

<if test=" null != sort ">
and `sort` = #{sort}
</if>
<if test=" null != sortFrom ">and `sort` >= #{sortFrom}</if>
<if test=" null != sortTo ">and #{sortTo} >= `sort`</if>
<if test=" null != sortGte ">and `sort` >= #{sortGte}</if>
<if test=" null != sortGt ">and `sort` > #{sortGt}</if>
<if test=" null != sortLte ">and #{sortLte} >= `sort`</if>
<if test=" null != sortLt ">and #{sortLt} > `sort`</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findList" parameterType="com.iformall.domain.po.MallPermission" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from mall_permission
<include refid="dynamicWhereConditions"/>
</select>



<if test=" null != name ">
and `name` like concat('%', #{name},'%')
</if>
<if test=" null != nameLike and '' != nameLike "> and `name` like concat('%', #{nameLike},'%')</if>
<if test=" null != available ">
and `available` like concat('%', #{available},'%')
</if>
<if test=" null != parentId ">
and `parent_id` = #{parentId}
</if>
<if test=" null != parentIds ">
and `parent_ids` like concat('%', #{parentIds},'%')
</if>
<if test=" null != permission ">
and `permission` like concat('%', #{permission},'%')
</if>
<if test=" null != permissions ">
and `permission` in
<foreach collection="permissions" item="item_permission" open="(" close=")" separator=",">
#{item_permission}
</foreach>
</if>
<if test=" null != resourceType ">
and `resource_type` like concat('%', #{resourceType},'%')
</if>
<if test=" null != url ">
and `url` like concat('%', #{url},'%')
</if>
<if test=" null != sort ">
and `sort` = #{sort}
</if>
<if test=" null != sortFrom "> and `sort` >= #{sortFrom} </if>
<if test=" null != sortTo "> and #{sortTo} >= `sort` </if>
<if test=" null != sortGte "> and `sort` >= #{sortGte} </if>
<if test=" null != sortGt "> and `sort` > #{sortGt} </if>
<if test=" null != sortLte "> and #{sortLte} >= `sort` </if>
<if test=" null != sortLt "> and #{sortLt} > `sort` </if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.MallPermission" resultMap="BaseResultMap">
select <include refid="allColumns" /> from mall_permission
<include refid="dynamicWhereConditions" />
</select>
</mapper> </mapper>

Caricamento…
Annulla
Salva