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.

164 lines
8.7 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.EquPlanStandardMapper">
<resultMap type="EquPlanStandard" id="EquPlanStandardResult">
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="parentCode" column="parent_code"/>
<result property="planCode" column="plan_code"/>
<result property="detailCode" column="detail_code"/>
<result property="standardType" column="standard_type"/>
<result property="standardName" column="standard_name"/>
<result property="detailUpLimit" column="detail_up_limit"/>
<result property="detailDownLimit" column="detail_down_limit"/>
<result property="detailUnit" column="detail_unit"/>
<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="selectEquPlanStandardVo">
select id, code, parent_code,plan_code, detail_code, standard_type, standard_name, detail_up_limit,
detail_down_limit, detail_unit, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time,
update_by, update_time
from equ_plan_standard
</sql>
<select id="selectEquPlanStandardList" parameterType="EquPlanStandard" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
<where>
<if test="code != null and code != ''">and code = #{code}</if>
<if test="parentCode != null and parentCode != ''">and parent_code = #{parentCode}</if>
<if test="planCode != null and planCode != ''">and plan_code = #{planCode}</if>
<if test="detailCode != null and detailCode != ''">and detail_code = #{detailCode}</if>
<if test="standardType != null and standardType != ''">and standard_type = #{standardType}</if>
<if test="standardName != null and standardName != ''">and standard_name like concat('%', #{standardName},
'%')
</if>
<if test="detailUpLimit != null ">and detail_up_limit = #{detailUpLimit}</if>
<if test="detailDownLimit != null ">and detail_down_limit = #{detailDownLimit}</if>
<if test="detailUnit != null and detailUnit != ''">and detail_unit = #{detailUnit}</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>
ORDER BY standard_name
</select>
<select id="selectEquPlanStandardById" parameterType="String" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquPlanStandardByPlanCode" parameterType="String" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
where plan_code = #{planCode} and del_flag ='0' ORDER BY standard_name
</select>
<select id="selectEquPlanStandardListByParentCode" parameterType="String" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
where parent_code = #{code} and del_flag ='0' ORDER BY standard_name
</select>
<insert id="insertEquPlanStandard" parameterType="EquPlanStandard">
insert into equ_plan_standard
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null">code,</if>
<if test="parentCode != null">parent_code,</if>
<if test="planCode != null">plan_code,</if>
<if test="detailCode != null">detail_code,</if>
<if test="standardType != null">standard_type,</if>
<if test="standardName != null">standard_name,</if>
<if test="detailUpLimit != null">detail_up_limit,</if>
<if test="detailDownLimit != null">detail_down_limit,</if>
<if test="detailUnit != null">detail_unit,</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="code != null">#{code},</if>
<if test="parentCode != null">#{parentCode},</if>
<if test="planCode != null">#{planCode},</if>
<if test="detailCode != null">#{detailCode},</if>
<if test="standardType != null">#{standardType},</if>
<if test="standardName != null">#{standardName},</if>
<if test="detailUpLimit != null">#{detailUpLimit},</if>
<if test="detailDownLimit != null">#{detailDownLimit},</if>
<if test="detailUnit != null">#{detailUnit},</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="updateEquPlanStandard" parameterType="EquPlanStandard">
update equ_plan_standard
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="parentCode != null">parent_code = #{parentCode},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="detailCode != null">detail_code = #{detailCode},</if>
<if test="standardType != null">standard_type = #{standardType},</if>
<if test="standardName != null">standard_name = #{standardName},</if>
<if test="detailUpLimit != null">detail_up_limit = #{detailUpLimit},</if>
<if test="detailDownLimit != null">detail_down_limit = #{detailDownLimit},</if>
<if test="detailUnit != null">detail_unit = #{detailUnit},</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="deleteEquPlanStandardById" parameterType="String">
delete from equ_plan_standard where id = #{id}
</delete>
<delete id="deleteEquPlanStandardByIds" parameterType="String">
delete from equ_plan_standard where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteEquPlanStandardByPlanCode">
delete from equ_plan_standard where plan_code = #{planCode}
</delete>
<delete id="delEquPlanStandardByPlanCode">
update equ_plan_standard set del_flag = '1' where plan_code = #{planCode}
</delete>
</mapper>