hnlg/src/main/resources/mapper/mysql/jxgl/FphqMapper.xml

219 lines
7.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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="net.htjs.pt4.zzsxt.dao.jxgl.jxfpgl.fphq.FphqMapper">
<select id="selectZZSGL_JX_FPXX_FPHQ" resultType="hashMap" parameterType="map">
SELECT C.*,@ROWNUM:=@ROWNUM+1 ROWNO
FROM (
SELECT A.FPID, A.FPDM, A.FPHM, A.KPRQ, A.XFSH, A.XFMC, A.JEBHS,
A.SL, A.SE, A.JSHJ, A.FPZT, A.RZBZ,A.RZRQ, @ROWNUM:=0
FROM ZZSGL_JX_FPXX A
WHERE 1=1
<if test="FPDM!=null and FPDM!=''">
AND A.FPDM = #{FPDM}
</if>
<if test="FPHM!=null and FPHM!=''">
AND A.FPHM = #{FPHM}
</if>
<if test="XFMC!=null and XFMC!=''">
AND A.XFMC LIKE CONCAT('%', #{XFMC}, '%')
</if>
<!--<if test="KPRQ!=null and KPRQ!=''">-->
<!--AND A.KPRQ = #{KPRQ}-->
<!--</if>-->
<if test="KPRQQ!=null and KPRQQ!=''">
<![CDATA[
AND DATE_FORMAT(A.KPRQ,'%Y-%m-%d') >= DATE_FORMAT(#{KPRQQ},'%Y-%m-%d')
]]>
</if>
<if test="KPRQZ!=null and KPRQZ!=''">
<![CDATA[
AND DATE_FORMAT(A.KPRQ,'%Y-%m-%d') < DATE_FORMAT(#{KPRQZ},'%Y-%m-%d')
]]>
</if>
<if test="FPZT!=null and FPZT!=''">
AND A.FPZT = #{FPZT}
</if>
<if test="RZBZ!=null and RZBZ!=''">
AND A.RZBZ = #{RZBZ}
</if>
<if test="QYXXID!=null and QYXXID!=''">
AND A.QYXXID = #{QYXXID}
</if>
<!--<if test='CurUserRole=="XLL"'>-->
<!--AND (X.CZRY_DM = #{LOG_CZRY_DM}-->
<!--OR Z.XMGLY_DM = #{LOG_CZRY_DM})-->
<!--</if>-->
<!--&lt;!&ndash; 部门负责人 或者超级管理员 &ndash;&gt;-->
<!--<if test='CurUserRole=="BOSS"'>-->
<!--AND get_zzjg_jbdm(B.ZZJG_DM) LIKE CONCAT( get_zzjg_jbdm(#{LOG_ZZJG_DM}), '%')-->
<!--</if>-->
ORDER BY A.KPRQ DESC
) C
</select>
<!--/**
*@Author: yangrong
*@Description 发票获取-查询数据库是否存在纳税人试别号和发票信息
*@Date: 17:18 2018/5/18
*/-->
<select id="selectZZSGL_GY_SSQXX" resultType="hashMap" parameterType="map">
SELECT SSQ, SSQJZSJ, GXRQQ, GXRQZ
FROM ZZSGL_GY_SSQXX
WHERE 1=1
<if test="QYXXID!=null and QYXXID!=''">
AND QYXXID = #{QYXXID}
</if>
<if test="SSQ!=null and SSQ!=''">
AND SSQ = #{SSQ}
</if>
order by SSQ desc
</select>
<!--/**
*@Author: yangrong
*@Description 发票获取-添加纳税人识别号及所属期信息
*@Date: 17:20 2018/5/18
*/-->
<insert id="insertZZSGL_GY_SSQXX" parameterType="map">
INSERT INTO ZZSGL_GY_SSQXX
(SSQ, SSQJZSJ, GXRQQ, GXRQZ, QYXXID )
VALUES
(#{SSQ}, DATE_FORMAT(#{SSQJZSJ},'%Y-%m-%d'),
DATE_FORMAT(#{GXRQQ},'%Y-%m-%d'),
DATE_FORMAT(#{GXRQZ},'%Y-%m-%d'),
#{QYXXID} )
</insert>
<!--/**
*@Author: yangrong
*@Description 发票获取-更新纳税人所属期
*@Date: 17:26 2018/5/18
*/-->
<update id="updateZZSGL_GY_SSQXX" parameterType="map">
UPDATE ZZSGL_GY_SSQXX
SET SSQJZSJ=#{SSQJZSJ}, GXRQQ=#{GXRQQ}, GXRQZ=#{GXRQZ}
WHERE QYXXID=#{QYXXID} AND SSQ = #{SSQ}
</update>
<!--/**
*@Author: yangrong
*@Description 进项发票下载导入本地数据库插入sql
*@Date: 15:37 2018/5/16
*@param null
*/-->
<insert id="insertZZSGL_JX_FPXX_FPXZ" parameterType="map">
INSERT INTO ZZSGL_JX_FPXX
( FPID, FPDM, FPHM, FPZT, KPRQ, XFMC, XFSH, SL,
JEBHS, SE, JSHJ, RZBZ, RZFS, RZSSQ, QYXXID, SCZT
<if test="RZRQ!=null and RZRQ!=''">
,RZRQ
</if>
<if test="FYLX!=null and FYLX!=''">
,FYLX
</if>
)
VALUES
( #{FPID}, #{FPDM}, #{FPHM}, #{FPZT}, #{KPRQ}, #{XFMC}, #{XFSH}, #{SL},
#{JEBHS}, #{SE}, #{JEBHS}+#{SE}, #{RZBZ}, #{RZFS}, #{RZSSQ}, #{QYXXID}, '1'
<if test="RZRQ!=null and RZRQ!=''">
,DATE_FORMAT(#{RZRQ}, '%Y-%m-%d')
</if>
<if test="FYLX!=null and FYLX!=''">
,#{FYLX}
</if>
)
</insert>
<!--/**
*@Author: yangrong
*@Description进项发票管理-发票获取-状态刷新
*@Date: 15:45 2018/5/16
*@param 因为发票状态一定不为空,所以更新 sql将发票状态放在最后一栏进行处理
*/-->
<update id="updateZZSGL_JX_FPXX_FPXZ" parameterType="map">
<!--更新发票状态-->
UPDATE ZZSGL_JX_FPXX
<set>
<if test="RZFS!=null and RZFS!=''">
RZFS = #{RZFS},
</if>
<if test="RZRQ!=null and RZRQ!=''">
RZRQ = DATE_FORMAT(#{RZRQ}, '%Y-%m-%d'),
</if>
<if test="RZBZ!=null and RZBZ!=''">
RZBZ = #{RZBZ},
</if>
<if test="FPLX!=null and FPLX!=''">
FPLX = #{FPLX},
</if>
<if test="RZSSQ!=null and RZSSQ!=''">
RZSSQ = #{RZSSQ},
</if>
<if test="FPZT!=null and FPZT!=''">
FPZT = #{FPZT},
</if>
<if test="SCZT!=null and SCZT!=''">
SCZT = '1',
</if>
<if test="KPRQ!=null and KPRQ!=''">
KPRQ = DATE_FORMAT(#{KPRQ}, '%Y-%m-%d'),
</if>
<if test="XFMC!=null and XFMC!=''">
XFMC = #{XFMC},
</if>
<if test="XFSH!=null and XFSH!=''">
XFSH = #{XFSH},
</if>
<if test="SL!=null and SL!=''">
SL = #{SL},
</if>
<if test="JEBHS!=null and JEBHS!=''">
JEBHS = #{JEBHS},
</if>
<if test="SE!=null and SE!=''">
SE = #{SE},
</if>
<if test="JEBHS!=null and JEBHS!='' and SE!=null and SE!=''">
JSHJ = #{JEBHS}+#{SE},
</if>
<if test="QYXXID!=null and QYXXID!=''">
QYXXID = #{QYXXID},
</if>
</set>
WHERE FPID = #{FPID}
<!--更新归属表发票状态-->
<if test="RZBZ=='2' or RZBZ=='3'">
;UPDATE ZZSGL_JX_FPGS
SET CZZT = #{CZZT}
WHERE FPID = #{FPID}
</if>
</update>
<!--/**
*@Author: yangrong
*@Description 发票下载-查询票是否重复
*@Date: 17:24 2018/5/22
*/-->
<select id="selectZZSGL_JX_FPXX_BY_DMHM" parameterType="map" resultType="hashMap">
<!--后期需要可以添加字段-->
SELECT XX.FPID, XX.FPHM, XX.FPDM, GS.CZZT
FROM ZZSGL_JX_FPXX XX
LEFT JOIN ZZSGL_JX_FPGS GS ON XX.FPID = GS.FPID
WHERE XX.FPHM = #{FPHM}
<if test="FPDM != null and FPDM!=''">
AND XX.FPDM = #{FPDM}
</if>
</select>
<!--/**
*@Author: yangrong
*@Description 发票下载-查询票是否重复
*@Date: 17:24 2018/5/22
*/-->
<select id="select_JX_FPXX_BY_DMHM" parameterType="map" resultType="hashMap">
<!--后期需要可以添加字段-->
SELECT *
FROM ZZSGL_JX_FPXX
WHERE FPHM = #{FPHM}
<if test="FPDM != null and FPDM!=''">
AND FPDM = #{FPDM}
</if>
</select>
</mapper>