SysCompanyMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.dgtly.system.mapper.SysCompanyMapper">
  6. <resultMap type="SysCompany" id="SysCompanyResult">
  7. <result property="id" column="id" />
  8. <result property="status" column="status" />
  9. <result property="companyName" column="company_name" />
  10. <result property="companyType" column="company_type" />
  11. <result property="detailAddress" column="detail_address" />
  12. <result property="longitude" column="longitude" />
  13. <result property="latitude" column="latitude" />
  14. <result property="legalPerson" column="legal_person" />
  15. <result property="contactNumber" column="contact_number" />
  16. <result property="establishDate" column="establish_date" />
  17. <result property="unifiedSocialCreditCode" column="unified_social_credit_code" />
  18. <result property="businessLicenseUrl" column="business_license_url" />
  19. <result property="defaultImgUrl" column="default_img_url" />
  20. <result property="propagandaImgUrl" column="propaganda_img_url" />
  21. <result property="companyIntroduce" column="company_introduce" />
  22. <result property="versionNum" column="version_num" />
  23. <result property="createBy" column="create_by" />
  24. <result property="createTime" column="create_time" />
  25. <result property="updateBy" column="update_by" />
  26. <result property="updateTime" column="update_time" />
  27. <result property="remark" column="remark" />
  28. <result property="primaryBusiness" column="primary_business" />
  29. </resultMap>
  30. <sql id="selectSysCompanyVo">
  31. select id, company_name,company_type,detail_address,longitude,latitude,legal_person,contact_number,establish_date,
  32. unified_social_credit_code,business_license_url,default_img_url,propaganda_img_url,company_introduce,version_num,
  33. create_by,update_by,update_time,remark,status,create_time,primary_business
  34. from sys_company
  35. </sql>
  36. <select id="selectSysCompanyList" parameterType="SysCompany" resultMap="SysCompanyResult">
  37. <include refid="selectSysCompanyVo"/>
  38. <where>
  39. <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName},'%')</if>
  40. <if test="status != null and status != ''">and status =#{status}</if>
  41. <if test="companyType != null and companyType != ''">and companyType =#{company_type}</if>
  42. </where>
  43. </select>
  44. <select id="selectSysCompanyById" parameterType="Long" resultMap="SysCompanyResult">
  45. <include refid="selectSysCompanyVo"/>
  46. where id = #{id}
  47. </select>
  48. <insert id="insertSysCompany" parameterType="SysCompany" useGeneratedKeys="true" keyProperty="id">
  49. insert into sys_company
  50. <trim prefix="(" suffix=")" suffixOverrides=",">
  51. create_time,
  52. <if test="status != null and status != ''">status,</if>
  53. <if test="companyName != null and companyName != ''">company_name,</if>
  54. <if test="companyType != null and companyType != ''">company_type,</if>
  55. <if test="detailAddress != null and detailAddress != ''">detail_address,</if>
  56. <if test="longitude != null and longitude != ''">longitude,</if>
  57. <if test="latitude != null and latitude != ''">latitude,</if>
  58. <if test="legalPerson != null and legalPerson != ''">legal_person,</if>
  59. <if test="contactNumber != null and contactNumber != ''">contact_number,</if>
  60. <if test="establishDate != null ">establish_date,</if>
  61. <if test="unifiedSocialCreditCode != null and unifiedSocialCreditCode != ''">unified_social_credit_code,</if>
  62. <if test="businessLicenseUrl != null and businessLicenseUrl != ''">business_license_url,</if>
  63. <if test="defaultImgUrl != null and defaultImgUrl != ''">default_img_url,</if>
  64. <if test="propagandaImgUrl != null and propagandaImgUrl != ''">propaganda_img_url,</if>
  65. <if test="companyIntroduce != null and companyIntroduce != ''">company_introduce,</if>
  66. <if test="versionNum != null and versionNum != ''">version_num,</if>
  67. <if test="createBy != null and createBy != ''">create_by,</if>
  68. <if test="updateBy != null and updateBy != ''">update_by,</if>
  69. <if test="remark != null and remark != ''">remark,</if>
  70. <if test="primaryBusiness != null and primaryBusiness != ''">primary_business,</if>
  71. </trim>
  72. <trim prefix="values (" suffix=")" suffixOverrides=",">
  73. now(),
  74. <if test="status != null and status != ''">#{status},</if>
  75. <if test="companyName != null and companyName != ''">#{companyName},</if>
  76. <if test="companyType != null and companyType != ''">#{companyType},</if>
  77. <if test="detailAddress != null and detailAddress != ''">#{detailAddress},</if>
  78. <if test="longitude != null and longitude != ''">#{longitude},</if>
  79. <if test="latitude != null and latitude != ''">#{latitude},</if>
  80. <if test="legalPerson != null and legalPerson != ''">#{legalPerson},</if>
  81. <if test="contactNumber != null and contactNumber != ''">#{contactNumber},</if>
  82. <if test="establishDate != null ">#{establishDate},</if>
  83. <if test="unifiedSocialCreditCode != null and unifiedSocialCreditCode != ''">#{unifiedSocialCreditCode},</if>
  84. <if test="businessLicenseUrl != null and businessLicenseUrl != ''">#{businessLicenseUrl},</if>
  85. <if test="defaultImgUrl != null and defaultImgUrl != ''">#{defaultImgUrl},</if>
  86. <if test="propagandaImgUrl != null and propagandaImgUrl != ''">#{propagandaImgUrl},</if>
  87. <if test="companyIntroduce != null and companyIntroduce != ''">#{companyIntroduce},</if>
  88. <if test="versionNum != null and versionNum != ''">#{versionNum},</if>
  89. <if test="createBy != null and createBy != ''">#{createBy},</if>
  90. <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
  91. <if test="remark != null and remark != ''">#{remark},</if>
  92. <if test="primaryBusiness != null and primaryBusiness != ''">#{primaryBusiness},</if>
  93. </trim>
  94. </insert>
  95. <update id="updateSysCompany" parameterType="SysCompany">
  96. update sys_company
  97. <trim prefix="SET" suffixOverrides=",">
  98. update_time = now(),
  99. <if test="status != null">status = #{status},</if>
  100. <if test="companyName != null and companyName != ''">company_name= #{companyName},</if>
  101. <if test="companyType != null and companyType != ''">company_type= #{companyType},</if>
  102. <if test="detailAddress != null and detailAddress != ''">detail_address= #{detailAddress},</if>
  103. <if test="longitude != null and longitude != ''">longitude= #{longitude},</if>
  104. <if test="latitude != null and latitude != ''">latitude= #{latitude},</if>
  105. <if test="legalPerson != null and legalPerson != ''">legal_person= #{legalPerson},</if>
  106. <if test="contactNumber != null and contactNumber != ''">contact_number= #{contactNumber},</if>
  107. <if test="establishDate != null ">establish_date= #{establishDate},</if>
  108. <if test="unifiedSocialCreditCode != null and unifiedSocialCreditCode != ''">unified_social_credit_code= #{unifiedSocialCreditCode},</if>
  109. <if test="businessLicenseUrl != null and businessLicenseUrl != ''">businessLicenseUrl= #{businessLicenseUrl},</if>
  110. <if test="defaultImgUrl != null and defaultImgUrl != ''">default_img_url= #{defaultImgUrl},</if>
  111. <if test="propagandaImgUrl != null and propagandaImgUrl != ''">propaganda_img_url= #{propagandaImgUrl},</if>
  112. <if test="companyIntroduce != null and companyIntroduce != ''">company_introduce= #{companyIntroduce},</if>
  113. <if test="versionNum != null and versionNum != ''">version_num= #{versionNum},</if>
  114. <if test="createBy != null and createBy != ''">create_by= #{createBy},</if>
  115. <if test="updateBy != null and updateBy != ''">update_by= #{updateBy},</if>
  116. <if test="remark != null and remark != ''">remark= #{remark},</if>
  117. <if test="primaryBusiness != null and primaryBusiness != ''">primary_business=#{primaryBusiness},</if>
  118. </trim>
  119. where id = #{id}
  120. </update>
  121. <delete id="deleteSysCompanyById" parameterType="Long">
  122. delete from sys_company where id = #{id}
  123. </delete>
  124. <delete id="deleteSysCompanyByIds" parameterType="String">
  125. delete from sys_company where id in
  126. <foreach item="id" collection="array" open="(" separator="," close=")">
  127. #{id}
  128. </foreach>
  129. </delete>
  130. <select id="selectCompanyHotList" resultMap="SysCompanyResult">
  131. select sc.id, sc.company_name,sc.establish_date,sc.default_img_url,sc.primary_business
  132. from sys_company sc
  133. where sc.id != 1 and sc.status = 0
  134. limit 0,5
  135. </select>
  136. <select id="selectSysCompanyListExRoot" parameterType="SysCompany" resultMap="SysCompanyResult">
  137. <include refid="selectSysCompanyVo"/>
  138. <where>
  139. id !=1
  140. <if test="companyName != null and companyName != ''"> and company_name = #{companyName}</if>
  141. </where>
  142. </select>
  143. </mapper>