unis_sip/ruoyi-sip/src/main/resources/mapper/sip/ProjectOperateLogMapper.xml

90 lines
4.0 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.sip.mapper.ProjectOperateLogMapper">
<resultMap type="ProjectOperateLog" id="ProjectOperateLogResult">
<result property="id" column="id" />
<result property="operateLog" column="operate_log" />
<result property="operateUser" column="operate_user" />
<result property="operateTime" column="operate_time" />
<result property="projectId" column="project_id" />
<result property="logType" column="log_type" />
</resultMap>
<sql id="selectProjectOperateLogVo">
select id, operate_log, operate_user, operate_time, project_id,log_type from project_operate_log
</sql>
<select id="selectProjectOperateLogList" parameterType="ProjectOperateLog" resultMap="ProjectOperateLogResult">
<include refid="selectProjectOperateLogVo"/>
<where>
<if test="operateLog != null and operateLog != ''"> and operate_log = #{operateLog}</if>
<if test="operateUser != null and operateUser != ''"> and operate_user = #{operateUser}</if>
<if test="operateTime != null "> and operate_time = #{operateTime}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
</where>
</select>
<select id="selectProjectOperateLogById" parameterType="Long" resultMap="ProjectOperateLogResult">
<include refid="selectProjectOperateLogVo"/>
where id = #{id}
</select>
<select id="selectProjectOperateLogListByProjectId" resultType="com.ruoyi.sip.domain.ProjectOperateLog">
select t1.id
, t1.operate_log
, t1.operate_user
, t1.operate_time
, t1.project_id
, t1.log_type
, t2.user_name as operate_user_name
from project_operate_log t1
left join sys_user t2 on operate_user = t2.user_id
where t1.project_id = #{projectId}
</select>
<insert id="insertProjectOperateLog" parameterType="ProjectOperateLog">
insert into project_operate_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="operateLog != null">operate_log,</if>
<if test="operateUser != null">operate_user,</if>
<if test="operateTime != null">operate_time,</if>
<if test="projectId != null">project_id,</if>
<if test="logType != null">log_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="operateLog != null">#{operateLog},</if>
<if test="operateUser != null">#{operateUser},</if>
<if test="operateTime != null">#{operateTime},</if>
<if test="projectId != null">#{projectId},</if>
<if test="logType != null">#{logType},</if>
</trim>
</insert>
<update id="updateProjectOperateLog" parameterType="ProjectOperateLog">
update project_operate_log
<trim prefix="SET" suffixOverrides=",">
<if test="operateLog != null">operate_log = #{operateLog},</if>
<if test="operateUser != null">operate_user = #{operateUser},</if>
<if test="operateTime != null">operate_time = #{operateTime},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="logType != null">log_type = #{logType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProjectOperateLogById" parameterType="Long">
delete from project_operate_log where id = #{id}
</delete>
<delete id="deleteProjectOperateLogByIds" parameterType="String">
delete from project_operate_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>