mappers.WorkflowApproverEntityMapper.xml Maven / Gradle / Ivy
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.apache.inlong.manager.dao.mapper.WorkflowApproverEntityMapper"> <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.WorkflowApproverEntity"> <id column="id" jdbcType="INTEGER" property="id"/> <result column="process_name" jdbcType="VARCHAR" property="processName"/> <result column="task_name" jdbcType="VARCHAR" property="taskName"/> <result column="tenant" jdbcType="VARCHAR" property="tenant"/> <result column="approvers" jdbcType="VARCHAR" property="approvers"/> <result column="creator" jdbcType="VARCHAR" property="creator"/> <result column="modifier" jdbcType="VARCHAR" property="modifier"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/> <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/> <result column="version" jdbcType="INTEGER" property="version"/> </resultMap> <sql id="Base_Column_List"> id, process_name, task_name, tenant, approvers, creator, modifier, create_time, modify_time, is_deleted, version </sql> <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="org.apache.inlong.manager.dao.entity.WorkflowApproverEntity"> insert into workflow_approver (id, process_name, task_name, tenant, approvers, creator, modifier) values (#{id, jdbcType=INTEGER}, #{processName, jdbcType=VARCHAR}, #{taskName, jdbcType=VARCHAR}, #{tenant,jdbcType=VARCHAR}, #{approvers, jdbcType=VARCHAR}, #{creator, jdbcType=VARCHAR}, #{modifier, jdbcType=VARCHAR}) </insert> <select id="selectById" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from workflow_approver where tenant = #{tenant,jdbcType=VARCHAR} and id = #{id, jdbcType=INTEGER} and is_deleted = 0 </select> <select id="selectByCondition" resultMap="BaseResultMap" parameterType="org.apache.inlong.manager.pojo.workflow.ApproverPageRequest"> select <include refid="Base_Column_List"/> from workflow_approver <where> tenant = #{tenant,jdbcType=VARCHAR} and is_deleted = 0 <if test="currentUser != null and currentUser != '' and isAdminRole == false"> and ( creator = #{currentUser, jdbcType=VARCHAR} or find_in_set(#{currentUser, jdbcType=VARCHAR}, approvers) ) </if> <if test="processName != null and processName!=''"> and process_name = #{processName, jdbcType=VARCHAR} </if> <if test="taskName != null and taskName!=''"> and task_name = #{taskName, jdbcType=VARCHAR} </if> <if test="approver != null and approver!=''"> and find_in_set(#{approver, jdbcType=VARCHAR}, approvers) </if> <if test="keyword != null and keyword != ''"> and (process_name like CONCAT('%', #{keyword}, '%') or task_name like CONCAT('%', #{keyword}, '%')) </if> </where> </select> <update id="updateById" parameterType="org.apache.inlong.manager.dao.entity.WorkflowApproverEntity"> update workflow_approver set process_name = #{processName, jdbcType=VARCHAR}, task_name = #{taskName, jdbcType=VARCHAR}, approvers = #{approvers, jdbcType=VARCHAR}, creator = #{creator, jdbcType=VARCHAR}, modifier = #{modifier, jdbcType=VARCHAR}, is_deleted = #{isDeleted, jdbcType=INTEGER}, version = #{version, jdbcType=INTEGER} + 1 where tenant = #{tenant,jdbcType=VARCHAR} and id = #{id, jdbcType=INTEGER} and is_deleted = 0 and version = #{version, jdbcType=INTEGER} </update> <delete id="deleteByPrimaryKey"> update workflow_approver set is_deleted = id, modifier=#{modifier, jdbcType=VARCHAR} where tenant = #{tenant,jdbcType=VARCHAR} and id = #{id, jdbcType=INTEGER} </delete> </mapper>