shopDeviceMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.ydd.module.mapper.ShopDeviceMapper">
  6. <resultMap type="ShopDevice" id="ShopDeviceResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="merchantId" column="merchant_id" />
  10. <result property="shopId" column="shop_id" />
  11. <result property="deviceId" column="device_id" />
  12. <result property="deviceSn" column="device_sn" />
  13. <result property="deviceSecret" column="device_secret" />
  14. <result property="onlineStatus" column="online_status" />
  15. <result property="status" column="status" />
  16. <result property="remark" column="remark" />
  17. </resultMap>
  18. <select id="findList" resultType="com.ydd.module.dto.DeviceDto">
  19. select sd.*,d.name as deviceName,d.img
  20. from lb_shop_device as sd
  21. left join lb_device as d
  22. on d.id = sd.device_id
  23. where sd.deleted=0 and sd.shop_id = #{shopId}
  24. <if test="deviceType == 2">
  25. and sd.device_type&gt;=21 and sd.device_type&lt;=27
  26. </if>
  27. <if test="deviceType != 2">
  28. and sd.device_type like concat(#{deviceType}, '%')
  29. </if>
  30. </select>
  31. <select id="findDetail" resultType="com.ydd.module.dto.ShopDeviceDto">
  32. select *
  33. from lb_shop_device
  34. where id = #{id}
  35. </select>
  36. <select id="queryList" resultType="com.ydd.module.domain.ShopDevice">
  37. SELECT sd.*
  38. FROM lb_shop_device sd
  39. LEFT JOIN lb_merchant m on sd.merchant_id = m.id
  40. WHERE 1=1 AND sd.device_type != 11 AND sd.deleted = 0
  41. <if test="params.dadaDspId != null">
  42. <if test="params.dadaDspId != 0">
  43. AND m.dada_dsp_id = #{params.dadaDspId}
  44. </if>
  45. <if test="params.dadaDspId == 0">
  46. AND m.dada_dsp_id is not null
  47. </if>
  48. </if>
  49. <if test="params.merchantId != null and params.merchantId != ''">
  50. AND sd.merchant_id = #{params.merchantId}
  51. </if>
  52. <if test="params.shopId != null and params.shopId != ''">
  53. AND sd.shop_id = #{params.shopId}
  54. </if>
  55. <if test="params.deviceId != null and params.deviceId != ''">
  56. AND sd.device_id = #{params.deviceId}
  57. </if>
  58. <if test="params.deviceName != null">
  59. AND sd.name like concat('%', #{params.deviceName}, '%')
  60. </if>
  61. <if test="params.deviceType != null">
  62. AND sd.device_type = #{params.deviceType}
  63. </if>
  64. <if test="params.deviceId != null and params.deviceId != ''">
  65. AND sd.device_id = #{params.deviceId}
  66. </if>
  67. <if test="params.deviceSn != null and params.deviceSn != ''">
  68. AND sd.device_sn like concat('%', #{params.deviceSn}, '%')
  69. </if>
  70. <if test="params.onlineStatus != null">
  71. AND sd.online_status = #{params.onlineStatus}
  72. </if>
  73. <if test="params.status != null">
  74. AND sd.status = #{params.status}
  75. </if>
  76. <if test="ids != null">
  77. AND sd.merchant_id IN
  78. <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
  79. #{item}
  80. </foreach>
  81. </if>
  82. ORDER BY sd.create_time DESC
  83. </select>
  84. <select id="findByDeviceSn" resultType="com.ydd.module.domain.ShopDevice">
  85. select id,`name`,merchant_id,shop_id,device_id,device_type,device_name from lb_shop_device where device_sn = #{deviceSn} and deleted = 0
  86. </select>
  87. <select id="findUsbPrintList" resultType="com.ydd.module.dto.ShopDeviceDto">
  88. select
  89. id,
  90. name,
  91. status,
  92. device_id,
  93. device_name,
  94. width,
  95. print_customer_count,
  96. print_merchant_count,
  97. print_kitchen_count,
  98. open_order_print,
  99. open_order_cancel_print
  100. from lb_shop_device
  101. where shop_id = #{shopId}
  102. and device_type = 99
  103. and deleted = 0
  104. and status = 1
  105. </select>
  106. </mapper>