|
- <?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.WxEnergyMeterMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeter">
- <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="is_del" jdbcType="INTEGER" property="isDel"/>
- <result column="type" jdbcType="INTEGER" property="type"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="rate" jdbcType="VARCHAR" property="rate"/>
- <result column="physics_type" jdbcType="INTEGER" property="physicsType"/>
- <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
- <result column="has_fee" jdbcType="INTEGER" property="hasFee"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`rate`,`physics_type`,`shop_type`,`has_fee`
- </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 != isDel ">and `is_del` = #{isDel}</if>
- <if test=" null != type ">and `type` = #{type}</if>
- <if test=" null != physicsType ">and `physics_type` = #{physicsType}</if>
- <if test=" null != shopType ">and `shop_type` = #{shopType}</if>
- <if test=" null != name and '' != name ">and name like concat('%', #{name},'%')</if>
- <if test=" null != orName and '' != orName ">or name like concat('%', #{orName},'%')</if>
- <if test=" null != isRealMeter ">and `physics_type` in (1,2) </if>
- <if test=" null != hasFee ">and `has_fee` = #{hasFee}</if>
- <if test=" null != physicsTypeList ">
- and physics_type in
- <foreach collection="physicsTypeList" index="index" item="ptidItem" open="(" separator="," close=")">
- #{ptidItem}
- </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.WxEnergyMeter" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_energy_meter
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findIdList" parameterType="com.iformall.domain.po.WxEnergyMeter" resultType="Long">
- select id
- from wx_energy_meter
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_energy_meter where id = #{id} and `tenant_id` = #{tenantId}
- </select>
-
- <update id = "setIsDel" parameterType="HashMap">
- update wx_energy_meter set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId}
- </update>
-
- </mapper>
|