|
@@ -0,0 +1,149 @@
|
|
|
|
+<?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.bz.smart_city.dao.OperatingValveRecordMapper">
|
|
|
|
+ <!-- 结果集 -->
|
|
|
|
+ <resultMap type="com.bz.smart_city.entity.OperatingValveRecord" id="OperatingValveRecordMap">
|
|
|
|
+ <result property="id" column="id" jdbcType="INTEGER"/>
|
|
|
|
+ <result property="waterFileNo" column="water_file_no" jdbcType="VARCHAR"/>
|
|
|
|
+ <result property="waterNo" column="water_no" jdbcType="VARCHAR"/>
|
|
|
|
+ <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
|
|
|
|
+ <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
|
|
|
|
+ <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
|
|
|
+ <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
|
+ <result property="customerId" column="customer_id" jdbcType="INTEGER"/>
|
|
|
|
+ <result property="operation" column="operation" jdbcType="INTEGER"/>
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <!-- 基本字段 -->
|
|
|
|
+ <sql id="Base_Column_List">
|
|
|
|
+ id, water_file_no, water_no, create_date, update_date, create_by, update_by, status, customer_id, operation </sql>
|
|
|
|
+
|
|
|
|
+ <!-- 查询单个 -->
|
|
|
|
+ <select id="selectById" resultMap="OperatingValveRecordMap">
|
|
|
|
+ select
|
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
|
+ from sc_operating_valve_record
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <!-- 查询全部 -->
|
|
|
|
+ <select id="selectAll" resultMap="OperatingValveRecordMap">
|
|
|
|
+ select
|
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
|
+ from sc_operating_valve_record
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!--通过实体作为筛选条件查询-->
|
|
|
|
+ <select id="selectList" resultMap="OperatingValveRecordMap">
|
|
|
|
+ select
|
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
|
+ from sc_operating_valve_record
|
|
|
|
+ <where>
|
|
|
|
+ status=1
|
|
|
|
+ <if test="id != null">
|
|
|
|
+ and id = #{id}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="waterFileNo != null and waterFileNo != ''">
|
|
|
|
+ and water_file_no = #{waterFileNo}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="waterNo != null and waterNo != ''">
|
|
|
|
+ and water_no = #{waterNo}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createDate != null">
|
|
|
|
+ and create_date = #{createDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateDate != null">
|
|
|
|
+ and update_date = #{updateDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createBy != null and createBy != ''">
|
|
|
|
+ and create_by = #{createBy}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateBy != null and updateBy != ''">
|
|
|
|
+ and update_by = #{updateBy}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ and status = #{status}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="customerId != null">
|
|
|
|
+ and customer_id = #{customerId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="operation != null">
|
|
|
|
+ and operation = #{operation}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 新增所有列 -->
|
|
|
|
+ <insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
|
+ insert into sc_operating_valve_record(id, water_file_no, water_no, create_date, update_date, create_by,
|
|
|
|
+ update_by, status, customer_id, operation)
|
|
|
|
+ values (#{id}, #{waterFileNo}, #{waterNo}, #{createDate}, #{updateDate}, #{createBy}, #{updateBy}, #{status},
|
|
|
|
+ #{customerId}, #{operation})
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <!-- 批量新增 -->
|
|
|
|
+ <insert id="batchInsert">
|
|
|
|
+ insert into sc_operating_valve_record(id, water_file_no, water_no, create_date, update_date, create_by,
|
|
|
|
+ update_by, status, customer_id, operation)
|
|
|
|
+ values
|
|
|
|
+ <foreach collection="operatingValveRecords" item="item" index="index" separator=",">
|
|
|
|
+ (
|
|
|
|
+ #{item.id}, #{item.waterFileNo}, #{item.waterNo}, #{item.createDate}, #{item.updateDate}, #{item.createBy},
|
|
|
|
+ #{item.updateBy}, #{item.status}, #{item.customerId}, #{item.operation} )
|
|
|
|
+ </foreach>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <!-- 通过主键修改数据 -->
|
|
|
|
+ <update id="update">
|
|
|
|
+ update sc_operating_valve_record
|
|
|
|
+ <set>
|
|
|
|
+ <if test="waterFileNo != null and waterFileNo != ''">
|
|
|
|
+ water_file_no = #{waterFileNo},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="waterNo != null and waterNo != ''">
|
|
|
|
+ water_no = #{waterNo},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createDate != null">
|
|
|
|
+ create_date = #{createDate},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateDate != null">
|
|
|
|
+ update_date = #{updateDate},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createBy != null and createBy != ''">
|
|
|
|
+ create_by = #{createBy},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateBy != null and updateBy != ''">
|
|
|
|
+ update_by = #{updateBy},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ status = #{status},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="customerId != null">
|
|
|
|
+ customer_id = #{customerId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="operation != null">
|
|
|
|
+ operation = #{operation},
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <!--通过主键删除-->
|
|
|
|
+ <delete id="deleteById">
|
|
|
|
+ delete
|
|
|
|
+ from sc_operating_valve_record
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <!-- 总数 -->
|
|
|
|
+ <select id="count" resultType="int">
|
|
|
|
+ select count(*)
|
|
|
|
+ from sc_operating_valve_record
|
|
|
|
+ </select>
|
|
|
|
+ <update id="updateStatus">
|
|
|
|
+ update sc_operating_valve_record set status=0,update_date=now() where water_file_no=#{waterFileNo}
|
|
|
|
+ and customer_id=#{customerId}
|
|
|
|
+ </update>
|
|
|
|
+</mapper>
|