EsmInsCompanyMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.ydtech.modules.esm.dao.EsmInsCompanyMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.esm.model.EsmInsCompany">
  7. <id property="id" column="id" jdbcType="VARCHAR"/>
  8. <result property="code" column="code" jdbcType="VARCHAR"/>
  9. <result property="name" column="name" jdbcType="VARCHAR"/>
  10. <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
  11. <result property="namesimple" column="namesimple" jdbcType="VARCHAR"/>
  12. <result property="remark" column="remark" jdbcType="VARCHAR"/>
  13. <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
  14. <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
  15. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  16. <result property="lastUpdateBy" column="last_update_by" jdbcType="VARCHAR"/>
  17. <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
  18. <result property="cnName" column="cn_name" jdbcType="VARCHAR"/>
  19. <result property="type" column="type" jdbcType="TINYINT"/>
  20. </resultMap>
  21. <sql id="Base_Column_List">
  22. id,code,name,
  23. parent_id,namesimple,remark,
  24. order_num,create_by,create_time,
  25. last_update_by,last_update_time,open_quote,
  26. cn_name,type,logo
  27. </sql>
  28. <select id="getByLowerId80" resultType="java.lang.String">
  29. with recursive temp as (select id
  30. from esm_ins_company
  31. where id = #{companyId}
  32. union all
  33. select t.id
  34. from esm_ins_company t
  35. inner join temp t2 on t2.id = t.parent_id)
  36. select id
  37. from temp
  38. </select>
  39. <select id="getByLowerId57" resultType="java.lang.String">
  40. SELECT id
  41. FROM (SELECT * FROM esm_ins_company ORDER BY parent_id, id) products_sorted,
  42. (SELECT @pv := #{companyId}) initialisation
  43. WHERE find_in_set(parent_id, @pv)
  44. AND length(
  45. @pv := concat(@pv, ',', id))
  46. UNION
  47. SELECT id
  48. FROM esm_ins_company
  49. WHERE id = #{companyId}
  50. </select>
  51. <select id="queryListByParentId" resultType="com.ydtech.modules.esm.model.EsmInsCompany">
  52. select
  53. a.name as "name",
  54. a.id as "id"
  55. from
  56. esm_ins_company a
  57. <where>
  58. <if test="parentId !=null and parentId !=''">
  59. a.parent_id=#{parentId}
  60. </if>
  61. </where>
  62. </select>
  63. <select id="findOrderCompanyList" resultType="com.ydtech.modules.esm.model.vo.res.EsmInsCompanyResVo">
  64. SELECT DISTINCT
  65. ins.company_id AS id,
  66. eic.namesimple AS NAME
  67. FROM
  68. ins_area_company ins
  69. LEFT JOIN esm_ins_company eic ON ins.company_id = eic.id
  70. WHERE
  71. IFNULL( ins.company_id, '' )!= ''
  72. AND IFNULL( eic.id, '' )!= ''
  73. GROUP BY
  74. ins.company_id,
  75. ins.inscompany
  76. </select>
  77. <select id="getExternalAgreementCompanyList" resultType="com.ydtech.modules.esm.model.vo.res.EsmInsCompanyResVo">
  78. SELECT DISTINCT
  79. insurance_company_id AS id,
  80. insurance_company AS NAME
  81. FROM
  82. ptl_agreement
  83. <where>
  84. is_external = '1'
  85. <if test="name != null and name != ''">
  86. and insurance_company like concat('%',#{name},'%')
  87. </if>
  88. </where>
  89. GROUP BY
  90. insurance_company_id,
  91. insurance_company
  92. </select>
  93. </mapper>