|
- <?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.iformall.mapper.WxEnergyMeterReadingMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeterReading">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
- <result column="cur_number" jdbcType="VARCHAR" property="curNumber"/>
- <result column="pre_number" jdbcType="VARCHAR" property="preNumber"/>
- <result column="pre_time" jdbcType="TIMESTAMP" property="preTime"/>
- <result column="pre_by" jdbcType="BIGINT" property="preBy"/>
- <result column="pre_by_name" jdbcType="VARCHAR" property="preByName"/>
- <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
- <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
- <result column="create_by" jdbcType="BIGINT" property="createBy"/>
- <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/>
- <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
- <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="meter_id" jdbcType="BIGINT" property="meterId"/>
- <result column="meter_type" jdbcType="INTEGER" property="meterType"/>
- <result column="meter_rate" jdbcType="VARCHAR" property="meterRate"/>
- <result column="meter_name" jdbcType="VARCHAR" property="meterName"/>
- <result column="is_del" jdbcType="INTEGER" property="isDel"/>
- <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
- <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
- <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`cur_number`,`pre_number`,`pre_time`,`pre_by`,`pre_by_name`,`start_time`,`end_time`,`create_by`,`create_by_name`,
- `update_by`,`update_by_name`,`remark`,`meter_id`,`meter_type`,`meter_rate`,`meter_name`,`is_del`,`building_name`,`floor_name`,`shop_name`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1=1
- <if test=" null != id ">and `id` = #{id}</if>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != createBy ">and `create_by` = #{createBy}</if>
- <if test=" null != meterId ">and `meter_id` = #{meterId}</if>
- <if test=" null != meterType ">and `meter_type` = #{meterType}</if>
- <if test=" null != meterName and '' != meterName ">and meter_name like concat('%', #{meterName},'%')</if>
- <if test=" null != isDel ">and `is_del` = #{isDel}</if>
- <if test=" null != createByName and '' != createByName ">and create_by_name like concat('%', #{createByName},'%')</if>
- <if test=" null != shopIds ">
- and shop_id in
- <foreach collection="shopIds" index="index" item="sidItem" open="(" separator="," close=")">
- #{sidItem}
- </foreach>
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxEnergyMeterReading" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_energy_meter_reading
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_energy_meter_reading where id = #{id} and `tenant_id` = #{tenantId}
- </select>
-
- <update id = "setIsDel" parameterType="HashMap">
- update wx_energy_meter_reading set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId}
- </update>
-
- </mapper>
|