CommonMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.steerinfo.dil.mapper.CommonMapper">
  4. <sql id="orderBy">
  5. <if test="orderByField!=null and orderByField !=''">
  6. order by "${orderByField}"
  7. <if test="orderByType == 'desc'">
  8. desc
  9. </if>
  10. <if test="orderByType == 'asc'">
  11. asc
  12. </if>
  13. </if>
  14. </sql>
  15. <sql id="rootCompanyFilter">
  16. <if test="rootCompanyMap != null and urlFlag != null and urlFlag != 'null' and urlFlag != ''">
  17. AND ("rootCompanyId" = #{rootCompanyMap.rootCompanyId}
  18. OR #{urlFlag} = (SELECT IS_LISTED FROM RMS_COMPANY WHERE COMPANY_ID = "rootCompanyId")
  19. )
  20. </if>
  21. </sql>
  22. <sql id="filterCompanyData">
  23. <if test="roleCodes != null and roleCodes.size > 0 and dilCompanyList != null and dilCompanyList.size > 0" >
  24. AND
  25. <foreach collection="roleCodes" index="index" item="item" separator="or" close=")" open="(">
  26. <choose>
  27. <when test="item == 'chengYunShang'">
  28. "carrierId"
  29. in
  30. <foreach collection="dilCompanyList" open="(" close=")" separator="," item="item" index="index">
  31. #{item.companyId}
  32. </foreach>
  33. </when>
  34. <when test="item == 'shippingCompany'">
  35. "shippingCompanyId"
  36. in
  37. <foreach collection="dilCompanyList" open="(" close=")" separator="," item="item" index="index">
  38. #{item.companyId}
  39. </foreach>
  40. </when>
  41. <when test="item == 'receivingCompany'">
  42. "receivingCompanyId"
  43. in
  44. <foreach collection="dilCompanyList" open="(" close=")" separator="," item="item" index="index">
  45. #{item.companyId}
  46. </foreach>
  47. </when>
  48. <when test="item == 'businessCompany'">
  49. "businessCompanyId"
  50. in
  51. <foreach collection="dilCompanyList" open="(" close=")" separator="," item="item" index="index">
  52. #{item.companyId}
  53. </foreach>
  54. </when>
  55. <when test="item == 'approveBusinessCompany'">
  56. "approveBusinessCompanyId"
  57. in
  58. <foreach collection="dilCompanyList" open="(" close=")" separator="," item="item" index="index">
  59. #{item.companyId}
  60. </foreach>
  61. </when>
  62. <when test="item.contains('admin')">
  63. 1 = 1
  64. </when>
  65. <when test="item.contains('siji')">
  66. 1 = 1
  67. </when>
  68. <otherwise>
  69. 1 != 1
  70. </otherwise>
  71. </choose>
  72. </foreach>
  73. </if>
  74. </sql>
  75. </mapper>