| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ydtech.modules.esm.dao.EsmInsCompanyMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.esm.model.EsmInsCompany">
- <id property="id" column="id" jdbcType="VARCHAR"/>
- <result property="code" column="code" jdbcType="VARCHAR"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
- <result property="namesimple" column="namesimple" jdbcType="VARCHAR"/>
- <result property="remark" column="remark" jdbcType="VARCHAR"/>
- <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
- <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="lastUpdateBy" column="last_update_by" jdbcType="VARCHAR"/>
- <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
- <result property="cnName" column="cn_name" jdbcType="VARCHAR"/>
- <result property="type" column="type" jdbcType="TINYINT"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,code,name,
- parent_id,namesimple,remark,
- order_num,create_by,create_time,
- last_update_by,last_update_time,open_quote,
- cn_name,type,logo
- </sql>
- <select id="getByLowerId80" resultType="java.lang.String">
- with recursive temp as (select id
- from esm_ins_company
- where id = #{companyId}
- union all
- select t.id
- from esm_ins_company t
- inner join temp t2 on t2.id = t.parent_id)
- select id
- from temp
- </select>
- <select id="getByLowerId57" resultType="java.lang.String">
- SELECT id
- FROM (SELECT * FROM esm_ins_company ORDER BY parent_id, id) products_sorted,
- (SELECT @pv := #{companyId}) initialisation
- WHERE find_in_set(parent_id, @pv)
- AND length(
- @pv := concat(@pv, ',', id))
- UNION
- SELECT id
- FROM esm_ins_company
- WHERE id = #{companyId}
- </select>
- <select id="queryListByParentId" resultType="com.ydtech.modules.esm.model.EsmInsCompany">
- select
- a.name as "name",
- a.id as "id"
- from
- esm_ins_company a
- <where>
- <if test="parentId !=null and parentId !=''">
- a.parent_id=#{parentId}
- </if>
- </where>
- </select>
- <select id="findOrderCompanyList" resultType="com.ydtech.modules.esm.model.vo.res.EsmInsCompanyResVo">
- SELECT DISTINCT
- ins.company_id AS id,
- eic.namesimple AS NAME
- FROM
- ins_area_company ins
- LEFT JOIN esm_ins_company eic ON ins.company_id = eic.id
- WHERE
- IFNULL( ins.company_id, '' )!= ''
- AND IFNULL( eic.id, '' )!= ''
- GROUP BY
- ins.company_id,
- ins.inscompany
- </select>
- </mapper>
|