RepairConsumablesMapper.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.repair.mapper.RepairConsumablesMapper">
  4. <resultMap type="com.repair.model.vo.ConsumablePageVo" id="repairConsumablePageMap">
  5. <result property="id" column="id"/>
  6. <result property="consumeName" column="consume_name"/>
  7. <result property="price" column="price"/>
  8. <result property="number" column="number"/>
  9. <result property="totalPrice" column="total_price"/>
  10. <result property="articleName" column="article_name"/>
  11. <result property="recordNo" column="record_no"/>
  12. <result property="reportTime" column="report_time"/>
  13. <result property="updateTime" column="update_time"/>
  14. </resultMap>
  15. <select id="queryConsumablePageList" resultType="com.repair.model.vo.ConsumablePageVo" resultMap="repairConsumablePageMap">
  16. select rcs.id,rcs.consume_name,rcs.price,rcs.number,rcs.total_price,(select GROUP_CONCAT(name) from repair_article_type where find_in_set(id,rc.article_id) and deleted = 0) as article_name
  17. ,rr.record_no,rr.report_time,rcs.update_time from repair_consumables rcs
  18. left join repair_consume rc on rc.deleted = 0 and rc.id = rcs.consume_id
  19. left join repair_record rr on rr.deleted = 0 and rr.id = rcs.record_id
  20. <where>
  21. and rcs.deleted = 0
  22. <if test="keyWord != null and keyWord != ''">
  23. and (rcs.consume_name like '%' #{keyWord} '%' or rr.record_no like '%' #{keyWord} '%')
  24. </if>
  25. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  26. and rcs.update_time BETWEEN #{startTime} and #{endTime}
  27. </if>
  28. </where>
  29. order by rr.report_time desc,rcs.update_time desc
  30. </select>
  31. <resultMap type="com.repair.model.vo.ConsumableExcelVo" id="repairConsumableExcelMap">
  32. <result property="id" column="id"/>
  33. <result property="consumeName" column="consume_name"/>
  34. <result property="price" column="price"/>
  35. <result property="number" column="number"/>
  36. <result property="totalPrice" column="total_price"/>
  37. <result property="articleName" column="article_name"/>
  38. <result property="recordNo" column="record_no"/>
  39. <result property="reportTime" column="report_time"/>
  40. <result property="updateTime" column="update_time"/>
  41. </resultMap>
  42. <select id="queryConsumableExcelList" resultType="com.repair.model.vo.ConsumableExcelVo" resultMap="repairConsumableExcelMap">
  43. select rcs.id,rcs.consume_name,rcs.price,rcs.number,rcs.total_price,(select GROUP_CONCAT(name) from repair_article_type where find_in_set(id,rc.article_id) and deleted = 0) as article_name
  44. ,rr.record_no,rr.report_time,rcs.update_time from repair_consumables rcs
  45. left join repair_consume rc on rc.deleted = 0 and rc.id = rcs.consume_id
  46. left join repair_record rr on rr.deleted = 0 and rr.id = rcs.record_id
  47. <where>
  48. and rcs.deleted = 0
  49. <if test="keyWord != null and keyWord != ''">
  50. and (rcs.consume_name like '%' #{keyWord} '%' or rr.record_no like '%' #{keyWord} '%')
  51. </if>
  52. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  53. and rcs.update_time BETWEEN #{startTime} and #{endTime}
  54. </if>
  55. </where>
  56. order by rr.report_time desc,rcs.update_time desc
  57. </select>
  58. </mapper>