1.MySQL数据库>SQL语句>第10条: 【推荐】SQL 语句中表的别名前加 as,并且以 t1、t2、t3、...的顺序依次命名。 说明: 1)别名可以是表的简称,或者是依照表在 SQL 语句中出现的顺序,以 t1、t2、t3 的方式命名。 2)别名前加 as 使别名更容易识别。 正例:select t1.name from first_table as t1 , second_table as t2 where t1.id = t2.id 个人理解:使用 t1、t2、t3... 的表别名命名方式,在很多类似业务查询的场景会更方便复用;使用 AS 而不是 as 更容易阅读。
12 lines
517 B
XML
12 lines
517 B
XML
<?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="top.charles7c.cnadmin.system.mapper.RoleMenuMapper">
|
|
<select id="selectMenuIdByRoleIds" resultType="java.lang.Long">
|
|
SELECT `menu_id`
|
|
FROM `sys_role_menu`
|
|
WHERE `role_id` IN
|
|
<foreach collection="list" item="roleId" open="(" close=")" separator=",">
|
|
#{roleId}
|
|
</foreach>
|
|
</select>
|
|
</mapper> |