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.

113 lines
5.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.aucma.dms.mapper.DmsBaseMaintStationMapper">
<resultMap type="DmsBaseMaintStation" id="DmsBaseMaintStationResult">
<result property="maintStationId" column="maint_station_id" />
<result property="deviceTypeId" column="device_type_id" />
<result property="maintStationCode" column="maint_station_code" />
<result property="maintStationName" column="maint_station_name" />
<result property="protocolCode" column="protocol_code" />
<result property="isFlag" column="is_flag" />
<result property="remark" column="remark" />
<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="selectDmsBaseMaintStationVo">
select maint_station_id, device_type_id, maint_station_code, protocol_code, remark, create_by, create_time, update_by, update_time from dms_base_maint_station
</sql>
<select id="selectDmsBaseMaintStationList" parameterType="DmsBaseMaintStation" resultMap="DmsBaseMaintStationResult">
select a.maint_station_id, a.device_type_id, a.maint_station_code, a.maint_station_name, a.protocol_code, a.remark, a.create_by, a.create_time, a.update_by, a.update_time
from dms_base_maint_station a
<where>
<if test="deviceTypeId != null "> and a.device_type_id = #{deviceTypeId}</if>
<if test="maintStationCode != null and maintStationCode != ''"> and a.maint_station_code = #{maintStationCode}</if>
<if test="protocolCode != null and protocolCode != ''"> and a.protocol_code = #{protocolCode}</if>
<if test="isFlag != null "> and a.is_flag = #{isFlag}</if>
</where>
</select>
<select id="selectDmsBaseMaintStationByMaintStationId" parameterType="Long" resultMap="DmsBaseMaintStationResult">
<include refid="selectDmsBaseMaintStationVo"/>
where maint_station_id = #{maintStationId}
</select>
<select id="selectDmsMainInfo" resultType="com.aucma.dms.domain.DmsMaintInstanceActivity"
parameterType="java.lang.Long">
select
a.maint_level,
a.maint_group,
a.maint_supervisor,
a.remark
from
dms_bills_maint_instance x
left join dms_plan_maint a on
x.plan_maint_id = a.plan_maint_id
where
x.maint_instance_id = #{maintInstanceId}
</select>
<insert id="insertDmsBaseMaintStation" parameterType="DmsBaseMaintStation">
<selectKey keyProperty="maintStationId" resultType="long" order="BEFORE">
SELECT SEQ_DMS_MAINT_STATION.NEXTVAL FROM DUAL
</selectKey>
insert into dms_base_maint_station
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maintStationId != null">maint_station_id,</if>
<if test="deviceTypeId != null">device_type_id,</if>
<if test="maintStationCode != null">maint_station_code,</if>
<if test="protocolCode != null">protocol_code,</if>
<if test="isFlag != null">is_flag,</if>
<if test="remark != null">remark,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="maintStationId != null">#{maintStationId},</if>
<if test="deviceTypeId != null">#{deviceTypeId},</if>
<if test="maintStationCode != null">#{maintStationCode},</if>
<if test="protocolCode != null">#{protocolCode},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="remark != null">#{remark},</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>
</trim>
</insert>
<update id="updateDmsBaseMaintStation" parameterType="DmsBaseMaintStation">
update dms_base_maint_station
<trim prefix="SET" suffixOverrides=",">
<if test="deviceTypeId != null">device_type_id = #{deviceTypeId},</if>
<if test="maintStationCode != null">maint_station_code = #{maintStationCode},</if>
<if test="protocolCode != null">protocol_code = #{protocolCode},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="remark != null">remark = #{remark},</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>
</trim>
where maint_station_id = #{maintStationId}
</update>
<delete id="deleteDmsBaseMaintStationByMaintStationId" parameterType="Long">
delete from dms_base_maint_station where maint_station_id = #{maintStationId}
</delete>
<delete id="deleteDmsBaseMaintStationByMaintStationIds" parameterType="String">
delete from dms_base_maint_station where maint_station_id in
<foreach item="maintStationId" collection="array" open="(" separator="," close=")">
#{maintStationId}
</foreach>
</delete>
</mapper>