DeviceAttributeMapper.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.huaxu.dao.DeviceAttributeMapper">
  6. <resultMap type="DeviceAttributeEntity" id="DeviceAttributeResult">
  7. <result property="id" column="id"/>
  8. <result property="name" column="name"/>
  9. <result property="identifier" column="identifier"/>
  10. <result property="dataType" column="data_type"/>
  11. <result property="description" column="description"/>
  12. <result property="unit" column="unit"/>
  13. <result property="deviceModeId" column="device_mode_id"/>
  14. <result property="status" column="status"/>
  15. <result property="dateCreate" column="date_create"/>
  16. <result property="createBy" column="create_by"/>
  17. <result property="dateUpdate" column="date_update"/>
  18. <result property="updateBy" column="update_by"/>
  19. </resultMap>
  20. <!-- 实体栏位 -->
  21. <sql id="deviceAttributeColumns">
  22. a.id as "id" ,
  23. a.name as "name" ,
  24. a.identifier as "identifier" ,
  25. a.data_type as "dataType" ,
  26. a.description as "description" ,
  27. a.unit as "unit" ,
  28. a.device_mode_id as "deviceModeId" ,
  29. a.status as "status" ,
  30. a.date_create as "dateCreate" ,
  31. a.create_by as "createBy" ,
  32. a.date_update as "dateUpdate" ,
  33. a.update_by as "updateBy"
  34. </sql>
  35. <!-- 根据主键获取实体 -->
  36. <select id="findDeviceAttributeById" resultType="com.huaxu.entity.DeviceAttributeEntity">
  37. SELECT
  38. <include refid="deviceAttributeColumns"/>
  39. FROM sms_device_attribute a
  40. WHERE a.id = #{id}
  41. </select>
  42. <!-- 根据获取实体List -->
  43. <select id="findList" resultType="com.huaxu.entity.DeviceAttributeEntity">
  44. SELECT
  45. <include refid="deviceAttributeColumns"/>
  46. FROM sms_device_attribute a
  47. <where>
  48. <if test="name != null and name != ''">
  49. and a.name LIKE concat('%',#{name},'%')
  50. </if>
  51. </where>
  52. </select>
  53. <!-- 根据获取实体 page -->
  54. <select id="findPage" resultType="com.huaxu.entity.DeviceAttributeEntity">
  55. SELECT
  56. <include refid="deviceAttributeColumns"/>
  57. FROM sms_device_attribute a
  58. <where>
  59. <if test="deviceAttribute.name != null and deviceAttribute.name != ''">
  60. and a.name LIKE concat('%',#{deviceAttribute.name},'%')
  61. </if>
  62. </where>
  63. </select>
  64. </mapper>