81 lines
3.3 KiB
XML
81 lines
3.3 KiB
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="com.ruoyi.airline.mapper.AirlineFileGroupMapper">
|
||
|
|
|
||
|
|
<!-- 结果映射 -->
|
||
|
|
<resultMap id="AirlineFileGroupResult" type="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity">
|
||
|
|
<id property="groupId" column="group_id" />
|
||
|
|
<result property="groupName" column="group_name" />
|
||
|
|
<result property="userId" column="user_id" />
|
||
|
|
<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="delFlag" column="del_flag" />
|
||
|
|
<result property="deletedBy" column="deleted_by" />
|
||
|
|
<result property="deletedTime" column="deleted_time" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!-- 检查分组名称是否唯一 -->
|
||
|
|
<select id="checkgroupNameUnique" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity" resultType="java.lang.Integer">
|
||
|
|
select count(1) from airline_file_group
|
||
|
|
where group_name = #{groupName}
|
||
|
|
and del_flag = 0
|
||
|
|
<if test="groupId != null">
|
||
|
|
and group_id != #{groupId}
|
||
|
|
</if>
|
||
|
|
<if test="userId != null">
|
||
|
|
and user_id = #{userId}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!-- 删除分组(软删除) -->
|
||
|
|
<update id="deletegroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity">
|
||
|
|
update airline_file_group
|
||
|
|
set del_flag = 1,
|
||
|
|
deleted_by = #{deletedBy},
|
||
|
|
deleted_time = #{deletedTime}
|
||
|
|
where group_id = #{groupId}
|
||
|
|
<if test="userId != null">
|
||
|
|
and user_id = #{userId}
|
||
|
|
</if>
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<!-- 更新分组 -->
|
||
|
|
<update id="updateGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity">
|
||
|
|
update airline_file_group
|
||
|
|
set group_name = #{groupName},
|
||
|
|
update_by = #{updateBy},
|
||
|
|
update_time = #{updateTime}
|
||
|
|
where group_id = #{groupId}
|
||
|
|
and del_flag = 0
|
||
|
|
<if test="userId != null">
|
||
|
|
and user_id = #{userId}
|
||
|
|
</if>
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<!-- 插入分组 -->
|
||
|
|
<insert id="insertGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity">
|
||
|
|
insert into airline_file_group (group_name, user_id, create_by, create_time, update_by, update_time, del_flag)
|
||
|
|
values (#{groupName}, #{userId}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, 0)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<!-- 查询分组列表 -->
|
||
|
|
<select id="selectGroupList" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity" resultMap="AirlineFileGroupResult">
|
||
|
|
select group_id, group_name, user_id, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time
|
||
|
|
from airline_file_group
|
||
|
|
<where>
|
||
|
|
and del_flag = 0
|
||
|
|
<if test="groupName != null and groupName != ''">
|
||
|
|
and group_name like concat('%', #{groupName}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="userId != null">
|
||
|
|
and user_id = #{userId}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
order by create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|