<?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.PatentNewMapper">
	<resultMap id="BaseResultMap"
		type="com.goafanti.common.model.PatentNew">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		<id column="id" jdbcType="INTEGER" property="id" />
		<result column="patent_no" jdbcType="VARCHAR"
			property="patentNo" />
		<result column="name" jdbcType="VARCHAR" property="name" />
		<result column="type" jdbcType="INTEGER" property="type" />
		<result column="status" jdbcType="INTEGER" property="status" />
		<result column="apply_date" jdbcType="DATE"
			property="applyDate" />
		<result column="authorization_date" jdbcType="DATE"
			property="authorizationDate" />
		<result column="patent_amount" jdbcType="DECIMAL"
			property="patentAmount" />
		<result column="applicant" jdbcType="VARCHAR"
			property="applicant" />
		<result column="province" jdbcType="INTEGER"
			property="province" />
		<result column="contact_mobile" jdbcType="VARCHAR"
			property="contactMobile" />
		<result column="email" jdbcType="VARCHAR" property="email" />
		<result column="certificate_url" jdbcType="VARCHAR"
			property="certificateUrl" />
		<result column="create_time" jdbcType="TIMESTAMP"
			property="createTime" />
		<result column="update_time" jdbcType="TIMESTAMP"
			property="updateTime" />
		<result column="aid" jdbcType="VARCHAR" property="aid" />
		<result column="years" jdbcType="INTEGER" property="years" />
		<result column="uid" jdbcType="VARCHAR" property="uid" />
		<result column="holders" jdbcType="VARCHAR" property="holders" />
		<result column="inventor" jdbcType="VARCHAR"
			property="inventor" />
		<result column="annual_fee_status" jdbcType="INTEGER"
			property="annualFeeStatus" />
		<result column="salesman_remind" jdbcType="INTEGER"
			property="salesmanRemind" />
		<result column="tid" jdbcType="INTEGER" property="tid" />
		<result column="new_type" jdbcType="INTEGER" property="newType" />
		<result column="delaying_amount" jdbcType="DECIMAL"
			property="delayingAmount" />
		<result column="recovery_amount" jdbcType="DECIMAL"
			property="recoveryAmount" />
		<result column="input_id" jdbcType="VARCHAR" property="inputId" />
		<result column="end_date" jdbcType="DATE" property="endDate" />
	</resultMap>
	<sql id="Base_Column_List">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		id, patent_no, `name`, `type`, `status`, apply_date,
		authorization_date, patent_amount,
		applicant, province, contact_mobile, email, certificate_url, create_time,
		update_time,
		aid, `years`, `uid`, holders, inventor, annual_fee_status,
		salesman_remind, tid,
		new_type, delaying_amount, recovery_amount, input_id, end_date
	</sql>
	<select id="selectByPrimaryKey"
		parameterType="java.lang.Integer" resultMap="BaseResultMap">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		select
		<include refid="Base_Column_List" />
		from patent_new
		where id = #{id,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey"
		parameterType="java.lang.Integer">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		delete from patent_new
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insert"
		parameterType="com.goafanti.common.model.PatentNew">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		insert into patent_new (id, patent_no, `name`,
		`type`, `status`, apply_date,
		authorization_date, patent_amount, applicant,
		province, contact_mobile, email,
		certificate_url, create_time, update_time,
		aid, `years`, `uid`, holders,
		inventor, annual_fee_status, salesman_remind,
		tid, new_type, delaying_amount,
		recovery_amount, input_id, end_date
		)
		values (#{id,jdbcType=INTEGER}, #{patentNo,jdbcType=VARCHAR},
		#{name,jdbcType=VARCHAR},
		#{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{applyDate,jdbcType=DATE},
		#{authorizationDate,jdbcType=DATE}, #{patentAmount,jdbcType=DECIMAL},
		#{applicant,jdbcType=VARCHAR},
		#{province,jdbcType=INTEGER}, #{contactMobile,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
		#{certificateUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
		#{updateTime,jdbcType=TIMESTAMP},
		#{aid,jdbcType=VARCHAR}, #{years,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR},
		#{holders,jdbcType=VARCHAR},
		#{inventor,jdbcType=VARCHAR}, #{annualFeeStatus,jdbcType=INTEGER},
		#{salesmanRemind,jdbcType=INTEGER},
		#{tid,jdbcType=INTEGER}, #{newType,jdbcType=INTEGER}, #{delayingAmount,jdbcType=DECIMAL},
		#{recoveryAmount,jdbcType=DECIMAL}, #{inputId,jdbcType=VARCHAR},
		#{endDate,jdbcType=DATE}
		)
	</insert>
	<insert id="insertSelective"
		parameterType="com.goafanti.common.model.PatentNew">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		insert into patent_new
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="patentNo != null">
				patent_no,
			</if>
			<if test="name != null">
				`name`,
			</if>
			<if test="type != null">
				`type`,
			</if>
			<if test="status != null">
				`status`,
			</if>
			<if test="applyDate != null">
				apply_date,
			</if>
			<if test="authorizationDate != null">
				authorization_date,
			</if>
			<if test="patentAmount != null">
				patent_amount,
			</if>
			<if test="applicant != null">
				applicant,
			</if>
			<if test="province != null">
				province,
			</if>
			<if test="contactMobile != null">
				contact_mobile,
			</if>
			<if test="email != null">
				email,
			</if>
			<if test="certificateUrl != null">
				certificate_url,
			</if>
			<if test="createTime != null">
				create_time,
			</if>
			<if test="updateTime != null">
				update_time,
			</if>
			<if test="aid != null">
				aid,
			</if>
			<if test="years != null">
				`years`,
			</if>
			<if test="uid != null">
				`uid`,
			</if>
			<if test="holders != null">
				holders,
			</if>
			<if test="inventor != null">
				inventor,
			</if>
			<if test="annualFeeStatus != null">
				annual_fee_status,
			</if>
			<if test="salesmanRemind != null">
				salesman_remind,
			</if>
			<if test="tid != null">
				tid,
			</if>
			<if test="newType != null">
				new_type,
			</if>
			<if test="delayingAmount != null">
				delaying_amount,
			</if>
			<if test="recoveryAmount != null">
				recovery_amount,
			</if>
			<if test="inputId != null">
				input_id,
			</if>
			<if test="endDate != null">
				end_date,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=INTEGER},
			</if>
			<if test="patentNo != null">
				#{patentNo,jdbcType=VARCHAR},
			</if>
			<if test="name != null">
				#{name,jdbcType=VARCHAR},
			</if>
			<if test="type != null">
				#{type,jdbcType=INTEGER},
			</if>
			<if test="status != null">
				#{status,jdbcType=INTEGER},
			</if>
			<if test="applyDate != null">
				#{applyDate,jdbcType=DATE},
			</if>
			<if test="authorizationDate != null">
				#{authorizationDate,jdbcType=DATE},
			</if>
			<if test="patentAmount != null">
				#{patentAmount,jdbcType=DECIMAL},
			</if>
			<if test="applicant != null">
				#{applicant,jdbcType=VARCHAR},
			</if>
			<if test="province != null">
				#{province,jdbcType=INTEGER},
			</if>
			<if test="contactMobile != null">
				#{contactMobile,jdbcType=VARCHAR},
			</if>
			<if test="email != null">
				#{email,jdbcType=VARCHAR},
			</if>
			<if test="certificateUrl != null">
				#{certificateUrl,jdbcType=VARCHAR},
			</if>
			<if test="createTime != null">
				#{createTime,jdbcType=TIMESTAMP},
			</if>
			<if test="updateTime != null">
				#{updateTime,jdbcType=TIMESTAMP},
			</if>
			<if test="aid != null">
				#{aid,jdbcType=VARCHAR},
			</if>
			<if test="years != null">
				#{years,jdbcType=INTEGER},
			</if>
			<if test="uid != null">
				#{uid,jdbcType=VARCHAR},
			</if>
			<if test="holders != null">
				#{holders,jdbcType=VARCHAR},
			</if>
			<if test="inventor != null">
				#{inventor,jdbcType=VARCHAR},
			</if>
			<if test="annualFeeStatus != null">
				#{annualFeeStatus,jdbcType=INTEGER},
			</if>
			<if test="salesmanRemind != null">
				#{salesmanRemind,jdbcType=INTEGER},
			</if>
			<if test="tid != null">
				#{tid,jdbcType=INTEGER},
			</if>
			<if test="newType != null">
				#{newType,jdbcType=INTEGER},
			</if>
			<if test="delayingAmount != null">
				#{delayingAmount,jdbcType=DECIMAL},
			</if>
			<if test="recoveryAmount != null">
				#{recoveryAmount,jdbcType=DECIMAL},
			</if>
			<if test="inputId != null">
				#{inputId,jdbcType=VARCHAR},
			</if>
			<if test="endDate != null">
				#{endDate,jdbcType=DATE},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective"
		parameterType="com.goafanti.common.model.PatentNew">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		update patent_new
		<set>
			<if test="patentNo != null">
				patent_no = #{patentNo,jdbcType=VARCHAR},
			</if>
			<if test="name != null">
				`name` = #{name,jdbcType=VARCHAR},
			</if>
			<if test="type != null">
				`type` = #{type,jdbcType=INTEGER},
			</if>
			<if test="status != null">
				`status` = #{status,jdbcType=INTEGER},
			</if>
			<if test="applyDate != null">
				apply_date = #{applyDate,jdbcType=DATE},
			</if>
			<if test="authorizationDate != null">
				authorization_date = #{authorizationDate,jdbcType=DATE},
			</if>
			<if test="patentAmount != null">
				patent_amount = #{patentAmount,jdbcType=DECIMAL},
			</if>
			<if test="applicant != null">
				applicant = #{applicant,jdbcType=VARCHAR},
			</if>
			<if test="province != null">
				province = #{province,jdbcType=INTEGER},
			</if>
			<if test="contactMobile != null">
				contact_mobile = #{contactMobile,jdbcType=VARCHAR},
			</if>
			<if test="email != null">
				email = #{email,jdbcType=VARCHAR},
			</if>
			<if test="certificateUrl != null">
				certificate_url = #{certificateUrl,jdbcType=VARCHAR},
			</if>
			<if test="createTime != null">
				create_time = #{createTime,jdbcType=TIMESTAMP},
			</if>
			<if test="updateTime != null">
				update_time = #{updateTime,jdbcType=TIMESTAMP},
			</if>
			<if test="aid != null">
				aid = #{aid,jdbcType=VARCHAR},
			</if>
			<if test="years != null">
				`years` = #{years,jdbcType=INTEGER},
			</if>
			<if test="uid != null">
				`uid` = #{uid,jdbcType=VARCHAR},
			</if>
			<if test="holders != null">
				holders = #{holders,jdbcType=VARCHAR},
			</if>
			<if test="inventor != null">
				inventor = #{inventor,jdbcType=VARCHAR},
			</if>
			<if test="annualFeeStatus != null">
				annual_fee_status = #{annualFeeStatus,jdbcType=INTEGER},
			</if>
			<if test="salesmanRemind != null">
				salesman_remind = #{salesmanRemind,jdbcType=INTEGER},
			</if>
			<if test="tid != null">
				tid = #{tid,jdbcType=INTEGER},
			</if>
			<if test="newType != null">
				new_type = #{newType,jdbcType=INTEGER},
			</if>
			<if test="delayingAmount != null">
				delaying_amount = #{delayingAmount,jdbcType=DECIMAL},
			</if>
			<if test="recoveryAmount != null">
				recovery_amount = #{recoveryAmount,jdbcType=DECIMAL},
			</if>
			<if test="inputId != null">
				input_id = #{inputId,jdbcType=VARCHAR},
			</if>
			<if test="endDate != null">
				end_date = #{endDate,jdbcType=DATE},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey"
		parameterType="com.goafanti.common.model.PatentNew">
		<!-- WARNING - @mbg.generated This element is automatically generated by
			MyBatis Generator, do not modify. This element was generated on Mon Aug 09
			14:41:21 CST 2021. -->
		update patent_new
		set patent_no = #{patentNo,jdbcType=VARCHAR},
		`name` = #{name,jdbcType=VARCHAR},
		`type` = #{type,jdbcType=INTEGER},
		`status` = #{status,jdbcType=INTEGER},
		apply_date = #{applyDate,jdbcType=DATE},
		authorization_date = #{authorizationDate,jdbcType=DATE},
		patent_amount = #{patentAmount,jdbcType=DECIMAL},
		applicant = #{applicant,jdbcType=VARCHAR},
		province = #{province,jdbcType=INTEGER},
		contact_mobile = #{contactMobile,jdbcType=VARCHAR},
		email = #{email,jdbcType=VARCHAR},
		certificate_url = #{certificateUrl,jdbcType=VARCHAR},
		create_time = #{createTime,jdbcType=TIMESTAMP},
		update_time = #{updateTime,jdbcType=TIMESTAMP},
		aid = #{aid,jdbcType=VARCHAR},
		`years` = #{years,jdbcType=INTEGER},
		`uid` = #{uid,jdbcType=VARCHAR},
		holders = #{holders,jdbcType=VARCHAR},
		inventor = #{inventor,jdbcType=VARCHAR},
		annual_fee_status = #{annualFeeStatus,jdbcType=INTEGER},
		salesman_remind = #{salesmanRemind,jdbcType=INTEGER},
		tid = #{tid,jdbcType=INTEGER},
		new_type = #{newType,jdbcType=INTEGER},
		delaying_amount = #{delayingAmount,jdbcType=DECIMAL},
		recovery_amount = #{recoveryAmount,jdbcType=DECIMAL},
		input_id = #{inputId,jdbcType=VARCHAR},
		end_date = #{endDate,jdbcType=DATE}
		where id = #{id,jdbcType=INTEGER}
	</update>

	<select id="selectPatentNewList" resultType="com.goafanti.patent.bo.PatentNewBo">
 		    select a.id,a.patent_no as patentNo,a.name,a.type,a.status,a.holders,a.inventor,ifnull(c.cost_reduction,0) costReduction ,
		a.annual_fee_status annualFeeStatus,date_format(a.apply_date,'%Y-%m-%d') applyDates,
		a.uid,a.salesman_remind salesmanRemind,a.email,a.province,a.years ,a.certificate_url as certificateUrl,
		date_format(a.authorization_date ,'%Y-%m-%d ')authorizationDates,a.aid ,
		a.applicant,a.contact_mobile as contactMobile,date_format(a.end_date,'%Y-%m-%d') as endDates,
		date_format(a.create_time,'%Y-%m-%d %H:%I:%S') as createTimeS,a.apply_date as applyDate,
		date_format(a.update_time,'%Y-%m-%d %H:%I:%S') as updateTimeS,b.name as aname,tm.buyer_name userName,
		a.patent_amount as patentAmount,a.delaying_amount delayingAmount ,a.recovery_amount
		recoveryAmount, c.commodity_name projectName , c.id tid,tm.salesman_name salesmanName ,
		c.receiver_name techName, tm.dep_name depName,ia.name inputName
		from patent_new a left join admin b on a.aid=b.id
		left join t_order_task c on a.tid =c.id left join t_order_mid tm on c.order_no =tm.order_no
		left join admin ia on a.input_id =ia.id
		<if test="shiro ==1">
			left join admin e on e.department_id=c.id
		</if>
		where 1=1
		<if test="shiro ==0">
			<if test="isFollow ==1">
			and a.aid = #{aid,jdbcType=VARCHAR}
			</if>
			<if test="isFollow ==0">
			and a.input_id = #{aid,jdbcType=VARCHAR}
			</if>
		</if>
		<if test="shiro ==1">
			and e.id = #{aid,jdbcType=VARCHAR}
		</if>
		<if test="status != null">
			and a.status=#{status}
		</if>
		<if test="type != null">
			and a.type=#{type}
		</if>
		<if test="startDates != null and endDates != null">
			and a.apply_date between #{startDates} and #{endDates}
		</if>
		<if test="createStarts != null and createEnds != null">
			and a.create_time between #{createStarts} and #{createEnds}
		</if>
		<if test="name != null">
			and a.name like concat('%',#{name},'%')
		</if>
		<if test="patentNo != null">
			and a.patent_no like concat('%',#{patentNo},'%')
		</if>
		<if test="annualFeeStatus != null">
			and a.annual_fee_status = #{annualFeeStatus}
		</if>
		<if test="userName != null">
			and tm.buyer_name like concat('%',#{userName},'%')
		</if>
		<if test="aname != null">
			and b.name like concat('%',#{aname},'%')
		</if>
		<if test="depName != null">
			and tm.dep_name  in
			<foreach close=")" collection="depName" item="deps" open="(" separator=",">
				#{deps}
			</foreach>
		</if>
		<if test="inputDep != null">
			and ia.department_id in
			<foreach close=")" collection="inputDep" item="deps" open="(" separator=",">
				#{deps}
			</foreach>
		</if>
		<if test="followDep != null">
			and b.department_id  in
			<foreach close=")" collection="followDep" item="deps" open="(" separator=",">
				#{deps}
			</foreach>
		</if>
		<if test="salesmanRemind !=null">
			and a.salesman_remind= #{salesmanRemind}
		</if>
		order by a.status ,a.create_time
		<if test="page_sql!=null">
			${page_sql}
		</if>
	</select>
	<select id="selectPatentNewCount" resultType="java.lang.Integer">
		select count(*)
		from patent_new a left join admin b on a.aid=b.id
		left join t_order_task c on a.tid =c.id left join t_order_mid tm on
		c.order_no =tm.order_no
		left join admin ia on a.input_id =ia.id
		<if test="shiro ==1">
			left join admin e on e.department_id=c.id
		</if>
		where 1=1
		<if test="shiro ==0">
			<if test="isFollow ==1">
				and a.aid = #{aid,jdbcType=VARCHAR}
			</if>
			<if test="isFollow ==0">
				and a.input_id = #{aid,jdbcType=VARCHAR}
			</if>
		</if>
		<if test="shiro ==1">
			and e.id = #{aid,jdbcType=VARCHAR}
		</if>
		<if test="status != null">
			and a.status=#{status}
		</if>
		<if test="type != null">
			and a.type=#{type}
		</if>
		<if test="startDates != null and endDates != null">
			and a.apply_date between #{startDates} and #{endDates}
		</if>
		<if test="createStarts != null and createEnds != null">
			and a.create_time between #{createStarts} and #{createEnds}
		</if>
		<if test="name != null">
			and a.name like concat('%',#{name},'%')
		</if>
		<if test="patentNo != null">
			and a.patent_no like concat('%',#{patentNo},'%')
		</if>
		<if test="annualFeeStatus != null">
			and a.annual_fee_status = #{annualFeeStatus}
		</if>
		<if test="userName != null">
			and tm.buyer_name like concat('%',#{userName},'%')
		</if>
		<if test="aname != null">
			and b.name like concat('%',#{aname},'%')
		</if>
		<if test="depName != null">
			and tm.dep_name  in
			<foreach close=")" collection="depName" item="deps" open="(" separator=",">
				#{deps}
			</foreach>
		</if>
		<if test="inputDep != null">
			and ia.department_id in
			<foreach close=")" collection="inputDep" item="deps" open="(" separator=",">
				#{deps}
			</foreach>
		</if>
		<if test="followDep != null">
			and b.department_id  in
			<foreach close=")" collection="followDep" item="deps" open="(" separator=",">
				#{deps}
			</foreach>
		</if>
		<if test="salesmanRemind !=null">
			and a.salesman_remind= #{salesmanRemind}
		</if>
	</select>

	<select id="AllselectStartPatentNew" resultType="com.goafanti.patent.bo.PatentNewBo">
		select
			a.id,a.patent_no patentNo,a.name ,a.aid ,a.email ,a.end_date endDate,a.status
			 ,c.buyer_name userName,a.salesman_remind salesmanRemind
		from patent_new a left join t_order_task b on a.tid =b.id left join
			 t_order_mid c on b.order_no=c.order_no where a.status &lt; 6
	</select>
	<select id="AllselectEndPatentNew" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from patent_new where status =1
	</select>

	<update id="updateAdmin">
		update patent_new set aid= #{transferId}
		where aid= #{aid}
	</update>
	<insert id="insertBatch">
		insert into patent_new (id, patent_no, `name`,
		`type`, `status`, apply_date,
		authorization_date, patent_amount, applicant,
		province, contact_mobile, email,
		certificate_url, create_time, update_time,
		aid, `years`, `uid`, holders,
		inventor, end_date,
		tid, new_type,
		input_id)
		values
		<foreach collection="list" index="index" item="item"
			separator=",">
			(#{item.id,jdbcType=INTEGER}, #{item.patentNo,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
			#{item.type,jdbcType=INTEGER}, #{item.status,jdbcType=INTEGER},
			#{item.applyDate,jdbcType=DATE},
			#{item.authorizationDate,jdbcType=DATE},
			#{item.patentAmount,jdbcType=DECIMAL},
			#{item.applicant,jdbcType=VARCHAR},
			#{item.province,jdbcType=INTEGER},
			#{item.contactMobile,jdbcType=VARCHAR},
			#{item.email,jdbcType=VARCHAR},
			#{item.certificateUrl,jdbcType=VARCHAR},
			#{item.createTime,jdbcType=TIMESTAMP},
			#{item.updateTime,jdbcType=TIMESTAMP},
			#{item.aid,jdbcType=VARCHAR}, #{item.years,jdbcType=INTEGER}, #{item.uid,jdbcType=VARCHAR},
			#{item.holders,jdbcType=VARCHAR},
			#{item.inventor,jdbcType=VARCHAR}, #{item.endDate,jdbcType=DATE},
			#{item.tid,jdbcType=INTEGER}, #{item.newType,jdbcType=INTEGER},
			#{item.inputId,jdbcType=VARCHAR})
		</foreach>
	</insert>
	<select id="selectByPatenNo" resultType="java.lang.Integer">
		select count(*) from patent_new where patent_no = #{patenNo}
	</select>

	<select id="selectByYear" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from patent_new where years = #{year}
	</select>

	<update id="updateBatch">
		update patent_new
		set salesman_remind=1
		where id in
		<foreach item="item" collection="list" open="(" separator=","
			close=")">
			#{item}
		</foreach>
	</update>
	<update id="updateBatchByid">
		update patent_new

		<set>
			<if test="status != null">
				status= #{status},
			</if>
			<if test="aid != null">
				aid= #{aid},
			</if>

		</set>
		where id in
		<foreach item="item" collection="list" open="(" separator=","
			close=")">
			#{item}
		</foreach>
	</update>
	<select id="selectByids" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from patent_new
		where id in
		<foreach item="item" collection="list" open="(" separator=","
			close=")">
			#{item}
		</foreach>
	</select>
	<select id="selectByTid" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from patent_new
		where tid = #{tid}
	</select>

	<select id="selectUserNameByTid" resultType="java.lang.String">
		select b.buyer_name userName from t_order_task a left join t_order_mid b on
		a.order_no =b.order_no
		where a.id = #{tid}
	</select>
</mapper>
