|
|
|
<?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" />
|
|
|
|
<result property="delFlag" column="del_flag" />
|
|
|
|
<result property="plcIp" column="plc_ip" />
|
|
|
|
<result property="plcPort" column="plc_port" />
|
|
|
|
</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,del_flag,plc_ip,plc_port from base_equipment
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectBaseEquipmentList" parameterType="BaseEquipment" resultMap="BaseEquipmentResult">
|
|
|
|
<include refid="selectBaseEquipmentVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code like concat('%', #{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 like concat('%', #{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>
|
|
|
|
<if test="plcIp != null and plcIp != ''"> and plc_ip = #{plcIp}</if>
|
|
|
|
<if test="plcPort != null and plcPort != ''"> and plc_port = #{plcPort}</if>
|
|
|
|
and del_flag ='0'
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectBaseEquipmentByEquipmentId" parameterType="Long" resultMap="BaseEquipmentResult">
|
|
|
|
<include refid="selectBaseEquipmentVo"/>
|
|
|
|
where equipment_id = #{equipmentId}
|
|
|
|
and del_flag ='0'
|
|
|
|
</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>
|
|
|
|
<if test="plcIp != null and plcIp != ''">plc_ip,</if>
|
|
|
|
<if test="plcPort != null and plcPort != ''">plc_port,</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>
|
|
|
|
<if test="plcIp != null and plcIp != ''">#{plcIp},</if>
|
|
|
|
<if test="plcPort != null and plcPort != ''">#{plcPort},</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>
|
|
|
|
<if test="plcIp != null and plcIp != ''">plc_ip = #{plcIp},</if>
|
|
|
|
<if test="plcPort != null and plcPort != ''">plc_port = #{plcPort},</if>
|
|
|
|
</trim>
|
|
|
|
where equipment_id = #{equipmentId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="deleteBaseEquipmentByEquipmentId" parameterType="Long">
|
|
|
|
update base_equipment
|
|
|
|
set del_flag = '1'
|
|
|
|
where equipment_id = #{equipmentId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="deleteBaseEquipmentByEquipmentIds" parameterType="String">
|
|
|
|
update base_equipment
|
|
|
|
set del_flag = '1'
|
|
|
|
where equipment_id in
|
|
|
|
<foreach item="equipmentId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{equipmentId}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<select id="getEquipmentTypeName" parameterType="BaseEquipment" resultType="java.lang.String">
|
|
|
|
select dict_label
|
|
|
|
from sys_dict_data
|
|
|
|
where dict_value = #{equipmentTypeCode}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="checkEquipmentNameUnique" parameterType="BaseEquipment" resultType ="java.lang.String">
|
|
|
|
select equipment_name
|
|
|
|
from base_equipment
|
|
|
|
where equipment_name = #{equipmentName}
|
|
|
|
and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="checkEquipmentCodeUnique" parameterType="BaseEquipment" resultType ="java.lang.String">
|
|
|
|
select equipment_code
|
|
|
|
from base_equipment
|
|
|
|
where equipment_code = #{equipmentCode}
|
|
|
|
and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getWorkCenterName" parameterType="BaseEquipment" resultType="java.lang.String">
|
|
|
|
select factory_name
|
|
|
|
from sys_factory
|
|
|
|
where factory_code = #{workshopCode}
|
|
|
|
and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getEquipmentAttachedList" parameterType="BaseEquipment" resultType="com.op.wms.domain.BaseEquipment">
|
|
|
|
SELECT *
|
|
|
|
FROM base_equipment,base_equipment_attached
|
|
|
|
where base_equipment_attached.device_code = #{equipmentCode}
|
|
|
|
and base_equipment.equipment_code = #{equipmentCode}
|
|
|
|
and base_equipment.del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getEquipmentTypeList" parameterType="BaseEquipment" resultMap="BaseEquipmentResult">
|
|
|
|
select equipment_type_code,equipment_type_name
|
|
|
|
from base_equipment
|
|
|
|
where del_flag = '0'
|
|
|
|
group by equipment_type_code,equipment_type_name
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|