CompanyMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. <select id="selectCompanyNameCompanyByIds" resultType="java.lang.String">
  62. select GROUP_CONCAT(DISTINCT company_name ORDER BY company_name SEPARATOR ',') AS company_name from company where company_id in
  63. <foreach collection="companyIds.split(',')" item="companyId" open="(" close=")" separator=",">
  64. #{companyId}
  65. </foreach>
  66. </select>
  67. <select id="selectCompanyAllList" resultType="com.fs.company.domain.Company">
  68. select company_id,company_name from company where is_del=0
  69. </select>
  70. <select id="selectDoctorIdsByCompanyId" resultType="java.lang.String">
  71. select doctor_ids from company where company_id = #{companyId}
  72. </select>
  73. <insert id="insertCompany" parameterType="Company" useGeneratedKeys="true" keyProperty="companyId">
  74. insert into company
  75. <trim prefix="(" suffix=")" suffixOverrides=",">
  76. <if test="companyName != null">company_name,</if>
  77. <if test="companyMobile != null">company_mobile,</if>
  78. <if test="companyAddress != null">company_address,</if>
  79. <if test="createTime != null">create_time,</if>
  80. <if test="updateTime != null">update_time,</if>
  81. <if test="status != null">status,</if>
  82. <if test="startTime != null">start_time,</if>
  83. <if test="limitTime != null">limit_time,</if>
  84. <if test="money != null">money,</if>
  85. <if test="tuiMoney != null">tui_money,</if>
  86. <if test="companyType != null">company_type,</if>
  87. <if test="voiceApiId != null">voice_api_id,</if>
  88. <if test="userId != null">user_id,</if>
  89. <if test="appId != null">app_id,</if>
  90. <if test="appKey != null">app_key,</if>
  91. <if test="remark != null">remark,</if>
  92. <if test="linkName != null">link_name,</if>
  93. <if test="limitUserCount != null">limit_user_count,</if>
  94. <if test="isDel != null">is_del,</if>
  95. <if test="voiceCallerNumber != null">voice_caller_number,</if>
  96. <if test="manager != null">manager,</if>
  97. <if test="followDoctorIds != null">follow_doctor_ids,</if>
  98. <if test="doctorIds != null">doctor_ids,</if>
  99. <if test="restartTime != null">restart_time,</if>
  100. <if test="packageCateIds != null">package_cate_ids,</if>
  101. <if test="courseMaAppId != null">course_ma_app_id,</if>
  102. <if test="courseMiniAppId != null">course_mini_app_id,</if>
  103. </trim>
  104. <trim prefix="values (" suffix=")" suffixOverrides=",">
  105. <if test="companyName != null">#{companyName},</if>
  106. <if test="companyMobile != null">#{companyMobile},</if>
  107. <if test="companyAddress != null">#{companyAddress},</if>
  108. <if test="createTime != null">#{createTime},</if>
  109. <if test="updateTime != null">#{updateTime},</if>
  110. <if test="status != null">#{status},</if>
  111. <if test="startTime != null">#{startTime},</if>
  112. <if test="limitTime != null">#{limitTime},</if>
  113. <if test="money != null">#{money},</if>
  114. <if test="tuiMoney != null">#{tuiMoney},</if>
  115. <if test="companyType != null">#{companyType},</if>
  116. <if test="voiceApiId != null">#{voiceApiId},</if>
  117. <if test="userId != null">#{userId},</if>
  118. <if test="appId != null">#{appId},</if>
  119. <if test="appKey != null">#{appKey},</if>
  120. <if test="remark != null">#{remark},</if>
  121. <if test="linkName != null">#{linkName},</if>
  122. <if test="limitUserCount != null">#{limitUserCount},</if>
  123. <if test="isDel != null">#{isDel},</if>
  124. <if test="voiceCallerNumber != null">#{voiceCallerNumber},</if>
  125. <if test="manager != null">#{manager},</if>
  126. <if test="followDoctorIds != null">#{followDoctorIds},</if>
  127. <if test="doctorIds != null">#{doctorIds},</if>
  128. <if test="restartTime != null">#{restartTime},</if>
  129. <if test="packageCateIds != null">#{packageCateIds},</if>
  130. <if test="courseMaAppId != null">#{courseMaAppId},</if>
  131. <if test="courseMiniAppId != null">#{courseMiniAppId},</if>
  132. </trim>
  133. </insert>
  134. <update id="updateCompany" parameterType="Company">
  135. update company
  136. <trim prefix="SET" suffixOverrides=",">
  137. <if test="companyName != null">company_name = #{companyName},</if>
  138. <if test="companyMobile != null">company_mobile = #{companyMobile},</if>
  139. <if test="companyAddress != null">company_address = #{companyAddress},</if>
  140. <if test="createTime != null">create_time = #{createTime},</if>
  141. <if test="updateTime != null">update_time = #{updateTime},</if>
  142. <if test="status != null">status = #{status},</if>
  143. <if test="startTime != null">start_time = #{startTime},</if>
  144. <if test="limitTime != null">limit_time = #{limitTime},</if>
  145. <if test="money != null">money = #{money},</if>
  146. <if test="tuiMoney != null">tui_money = #{tuiMoney},</if>
  147. <if test="voiceApiId != null">voice_api_id = #{voiceApiId},</if>
  148. <if test="companyType != null">company_type = #{companyType},</if>
  149. <if test="userId != null">user_id = #{userId},</if>
  150. <if test="appId != null">app_id = #{appId},</if>
  151. <if test="appKey != null">app_key = #{appKey},</if>
  152. <if test="remark != null">remark = #{remark},</if>
  153. <if test="linkName != null">link_name = #{linkName},</if>
  154. <if test="limitUserCount != null">limit_user_count = #{limitUserCount},</if>
  155. <if test="isDel != null">is_del = #{isDel},</if>
  156. <if test="voiceCallerNumber != null">voice_caller_number = #{voiceCallerNumber},</if>
  157. <if test="omsCode != null ">oms_code = #{omsCode},</if>
  158. <if test="manager != null">manager = #{manager},</if>
  159. <if test="followDoctorIds != null">follow_doctor_ids = #{followDoctorIds},</if>
  160. <if test="doctorIds != null">doctor_ids = #{doctorIds},</if>
  161. <if test="restartTime != null">restart_time = #{restartTime},</if>
  162. <if test="packageCateIds != null">package_cate_ids = #{packageCateIds},</if>
  163. <if test="courseMaAppId != null">course_ma_app_id = #{courseMaAppId},</if>
  164. <if test="courseMiniAppId != null">course_mini_app_id = #{courseMiniAppId},</if>
  165. <if test="fsUserIsDefaultBlack != null ">fs_user_is_default_black = #{fsUserIsDefaultBlack},</if>
  166. </trim>
  167. where company_id = #{companyId}
  168. </update>
  169. <delete id="deleteCompanyById" parameterType="Long">
  170. update company set is_del=1 where company_id = #{companyId}
  171. </delete>
  172. <delete id="deleteCompanyByIds" parameterType="String">
  173. update company set is_del=1 where company_id in
  174. <foreach item="companyId" collection="array" open="(" separator="," close=")">
  175. #{companyId}
  176. </foreach>
  177. </delete>
  178. <select id="selectCompanyByIds" resultMap="CompanyResult">
  179. SELECT
  180. company_id,
  181. company_name
  182. FROM
  183. company
  184. WHERE
  185. status=1
  186. AND company_id IN
  187. <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
  188. #{item}
  189. </foreach>
  190. <!-- 批量查询企业ID: ${ids} -->
  191. </select>
  192. <!--selectCompanyByKeyword -->
  193. <select id="selectCompanyByKeyword" resultMap="CompanyResult">
  194. SELECT
  195. company_id,
  196. company_name
  197. FROM
  198. company
  199. WHERE
  200. status=1
  201. AND company_name like concat('%',#{keyword},'%')
  202. </select>
  203. </mapper>