| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?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="platform.modules.build.dao.CompanyContactDao">
- <update id="deleteByCompanyId">
- update y_company_contact set del_flag=1 where company_id=#{companyId}
- </update>
- <insert id="insertInfo">
- INSERT INTO `service_platform`.`y_company_contact`
- ( `company_id`, `contact`, `phone`, `gender`, `birthday`, `tel`, `qq`, `wechat`, `email`, `position`, `work`, `create_time`, `create_by`, `create_name`, `update_by`, `update_name`, `update_time`, `del_flag`)
- VALUES ( #{company_id}, #{contact}, #{phone}, NULL, NULL, NULL, NULL, NULL, NULL, #{position}, NULL, #{create_time}, #{create_by}, #{create_name}, NULL, NULL, NULL, '0')
- </insert>
- <select id="findContactList" resultType="platform.modules.build.entity.CompanyContact">
- SELECT
- getFirstPinyin ( TRIM(c.company_name) ) AS letter,
- cc.company_id,
- c.company_name,
- cc.phone,
- cc.contact
- FROM
- y_company_contact cc
- LEFT JOIN y_company c ON c.id = cc.company_id
- WHERE c.del_flag = 0 AND cc.del_flag = 0
- <if test="searchName != null and searchName != ''">
- c.compnay_name LIKE CONCAT('%', #{seatchName}, '%')
- </if>
- ORDER BY letter
- </select>
- <resultMap id="companyContactList" type="platform.modules.carrier.dto.CompanyContacts">
- <result column="letter" jdbcType="VARCHAR" property="letter"/>
- <collection property="data" ofType="platform.modules.build.entity.Company">
- <id column="id" jdbcType="INTEGER" property="id"/>
- <result column="company_name" jdbcType="VARCHAR" property="company_name"/>
- <collection property="contactList" ofType="platform.modules.build.entity.CompanyContact">
- <id column="contact_id" jdbcType="INTEGER" property="id"/>
- <result column="phone" jdbcType="VARCHAR" property="phone"/>
- <result column="contact" jdbcType="VARCHAR" property="contact"/>
- </collection>
- </collection>
- </resultMap>
- <select id="findCompanyContactList" resultMap="companyContactList">
- SELECT
- *
- FROM
- (
- SELECT
- getFirstPinyin ( TRIM( c.company_name ) ) AS letter,
- c.id,
- c.company_name,
- cc.id AS contact_id,
- cc.phone,
- cc.contact
- FROM
- y_company c
- LEFT JOIN y_company_contact cc ON cc.company_id = c.id
- WHERE
- c.del_flag = 0 AND c.is_start = 1 AND c.is_register = 1
- AND cc.del_flag = 0
- <if test="streetId != null and streetId != ''">
- AND c.street_id = #{streetId}
- </if>
- <if test="parkId != null and parkId != ''">
- AND c.build_id = #{parkId}
- </if>
- ORDER BY
- letter
- ) a
- WHERE 1=1
- <if test="letter != null and letter != ''">
- and a.letter = #{letter}
- </if>
- <if test="companyName != null and companyName != ''">
- and a.company_name LIKE CONCAT('%', #{companyName}, '%')
- </if>
- </select>
- </mapper>
|