| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541 |
- <?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.ContractMapper" >
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.Contract" >
- <id column="id" property="id" jdbcType="VARCHAR" />
- <result column="uid" property="uid" jdbcType="VARCHAR" />
- <result column="serial_number" property="serialNumber" jdbcType="INTEGER" />
- <result column="name" property="name" jdbcType="VARCHAR" />
- <result column="type" property="type" jdbcType="INTEGER" />
- <result column="sign_date" property="signDate" jdbcType="TIMESTAMP" />
- <result column="founder" property="founder" jdbcType="VARCHAR" />
- <result column="depict" property="depict" jdbcType="VARCHAR" />
- <result column="status" property="status" jdbcType="INTEGER" />
- <result column="patent_num" property="patentNum" jdbcType="INTEGER" />
- <result column="patent_status" property="patentStatus" jdbcType="INTEGER" />
- <result column="copyright_num" property="copyrightNum" jdbcType="INTEGER" />
- <result column="copyright_status" property="copyrightStatus" jdbcType="INTEGER" />
- <result column="cognizance_year" property="cognizanceYear" jdbcType="INTEGER" />
- <result column="cognizance_status" property="cognizanceStatus" jdbcType="INTEGER" />
- <result column="tech_project_num" property="techProjectNum" jdbcType="INTEGER" />
- <result column="tech_project_status" property="techProjectStatus" jdbcType="INTEGER" />
- <result column="comment" property="comment" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="complete_date" property="completeDate" jdbcType="TIMESTAMP" />
- <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
- <result column="contacts" property="contacts" jdbcType="INTEGER" />
- <result column="previous_fee" property="previousFee" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, uid, serial_number, name, type, sign_date, founder, depict, status, patent_num,
- patent_status, copyright_num, copyright_status, cognizance_year, cognizance_status,
- tech_project_num, tech_project_status, comment, create_time, complete_date, deleted_sign,
- contacts, previous_fee
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from contract
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
- delete from contract
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.Contract" >
- insert into contract (id, uid, serial_number,
- name, type, sign_date,
- founder, depict, status,
- patent_num, patent_status, copyright_num,
- copyright_status, cognizance_year, cognizance_status,
- tech_project_num, tech_project_status, comment,
- create_time, complete_date, deleted_sign, contacts, previous_fee
- )
- values (
- #{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER},
- #{name,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{signDate,jdbcType=TIMESTAMP},
- #{founder,jdbcType=VARCHAR}, #{depict,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
- #{patentNum,jdbcType=INTEGER}, #{patentStatus,jdbcType=INTEGER}, #{copyrightNum,jdbcType=INTEGER},
- #{copyrightStatus,jdbcType=INTEGER}, #{cognizanceYear,jdbcType=INTEGER}, #{cognizanceStatus,jdbcType=INTEGER},
- #{techProjectNum,jdbcType=INTEGER}, #{techProjectStatus,jdbcType=INTEGER}, #{comment,jdbcType=VARCHAR},
- #{createTime,jdbcType=TIMESTAMP}, #{completeDate,jdbcType=TIMESTAMP}, #{deletedSign,jdbcType=INTEGER},
- #{contacts,jdbcType=INTEGER}, #{previousFee,jdbcType=VARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.Contract" >
- insert into contract
- <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="name != null" >
- name,
- </if>
- <if test="type != null" >
- type,
- </if>
- <if test="signDate != null" >
- sign_date,
- </if>
- <if test="founder != null" >
- founder,
- </if>
- <if test="depict != null" >
- depict,
- </if>
- <if test="status != null" >
- status,
- </if>
- <if test="patentNum != null" >
- patent_num,
- </if>
- <if test="patentStatus != null" >
- patent_status,
- </if>
- <if test="copyrightNum != null" >
- copyright_num,
- </if>
- <if test="copyrightStatus != null" >
- copyright_status,
- </if>
- <if test="cognizanceYear != null" >
- cognizance_year,
- </if>
- <if test="cognizanceStatus != null" >
- cognizance_status,
- </if>
- <if test="techProjectNum != null" >
- tech_project_num,
- </if>
- <if test="techProjectStatus != null" >
- tech_project_status,
- </if>
- <if test="comment != null" >
- comment,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="completeDate != null" >
- complete_date,
- </if>
- <if test="deletedSign != null" >
- deleted_sign,
- </if>
- <if test="contacts != null" >
- contacts,
- </if>
- <if test="previousFee != null" >
- previous_fee,
- </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="name != null" >
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="type != null" >
- #{type,jdbcType=INTEGER},
- </if>
- <if test="signDate != null" >
- #{signDate,jdbcType=TIMESTAMP},
- </if>
- <if test="founder != null" >
- #{founder,jdbcType=VARCHAR},
- </if>
- <if test="depict != null" >
- #{depict,jdbcType=VARCHAR},
- </if>
- <if test="status != null" >
- #{status,jdbcType=INTEGER},
- </if>
- <if test="patentNum != null" >
- #{patentNum,jdbcType=INTEGER},
- </if>
- <if test="patentStatus != null" >
- #{patentStatus,jdbcType=INTEGER},
- </if>
- <if test="copyrightNum != null" >
- #{copyrightNum,jdbcType=INTEGER},
- </if>
- <if test="copyrightStatus != null" >
- #{copyrightStatus,jdbcType=INTEGER},
- </if>
- <if test="cognizanceYear != null" >
- #{cognizanceYear,jdbcType=INTEGER},
- </if>
- <if test="cognizanceStatus != null" >
- #{cognizanceStatus,jdbcType=INTEGER},
- </if>
- <if test="techProjectNum != null" >
- #{techProjectNum,jdbcType=INTEGER},
- </if>
- <if test="techProjectStatus != null" >
- #{techProjectStatus,jdbcType=INTEGER},
- </if>
- <if test="comment != null" >
- #{comment,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="completeDate != null" >
- #{completeDate,jdbcType=TIMESTAMP},
- </if>
- <if test="deletedSign != null" >
- #{deletedSign,jdbcType=INTEGER},
- </if>
- <if test="contacts != null" >
- #{contacts,jdbcType=INTEGER},
- </if>
- <if test="previousFee != null" >
- #{previousFee,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Contract" >
- update contract
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=VARCHAR},
- </if>
- <if test="serialNumber != null" >
- serial_number = #{serialNumber,jdbcType=INTEGER},
- </if>
- <if test="name != null" >
- name = #{name,jdbcType=VARCHAR},
- </if>
- <if test="type != null" >
- type = #{type,jdbcType=INTEGER},
- </if>
- <if test="signDate != null" >
- sign_date = #{signDate,jdbcType=TIMESTAMP},
- </if>
- <if test="founder != null" >
- founder = #{founder,jdbcType=VARCHAR},
- </if>
- <if test="depict != null" >
- depict = #{depict,jdbcType=VARCHAR},
- </if>
- <if test="status != null" >
- status = #{status,jdbcType=INTEGER},
- </if>
- <if test="patentNum != null" >
- patent_num = #{patentNum,jdbcType=INTEGER},
- </if>
- <if test="patentStatus != null" >
- patent_status = #{patentStatus,jdbcType=INTEGER},
- </if>
- <if test="copyrightNum != null" >
- copyright_num = #{copyrightNum,jdbcType=INTEGER},
- </if>
- <if test="copyrightStatus != null" >
- copyright_status = #{copyrightStatus,jdbcType=INTEGER},
- </if>
- <if test="cognizanceYear != null" >
- cognizance_year = #{cognizanceYear,jdbcType=INTEGER},
- </if>
- <if test="cognizanceStatus != null" >
- cognizance_status = #{cognizanceStatus,jdbcType=INTEGER},
- </if>
- <if test="techProjectNum != null" >
- tech_project_num = #{techProjectNum,jdbcType=INTEGER},
- </if>
- <if test="techProjectStatus != null" >
- tech_project_status = #{techProjectStatus,jdbcType=INTEGER},
- </if>
- <if test="comment != null" >
- comment = #{comment,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="completeDate != null" >
- complete_date = #{completeDate,jdbcType=TIMESTAMP},
- </if>
- <if test="deletedSign != null" >
- deleted_sign = #{deletedSign,jdbcType=INTEGER},
- </if>
- <if test="contacts != null" >
- contacts = #{contacts,jdbcType=INTEGER},
- </if>
- <if test="previousFee != null" >
- previous_fee = #{previousFee,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Contract" >
- update contract
- set uid = #{uid,jdbcType=VARCHAR},
- serial_number = #{serialNumber,jdbcType=INTEGER},
- name = #{name,jdbcType=VARCHAR},
- type = #{type,jdbcType=INTEGER},
- sign_date = #{signDate,jdbcType=TIMESTAMP},
- founder = #{founder,jdbcType=VARCHAR},
- depict = #{depict,jdbcType=VARCHAR},
- status = #{status,jdbcType=INTEGER},
- patent_num = #{patentNum,jdbcType=INTEGER},
- patent_status = #{patentStatus,jdbcType=INTEGER},
- copyright_num = #{copyrightNum,jdbcType=INTEGER},
- copyright_status = #{copyrightStatus,jdbcType=INTEGER},
- cognizance_year = #{cognizanceYear,jdbcType=INTEGER},
- cognizance_status = #{cognizanceStatus,jdbcType=INTEGER},
- tech_project_num = #{techProjectNum,jdbcType=INTEGER},
- tech_project_status = #{techProjectStatus,jdbcType=INTEGER},
- comment = #{comment,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- complete_date = #{completeDate,jdbcType=TIMESTAMP},
- deleted_sign = #{deletedSign,jdbcType=INTEGER},
- contacts = #{contacts,jdbcType=INTEGER},
- previous_fee = #{previousFee,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
-
- <select id="findManageContractListByPage" parameterType="String" resultType="com.goafanti.contract.bo.ContractManageListBo">
- select c.id, c.uid, oi.unit_name as unitName,
- oi.licence_province as province, c.serial_number as serialNumber, c.type,
- c.sign_date as signDate, a.name as founder,
- c.depict, c.status, c.complete_date as completeDate, c.contacts
- from contract c
- LEFT JOIN organization_identity oi on oi.uid = c.uid
- LEFT JOIN admin a on a.id = c.founder
- <if test="principal != null">
- LEFT JOIN contract_log cl on cl.cid = c.id
- </if>
- where c.deleted_sign = 0
- <if test="principal != null">
- and cl.principal = #{principal,jdbcType=VARCHAR}
- </if>
- <if test="serialNumber !=null">
- and c.serialNumber = #{serialNumber,jdbcType=INTEGER}
- </if>
- <if test="id !=null">
- and c.id = #{id,jdbcType=VARCHAR}
- </if>
- <if test="type !=null">
- and c.type = #{type,jdbcType=INTEGER}
- </if>
- <if test="uid !=null">
- and c.uid = #{uid,jdbcType=INTEGER}
- </if>
- <if test="status !=null">
- and c.status= #{status ,jdbcType=INTEGER}
- </if>
- <if test="cStart !=null">
- and c.sign_date <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
- </if>
- <if test="cEnd !=null">
- and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
- </if>
- <if test="province !=null">
- and oi.licence_province= #{province,jdbcType=INTEGER}
- </if>
- <if test="unitName !=null">
- and oi.unit_name= #{unitName,jdbcType=VARCAHR}
- </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="findManageContractCount" resultType="java.lang.Integer"
- parameterType="String">
- select count(1)
- from contract c
- LEFT JOIN organization_identity oi on oi.uid = c.uid
- LEFT JOIN admin a on a.id = c.founder
- <if test="principal != null">
- LEFT JOIN contract_log cl on cl.cid = c.id
- </if>
- where c.deleted_sign = 0
- <if test="principal != null">
- and cl.principal = #{principal,jdbcType=VARCHAR}
- </if>
- <if test="id !=null">
- and c.id = #{id,jdbcType=VARCHAR}
- </if>
- <if test="serialNumber !=null">
- and c.serialNumber = #{serialNumber,jdbcType=INTEGER}
- </if>
- <if test="type !=null">
- and c.type = #{type,jdbcType=INTEGER}
- </if>
- <if test="uid !=null">ContractDetail
- and c.uid = #{uid,jdbcType=INTEGER}
- </if>
- <if test="status !=null">
- and c.status= #{status ,jdbcType=INTEGER}
- </if>
- <if test="cStart !=null">
- and c.sign_date <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
- </if>
- <if test="cEnd !=null">
- and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
- </if>
- <if test="province !=null">
- and oi.licence_province= #{province,jdbcType=INTEGER}
- </if>
- <if test="unitName !=null">
- and oi.unit_name= #{unitName,jdbcType=VARCAHR}
- </if>
- <if test="principal != null">
- group by c.id
- </if>
- </select>
-
- <select id="selectContractDetail" parameterType="java.lang.String" resultType="com.goafanti.contract.bo.ContractDetail">
- select
- c.id, c.uid, c.serial_number as serialNumber,
- oi.unit_name as unitName, oi.org_code as orgCode, oi.postal_address as address,
- c.type, c.sign_date as signDate, a.name as founder,
- c.depict, c.status, c.patent_num as patentNum,
- c.patent_status as patentStatus, c.copyright_num as copyrightNum, c.copyright_status as copyrightStatus,
- c.cognizance_year as cognizanceYear, c.cognizance_status as cognizanceStatus, c.tech_project_num as techProjectNum,
- c.tech_project_status as techProjectStatus, c.comment, c.complete_date as completeDate,
- c.contacts, c.previous_fee as previousFee
- from contract c
- LEFT JOIN organization_identity oi on oi.uid = c.uid
- LEFT JOIN admin a on a.id = c.founder
- where c.deleted_sign = 0 and c.id = #{id,jdbcType=VARCHAR}
- </select>
-
-
- <select id="selectContractSerialNumber" resultType="com.goafanti.contract.bo.ContractSerialNumber" parameterType="java.lang.String">
- select c.id as contractId, c.serial_number as serialNumber
- from contract c
- <if test="_parameter != null">
- LEFT JOIN contract_log cl on cl.cid = c.id
- </if>
- where c.deleted_sign = 0
- <if test="_parameter !=null">
- and cl.principal = #{_parameter,jdbcType=VARCHAR}
- </if>
- <if test="_parameter != null">
- group by c.id
- </if>
- order by c.serial_number desc
- </select>
-
- <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
- update contract set deleted_sign = 1
- where id in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
-
- <select id="findClientContractListByPage" parameterType="String" resultType="com.goafanti.contract.bo.ContractClientListBo">
- select c.id, c.uid, c.serial_number as serialNumber, c.type,
- c.sign_date as signDate,
- c.depict, c.status, c.complete_date as completeDate, c.contacts
- from contract c
- where c.deleted_sign = 0
- <if test="serialNumber !=null">
- and c.serial_number = #{serialNumber,jdbcType=INTEGER}
- </if>
- <if test="id !=null">
- and c.id = #{id,jdbcType=VARCHAR}
- </if>
- <if test="type !=null">
- and c.type = #{type,jdbcType=INTEGER}
- </if>
- <if test="uid !=null">
- and c.uid = #{uid,jdbcType=INTEGER}
- </if>
- <if test="status !=null">
- and c.status= #{status ,jdbcType=INTEGER}
- </if>
- <if test="cStart !=null">
- and c.sign_date <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
- </if>
- <if test="cEnd !=null">
- and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
- </if>
- <if test="lStart !=null">
- and c.complete_date <![CDATA[ >= ]]> #{lStart,jdbcType=TIMESTAMP}
- </if>
- <if test="lEnd !=null">
- and c.complete_date <![CDATA[ < ]]> #{lEnd,jdbcType=TIMESTAMP}
- </if>
-
- order by c.serial_number DESC
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="findClientContractCount" resultType="java.lang.Integer"
- parameterType="String">
- select count(1)
- from contract c
- where c.deleted_sign = 0
- <if test="serialNumber !=null">
- and c.serial_number = #{serialNumber,jdbcType=INTEGER}
- </if>
- <if test="id !=null">
- and c.id = #{id,jdbcType=VARCHAR}
- </if>
- <if test="type !=null">
- and c.type = #{type,jdbcType=INTEGER}
- </if>
- <if test="uid !=null">
- and c.uid = #{uid,jdbcType=INTEGER}
- </if>
- <if test="status !=null">
- and c.status= #{status ,jdbcType=INTEGER}
- </if>
- <if test="cStart !=null">
- and c.sign_date <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
- </if>
- <if test="cEnd !=null">
- and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
- </if>
- <if test="lStart !=null">
- and c.complete_date <![CDATA[ >= ]]> #{lStart,jdbcType=TIMESTAMP}
- </if>
- <if test="lEnd !=null">
- and c.complete_date <![CDATA[ < ]]> #{lEnd,jdbcType=TIMESTAMP}
- </if>
- </select>
-
- <select id="findByUidAndYear" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from contract
- where uid = #{uid,jdbcType=VARCHAR}
- and cognizance_year = #{year,jdbcType=INTEGER}
- and deleted_sign = 0
- </select>
-
- <select id="findLatelyRecordByUid" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from contract
- where cognizance_year =
- (select
- Max(cognizance_year)
- from contract
- where uid = #{uid,jdbcType=VARCHAR}
- and deleted_sign = 0
- )
- </select>
- </mapper>
|