初始化项目
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?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="xtools.app.sys.mapper.SysMenuMapper">
|
||||
<!-- 根据角色 ID 查询菜单列表 -->
|
||||
<select id="getMenuByRoleIds" resultType="xtools.app.sys.model.entity.SysMenu">
|
||||
SELECT
|
||||
DISTINCT
|
||||
sm.id,
|
||||
sm.parent_id,
|
||||
sm.tree_path,
|
||||
sm.menu_name,
|
||||
sm.menu_type,
|
||||
sm.menu_icon,
|
||||
sm.route_name,
|
||||
sm.route_path,
|
||||
sm.component,
|
||||
sm.menu_visible,
|
||||
sm.menu_cache
|
||||
FROM
|
||||
sys_menu sm
|
||||
LEFT JOIN sys_role_menu srm ON sm.id = srm.menu_id
|
||||
<where>
|
||||
AND sm.menu_type IN ('C', 'M')
|
||||
<if test="roleIds != null and roleIds.size() > 0">
|
||||
AND srm.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
sm.sort,
|
||||
sm.gmt_create DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据角色 ID 获取按钮权限列表 -->
|
||||
<select id="getBtnPermByRoleIds" resultType="xtools.app.sys.model.entity.SysMenu">
|
||||
SELECT
|
||||
DISTINCT
|
||||
sm.btn_perm
|
||||
FROM
|
||||
sys_menu sm
|
||||
LEFT JOIN sys_role_menu srm ON sm.id = srm.menu_id
|
||||
<where>
|
||||
AND sm.menu_type = 'B'
|
||||
<if test="roleIds != null and roleIds.size() > 0">
|
||||
AND srm.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 获取接口权限列表 -->
|
||||
<select id="getSysInterfacePerm" resultType="xtools.app.sys.model.entity.SysInterfacePerm">
|
||||
SELECT sm.interface_perm_type type,
|
||||
sm.interface_perm_uri uri,
|
||||
GROUP_CONCAT(srm.role_id SEPARATOR ',') AS roleIds
|
||||
FROM sys_menu sm
|
||||
LEFT JOIN sys_role_menu srm ON sm.id = srm.menu_id
|
||||
WHERE sm.menu_type = 'I'
|
||||
GROUP BY sm.id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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="xtools.app.sys.mapper.SysRiskMapper">
|
||||
<!-- 添加IP -->
|
||||
<update id="addIp">
|
||||
UPDATE sys_risk sr
|
||||
SET sr.DATA = CONCAT(
|
||||
REPLACE(sr.DATA, #{ip}, ''),
|
||||
#{ip}
|
||||
)
|
||||
WHERE sr.type = #{type} AND sr.sys_type = #{sysType}
|
||||
</update>
|
||||
|
||||
<!-- 移除IP -->
|
||||
<update id="removeIp">
|
||||
UPDATE sys_risk sr
|
||||
SET sr.DATA = REPLACE(sr.DATA, #{ip}, '')
|
||||
WHERE sr.type = #{type} AND sr.sys_type = #{sysType}
|
||||
</update>
|
||||
</mapper>
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?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="xtools.app.sys.mapper.SysUserNoticeInfoMapper">
|
||||
<!-- 获取用户通知列表 -->
|
||||
<select id="getUserNoticeList" resultType="xtools.app.sys.model.dto.resp.SysUserNoticeInfoResp">
|
||||
SELECT
|
||||
sn.id,
|
||||
sun.notice_read,
|
||||
sn.title,
|
||||
sn.type,
|
||||
sn.level,
|
||||
su.nickname publisher,
|
||||
sn.publish_time
|
||||
FROM
|
||||
sys_user_notice sun
|
||||
LEFT JOIN sys_notice sn ON sn.id = sun.notice_id
|
||||
LEFT JOIN sys_user su ON sn.publisher_id = su.id
|
||||
<where>
|
||||
AND sn.is_deleted = 0
|
||||
AND sun.is_deleted = 0
|
||||
AND sn.publish_status = 1
|
||||
AND sun.user_id = #{userId}
|
||||
<if test="query != null">
|
||||
<if test="query.noticeRead != null">
|
||||
AND sun.notice_read = #{query.noticeRead}
|
||||
</if>
|
||||
<if test="query.title != null and query.title != ''">
|
||||
AND sn.title LIKE CONCAT('%', #{query.title}, '%')
|
||||
</if>
|
||||
<if test="query.type != null">
|
||||
AND sn.type = #{query.type}
|
||||
</if>
|
||||
<if test="query.level != null">
|
||||
AND sn.level = #{query.level}
|
||||
</if>
|
||||
<if test="query.publishTimeRange != null and query.publishTimeRange.length == 2">
|
||||
AND sn.publish_time BETWEEN #{query.publishTimeRange[0]} AND #{query.publishTimeRange[1]}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
sn.gmt_create DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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="xtools.app.sys.mapper.SysUserNoticeMapper">
|
||||
<!-- 获取分页列表 -->
|
||||
<select id="getPage" resultType="xtools.app.sys.model.dto.resp.SysUserNoticeResp">
|
||||
SELECT
|
||||
sun.*,
|
||||
sn.title,
|
||||
su.nickname
|
||||
FROM
|
||||
sys_user_notice sun
|
||||
LEFT JOIN sys_notice sn ON sun.notice_id = sn.id
|
||||
LEFT JOIN sys_user su ON sun.user_id = su.id
|
||||
<where>
|
||||
<if test="query != null">
|
||||
<if test="query.noticeRead != null">
|
||||
AND sun.notice_read = #{query.noticeRead}
|
||||
</if>
|
||||
<if test="query.readTimeRange != null and query.readTimeRange.length == 2">
|
||||
AND sun.read_time BETWEEN #{query.readTimeRange[0]} AND #{query.readTimeRange[1]}
|
||||
</if>
|
||||
<if test="query.isDeleted != null">
|
||||
AND sun.is_deleted = #{query.isDeleted}
|
||||
</if>
|
||||
<if test="query.memo != null and query.memo != ''">
|
||||
AND sun.memo LIKE CONCAT('%', #{query.memo}, '%')
|
||||
</if>
|
||||
<if test="query.gmtCreateRange != null and query.gmtCreateRange.length == 2">
|
||||
AND sun.gmt_create BETWEEN #{query.gmtCreateRange[0]} AND #{query.gmtCreateRange[1]}
|
||||
</if>
|
||||
<if test="query.gmtModifiedRange != null and query.gmtModifiedRange.length == 2">
|
||||
AND sun.gmt_modified BETWEEN #{query.gmtModifiedRange[0]} AND #{query.gmtModifiedRange[1]}
|
||||
</if>
|
||||
<if test="query.title != null and query.title != ''">
|
||||
AND sn.title LIKE CONCAT('%', #{query.title}, '%')
|
||||
</if>
|
||||
<if test="query.nickname != null and query.nickname != ''">
|
||||
AND su.nickname LIKE CONCAT('%', #{query.nickname}, '%')
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
sun.gmt_create
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user