You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

80 lines
3.3 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.iformall.mapper.WxEnergyMeterMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeter">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  9. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  10. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  11. <result column="type" jdbcType="INTEGER" property="type"/>
  12. <result column="name" jdbcType="VARCHAR" property="name"/>
  13. <result column="rate" jdbcType="VARCHAR" property="rate"/>
  14. <result column="physics_type" jdbcType="INTEGER" property="physicsType"/>
  15. <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
  16. <result column="has_fee" jdbcType="INTEGER" property="hasFee"/>
  17. </resultMap>
  18. <sql id="allColumns">
  19. `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`rate`,`physics_type`,`shop_type`,`has_fee`
  20. </sql>
  21. <sql id="dynamicWhereConditions">
  22. where 1=1
  23. <if test=" null != id ">and `id` = #{id}</if>
  24. <if test=" null != tenantId and '' != tenantId">
  25. and `tenant_id` = #{tenantId}
  26. </if>
  27. <if test=" null != parentTenantId and '' != parentTenantId">
  28. and `parent_tenant_id` = #{parentTenantId}
  29. </if>
  30. <if test=" null != isDel ">and `is_del` = #{isDel}</if>
  31. <if test=" null != type ">and `type` = #{type}</if>
  32. <if test=" null != physicsType ">and `physics_type` = #{physicsType}</if>
  33. <if test=" null != shopType ">and `shop_type` = #{shopType}</if>
  34. <if test=" null != name and '' != name ">and name like concat('%', #{name},'%')</if>
  35. <if test=" null != orName and '' != orName ">or name like concat('%', #{orName},'%')</if>
  36. <if test=" null != isRealMeter ">and `physics_type` in (1,2) </if>
  37. <if test=" null != hasFee ">and `has_fee` = #{hasFee}</if>
  38. <if test=" null != physicsTypeList ">
  39. and physics_type in
  40. <foreach collection="physicsTypeList" index="index" item="ptidItem" open="(" separator="," close=")">
  41. #{ptidItem}
  42. </foreach>
  43. </if>
  44. <if test=" null != ids ">
  45. and id in
  46. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  47. #{idItem}
  48. </foreach>
  49. </if>
  50. <if test=" null != sortColumns">order by ${sortColumns}</if>
  51. </sql>
  52. <select id="findList" parameterType="com.iformall.domain.po.WxEnergyMeter" resultMap="BaseResultMap">
  53. select
  54. <include refid="allColumns"/>
  55. from wx_energy_meter
  56. <include refid="dynamicWhereConditions"/>
  57. </select>
  58. <select id="findIdList" parameterType="com.iformall.domain.po.WxEnergyMeter" resultType="Long">
  59. select id
  60. from wx_energy_meter
  61. <include refid="dynamicWhereConditions"/>
  62. </select>
  63. <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
  64. select
  65. <include refid="allColumns"/>
  66. from wx_energy_meter where id = #{id} and `tenant_id` = #{tenantId}
  67. </select>
  68. <update id = "setIsDel" parameterType="HashMap">
  69. update wx_energy_meter set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId}
  70. </update>
  71. </mapper>