| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613 |
- <?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.OrgCognizanceMapper" >
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.OrgCognizance" >
- <id column="id" property="id" jdbcType="VARCHAR" />
- <result column="uid" property="uid" jdbcType="VARCHAR" />
- <result column="serial_number" property="serialNumber" jdbcType="INTEGER" />
- <result column="contacts" property="contacts" jdbcType="INTEGER" />
- <result column="comment" property="comment" jdbcType="VARCHAR" />
- <result column="consultant" property="consultant" jdbcType="VARCHAR" />
- <result column="technical_field1" property="technicalField1" jdbcType="INTEGER" />
- <result column="technical_field2" property="technicalField2" jdbcType="INTEGER" />
- <result column="technical_field3" property="technicalField3" jdbcType="INTEGER" />
- <result column="basic_research_cost" property="basicResearchCost" jdbcType="DECIMAL" />
- <result column="accident" property="accident" jdbcType="INTEGER" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="accept_date" property="acceptDate" jdbcType="TIMESTAMP" />
- <result column="issuing_date" property="issuingDate" jdbcType="TIMESTAMP" />
- <result column="certificate_number" property="certificateNumber" jdbcType="VARCHAR" />
- <result column="certificate_url" property="certificateUrl" jdbcType="VARCHAR" />
- <result column="state" property="state" jdbcType="INTEGER" />
- <result column="year" property="year" jdbcType="INTEGER" />
- <result column="record_time" property="recordTime" jdbcType="TIMESTAMP" />
- <result column="large_order" property="largeOrder" jdbcType="INTEGER" />
- <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
- <result column="founder" property="founder" jdbcType="VARCHAR" />
- <result column="tech_principal" property="techPrincipal" jdbcType="VARCHAR" />
- <result column="contract_id" property="contractId" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, uid, serial_number, contacts, comment, consultant, technical_field1, technical_field2,
- technical_field3, basic_research_cost, accident, create_time, accept_date, issuing_date,
- certificate_number, certificate_url, state, year, record_time, large_order, deleted_sign,
- founder, tech_principal, contract_id
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from org_cognizance
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
- delete from org_cognizance
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.OrgCognizance" >
- insert into org_cognizance (id, uid, serial_number,
- contacts, comment, consultant,
- technical_field1, technical_field2, technical_field3,
- basic_research_cost, accident, create_time,
- accept_date, issuing_date, certificate_number,
- certificate_url, state, year, record_time, large_order, deleted_sign, founder,
- tech_principal, contract_id
- )
- values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER},
- #{contacts,jdbcType=INTEGER}, #{comment,jdbcType=VARCHAR}, #{consultant,jdbcType=VARCHAR},
- #{technicalField1,jdbcType=INTEGER}, #{technicalField2,jdbcType=INTEGER}, #{technicalField3,jdbcType=INTEGER},
- #{basicResearchCost,jdbcType=DECIMAL}, #{accident,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
- #{acceptDate,jdbcType=TIMESTAMP}, #{issuingDate,jdbcType=TIMESTAMP}, #{certificateNumber,jdbcType=VARCHAR},
- #{certificateUrl,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{year,jdbcType=INTEGER}, #{recordTime,jdbcType=TIMESTAMP},
- #{largeOrder,jdbcType=INTEGER}, #{deletedSign,jdbcType=INTEGER}, #{founder,jdbcType=VARCHAR},
- #{techPrincipal,jdbcType=VARCHAR}, #{contractId,jdbcType=VARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.OrgCognizance" >
- insert into org_cognizance
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="uid != null" >
- uid,
- </if>
- <if test="serialNumber != null" >
- serial_number,
- </if>
- <if test="contacts != null" >
- contacts,
- </if>
- <if test="comment != null" >
- comment,
- </if>
- <if test="consultant != null" >
- consultant,
- </if>
- <if test="technicalField1 != null" >
- technical_field1,
- </if>
- <if test="technicalField2 != null" >
- technical_field2,
- </if>
- <if test="technicalField3 != null" >
- technical_field3,
- </if>
- <if test="basicResearchCost != null" >
- basic_research_cost,
- </if>
- <if test="accident != null" >
- accident,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="acceptDate != null" >
- accept_date,
- </if>
- <if test="issuingDate != null" >
- issuing_date,
- </if>
- <if test="certificateNumber != null" >
- certificate_number,
- </if>
- <if test="certificateUrl != null" >
- certificate_url,
- </if>
- <if test="state != null" >
- state,
- </if>
- <if test="year != null" >
- year,
- </if>
- <if test="recordTime != null" >
- record_time,
- </if>
- <if test="largeOrder != null" >
- large_order,
- </if>
- <if test="deletedSign != null" >
- deleted_sign,
- </if>
- <if test="founder != null" >
- founder,
- </if>
- <if test="techPrincipal != null" >
- tech_principal,
- </if>
- <if test="contractId != null" >
- contract_id,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="uid != null" >
- #{uid,jdbcType=VARCHAR},
- </if>
- <if test="serialNumber != null" >
- #{serialNumber,jdbcType=INTEGER},
- </if>
- <if test="contacts != null" >
- #{contacts,jdbcType=INTEGER},
- </if>
- <if test="comment != null" >
- #{comment,jdbcType=VARCHAR},
- </if>
- <if test="consultant != null" >
- #{consultant,jdbcType=VARCHAR},
- </if>
- <if test="technicalField1 != null" >
- #{technicalField1,jdbcType=INTEGER},
- </if>
- <if test="technicalField2 != null" >
- #{technicalField2,jdbcType=INTEGER},
- </if>
- <if test="technicalField3 != null" >
- #{technicalField3,jdbcType=INTEGER},
- </if>
- <if test="basicResearchCost != null" >
- #{basicResearchCost,jdbcType=DECIMAL},
- </if>
- <if test="accident != null" >
- #{accident,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="acceptDate != null" >
- #{acceptDate,jdbcType=TIMESTAMP},
- </if>
- <if test="issuingDate != null" >
- #{issuingDate,jdbcType=TIMESTAMP},
- </if>
- <if test="certificateNumber != null" >
- #{certificateNumber,jdbcType=VARCHAR},
- </if>
- <if test="certificateUrl != null" >
- #{certificateUrl,jdbcType=VARCHAR},
- </if>
- <if test="state != null" >
- #{state,jdbcType=INTEGER},
- </if>
- <if test="year != null" >
- #{year,jdbcType=INTEGER},
- </if>
- <if test="recordTime != null" >
- #{recordTime,jdbcType=TIMESTAMP},
- </if>
- <if test="largeOrder != null" >
- #{largeOrder,jdbcType=INTEGER},
- </if>
- <if test="deletedSign != null" >
- #{deletedSign,jdbcType=INTEGER},
- </if>
- <if test="founder != null" >
- #{founder,jdbcType=VARCHAR},
- </if>
- <if test="techPrincipal != null" >
- #{techPrincipal,jdbcType=VARCHAR},
- </if>
- <if test="contractId != null" >
- #{contractId,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrgCognizance" >
- update org_cognizance
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=VARCHAR},
- </if>
- <if test="serialNumber != null" >
- serial_number = #{serialNumber,jdbcType=INTEGER},
- </if>
- <if test="contacts != null" >
- contacts = #{contacts,jdbcType=INTEGER},
- </if>
- <if test="comment != null" >
- comment = #{comment,jdbcType=VARCHAR},
- </if>
- <if test="consultant != null" >
- consultant = #{consultant,jdbcType=VARCHAR},
- </if>
- <if test="technicalField1 != null" >
- technical_field1 = #{technicalField1,jdbcType=INTEGER},
- </if>
- <if test="technicalField2 != null" >
- technical_field2 = #{technicalField2,jdbcType=INTEGER},
- </if>
- <if test="technicalField3 != null" >
- technical_field3 = #{technicalField3,jdbcType=INTEGER},
- </if>
- <if test="basicResearchCost != null" >
- basic_research_cost = #{basicResearchCost,jdbcType=DECIMAL},
- </if>
- <if test="accident != null" >
- accident = #{accident,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="acceptDate != null" >
- accept_date = #{acceptDate,jdbcType=TIMESTAMP},
- </if>
- <if test="issuingDate != null" >
- issuing_date = #{issuingDate,jdbcType=TIMESTAMP},
- </if>
- <if test="certificateNumber != null" >
- certificate_number = #{certificateNumber,jdbcType=VARCHAR},
- </if>
- <if test="certificateUrl != null" >
- certificate_url = #{certificateUrl,jdbcType=VARCHAR},
- </if>
- <if test="state != null" >
- state = #{state,jdbcType=INTEGER},
- </if>
- <if test="year != null" >
- year = #{year,jdbcType=INTEGER},
- </if>
- <if test="recordTime != null" >
- record_time = #{recordTime,jdbcType=TIMESTAMP},
- </if>
- <if test="largeOrder != null" >
- large_order = #{largeOrder,jdbcType=INTEGER},
- </if>
- <if test="deletedSign != null" >
- deleted_sign = #{deletedSign,jdbcType=INTEGER},
- </if>
- <if test="founder != null" >
- founder = #{founder,jdbcType=VARCHAR},
- </if>
- <if test="techPrincipal != null" >
- tech_principal = #{techPrincipal,jdbcType=VARCHAR},
- </if>
- <if test="contractId != null" >
- contract_id = #{contractId,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrgCognizance" >
- update org_cognizance
- set uid = #{uid,jdbcType=VARCHAR},
- serial_number = #{serialNumber,jdbcType=INTEGER},
- contacts = #{contacts,jdbcType=INTEGER},
- comment = #{comment,jdbcType=VARCHAR},
- consultant = #{consultant,jdbcType=VARCHAR},
- technical_field1 = #{technicalField1,jdbcType=INTEGER},
- technical_field2 = #{technicalField2,jdbcType=INTEGER},
- technical_field3 = #{technicalField3,jdbcType=INTEGER},
- basic_research_cost = #{basicResearchCost,jdbcType=DECIMAL},
- accident = #{accident,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- accept_date = #{acceptDate,jdbcType=TIMESTAMP},
- issuing_date = #{issuingDate,jdbcType=TIMESTAMP},
- certificate_number = #{certificateNumber,jdbcType=VARCHAR},
- certificate_url = #{certificateUrl,jdbcType=VARCHAR},
- state = #{state,jdbcType=INTEGER},
- year = #{year,jdbcType=INTEGER},
- record_time = #{recordTime,jdbcType=TIMESTAMP},
- large_order = #{largeOrder,jdbcType=INTEGER},
- deleted_sign = #{deletedSign,jdbcType=INTEGER},
- founder = #{founder,jdbcType=VARCHAR},
- tech_principal = #{techPrincipal,jdbcType=VARCHAR},
- contract_id = #{contractId,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
-
- <select id="findCognizanceBoByPage" parameterType="String" resultType="com.goafanti.cognizance.bo.CognizanceBo">
- select c.id as cid, c.uid as uid, c.serial_number as serialNumber, i.licence_province as locationProvince,
- i.unit_name as unitName, c.contacts, c.create_time as createTime, c.contract_id as contractId,
- c.comment, c.state, c.certificate_number as certificateNumber, c.large_order as largeOrder,
- c.issuing_date as issuingDate, c.year, a.name as consultant,
- CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
- CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
- CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
- ad.name as founder, ct.serial_number as contractNumber
- from org_cognizance c
- LEFT JOIN organization_identity i on c.uid = i.uid
- LEFT JOIN admin a on c.consultant = a.id
- LEFT JOIN admin ad on c.founder = ad.id
- left join contract ct on ct.id = c.contract_id
- <if test="principal != null">
- left join contract_log l on c.contract_id=l.cid
- </if>
- where c.deleted_sign = 0
- <if test="principal != null">
- and l.principal = #{principal,jdbcType=VARCHAR}
- </if>
- <if test="unitName != null">
- and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
- </if>
- <if test="uid != null">
- and c.uid = #{uid,jdbcType=VARCHAR}
- </if>
- <if test="contractId != null">
- and c.contract_id = #{contractId,jdbcType=VARCHAR}
- </if>
- <if test="locationProvince != null">
- and i.licence_province = #{locationProvince, jdbcType=INTEGER}
- </if>
- <if test="principal != null">
- group by c.id
- </if>
- order by c.serial_number desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="findCognizanceBoCount" resultType="java.lang.Integer" parameterType="String">
- select count(1)
- from org_cognizance c
- LEFT JOIN organization_identity i on c.uid = i.uid
- <if test="principal != null">
- left join contract_log l on c.contract_id=l.cid
- </if>
- where c.deleted_sign = 0
- <if test="principal != null">
- and l.principal = #{principal,jdbcType=VARCHAR}
- </if>
- <if test="contractId != null">
- and c.contract_id = #{contractId,jdbcType=VARCHAR}
- </if>
- <if test="uid != null">
- and c.uid = #{uid,jdbcType=VARCHAR}
- </if>
- <if test="unitName != null">
- and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
- </if>
- <if test="locationProvince != null">
- and i.licence_province = #{locationProvince, jdbcType=INTEGER}
- </if>
- <if test="principal != null">
- group by c.id
- </if>
- </select>
-
-
- <select id="selectCognizanceOrgInfoBoByUidAndCid" resultType="com.goafanti.cognizance.bo.CognizanceOrgInfoBo">
- select u.id as uid, c.id as cid, o.unit_name as unitName, o.org_code as orgCode, o.postal_address as postalAddress,
- c.contacts, c.technical_field1 as technicalField1, c.technical_field2 as technicalField2, c.technical_field3 as technicalField3,
- c.basic_research_cost as basicResearchCost, c.accident, c.large_order as largeOrder, c.year, c.certificate_number as certificateNumber
- from (select id from user where id = #{0}) u
- LEFT JOIN organization_identity o on u.id = o.uid
- INNER JOIN org_cognizance c on c.uid = u.id and c.deleted_sign = 0 and c.id = #{1}
- </select>
-
- <select id="selectCognizanceResearchCostBoByUidAndYear" resultType="com.goafanti.cognizance.bo.CognizanceResearchCostBo">
- select m.uid, sum(m.cost1) as researchCost, sum(m.territory) as territory from(
- select uid, (internal_labor_cost + internal_direct_cost + internal_depreciation_cost + internal_amortization_cost
- + internal_design_cost + internal_equipment_cost + internal_other_cost +external_total_cost) as cost1,
- external_abroad_cost as territory
- from org_activity_cost
- where (start_date >= (select str_to_date(CONCAT(#{0}-3,'-01-01'), '%Y-%m-%d %H'))
- and start_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H')))
- or (end_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H')) and
- end_date >= (select str_to_date(CONCAT(#{0}-3,'-01-01'), '%Y-%m-%d %H')))
- and deleted_sign = 0
- ) m where m.uid = #{1} GROUP BY m.uid
- </select>
-
- <select id="selectCognizanceManageCostBoByUidAndYear" resultType="com.goafanti.cognizance.bo.CognizanceManageCostBo">
- select u.id as uid, a.netAsset1, a.salesRevenue1, a.grossProfit1, b.netAsset2, b.salesRevenue2, b.grossProfit2,
- c.netAsset3, c.salesRevenue3, c.grossProfit3 from
- (select id from user where id = #{1}) u
- LEFT JOIN
- (
- select uid, net_asset as netAsset1, gross_profit as grossProfit1, sales_revenue as salesRevenue1 from org_finance where uid = #{1} and year =
- #{0}-1 and deleted_sign = 0
- ) a ON a.uid = u.id
- LEFT JOIN
- (
- select uid, net_asset as netAsset2, gross_profit as grossProfit2, sales_revenue as salesRevenue2 from org_finance where uid = #{1} and year =
- #{0}-2 and deleted_sign = 0
- ) b on b.uid = u. id
- LEFT JOIN
- (
- select uid, net_asset as netAsset3, gross_profit as grossProfit3, sales_revenue as salesRevenue3 from org_finance where uid = #{1} and year =
- #{0}-3 and deleted_sign = 0
- ) c on c.uid = u.id
- </select>
-
- <select id="selectCognizanceCatagoryBoByUidAndYear" resultType="com.goafanti.cognizance.bo.CognizanceCatagoryBo">
- select
- u.id as uid,
- a.firstCatagory, b.secondCatagory,
- c.firmTotal,
- c.techTotal,
- d.totalRevenue FROM
- (
- select id from user where id = #{1}
- ) u
- LEFT JOIN
- (
- select
- uid,
- count(1) as firstCatagory
- from org_intellectual_property
- where uid = #{1}
- and evaluation_category= 0
- and deleted_sign = 0
- and authorization_date >=
- (
- select
- str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H')
- )
- and authorization_date <![CDATA[ < ]]>
- (
- select
- str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H')
- )
- and deleted_sign = 0
- GROUP BY uid
- ) a on a.uid = u.id
- LEFT JOIN
- (
- select
- uid,
- count(1) as secondCatagory
- from org_intellectual_property
- where uid = #{1}
- and evaluation_category = 1
- and deleted_sign = 0
- and authorization_date >=
- (
- select
- str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H')
- )
- and authorization_date <![CDATA[ < ]]>
- (
- select
- str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H')
- )
- GROUP BY uid
- ) b on b.uid = u.id
- LEFT JOIN
- (
- select
- uid,
- firm_total as firmTotal,
- tech_total as techTotal
- from org_human_resource
- where
- uid = #{1}
- and year = #{0}-1
- and deleted_sign = 0
- ) c on c.uid = u.id
- LEFT JOIN
- (
- SELECT
- uid,
- (operating_income + non_operating_income - non_taxable_income) as totalRevenue
- from org_ratepay
- where
- uid = #{1}
- and year = #{0}-1
- and deleted_sign = 0
- ) d on d.uid = u.id
- </select>
-
- <select id="selectLastYearRevenueByUidAndYear" resultType="java.math.BigDecimal">
- SELECT
- sum(last_year_revenue) as lastYearRevenue
- from org_tech_product
- where
- uid = #{1}
- and year = #{0}
- and deleted_sign = 0
- </select>
-
- <select id="selectCognizanceByUidAndYear" resultMap="BaseResultMap" >
- select
- <include refid="Base_Column_List" />
- from org_cognizance
- where year = #{0} and uid = #{1} and deleted_sign = 0
- </select>
-
- <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
- update org_cognizance set deleted_sign = 1
- where id in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
-
- <select id="findCultivationListByPage" parameterType="java.lang.String" resultType="com.goafanti.cognizance.bo.CultivationListBo">
- select
- u.id as uid,
- i.licence_province as province,
- i.unit_name as unitName,
- i.cog_contacts as cogContacts,
- i.certificate_number as certificateNumber,
- i.issuing_date as issuingDate,
- a.name as consultant,
- i.tech_principal,
- CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
- CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
- CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts
- from user u
- LEFT JOIN organization_identity i on u.id = i.uid
- LEFT JOIN admin a on a.id = u.aid
- where u.type = 1 and u.lvl = 1
- <if test="unitName != null">
- and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
- </if>
- <if test="uid != null">
- and u.id = #{uid,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and i.licence_province = #{province,jdbcType=INTEGER}
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="findCultivationCount" resultType="java.lang.Integer" parameterType="java.lang.String">
- select count(1)
- from user u
- LEFT JOIN organization_identity i on u.id = i.uid
- LEFT JOIN admin a on a.id = u.aid
- where u.type = 1 and u.lvl = 1
- <if test="unitName != null">
- and i.unit_name = #{unitName,jdbcType=VARCHAR}
- </if>
- <if test="uid != null">
- and u.id = #{uid,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and i.licence_province = #{province,jdbcType=INTEGER}
- </if>
- </select>
-
- <select id="selectLatelyRecordYear" resultType="Integer" parameterType="java.lang.String" >
- select
- Max(year)
- from org_cognizance
- where state not in (8, 11, 13)
- and deleted_sign = 0
- and uid= #{uid,jdbcType=VARCHAR}
- </select>
-
- <select id="selectContractCognizanceByContractId" resultType="com.goafanti.cognizance.bo.CognizanceContractBo" parameterType="java.lang.String" >
- select
- oc.id, oc.uid, oc.contract_id as contractId,
- oc.year, oc.serial_number as serialNumber, oc.state,
- oc.certificate_Number as certificate_number, a.name as techPrincipal
- from org_cognizance oc
- left join admin a on a.id = oc.tech_principal
- where oc.contract_id = #{contractId,jdbcType=VARCHAR}
- </select>
-
- <update id="batchDeleteByContractId" parameterType="java.util.List">
- update org_cognizance set deleted_sign = 1
- where contract_id in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
- </mapper>
|