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.

166 lines
9.8 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.wms.mapper.BaseEquipmentMapper">
<resultMap type="BaseEquipment" id="BaseEquipmentResult">
<result property="equipmentId" column="equipment_id" />
<result property="equipmentCode" column="equipment_code" />
<result property="equipmentName" column="equipment_name" />
<result property="equipmentBrand" column="equipment_brand" />
<result property="equipmentSpec" column="equipment_spec" />
<result property="equipmentTypeId" column="equipment_type_id" />
<result property="equipmentTypeCode" column="equipment_type_code" />
<result property="equipmentTypeName" column="equipment_type_name" />
<result property="workshopId" column="workshop_id" />
<result property="workshopCode" column="workshop_code" />
<result property="workshopName" column="workshop_name" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="unitWorkingHours" column="unit_working_hours" />
<result property="workshopSection" column="workshop_section" />
<result property="equipmentLocation" column="equipment_location" />
<result property="hourlyUnitPrice" column="hourly_unit_price" />
</resultMap>
<sql id="selectBaseEquipmentVo">
select equipment_id, equipment_code, equipment_name, equipment_brand, equipment_spec, equipment_type_id, equipment_type_code, equipment_type_name, workshop_id, workshop_code, workshop_name, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, workshop_section, equipment_location, hourly_unit_price,unit_working_hours from base_equipment
</sql>
<select id="selectBaseEquipmentList" parameterType="BaseEquipment" resultMap="BaseEquipmentResult">
<include refid="selectBaseEquipmentVo"/>
<where>
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code = #{equipmentCode}</if>
<if test="equipmentName != null and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
<if test="equipmentBrand != null and equipmentBrand != ''"> and equipment_brand = #{equipmentBrand}</if>
<if test="equipmentSpec != null and equipmentSpec != ''"> and equipment_spec = #{equipmentSpec}</if>
<if test="equipmentTypeId != null "> and equipment_type_id = #{equipmentTypeId}</if>
<if test="equipmentTypeCode != null and equipmentTypeCode != ''"> and equipment_type_code = #{equipmentTypeCode}</if>
<if test="equipmentTypeName != null and equipmentTypeName != ''"> and equipment_type_name like concat('%', #{equipmentTypeName}, '%')</if>
<if test="workshopId != null "> and workshop_id = #{workshopId}</if>
<if test="workshopCode != null and workshopCode != ''"> and workshop_code = #{workshopCode}</if>
<if test="workshopName != null and workshopName != ''"> and workshop_name like concat('%', #{workshopName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</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 = #{attr3}</if>
<if test="attr4 != null "> and attr4 = #{attr4}</if>
<if test="unitWorkingHours != null and unitWorkingHours != ''"> and unit_working_hours = #{unitWorkingHours}</if>
<if test="workshopSection != null and workshopSection != ''"> and workshop_section = #{workshopSection}</if>
<if test="equipmentLocation != null and equipmentLocation != ''"> and equipment_location = #{equipmentLocation}</if>
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''"> and hourly_unit_price = #{hourlyUnitPrice}</if>
</where>
</select>
<select id="selectBaseEquipmentByEquipmentId" parameterType="Long" resultMap="BaseEquipmentResult">
<include refid="selectBaseEquipmentVo"/>
where equipment_id = #{equipmentId}
</select>
<insert id="insertBaseEquipment" parameterType="BaseEquipment" useGeneratedKeys="true" keyProperty="equipmentId">
insert into base_equipment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="equipmentCode != null and equipmentCode != ''">equipment_code,</if>
<if test="equipmentName != null">equipment_name,</if>
<if test="equipmentBrand != null">equipment_brand,</if>
<if test="equipmentSpec != null">equipment_spec,</if>
<if test="equipmentTypeId != null">equipment_type_id,</if>
<if test="equipmentTypeCode != null">equipment_type_code,</if>
<if test="equipmentTypeName != null">equipment_type_name,</if>
<if test="workshopId != null">workshop_id,</if>
<if test="workshopCode != null">workshop_code,</if>
<if test="workshopName != null">workshop_name,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="unitWorkingHours != null and unitWorkingHours != ''">unit_working_hours,</if>
<if test="workshopSection != null and workshopSection != ''">workshop_section,</if>
<if test="equipmentLocation != null and equipmentLocation != ''">equipment_location,</if>
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''">hourly_unit_price,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
<if test="equipmentName != null">#{equipmentName},</if>
<if test="equipmentBrand != null">#{equipmentBrand},</if>
<if test="equipmentSpec != null">#{equipmentSpec},</if>
<if test="equipmentTypeId != null">#{equipmentTypeId},</if>
<if test="equipmentTypeCode != null">#{equipmentTypeCode},</if>
<if test="equipmentTypeName != null">#{equipmentTypeName},</if>
<if test="workshopId != null">#{workshopId},</if>
<if test="workshopCode != null">#{workshopCode},</if>
<if test="workshopName != null">#{workshopName},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="unitWorkingHours != null and unitWorkingHours != ''">#{unitWorkingHours},</if>
<if test="workshopSection != null and workshopSection != ''">#{workshopSection},</if>
<if test="equipmentLocation != null and equipmentLocation != ''">#{equipmentLocation},</if>
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''">#{hourlyUnitPrice},</if>
</trim>
</insert>
<update id="updateBaseEquipment" parameterType="BaseEquipment">
update base_equipment
<trim prefix="SET" suffixOverrides=",">
<if test="equipmentCode != null and equipmentCode != ''">equipment_code = #{equipmentCode},</if>
<if test="equipmentName != null">equipment_name = #{equipmentName},</if>
<if test="equipmentBrand != null">equipment_brand = #{equipmentBrand},</if>
<if test="equipmentSpec != null">equipment_spec = #{equipmentSpec},</if>
<if test="equipmentTypeId != null">equipment_type_id = #{equipmentTypeId},</if>
<if test="equipmentTypeCode != null">equipment_type_code = #{equipmentTypeCode},</if>
<if test="equipmentTypeName != null">equipment_type_name = #{equipmentTypeName},</if>
<if test="workshopId != null">workshop_id = #{workshopId},</if>
<if test="workshopCode != null">workshop_code = #{workshopCode},</if>
<if test="workshopName != null">workshop_name = #{workshopName},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="unitWorkingHours != null and unitWorkingHours != ''">unit_working_hours = #{unitWorkingHours},</if>
<if test="workshopSection != null and workshopSection != ''">workshop_section = #{workshopSection},</if>
<if test="equipmentLocation != null and equipmentLocation != ''">equipment_location = #{equipmentLocation},</if>
<if test="hourlyUnitPrice != null and hourlyUnitPrice != ''">hourly_unit_price = #{hourlyUnitPrice},</if>
</trim>
where equipment_id = #{equipmentId}
</update>
<delete id="deleteBaseEquipmentByEquipmentId" parameterType="Long">
delete from base_equipment where equipment_id = #{equipmentId}
</delete>
<delete id="deleteBaseEquipmentByEquipmentIds" parameterType="String">
delete from base_equipment where equipment_id in
<foreach item="equipmentId" collection="array" open="(" separator="," close=")">
#{equipmentId}
</foreach>
</delete>
</mapper>