CompanyMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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_key" />
  23. <result property="remark" column="remark" />
  24. <result property="linkName" column="link_name" />
  25. <result property="limitUserCount" column="limit_user_count" />
  26. <result property="isDel" column="is_del" />
  27. <result property="voiceCallerNumber" column="voice_caller_number" />
  28. <result property="omsCode" column="oms_code" />
  29. </resultMap>
  30. <sql id="selectCompanyVo">
  31. select company_id, company_name, company_mobile, company_address, create_time, update_time, status, start_time, limit_time, money ,tui_money, voice_api_id,company_type,user_id,app_id,app_key,remark,link_name,limit_user_count,is_del,voice_caller_number,oms_code from company
  32. </sql>
  33. <select id="selectCompanyList" parameterType="Company" resultMap="CompanyResult">
  34. <include refid="selectCompanyVo"/>
  35. <where>
  36. <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
  37. <if test="companyMobile != null and companyMobile != ''"> and company_mobile = #{companyMobile}</if>
  38. <if test="companyAddress != null and companyAddress != ''"> and company_address = #{companyAddress}</if>
  39. <if test="status != null "> and status = #{status}</if>
  40. <if test="money != null "> and money = #{money}</if>
  41. <if test="isDel != null "> and is_del = #{isDel}</if>
  42. <if test="voiceApiId != null "> and voice_api_id = #{voiceApiId}</if>
  43. </where>
  44. </select>
  45. <select id="selectCompanyById" parameterType="Long" resultMap="CompanyResult">
  46. <include refid="selectCompanyVo"/>
  47. where company_id = #{companyId}
  48. </select>
  49. <select id="selectAllCompanyList" resultType="com.fs.store.vo.OptionsVO"></select>
  50. <insert id="insertCompany" parameterType="Company" useGeneratedKeys="true" keyProperty="companyId">
  51. insert into company
  52. <trim prefix="(" suffix=")" suffixOverrides=",">
  53. <if test="companyName != null">company_name,</if>
  54. <if test="companyMobile != null">company_mobile,</if>
  55. <if test="companyAddress != null">company_address,</if>
  56. <if test="createTime != null">create_time,</if>
  57. <if test="updateTime != null">update_time,</if>
  58. <if test="status != null">status,</if>
  59. <if test="startTime != null">start_time,</if>
  60. <if test="limitTime != null">limit_time,</if>
  61. <if test="money != null">money,</if>
  62. <if test="tuiMoney != null">tui_money,</if>
  63. <if test="companyType != null">company_type,</if>
  64. <if test="voiceApiId != null">voice_api_id,</if>
  65. <if test="userId != null">user_id,</if>
  66. <if test="appId != null">app_id,</if>
  67. <if test="appKey != null">app_key,</if>
  68. <if test="remark != null">remark,</if>
  69. <if test="linkName != null">link_name,</if>
  70. <if test="limitUserCount != null">limit_user_count,</if>
  71. <if test="isDel != null">is_del,</if>
  72. <if test="omsCode != null ">oms_code,</if>
  73. <if test="voiceCallerNumber != null">voice_caller_number,</if>
  74. </trim>
  75. <trim prefix="values (" suffix=")" suffixOverrides=",">
  76. <if test="companyName != null">#{companyName},</if>
  77. <if test="companyMobile != null">#{companyMobile},</if>
  78. <if test="companyAddress != null">#{companyAddress},</if>
  79. <if test="createTime != null">#{createTime},</if>
  80. <if test="updateTime != null">#{updateTime},</if>
  81. <if test="status != null">#{status},</if>
  82. <if test="startTime != null">#{startTime},</if>
  83. <if test="limitTime != null">#{limitTime},</if>
  84. <if test="money != null">#{money},</if>
  85. <if test="tuiMoney != null">#{tuiMoney},</if>
  86. <if test="companyType != null">#{companyType},</if>
  87. <if test="voiceApiId != null">#{voiceApiId},</if>
  88. <if test="userId != null">#{userId},</if>
  89. <if test="appId != null">#{appId},</if>
  90. <if test="appKey != null">#{appKey},</if>
  91. <if test="remark != null">#{remark},</if>
  92. <if test="linkName != null">#{linkName},</if>
  93. <if test="limitUserCount != null">#{limitUserCount},</if>
  94. <if test="isDel != null">#{isDel},</if>
  95. <if test="omsCode != null ">#{omsCode},</if>
  96. <if test="voiceCallerNumber != null">#{voiceCallerNumber},</if>
  97. </trim>
  98. </insert>
  99. <update id="updateCompany" parameterType="Company">
  100. update company
  101. <trim prefix="SET" suffixOverrides=",">
  102. <if test="companyName != null">company_name = #{companyName},</if>
  103. <if test="companyMobile != null">company_mobile = #{companyMobile},</if>
  104. <if test="companyAddress != null">company_address = #{companyAddress},</if>
  105. <if test="createTime != null">create_time = #{createTime},</if>
  106. <if test="updateTime != null">update_time = #{updateTime},</if>
  107. <if test="status != null">status = #{status},</if>
  108. <if test="startTime != null">start_time = #{startTime},</if>
  109. <if test="limitTime != null">limit_time = #{limitTime},</if>
  110. <if test="money != null">money = #{money},</if>
  111. <if test="tuiMoney != null">tui_money = #{tuiMoney},</if>
  112. <if test="voiceApiId != null">voice_api_id = #{voiceApiId},</if>
  113. <if test="companyType != null">company_type = #{companyType},</if>
  114. <if test="userId != null">user_id = #{userId},</if>
  115. <if test="appId != null">app_id = #{appId},</if>
  116. <if test="appKey != null">app_key = #{appKey},</if>
  117. <if test="remark != null">remark = #{remark},</if>
  118. <if test="linkName != null">link_name = #{linkName},</if>
  119. <if test="limitUserCount != null">limit_user_count = #{limitUserCount},</if>
  120. <if test="isDel != null">is_del = #{isDel},</if>
  121. <if test="voiceCallerNumber != null">voice_caller_number = #{voiceCallerNumber},</if>
  122. <if test="omsCode != null ">oms_code = #{omsCode},</if>
  123. </trim>
  124. where company_id = #{companyId}
  125. </update>
  126. <delete id="deleteCompanyById" parameterType="Long">
  127. update company set is_del=1 where company_id = #{companyId}
  128. </delete>
  129. <delete id="deleteCompanyByIds" parameterType="String">
  130. update company set is_del=1 where company_id in
  131. <foreach item="companyId" collection="array" open="(" separator="," close=")">
  132. #{companyId}
  133. </foreach>
  134. </delete>
  135. </mapper>