OrgMacMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.dk.mdm.mapper.mst.OrgMacMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. org_id, mac_id, display_no, flg_default, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
  8. </sql>
  9. <!-- 通用查询映射结果 -->
  10. <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.OrgMac">
  11. <id column="org_id" property="orgId"/>
  12. <result column="mac_id" property="macId" typeHandler="UuidTypeHandler"/>
  13. <result column="display_no" property="displayNo"/>
  14. <result column="flg_default" property="flgDefault"/>
  15. <result column="cp_id" property="cpId"/>
  16. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  17. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  18. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  19. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  20. <result column="op_app_code" property="opAppCode"/>
  21. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  22. <result column="op_db_user" property="opDbUser"/>
  23. </resultMap>
  24. <!-- 通用条件列 -->
  25. <sql id="Condition">
  26. <where>
  27. <if test="macId != null and macId != ''">
  28. AND mac_id = #{macId}
  29. </if>
  30. <if test="displayNo != null">
  31. AND display_no = #{displayNo}
  32. </if>
  33. <if test="flgDefault != null">
  34. AND flg_default = #{flgDefault}
  35. </if>
  36. <if test="cpId != null">
  37. AND cp_id = #{cpId}
  38. </if>
  39. <if test="opCreateTime != null">
  40. AND op_create_time = #{opCreateTime}
  41. </if>
  42. <if test="opCreateUserId != null and opCreateUserId != ''">
  43. AND op_create_user_id = #{opCreateUserId}
  44. </if>
  45. <if test="opUpdateTime != null">
  46. AND op_update_time = #{opUpdateTime}
  47. </if>
  48. <if test="opUpdateUserId != null and opUpdateUserId != ''">
  49. AND op_update_user_id = #{opUpdateUserId}
  50. </if>
  51. <if test="opAppCode != null and opAppCode != ''">
  52. AND op_app_code = #{opAppCode}
  53. </if>
  54. <if test="opTimestamp != null">
  55. AND op_timestamp = #{opTimestamp}
  56. </if>
  57. <if test="opDbUser != null and opDbUser != ''">
  58. AND op_db_user = #{opDbUser}
  59. </if>
  60. </where>
  61. </sql>
  62. <sql id="idsForeach">
  63. <!-- 根据主键orgId批量操作 -->
  64. WHERE org_id in
  65. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  66. #{item}
  67. </foreach>
  68. </sql>
  69. <!-- 查询表t_mst_org_mac,(条件查询+分页)列表 -->
  70. <select id="selectByCond" resultMap="BaseResultMap">
  71. SELECT
  72. <include refid="Base_Column_List"/>
  73. FROM t_mst_org_mac
  74. <include refid="Condition"/>
  75. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  76. limit #{end} offset #{start}
  77. </if>
  78. </select>
  79. <!-- 查询表t_mst_org_mac,(条件查询)个数 -->
  80. <select id="countByCond" resultType="Long">
  81. SELECT
  82. count(1)
  83. FROM t_mst_org_mac
  84. <include refid="Condition"/>
  85. </select>
  86. <!-- 根据主键查询表t_mst_org_mac的一行数据 -->
  87. <select id="selectById" resultMap="BaseResultMap">
  88. SELECT
  89. <include refid="Base_Column_List"/>
  90. FROM t_mst_org_mac
  91. WHERE org_id = #{orgId}::uuid
  92. </select>
  93. <!-- 根据主键锁定表t_mst_org_mac的一行数据 -->
  94. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  95. SELECT
  96. <include refid="Base_Column_List"/>
  97. FROM t_mst_org_mac
  98. WHERE org_id = #{orgId}
  99. for update
  100. </select>
  101. <delete id="deleteByOrgId">
  102. DELETE FROM dkic_b.t_mst_org_mac WHERE org_id = #{orgId}::uuid
  103. </delete>
  104. </mapper>