You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HwMes/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseProcessUserMapper.xml

73 lines
3.4 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.hw.mes.mapper.MesBaseProcessUserMapper">
<resultMap type="MesBaseProcessUser" id="MesBaseProcessUserResult">
<result property="processId" column="process_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="routeId" column="route_id" />
</resultMap>
<sql id="selectMesBaseProcessUserVo">
select process_id, user_id, user_name, create_by, create_time from mes_base_process_user mbpu
</sql>
<select id="selectMesBaseProcessUserList" parameterType="MesBaseProcessUser" resultMap="MesBaseProcessUserResult">
<include refid="selectMesBaseProcessUserVo"/>
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="routeId != null "> and exists (select 1 from mes_base_route_process mbrp where mbrp.process_id=mbpu.process_id and mbrp.route_id = #{routeId} )</if>
</where>
</select>
<select id="selectMesBaseProcessUserByProcessId" parameterType="Long" resultMap="MesBaseProcessUserResult">
<include refid="selectMesBaseProcessUserVo"/>
where process_id = #{processId}
</select>
<insert id="insertMesBaseProcessUser" parameterType="MesBaseProcessUser">
insert into mes_base_process_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="processId != null">process_id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="processId != null">#{processId},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateMesBaseProcessUser" parameterType="MesBaseProcessUser">
update mes_base_process_user
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where process_id = #{processId}
</update>
<delete id="deleteMesBaseProcessUserByProcessId" parameterType="Long">
delete from mes_base_process_user where process_id = #{processId}
</delete>
<delete id="deleteMesBaseProcessUserByProcessIds" parameterType="String">
delete from mes_base_process_user where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
</mapper>