作者 朱兆平

组织机构查询接口sql优化失败,暂时回撤到正常版本.

... ... @@ -47,7 +47,7 @@ public class RoleServiceImp implements RoleService{
@Override
public PageInfo<ROLE> findAll(int pageNum, int pageSize, String roleName, String type){
Page<ROLE> page = PageHelper.startPage(pageNum,pageSize);
List<ROLE> list = roleMapper.findAllWithChildAndTree(roleName, type);
List<ROLE> list = roleMapper.findAll(roleName, type);
// List<ROLE> treeList = list.stream()
// .filter(role -> role.getParentid() == 0)
... ...
... ... @@ -14,6 +14,10 @@
<result column="departmentId" jdbcType="VARCHAR" property="departmentid" />
<result column="mq_code" jdbcType="VARCHAR" property="mqcode" />
</resultMap>
<resultMap id="TreeSqlWithPermResultMap" type="com.tianbo.warehouse.model.ROLE" extends="BaseResultMap">
<collection column="role_id" javaType="java.util.ArrayList" ofType="com.tianbo.warehouse.model.PERMISSION" property="permissions" select="com.tianbo.warehouse.dao.PERMISSIONMapper.getRolePermisson" />
<collection column="role_id" property="children" select="selectByParentId" />
</resultMap>
<resultMap id="TreeWithPermResultMap" type="com.tianbo.warehouse.model.ROLE" extends="BaseResultMap">
<collection javaType="java.util.ArrayList" ofType="com.tianbo.warehouse.model.PERMISSION" property="permissions">
<result column="permission_id" property="permissionId" jdbcType="INTEGER" />
... ... @@ -44,7 +48,7 @@
from role
where role_id = #{roleId,jdbcType=INTEGER}
</select>
<select id="selectByParentId" parameterType="java.lang.Integer" resultMap="TreeWithPermResultMap">
<select id="selectByParentId" parameterType="java.lang.Integer" resultMap="TreeSqlWithPermResultMap">
select
<include refid="Base_Column_List" />
from role
... ... @@ -223,7 +227,7 @@ WHERE
where role_id = #{roleId,jdbcType=INTEGER}
</update>
<select id="findAll" parameterType="java.lang.String" resultMap="TreeWithPermResultMap">
<select id="findAll" parameterType="java.lang.String" resultMap="TreeSqlWithPermResultMap">
SELECT
<include refid="Base_Column_List" />
FROM role
... ...