mybaties查询!!!你就说灵不灵活吧

你就说灵不灵活吧

<?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="com.ruoyi.system.mapper.SysDeptMapper"><resultMap type="SysDept" id="SysDeptResult"><id     property="deptId"     column="dept_id"     /><result property="parentId"   column="parent_id"   /><result property="ancestors"  column="ancestors"   /><result property="deptName"   column="dept_name"   /><result property="orderNum"   column="order_num"   /><result property="leader"     column="leader"      /><result property="phone"      column="phone"       /><result property="email"      column="email"       /><result property="status"     column="status"      /><result property="delFlag"    column="del_flag"    /><result property="parentName" column="parent_name" /><result property="createBy"   column="create_by"   /><result property="createTime" column="create_time" /><result property="updateBy"   column="update_by"   /><result property="updateTime" column="update_time" /></resultMap><sql id="selectDeptVo">select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_timefrom sys_dept d</sql><select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult"><include refid="selectDeptVo"/>where d.del_flag = '0'<if test="deptId != null and deptId != 0">AND dept_id = #{deptId}</if><if test="parentId != null and parentId != 0">AND parent_id = #{parentId}</if><if test="deptName != null and deptName != ''">AND dept_name like concat('%', #{deptName}, '%')</if><if test="status != null and status != ''">AND status = #{status}</if><!-- 数据范围过滤 -->${params.dataScope}order by d.parent_id, d.order_num</select><select id="selectDeptListByRoleId" resultType="Long">select d.dept_idfrom sys_dept dleft join sys_role_dept rd on d.dept_id = rd.dept_idwhere rd.role_id = #{roleId}<if test="deptCheckStrictly">and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})</if>order by d.parent_id, d.order_num</select><select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,(select dept_name from sys_dept where dept_id = d.parent_id) parent_namefrom sys_dept dwhere d.dept_id = #{deptId}</select><select id="checkDeptExistUser" parameterType="Long" resultType="int">select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'</select><select id="hasChildByDeptId" parameterType="Long" resultType="int">select count(1) from sys_deptwhere del_flag = '0' and parent_id = #{deptId} limit 1</select><select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">select * from sys_dept where find_in_set(#{deptId}, ancestors)</select><select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)</select><select id="checkDeptNameUnique" resultMap="SysDeptResult"><include refid="selectDeptVo"/>where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1</select><insert id="insertDept" parameterType="SysDept">insert into sys_dept(<if test="deptId != null and deptId != 0">dept_id,</if><if test="parentId != null and parentId != 0">parent_id,</if><if test="deptName != null and deptName != ''">dept_name,</if><if test="ancestors != null and ancestors != ''">ancestors,</if><if test="orderNum != null">order_num,</if><if test="leader != null and leader != ''">leader,</if><if test="phone != null and phone != ''">phone,</if><if test="email != null and email != ''">email,</if><if test="status != null">status,</if><if test="createBy != null and createBy != ''">create_by,</if>create_time)values(<if test="deptId != null and deptId != 0">#{deptId},</if><if test="parentId != null and parentId != 0">#{parentId},</if><if test="deptName != null and deptName != ''">#{deptName},</if><if test="ancestors != null and ancestors != ''">#{ancestors},</if><if test="orderNum != null">#{orderNum},</if><if test="leader != null and leader != ''">#{leader},</if><if test="phone != null and phone != ''">#{phone},</if><if test="email != null and email != ''">#{email},</if><if test="status != null">#{status},</if><if test="createBy != null and createBy != ''">#{createBy},</if>sysdate())</insert><update id="updateDept" parameterType="SysDept">update sys_dept<set><if test="parentId != null and parentId != 0">parent_id = #{parentId},</if><if test="deptName != null and deptName != ''">dept_name = #{deptName},</if><if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if><if test="orderNum != null">order_num = #{orderNum},</if><if test="leader != null">leader = #{leader},</if><if test="phone != null">phone = #{phone},</if><if test="email != null">email = #{email},</if><if test="status != null and status != ''">status = #{status},</if><if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>update_time = sysdate()</set>where dept_id = #{deptId}</update><update id="updateDeptChildren" parameterType="java.util.List">update sys_dept set ancestors =<foreach collection="depts" item="item" index="index"separator=" " open="case dept_id" close="end">when #{item.deptId} then #{item.ancestors}</foreach>where dept_id in<foreach collection="depts" item="item" index="index"separator="," open="(" close=")">#{item.deptId}</foreach></update><update id="updateDeptStatusNormal" parameterType="Long">update sys_dept set status = '0' where dept_id in<foreach collection="array" item="deptId" open="(" separator="," close=")">#{deptId}</foreach></update><delete id="deleteDeptById" parameterType="Long">update sys_dept set del_flag = '2' where dept_id = #{deptId}</delete></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="com.ruoyi.system.mapper.SysRoleMapper"><resultMap type="SysRole" id="SysRoleResult"><id     property="roleId"             column="role_id"               /><result property="roleName"           column="role_name"             /><result property="roleKey"            column="role_key"              /><result property="roleSort"           column="role_sort"             /><result property="dataScope"          column="data_scope"            /><result property="menuCheckStrictly"  column="menu_check_strictly"   /><result property="deptCheckStrictly"  column="dept_check_strictly"   /><result property="status"             column="status"                /><result property="delFlag"            column="del_flag"              /><result property="createBy"           column="create_by"             /><result property="createTime"         column="create_time"           /><result property="updateBy"           column="update_by"             /><result property="updateTime"         column="update_time"           /><result property="remark"             column="remark"                /></resultMap>// 多表查询<sql id="selectRoleVo">select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,r.status, r.del_flag, r.create_time, r.remark from sys_role rleft join sys_user_role ur on ur.role_id = r.role_idleft join sys_user u on u.user_id = ur.user_idleft join sys_dept d on u.dept_id = d.dept_id</sql><select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"><include refid="selectRoleVo"/>where r.del_flag = '0'<if test="roleId != null and roleId != 0">AND r.role_id = #{roleId}</if><if test="roleName != null and roleName != ''">AND r.role_name like concat('%', #{roleName}, '%')</if><if test="status != null and status != ''">AND r.status = #{status}</if><if test="roleKey != null and roleKey != ''">AND r.role_key like concat('%', #{roleKey}, '%')</if><if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')</if><if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')</if><!-- 数据范围过滤 -->${params.dataScope}order by r.role_sort</select><select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult"><include refid="selectRoleVo"/>WHERE r.del_flag = '0' and ur.user_id = #{userId}</select><select id="selectRoleAll" resultMap="SysRoleResult"><include refid="selectRoleVo"/></select><select id="selectRoleListByUserId" parameterType="Long" resultType="Long">select r.role_idfrom sys_role rleft join sys_user_role ur on ur.role_id = r.role_idleft join sys_user u on u.user_id = ur.user_idwhere u.user_id = #{userId}</select><select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult"><include refid="selectRoleVo"/>where r.role_id = #{roleId}</select><select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult"><include refid="selectRoleVo"/>WHERE r.del_flag = '0' and u.user_name = #{userName}</select><select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult"><include refid="selectRoleVo"/>where r.role_name=#{roleName} and r.del_flag = '0' limit 1</select><select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult"><include refid="selectRoleVo"/>where r.role_key=#{roleKey} and r.del_flag = '0' limit 1</select><insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">insert into sys_role(<if test="roleId != null and roleId != 0">role_id,</if><if test="roleName != null and roleName != ''">role_name,</if><if test="roleKey != null and roleKey != ''">role_key,</if><if test="roleSort != null">role_sort,</if><if test="dataScope != null and dataScope != ''">data_scope,</if><if test="menuCheckStrictly != null">menu_check_strictly,</if><if test="deptCheckStrictly != null">dept_check_strictly,</if><if test="status != null and status != ''">status,</if><if test="remark != null and remark != ''">remark,</if><if test="createBy != null and createBy != ''">create_by,</if>create_time)values(<if test="roleId != null and roleId != 0">#{roleId},</if><if test="roleName != null and roleName != ''">#{roleName},</if><if test="roleKey != null and roleKey != ''">#{roleKey},</if><if test="roleSort != null">#{roleSort},</if><if test="dataScope != null and dataScope != ''">#{dataScope},</if><if test="menuCheckStrictly != null">#{menuCheckStrictly},</if><if test="deptCheckStrictly != null">#{deptCheckStrictly},</if><if test="status != null and status != ''">#{status},</if><if test="remark != null and remark != ''">#{remark},</if><if test="createBy != null and createBy != ''">#{createBy},</if>sysdate())</insert><update id="updateRole" parameterType="SysRole">update sys_role<set><if test="roleName != null and roleName != ''">role_name = #{roleName},</if><if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if><if test="roleSort != null">role_sort = #{roleSort},</if><if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if><if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if><if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if><if test="status != null and status != ''">status = #{status},</if><if test="remark != null">remark = #{remark},</if><if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>update_time = sysdate()</set>where role_id = #{roleId}</update><delete id="deleteRoleById" parameterType="Long">update sys_role set del_flag = '2' where role_id = #{roleId}</delete><delete id="deleteRoleByIds" parameterType="Long">update sys_role set del_flag = '2' where role_id in<foreach collection="array" item="roleId" open="(" separator="," close=")">#{roleId}</foreach> </delete></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="com.ruoyi.system.mapper.SysDictDataMapper"><resultMap type="SysDictData" id="SysDictDataResult"><id     property="dictCode"   column="dict_code"   /><result property="dictSort"   column="dict_sort"   /><result property="dictLabel"  column="dict_label"  /><result property="dictValue"  column="dict_value"  /><result property="dictType"   column="dict_type"   /><result property="cssClass"   column="css_class"   /><result property="listClass"  column="list_class"  /><result property="isDefault"  column="is_default"  /><result property="status"     column="status"      /><result property="createBy"   column="create_by"   /><result property="createTime" column="create_time" /><result property="updateBy"   column="update_by"   /><result property="updateTime" column="update_time" /></resultMap><sql id="selectDictDataVo">select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from sys_dict_data</sql><select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult"><include refid="selectDictDataVo"/><where><if test="dictType != null and dictType != ''">AND dict_type = #{dictType}</if><if test="dictLabel != null and dictLabel != ''">AND dict_label like concat('%', #{dictLabel}, '%')</if><if test="status != null and status != ''">AND status = #{status}</if></where>order by dict_sort asc</select><select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult"><include refid="selectDictDataVo"/>where status = '0' and dict_type = #{dictType} order by dict_sort asc</select><select id="selectDictLabel" resultType="String">select dict_label from sys_dict_datawhere dict_type = #{dictType} and dict_value = #{dictValue}</select><select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult"><include refid="selectDictDataVo"/>where dict_code = #{dictCode}</select><select id="countDictDataByType" resultType="Integer">select count(1) from sys_dict_data where dict_type=#{dictType}  </select><delete id="deleteDictDataById" parameterType="Long">delete from sys_dict_data where dict_code = #{dictCode}</delete><delete id="deleteDictDataByIds" parameterType="Long">delete from sys_dict_data where dict_code in<foreach collection="array" item="dictCode" open="(" separator="," close=")">#{dictCode}</foreach> </delete><update id="updateDictData" parameterType="SysDictData">update sys_dict_data<set><if test="dictSort != null">dict_sort = #{dictSort},</if><if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if><if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if><if test="dictType != null and dictType != ''">dict_type = #{dictType},</if><if test="cssClass != null">css_class = #{cssClass},</if><if test="listClass != null">list_class = #{listClass},</if><if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if><if test="status != null">status = #{status},</if><if test="remark != null">remark = #{remark},</if><if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>update_time = sysdate()</set>where dict_code = #{dictCode}</update><update id="updateDictDataType" parameterType="String">update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}</update><insert id="insertDictData" parameterType="SysDictData">insert into sys_dict_data(<if test="dictSort != null">dict_sort,</if><if test="dictLabel != null and dictLabel != ''">dict_label,</if><if test="dictValue != null and dictValue != ''">dict_value,</if><if test="dictType != null and dictType != ''">dict_type,</if><if test="cssClass != null and cssClass != ''">css_class,</if><if test="listClass != null and listClass != ''">list_class,</if><if test="isDefault != null and isDefault != ''">is_default,</if><if test="status != null">status,</if><if test="remark != null and remark != ''">remark,</if><if test="createBy != null and createBy != ''">create_by,</if>create_time)values(<if test="dictSort != null">#{dictSort},</if><if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if><if test="dictValue != null and dictValue != ''">#{dictValue},</if><if test="dictType != null and dictType != ''">#{dictType},</if><if test="cssClass != null and cssClass != ''">#{cssClass},</if><if test="listClass != null and listClass != ''">#{listClass},</if><if test="isDefault != null and isDefault != ''">#{isDefault},</if><if test="status != null">#{status},</if><if test="remark != null and remark != ''">#{remark},</if><if test="createBy != null and createBy != ''">#{createBy},</if>sysdate())</insert></mapper> 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/706743.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

浅析扩散模型与图像生成【应用篇】(二十五)——Plug-and-Play

25. Plug-and-Play: Diffusion Features for Text-Driven Image-to-Image Translation 该文提出一种文本驱动的图像转换方法&#xff0c;输入一张图像和一个目标文本描述&#xff0c;按照文本描述对输入图像进行转换&#xff0c;得到目标图像。图像转换任务其实本质上属于图像编…

web安全学习笔记(16)

记一下第27-28课的内容。Token 验证 URL跳转漏洞的类型与三种跳转形式&#xff1b;URL跳转漏洞修复 短信轰炸漏洞绕过挖掘 一、token有关知识 什么是token&#xff1f;token是用来干嘛的&#xff1f;_token是什么意思-CSDN博客 二、URL跳转漏洞 我们在靶场中&#xff0c;…

JVS物联网模拟点位:如何配置并自动生成点位数据全教程

模拟点位 功能描述 模拟点位常用于业务的调试或数据展示&#xff0c;通过配置对应点位实现自动生成点位数据的功能。 界面操作 如下图所示&#xff0c;从模拟点位菜单进入模拟点位管理界面 模拟点位新增 点击新增按钮&#xff0c;如下图所示&#xff1a; ①&#xff1a;用户…

带插画的登录页火爆一时,不过好像有点过气了,是么?

插画在B端登录页中的作用是通过增加视觉吸引力、塑造品牌形象、提升用户体验和增加可视化指引等方式&#xff0c;为用户提供一个愉悦、易用、具有个性化的登录体验。这有助于提高用户对企业或组织的认知和好感度&#xff0c;增加用户的参与度和忠诚度。 当年这种分割很火爆呀&…

前端学习第一课

AJAX 事先说明&#xff0c;这只是记录&#xff0c;并不是从零到一的教学内容&#xff0c;如果想要学习的话&#xff0c;可以跳过本文章了 ok&#xff0c;转回正题&#xff0c;正如上面所说&#xff0c;这只是记录。其实我是有一定的前端基础的&#xff0c;也做过涉及相关的开发…

【JavaEE 初阶(七)】网络原理 TCP与UDP协议

❣博主主页: 33的博客❣ ▶️文章专栏分类:JavaEE◀️ &#x1f69a;我的代码仓库: 33的代码仓库&#x1f69a; &#x1faf5;&#x1faf5;&#x1faf5;关注我带你了解更多网络知识 目录 1.前言2.应用层2.1xml2.2json 3.传输层3.1UDP协议3.2TCP协议3.2.1确认响应3.2.2超时重…

【车载开发系列】AutoSar中的Port

【车载开发系列】AutoSar中的Port 一. Port概念 AutoSAR 接口定义了 SWC 之间、BSW 模块之间以及 SWC 和 BSW 模块之间交互的信息。AutoSAR 接口通过 SWC 和/或 BSW 模块端口&#xff08;Port&#xff09;的形式实现。通过这些端口&#xff0c;SWC 和 BSW 模块之间实现了数据…

NineData云原生智能数据管理平台新功能发布|2024年4月版

基础服务 - 工作台 NineData 工作台提供了直观明了的可视化页面&#xff0c;展现了当前账户下所有任务流、资源以及热点信息&#xff0c;包含了任务流总览、资源总览、常用文档、公告、本周热文。 基础服务 - 新增数据源支持 NineData 发布了对 TiDB、Sybase、Hive、OceanBas…

Git使用(4):分支管理

一、新建分支 首先选择Git -> Branches... 然后选择 New Branch&#xff0c;输入新分支名称&#xff0c;例如dev。 可以看到右下角显示已经切换到新建的dev分支了。 push到远程仓库&#xff0c;可以看到新添加的分支。 二、切换分支与合并分支 为了演示合并分支&#xff0c…

laravel 解决composer install报错

laravel 解决报错: Please provide a valid cache path 这是因为laravel的缓存路径没有找到 laravel缓存文件路径是在 config/cache.php中设置&#xff0c;默认存在storage文件夹中 file > [driver > file,path > storage_path(framework/cache/data),], 解决&#x…

提升LED显示屏散热效能的五大策略

在现代生活中&#xff0c;LED显示屏已成为不可或缺的信息展示工具&#xff0c;其广泛应用于商业广告、公共信息发布、舞台表演等多个领域。然而&#xff0c;随着LED显示屏的长时间运行&#xff0c;散热问题逐渐凸显&#xff0c;不仅影响设备的稳定性和寿命&#xff0c;还可能导…

【Python】语句与众所周知【自我维护版】

各位大佬好 &#xff0c;这里是阿川的博客 &#xff0c; 祝您变得更强 个人主页&#xff1a;在线OJ的阿川 大佬的支持和鼓励&#xff0c;将是我成长路上最大的动力 阿川水平有限&#xff0c;如有错误&#xff0c;欢迎大佬指正 本篇博客是在之前的基础上进行的维护 目录 条…