Commit ab0c0b6c authored by luojun's avatar luojun

mapper文件添加

parent 78c9560e
Pipeline #6322 canceled with stages
......@@ -15,7 +15,7 @@
<jjwt.version>0.11.1</jjwt.version>
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
<jna.version>5.5.0</jna.version>
<druid.version>1.2.14</druid.version>
<druid.version>1.1.22</druid.version>
<mybatis-plus.version>3.3.0</mybatis-plus.version>
</properties>
......
<?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="admin.modules.system.service.mapper.DeptMapper">
<resultMap id="Dept" type="admin.modules.system.domain.Dept">
<id property="id" column="dept_id"/>
<result property="updatedBy" column="update_by" />
<collection property="roles" column="dept_id" select="selectRole">
</collection>
</resultMap>
<select id="selectRole" resultType="admin.modules.system.domain.Role">
select a.* from sys_role a left join sys_roles_depts b on a.role_id = b.role_id where b.dept_id = #{dept_id}
</select>
<update id="updateSubCntById">
update sys_dept set sub_count = #{count} where dept_id = #{id}
</update>
<select id="findByRoleId" resultType="admin.modules.system.domain.Dept">
SELECT d.dept_id as id, d.* FROM sys_dept d LEFT OUTER JOIN sys_roles_depts rd ON d.dept_id=rd.dept_id WHERE rd.role_id=#{roleId}
</select>
<select id="findByPid" resultMap="Dept">
select * from sys_dept where pid = #{id}
</select>
<select id="findByPidIsNull" resultMap="Dept">
select * from sys_dept where pid is null
</select>
<select id="countByPid" resultType="java.lang.Integer">
select count(1) from sys_dept where pid = #{pid}
</select>
</mapper>
<?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="admin.modules.system.service.mapper.DictDetailMapper">
<select id="findByDictName" resultType="admin.modules.system.domain.DictDetail">
select * from sys_dict_detail a where b.name = #{name}
</select>
</mapper>
<?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="admin.modules.system.service.mapper.DictMapper">
<resultMap id="Dict" type="admin.modules.system.domain.Dict">
<id property="id" column="dept_id"/>
<result property="name" column="name" />
<result property="description" column="description" />
<collection property="dictDetails" ofType="admin.modules.system.domain.DictDetail">
<id property="id" column="detail_id"/>
<result property="dictId" column="dict_id" />
<result property="label" column="label" />
<result property="value" column="value" />
<result property="dictSort" column="dict_sort" />
</collection>
</resultMap>
<delete id="deleteByIdIn">
delete from sys_dict where dict_id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="findByIdIn" resultMap="Dict">
select * from sys_dict a left join sys_dict_detail b on a.dict_id = b.dict_id where a.dict_id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
<?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="admin.modules.system.service.mapper.MenuMapper">
<resultMap id="resultMap" type="admin.modules.system.domain.Menu">
<id property="id" column="menu_id" />
<result property="updatedBy" column="update_by" />
</resultMap>
<update id="addQuick">
update sys_menu set nav_quick=1 where menu_id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updateSubCntById">
update sys_menu set sub_count = #{count} where menu_id = #{menuId}
</update>
<update id="delQuick">
update sys_menu set nav_quick=0
</update>
<select id="findByRoleIdsAndTypeNot" resultMap="resultMap">
SELECT m.* FROM sys_menu m, sys_roles_menus r
WHERE m.menu_id = r.menu_id AND r.role_id IN
<foreach collection="roleIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
AND type != #{type} order by m.menu_sort asc
</select>
<select id="findByTitle" resultMap="resultMap">
select * from sys_menu a where a.title = #{title}
</select>
<select id="findByComponentName" resultMap="resultMap">
select * from sys_menu a where a.name = #{name}
</select>
<select id="findByPid" resultMap="resultMap">
select * from sys_menu a where a.pid = #{pid}
</select>
<select id="findByPidIsNull" resultMap="resultMap">
select * from sys_menu where pid is null
</select>
<select id="countByPid" resultType="java.lang.Integer">
select count(1) from sys_menu where pid = #{id}
</select>
<select id="findMenuByRoleId" resultMap="resultMap">
SELECT b.* FROM sys_roles_menus a, sys_menu b WHERE a.menu_id = b.menu_id AND a.role_id = #{roleId}
</select>
</mapper>
<?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="admin.modules.parking.service.mapper.ParkingInInfoMapper">
<select id="findByParkingInSerial" resultType="admin.modules.parking.domain.ParkingInInfo">
select * from parking_in_info where parking_in_serial = #{parkingInSerial}
</select>
<select id="findByParkingInNo" resultType="admin.modules.parking.domain.ParkingInInfo">
select * from parking_in_info where parking_in_no = #{parkingInNo}
</select>
<select id="findByParentChannel" resultType="admin.modules.parking.domain.ParkingInInfo">
select * from parking_in_info where parent_park=#{parent} and channel_id=#{channelId} LIMIT 1
</select>
<select id="parkingCount" resultType="java.lang.Integer">
select count(0) from parking_in_info
</select>
<select id="findById" resultType="admin.modules.parking.domain.ParkingInInfo">
select * from parking_in_info where parking_in_id =#{parkingInId}
</select>
<select id="findAll" resultType="admin.modules.parking.domain.ParkingInInfo">
select * from parking_in_info
</select>
</mapper>
<?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="admin.modules.parking.service.mapper.ParkingInfoMapper">
<select id="findByJobId" resultType="admin.modules.parking.domain.ParkingInfo">
SELECT * FROM `parking_info` WHERE `job_id` = #{jobId} order by parking_serial
</select>
<select id="getRoadParkingCount" resultType="java.util.Map">
SELECT count(0) as parkingNum, `road_id` as roadId
FROM `parking_info` WHERE `road_id` in
<foreach collection="roadList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY `road_id`
</select>
<select id="getOnlineParkingNum" resultType="java.lang.Integer">
SELECT CASE WHEN ISNULL(count(0)) THEN 0 ELSE count(0) END as num from `parking_info` where 1=1
<if test="status!=null">
and status = #{status}
</if>
</select>
<select id="getParkingUseNum" resultType="java.util.Map">
select `road_id`,`status`,
CASE WHEN ISNULL(count(0)) THEN 0 ELSE count(0) END as num
from `parking_info` GROUP BY `road_id` , `status`
</select>
<select id="findByIdIn" resultType="admin.modules.parking.domain.ParkingInfo">
SELECT * FROM `parking_info` WHERE `parking_id` in
<foreach collection="idList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
order by parking_serial
</select>
<select id="findByParkingSerial" resultType="admin.modules.parking.domain.ParkingInfo">
select * from `parking_info` where parking_serial = #{parkingSerial}
</select>
<select id="findByRoadId" resultType="admin.modules.parking.domain.ParkingInfo">
select * from `parking_info` where road_id = #{roadId}
</select>
<update id="modifyBatchJobMsg">
update parking_info set job_id=null,job_name = null where parking_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="findRemainCountByRoadId" resultType="java.lang.Long">
select count(*) from `parking_info` where road_id = #{roadId} and status =2
</select>
</mapper>
<?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="admin.modules.system.service.mapper.RoleMapper">
<resultMap id="resultMap" type="admin.modules.system.domain.Role">
<id property="id" column="role_id" />
<result property="updatedBy" column="update_by" />
<collection property="menus" column="role_id" select="selectMenus">
</collection>
</resultMap>
<delete id="deleteAllByIdIn">
delete from sys_role where role_id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="untiedMenu">
delete from sys_roles_menus where menu_id = #{id}
</delete>
<!-- select a.menu_id as id,a.permission as permission,#{role_id} as path from sys_menu a ,sys_roles_menus b where b.role_id IN (1,5) and b.menu_id=a.menu_id;-->
<select id="selectMenus" resultType="admin.modules.system.domain.Menu">
select a.menu_id as id,a.permission as permission from sys_menu a ,sys_roles_menus b where b.role_id=#{role_id} and b.menu_id=a.menu_id;
</select>
<select id="findByName" resultMap="resultMap">
select * from sys_role where name = #{name}
</select>
<select id="findByUserId" resultMap="resultMap">
SELECT r.* FROM sys_role r, sys_users_roles u WHERE r.role_id = u.role_id AND u.user_id = #{id}
</select>
<select id="countByDepts" resultType="java.lang.Integer">
select count(1) from sys_role r, sys_roles_depts d where r.role_id = d.role_id and d.dept_id in
<foreach collection="deptIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="findInMenuId" resultMap="resultMap">
SELECT r.* FROM sys_role r, sys_roles_menus m WHERE r.role_id = m.role_id AND m.menu_id in
<foreach collection="menuIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
<?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="admin.modules.system.service.mapper.UserMapper">
<update id="updatePass">
update sys_user set password = #{pass} , pwd_reset_time = #{lastPasswordResetTime} where username = #{username}
</update>
<update id="updateEmail">
update sys_user set email = #{email} where username = #{username}
</update>
<update id="updateUserAmount">
update sys_user set amount = #{amount} where user_id = #{userId}
</update>
<delete id="deleteAllByIdIn">
delete from sys_user where user_id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<resultMap id="User" type="admin.modules.system.domain.User">
<id property="id" column="user_id"/>
<result property="deptId" column="dept_id"/>
<association property="dept" column="dept_id" select="selectDept"/>
<collection property="roles" column="user_id" select="selectRole">
</collection>
<collection property="jobs" column="user_id" select="selectJob">
</collection>
</resultMap>
<select id="findByUsername" resultMap="User">
select * from sys_user where username = #{username}
</select>
<select id="selectDept" resultType="admin.modules.system.domain.Dept">
select a.dept_id as id,a.* from sys_dept a where a.dept_id = #{dept_id}
</select>
<select id="selectRole" resultType="admin.modules.system.domain.Role">
select a.role_id as id,a.* from sys_role a left join sys_users_roles b on a.role_id = b.role_id where b.user_id = #{user_id}
</select>
<select id="selectJob" resultType="admin.modules.system.domain.Job">
select a.job_id as id,a.* from sys_job a left join sys_users_jobs b on a.job_id = b.job_id where b.user_id = #{user_id}
</select>
<select id="findByEmail" resultMap="User">
select user_id as id,u.* from sys_user u where u.email = #{email}
</select>
<select id="findByPhone" resultMap="User">
select user_id as id,u.* from sys_user u where u.phone = #{phone}
</select>
<select id="findByJobId" resultType="admin.modules.system.domain.User">
select user_id as id,u.* from sys_user u where u.job_id = #{jobId} and u.is_business=1 order by u.update_time desc limit 1
</select>
<select id="findListByJobId" resultType="admin.modules.system.domain.User">
select user_id as id,u.* from sys_user u where u.job_id = #{jobId} and u.is_business=1 order by u.update_time desc
</select>
<select id="findUserByIdNoAuth" resultType="admin.modules.system.domain.User">
select user_id as id,u.* from sys_user u where u.user_id = #{userId} order by u.update_time desc limit 1
</select>
<select id="findByRoleId" resultType="admin.modules.system.domain.User">
SELECT u.user_id as id, u.* FROM sys_user u, sys_users_roles r WHERE u.user_id = r.user_id AND r.role_id = #{roleId}
</select>
<select id="findByDeptRoleId" resultType="admin.modules.system.domain.User">
SELECT u.user_id as id, u.* FROM sys_user u, sys_users_roles r, sys_roles_depts d
WHERE u.user_id = r.user_id AND r.role_id = d.role_id AND r.role_id = #{id} group by u.user_id
</select>
<select id="findByMenuId" resultType="admin.modules.system.domain.User">
SELECT u.user_id as id, u.* FROM sys_user u, sys_users_roles ur, sys_roles_menus rm
WHERE u.user_id = ur.user_id AND ur.role_id = rm.role_id AND rm.menu_id = #{id} group by u.user_id
</select>
<select id="countByJobs" resultType="java.lang.Integer">
SELECT count(1) FROM sys_user u, sys_users_jobs j WHERE u.user_id = j.user_id AND j.job_id IN
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="countByDepts" resultType="java.lang.Integer">
SELECT count(1) FROM sys_user u WHERE u.dept_id IN
<foreach collection="deptIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="countByRoles" resultType="java.lang.Integer">
SELECT count(1) FROM sys_user u, sys_users_roles r WHERE u.user_id = r.user_id AND r.role_id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="allUsers" resultType="admin.modules.system.domain.User">
SELECT user_id as id,* FROM sys_user where enabled=1
</select>
<select id="allUserData" resultType="java.util.Map">
SELECT user_id as userId,username as userName,is_business as isBusiness,phone
FROM sys_user where enabled=1
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment