diff --git a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml index e8b2b467..d482d5e4 100644 --- a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml +++ b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml @@ -3,46 +3,46 @@ <mapper namespace="top.charles7c.continew.admin.monitor.mapper.LogMapper"> <select id="selectDashboardTotal" resultType="top.charles7c.continew.admin.monitor.model.resp.DashboardTotalResp"> SELECT - (SELECT COUNT(*) FROM `sys_log`) AS pvCount, - (SELECT COUNT(DISTINCT `ip`) FROM `sys_log`) AS ipCount, - (SELECT COUNT(*) FROM `sys_log` WHERE DATE(`create_time`) = CURDATE()) AS todayPvCount, - (SELECT COUNT(*) FROM `sys_log` WHERE DATE(`create_time`) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS yesterdayPvCount + (SELECT COUNT(*) FROM sys_log) AS pvCount, + (SELECT COUNT(DISTINCT ip) FROM sys_log) AS ipCount, + (SELECT COUNT(*) FROM sys_log WHERE DATE(create_time) = CURDATE()) AS todayPvCount, + (SELECT COUNT(*) FROM sys_log WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS yesterdayPvCount </select> <select id="selectListDashboardAccessTrend" resultType="top.charles7c.continew.admin.monitor.model.resp.DashboardAccessTrendResp"> SELECT - DATE(`create_time`) AS date, + DATE(create_time) AS date, COUNT(*) AS pvCount, - COUNT(DISTINCT `ip`) AS ipCount - FROM `sys_log` - GROUP BY DATE(`create_time`) - HAVING `date` != CURDATE() - ORDER BY DATE(`create_time`) DESC + COUNT(DISTINCT ip) AS ipCount + FROM sys_log + GROUP BY DATE(create_time) + HAVING date != CURDATE() + ORDER BY DATE(create_time) DESC LIMIT #{days} </select> <select id="selectListDashboardPopularModule" resultType="top.charles7c.continew.admin.monitor.model.resp.DashboardPopularModuleResp"> SELECT - `module`, + module, COUNT(*) AS pvCount, - SUM(CASE WHEN DATE(`create_time`) = CURDATE() THEN 1 ELSE 0 END) AS todayPvCount, - SUM(CASE WHEN DATE(`create_time`) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) THEN 1 ELSE 0 END) AS yesterdayPvCount - FROM `sys_log` - GROUP BY `module` - HAVING `module` != '验证码' AND `module` != '登录' - ORDER BY `pvCount` DESC + SUM(CASE WHEN DATE(create_time) = CURDATE() THEN 1 ELSE 0 END) AS todayPvCount, + SUM(CASE WHEN DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) THEN 1 ELSE 0 END) AS yesterdayPvCount + FROM sys_log + GROUP BY module + HAVING module != '验证码' AND module != '登录' + ORDER BY pvCount DESC LIMIT 10 </select> <select id="selectListDashboardGeoDistribution" resultType="java.util.Map"> SELECT - SUBSTRING_INDEX(`address`, ' ', 1) AS name, - COUNT(DISTINCT `ip`) AS value - FROM `sys_log` - GROUP BY `name` - ORDER BY COUNT(DISTINCT `ip`) DESC + SUBSTRING_INDEX(address, ' ', 1) AS name, + COUNT(DISTINCT ip) AS value + FROM sys_log + GROUP BY name + ORDER BY COUNT(DISTINCT ip) DESC LIMIT 10 </select> </mapper> \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java index efed6bfb..992f7642 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java @@ -16,14 +16,13 @@ package top.charles7c.continew.admin.system.mapper; -import java.util.List; - import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; - import top.charles7c.continew.admin.system.model.entity.RoleDeptDO; import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; +import java.util.List; + /** * 角色和部门 Mapper * @@ -38,6 +37,6 @@ public interface RoleDeptMapper extends BaseMapper<RoleDeptDO> { * @param roleId 角色 ID * @return 部门 ID 列表 */ - @Select("SELECT `dept_id` FROM `sys_role_dept` WHERE `role_id` = #{roleId}") + @Select("SELECT dept_id FROM sys_role_dept WHERE role_id = #{roleId}") List<Long> selectDeptIdByRoleId(@Param("roleId") Long roleId); } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java index dd02eb5f..68970b13 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java @@ -37,7 +37,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { * @param username 用户名 * @return 用户信息 */ - @Select("SELECT * FROM `sys_user` WHERE `username` = #{username}") + @Select("SELECT * FROM sys_user WHERE username = #{username}") UserDO selectByUsername(@Param("username") String username); /** @@ -46,7 +46,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { * @param phone 手机号 * @return 用户信息 */ - @Select("SELECT * FROM `sys_user` WHERE `phone` = #{phone}") + @Select("SELECT * FROM sys_user WHERE phone = #{phone}") UserDO selectByPhone(@FieldEncrypt @Param("phone") String phone); /** @@ -55,7 +55,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { * @param email 邮箱 * @return 用户信息 */ - @Select("SELECT * FROM `sys_user` WHERE `email` = #{email}") + @Select("SELECT * FROM sys_user WHERE email = #{email}") UserDO selectByEmail(@FieldEncrypt @Param("email") String email); /** @@ -64,6 +64,6 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { * @param id ID * @return 昵称 */ - @Select("SELECT `nickname` FROM `sys_user` WHERE `id` = #{id}") + @Select("SELECT nickname FROM sys_user WHERE id = #{id}") String selectNicknameById(@Param("id") Long id); } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java index 28e09e61..9705fb80 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java @@ -38,6 +38,6 @@ public interface UserRoleMapper extends BaseMapper<UserRoleDO> { * @param userId 用户 ID * @return 角色 ID 列表 */ - @Select("SELECT `role_id` FROM `sys_user_role` WHERE `user_id` = #{userId}") + @Select("SELECT role_id FROM sys_user_role WHERE user_id = #{userId}") List<Long> selectRoleIdByUserId(@Param("userId") Long userId); } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java index 5d7a42d3..1c8cda3d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java @@ -155,7 +155,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes * @return 子部门列表 */ private List<DeptDO> listChildren(Long id) { - return baseMapper.lambdaQuery().apply(String.format("find_in_set(%s, `ancestors`)", id)).list(); + return baseMapper.lambdaQuery().apply(String.format("find_in_set(%s, ancestors)", id)).list(); } /** @@ -170,7 +170,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes return 0L; } return ids.stream() - .mapToLong(id -> baseMapper.lambdaQuery().apply(String.format("find_in_set(%s, `ancestors`)", id)).count()) + .mapToLong(id -> baseMapper.lambdaQuery().apply(String.format("find_in_set(%s, ancestors)", id)).count()) .sum(); } diff --git a/continew-admin-system/src/main/resources/mapper/AnnouncementMapper.xml b/continew-admin-system/src/main/resources/mapper/AnnouncementMapper.xml index db5211f9..1990d815 100644 --- a/continew-admin-system/src/main/resources/mapper/AnnouncementMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/AnnouncementMapper.xml @@ -5,11 +5,11 @@ <select id="selectDashboardList" resultType="top.charles7c.continew.admin.system.model.resp.DashboardAnnouncementResp"> SELECT - `id`, `title`, `type` - FROM `sys_announcement` - WHERE (`effective_time` IS NULL OR NOW() > `effective_time`) - AND (`terminate_time` IS NULL OR `terminate_time` > NOW()) - ORDER BY `sort` ASC, `effective_time` DESC + id, title, type + FROM sys_announcement + WHERE (effective_time IS NULL OR NOW() > effective_time) + AND (terminate_time IS NULL OR terminate_time > NOW()) + ORDER BY sort ASC, effective_time DESC LIMIT 5 </select> </mapper> \ No newline at end of file diff --git a/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml b/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml index 84e2355b..93bd02e7 100644 --- a/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml @@ -2,10 +2,10 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="top.charles7c.continew.admin.system.mapper.DictItemMapper"> <select id="listByDictCode" resultType="top.charles7c.continew.admin.common.model.resp.LabelValueResp"> - SELECT t1.`label`, t1.`value`, t1.`color` - FROM `sys_dict_item` AS t1 - LEFT JOIN `sys_dict` AS t2 ON t1.`dict_id` = t2.`id` - WHERE t2.`code` = #{dictCode} - ORDER BY t1.`sort` ASC + SELECT t1.label, t1.value, t1.color + FROM sys_dict_item AS t1 + LEFT JOIN sys_dict AS t2 ON t1.dict_id = t2.id + WHERE t2.code = #{dictCode} + ORDER BY t1.sort ASC </select> </mapper> \ No newline at end of file diff --git a/continew-admin-system/src/main/resources/mapper/MenuMapper.xml b/continew-admin-system/src/main/resources/mapper/MenuMapper.xml index 24fa3c4f..6fdeae33 100644 --- a/continew-admin-system/src/main/resources/mapper/MenuMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/MenuMapper.xml @@ -2,25 +2,25 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="top.charles7c.continew.admin.system.mapper.MenuMapper"> <select id="selectPermissionByUserId" resultType="java.lang.String"> - SELECT DISTINCT t1.`permission` - FROM `sys_menu` AS t1 - LEFT JOIN `sys_role_menu` AS t2 ON t2.`menu_id` = t1.`id` - LEFT JOIN `sys_role` AS t3 ON t3.`id` = t2.`role_id` - LEFT JOIN `sys_user_role` AS t4 ON t4.`role_id` = t3.`id` - LEFT JOIN `sys_user` AS t5 ON t5.`id` = t4.`user_id` - WHERE t5.`id` = #{userId} - AND t1.`type` IN (2, 3) - AND t1.`status` = 1 - AND t3.`status` = 1 + SELECT DISTINCT t1.permission + FROM sys_menu AS t1 + LEFT JOIN sys_role_menu AS t2 ON t2.menu_id = t1.id + LEFT JOIN sys_role AS t3 ON t3.id = t2.role_id + LEFT JOIN sys_user_role AS t4 ON t4.role_id = t3.id + LEFT JOIN sys_user AS t5 ON t5.id = t4.user_id + WHERE t5.id = #{userId} + AND t1.type IN (2, 3) + AND t1.status = 1 + AND t3.status = 1 </select> <select id="selectListByRoleCode" resultType="top.charles7c.continew.admin.system.model.entity.MenuDO"> SELECT t1.* - FROM `sys_menu` AS t1 - LEFT JOIN `sys_role_menu` AS t2 ON t2.`menu_id` = t1.`id` - LEFT JOIN `sys_role` AS t3 ON t3.`id` = t2.`role_id` - WHERE t3.`code` = #{roleCode} - AND t1.`status` = 1 - AND t3.`status` = 1 + FROM sys_menu AS t1 + LEFT JOIN sys_role_menu AS t2 ON t2.menu_id = t1.id + LEFT JOIN sys_role AS t3 ON t3.id = t2.role_id + WHERE t3.code = #{roleCode} + AND t1.status = 1 + AND t3.status = 1 </select> </mapper> \ No newline at end of file diff --git a/continew-admin-system/src/main/resources/mapper/MessageMapper.xml b/continew-admin-system/src/main/resources/mapper/MessageMapper.xml index 14046597..4588b8d9 100644 --- a/continew-admin-system/src/main/resources/mapper/MessageMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/MessageMapper.xml @@ -4,11 +4,11 @@ <select id="selectPageByUserId" resultType="top.charles7c.continew.admin.system.model.resp.MessageResp"> SELECT t1.*, - t2.`user_id`, - t2.`is_read`, - t2.`read_time` - FROM `sys_message` AS t1 - LEFT JOIN `sys_message_user` AS t2 ON t2.`message_id` = t1.`id` + t2.user_id, + t2.is_read, + t2.read_time + FROM sys_message AS t1 + LEFT JOIN sys_message_user AS t2 ON t2.message_id = t1.id ${ew.getCustomSqlSegment} </select> </mapper> diff --git a/continew-admin-system/src/main/resources/mapper/MessageUserMapper.xml b/continew-admin-system/src/main/resources/mapper/MessageUserMapper.xml index e8b6a909..d762bb6c 100644 --- a/continew-admin-system/src/main/resources/mapper/MessageUserMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/MessageUserMapper.xml @@ -3,12 +3,12 @@ <mapper namespace="top.charles7c.continew.admin.system.mapper.MessageUserMapper"> <select id="selectUnreadCountByUserIdAndType" resultType="Long"> SELECT - COUNT(t1.`message_id`) - FROM `sys_message_user` AS t1 - LEFT JOIN `sys_message` AS t2 ON t2.`id` = t1.`message_id` - WHERE t1.`user_id` = #{userId} AND t1.`is_read` = 0 + COUNT(t1.message_id) + FROM sys_message_user AS t1 + LEFT JOIN sys_message AS t2 ON t2.id = t1.message_id + WHERE t1.user_id = #{userId} AND t1.is_read = 0 <if test="type != null"> - AND t2.`type` = #{type} + AND t2.type = #{type} </if> </select> </mapper> \ No newline at end of file diff --git a/continew-admin-system/src/main/resources/mapper/RoleMenuMapper.xml b/continew-admin-system/src/main/resources/mapper/RoleMenuMapper.xml index 827b0fec..5b8d82d6 100644 --- a/continew-admin-system/src/main/resources/mapper/RoleMenuMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/RoleMenuMapper.xml @@ -2,9 +2,9 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="top.charles7c.continew.admin.system.mapper.RoleMenuMapper"> <select id="selectMenuIdByRoleIds" resultType="java.lang.Long"> - SELECT `menu_id` - FROM `sys_role_menu` - WHERE `role_id` IN + SELECT menu_id + FROM sys_role_menu + WHERE role_id IN <foreach collection="list" item="roleId" open="(" close=")" separator=","> #{roleId} </foreach> diff --git a/continew-admin-system/src/main/resources/mapper/UserSocialMapper.xml b/continew-admin-system/src/main/resources/mapper/UserSocialMapper.xml index 9ab3e216..8193dc10 100644 --- a/continew-admin-system/src/main/resources/mapper/UserSocialMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/UserSocialMapper.xml @@ -4,8 +4,8 @@ <select id="selectBySourceAndOpenId" resultType="top.charles7c.continew.admin.system.model.entity.UserSocialDO"> SELECT t1.* - FROM `sys_user_social` AS t1 - LEFT JOIN `sys_user` AS t2 ON t2.`id` = t1.`user_id` - WHERE t1.`source` = #{source} AND t1.`open_id` = #{openId} + FROM sys_user_social AS t1 + LEFT JOIN sys_user AS t2 ON t2.id = t1.user_id + WHERE t1.source = #{source} AND t1.open_id = #{openId} </select> </mapper> \ No newline at end of file diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java index 0404d3f8..60107013 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java @@ -32,72 +32,72 @@ import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; public enum QueryTypeEnum implements IBaseEnum<Integer> { /** - * 等于 =,例如:WHERE `age` = 18 + * 等于 =,例如:WHERE age = 18 */ EQ(1, "="), /** - * 不等于 !=,例如:WHERE `age` != 18 + * 不等于 !=,例如:WHERE age != 18 */ NE(2, "!="), /** - * 大于 >,例如:WHERE `age` > 18 + * 大于 >,例如:WHERE age > 18 */ GT(3, ">"), /** - * 大于等于 >= ,例如:WHERE `age` >= 18 + * 大于等于 >= ,例如:WHERE age >= 18 */ GE(4, ">="), /** - * 小于 <,例如:WHERE `age` < 18 + * 小于 <,例如:WHERE age < 18 */ LT(5, "<"), /** - * 小于等于 <=,例如:WHERE `age` <= 18 + * 小于等于 <=,例如:WHERE age <= 18 */ LE(6, "<="), /** - * 范围查询,例如:WHERE `age` BETWEEN 10 AND 18 + * 范围查询,例如:WHERE age BETWEEN 10 AND 18 */ BETWEEN(7, "BETWEEN"), /** - * LIKE '%值%',例如:WHERE `nickname` LIKE '%s%' + * LIKE '%值%',例如:WHERE nickname LIKE '%s%' */ LIKE(8, "LIKE '%s%'"), /** - * LIKE '%值',例如:WHERE `nickname` LIKE '%s' + * LIKE '%值',例如:WHERE nickname LIKE '%s' */ LIKE_LEFT(9, "LIKE '%s'"), /** - * LIKE '值%',例如:WHERE `nickname` LIKE 's%' + * LIKE '值%',例如:WHERE nickname LIKE 's%' */ LIKE_RIGHT(10, "LIKE 's%'"), /** - * 包含查询,例如:WHERE `age` IN (10, 20, 30) + * 包含查询,例如:WHERE age IN (10, 20, 30) */ IN(11, "IN"), /** - * 不包含查询,例如:WHERE `age` NOT IN (20, 30) + * 不包含查询,例如:WHERE age NOT IN (20, 30) */ NOT_IN(12, "NOT IN"), /** - * 空查询,例如:WHERE `email` IS NULL + * 空查询,例如:WHERE email IS NULL */ IS_NULL(13, "IS NULL"), /** - * 非空查询,例如:WHERE `email` IS NOT NULL + * 非空查询,例如:WHERE email IS NOT NULL */ IS_NOT_NULL(14, "IS NOT NULL"),; diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java index 13ffa338..23273270 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java @@ -16,14 +16,13 @@ package top.charles7c.continew.admin.tool.mapper; -import java.util.List; - import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; - import top.charles7c.continew.admin.tool.model.entity.FieldConfigDO; import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; +import java.util.List; + /** * 字段配置 Mapper * @@ -38,6 +37,6 @@ public interface FieldConfigMapper extends BaseMapper<FieldConfigDO> { * @param tableName 表名称 * @return 字段配置信息 */ - @Select("SELECT * FROM `gen_field_config` WHERE `table_name` = #{tableName}") + @Select("SELECT * FROM gen_field_config WHERE table_name = #{tableName}") List<FieldConfigDO> selectListByTableName(@Param("tableName") String tableName); }