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.

125 lines
6.1 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.op.device.mapper.EquPlanPersonMapper">
<resultMap type="EquPlanPerson" id="EquPlanPersonResult">
<result property="id" column="id" />
<result property="planCode" column="plan_code" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="factoryCode" column="factory_code" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectEquPlanPersonVo">
select id, plan_code, user_id, user_name, factory_code, attr1, attr2, attr3, del_flag,
create_by, create_time, update_by, update_time
from equ_plan_person
</sql>
<select id="selectEquPlanPersonList" parameterType="EquPlanPerson" resultMap="EquPlanPersonResult">
<include refid="selectEquPlanPersonVo"/>
<where>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
and del_flag = '0'
</where>
</select>
<select id="selectEquPlanPersonById" parameterType="String" resultMap="EquPlanPersonResult">
<include refid="selectEquPlanPersonVo"/>
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquPlanPersonByPlanCode" parameterType="String" resultMap="EquPlanPersonResult">
<include refid="selectEquPlanPersonVo"/>
where plan_code = #{planCode} and del_flag = '0'
</select>
<insert id="insertEquPlanPerson" parameterType="EquPlanPerson">
insert into equ_plan_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="planCode != null and planCode != ''">#{planCode},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEquPlanPerson" parameterType="EquPlanPerson">
update equ_plan_person
<trim prefix="SET" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEquPlanPersonById" parameterType="String">
delete from equ_plan_person where id = #{id}
</delete>
<delete id="deleteEquPlanPersonByIds" parameterType="String">
delete from equ_plan_person where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteEquPlanPersonByPlanCode">
delete from equ_plan_person where plan_code = #{planCode}
</delete>
<delete id="delEquPlanPersonByPlanCode">
update equ_plan_person set del_flag = '1' where plan_code = #{planCode}
</delete>
</mapper>