upd: 编码规范

This commit is contained in:
2025-03-25 19:01:35 +08:00
parent aebaebe582
commit 93831d9c3d
12 changed files with 93 additions and 98 deletions
@@ -14,13 +14,9 @@
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
</resultMap> </resultMap>
<sql id="BaseResultMap">
dept_id, name, pid, sub_count, create_time, update_time, create_by, update_by, enabled, dept_sort
</sql>
<select id="findAll" resultMap="BaseResultMap"> <select id="findAll" resultMap="BaseResultMap">
select select
<include refid="BaseResultMap"/> dept_id, name, pid, sub_count, create_time, update_time, create_by, update_by, enabled, dept_sort
from sys_dept from sys_dept
<where> <where>
<if test="criteria.ids != null and criteria.ids.size() > 0"> <if test="criteria.ids != null and criteria.ids.size() > 0">
@@ -50,14 +46,14 @@
<select id="findByPid" resultMap="BaseResultMap"> <select id="findByPid" resultMap="BaseResultMap">
select select
<include refid="BaseResultMap"/> dept_id, name, pid, sub_count, create_time, update_time, create_by, update_by, enabled, dept_sort
from sys_dept from sys_dept
where pid = #{pid} where pid = #{pid}
</select> </select>
<select id="findByPidIsNull" resultMap="BaseResultMap"> <select id="findByPidIsNull" resultMap="BaseResultMap">
select select
<include refid="BaseResultMap"/> dept_id, name, pid, sub_count, create_time, update_time, create_by, update_by, enabled, dept_sort
from sys_dept from sys_dept
where pid is null where pid is null
</select> </select>
@@ -17,14 +17,11 @@
</association> </association>
</resultMap> </resultMap>
<sql id="Base_Column_List">
dd.id, dd.label, dd.`value`, dd.`dict_sort`, dd.create_by, dd.update_by, dd.create_time, dd.update_time,
d.id as dict_id, d.name
</sql>
<select id="findAll" resultMap="BaseResultMap"> <select id="findAll" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> dd.id, dd.label, dd.`value`, dd.`dict_sort`, dd.create_by, dd.update_by, dd.create_time, dd.update_time,
d.id as dict_id, d.name
from sys_dict_detail dd, sys_dict d from sys_dict_detail dd, sys_dict d
where dd.dict_id = d.id where dd.dict_id = d.id
<if test="criteria.dictName != null and criteria.dictName != ''"> <if test="criteria.dictName != null and criteria.dictName != ''">
@@ -38,7 +35,8 @@
<select id="findByDictName" resultMap="BaseResultMap"> <select id="findByDictName" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> dd.id, dd.label, dd.`value`, dd.`dict_sort`, dd.create_by, dd.update_by, dd.create_time, dd.update_time,
d.id as dict_id, d.name
from sys_dict_detail dd, sys_dict d from sys_dict_detail dd, sys_dict d
where dd.dict_id = d.id where dd.dict_id = d.id
<if test="name != null and name != ''"> <if test="name != null and name != ''">
@@ -22,13 +22,9 @@
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
</resultMap> </resultMap>
<sql id="Base_Column_List">
menu_id, title, name, menu_sort, component, path, type, permission, icon, cache, hidden, pid, sub_count, i_frame, create_by, update_by, create_time, update_time
</sql>
<select id="findAll" resultMap="BaseResultMap"> <select id="findAll" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> menu_id, title, name, menu_sort, component, path, type, permission, icon, cache, hidden, pid, sub_count, i_frame, create_by, update_by, create_time, update_time
from sys_menu from sys_menu
<where> <where>
<if test="criteria.blurry != null and criteria.blurry != ''"> <if test="criteria.blurry != null and criteria.blurry != ''">
@@ -63,7 +59,7 @@
<select id="findByPidOrderByMenuSort" resultMap="BaseResultMap"> <select id="findByPidOrderByMenuSort" resultMap="BaseResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> menu_id, title, name, menu_sort, component, path, type, permission, icon, cache, hidden, pid, sub_count, i_frame, create_by, update_by, create_time, update_time
from sys_menu from sys_menu
WHERE pid = #{pid} WHERE pid = #{pid}
ORDER BY menu_sort ORDER BY menu_sort
@@ -71,7 +67,7 @@
<select id="findByPidIsNullOrderByMenuSort" resultMap="BaseResultMap"> <select id="findByPidIsNullOrderByMenuSort" resultMap="BaseResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> menu_id, title, name, menu_sort, component, path, type, permission, icon, cache, hidden, pid, sub_count, i_frame, create_by, update_by, create_time, update_time
from sys_menu from sys_menu
where pid is null where pid is null
order by menu_sort order by menu_sort
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.odboy.modules.system.mapper.RoleDeptMapper"> <mapper namespace="cn.odboy.modules.system.mapper.RoleDeptMapper">
<insert id="insertData"> <insert id="insertData">
insert into sys_roles_depts (role_id, dept_id) insert into sys_roles_depts (role_id, dept_id)
values values
@@ -22,21 +22,22 @@
</collection> </collection>
</resultMap> </resultMap>
<sql id="Base_Column_List">
<select id="queryAll" resultType="cn.odboy.model.system.domain.Role">
select role_id as id, name, level
from sys_role order by level
</select>
<select id="findAll" resultMap="BaseResultMap">
select role.*,
dept.dept_id as dept_id, dept.name as dept_name,
menu.menu_id as menu_id, menu.title as menu_title, menu.permission as menu_permission
from (
select
role.role_id as role_role_id, role.name as role_name, role.data_scope as role_data_scope, role.role_id as role_role_id, role.name as role_name, role.data_scope as role_data_scope,
role.level as role_level, role.description as role_description, role.create_by as role_create_by, role.level as role_level, role.description as role_description, role.create_by as role_create_by,
role.update_by as role_update_by, role.create_time as role_create_time, role.update_time as role_update_time role.update_by as role_update_by, role.create_time as role_create_time, role.update_time as role_update_time
</sql> from sys_role role
<sql id="Menu_Column_List">
menu.menu_id as menu_id, menu.title as menu_title, menu.permission as menu_permission
</sql>
<sql id="Dept_Column_List">
dept.dept_id as dept_id, dept.name as dept_name
</sql>
<sql id="Where_sql">
<where> <where>
<if test="criteria.blurry != null and criteria.blurry != ''"> <if test="criteria.blurry != null and criteria.blurry != ''">
and ( and (
@@ -48,22 +49,6 @@
and role.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]} and role.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
</if> </if>
</where> </where>
</sql>
<select id="queryAll" resultType="cn.odboy.model.system.domain.Role">
select role_id as id, name, level
from sys_role order by level
</select>
<select id="findAll" resultMap="BaseResultMap">
select role.*,
<include refid="Dept_Column_List"/>,
<include refid="Menu_Column_List"/>
from (
select
<include refid="Base_Column_List"/>
from sys_role role
<include refid="Where_sql"/>
order by role.level order by role.level
<if test="criteria.offset != null"> <if test="criteria.offset != null">
limit #{criteria.offset}, #{criteria.size} limit #{criteria.offset}, #{criteria.size}
@@ -79,7 +64,17 @@
<select id="countAll" resultType="java.lang.Long"> <select id="countAll" resultType="java.lang.Long">
select count(*) select count(*)
from sys_role role from sys_role role
<include refid="Where_sql"/> <where>
<if test="criteria.blurry != null and criteria.blurry != ''">
and (
role.name like concat('%', #{criteria.blurry}, '%')
or role.description like concat('%', #{criteria.blurry}, '%')
)
</if>
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
and role.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
</if>
</where>
</select> </select>
<select id="findByName" resultType="cn.odboy.model.system.domain.Role"> <select id="findByName" resultType="cn.odboy.model.system.domain.Role">
@@ -89,9 +84,11 @@
<select id="findById" resultMap="BaseResultMap"> <select id="findById" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/>, role.role_id as role_role_id, role.name as role_name, role.data_scope as role_data_scope,
<include refid="Dept_Column_List"/>, role.level as role_level, role.description as role_description, role.create_by as role_create_by,
<include refid="Menu_Column_List"/> role.update_by as role_update_by, role.create_time as role_create_time, role.update_time as role_update_time,
dept.dept_id as dept_id, dept.name as dept_name,
menu.menu_id as menu_id, menu.title as menu_title, menu.permission as menu_permission
from sys_role role from sys_role role
left join sys_roles_menus srm on role.role_id = srm.role_id left join sys_roles_menus srm on role.role_id = srm.role_id
left join sys_menu menu on menu.menu_id = srm.menu_id left join sys_menu menu on menu.menu_id = srm.menu_id
@@ -102,9 +99,11 @@
<select id="findByUserId" resultMap="BaseResultMap"> <select id="findByUserId" resultMap="BaseResultMap">
SELECT SELECT
<include refid="Base_Column_List"/>, role.role_id as role_role_id, role.name as role_name, role.data_scope as role_data_scope,
<include refid="Dept_Column_List"/>, role.level as role_level, role.description as role_description, role.create_by as role_create_by,
<include refid="Menu_Column_List"/> role.update_by as role_update_by, role.create_time as role_create_time, role.update_time as role_update_time,
dept.dept_id as dept_id, dept.name as dept_name,
menu.menu_id as menu_id, menu.title as menu_title, menu.permission as menu_permission
from sys_role role from sys_role role
left join sys_roles_menus srm on role.role_id = srm.role_id left join sys_roles_menus srm on role.role_id = srm.role_id
left join sys_menu menu on menu.menu_id = srm.menu_id left join sys_menu menu on menu.menu_id = srm.menu_id
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.odboy.modules.system.mapper.RoleMenuMapper"> <mapper namespace="cn.odboy.modules.system.mapper.RoleMenuMapper">
<insert id="insertData"> <insert id="insertData">
insert into sys_roles_menus (role_id, menu_id) insert into sys_roles_menus (role_id, menu_id)
values values
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.odboy.modules.system.mapper.UserJobMapper"> <mapper namespace="cn.odboy.modules.system.mapper.UserJobMapper">
<insert id="insertData"> <insert id="insertData">
insert into sys_users_jobs (user_id, job_id) insert into sys_users_jobs (user_id, job_id)
values values
@@ -35,24 +35,20 @@
</collection> </collection>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <select id="findAll" resultMap="BaseResultMap">
select u.*,
j.id as job_id, j.name as job_name,
r.role_id as role_id, r.name as role_name, r.level as role_level, r.data_scope as role_data_scope
from (
select
u.user_id as user_user_id, u.dept_id as user_dept_id, u.username as user_username, u.user_id as user_user_id, u.dept_id as user_dept_id, u.username as user_username,
u.nick_name as user_nick_name, u.email as user_email, u.phone as user_phone, u.nick_name as user_nick_name, u.email as user_email, u.phone as user_phone,
u.gender as user_gender, u.avatar_name as user_avatar_name, u.avatar_path as user_avatar_path, u.gender as user_gender, u.avatar_name as user_avatar_name, u.avatar_path as user_avatar_path,
u.enabled as user_enabled, u.pwd_reset_time as user_pwd_reset_time, u.create_by as user_create_by, u.enabled as user_enabled, u.pwd_reset_time as user_pwd_reset_time, u.create_by as user_create_by,
u.update_by as user_update_by, u.create_time as user_create_time, u.update_time as user_update_time, u.update_by as user_update_by, u.create_time as user_create_time, u.update_time as user_update_time,
d.dept_id as dept_id, d.name as dept_name d.dept_id as dept_id, d.name as dept_name
</sql> from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
<sql id="Job_Column_List">
j.job_id as job_id, j.name as job_name
</sql>
<sql id="Role_Column_List">
r.role_id as role_id, r.name as role_name, r.level as role_level, r.data_scope as role_data_scope
</sql>
<sql id="Whrer_Sql">
<where> <where>
<if test="criteria.id != null"> <if test="criteria.id != null">
and u.user_id = #{criteria.id} and u.user_id = #{criteria.id}
@@ -77,25 +73,13 @@
and u.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]} and u.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
</if> </if>
</where> </where>
</sql>
<select id="findAll" resultMap="BaseResultMap">
select u.*,
<include refid="Job_Column_List"/>,
<include refid="Role_Column_List"/>
from (
select
<include refid="Base_Column_List"/>
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
<include refid="Whrer_Sql"/>
order by u.user_id desc order by u.user_id desc
<if test="criteria.offset != null"> <if test="criteria.offset != null">
limit #{criteria.offset}, #{criteria.size} limit #{criteria.offset}, #{criteria.size}
</if> </if>
) u ) u
left join sys_users_jobs suj on u.user_user_id = suj.user_id left join sys_users_jobs suj on u.user_user_id = suj.user_id
left join sys_job j on suj.job_id = j.job_id left join sys_job j on suj.job_id = j.id
left join sys_users_roles sur on u.user_user_id = sur.user_id left join sys_users_roles sur on u.user_user_id = sur.user_id
left join sys_role r on sur.role_id = r.role_id left join sys_role r on sur.role_id = r.role_id
order by u.user_user_id desc order by u.user_user_id desc
@@ -104,13 +88,41 @@
<select id="countAll" resultType="java.lang.Long"> <select id="countAll" resultType="java.lang.Long">
select count(*) select count(*)
from sys_user u from sys_user u
<include refid="Whrer_Sql"/> <where>
<if test="criteria.id != null">
and u.user_id = #{criteria.id}
</if>
<if test="criteria.enabled != null">
and u.enabled = #{criteria.enabled}
</if>
<if test="criteria.deptIds != null and criteria.deptIds.size() != 0">
and u.dept_id in
<foreach collection="criteria.deptIds" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
<if test="criteria.blurry != null and criteria.blurry != ''">
and (
u.username like concat('%', #{criteria.blurry}, '%')
or u.nick_name like concat('%', #{criteria.blurry}, '%')
or u.email like concat('%', #{criteria.blurry}, '%')
)
</if>
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
and u.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
</if>
</where>
</select> </select>
<select id="findByUsername" resultMap="BaseResultMap"> <select id="findByUsername" resultMap="BaseResultMap">
select select
u.password user_password, u.is_admin user_is_admin, u.password user_password, u.is_admin user_is_admin,
<include refid="Base_Column_List"/> u.user_id as user_user_id, u.dept_id as user_dept_id, u.username as user_username,
u.nick_name as user_nick_name, u.email as user_email, u.phone as user_phone,
u.gender as user_gender, u.avatar_name as user_avatar_name, u.avatar_path as user_avatar_path,
u.enabled as user_enabled, u.pwd_reset_time as user_pwd_reset_time, u.create_by as user_create_by,
u.update_by as user_update_by, u.create_time as user_create_time, u.update_time as user_update_time,
d.dept_id as dept_id, d.name as dept_name
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
where u.username = #{username} where u.username = #{username}
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.odboy.modules.system.mapper.UserRoleMapper"> <mapper namespace="cn.odboy.modules.system.mapper.UserRoleMapper">
<insert id="insertData"> <insert id="insertData">
insert into sys_users_roles (user_id, role_id) insert into sys_users_roles (user_id, role_id)
values values
@@ -12,8 +12,6 @@ import java.util.List;
@Mapper @Mapper
public interface LocalStorageMapper extends BaseMapper<LocalStorage> { public interface LocalStorageMapper extends BaseMapper<LocalStorage> {
IPage<LocalStorage> selectByPage(@Param("criteria") LocalStorageQueryCriteria criteria, Page<Object> page);
IPage<LocalStorage> findAll(@Param("criteria") LocalStorageQueryCriteria criteria, Page<Object> page); List<LocalStorage> selectByPage(@Param("criteria") LocalStorageQueryCriteria criteria);
List<LocalStorage> findAll(@Param("criteria") LocalStorageQueryCriteria criteria);
} }
@@ -36,12 +36,12 @@ public class LocalStorageServiceImpl extends ServiceImpl<LocalStorageMapper, Loc
@Override @Override
public PageResult<LocalStorage> queryAll(LocalStorageQueryCriteria criteria, Page<Object> page) { public PageResult<LocalStorage> queryAll(LocalStorageQueryCriteria criteria, Page<Object> page) {
return PageUtil.toPage(localStorageMapper.findAll(criteria, page)); return PageUtil.toPage(localStorageMapper.selectByPage(criteria, page));
} }
@Override @Override
public List<LocalStorage> queryAll(LocalStorageQueryCriteria criteria) { public List<LocalStorage> queryAll(LocalStorageQueryCriteria criteria) {
return localStorageMapper.findAll(criteria); return localStorageMapper.selectByPage(criteria);
} }
@Override @Override
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.odboy.mapper.LocalStorageMapper"> <mapper namespace="cn.odboy.mapper.LocalStorageMapper">
<select id="findAll" resultType="cn.odboy.model.tools.domain.LocalStorage"> <select id="selectByPage" resultType="cn.odboy.model.tools.domain.LocalStorage">
select select
* *
from tool_local_storage from tool_local_storage