|
@@ -152,6 +152,149 @@
|
|
</choose>
|
|
</choose>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="findAll" resultType="WorkClientInfo" >
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="workClientInfoColumns"/>
|
|
|
|
+ ,su.name as "userName"
|
|
|
|
+ FROM work_client_info a
|
|
|
|
+ <include refid="workClientInfoJoinsLink"/>
|
|
|
|
+ left join sys_user su on su.id = a.create_by
|
|
|
|
+ <if test="workClientLinkman != null and workClientLinkman.name !=null and workClientLinkman.name !=''">
|
|
|
|
+ LEFT JOIN work_client_linkman b ON a.id = b.client_id
|
|
|
|
+ </if>
|
|
|
|
+ left join work_client_job_type_info c on c.work_client_id=a.id
|
|
|
|
+ <where>
|
|
|
|
+ a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
|
+ <!--<if test="workClientLinkman != null and workClientLinkman.id != '' and workClientLinkman.id != null">-->
|
|
|
|
+ <!--LEFT JOIN work_client_linkman b ON a.id = b.client_id-->
|
|
|
|
+ <!--and b.id = #{workClientLinkman.id}-->
|
|
|
|
+ <!--</if>-->
|
|
|
|
+ <if test="name != null and name != ''">
|
|
|
|
+ AND a.name LIKE
|
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
|
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
|
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyType != null and companyType != ''">
|
|
|
|
+ AND a.company_type = #{companyType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyIndustry != null and companyIndustry != ''">
|
|
|
|
+ AND a.company_industry = #{companyIndustry}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
|
+ AND (a.area_id = #{area.id} OR find_in_set(#{area.id},a.area_parent_ids))
|
|
|
|
+ </if>
|
|
|
|
+ <if test="workClientLinkman != null and workClientLinkman.name != null and workClientLinkman.name !=''">
|
|
|
|
+ AND b.name LIKE concat('%',#{workClientLinkman.name},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="workClientLinkman != null and workClientLinkman.linkPhone != null and workClientLinkman.linkPhone !=''">
|
|
|
|
+ AND b.link_phone LIKE concat('%',#{workClientLinkman.linkPhone},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="address != null and address != ''">
|
|
|
|
+ AND a.address LIKE
|
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{address}||'%'</if>
|
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{address}+'%'</if>
|
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{address},'%')</if>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="clientType != null and clientType != ''">
|
|
|
|
+ AND a.client_type like concat('%',#{clientType},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="uscCode != null and uscCode != ''">
|
|
|
|
+ AND a.usc_code like concat('%',#{uscCode},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginDate !=null">
|
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endDate !=null">
|
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="(createId != null and createId != '') or (createNameStr != null and createNameStr != '')">
|
|
|
|
+ AND (a.create_by = #{createId} or su.name like concat('%',#{createNameStr},'%'))
|
|
|
|
+ </if>
|
|
|
|
+ AND a.company_id = #{currentUser.company.id}
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="jobTypeShow !=null and jobTypeShow !=''">
|
|
|
|
+ AND c.job_type_id = #{jobTypeShow}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </where>
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ ORDER BY a.update_date DESC
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </select>
|
|
|
|
+ <select id="queryAllCount" resultType="int" >
|
|
|
|
+ SELECT
|
|
|
|
+ count(distinct a.id)
|
|
|
|
+ FROM work_client_info a
|
|
|
|
+ <if test="workClientLinkman != null and workClientLinkman.name !=null and workClientLinkman.name !=''">
|
|
|
|
+ LEFT JOIN work_client_linkman b ON a.id = b.client_id
|
|
|
|
+ </if>
|
|
|
|
+ left join work_client_job_type_info c on c.work_client_id=a.id
|
|
|
|
+ left join sys_user su on su.id = a.create_by
|
|
|
|
+ <where>
|
|
|
|
+ a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
|
+ <if test="name != null and name != ''">
|
|
|
|
+ AND a.name LIKE
|
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
|
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
|
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyType != null and companyType != ''">
|
|
|
|
+ AND a.company_type = #{companyType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyIndustry != null and companyIndustry != ''">
|
|
|
|
+ AND a.company_industry = #{companyIndustry}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
|
+ AND (a.area_id = #{area.id} OR find_in_set(#{area.id},a.area_parent_ids))
|
|
|
|
+ </if>
|
|
|
|
+ <if test="workClientLinkman != null and workClientLinkman.name != null and workClientLinkman.name !=''">
|
|
|
|
+ AND b.name LIKE concat('%',#{workClientLinkman.name},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="workClientLinkman != null and workClientLinkman.linkPhone != null and workClientLinkman.linkPhone !=''">
|
|
|
|
+ AND b.link_phone LIKE concat('%',#{workClientLinkman.linkPhone},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="address != null and address != ''">
|
|
|
|
+ AND a.address LIKE
|
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{address}||'%'</if>
|
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{address}+'%'</if>
|
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{address},'%')</if>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="clientType != null and clientType != ''">
|
|
|
|
+ AND a.client_type like concat('%',#{clientType},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="uscCode != null and uscCode != ''">
|
|
|
|
+ AND a.usc_code like concat('%',#{uscCode},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginDate !=null">
|
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endDate !=null">
|
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="(createId != null and createId != '') or (createNameStr != null and createNameStr != '')">
|
|
|
|
+ AND (a.create_by = #{createId} or su.name = #{createNameStr})
|
|
|
|
+ </if>
|
|
|
|
+ AND a.company_id = #{currentUser.company.id}
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="jobTypeShow !=null and jobTypeShow !=''">
|
|
|
|
+ AND c.job_type_id = #{jobTypeShow}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<select id="queryCount" resultType="int" >
|
|
<select id="queryCount" resultType="int" >
|
|
SELECT
|
|
SELECT
|
|
count(distinct a.id)
|
|
count(distinct a.id)
|