SysTenantMapper.xml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.bizmatics.persistence.mapper.SysTenantMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.bizmatics.model.SysTenant">
  6. <id column="id" property="id" />
  7. <result column="tenant_code" property="tenantCode" />
  8. <result column="tenant_name" property="tenantName" />
  9. <result column="tenant_manager" property="tenantManager" />
  10. <result column="tenant_type" property="tenantType" />
  11. <result column="domain" property="domain" />
  12. <result column="email" property="email" />
  13. <result column="phone_number" property="phoneNumber" />
  14. <result column="address" property="address" />
  15. <result column="geo_position" property="geoPosition" />
  16. <result column="tenant_term" property="tenantTerm" />
  17. <result column="remark" property="remark" />
  18. <result column="status" property="status" />
  19. <result column="create_by" property="createBy" />
  20. <result column="create_time" property="createTime" />
  21. <result column="update_by" property="updateBy" />
  22. <result column="update_time" property="updateTime" />
  23. <result column="system_name" property="systemName" />
  24. </resultMap>
  25. <select id="getUserData" resultType="com.bizmatics.model.vo.SysTenantVo">
  26. SELECT
  27. a.*,b.id,b.tenant_code,b.tenant_name,b.tenant_manager,b.tenant_type,b.domain,b.tenant_term,b.system_name
  28. FROM
  29. sys_user AS a
  30. LEFT JOIN sys_tenant AS b ON a.tenant_id = b.id
  31. <where>
  32. a.user_id = #{userId}
  33. </where>
  34. </select>
  35. <select id="getTenantData" resultType="com.bizmatics.model.SysTenant">
  36. SELECT
  37. *
  38. FROM
  39. sys_tenant
  40. <where>
  41. <if test="tenantName != null and tenantName != ''">
  42. and tenant_name LIKE CONCAT(CONCAT('%', #{tenantName}), '%')
  43. </if>
  44. <if test="tenantManager != null and tenantManager != ''">
  45. and tenant_manager LIKE CONCAT(CONCAT('%', #{tenantManager}), '%')
  46. </if>
  47. <if test="tenantType != null and tenantType != ''">
  48. and tenant_type = #{tenantType}
  49. </if>
  50. <if test="status != null and status != ''">
  51. and status = #{status}
  52. </if>
  53. <if test="endTime != null and startTime != null and endTime != '' and startTime != ''">
  54. and tenant_term BETWEEN #{startTime} and #{endTime}
  55. </if>
  56. </where>
  57. <if test="current != null and size != null and size != 0">
  58. limit #{current},#{size}
  59. </if>
  60. </select>
  61. </mapper>