StoreMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.platform.dao.mapper.store.StoreMapper">
  4. <sql id="Base_Column_List">
  5. store.id,
  6. store.level,
  7. store.no,
  8. store.use_company,
  9. store.use_project,
  10. store.user_id,
  11. store.name,
  12. store.type,
  13. store.sort,
  14. store.del_flag,
  15. store.parent_id,
  16. store.remark,
  17. store.created_user_id,
  18. store.created_user_name,
  19. store.update_user_id,
  20. store.update_user_name,
  21. store.created_time,
  22. store.update_time
  23. </sql>
  24. <sql id="Ref_Column_List">
  25. store.no,
  26. store.level,
  27. store.use_company,
  28. store.use_project,
  29. store.user_id,
  30. store.name,
  31. store.type,
  32. store.sort,
  33. store.del_flag,
  34. store.parent_id,
  35. store.remark
  36. </sql>
  37. <sql id="List_Condition">
  38. <if test="id != null and id != ''">
  39. and store.id = #{id}
  40. </if>
  41. <if test="level != null and level != ''">
  42. and store.level = #{level}
  43. </if>
  44. <if test="levelList != null and levelList.size > 0">
  45. AND store.level in
  46. <foreach item="item" index="index" collection="levelList" open="(" close=")" separator=",">
  47. #{item}
  48. </foreach>
  49. </if>
  50. <if test="no != null and no != ''">
  51. and store.no = #{no}
  52. </if>
  53. <if test="useCompany != null and useCompany != ''">
  54. and store.use_company = #{useCompany}
  55. </if>
  56. <if test="useProject != null and useProject != ''">
  57. and store.use_project = #{useProject}
  58. </if>
  59. <if test="userId != null and userId != ''">
  60. and store.user_id = #{userId}
  61. </if>
  62. <if test="name != null and name != ''">
  63. and store.name = #{name}
  64. </if>
  65. <if test="type != null">
  66. and store.type = #{type}
  67. </if>
  68. <if test="sort != null">
  69. and store.sort = #{sort}
  70. </if>
  71. <if test="delFlag != null">
  72. and store.del_flag = #{delFlag}
  73. </if>
  74. <if test="parentId != null and parentId != ''">
  75. and store.parent_id = #{parentId}
  76. </if>
  77. <if test="remark != null and remark != ''">
  78. and store.remark = #{remark}
  79. </if>
  80. <if test="createdUserId != null and createdUserId != ''">
  81. and store.created_user_id = #{createdUserId}
  82. </if>
  83. <if test="createdUserName != null and createdUserName != ''">
  84. and store.created_user_name = #{createdUserName}
  85. </if>
  86. <if test="updateUserId != null and updateUserId != ''">
  87. and store.update_user_id = #{updateUserId}
  88. </if>
  89. <if test="updateUserName != null and updateUserName != ''">
  90. and store.update_user_name = #{updateUserName}
  91. </if>
  92. <if test="createdTimeStart != null">
  93. and store.created_time <![CDATA[>=]]>; #{createdTimeStart}
  94. </if>
  95. <if test="createdTimeEnd != null">
  96. and store.created_time <![CDATA[<=]]> #{createdTimeEnd}
  97. </if>
  98. <if test="createdTime != null">
  99. and store.created_time = #{createdTime}
  100. </if>
  101. <if test="updateTimeStart != null">
  102. and store.update_time <![CDATA[>=]]>; #{updateTimeStart}
  103. </if>
  104. <if test="updateTimeEnd != null">
  105. and store.update_time <![CDATA[<=]]> #{updateTimeEnd}
  106. </if>
  107. <if test="updateTime != null">
  108. and store.update_time = #{updateTime}
  109. </if>
  110. <if test="keyword != null and keyword != ''">
  111. and (store.name like concat('%',#{keyword},'%')
  112. or store.no like concat('%',#{keyword},'%'))
  113. </if>
  114. </sql>
  115. <select id="selectList" parameterType="com.platform.dao.dto.store.StoreDTO"
  116. resultType="com.platform.dao.vo.query.store.StoreVO">
  117. select store.*, pstore.name parentName, user.real_name as userName
  118. from t_store as store
  119. left join t_store pstore on store.parent_id = pstore.id
  120. left join t_sys_user user on store.user_id = user.user_id
  121. <where>
  122. <include refid="List_Condition"/>
  123. </where>
  124. order by store.sort asc
  125. </select>
  126. </mapper>