标签:foreach hold shm file time java work man quit
<?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.gwt.flow.mapper.SeCompanyMapper2">
<resultMap id="map1" type="com.gwt.flow.entity.pojo.Companyinfo">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="COMPANY_CODE" jdbcType="VARCHAR" property="companyCode" />
<result column="COMPANY_NAME" jdbcType="VARCHAR" property="companyName" />
<result column="COMPANY_MANAGETYPE" jdbcType="VARCHAR" property="comManageType" />
<result column="ORG_CODE" jdbcType="VARCHAR" property="orgCode" />
<result column="COMPANY_LEVEL" jdbcType="DECIMAL" property="companyLevel" />
<result column="USERNAME" jdbcType="VARCHAR" property="userName" />
<result column="COMPANY_CREATETIME" jdbcType="VARCHAR" property="company_createtime" />
<result column="COMPANY_ORGTYPE" jdbcType="DECIMAL" property="company_orgtype" />
<result column="COMPANY_ECONOMYTYPE" jdbcType="DECIMAL" property="company_economytype" />
<result column="COMPANY_REGISMONEY" jdbcType="DECIMAL" property="company_regismoney" />
<result column="DIST_TRADE" jdbcType="VARCHAR" property="dist_trade" />
<result column="COMPANY_STATE" jdbcType="DECIMAL" property="company_state" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="COMPANY_INCOMEMONEY" jdbcType="DECIMAL" property="company_incomemoney" />
<result column="COMPANY_CREDITCODE" jdbcType="VARCHAR" property="company_creditcode" />
<result column="LEGAL_PEOPLE" jdbcType="VARCHAR" property="legal_people" />
<result column="REGIS_AUTH" jdbcType="VARCHAR" property="regis_auth" />
<result column="REGIS_BUSINESS" jdbcType="VARCHAR" property="regis_business" />
<result column="BUSSINESS_SCOPE" jdbcType="VARCHAR" property="bussness_scope" />
<result column="MAIN_BUSSINESS" jdbcType="VARCHAR" property="main_bussiness" />
<result column="IS_CANCEL" jdbcType="DECIMAL" property="is_cancel" />
<result column="IS_BOARD" jdbcType="DECIMAL" property="is_board" />
<result column="IS_SUPERVISOR" jdbcType="DECIMAL" property="is_supervisor" />
<result column="TOTAL_PEOPLENUM" jdbcType="DECIMAL" property="total_peoplenum" />
<result column="TECH_ASSOCIATION" jdbcType="DECIMAL" property="tech_association" />
<result column="CREATE_TIME" jdbcType="VARCHAR" property="create_time" />
<result column="OWNERSHIP_STRUCTURE" jdbcType="VARCHAR" property="ownership_structure" />
<result column="SCHOOL_STRUCTURE" jdbcType="VARCHAR" property="school_structure" />
<result column="IS_PROPERTY_RIGHT" jdbcType="VARCHAR" property="is_property_right" />
<result column="PROPERTY_RIGHT_CODE" jdbcType="VARCHAR" property="property_right_code" />
<result column="CLOSE_TIME" jdbcType="VARCHAR" property="closeTime" />
<result column="CANCEL_TIME" jdbcType="VARCHAR" property="cancelTime" />
</resultMap>
<resultMap id="map2" type="com.gwt.system.entity.SysOrg">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="CODE" jdbcType="VARCHAR" property="code" />
<result column="PARENT" jdbcType="DECIMAL" property="parent" />
<result column="STATUS" jdbcType="VARCHAR" property="status" />
</resultMap>
<resultMap id="map3" type="com.gwt.flow.entity.pojo.LoginUser">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="TELEPHONE" jdbcType="VARCHAR" property="telephone" />
<result column="PHONE" jdbcType="VARCHAR" property="phone" />
<result column="IS_DISABLE" jdbcType="DECIMAL" property="isok" />
<result column="DESNAME" jdbcType="VARCHAR" property="desname" />
<result column="EMAIL" jdbcType="VARCHAR" property="email" />
<result column="USERNAME" jdbcType="VARCHAR" property="username" />
<result column="ACCOUNT" jdbcType="VARCHAR" property="account" />
<result column="COMPANY_TYPE" jdbcType="VARCHAR" property="companytype" />
<result column="IS_INNER" jdbcType="DECIMAL" property="is_inner" />
<result column="ORGNAME" jdbcType="VARCHAR" property="OrgName" />
</resultMap>
<select id="getInfo" resultType="java.util.HashMap">
SELECT DISTINCT
c.COMPANY_LEVEL,
count( 1 ) over ( partition BY COMPANY_LEVEL ) AS num,
c_b.COMPANY_ECONOMYTYPE,
count( 1 ) over ( partition BY COMPANY_ECONOMYTYPE ) AS ECONOMYTYPEnum
FROM
SE_COMPANY c left join SE_COMPANY_USER c_u ON c.COMPANY_CODE = c_u.COMPANY_CODE left join SYS_USER u ON c_u.USER_ID = u.ID left join SYS_ORG o ON o.CODE = c.ORG_CODE left join SE_COMPANYPEOPLE c_p ON c.COMPANY_CODE = c_p.COMPANY_CODE left join SE_COMPANY_BUSINESS c_b ON c.COMPANY_CODE = c_b.COMPANY_CODE left join SE_COMPANYTECH c_t ON c_t.COMPANY_CODE = c.COMPANY_CODE
WHERE
c.COMPANY_CODE in (SELECT COMPANY_CODE FROM SE_COMPANY START WITH COMPANY_CODE=(SELECT COMPANY_CODE from SE_COMPANY_USER WHERE USER_ID=#{id}) CONNECT BY PRIOR ID=PARENT_ID)
and c.COMPANY_TYPE in(1,3)
<if test="searchContent!=null and searchContent!=‘‘">
and (COMPANY_NAME like ‘%‘||#{searchContent}||‘%‘ or c.COMPANY_CODE like ‘%‘||#{searchContent}||‘%‘or c.COMPANY_MANAGETYPE like ‘%‘||#{searchContent}||‘%‘)
</if>
<if test="comManageType!=null and comManageType.size()>0">
and
<foreach item="item" index="index" collection="comManageType" open="(" separator=" or " close=")">
c.COMPANY_MANAGETYPE like ‘%‘||#{item}||‘%‘
</foreach>
</if>
<if test="industry!=null and industry.size()>0">
and
<foreach item="item" index="index" collection="industry" open="(" separator=" or " close=")">
c_b.DIST_TRADE like #{item}||‘%‘
</foreach>
</if>
<if test="manageDept!=null and manageDept.size()>0">
and
<foreach item="item" index="index" collection="manageDept" open="(" separator=" or " close=")">
c.ORG_CODE = #{item}
</foreach>
</if>
<if test="settDate!=null and settDate.size()>0">
and
<foreach item="item" index="index" collection="settDate" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
<!-- 一年内 -->
c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘)
</when>
<when test="item==2">
<!-- 1-3年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘))
</when>
<when test="item==3">
<!-- 3-10年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘))
</when>
<otherwise>
<!-- 10年以上 -->
c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘)
</otherwise>
</choose>
</foreach>
</if>
<if test="registemoney!=null and registemoney.size()>0">
and
<foreach item="item" index="index" collection="registemoney" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
c_b.COMPANY_REGISMONEY < 100 or c_b.COMPANY_REGISMONEY is null
</when>
<when test="item==2">
(c_b.COMPANY_REGISMONEY >= 100 and c_b.COMPANY_REGISMONEY < 500)
</when>
<when test="item==3">
(c_b.COMPANY_REGISMONEY >= 500 and c_b.COMPANY_REGISMONEY < 1000)
</when>
<when test="item==4">
(c_b.COMPANY_REGISMONEY >= 1000 and c_b.COMPANY_REGISMONEY < 3000)
</when>
<when test="item==5">
(c_b.COMPANY_REGISMONEY >= 3000 and c_b.COMPANY_REGISMONEY < 5000)
</when>
<otherwise>
c_b.COMPANY_REGISMONEY >= 5000
</otherwise>
</choose>
</foreach>
</if>
<if test="level!=null and level.size()>0">
and
<foreach item="item" index="index" collection="level" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c.COMPANY_LEVEL not in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘)
</when>
<otherwise>
c.COMPANY_LEVEL = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="comStely!=null and comStely.size()>0">
and
<foreach item="item" index="index" collection="comStely" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c_b.COMPANY_ORGTYPE =6 or c_b.COMPANY_ORGTYPE is null
</when>
<otherwise>
c_b.COMPANY_ORGTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="economytype!=null and economytype.size()>0">
and
<foreach item="item" index="index" collection="economytype" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c_b.COMPANY_ECONOMYTYPE =6 or c_b.COMPANY_ECONOMYTYPE is null
</when>
<otherwise>
c_b.COMPANY_ECONOMYTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="getCompanyInfo" parameterType="com.gwt.flow.entity.SeCompany">
select
c.ID,
c.COMPANY_TYPE,
c.ORG_CODE,
c.PARENT_ID,
c.COMPANY_NAME,
c.COMPANY_CODE,
c.COMPANY_LEVEL,
c.COMPANY_MANAGETYPE,
c.IS_PROPERTY_RIGHT,
c.PROPERTY_RIGHT_CODE,
c.COMPANY_ADDRESS,
c.COMPANY_FILE,
from
SE_COMPANY c
</select>
<select id="getcompanybycode" resultMap="map1" >
select
<if test="code != null and code.size()>0">
<trim prefix="" suffix="" suffixOverrides=",">
<foreach item="item" index="index" collection="code" open="" separator="," close="">
<choose>
<when test="item==1"> c.COMPANY_NAME</when>
<when test="item==2">c.COMPANY_MANAGETYPE </when>
<when test="item==3"> o.NAME</when>
<when test="item==4">c.COMPANY_CODE </when>
<when test="item==5"> c.CREATE_TIME</when>
<when test="item==6"> c.COMPANY_LEVEL</when>
<when test="item==7"> u.USERNAME </when>
<when test="item==8"> c_b.COMPANY_CREATETIME</when>
<when test="item==9"> c_b.COMPANY_ORGTYPE</when>
<when test="item==10"> c_b.COMPANY_ECONOMYTYPE</when>
<when test="item==11"> c_b.COMPANY_REGISMONEY</when>
<when test="item==12">c_b.COMPANY_INCOMEMONEY </when>
<when test="item==13">c_b.COMPANY_CREDITCODE </when>
<when test="item==14"> c_b.LEGAL_PEOPLE</when>
<when test="item==15">c_b.REGIS_AUTH</when>
<when test="item==16">c_b.REGIS_BUSINESS</when>
<when test="item==17">c_b.DIST_TRADE</when>
<when test="item==18"> c_b.BUSSINESS_SCOPE</when>
<when test="item==19"> c_b.MAIN_BUSSINESS </when>
<when test="item==20"> c_b.COMPANY_STATE</when>
<when test="item==21"> c_b.IS_CANCEL</when>
<when test="item==22">c_p.IS_BOARD</when>
<when test="item==23">c_p.IS_SUPERVISOR</when>
<when test="item==24"> c_p.TOTAL_PEOPLENUM</when>
<when test="item==25"> c_t.TECH_ASSOCIATION</when>
<when test="item==29">IS_PROPERTY_RIGHT</when>
<when test="item==27">c_b.CLOSE_TIME</when>
<when test="item==28">c_b.CANCEL_TIME</when>
<when test="item==26">t.OWNERSHIP_STRUCTURE</when>
<when test="item==30">t2.SCHOOL_STRUCTURE</when>
<when test="item==31">c.PROPERTY_RIGHT_CODE</when>
<otherwise>
</otherwise>
</choose>
</foreach>
</trim>
</if>
from
SE_COMPANY c
left join SE_COMPANY_USER c_u
on c.COMPANY_CODE=c_u.COMPANY_CODE
left join SYS_USER u
on c_u.USER_ID = u.ID
left join SYS_ORG o
on o.CODE=c.ORG_CODE
left join SE_COMPANYPEOPLE c_p
on c.COMPANY_CODE=c_p.COMPANY_CODE
left join SE_COMPANY_BUSINESS c_b
on c.COMPANY_CODE=c_b.COMPANY_CODE
left join SE_COMPANYTECH c_t
on c_t.COMPANY_CODE=c.COMPANY_CODE
left join (select t.COMPANY_CODE, WMSYS.WM_CONCAT(‘(‘||t.SHAREHOLDER||‘:‘||t.HOLDING_PERCENT||‘;‘||CONTRIBUTE_MONEY||‘万元)‘) OWNERSHIP_STRUCTURE
From (select
ID,
SHAREHOLDER,
NVL2(HOLDING_PERCENT,HOLDING_PERCENT,‘0%‘) as HOLDING_PERCENT,
NVL2(CONTRIBUTE_MONEY,CONTRIBUTE_MONEY,0) as CONTRIBUTE_MONEY,
COMPANY_CODE,
STATE
from
SE_EQUITY ) t GROUP BY t.COMPANY_CODE) t on
t.COMPANY_CODE=c.COMPANY_CODE
left join (select t.COMPANY_CODE,
WMSYS.WM_CONCAT(‘(‘||t.SCHOOL_CONTRIBUTE||‘:‘||t.CONTRIBUTE_PERCENT||‘;‘||CONTRIBUTE_MONEY||‘万元;‘||CONTRIBUTE_REALMONEY||‘万元;‘||CURRENCY||‘:‘|| CURRENCY_MONEY||‘万元;‘ ||‘固定资产‘||‘:‘||FIX_ASSET_MONEY||‘万元;‘||‘无形资产:‘||NON_ASSET_MONEY||‘万元)‘
)
SCHOOL_STRUCTURE FROM
(select s.COMPANY_CODE,s.SCHOOL_CONTRIBUTE,
NVL2(s.CONTRIBUTE_PERCENT,s.CONTRIBUTE_PERCENT,‘0%‘) as CONTRIBUTE_PERCENT,
NVL2(s.CONTRIBUTE_MONEY,s.CONTRIBUTE_MONEY,0) as CONTRIBUTE_MONEY,
NVL2(s.CONTRIBUTE_REALMONEY,s.CONTRIBUTE_REALMONEY,0) as CONTRIBUTE_REALMONEY,
NVL2(s.CURRENCY_MONEY,s.CURRENCY_MONEY,0) as CURRENCY_MONEY,
NVL2(s.FIX_ASSET_MONEY,s.FIX_ASSET_MONEY,0) as FIX_ASSET_MONEY,
NVL2(s.NON_ASSET_MONEY,s.NON_ASSET_MONEY,0) as NON_ASSET_MONEY,
s.CURRENCY, s.FIX_ASSET from SE_CONTRIBUTE s)
t GROUP BY t.COMPANY_CODE) t2
on t2.COMPANY_CODE=c.COMPANY_CODE
where
c.COMPANY_CODE in (SELECT COMPANY_CODE FROM SE_COMPANY START WITH COMPANY_CODE=(SELECT COMPANY_CODE from SE_COMPANY_USER WHERE USER_ID=#{id}) CONNECT BY PRIOR ID=PARENT_ID)
and c.COMPANY_TYPE in(1,3)
<if test="searchContent!=null and searchContent!=‘‘">
and (COMPANY_NAME like #{searchContent} or c.COMPANY_CODE like #{searchContent} or c.COMPANY_MANAGETYPE like #{searchContent})
</if>
<if test="comManageType!=null and comManageType.size()>0">
and
<foreach item="item" index="index" collection="comManageType" open="(" separator=" or " close=")">
c.COMPANY_MANAGETYPE like ‘%‘||#{item}||‘%‘
</foreach>
</if>
<if test="industry!=null and industry.size()>0">
and
<foreach item="item" index="index" collection="industry" open="(" separator=" or " close=")">
c_b.DIST_TRADE like #{item}||‘%‘
</foreach>
</if>
<if test="manageDept!=null and manageDept.size()>0">
and
<foreach item="item" index="index" collection="manageDept" open="(" separator=" or " close=")">
c.ORG_CODE = #{item}
</foreach>
</if>
<if test="settDate!=null and settDate.size()>0">
and
<foreach item="item" index="index" collection="settDate" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
<!-- 一年内 -->
c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘)
</when>
<when test="item==2">
<!-- 1-3年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘))
</when>
<when test="item==3">
<!-- 3-10年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘))
</when>
<otherwise>
<!-- 10年以上 -->
c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘)
</otherwise>
</choose>
</foreach>
</if>
<if test="registemoney!=null and registemoney.size()>0">
and
<foreach item="item" index="index" collection="registemoney" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
c_b.COMPANY_REGISMONEY < 100
</when>
<when test="item==2">
(c_b.COMPANY_REGISMONEY >= 100 and c_b.COMPANY_REGISMONEY < 500)
</when>
<when test="item==3">
(c_b.COMPANY_REGISMONEY >= 500 and c_b.COMPANY_REGISMONEY < 1000)
</when>
<when test="item==4">
(c_b.COMPANY_REGISMONEY >= 1000 and c_b.COMPANY_REGISMONEY < 3000)
</when>
<when test="item==5">
(c_b.COMPANY_REGISMONEY >= 3000 and c_b.COMPANY_REGISMONEY < 5000)
</when>
<otherwise>
c_b.COMPANY_REGISMONEY >= 5000
</otherwise>
</choose>
</foreach>
</if>
<if test="level!=null and level.size()>0">
and
<foreach item="item" index="index" collection="level" open="(" separator=" or " close=")">
<choose>
<when test="item==‘other‘">
c.COMPANY_LEVEL not in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘)
</when>
<otherwise>
c.COMPANY_LEVEL = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="comStely!=null and comStely.size()>0">
and
<foreach item="item" index="index" collection="comStely" open="(" separator=" or " close=")">
<choose>
<when test="item==‘other‘">
c_b.COMPANY_ORGTYPE not in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘)
</when>
<otherwise>
c_b.COMPANY_ORGTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="economytype!=null and economytype.size()>0">
and
<foreach item="item" index="index" collection="economytype" open="(" separator=" or " close=")">
c_b.COMPANY_ORGTYPE = #{item}
</foreach>
</if>
</select>
<select id="getcompanybycode2" resultMap="map1" >
select
<if test="code != null and code.size()>0">
<trim prefix="" suffix="" suffixOverrides=",">
<foreach item="item" index="index" collection="code" open="" separator="" close="">
<choose>
<when test="item==1"> c.COMPANY_NAME,</when>
<when test="item==2">c.COMPANY_MANAGETYPE, </when>
<when test="item==3"> o.NAME,</when>
<when test="item==4">c.COMPANY_CODE, </when>
<when test="item==5">c.CREATE_TIME,</when>
<when test="item==6"> c.COMPANY_LEVEL,</when>
<when test="item==7"> u.USERNAME ,</when>
<when test="item==8"> c_b.COMPANY_CREATETIME,</when>
<when test="item==9"> c_b.COMPANY_ORGTYPE,</when>
<when test="item==10"> c_b.COMPANY_ECONOMYTYPE,</when>
<when test="item==11"> c_b.COMPANY_REGISMONEY,</when>
<when test="item==12">c_b.COMPANY_INCOMEMONEY, </when>
<when test="item==13">c_b.COMPANY_CREDITCODE, </when>
<when test="item==14"> c_b.LEGAL_PEOPLE,</when>
<when test="item==15">c_b.REGIS_AUTH,</when>
<when test="item==16">c_b.REGIS_BUSINESS, </when>
<when test="item==17">c_b.DIST_TRADE, </when>
<when test="item==18">c_b.BUSSINESS_SCOPE, </when>
<when test="item==19">c_b.MAIN_BUSSINESS, </when>
<when test="item==20">c_b.COMPANY_STATE,</when>
<when test="item==21">c_b.IS_CANCEL,</when>
<when test="item==22">c_p.IS_BOARD, </when>
<when test="item==23">c_p.IS_SUPERVISOR,</when>
<when test="item==24">c_p.TOTAL_PEOPLENUM,</when>
<when test="item==25">c_t.TECH_ASSOCIATION</when>
<otherwise>
</otherwise>
</choose>
</foreach>
</trim>
</if>
from
SE_COMPANY c
left join SE_COMPANY_USER c_u
on c.COMPANY_CODE=c_u.COMPANY_CODE
left join SYS_USER u
on c_u.USER_ID = u.ID
left join SYS_ORG o
on o.CODE=c.ORG_CODE
left join SE_COMPANYPEOPLE c_p
on c.COMPANY_CODE=c_p.COMPANY_CODE
left join SE_COMPANY_BUSINESS c_b
on c.COMPANY_CODE=c_b.COMPANY_CODE
left join SE_COMPANYTECH c_t
on c_t.COMPANY_CODE=c.COMPANY_CODE
<where>
c_b.IS_CANCEL=1
<if test="searchContent!=null and searchContent!=‘‘">
and (COMPANY_NAME like #{searchContent} or c.COMPANY_CODE like #{searchContent} or c.COMPANY_MANAGETYPE like #{searchContent})
</if>
<if test="comManageType!=null and comManageType.size()>0">
and
<foreach item="item" index="index" collection="comManageType" open="(" separator=" or " close=")">
c.COMPANY_MANAGETYPE like ‘%‘||#{item}||‘%‘
</foreach>
</if>
<if test="industry!=null and industry.size()>0">
and
<foreach item="item" index="index" collection="industry" open="(" separator=" or " close=")">
c_b.DIST_TRADE like #{item}||‘%‘
</foreach>
</if>
<if test="manageDept!=null and manageDept.size()>0">
and
<foreach item="item" index="index" collection="manageDept" open="(" separator=" or " close=")">
c.ORG_CODE = #{item}
</foreach>
</if>
<if test="settDate!=null and settDate.size()>0">
and
<foreach item="item" index="index" collection="settDate" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
<!-- 一年内 -->
c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘)
</when>
<when test="item==2">
<!-- 1-3年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘))
</when>
<when test="item==3">
<!-- 3-10年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘))
</when>
<otherwise>
<!-- 10年以上 -->
c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘)
</otherwise>
</choose>
</foreach>
</if>
<if test="registemoney!=null and registemoney.size()>0">
and
<foreach item="item" index="index" collection="registemoney" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
c_b.COMPANY_REGISMONEY < 100
</when>
<when test="item==2">
(c_b.COMPANY_REGISMONEY >= 100 and c_b.COMPANY_REGISMONEY < 500)
</when>
<when test="item==3">
(c_b.COMPANY_REGISMONEY >= 500 and c_b.COMPANY_REGISMONEY < 1000)
</when>
<when test="item==4">
(c_b.COMPANY_REGISMONEY >= 1000 and c_b.COMPANY_REGISMONEY < 3000)
</when>
<when test="item==5">
(c_b.COMPANY_REGISMONEY >= 3000 and c_b.COMPANY_REGISMONEY < 5000)
</when>
<otherwise>
c_b.COMPANY_REGISMONEY >= 5000
</otherwise>
</choose>
</foreach>
</if>
<if test="level!=null and level.size()>0">
and
<foreach item="item" index="index" collection="level" open="(" separator=" or " close=")">
<choose>
<when test="item==‘other‘">
c.COMPANY_LEVEL not in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘)
</when>
<otherwise>
c.COMPANY_LEVEL = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="comStely!=null and comStely.size()>0">
and
<foreach item="item" index="index" collection="comStely" open="(" separator=" or " close=")">
<choose>
<when test="item==‘other‘">
c_b.COMPANY_ORGTYPE not in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘)
</when>
<otherwise>
c_b.COMPANY_ORGTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="economytype!=null and economytype.size()>0">
and
<foreach item="item" index="index" collection="economytype" open="(" separator=" or " close=")">
c_b.COMPANY_ORGTYPE = #{item}
</foreach>
</if>
</where>
</select>
<select id="getcompanybyContent" resultMap="map1" >
select
NVL2(c.IS_PROPERTY_RIGHT,c.IS_PROPERTY_RIGHT,0) as IS_PROPERTY_RIGHT,
c_b.CLOSE_TIME,
c_b.CANCEL_TIME,
t.OWNERSHIP_STRUCTURE,
t2.SCHOOL_STRUCTURE,
c.ID,
c.CREATE_TIME,
c.COMPANY_TYPE,
c.ORG_CODE,
c.PARENT_ID,
c.COMPANY_NAME,
c.COMPANY_CODE,
c.COMPANY_LEVEL,
c.COMPANY_MANAGETYPE,
c.PROPERTY_RIGHT_CODE,
c.COMPANY_ADDRESS,
c.COMPANY_FILE,
u.USERNAME ,
c_b.COMPANY_CREATETIME,
c_b.COMPANY_ORGTYPE,
c_b.COMPANY_ECONOMYTYPE,
c_b.COMPANY_REGISMONEY,
c_b.DIST_TRADE,
c_b.COMPANY_INCOMEMONEY,
c_b.COMPANY_CREDITCODE,
c_b.IS_CANCEL,
c_b.LEGAL_PEOPLE,
c_b.BUSSINESS_SCOPE,
c_b.MAIN_BUSSINESS,
c_b.REGIS_AUTH,
c_b.REGIS_BUSINESS,
o.NAME,
c_b.COMPANY_STATE,
c_p.TOTAL_PEOPLENUM,
c_p.IS_BOARD,
c_p.IS_SUPERVISOR,
c_t.TECH_ASSOCIATION
from
SE_COMPANY c
left join SE_COMPANY_USER c_u
on c.COMPANY_CODE=c_u.COMPANY_CODE
left join SYS_USER u
on c_u.USER_ID = u.ID
left join SYS_ORG o
on o.CODE=c.ORG_CODE
left join SE_COMPANYPEOPLE c_p
on c.COMPANY_CODE=c_p.COMPANY_CODE
left join SE_COMPANY_BUSINESS c_b
on c.COMPANY_CODE=c_b.COMPANY_CODE
left join SE_COMPANYTECH c_t
on c_t.COMPANY_CODE=c.COMPANY_CODE
left join (select t.COMPANY_CODE, WMSYS.WM_CONCAT(‘(‘||t.SHAREHOLDER||‘:‘||t.HOLDING_PERCENT||‘;‘||CONTRIBUTE_MONEY||‘万元)‘) OWNERSHIP_STRUCTURE
From (select
ID,
SHAREHOLDER,
NVL2(HOLDING_PERCENT,HOLDING_PERCENT,‘0%‘) as HOLDING_PERCENT,
NVL2(CONTRIBUTE_MONEY,CONTRIBUTE_MONEY,0) as CONTRIBUTE_MONEY,
COMPANY_CODE,
STATE
from
SE_EQUITY ) t GROUP BY t.COMPANY_CODE) t on
t.COMPANY_CODE=c.COMPANY_CODE
left join (select t.COMPANY_CODE,
WMSYS.WM_CONCAT(‘(‘||t.SCHOOL_CONTRIBUTE||‘:‘||t.CONTRIBUTE_PERCENT||‘;‘||CONTRIBUTE_MONEY||‘万元;‘||CONTRIBUTE_REALMONEY||‘万元;‘||CURRENCY||‘:‘|| CURRENCY_MONEY||‘万元;‘ ||‘固定资产‘||‘:‘||FIX_ASSET_MONEY||‘万元;‘||‘无形资产:‘||NON_ASSET_MONEY||‘万元)‘
)
SCHOOL_STRUCTURE FROM
(select s.COMPANY_CODE,s.SCHOOL_CONTRIBUTE,
NVL2(s.CONTRIBUTE_PERCENT,s.CONTRIBUTE_PERCENT,‘0%‘) as CONTRIBUTE_PERCENT,
NVL2(s.CONTRIBUTE_MONEY,s.CONTRIBUTE_MONEY,0) as CONTRIBUTE_MONEY,
NVL2(s.CONTRIBUTE_REALMONEY,s.CONTRIBUTE_REALMONEY,0) as CONTRIBUTE_REALMONEY,
NVL2(s.CURRENCY_MONEY,s.CURRENCY_MONEY,0) as CURRENCY_MONEY,
NVL2(s.FIX_ASSET_MONEY,s.FIX_ASSET_MONEY,0) as FIX_ASSET_MONEY,
NVL2(s.NON_ASSET_MONEY,s.NON_ASSET_MONEY,0) as NON_ASSET_MONEY,
s.CURRENCY, s.FIX_ASSET from SE_CONTRIBUTE s)
t GROUP BY t.COMPANY_CODE) t2
on t2.COMPANY_CODE=c.COMPANY_CODE
where
c.COMPANY_CODE in (SELECT COMPANY_CODE FROM SE_COMPANY START WITH COMPANY_CODE=(SELECT COMPANY_CODE from SE_COMPANY_USER WHERE USER_ID=#{id}) CONNECT BY PRIOR ID=PARENT_ID)
and c.COMPANY_TYPE in(1,3)
<if test="searchContent!=null and searchContent!=‘‘">
and (COMPANY_NAME like ‘%‘||#{searchContent}||‘%‘ or c.COMPANY_CODE like ‘%‘||#{searchContent}||‘%‘or c.COMPANY_MANAGETYPE like ‘%‘||#{searchContent}||‘%‘)
</if>
<if test="comManageType!=null and comManageType.size()>0">
and
<foreach item="item" index="index" collection="comManageType" open="(" separator=" or " close=")">
c.COMPANY_MANAGETYPE like ‘%‘||#{item}||‘%‘
</foreach>
</if>
<!-- 加-->
<if test="iscancel!=null and iscancel.size()>0">
and
<foreach item="item" index="index" collection="iscancel" open="(" separator=" or " close=")">
c_b.IS_CANCEL = #{item}
</foreach>
</if>
<if test="companystate!=null and companystate.size()>0">
and
<foreach item="item" index="index" collection="companystate" open="(" separator=" or " close=")">
c_b.COMPANY_STATE = #{item}
</foreach>
</if>
<if test="industry!=null and industry.size()>0">
and
<foreach item="item" index="index" collection="industry" open="(" separator=" or " close=")">
c_b.DIST_TRADE like #{item}||‘%‘
</foreach>
</if>
<if test="manageDept!=null and manageDept.size()>0">
and
<foreach item="item" index="index" collection="manageDept" open="(" separator=" or " close=")">
c.ORG_CODE = #{item}
</foreach>
</if>
<if test="settDate!=null and settDate.size()>0">
and
<foreach item="item" index="index" collection="settDate" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
<!-- 一年内 -->
c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘)
</when>
<when test="item==2">
<!-- 1-3年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘))
</when>
<when test="item==3">
<!-- 3-10年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘))
</when>
<otherwise>
<!-- 10年以上 -->
c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘)
</otherwise>
</choose>
</foreach>
</if>
<if test="registemoney!=null and registemoney.size()>0">
and
<foreach item="item" index="index" collection="registemoney" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
c_b.COMPANY_REGISMONEY < 100 or c_b.COMPANY_REGISMONEY is null
</when>
<when test="item==2">
(c_b.COMPANY_REGISMONEY >= 100 and c_b.COMPANY_REGISMONEY < 500)
</when>
<when test="item==3">
(c_b.COMPANY_REGISMONEY >= 500 and c_b.COMPANY_REGISMONEY < 1000)
</when>
<when test="item==4">
(c_b.COMPANY_REGISMONEY >= 1000 and c_b.COMPANY_REGISMONEY < 3000)
</when>
<when test="item==5">
(c_b.COMPANY_REGISMONEY >= 3000 and c_b.COMPANY_REGISMONEY < 5000)
</when>
<otherwise>
c_b.COMPANY_REGISMONEY >= 5000
</otherwise>
</choose>
</foreach>
</if>
<if test="level!=null and level.size()>0">
and
<foreach item="item" index="index" collection="level" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c.COMPANY_LEVEL not in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘)
</when>
<otherwise>
c.COMPANY_LEVEL = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="comStely!=null and comStely.size()>0">
and
<foreach item="item" index="index" collection="comStely" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c_b.COMPANY_ORGTYPE =6 or c_b.COMPANY_ORGTYPE is null
</when>
<otherwise>
c_b.COMPANY_ORGTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="economytype!=null and economytype.size()>0">
and
<foreach item="item" index="index" collection="economytype" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c_b.COMPANY_ECONOMYTYPE =6 or c_b.COMPANY_ECONOMYTYPE is null
</when>
<otherwise>
c_b.COMPANY_ECONOMYTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="getcompanybyContent2" resultMap="map1" >
select
c.ID,
c.CREATE_TIME,
c.COMPANY_TYPE,
c.ORG_CODE,
c.PARENT_ID,
c.COMPANY_NAME,
c.COMPANY_CODE,
c.COMPANY_LEVEL,
c.COMPANY_MANAGETYPE,
c.IS_PROPERTY_RIGHT,
c.PROPERTY_RIGHT_CODE,
c.COMPANY_ADDRESS,
c.COMPANY_FILE,
u.USERNAME ,
c_b.COMPANY_CREATETIME,
c_b.COMPANY_ORGTYPE,
c_b.COMPANY_ECONOMYTYPE,
c_b.COMPANY_REGISMONEY,
c_b.DIST_TRADE,
c_b.COMPANY_INCOMEMONEY,
c_b.COMPANY_CREDITCODE,
c_b.IS_CANCEL,
c_b.LEGAL_PEOPLE,
c_b.BUSSINESS_SCOPE,
c_b.MAIN_BUSSINESS,
c_b.REGIS_AUTH,
c_b.REGIS_BUSINESS,
o.NAME,
c_b.COMPANY_STATE,
c_p.TOTAL_PEOPLENUM,
c_p.IS_BOARD,
c_p.IS_SUPERVISOR,
c_t.TECH_ASSOCIATION
from
SE_COMPANY c
left join SE_COMPANY_USER c_u
on c.COMPANY_CODE=c_u.COMPANY_CODE
left join SYS_USER u
on c_u.USER_ID = u.ID
left join SYS_ORG o
on o.CODE=c.ORG_CODE
left join SE_COMPANYPEOPLE c_p
on c.COMPANY_CODE=c_p.COMPANY_CODE
left join SE_COMPANY_BUSINESS c_b
on c.COMPANY_CODE=c_b.COMPANY_CODE
left join SE_COMPANYTECH c_t
on c_t.COMPANY_CODE=c.COMPANY_CODE
where
c_b.IS_CANCEL=1
and c.COMPANY_TYPE in(1,3)
<if test="searchContent!=null and searchContent!=‘‘">
and (COMPANY_NAME like ‘%‘||#{searchContent}||‘%‘ or c.COMPANY_CODE like ‘%‘||#{searchContent}||‘%‘or c.COMPANY_MANAGETYPE like ‘%‘||#{searchContent}||‘%‘)
</if>
<if test="comManageType!=null and comManageType.size()>0">
and
<foreach item="item" index="index" collection="comManageType" open="(" separator=" or " close=")">
c.COMPANY_MANAGETYPE like ‘%‘||#{item}||‘%‘
</foreach>
</if>
<if test="industry!=null and industry.size()>0">
and
<foreach item="item" index="index" collection="industry" open="(" separator=" or " close=")">
c_b.DIST_TRADE like #{item}||‘%‘
</foreach>
</if>
<if test="manageDept!=null and manageDept.size()>0">
and
<foreach item="item" index="index" collection="manageDept" open="(" separator=" or " close=")">
c.ORG_CODE = #{item}
</foreach>
</if>
<if test="settDate!=null and settDate.size()>0">
and
<foreach item="item" index="index" collection="settDate" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
<!-- 一年内 -->
c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘)
</when>
<when test="item==2">
<!-- 1-3年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘))
</when>
<when test="item==3">
<!-- 3-10年 -->
(c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*3),‘YYYYMM‘) and c_b.COMPANY_CREATETIME > to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘))
</when>
<otherwise>
<!-- 10年以上 -->
c_b.COMPANY_CREATETIME <= to_char(ADD_MONTHS (sysdate, -12*10),‘YYYYMM‘)
</otherwise>
</choose>
</foreach>
</if>
<if test="registemoney!=null and registemoney.size()>0">
and
<foreach item="item" index="index" collection="registemoney" open="(" separator=" or " close=")">
<choose>
<when test="item==1">
c_b.COMPANY_REGISMONEY < 100 or c_b.COMPANY_REGISMONEY is null
</when>
<when test="item==2">
(c_b.COMPANY_REGISMONEY >= 100 and c_b.COMPANY_REGISMONEY < 500)
</when>
<when test="item==3">
(c_b.COMPANY_REGISMONEY >= 500 and c_b.COMPANY_REGISMONEY < 1000)
</when>
<when test="item==4">
(c_b.COMPANY_REGISMONEY >= 1000 and c_b.COMPANY_REGISMONEY < 3000)
</when>
<when test="item==5">
(c_b.COMPANY_REGISMONEY >= 3000 and c_b.COMPANY_REGISMONEY < 5000)
</when>
<otherwise>
c_b.COMPANY_REGISMONEY >= 5000
</otherwise>
</choose>
</foreach>
</if>
<if test="level!=null and level.size()>0">
and
<foreach item="item" index="index" collection="level" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c.COMPANY_LEVEL not in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘)
</when>
<otherwise>
c.COMPANY_LEVEL = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="comStely!=null and comStely.size()>0">
and
<foreach item="item" index="index" collection="comStely" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c_b.COMPANY_ORGTYPE =6 or c_b.COMPANY_ORGTYPE is null
</when>
<otherwise>
c_b.COMPANY_ORGTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
<if test="economytype!=null and economytype.size()>0">
and
<foreach item="item" index="index" collection="economytype" open="(" separator=" or " close=")">
<choose>
<when test="item==6">
c_b.COMPANY_ECONOMYTYPE =6 or c_b.COMPANY_ECONOMYTYPE is null
</when>
<otherwise>
c_b.COMPANY_ECONOMYTYPE = #{item}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="getorg" resultMap="map2">
SELECT * FROM SYS_ORG
</select>
<select id="getcode1" resultType="string">
SELECT COMPANY_CODE FROM SE_COMPANY where ID=#{id,jdbcType=DECIMAL}
</select>
<select id="gettrade" resultType="string">
SELECT distinct SE_COMPANY_BUSINESS.DIST_TRADE FROM SE_COMPANY_BUSINESS
</select>
<select id="getCode" parameterType="Integer" resultType="string" >
SELECT SE_COMPANY_CLUMNSHOW.CODE
from SE_COMPANY_CLUMNSHOW
WHERE SE_COMPANY_CLUMNSHOW.USER_ID=#{id}
</select>
<select id="getUser" parameterType="Integer" resultMap="map3" >
SELECT s_u.*,s_o.name orgname,c.company_type from
SE_COMPANY_USER c_u left join SE_COMPANY c
on c.COMPANY_CODE=c_u.COMPANY_CODE
left join SYS_USER s_u on c_u.USER_ID = s_u.ID
left join SYS_ORG s_o on s_u.ORG_ID=s_o.ID
where s_u.ID=#{id}
</select>
<update id="updateCode" parameterType="java.util.HashMap">
update SE_COMPANY_CLUMNSHOW set SE_COMPANY_CLUMNSHOW.CODE=#{code} where SE_COMPANY_CLUMNSHOW.USER_ID=#{id,jdbcType=DECIMAL}
</update>
<update id="updateUse" parameterType="com.gwt.flow.entity.pojo.LoginUser">
update SYS_USER s set s.TELEPHONE=#{telephone,jdbcType=VARCHAR },s.DESNAME=#{desname,jdbcType=VARCHAR },s.PHONE=#{phone,jdbcType=VARCHAR},s.EMAIL=#{email,jdbcType=VARCHAR} where s.ID=#{id,jdbcType=DECIMAL}
</update>
<update id="updateUserpwd" parameterType="java.util.HashMap">
update SYS_USER s set s.PASSWORD=#{pwd,jdbcType=VARCHAR } where s.id=#{id}
</update>
<select id="getpwd" resultType="string">
select PASSWORD from SYS_USER where ID=#{id}
</select>
</mapper>
批量更新
<!--批量更新 -->
<update id="batchUpdate" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
UPDATE S_APPOINT
<set>
<if test="item.quitReasonNew != null and item.quitReasonNew!=‘‘ ">
QUIT_REASONNEW = #{item.quitReasonNew,jdbcType=VARCHAR},
</if>
<if test="item.quitTypeNew != null and item.quitTypeNew !=‘‘ ">
QUIT_TYPENEW = #{item.quitTypeNew,jdbcType=VARCHAR},
</if>
</set>
where APPOINT_NUMBER = #{item.appointNumber,jdbcType=VARCHAR}
</foreach>
</update>
批量插入
<insert id="add" parameterType="java.util.List">
insert all
<foreach item="item" index="index" collection="list" open="" separator="" close="">
into PARAMETETER_CONFIGURATION
( INPUT_NAME, WEIGTH_,MONTH_,ACTUAL_WORK)
values (#{item.inputName,jdbcType=DECIMAL},#{item.weigth,jdbcType=VARCHAR}, #{item.month,jdbcType=VARCHAR},#{item.actualWork,jdbcType=VARCHAR})
</foreach>
select 1 from dual
</insert>
标签:foreach hold shm file time java work man quit
原文地址:https://www.cnblogs.com/wcss/p/11847821.html