EnterpriseBranchMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.pm.enterpriseInfo.mapper.EnterpriseBranchMapper">
  6. <resultMap type="pd" id="EnterpriseBranchResult">
  7. <result property="branchId" column="branch_id" />
  8. <result property="enterpriseId" column="enterprise_id" />
  9. <result property="branchName" column="branch_name" />
  10. <result property="branchCode" column="branch_code" />
  11. <result property="branchType" column="branch_type" />
  12. <result property="address" column="address" />
  13. <result property="contactPerson" column="contact_person" />
  14. <result property="contactPhone" column="contact_phone" />
  15. <result property="longitude" column="longitude" />
  16. <result property="latitude" column="latitude" />
  17. <result property="status" column="status" />
  18. <result property="createBy" column="create_by" />
  19. <result property="createTime" column="create_time" />
  20. <result property="updateBy" column="update_by" />
  21. <result property="updateTime" column="update_time" />
  22. </resultMap>
  23. <sql id="selectEnterpriseBranchVo">
  24. select branch_id, enterprise_id, branch_name, branch_code, branch_type, address,
  25. contact_person, contact_phone, longitude, latitude, status, create_by,
  26. create_time, update_by, update_time
  27. from sys_enterprise_branch
  28. </sql>
  29. <select id="selectEnterpriseBranchList" parameterType="pd" resultMap="EnterpriseBranchResult">
  30. <include refid="selectEnterpriseBranchVo"/>
  31. <where>
  32. <if test="enterpriseId != null ">
  33. and enterprise_id = #{enterpriseId}
  34. </if>
  35. <if test="branchName != null and branchName != ''">
  36. and branch_name like concat('%', #{branchName}, '%')
  37. </if>
  38. <if test="branchCode != null and branchCode != ''">
  39. and branch_code = #{branchCode}
  40. </if>
  41. <if test="branchType != null and branchType != ''">
  42. and branch_type = #{branchType}
  43. </if>
  44. <if test="status != null and status != ''">
  45. and status = #{status}
  46. </if>
  47. </where>
  48. order by create_time desc
  49. </select>
  50. <select id="selectEnterpriseBranchByBranchId" parameterType="Long" resultMap="EnterpriseBranchResult">
  51. <include refid="selectEnterpriseBranchVo"/>
  52. where branch_id = #{branchId}
  53. </select>
  54. <select id="selectBranchesByEnterpriseId" parameterType="Long" resultMap="EnterpriseBranchResult">
  55. <include refid="selectEnterpriseBranchVo"/>
  56. where enterprise_id = #{enterpriseId}
  57. order by create_time desc
  58. </select>
  59. <insert id="insertEnterpriseBranch" parameterType="pd" useGeneratedKeys="true" keyProperty="branchId">
  60. insert into sys_enterprise_branch
  61. <trim prefix="(" suffix=")" suffixOverrides=",">
  62. <if test="enterpriseId != null">enterprise_id,</if>
  63. <if test="branchName != null and branchName != ''">branch_name,</if>
  64. <if test="branchCode != null and branchCode != ''">branch_code,</if>
  65. <if test="branchType != null">branch_type,</if>
  66. <if test="address != null">address,</if>
  67. <if test="contactPerson != null">contact_person,</if>
  68. <if test="contactPhone != null">contact_phone,</if>
  69. <if test="longitude != null">longitude,</if>
  70. <if test="latitude != null">latitude,</if>
  71. <if test="status != null">status,</if>
  72. <if test="createBy != null">create_by,</if>
  73. create_time,
  74. <if test="updateBy != null">update_by,</if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test="enterpriseId != null">#{enterpriseId},</if>
  78. <if test="branchName != null and branchName != ''">#{branchName},</if>
  79. <if test="branchCode != null and branchCode != ''">#{branchCode},</if>
  80. <if test="branchType != null">#{branchType},</if>
  81. <if test="address != null">#{address},</if>
  82. <if test="contactPerson != null">#{contactPerson},</if>
  83. <if test="contactPhone != null">#{contactPhone},</if>
  84. <if test="longitude != null">#{longitude},</if>
  85. <if test="latitude != null">#{latitude},</if>
  86. <if test="status != null">#{status},</if>
  87. <if test="createBy != null">#{createBy},</if>
  88. sysdate(),
  89. <if test="updateBy != null">#{updateBy},</if>
  90. </trim>
  91. </insert>
  92. <update id="updateEnterpriseBranch" parameterType="pd">
  93. update sys_enterprise_branch
  94. <trim prefix="SET" suffixOverrides=",">
  95. <if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
  96. <if test="branchName != null and branchName != ''">branch_name = #{branchName},</if>
  97. <if test="branchCode != null and branchCode != ''">branch_code = #{branchCode},</if>
  98. <if test="branchType != null">branch_type = #{branchType},</if>
  99. <if test="address != null">address = #{address},</if>
  100. <if test="contactPerson != null">contact_person = #{contactPerson},</if>
  101. <if test="contactPhone != null">contact_phone = #{contactPhone},</if>
  102. <if test="longitude != null">longitude = #{longitude},</if>
  103. <if test="latitude != null">latitude = #{latitude},</if>
  104. <if test="status != null">status = #{status},</if>
  105. <if test="updateBy != null">update_by = #{updateBy},</if>
  106. update_time = sysdate(),
  107. </trim>
  108. where branch_id = #{branchId}
  109. </update>
  110. <delete id="deleteEnterpriseBranchByBranchId" parameterType="Long">
  111. delete from sys_enterprise_branch where branch_id = #{branchId}
  112. </delete>
  113. <delete id="deleteEnterpriseBranchByBranchIds" parameterType="String">
  114. delete from sys_enterprise_branch where branch_id in
  115. <foreach item="branchId" collection="array" open="(" separator="," close=")">
  116. #{branchId}
  117. </foreach>
  118. </delete>
  119. </mapper>