<?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="doumeemes.dao.ext.CompanyExtMapper">
|
|
<!-- 管理页面查询 -->
|
<resultMap id="CompanyExtListVO" type="doumeemes.dao.ext.vo.CompanyExtListVO" autoMapping="true">
|
<id column="ID" jdbcType="INTEGER" property="id"/>
|
<association property="lpmodel" javaType="doumeemes.dao.system.model.SystemUser">
|
<id column="LPMODEL_ID" jdbcType="INTEGER" property="id"/>
|
<result column="LPMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
|
<result column="LPMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
|
<result column="LPMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="LPMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
|
<result column="LPMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
<result column="LPMODEL_FIXED" jdbcType="TINYINT" property="fixed"/>
|
<result column="LPMODEL_PASSWORD" jdbcType="VARCHAR" property="password"/>
|
<result column="LPMODEL_SALT" jdbcType="VARCHAR" property="salt"/>
|
<result column="LPMODEL_AVATAR" jdbcType="VARCHAR" property="avatar"/>
|
<result column="LPMODEL_MOBILE" jdbcType="VARCHAR" property="mobile"/>
|
<result column="LPMODEL_EMAIL" jdbcType="VARCHAR" property="email"/>
|
<result column="LPMODEL_SEX" jdbcType="VARCHAR" property="sex"/>
|
<result column="LPMODEL_BIRTHDAY" jdbcType="DATE" property="birthday"/>
|
<result column="LPMODEL_EMP_NO" jdbcType="VARCHAR" property="empNo"/>
|
<result column="LPMODEL_REALNAME" jdbcType="VARCHAR" property="realname"/>
|
<result column="LPMODEL_USERNAME" jdbcType="VARCHAR" property="username"/>
|
<result column="LPMODEL_SYSTEMID" jdbcType="VARCHAR" property="systemid"/>
|
<result column="LPMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/>
|
<result column="LPMODEL_TYPE" jdbcType="INTEGER" property="type"/>
|
</association>
|
</resultMap>
|
<select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryCompanyExtDTO" resultMap="CompanyExtListVO">
|
SELECT
|
`a`.*,
|
`lpmodel`.`ID` AS LPMODEL_ID,
|
`lpmodel`.`DELETED` AS LPMODEL_DELETED,
|
`lpmodel`.`CREATE_USER` AS LPMODEL_CREATE_USER,
|
`lpmodel`.`CREATE_TIME` AS LPMODEL_CREATE_TIME,
|
`lpmodel`.`UPDATE_USER` AS LPMODEL_UPDATE_USER,
|
`lpmodel`.`UPDATE_TIME` AS LPMODEL_UPDATE_TIME,
|
`lpmodel`.`FIXED` AS LPMODEL_FIXED,
|
`lpmodel`.`PASSWORD` AS LPMODEL_PASSWORD,
|
`lpmodel`.`SALT` AS LPMODEL_SALT,
|
`lpmodel`.`AVATAR` AS LPMODEL_AVATAR,
|
`lpmodel`.`MOBILE` AS LPMODEL_MOBILE,
|
`lpmodel`.`EMAIL` AS LPMODEL_EMAIL,
|
`lpmodel`.`SEX` AS LPMODEL_SEX,
|
`lpmodel`.`BIRTHDAY` AS LPMODEL_BIRTHDAY,
|
`lpmodel`.`EMP_NO` AS LPMODEL_EMP_NO,
|
`lpmodel`.`REALNAME` AS LPMODEL_REALNAME,
|
`lpmodel`.`USERNAME` AS LPMODEL_USERNAME,
|
`lpmodel`.`SYSTEMID` AS LPMODEL_SYSTEMID,
|
`lpmodel`.`INVALID_TIME` AS LPMODEL_INVALID_TIME,
|
`lpmodel`.`TYPE` AS LPMODEL_TYPE
|
FROM `company` `a`
|
LEFT JOIN `system_user` `lpmodel` ON a.LEGAL_PERSON_ID=lpmodel.ID
|
<where>
|
<if test="id != null">
|
AND `a`.`ID` = #{id}
|
</if>
|
<if test="deleted != null">
|
AND `a`.`DELETED` = #{deleted}
|
</if>
|
<if test="createUser != null">
|
AND `a`.`CREATE_USER` = #{createUser}
|
</if>
|
<if test="createTime != null">
|
AND `a`.`CREATE_TIME` = #{createTime}
|
</if>
|
<if test="updateUser != null">
|
AND `a`.`UPDATE_USER` = #{updateUser}
|
</if>
|
<if test="updateTime != null">
|
AND `a`.`UPDATE_TIME` = #{updateTime}
|
</if>
|
<if test="origin != null">
|
AND `a`.`ORIGIN` = #{origin}
|
</if>
|
<if test="name != null and name != ''">
|
AND `a`.`NAME` = #{name}
|
</if>
|
<if test="remark != null and remark != ''">
|
AND `a`.`REMARK` = #{remark}
|
</if>
|
<if test="type != null and type != ''">
|
AND `a`.`TYPE` = #{type}
|
</if>
|
<if test="legalPersonId != null">
|
AND `a`.`LEGAL_PERSON_ID` = #{legalPersonId}
|
</if>
|
<if test="legalPersonPhone != null and legalPersonPhone != ''">
|
AND `a`.`LEGAL_PERSON_PHONE` = #{legalPersonPhone}
|
</if>
|
<if test="registerDate != null">
|
AND `a`.`REGISTER_DATE` = #{registerDate}
|
</if>
|
<if test="addr != null and addr != ''">
|
AND `a`.`ADDR` = #{addr}
|
</if>
|
<if test="businessScope != null and businessScope != ''">
|
AND `a`.`BUSINESS_SCOPE` = #{businessScope}
|
</if>
|
<if test="businessTerm != null and businessTerm != ''">
|
AND `a`.`BUSINESS_TERM` = #{businessTerm}
|
</if>
|
<if test="issueDate != null">
|
AND `a`.`ISSUE_DATE` = #{issueDate}
|
</if>
|
<if test="creditCode != null and creditCode != ''">
|
AND `a`.`CREDIT_CODE` = #{creditCode}
|
</if>
|
<if test="registerCapital != null and registerCapital != ''">
|
AND `a`.`REGISTER_CAPITAL` = #{registerCapital}
|
</if>
|
<if test="fileFormat != null and fileFormat != ''">
|
AND `a`.`FILE_FORMAT` = #{fileFormat}
|
</if>
|
<if test="fileName != null and fileName != ''">
|
AND `a`.`FILE_NAME` = #{fileName}
|
</if>
|
<if test="fileStoreAddr != null and fileStoreAddr != ''">
|
AND `a`.`FILE_STORE_ADDR` = #{fileStoreAddr}
|
</if>
|
<if test="authStatus != null">
|
AND `a`.`AUTH_STATUS` = #{authStatus}
|
</if>
|
<if test="authId != null">
|
AND `a`.`AUTH_ID` = #{authId}
|
</if>
|
<if test="dingdingId != null and dingdingId != ''">
|
AND `a`.`DINGDING_ID` = #{dingdingId}
|
</if>
|
<if test="openUserNum != null">
|
AND `a`.`OPEN_USER_NUM` = #{openUserNum}
|
</if>
|
<if test="openModules != null and openModules != ''">
|
AND `a`.`OPEN_MODULES` = #{openModules}
|
</if>
|
<if test="oepnValidDate != null">
|
AND `a`.`OEPN_VALID_DATE` = #{oepnValidDate}
|
</if>
|
<if test="oepnType != null">
|
AND `a`.`OEPN_TYPE` = #{oepnType}
|
</if>
|
<if test="channelId != null">
|
AND `a`.`CHANNEL_ID` = #{channelId}
|
</if>
|
<if test="lpmodelId != null">
|
AND `lpmodel`.`ID` = #{lpmodelId}
|
</if>
|
<if test="lpmodelDeleted != null">
|
AND `lpmodel`.`DELETED` = #{lpmodelDeleted}
|
</if>
|
<if test="lpmodelCreateUser != null">
|
AND `lpmodel`.`CREATE_USER` = #{lpmodelCreateUser}
|
</if>
|
<if test="lpmodelCreateTime != null">
|
AND `lpmodel`.`CREATE_TIME` = #{lpmodelCreateTime}
|
</if>
|
<if test="lpmodelUpdateUser != null">
|
AND `lpmodel`.`UPDATE_USER` = #{lpmodelUpdateUser}
|
</if>
|
<if test="lpmodelUpdateTime != null">
|
AND `lpmodel`.`UPDATE_TIME` = #{lpmodelUpdateTime}
|
</if>
|
<if test="lpmodelFixed != null">
|
AND `lpmodel`.`FIXED` = #{lpmodelFixed}
|
</if>
|
<if test="lpmodelPassword != null and lpmodelPassword != ''">
|
AND `lpmodel`.`PASSWORD` = #{lpmodelPassword}
|
</if>
|
<if test="lpmodelSalt != null and lpmodelSalt != ''">
|
AND `lpmodel`.`SALT` = #{lpmodelSalt}
|
</if>
|
<if test="lpmodelAvatar != null and lpmodelAvatar != ''">
|
AND `lpmodel`.`AVATAR` = #{lpmodelAvatar}
|
</if>
|
<if test="lpmodelMobile != null and lpmodelMobile != ''">
|
AND `lpmodel`.`MOBILE` = #{lpmodelMobile}
|
</if>
|
<if test="lpmodelEmail != null and lpmodelEmail != ''">
|
AND `lpmodel`.`EMAIL` = #{lpmodelEmail}
|
</if>
|
<if test="lpmodelSex != null and lpmodelSex != ''">
|
AND `lpmodel`.`SEX` = #{lpmodelSex}
|
</if>
|
<if test="lpmodelBirthday != null">
|
AND `lpmodel`.`BIRTHDAY` = #{lpmodelBirthday}
|
</if>
|
<if test="lpmodelEmpNo != null and lpmodelEmpNo != ''">
|
AND `lpmodel`.`EMP_NO` = #{lpmodelEmpNo}
|
</if>
|
<if test="lpmodelRealname != null and lpmodelRealname != ''">
|
AND `lpmodel`.`REALNAME` = #{lpmodelRealname}
|
</if>
|
<if test="lpmodelUsername != null and lpmodelUsername != ''">
|
AND `lpmodel`.`USERNAME` = #{lpmodelUsername}
|
</if>
|
<if test="lpmodelSystemid != null and lpmodelSystemid != ''">
|
AND `lpmodel`.`SYSTEMID` = #{lpmodelSystemid}
|
</if>
|
<if test="lpmodelInvalidTime != null">
|
AND `lpmodel`.`INVALID_TIME` = #{lpmodelInvalidTime}
|
</if>
|
<if test="lpmodelType != null">
|
AND `lpmodel`.`TYPE` = #{lpmodelType}
|
</if>
|
</where>
|
</select>
|
<select id="selectCompanyInfoList" parameterType="doumeemes.dao.ext.dto.QueryCompanyExtDTO" resultType="doumeemes.dao.ext.vo.CompanyInfoListVO" >
|
SELECT
|
comp.ID,
|
comp.NAME as companyName,
|
dept.name AS remark,
|
comp.ADDR,
|
comp.DINGDING_INFO,
|
comp.OEPN_TYPE,
|
comu.PHONE as PHONE
|
,comu.id as companyUserId
|
,comp.OEPN_VALID_DATE AS oepnValidDate
|
,comp.LINKER as linkName
|
,comp.status
|
,comp.LINK_PHONE
|
,comp.SALESPERSON
|
,t2.REALNAME as SALESPERSON_NAME
|
,comp.CREATE_USER
|
,comp.CREATE_TIME
|
,t3.REALNAME as CREATE_USER_NAME
|
FROM
|
company comp
|
LEFT JOIN SYSTEM_USER t2 ON comp.SALESPERSON = t2.ID
|
LEFT JOIN SYSTEM_USER t3 ON comp.CREATE_USER = t3.ID
|
left join department dept on dept.COMPANY_ID = comp.ID and dept.PARENT_ID IS NULL AND dept.TYPE != 4
|
LEFT JOIN company_user comu ON dept.id = comu.ROOT_DEPART_ID AND comu.IS_MASTER = 1
|
<where>
|
<if test="dto.name != null and dto.name != ''">
|
comp.NAME LIKE concat('%',#{dto.name},'%')
|
</if>
|
<if test="dto.deleted != null">
|
and comp.DELETED = #{dto.deleted}
|
</if>
|
<if test="dto.oepnType != null">
|
and comp.OEPN_TYPE = #{dto.oepnType}
|
</if>
|
<if test="dto.status != null">
|
and comp.status = #{dto.status}
|
</if>
|
</where>
|
order by comp.CREATE_TIME desc
|
</select>
|
<select id="selectCompanyInfo" resultType="doumeemes.dao.ext.vo.CompanyInfoListVO">
|
SELECT
|
comp.ID,
|
comp.NAME as orgName,
|
dept.name AS remark,
|
comp.ADDR,
|
comp.OEPN_TYPE,
|
comp.REMARK,
|
comp.credit_code,
|
comu.PHONE,
|
comp.FILE_STORE_ADDR as fileStoreAddr
|
,comu.name as mastAccountName
|
,comp.OEPN_VALID_DATE AS oepnValidDate
|
,comp.LINKER as linkName
|
,comp.status
|
,comp.LINK_PHONE
|
,comp.LEGAL_PERSON_PHONE
|
,comp.SALESPERSON
|
,t2.REALNAME as SALESPERSONNAME
|
,t2.MOBILE as SALESPERSONMOBILE
|
,comp.CREATE_USER
|
,t3.REALNAME as CREATE_USER_NAME
|
,comp.CREATE_TIME
|
FROM
|
company comp
|
|
LEFT JOIN SYSTEM_USER t2 ON comp.SALESPERSON = t2.ID
|
LEFT JOIN SYSTEM_USER t3 ON comp.CREATE_USER = t3.ID
|
left join department dept on dept.COMPANY_ID = comp.ID and dept.PARENT_ID IS NULL AND dept.TYPE != 4
|
LEFT JOIN company_user comu ON dept.id = comu.ROOT_DEPART_ID AND comu.IS_MASTER = 1
|
where comp.id = #{companyId}
|
</select>
|
</mapper>
|