feat: role 接口开发
This commit is contained in:
55
src/main/resources/db/mapper/sys/SysRoleMapper.xml
Normal file
55
src/main/resources/db/mapper/sys/SysRoleMapper.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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" >
|
||||
<mapper namespace="net.geedge.asw.module.sys.dao.SysRoleDao">
|
||||
|
||||
<resultMap id="roleResult" type="net.geedge.asw.module.sys.entity.SysRoleEntity">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="i18n" column="i18n"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="buildIn" column="build_in"/>
|
||||
<result property="createUserId" column="create_user_id"/>
|
||||
<result property="updateUserId" column="update_user_id"/>
|
||||
<result property="createTimestamp" column="create_timestamp"/>
|
||||
<result property="updateTimestamp" column="update_timestamp"/>
|
||||
|
||||
<association property="createUser" columnPrefix="cu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
<association property="updateUser" columnPrefix="uu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryList" resultMap="roleResult">
|
||||
|
||||
SELECT
|
||||
sr.*,
|
||||
cu.id as cu_id,
|
||||
cu.name as cu_name,
|
||||
uu.id as uu_id,
|
||||
uu.id as uu_name
|
||||
FROM
|
||||
sys_role sr
|
||||
left join sys_user cu on sr.create_user_id = cu.id
|
||||
left join sys_user uu on sr.update_user_id = uu.id
|
||||
<where>
|
||||
<if test="params.ids != null and params.ids != ''">
|
||||
sr.id in
|
||||
<foreach item="id" collection="params.ids.split(',')" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="params.q != null and params.q != ''">
|
||||
AND ( locate(#{params.q}, sr.name) OR locate(#{params.q}, sr.remark) )
|
||||
</if>
|
||||
</where>
|
||||
<if test="params.orderBy == null or params.orderBy == ''">
|
||||
ORDER BY sr.name
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -117,5 +117,9 @@ INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_
|
||||
INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_user_id`, `update_timestamp`) VALUES (191, '201015', 'APP_ATTACHMENT_NOT_EXIST', '应用附件不存在', 'zh', '', 'admin', 1724030366000);
|
||||
INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_user_id`, `update_timestamp`) VALUES (193, '201016', 'APP_PROPERTIES_FORMAT_ERROR', 'application properties format error', 'en', '', 'admin', 1724030366000);
|
||||
INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_user_id`, `update_timestamp`) VALUES (195, '201016', 'APP_PROPERTIES_FORMAT_ERROR', '应用属性格式错误', 'zh', '', 'admin', 1724030366000);
|
||||
INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_user_id`, `update_timestamp`) VALUES (197, '100017', 'SYS_ROLE_BUILT_IN', 'Built-in role are not allowed to delete or update', 'en', '', 'admin', 1724030366000);
|
||||
INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_user_id`, `update_timestamp`) VALUES (199, '100017', 'SYS_ROLE_BUILT_IN', '内置权限不能删除或修改', 'zh', '', 'admin', 1724030366000);
|
||||
INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_user_id`, `update_timestamp`) VALUES (201, '100018', 'SYS_ROLE_NOT_DELETE', 'Used role cannot be delete', 'en', '', 'admin', 1724030366000);
|
||||
INSERT INTO `sys_i18n`(`id`, `name`, `code`, `value`, `lang`, `remark`, `update_user_id`, `update_timestamp`) VALUES (203, '100018', 'SYS_ROLE_NOT_DELETE', '已使用权限不能删除', 'zh', '', 'admin', 1724030366000);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -34,24 +34,27 @@ DROP TABLE IF EXISTS `sys_role`;
|
||||
CREATE TABLE `sys_role` (
|
||||
`id` varchar(64) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`i18n` varchar(255) NOT NULL,
|
||||
`remark` varchar(255) NOT NULL,
|
||||
`i18n` varchar(255) NOT NULL DEFAULT '',
|
||||
`remark` varchar(255) NOT NULL DEFAULT '',
|
||||
`build_in` int(10) NOT NULL DEFAULT 0,
|
||||
`create_timestamp` bigint(20) NOT NULL,
|
||||
`update_timestamp` bigint(20) NOT NULL,
|
||||
`create_user_id` varchar(64) NOT NULL,
|
||||
`update_user_id` varchar(64) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_name` (`name`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 添加内置角色
|
||||
INSERT INTO `sys_role` (`id`, `name`, `i18n`, `remark`, `build_in`, `create_timestamp`) VALUES ('admin', 'admin', 'admin', 'admin', 1, UNIX_TIMESTAMP(NOW())*1000);
|
||||
INSERT INTO `sys_role` (`id`, `name`, `i18n`, `remark`, `build_in`, `create_timestamp`) VALUES ('readonly', 'readonly', 'readonly', 'readonly', 1, UNIX_TIMESTAMP(NOW())*1000);
|
||||
INSERT INTO `sys_role` (`id`, `name`, `i18n`, `remark`, `build_in`, `create_timestamp`, `update_timestamp`, `create_user_id`, `update_user_id`) VALUES ('admin', 'admin', 'admin', 'The system built-in administrator role', 1, UNIX_TIMESTAMP(NOW())*1000, UNIX_TIMESTAMP(NOW())*1000, 'admin', 'admin');
|
||||
INSERT INTO `sys_role` (`id`, `name`, `i18n`, `remark`, `build_in`, `create_timestamp`, `update_timestamp`, `create_user_id`, `update_user_id`) VALUES ('readonly', 'readonly', 'readonly', 'The system built-in common user role', 1, UNIX_TIMESTAMP(NOW())*1000, UNIX_TIMESTAMP(NOW())*1000, 'admin', 'admin');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `sys_menu`;
|
||||
CREATE TABLE `sys_menu` (
|
||||
`id` varchar(64) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`i18n` varchar(255) NOT NULL,
|
||||
`i18n` varchar(255) NOT NULL DEFAULT '',
|
||||
`pid` varchar(64) NOT NULL DEFAULT '',
|
||||
`type` varchar(64) NOT NULL,
|
||||
`perms` varchar(255) NOT NULL DEFAULT '',
|
||||
|
||||
Reference in New Issue
Block a user