<?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">
|
<!--
|
* @title: 平台功能目录表
|
* @description: 自定义sql,请自行实现业务逻辑
|
* @company: hugeinfo
|
* @author: liyj
|
* @time:2024-09-10 10:57:02
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.rsoper.dao.mapper.RsMenuMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.rsoper.domain.po.RsMenu">
|
<result property="id" column="id"/>
|
<result property="menuType" column="menu_type"/>
|
<result property="menuTag" column="menu_tag"/>
|
<result property="menuName" column="menu_name"/>
|
<result property="menuIcon" column="menu_icon"/>
|
<result property="menuUrl" column="menu_url"/>
|
<result property="menuDes" column="menu_des"/>
|
<result property="appClient" column="app_client"/>
|
<result property="appType" column="app_type"/>
|
<result property="sorts" column="sorts"/>
|
<result property="parentId" column="parent_id"/>
|
<result property="deleteStatus" column="delete_status"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_rs_menu</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
menu_type,
|
menu_tag,
|
menu_name,
|
menu_icon,
|
menu_url,
|
menu_des,
|
app_client,
|
app_type,
|
sorts,
|
parent_id,
|
delete_status,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.menuType != null">menu_type = #{entity.menuType},</if>
|
<if test="entity.menuTag != null">menu_tag = #{entity.menuTag},</if>
|
<if test="entity.menuName != null">menu_name = #{entity.menuName},</if>
|
<if test="entity.menuIcon != null">menu_icon = #{entity.menuIcon},</if>
|
<if test="entity.menuUrl != null">menu_url = #{entity.menuUrl},</if>
|
<if test="entity.menuDes != null">menu_des = #{entity.menuDes},</if>
|
<if test="entity.appClient != null">app_client = #{entity.appClient},</if>
|
<if test="entity.appType != null">app_type = #{entity.appType},</if>
|
<if test="entity.sorts != null">sorts = #{entity.sorts},</if>
|
<if test="entity.parentId != null">parent_id = #{entity.parentId},</if>
|
<if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
|
<if test="entity.createTime != null">create_time = #{entity.createTime},</if>
|
<if test="entity.updateTime != null">update_time = #{entity.updateTime}</if>
|
</sql>
|
<!-- 条件 -->
|
<sql id="where-part">
|
<if test="terms != null">
|
<where>
|
<if test="terms.id != null and terms.id !=''">
|
and id = #{terms.id}
|
</if>
|
<if test="terms.menuType != null and terms.menuType !=''">
|
and menu_type = #{terms.menuType}
|
</if>
|
<if test="terms.menuTag != null and terms.menuTag !=''">
|
and menu_tag = #{terms.menuTag}
|
</if>
|
<if test="terms.menuName != null and terms.menuName !=''">
|
and menu_name = #{terms.menuName}
|
</if>
|
<if test="terms.menuIcon != null and terms.menuIcon !=''">
|
and menu_icon = #{terms.menuIcon}
|
</if>
|
<if test="terms.menuUrl != null and terms.menuUrl !=''">
|
and menu_url = #{terms.menuUrl}
|
</if>
|
<if test="terms.menuDes != null and terms.menuDes !=''">
|
and menu_des = #{terms.menuDes}
|
</if>
|
<if test="terms.appClient != null and terms.appClient !=''">
|
and app_client = #{terms.appClient}
|
</if>
|
<if test="terms.appType != null and terms.appType !=''">
|
and app_type = #{terms.appType}
|
</if>
|
<if test="terms.sorts != null and terms.sorts !=''">
|
and sorts = #{terms.sorts}
|
</if>
|
<if test="terms.parentId != null and terms.parentId !=''">
|
and parent_id = #{terms.parentId}
|
</if>
|
<if test="terms.deleteStatus = null and terms.deleteStatus =''">
|
and delete_status = 0
|
</if>
|
<if test="terms.deleteStatus != null and terms.deleteStatus !=''">
|
and delete_status = #{terms.deleteStatus}
|
</if>
|
<if test="terms.createTime != null and terms.createTime !=''">
|
and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime}
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart}
|
and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.updateTime != null and terms.updateTime !=''">
|
and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime}
|
</if>
|
<if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''">
|
and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart}
|
and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd})
|
</if>
|
</where>
|
</if>
|
</sql>
|
<!-- 更新对象 -->
|
<update id="updateRsMenu">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateRsMenuTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteRsMenu">
|
delete from
|
<include refid="table-name" />
|
where id = #{id}
|
</delete>
|
<!-- 根据条件查询 -->
|
<select id="listTerms" resultMap="dataResult">
|
select
|
<include refid="column-part"/>
|
from
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
</select>
|
<!-- 根据条件统计 -->
|
<select id="countTerms" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
</select>
|
<!-- 根据条件分页查询 -->
|
<select id="pageTerms" resultMap="dataResult">
|
SELECT
|
<include refid="column-part"/>
|
FROM
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(create_time), create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
</mapper>
|