CompanyMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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.fs.company.mapper.CompanyMapper">
  6. <resultMap type="Company" id="CompanyResult">
  7. <result property="companyId" column="company_id" />
  8. <result property="companyName" column="company_name" />
  9. <result property="companyMobile" column="company_mobile" />
  10. <result property="companyAddress" column="company_address" />
  11. <result property="createTime" column="create_time" />
  12. <result property="updateTime" column="update_time" />
  13. <result property="status" column="status" />
  14. <result property="startTime" column="start_time" />
  15. <result property="limitTime" column="limit_time" />
  16. <result property="money" column="money" />
  17. <result property="tuiMoney" column="tui_money" />
  18. <result property="voiceApiId" column="voice_api_id" />
  19. <result property="companyType" column="company_type" />
  20. <result property="userId" column="user_id" />
  21. <result property="appId" column="app_id" />
  22. <result property="appKey" column="app_kdy" />
  23. <result property="appKey" column="app_kdy" />
  24. <result property="remark" column="remark" />
  25. <result property="linkName" column="link_name" />
  26. <result property="limitUserCount" column="limit_user_count" />
  27. <result property="isDel" column="is_del" />
  28. <result property="voiceCallerNumber" column="voice_caller_number" />
  29. <result property="omsCode" column="oms_code" />
  30. <result property="manager" column="manager" />
  31. <result property="followDoctorIds" column="follow_doctor_ids" />
  32. <result property="doctorIds" column="doctor_ids" />
  33. <result property="restartTime" column="restart_time" />
  34. <result property="packageCateIds" column="package_cate_ids" />
  35. <result property="courseMaAppId" column="course_ma_app_id" />
  36. <result property="courseMiniAppId" column="course_mini_app_id" />
  37. </resultMap>
  38. <sql id="selectCompanyVo">
  39. select * from company
  40. </sql>
  41. <select id="selectCompanyList" parameterType="Company" resultMap="CompanyResult">
  42. <include refid="selectCompanyVo"/>
  43. <where>
  44. <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
  45. <if test="companyMobile != null and companyMobile != ''"> and company_mobile = #{companyMobile}</if>
  46. <if test="companyAddress != null and companyAddress != ''"> and company_address = #{companyAddress}</if>
  47. <if test="status != null "> and status = #{status}</if>
  48. <if test="money != null "> and money = #{money}</if>
  49. <if test="isDel != null "> and is_del = #{isDel}</if>
  50. <if test="voiceApiId != null "> and voice_api_id = #{voiceApiId}</if>
  51. <if test="restartTime != null "> and restart_time = #{restartTime}</if>
  52. <if test="packageCateIds != null "> and package_cate_ids = #{packageCateIds}</if>
  53. <if test="courseMaAppId != null "> and course_ma_app_id = #{courseMaAppId}</if>
  54. <if test="courseMiniAppId != null "> and course_mini_app_id = #{courseMiniAppId}</if>
  55. </where>
  56. </select>
  57. <select id="selectCompanyById" parameterType="Long" resultMap="CompanyResult">
  58. <include refid="selectCompanyVo"/>
  59. where company_id = #{companyId}
  60. </select>
  61. <insert id="insertCompany" parameterType="Company" useGeneratedKeys="true" keyProperty="companyId">
  62. insert into company
  63. <trim prefix="(" suffix=")" suffixOverrides=",">
  64. <if test="companyName != null">company_name,</if>
  65. <if test="companyMobile != null">company_mobile,</if>
  66. <if test="companyAddress != null">company_address,</if>
  67. <if test="createTime != null">create_time,</if>
  68. <if test="updateTime != null">update_time,</if>
  69. <if test="status != null">status,</if>
  70. <if test="startTime != null">start_time,</if>
  71. <if test="limitTime != null">limit_time,</if>
  72. <if test="money != null">money,</if>
  73. <if test="tuiMoney != null">tui_money,</if>
  74. <if test="companyType != null">company_type,</if>
  75. <if test="voiceApiId != null">voice_api_id,</if>
  76. <if test="userId != null">user_id,</if>
  77. <if test="appId != null">app_id,</if>
  78. <if test="appKey != null">app_key,</if>
  79. <if test="remark != null">remark,</if>
  80. <if test="linkName != null">link_name,</if>
  81. <if test="limitUserCount != null">limit_user_count,</if>
  82. <if test="isDel != null">is_del,</if>
  83. <if test="voiceCallerNumber != null">voice_caller_number,</if>
  84. <if test="manager != null">manager,</if>
  85. <if test="followDoctorIds != null">follow_doctor_ids,</if>
  86. <if test="doctorIds != null">doctor_ids,</if>
  87. <if test="restartTime != null">restart_time,</if>
  88. <if test="packageCateIds != null">package_cate_ids,</if>
  89. <if test="courseMaAppId != null">course_ma_app_id,</if>
  90. <if test="courseMiniAppId != null">course_mini_app_id,</if>
  91. </trim>
  92. <trim prefix="values (" suffix=")" suffixOverrides=",">
  93. <if test="companyName != null">#{companyName},</if>
  94. <if test="companyMobile != null">#{companyMobile},</if>
  95. <if test="companyAddress != null">#{companyAddress},</if>
  96. <if test="createTime != null">#{createTime},</if>
  97. <if test="updateTime != null">#{updateTime},</if>
  98. <if test="status != null">#{status},</if>
  99. <if test="startTime != null">#{startTime},</if>
  100. <if test="limitTime != null">#{limitTime},</if>
  101. <if test="money != null">#{money},</if>
  102. <if test="tuiMoney != null">#{tuiMoney},</if>
  103. <if test="companyType != null">#{companyType},</if>
  104. <if test="voiceApiId != null">#{voiceApiId},</if>
  105. <if test="userId != null">#{userId},</if>
  106. <if test="appId != null">#{appId},</if>
  107. <if test="appKey != null">#{appKey},</if>
  108. <if test="remark != null">#{remark},</if>
  109. <if test="linkName != null">#{linkName},</if>
  110. <if test="limitUserCount != null">#{limitUserCount},</if>
  111. <if test="isDel != null">#{isDel},</if>
  112. <if test="voiceCallerNumber != null">#{voiceCallerNumber},</if>
  113. <if test="manager != null">#{manager},</if>
  114. <if test="followDoctorIds != null">#{followDoctorIds},</if>
  115. <if test="doctorIds != null">#{doctorIds},</if>
  116. <if test="restartTime != null">#{restartTime},</if>
  117. <if test="packageCateIds != null">#{packageCateIds},</if>
  118. <if test="courseMaAppId != null">#{courseMaAppId},</if>
  119. <if test="courseMiniAppId != null">#{courseMiniAppId},</if>
  120. </trim>
  121. </insert>
  122. <update id="updateCompany" parameterType="Company">
  123. update company
  124. <trim prefix="SET" suffixOverrides=",">
  125. <if test="companyName != null">company_name = #{companyName},</if>
  126. <if test="companyMobile != null">company_mobile = #{companyMobile},</if>
  127. <if test="companyAddress != null">company_address = #{companyAddress},</if>
  128. <if test="createTime != null">create_time = #{createTime},</if>
  129. <if test="updateTime != null">update_time = #{updateTime},</if>
  130. <if test="status != null">status = #{status},</if>
  131. <if test="startTime != null">start_time = #{startTime},</if>
  132. <if test="limitTime != null">limit_time = #{limitTime},</if>
  133. <if test="money != null">money = #{money},</if>
  134. <if test="tuiMoney != null">tui_money = #{tuiMoney},</if>
  135. <if test="voiceApiId != null">voice_api_id = #{voiceApiId},</if>
  136. <if test="companyType != null">company_type = #{companyType},</if>
  137. <if test="userId != null">user_id = #{userId},</if>
  138. <if test="appId != null">app_id = #{appId},</if>
  139. <if test="appKey != null">app_key = #{appKey},</if>
  140. <if test="remark != null">remark = #{remark},</if>
  141. <if test="linkName != null">link_name = #{linkName},</if>
  142. <if test="limitUserCount != null">limit_user_count = #{limitUserCount},</if>
  143. <if test="isDel != null">is_del = #{isDel},</if>
  144. <if test="voiceCallerNumber != null">voice_caller_number = #{voiceCallerNumber},</if>
  145. <if test="omsCode != null ">oms_code = #{omsCode},</if>
  146. <if test="manager != null">manager = #{manager},</if>
  147. <if test="followDoctorIds != null">follow_doctor_ids = #{followDoctorIds},</if>
  148. <if test="doctorIds != null">doctor_ids = #{doctorIds},</if>
  149. <if test="restartTime != null">restart_time = #{restartTime},</if>
  150. <if test="packageCateIds != null">package_cate_ids = #{packageCateIds},</if>
  151. <if test="courseMaAppId != null">course_ma_app_id = #{courseMaAppId},</if>
  152. <if test="courseMiniAppId != null">course_mini_app_id = #{courseMiniAppId},</if>
  153. <if test="fsUserIsDefaultBlack != null ">fs_user_is_default_black = #{fsUserIsDefaultBlack},</if>
  154. </trim>
  155. where company_id = #{companyId}
  156. </update>
  157. <delete id="deleteCompanyById" parameterType="Long">
  158. update company set is_del=1 where company_id = #{companyId}
  159. </delete>
  160. <delete id="deleteCompanyByIds" parameterType="String">
  161. update company set is_del=1 where company_id in
  162. <foreach item="companyId" collection="array" open="(" separator="," close=")">
  163. #{companyId}
  164. </foreach>
  165. </delete>
  166. <select id="selectCompanyByIds" resultMap="CompanyResult">
  167. SELECT
  168. company_id,
  169. company_name
  170. FROM
  171. company
  172. WHERE
  173. status=1
  174. AND company_id IN
  175. <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
  176. #{item}
  177. </foreach>
  178. <!-- 批量查询企业ID: ${ids} -->
  179. </select>
  180. </mapper>