...
|
...
|
@@ -13,9 +13,36 @@ |
|
|
<result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
|
|
|
<result column="departmentId" jdbcType="VARCHAR" property="departmentid" />
|
|
|
<result column="mq_code" jdbcType="VARCHAR" property="mqcode" />
|
|
|
<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">
|
|
|
<id column="role_id" jdbcType="INTEGER" property="roleId" />
|
|
|
<result column="role_name" jdbcType="VARCHAR" property="roleName" />
|
|
|
<result column="role_sign" jdbcType="VARCHAR" property="roleSign" />
|
|
|
<result column="description" jdbcType="VARCHAR" property="description" />
|
|
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
|
|
<result column="parentId" jdbcType="INTEGER" property="parentid" />
|
|
|
<result column="rsort" jdbcType="INTEGER" property="rsort" />
|
|
|
<result column="customs_reg_code" jdbcType="VARCHAR" property="customsRegCode" />
|
|
|
<result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
|
|
|
<result column="departmentId" jdbcType="VARCHAR" property="departmentid" />
|
|
|
<result column="mq_code" jdbcType="VARCHAR" property="mqcode" />
|
|
|
<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="TreeWithResultMap" type="com.tianbo.warehouse.model.ROLE">
|
|
|
<id column="role_id" jdbcType="INTEGER" property="roleId" />
|
|
|
<result column="role_name" jdbcType="VARCHAR" property="roleName" />
|
|
|
<result column="role_sign" jdbcType="VARCHAR" property="roleSign" />
|
|
|
<result column="description" jdbcType="VARCHAR" property="description" />
|
|
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
|
|
<result column="parentId" jdbcType="INTEGER" property="parentid" />
|
|
|
<result column="rsort" jdbcType="INTEGER" property="rsort" />
|
|
|
<result column="customs_reg_code" jdbcType="VARCHAR" property="customsRegCode" />
|
|
|
<result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
|
|
|
<result column="departmentId" jdbcType="VARCHAR" property="departmentid" />
|
|
|
<result column="mq_code" jdbcType="VARCHAR" property="mqcode" />
|
|
|
<collection column="role_id" property="children" select="selectByParentId" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
role_id, role_name, role_sign, description, type, parentId, rsort, customs_reg_code,
|
|
|
business_license, departmentId, mq_code
|
...
|
...
|
@@ -26,7 +53,7 @@ |
|
|
from role
|
|
|
where role_id = #{roleId,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<select id="selectByParentId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
<select id="selectByParentId" parameterType="java.lang.Integer" resultMap="TreeWithResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from role
|
...
|
...
|
@@ -205,18 +232,20 @@ WHERE |
|
|
where role_id = #{roleId,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
<select id="findAll" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
<select id="findAll" parameterType="java.lang.String" resultMap="TreeWithResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List" />
|
|
|
FROM role
|
|
|
where parentId=0
|
|
|
and 1=1
|
|
|
<if test="roleName != '' and roleName !=null">
|
|
|
and role_name = #{roleName, jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="type != '' and type !=null">
|
|
|
and type like '%' #{type} '%'
|
|
|
</if>
|
|
|
<where>
|
|
|
parentId = 0
|
|
|
<if test="roleName != '' and roleName !=null">
|
|
|
and role_name = #{roleName, jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="type != '' and type !=null">
|
|
|
and type like '%' #{type} '%'
|
|
|
</if>
|
|
|
</where>
|
|
|
order by rsort
|
|
|
</select>
|
|
|
<select id="findRolesByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
SELECT
|
...
|
...
|
@@ -227,4 +256,19 @@ WHERE |
|
|
LEFT JOIN role R ON R.role_id= UR.role_id
|
|
|
where U.user_id = #{userId,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
|
|
|
<select id="findAllWithOutTree" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List" />
|
|
|
FROM role
|
|
|
<where>
|
|
|
<if test="roleName != '' and roleName !=null">
|
|
|
and role_name = #{roleName, jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="type != '' and type !=null">
|
|
|
and type like '%' #{type} '%'
|
|
|
</if>
|
|
|
</where>
|
|
|
order by parentId,rsort
|
|
|
</select>
|
|
|
</mapper> |
...
|
...
|
|