| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- <?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.goafanti.common.dao.UserArchivesMapper">
- <resultMap type="com.goafanti.common.model.UserArchives" id="UserArchivesMap">
- <result property="id" column="id" jdbcType="INTEGER"/>
- <result property="uid" column="uid" jdbcType="VARCHAR"/>
- <result property="patentCount" column="patent_count" jdbcType="INTEGER"/>
- <result property="inventionPatentCount" column="invention_patent_count" jdbcType="INTEGER"/>
- <result property="utilityModelCount" column="utility_model_count" jdbcType="INTEGER"/>
- <result property="appearancePatentCount" column="appearance_patent_count" jdbcType="INTEGER"/>
- <result property="softwareWorksCount" column="software_works_count" jdbcType="INTEGER"/>
- <result property="otherCount" column="other_count" jdbcType="INTEGER"/>
- <result property="financialData" column="financial_data" jdbcType="VARCHAR"/>
- <result property="earlyCommunication" column="early_communication" jdbcType="VARCHAR"/>
- <result property="interviewIdeas" column="interview_ideas" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="enterpriseCount" column="enterprise_count" jdbcType="INTEGER"/>
- <result property="channelIndicators" column="channel_indicators" jdbcType="VARCHAR"/>
- <result property="interviewDistribution" column="interview_distribution" jdbcType="VARCHAR"/>
- </resultMap>
-
- <sql id="UserArchivesAllSql">
- id, uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time, enterprise_count, channel_indicators, interview_distribution
- </sql>
- <!--查询单个-->
- <select id="queryById" resultMap="UserArchivesMap">
- select
- <include refid="UserArchivesAllSql"/>
- from user_archives
- where id = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="findUserArchivesList" resultMap="UserArchivesMap">
- select
- <include refid="UserArchivesAllSql"/>
- from user_archives
- <where>
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="uid != null and uid != ''">
- and uid = #{uid}
- </if>
- <if test="patentCount != null">
- and patent_count = #{patentCount}
- </if>
- <if test="inventionPatentCount != null">
- and invention_patent_count = #{inventionPatentCount}
- </if>
- <if test="utilityModelCount != null">
- and utility_model_count = #{utilityModelCount}
- </if>
- <if test="appearancePatentCount != null">
- and appearance_patent_count = #{appearancePatentCount}
- </if>
- <if test="softwareWorksCount != null">
- and software_works_count = #{softwareWorksCount}
- </if>
- <if test="otherCount != null">
- and other_count = #{otherCount}
- </if>
- <if test="financialData != null and financialData != ''">
- and financial_data = #{financialData}
- </if>
- <if test="earlyCommunication != null and earlyCommunication != ''">
- and early_communication = #{earlyCommunication}
- </if>
- <if test="interviewIdeas != null and interviewIdeas != ''">
- and interview_ideas = #{interviewIdeas}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- <if test="enterpriseCount != null">
- and enterprise_count = #{enterpriseCount}
- </if>
- <if test="channelIndicators != null and channelIndicators != ''">
- and channel_indicators = #{channelIndicators}
- </if>
- <if test="interviewDistribution != null and interviewDistribution != ''">
- and interview_distribution = #{interviewDistribution}
- </if>
- </where>
- <if test="page_sql != null">
- ${page_sql}
- </if>
- </select>
- <!--统计总行数-->
- <select id="findUserArchivesCount" resultType="java.lang.Integer">
- select count(1)
- from user_archives
- <where>
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="uid != null and uid != ''">
- and uid = #{uid}
- </if>
- <if test="patentCount != null">
- and patent_count = #{patentCount}
- </if>
- <if test="inventionPatentCount != null">
- and invention_patent_count = #{inventionPatentCount}
- </if>
- <if test="utilityModelCount != null">
- and utility_model_count = #{utilityModelCount}
- </if>
- <if test="appearancePatentCount != null">
- and appearance_patent_count = #{appearancePatentCount}
- </if>
- <if test="softwareWorksCount != null">
- and software_works_count = #{softwareWorksCount}
- </if>
- <if test="otherCount != null">
- and other_count = #{otherCount}
- </if>
- <if test="financialData != null and financialData != ''">
- and financial_data = #{financialData}
- </if>
- <if test="earlyCommunication != null and earlyCommunication != ''">
- and early_communication = #{earlyCommunication}
- </if>
- <if test="interviewIdeas != null and interviewIdeas != ''">
- and interview_ideas = #{interviewIdeas}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- <if test="enterpriseCount != null">
- and enterprise_count = #{enterpriseCount}
- </if>
- <if test="channelIndicators != null and channelIndicators != ''">
- and channel_indicators = #{channelIndicators}
- </if>
- <if test="interviewDistribution != null and interviewDistribution != ''">
- and interview_distribution = #{interviewDistribution}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time, enterprise_count, channel_indicators, interview_distribution)
- values (#{uid}, #{patentCount}, #{inventionPatentCount}, #{utilityModelCount}, #{appearancePatentCount}, #{softwareWorksCount}, #{otherCount}, #{financialData}, #{earlyCommunication}, #{interviewIdeas}, #{createTime}, #{enterpriseCount}, #{channelIndicators}, #{interviewDistribution})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time, enterprise_count, channel_indicators, interview_distribution)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount}, #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.otherCount}, #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime}, #{entity.enterpriseCount}, #{entity.channelIndicators}, #{entity.interviewDistribution})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time, enterprise_count, channel_indicators, interview_distribution)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount}, #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.otherCount}, #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime}, #{entity.enterpriseCount}, #{entity.channelIndicators}, #{entity.interviewDistribution})
- </foreach>
- on duplicate key update
- uid = values(uid),
- patent_count = values(patent_count),
- invention_patent_count = values(invention_patent_count),
- utility_model_count = values(utility_model_count),
- appearance_patent_count = values(appearance_patent_count),
- software_works_count = values(software_works_count),
- other_count = values(other_count),
- financial_data = values(financial_data),
- early_communication = values(early_communication),
- interview_ideas = values(interview_ideas),
- create_time = values(create_time),
- enterprise_count = values(enterprise_count),
- channel_indicators = values(channel_indicators),
- interview_distribution = values(interview_distribution)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update user_archives
- <set>
- <if test="uid != null and uid != ''">
- uid = #{uid},
- </if>
- <if test="patentCount != null">
- patent_count = #{patentCount},
- </if>
- <if test="inventionPatentCount != null">
- invention_patent_count = #{inventionPatentCount},
- </if>
- <if test="utilityModelCount != null">
- utility_model_count = #{utilityModelCount},
- </if>
- <if test="appearancePatentCount != null">
- appearance_patent_count = #{appearancePatentCount},
- </if>
- <if test="softwareWorksCount != null">
- software_works_count = #{softwareWorksCount},
- </if>
- <if test="otherCount != null">
- other_count = #{otherCount},
- </if>
- <if test="financialData != null and financialData != ''">
- financial_data = #{financialData},
- </if>
- <if test="earlyCommunication != null and earlyCommunication != ''">
- early_communication = #{earlyCommunication},
- </if>
- <if test="interviewIdeas != null and interviewIdeas != ''">
- interview_ideas = #{interviewIdeas},
- </if>
- <if test="createTime != null">
- create_time = #{createTime},
- </if>
- <if test="enterpriseCount != null">
- enterprise_count = #{enterpriseCount},
- </if>
- <if test="channelIndicators != null and channelIndicators != ''">
- channel_indicators = #{channelIndicators},
- </if>
- <if test="interviewDistribution != null and interviewDistribution != ''">
- interview_distribution = #{interviewDistribution},
- </if>
- </set>
- where id = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from user_archives where id = #{id}
- </delete>
- <select id="queryByUid" resultMap="UserArchivesMap">
- select
- <include refid="UserArchivesAllSql"/>
- from user_archives
- where uid = #{id}
- </select>
- <select id="selectUserArchivesList" resultType="com.goafanti.customer.bo.OutSelectUserArchives">
- select a.id , a.nickname ,d1.name as province ,d2.name as city ,d3.name area ,
- a.share_type as shareType ,d.channel_type as channelType ,e.enterprise_count as enterpriseCount,
- c.name contactName,f.name adminName,e.channel_indicators as channelIndicators,
- e.interview_ideas as interviewIdeas ,b.intended_project as intendedProject,
- e.interview_distribution as interviewDistribution, g.name depName,
- ic.name as industry ,b.business_scope as businessScope ,e.financial_data as financialData,
- e.early_communication as earlyCommunication,e.patent_count as patentCount,
- e.invention_patent_count as inventionPatentCount,e.utility_model_count as utilityModelCount,
- e.appearance_patent_count as appearancePatentCount,e.software_works_count as softwareWorksCount,
- e.other_count as otherCount
- from user a left join organization_identity b on a.id =b.uid
- left join organization_contact_book c on a.id =c.uid and c.major =1
- left join user_mid d on a.id =d.uid
- left join user_archives e on a.id =e.uid
- left join admin f on a.aid =f.id
- left join department g on f.department_id =g.id
- left join district_glossory d1 on b.location_province=d1.id
- left join district_glossory d2 on b.location_city=d2.id
- left join district_glossory d3 on b.location_area=d3.id
- left join industry_category ic on b.industry=ic.id
- <where>
- <if test="newChannel !=null">
- and a.new_channel = #{newChannel}
- </if>
- <if test="name !=null">
- and a.nickname like concat('%',#{name},'%')
- </if>
- <if test="aid !=null">
- and a.aid = #{aid}
- </if>
- <if test="channelType !=null">
- and d.channel_type in
- <foreach collection="channelType" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="shareType !=null">
- and a.share_type = #{shareType}
- </if>
- <if test="businessScope !=null">
- and find_in_set(#{businessScope},b.business_scope)
- </if>
- <if test="industry !=null">
- and b.industry in
- <foreach collection="industry" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- </where>
- <if test="page_sql != null">
- ${page_sql}
- </if>
- </select>
- <select id="selectUserArchivesCount" resultType="java.lang.Integer">
- select count(*)
- from user a
- left join organization_identity b on a.id =b.uid
- left join user_mid d on a.id =d.uid
- <where>
- <if test="newChannel !=null">
- and a.new_channel = #{newChannel}
- </if>
- <if test="name !=null">
- and a.nickname like concat('%',#{name},'%')
- </if>
- <if test="aid !=null">
- and a.aid = #{aid}
- </if>
- <if test="channelType !=null">
- and d.channel_type in
- <foreach collection="channelType" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="shareType !=null">
- and a.share_type = #{shareType}
- </if>
- <if test="businessScope !=null">
- and find_in_set(#{businessScope},b.business_scope)
- </if>
- <if test="industry !=null">
- and b.industry in
- <foreach collection="industry" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- </mapper>
|