...
|
...
|
@@ -17,11 +17,11 @@ |
|
|
<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,
|
|
|
role_id, role_name, role_sign, description, type, parentId, rsort, customs_reg_code,
|
|
|
business_license, departmentId, mq_code
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
select
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from role
|
|
|
where role_id = #{roleId,jdbcType=INTEGER}
|
...
|
...
|
@@ -32,18 +32,53 @@ |
|
|
from role
|
|
|
where parentId = #{roleId,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<select id="selectTopByChildID" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
*
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
t3.*
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
t1.*,
|
|
|
IF
|
|
|
(
|
|
|
FIND_IN_SET( role_id, @ids ) > 0,
|
|
|
@ids := CONCAT( parentId, ',', @ids ),
|
|
|
'0'
|
|
|
) AS isparent
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
t.*
|
|
|
FROM
|
|
|
role AS t
|
|
|
ORDER BY
|
|
|
t.role_id DESC
|
|
|
) t1,
|
|
|
( SELECT @ids := #{roleId,jdbcType=INTEGER} ) t2
|
|
|
) t3
|
|
|
WHERE
|
|
|
t3.isparent != '0'
|
|
|
) t4
|
|
|
WHERE
|
|
|
t4.parentId = 0
|
|
|
order by role_id
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
delete from role
|
|
|
where role_id = #{roleId,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.tianbo.warehouse.model.ROLE">
|
|
|
insert into role (role_id, role_name, role_sign,
|
|
|
description, type, parentId,
|
|
|
rsort, customs_reg_code, business_license,
|
|
|
insert into role (role_id, role_name, role_sign,
|
|
|
description, type, parentId,
|
|
|
rsort, customs_reg_code, business_license,
|
|
|
departmentId, mq_code)
|
|
|
values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{roleSign,jdbcType=VARCHAR},
|
|
|
#{description,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{parentid,jdbcType=INTEGER},
|
|
|
#{rsort,jdbcType=INTEGER}, #{customsRegCode,jdbcType=VARCHAR}, #{businessLicense,jdbcType=VARCHAR},
|
|
|
values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{roleSign,jdbcType=VARCHAR},
|
|
|
#{description,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{parentid,jdbcType=INTEGER},
|
|
|
#{rsort,jdbcType=INTEGER}, #{customsRegCode,jdbcType=VARCHAR}, #{businessLicense,jdbcType=VARCHAR},
|
|
|
#{departmentid,jdbcType=VARCHAR},#{mqcode,jdbcType=VARCHAR})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.tianbo.warehouse.model.ROLE">
|
...
|
...
|
@@ -192,4 +227,4 @@ |
|
|
LEFT JOIN role R ON R.role_id= UR.role_id
|
|
|
where U.user_id = #{userId,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
</mapper> |
|
|
\ No newline at end of file |
|
|
</mapper> |
...
|
...
|
|