RepairConsumeMapper.xml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.RepairConsumeMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.repair.model.vo.ConsumeVo" id="repairConsumeMap">
  6. <result property="id" column="id"/>
  7. <result property="name" column="name"/>
  8. <result property="price" column="price"/>
  9. <result property="schoolName" column="school_name"/>
  10. <result property="artileName" column="artile_name"/>
  11. <result property="entryName" column="entry_name"/>
  12. <result property="updateTime" column="update_time"/>
  13. </resultMap>
  14. <select id="queryConsumeList" resultType="com.repair.model.vo.ConsumeVo" resultMap="repairConsumeMap">
  15. SELECT rc.id,rc.name,rc.price,rae.name as school_name,ra.username as entry_name,ra.update_time ,(select GROUP_CONCAT(name) from repair_article_type where find_in_set(id,rc.article_id) and deleted) as artile_name FROM `repair_consume` rc
  16. left join repair_admin ra on ra.id = rc.update_user and ra.deleted = 0
  17. left join repair_area rae on rae.id = rc.school_id and rae.deleted = 0
  18. <where>
  19. and rc.deleted = 0
  20. <if test="name != null and name != ''">
  21. and rc.name like '%' #{name} '%'
  22. </if>
  23. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  24. and rc.update_time BETWEEN #{startTime} and #{endTime}
  25. </if>
  26. </where>
  27. </select>
  28. <resultMap type="com.repair.model.vo.RepairConsumeVo" id="repairConsumePageMap">
  29. <result property="id" column="id"/>
  30. <result property="name" column="name"/>
  31. <result property="content" column="content"/>
  32. <result property="price" column="price"/>
  33. <result property="articleId" column="article_id"/>
  34. <result property="userName" column="user_name"/>
  35. <result property="articleName" column="article_name"/>
  36. <result property="updateTime" column="update_time"/>
  37. <result property="schoolId" column="school_id"/>
  38. </resultMap>
  39. <select id="queryConsumePageList" resultType="com.repair.model.vo.RepairConsumeVo" resultMap="repairConsumePageMap">
  40. select rc.school_id,rc.update_time,rc.id,rc.name,rc.content,rc.price,rc.article_id,ra.username as user_name,(select GROUP_CONCAT(name) from repair_article_type where find_in_set(id,rc.article_id)) as article_name from repair_consume rc
  41. left join repair_admin ra on rc.update_user = ra.id and ra.deleted = 0
  42. <where>
  43. and rc.deleted = 0
  44. <if test="name != null and name != ''">
  45. and rc.name like '%' #{name} '%'
  46. </if>
  47. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  48. and rc.update_time BETWEEN #{startTime} and #{endTime}
  49. </if>
  50. </where>
  51. </select>
  52. <resultMap type="com.repair.model.vo.RepairArticleConsumeVo" id="repairArticleConsumeMap">
  53. <result property="id" column="id"/>
  54. <result property="name" column="name"/>
  55. <result property="articleId" column="article_id"/>
  56. <result property="price" column="price"/>
  57. </resultMap>
  58. <select id="queryArticleConsumes" resultType="com.repair.model.vo.RepairArticleConsumeVo" resultMap="repairArticleConsumeMap">
  59. select id,article_id,name,price from repair_consume
  60. <where>
  61. and deleted =0
  62. <if test="schoolId != null and schoolId != ''">
  63. and school_id = #{schoolId}
  64. </if>
  65. <if test="keyWork != null and keyWork != ''">
  66. and name like '%' #{keyWork} '%'
  67. </if>
  68. <if test="findInSet != null and findInSet != ''">
  69. and (${findInSet})
  70. </if>
  71. </where>
  72. </select>
  73. <select id="queryArticleConsumesName" resultType="com.repair.model.vo.RepairArticleConsumeVo">
  74. select id,article_id,name,price from repair_consume
  75. <where>
  76. and deleted =0
  77. <if test="schoolId != null and schoolId != ''">
  78. and school_id = #{schoolId}
  79. </if>
  80. <if test="findInSet != null and findInSet != ''">
  81. and (${findInSet})
  82. </if>
  83. </where>
  84. </select>
  85. </mapper>