| 
					
				 | 
			
			
				@@ -3,7 +3,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <mapper namespace="com.fs.company.mapper.CompanyMoneyLogsMapper"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <resultMap type="CompanyMoneyLogs" id="CompanyMoneyLogsResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="logsId"    column="logs_id"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="companyId"    column="company_id"    /> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -21,17 +21,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectCompanyMoneyLogsList" parameterType="CompanyMoneyLogs" resultMap="CompanyMoneyLogsResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="selectCompanyMoneyLogsVo"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <where>   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="companyId != null "> and company_id = #{companyId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="money != null "> and money = #{money}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectCompanyMoneyLogsById" parameterType="Long" resultMap="CompanyMoneyLogsResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="selectCompanyMoneyLogsVo"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where logs_id = #{logsId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="selectCompanyMoneyLogsExportVOList" resultType="com.fs.company.vo.CompanyMoneyLogsExportVO"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        select l.*,c.company_name,o.order_code,deliver.deliver_id as delivery_id,p.pay_code,p.pay_type_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from company_money_logs l 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            left join company c on c.company_id=l.company_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            left join fs_store_order o on (o.id=l.business_id and (l.logs_type=4 or  l.logs_type=5)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            left join fs_store_payment p on (p.payment_id=l.business_id and (l.logs_type=8 or  l.logs_type=9)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            left join fs_store_delivers deliver on deliver.order_id=o.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test = 'maps.companyId != null  '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and l.company_id = #{maps.companyId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test = 'maps.logsType != null  '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and l.logs_type = #{maps.logsType} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test = 'maps.beginTime != null and maps.beginTime != "" '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and date_format(l.create_time,'%y%m%d') >= date_format(#{maps.beginTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test = 'maps.endTime != null and maps.endTime != "" '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and date_format(l.create_time,'%y%m%d') <= date_format(#{maps.endTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        order by l.logs_id desc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="selectCompanyMoneyLogsExport1VOList" resultType="com.fs.company.vo.CompanyMoneyLogsExport1VO"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        select DISTINCT l.*,c.company_name,p.pay_type_code,o.order_code,o.real_name,o.user_phone,o.user_address,o.total_price,o.pay_money,o.pay_delivery,o.status,o.delivery_pay_status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        o.delivery_time,o.delivery_pay_time,deliver.deliver_id as delivery_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ,(select group_concat(dd.dept_name separator  ',') from company_dept dd where o.dept_id=dd.dept_id or find_in_set(dd.dept_id,d.ancestors)) as dept_name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from company_money_logs l left join company c on c.company_id=l.company_id left join fs_store_order o on o.id=l.business_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join (select * from fs_store_payment where status != 0) p on o.id=p.order_id left join company_dept d on d.dept_id=o.dept_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join fs_store_delivers deliver on deliver.order_id=o.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where (l.logs_type=4||l.logs_type=5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test = 'maps.companyId != null  '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and l.company_id = #{maps.companyId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test = 'maps.beginTime != null and maps.beginTime !="" '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and date_format(l.create_time,'%y%m%d') >= date_format(#{maps.beginTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test = 'maps.endTime != null and maps.endTime != "" '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and date_format(l.create_time,'%y%m%d') <= date_format(#{maps.endTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        order by l.logs_id desc LIMIT 30000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <insert id="insertCompanyMoneyLogs" parameterType="CompanyMoneyLogs" useGeneratedKeys="true" keyProperty="logsId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         insert into company_money_logs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <trim prefix="(" suffix=")" suffixOverrides=","> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -73,10 +115,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <delete id="deleteCompanyMoneyLogsByIds" parameterType="String"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        delete from company_money_logs where logs_id in  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        delete from company_money_logs where logs_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <foreach item="logsId" collection="array" open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #{logsId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-</mapper> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</mapper> 
			 |