<?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.hzya.frame.sys.proof.dao.impl.ProofDaoImpl">
	<resultMap id="get-ProofEntity-result" type="com.hzya.frame.sys.proof.entity.ProofEntity">
		<!--主键ID -->
		<result property="id" column="id" />
		<!--单据标题 -->
		<result property="receipt_title" column="receipt_title" />
		<!--会计期间 -->
		<result property="ap" column="ap" />
		<!--凭证字 -->
		<result property="vou" column="vou" />
		<!--凭证号 -->
		<result property="voucher_number" column="voucher_number" />
		<!--帐套号 -->
		<result property="sob_no" column="sob_no" />
		<!--年度 -->
		<result property="year" column="year" />
		<!--推送日期 -->
		<result property="push_date" column="push_date" />
		<!--凭证状态 -->
		<result property="certificate_status" column="certificate_status" />
		<!--审核人 -->
		<result property="auditor" column="auditor" />
		<!--审核人 -->
		<result property="documenter" column="documenter" />
		<!--审核日期 -->
		<result property="auditor_date" column="auditor_date" />
		<!--记账人 -->
		<result property="bookkeeper" column="bookkeeper" />
		<!--出纳 -->
		<result property="teller" column="teller" />
		<!--凭证日期 -->
		<result property="certificate_date" column="certificate_date" />
		<!--失败原因 -->
		<result property="err_msg" column="err_msg" />
		<!--分录合并 -->
		<result property="consolidation_entries" column="consolidation_entries" />
		<!--排序 -->
		<result property="sorts" column="sorts" />
		<!--创建人id -->
		<result property="create_user_id" column="create_user_id" />
		<!--创建时间 -->
		<result property="create_time" column="create_time" />
		<!--修改人id -->
		<result property="modify_user_id" column="modify_user_id" />
		<!--修改时间 -->
		<result property="modify_time" column="modify_time" />
		<!--状态(Y正常N删除) -->
		<result property="sts" column="sts" />
		<!--组织机构ID -->
		<result property="org_id" column="org_id" />
	</resultMap>

	<sql id="ProofEntity_Base_Column_List">
		id,
		receipt_title,
		ap,
		vou,
		voucher_number,
		sob_no,
		year,
		push_date,
		certificate_status,
		auditor,
		documenter,
		auditor_date,
		bookkeeper,
		teller,
		certificate_date,
		err_msg,
		consolidation_entries,
		sorts,
		create_user_id,
		create_time,
		modify_user_id,
		modify_time,
		sts,
		org_id
	</sql>

	<!--通过ID获取数据 -->
	<select id="entity_get" resultMap="get-ProofEntity-result">
		select
		<include refid="ProofEntity_Base_Column_List" />
		from sys_proof where id = #{ id } and sts='Y'
	</select>

	<!-- 查询 采用==查询 -->
	<select id="entity_list_base" resultMap="get-ProofEntity-result" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		select
		<include refid="ProofEntity_Base_Column_List" />
		from sys_proof
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="receipt_title != null and receipt_title !='' "> and receipt_title = #{receipt_title}</if>
			<if test="ap != null and ap !='' "> and ap = #{ap}</if>
			<if test="vou != null and vou !='' "> and vou = #{vou}</if>
			<if test="voucher_number != null and voucher_number !='' "> and voucher_number = #{voucher_number}</if>
			<if test="sob_no != null and sob_no !='' "> and sob_no = #{sob_no}</if>
			<if test="year != null and year !='' "> and year = #{year}</if>
			<if test="push_date != null "> and push_date = #{push_date}</if>
			<if test="certificate_status != null and certificate_status !='' "> and certificate_status = #{certificate_status}</if>
			<if test="auditor != null and auditor !='' "> and auditor = #{auditor}</if>
			<if test="documenter != null and documenter !='' "> and documenter = #{documenter}</if>
			<if test="auditor_date != null "> and auditor_date = #{auditor_date}</if>
			<if test="bookkeeper != null and bookkeeper !='' "> and bookkeeper = #{bookkeeper}</if>
			<if test="teller != null and teller !='' "> and teller = #{teller}</if>
			<if test="certificate_date != null "> and certificate_date = #{certificate_date}</if>
			<if test="err_msg != null and err_msg !='' "> and err_msg = #{err_msg}</if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> and consolidation_entries = #{consolidation_entries}</if>
			<if test="sorts != null "> and sorts = #{sorts}</if>
			<if test="create_user_id != null and create_user_id !='' "> and create_user_id = #{create_user_id}</if>
			<if test="create_time != null "> and create_time = #{create_time}</if>
			<if test="modify_user_id != null and modify_user_id !='' "> and modify_user_id = #{modify_user_id}</if>
			<if test="modify_time != null "> and modify_time = #{modify_time}</if>
			<if test="sts != null and sts !='' "> and sts = #{sts}</if>
			<if test="org_id != null and org_id !='' "> and org_id = #{org_id}</if>
			and sts='Y'
		</trim>
		<if test="sort == null or sort == ''.toString() "> order by sorts asc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
	</select>

	<!-- 查询符合条件的数量 -->
	<select id="entity_count" resultType="Integer" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		select count(1) from sys_proof
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="receipt_title != null and receipt_title !='' "> and receipt_title = #{receipt_title} </if>
			<if test="ap != null and ap !='' "> and ap = #{ap} </if>
			<if test="vou != null and vou !='' "> and vou = #{vou} </if>
			<if test="voucher_number != null and voucher_number !='' "> and voucher_number = #{voucher_number} </if>
			<if test="sob_no != null and sob_no !='' "> and sob_no = #{sob_no} </if>
			<if test="year != null and year !='' "> and year = #{year} </if>
			<if test="push_date != null "> and push_date = #{push_date}  </if>
			<if test="certificate_status != null and certificate_status !='' "> and certificate_status = #{certificate_status} </if>
			<if test="auditor != null and auditor !='' "> and auditor = #{auditor} </if>
			<if test="documenter != null and documenter !='' "> and documenter = #{documenter} </if>
			<if test="auditor_date != null "> and auditor_date = #{auditor_date}  </if>
			<if test="bookkeeper != null and bookkeeper !='' "> and bookkeeper = #{bookkeeper} </if>
			<if test="teller != null and teller !='' "> and teller = #{teller} </if>
			<if test="certificate_date != null "> and certificate_date = #{certificate_date}  </if>
			<if test="err_msg != null and err_msg !='' "> and err_msg = #{err_msg} </if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> and consolidation_entries = #{consolidation_entries} </if>
			<if test="sorts != null "> and sorts = #{sorts}  </if>
			<if test="create_user_id != null and create_user_id !='' "> and create_user_id = #{create_user_id} </if>
			<if test="create_time != null "> and create_time = #{create_time}  </if>
			<if test="modify_user_id != null and modify_user_id !='' "> and modify_user_id = #{modify_user_id} </if>
			<if test="modify_time != null "> and modify_time = #{modify_time}  </if>
			<if test="sts != null and sts !='' "> and sts = #{sts} </if>
			<if test="org_id != null and org_id !='' "> and org_id = #{org_id} </if>
			and sts='Y'
		</trim>
		<if test=" sort ==''.toString() "> order by sorts asc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="entity_list_like" resultMap="get-ProofEntity-result" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		select
		<include refid="ProofEntity_Base_Column_List" />
		from sys_proof
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' "> id like concat('%',#{id},'%') </if>
			<if test="receipt_title != null and receipt_title !='' "> and receipt_title like concat('%',#{receipt_title},'%') </if>
			<if test="ap != null and ap !='' "> and ap like concat('%',#{ap},'%') </if>
			<if test="vou != null and vou !='' "> and vou like concat('%',#{vou},'%') </if>
			<if test="voucher_number != null and voucher_number !='' "> and voucher_number like concat('%',#{voucher_number},'%') </if>
			<if test="sob_no != null and sob_no !='' "> and sob_no like concat('%',#{sob_no},'%') </if>
			<if test="year != null and year !='' "> and year like concat('%',#{year},'%') </if>
			<if test="push_date != null and push_date !='' "> and push_date like concat('%',#{push_date},'%') </if>
			<if test="certificate_status != null and certificate_status !='' "> and certificate_status like concat('%',#{certificate_status},'%') </if>
			<if test="auditor != null and auditor !='' "> and auditor like concat('%',#{auditor},'%') </if>
			<if test="documenter != null and documenter !='' "> and documenter like concat('%',#{documenter},'%') </if>
			<if test="auditor_date != null and auditor_date !='' "> and auditor_date like concat('%',#{auditor_date},'%') </if>
			<if test="bookkeeper != null and bookkeeper !='' "> and bookkeeper like concat('%',#{bookkeeper},'%') </if>
			<if test="teller != null and teller !='' "> and teller like concat('%',#{teller},'%') </if>
			<if test="certificate_date != null and certificate_date !='' "> and certificate_date like concat('%',#{certificate_date},'%') </if>
			<if test="err_msg != null and err_msg !='' "> and err_msg like concat('%',#{err_msg},'%') </if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> and consolidation_entries like concat('%',#{consolidation_entries},'%') </if>
			<if test="sorts != null "> and sorts = #{sorts}</if>
			<if test="create_user_id != null and create_user_id !='' "> and create_user_id like concat('%',#{create_user_id},'%') </if>
			<if test="create_time != null and create_time !='' "> and create_time like concat('%',#{create_time},'%') </if>
			<if test="modify_user_id != null and modify_user_id !='' "> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
			<if test="modify_time != null and modify_time !='' "> and modify_time like concat('%',#{modify_time},'%') </if>
			<if test="sts != null and sts !='' "> and sts like concat('%',#{sts},'%') </if>
			<if test="org_id != null and org_id !='' "> and org_id like concat('%',#{org_id},'%') </if>
			and sts='Y'
		</trim>
		<if test=" sort ==''.toString() "> order by sorts asc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by  ${sort} ${order}</if>
	</select>
	<select id="queryProofPrepare" resultType="com.hzya.frame.sys.proof.entity.ProofEntity" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		select
		<include refid="ProofEntity_Base_Column_List" />
		from sys_proof
		WHERE
		sts = 'Y'
		and certificate_status = '1'
		and voucher_number is null
	</select>
	<select id="queryPushProof" resultType="com.hzya.frame.sys.proof.entity.ProofEntity" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		select
		<include refid="ProofEntity_Base_Column_List" />
		from sys_proof
		WHERE
		sts = 'Y'
		and certificate_status = '1'
		and voucher_number is not null
	</select>
	<!-- 查询列表 字段采用or格式 -->
	<select id="entity_list_or" resultMap="get-ProofEntity-result" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		select
		<include refid="ProofEntity_Base_Column_List" />
		from sys_proof
		<trim prefix="where" prefixOverrides="or">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="receipt_title != null and receipt_title !='' "> or receipt_title = #{receipt_title} </if>
			<if test="ap != null and ap !='' "> or ap = #{ap} </if>
			<if test="vou != null and vou !='' "> or vou = #{vou} </if>
			<if test="voucher_number != null and voucher_number !='' "> or voucher_number = #{voucher_number} </if>
			<if test="sob_no != null and sob_no !='' "> or sob_no = #{sob_no} </if>
			<if test="year != null and year !='' "> or year = #{year} </if>
			<if test="push_date != null and push_date !='' "> or push_date = #{push_date} </if>
			<if test="certificate_status != null and certificate_status !='' "> or certificate_status = #{certificate_status} </if>
			<if test="auditor != null and auditor !='' "> or auditor = #{auditor} </if>
			<if test="documenter != null and documenter !='' "> or documenter = #{documenter} </if>
			<if test="auditor_date != null and auditor_date !='' "> or auditor_date = #{auditor_date} </if>
			<if test="bookkeeper != null and bookkeeper !='' "> or bookkeeper = #{bookkeeper} </if>
			<if test="teller != null and teller !='' "> or teller = #{teller} </if>
			<if test="certificate_date != null and certificate_date !='' "> or certificate_date = #{certificate_date} </if>
			<if test="err_msg != null and err_msg !='' "> or err_msg = #{err_msg} </if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> or consolidation_entries = #{consolidation_entries} </if>
			<if test="sorts != null "> or sorts = #{sorts}</if>
			<if test="create_user_id != null and create_user_id !='' "> or create_user_id = #{create_user_id} </if>
			<if test="create_time != null and create_time !='' "> or create_time = #{create_time} </if>
			<if test="modify_user_id != null and modify_user_id !='' "> or modify_user_id = #{modify_user_id} </if>
			<if test="modify_time != null and modify_time !='' "> or modify_time = #{modify_time} </if>
			<if test="sts != null and sts !='' "> or sts = #{sts} </if>
			<if test="org_id != null and org_id !='' "> or org_id = #{org_id} </if>
			and sts='Y'
		</trim>
		<if test=" sort ==''.toString() "> order by sorts asc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by  ${sort} ${order}</if>
	</select>
	<!-- 新增 -->
	<insert id="entity_insert" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		insert into sys_proof(
		<trim suffix="" suffixOverrides=",">
			<if test="id != null and id !='' "> id, </if>
			<if test="receipt_title != null and receipt_title !='' "> receipt_title, </if>
			<if test="ap != null and ap !='' "> ap, </if>
			<if test="vou != null and vou !='' "> vou, </if>
			<if test="voucher_number != null and voucher_number !='' "> voucher_number, </if>
			<if test="sob_no != null and sob_no !='' "> sob_no, </if>
			<if test="year != null and year !='' "> year, </if>
			<if test="push_date != null ">push_date,</if>
			<if test="certificate_status != null and certificate_status !='' "> certificate_status, </if>
			<if test="auditor != null and auditor !='' "> auditor, </if>
			<if test="documenter != null and documenter !='' "> documenter, </if>
			<if test="auditor_date != null ">auditor_date,</if>
			<if test="bookkeeper != null and bookkeeper !='' "> bookkeeper, </if>
			<if test="teller != null and teller !='' "> teller, </if>
			<if test="certificate_date != null ">certificate_date,</if>
			<if test="err_msg != null and err_msg !='' "> err_msg, </if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> consolidation_entries, </if>
			<if test="sorts != null ">sorts,</if>
			<if test="create_user_id != null and create_user_id !='' "> create_user_id, </if>
			<if test="modify_user_id != null and modify_user_id !='' "> modify_user_id, </if>
			<if test="org_id != null and org_id !='' "> org_id, </if>
			<if test="sorts == null ">sorts,</if>
			create_time,
			modify_time,
			sts
		</trim>
		)values
		(
		<trim suffix="" suffixOverrides=",">
			<if test="id != null and id !='' "> #{id}, </if>
			<if test="receipt_title != null and receipt_title !='' "> #{receipt_title}, </if>
			<if test="ap != null and ap !='' "> #{ap}, </if>
			<if test="vou != null and vou !='' "> #{vou}, </if>
			<if test="voucher_number != null and voucher_number !='' "> #{voucher_number}, </if>
			<if test="sob_no != null and sob_no !='' "> #{sob_no}, </if>
			<if test="year != null and year !='' "> #{year}, </if>
			<if test="push_date != null ">#{push_date},</if>
			<if test="certificate_status != null and certificate_status !='' "> #{certificate_status}, </if>
			<if test="auditor != null and auditor !='' "> #{auditor}, </if>
			<if test="documenter != null and documenter !='' "> #{documenter}, </if>
			<if test="auditor_date != null ">#{auditor_date},</if>
			<if test="bookkeeper != null and bookkeeper !='' "> #{bookkeeper}, </if>
			<if test="teller != null and teller !='' "> #{teller}, </if>
			<if test="certificate_date != null ">#{certificate_date},</if>
			<if test="err_msg != null and err_msg !='' "> #{err_msg}, </if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> #{consolidation_entries}, </if>
			<if test="sorts != null ">#{sorts},</if>
			<if test="create_user_id != null and create_user_id !='' "> #{create_user_id}, </if>
			<if test="modify_user_id != null and modify_user_id !='' "> #{modify_user_id}, </if>
			<if test="org_id != null and org_id !='' "> #{org_id}, </if>
			<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_proof a WHERE a.sts = 'Y' ),</if>
			<if test="create_time != null "> #{create_time} ,</if>
			<if test="modify_time != null "> #{modify_time},</if>
			'Y'
		</trim>
		)
	</insert>

	<!-- 修改 -->
	<update id="entity_update" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		update sys_proof set
		<trim suffix="" suffixOverrides=",">
			<if test="id != null and id !='' "> id = #{id},</if>
			<if test="receipt_title != null and receipt_title !='' "> receipt_title = #{receipt_title},</if>
			<if test="ap != null and ap !='' "> ap = #{ap},</if>
			<if test="vou != null and vou !='' "> vou = #{vou},</if>
			<if test="voucher_number != null and voucher_number !='' "> voucher_number = #{voucher_number},</if>
			<if test="sob_no != null and sob_no !='' "> sob_no = #{sob_no},</if>
			<if test="year != null and year !='' "> year = #{year},</if>
			<if test="push_date != null ">push_date = #{push_date},</if>
			<if test="certificate_status != null and certificate_status !='' "> certificate_status = #{certificate_status},</if>
			<if test="auditor != null and auditor !='' "> auditor = #{auditor},</if>
			<if test="documenter != null and documenter !='' "> documenter = #{documenter},</if>
			<if test="auditor_date != null ">auditor_date = #{auditor_date},</if>
			<if test="bookkeeper != null and bookkeeper !='' "> bookkeeper = #{bookkeeper},</if>
			<if test="teller != null and teller !='' "> teller = #{teller},</if>
			<if test="certificate_date != null ">certificate_date = #{certificate_date},</if>
			<if test="err_msg != null and err_msg !='' "> err_msg = #{err_msg},</if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> consolidation_entries = #{consolidation_entries},</if>
			<if test="sorts != null ">sorts = #{sorts},</if>
			<if test="create_user_id != null and create_user_id !='' "> create_user_id = #{create_user_id},</if>
			<if test="modify_user_id != null and modify_user_id !='' "> modify_user_id = #{modify_user_id},</if>
			<if test="org_id != null and org_id !='' "> org_id = #{org_id},</if>
			<if test="sts != null and sts !='' "> sts = #{sts},</if>
			<if test="modify_time != null "> modify_time =#{modify_time}  </if>
			<if test="modify_time  == null "> modify_time = now()</if>
		</trim>
		where id = #{id}
	</update>

	<!-- 逻辑删除 -->
	<update id="entity_logicDelete" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		update sys_proof set
		sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where
		id = #{id}
	</update>

	<!-- 逻辑删除多条件 -->
	<update id="entity_logicDelete_Multi_Condition" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		update sys_proof set
		sts='N',modify_time = now(),modify_user_id = #{modify_user_id} 
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="receipt_title != null and receipt_title !='' "> and receipt_title = #{receipt_title}</if>
			<if test="ap != null and ap !='' "> and ap = #{ap}</if>
			<if test="vou != null and vou !='' "> and vou = #{vou}</if>
			<if test="voucher_number != null and voucher_number !='' "> and voucher_number = #{voucher_number}</if>
			<if test="sob_no != null and sob_no !='' "> and sob_no = #{sob_no}</if>
			<if test="year != null and year !='' "> and year = #{year}</if>
			<if test="push_date != null and push_date !='' "> and push_date = #{push_date}</if>
			<if test="certificate_status != null and certificate_status !='' "> and certificate_status = #{certificate_status}</if>
			<if test="auditor != null and auditor !='' "> and auditor = #{auditor}</if>
			<if test="documenter != null and documenter !='' "> and documenter = #{documenter}</if>
			<if test="auditor_date != null and auditor_date !='' "> and auditor_date = #{auditor_date}</if>
			<if test="bookkeeper != null and bookkeeper !='' "> and bookkeeper = #{bookkeeper}</if>
			<if test="teller != null and teller !='' "> and teller = #{teller}</if>
			<if test="certificate_date != null and certificate_date !='' "> and certificate_date = #{certificate_date}</if>
			<if test="err_msg != null and err_msg !='' "> and err_msg = #{err_msg}</if>
			<if test="consolidation_entries != null and consolidation_entries !='' "> and consolidation_entries = #{consolidation_entries}</if>
			<if test="sorts != null "> and sorts = #{sorts}</if>
			<if test="create_user_id != null and create_user_id !='' "> and create_user_id = #{create_user_id}</if>
			<if test="create_time != null and create_time !='' "> and create_time = #{create_time}</if>
			<if test="modify_user_id != null and modify_user_id !='' "> and modify_user_id = #{modify_user_id}</if>
			<if test="modify_time != null and modify_time !='' "> and modify_time = #{modify_time}</if>
			<if test="sts != null and sts !='' "> and sts = #{sts}</if>
			<if test="org_id != null and org_id !='' "> and org_id = #{org_id}</if>
		</trim>
	</update>

	<!-- 物理删除 -->
	<delete id="entity_delete" parameterType="com.hzya.frame.sys.proof.entity.ProofEntity">
		delete from sys_proof where id =#{id}
	</delete>



	<!-- 分页查询列表 采用like格式 -->
	<select id="queryProject" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo" >
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_project_control
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and right_name like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and right_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="queryXM" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo" >
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_project_control
		<trim prefix="where" prefixOverrides="and">
			<if test="codes != null and codes !='' "> and left_code = #{codes}</if>
			and sts='Y'
		</trim>
		order by sorts asc
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="querySupplier" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_supplier_control
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and right_name like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and right_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>
	<!-- 分页查询列表 采用like格式 -->
	<select id="queryGys" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_supplier_control
		<trim prefix="where" prefixOverrides="and">
			<if test="codes != null and codes !='' "> and left_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>
	<!-- 分页查询列表 采用like格式 -->
	<select id="queryClient" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_customer_control
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and right_name like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and right_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>	<!-- 分页查询列表 采用like格式 -->
	<select id="queryKh" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_customer_control
		<trim prefix="where" prefixOverrides="and">
			<if test="codes != null and codes !='' "> and left_code = #{codes}</if>
			and sts='Y'
		</trim>
		order by sorts asc
	</select>
	<!-- 分页查询列表 采用like格式 -->
	<select id="querySalesman" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo" >
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_personnel_control
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and right_name like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and right_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>
	<!-- 分页查询列表 采用like格式 -->
	<select id="queryYwy" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo" >
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_personnel_control
		<trim prefix="where" prefixOverrides="and">
			<if test="codes != null and codes !='' "> and left_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>
	<!-- 分页查询列表 采用like格式 -->
	<select id="querySection" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_org_control
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and right_name like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and right_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>
	<!-- 分页查询列表 采用like格式 -->
	<select id="queryBm" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		right_code as codes,
		left_name as leftNames,
		right_name as rightNames
		from sys_org_control
		<trim prefix="where" prefixOverrides="and">
			<if test="codes != null and codes !='' "> and left_code = #{codes}</if>

			and sts='Y'
		</trim>
		order by sorts asc
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="querySob" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		code as codes,
		name as names
		from sys_sob
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and name like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and code = #{codes}</if>
			and sts='Y'
		</trim>
		order by sorts asc
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="querySubject" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		field0002 as codes,
		field0003 as names
		from formmain_0018
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and field0003 like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and field0002 = #{codes}</if>
			and sts='Y'
		</trim>
		order by sorts asc
	</select>

	<!-- 分页查询列表 采用like格式 -->

	<!-- 分页查询列表 采用like格式 -->
	<select id="queryReceiptConf" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		select
		id as id,
		receipt_code as codes,
		receipt_type as names
		from sys_receipt_conf
		<trim prefix="where" prefixOverrides="and">
			<if test="names != null and names !='' "> and receipt_type like concat('%',#{names},'%') </if>
			<if test="codes != null and codes !='' "> and receipt_code = #{codes}</if>
			and sts='Y'
		</trim>
		order by sorts asc
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="queryFzhs" resultType="com.hzya.frame.sys.proof.entity.PullVo" parameterType="com.hzya.frame.sys.proof.entity.PullVo">
		SELECT
		id as id,
		field0002 as codes,
		field0003 as names
		FROM
		formmain_0006
		WHERE
		sts = 'Y'
		AND id IN (
		SELECT
		field0001
		FROM
		formson_0006
		WHERE
		formmain_id in (
		SELECT
		id
		FROM
		formmain_0018
		WHERE
		field0002 = #{codes}
		AND sts = 'Y'
		)
		AND sts = 'Y'
		)
		AND field0002 IN (
		'xm',
		'gys',
		'kh',
		'ywy',
		'bm')
	</select>
</mapper>
