|
@@ -0,0 +1,199 @@
|
|
|
+<?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.imcs.admin.business.dao.WDeviceDao">
|
|
|
+
|
|
|
+ <resultMap type="com.imcs.admin.entity.WDevice" id="WDeviceMap">
|
|
|
+ <result property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deviceModel" column="device_model" jdbcType="VARCHAR"/>
|
|
|
+ <result property="factoryDate" column="factory_date" jdbcType="VARCHAR"/>
|
|
|
+ <result property="factory" column="factory" jdbcType="VARCHAR"/>
|
|
|
+ <result property="remark" column="remark" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deviceSystem" column="device_system" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deviceType" column="device_type" jdbcType="VARCHAR"/>
|
|
|
+ <result property="pic" column="pic" jdbcType="VARCHAR"/>
|
|
|
+ <result property="ip" column="ip" jdbcType="VARCHAR"/>
|
|
|
+ <result property="factoryStatus" column="factory_status" jdbcType="VARCHAR"/>
|
|
|
+ <result property="homePosition" column="home_position" jdbcType="VARCHAR"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!--查询单个-->
|
|
|
+ <select id="queryById" resultMap="WDeviceMap">
|
|
|
+ select
|
|
|
+*
|
|
|
+ from w_device
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--查询指定行数据-->
|
|
|
+ <select id="queryAllByLimit" resultMap="WDeviceMap">
|
|
|
+ select
|
|
|
+*
|
|
|
+ from w_device
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">
|
|
|
+ and device_code = #{deviceCode}
|
|
|
+ </if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">
|
|
|
+ and device_name = #{deviceName}
|
|
|
+ </if>
|
|
|
+ <if test="deviceModel != null and deviceModel != ''">
|
|
|
+ and device_model = #{deviceModel}
|
|
|
+ </if>
|
|
|
+ <if test="factoryDate != null and factoryDate != ''">
|
|
|
+ and factory_date = #{factoryDate}
|
|
|
+ </if>
|
|
|
+ <if test="factory != null and factory != ''">
|
|
|
+ and factory = #{factory}
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and remark != ''">
|
|
|
+ and remark = #{remark}
|
|
|
+ </if>
|
|
|
+ <if test="deviceSystem != null and deviceSystem != ''">
|
|
|
+ and device_system = #{deviceSystem}
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null and deviceType != ''">
|
|
|
+ and device_type = #{deviceType}
|
|
|
+ </if>
|
|
|
+ <if test="pic != null and pic != ''">
|
|
|
+ and pic = #{pic}
|
|
|
+ </if>
|
|
|
+ <if test="ip != null and ip != ''">
|
|
|
+ and ip = #{ip}
|
|
|
+ </if>
|
|
|
+ <if test="factoryStatus != null and factoryStatus != ''">
|
|
|
+ and factory_status = #{factoryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="homePosition != null and homePosition != ''">
|
|
|
+ and home_position = #{homePosition}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ limit #{pageable.offset}, #{pageable.pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--统计总行数-->
|
|
|
+ <select id="count" resultType="java.lang.Long">
|
|
|
+ select count(1)
|
|
|
+ from w_device
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">
|
|
|
+ and device_code = #{deviceCode}
|
|
|
+ </if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">
|
|
|
+ and device_name = #{deviceName}
|
|
|
+ </if>
|
|
|
+ <if test="deviceModel != null and deviceModel != ''">
|
|
|
+ and device_model = #{deviceModel}
|
|
|
+ </if>
|
|
|
+ <if test="factoryDate != null and factoryDate != ''">
|
|
|
+ and factory_date = #{factoryDate}
|
|
|
+ </if>
|
|
|
+ <if test="factory != null and factory != ''">
|
|
|
+ and factory = #{factory}
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and remark != ''">
|
|
|
+ and remark = #{remark}
|
|
|
+ </if>
|
|
|
+ <if test="deviceSystem != null and deviceSystem != ''">
|
|
|
+ and device_system = #{deviceSystem}
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null and deviceType != ''">
|
|
|
+ and device_type = #{deviceType}
|
|
|
+ </if>
|
|
|
+ <if test="pic != null and pic != ''">
|
|
|
+ and pic = #{pic}
|
|
|
+ </if>
|
|
|
+ <if test="ip != null and ip != ''">
|
|
|
+ and ip = #{ip}
|
|
|
+ </if>
|
|
|
+ <if test="factoryStatus != null and factoryStatus != ''">
|
|
|
+ and factory_status = #{factoryStatus}
|
|
|
+ </if>
|
|
|
+ <if test="homePosition != null and homePosition != ''">
|
|
|
+ and home_position = #{homePosition}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--新增所有列-->
|
|
|
+ <insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into w_device(device_code,device_name,device_model,factory_date,factory,remark,device_system,device_type,pic,ip,factory_status,home_position)
|
|
|
+ values (#{deviceCode}#{deviceName}#{deviceModel}#{factoryDate}#{factory}#{remark}#{deviceSystem}#{deviceType}#{pic}#{ip}#{factoryStatus}#{homePosition})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into w_device(device_code,device_name,device_model,factory_date,factory,remark,device_system,device_type,pic,ip,factory_status,home_position)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.deviceCode},#{entity.deviceName},#{entity.deviceModel},#{entity.factoryDate},#{entity.factory},#{entity.remark},#{entity.deviceSystem},#{entity.deviceType},#{entity.pic},#{entity.ip},#{entity.factoryStatus},#{entity.homePosition})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into w_device(device_code,device_name,device_model,factory_date,factory,remark,device_system,device_type,pic,ip,factory_status,home_position)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.deviceCode}#{entity.deviceName},#{entity.deviceModel},#{entity.factoryDate},#{entity.factory},#{entity.remark},#{entity.deviceSystem},#{entity.deviceType},#{entity.pic},#{entity.ip},#{entity.factoryStatus},#{entity.homePosition})
|
|
|
+ </foreach>
|
|
|
+ on duplicate key update
|
|
|
+device_code = values(device_code)device_name = values(device_name)device_model = values(device_model)factory_date = values(factory_date)factory = values(factory)remark = values(remark)device_system = values(device_system)device_type = values(device_type)pic = values(pic)ip = values(ip)factory_status = values(factory_status)home_position = values(home_position)
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!--通过主键修改数据-->
|
|
|
+ <update id="update">
|
|
|
+ update w_device
|
|
|
+ <set>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">
|
|
|
+ device_code = #{deviceCode},
|
|
|
+ </if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">
|
|
|
+ device_name = #{deviceName},
|
|
|
+ </if>
|
|
|
+ <if test="deviceModel != null and deviceModel != ''">
|
|
|
+ device_model = #{deviceModel},
|
|
|
+ </if>
|
|
|
+ <if test="factoryDate != null and factoryDate != ''">
|
|
|
+ factory_date = #{factoryDate},
|
|
|
+ </if>
|
|
|
+ <if test="factory != null and factory != ''">
|
|
|
+ factory = #{factory},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and remark != ''">
|
|
|
+ remark = #{remark},
|
|
|
+ </if>
|
|
|
+ <if test="deviceSystem != null and deviceSystem != ''">
|
|
|
+ device_system = #{deviceSystem},
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null and deviceType != ''">
|
|
|
+ device_type = #{deviceType},
|
|
|
+ </if>
|
|
|
+ <if test="pic != null and pic != ''">
|
|
|
+ pic = #{pic},
|
|
|
+ </if>
|
|
|
+ <if test="ip != null and ip != ''">
|
|
|
+ ip = #{ip},
|
|
|
+ </if>
|
|
|
+ <if test="factoryStatus != null and factoryStatus != ''">
|
|
|
+ factory_status = #{factoryStatus},
|
|
|
+ </if>
|
|
|
+ <if test="homePosition != null and homePosition != ''">
|
|
|
+ home_position = #{homePosition},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--通过主键删除-->
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete from w_device where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|
|
|
+
|