TSupBalGasSupMapper.xml 9.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?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.zehong.system.mapper.TSupBalGasSupMapper">
    
    <resultMap type="TSupBalGasSup" id="TSupBalGasSupResult">
        <result property="fGasSupId"    column="f_gas_sup_id"    />
        <result property="fCompanyInfoId"    column="f_company_info_id"    />
        <result property="fPlanQuan"    column="f_plan_quan"    />
        <result property="fApprQuan"    column="f_appr_quan"    />
        <result property="fSupGasVol"    column="f_sup_gas_vol"    />
        <result property="fStorageVol"    column="f_storage_vol"    />
        <result property="fSupDate"    column="f_sup_date"    />
        <result property="fRepStatus"    column="f_rep_status"    />
        <result property="fRepDate"    column="f_rep_date"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="remarks"    column="remarks"    />
23
        <result property="calendarDate"    column="f_calendar_date"    />
耿迪迪's avatar
耿迪迪 committed
24 25
        <result property="fGovUploadStatus"    column="f_gov_upload_status"    />
        <result property="fGovUploadTime"    column="f_gov_upload_time"    />
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    </resultMap>

    <sql id="selectTSupBalGasSupVo">
        SELECT
            sup.f_gas_sup_id,
            sup.f_company_info_id,
            sup.f_plan_quan,
            sup.f_appr_quan,
            sup.f_sup_gas_vol,
            sup.f_storage_vol,
            sup.f_sup_date,
            sup.f_rep_status,
            sup.f_rep_date,
            sup.create_by,
            sup.create_time,
            sup.update_by,
            sup.update_time,
            sup.is_del,
            sup.remarks,
45
            sup.f_calendar_date,
耿迪迪's avatar
耿迪迪 committed
46 47
            sup.f_gov_upload_status,
            sup.f_gov_upload_time,
48 49 50 51 52 53 54 55 56
            en.enterprise_name as enterpriseName
        FROM
            t_sup_bal_gas_sup sup
        LEFT JOIN t_enterprise_info en ON sup.f_company_info_id = en.enterprise_id
    </sql>

    <select id="selectTSupBalGasSupList" parameterType="TSupBalGasSup" resultMap="TSupBalGasSupResult">
        <include refid="selectTSupBalGasSupVo"/>
        <where>  
耿迪迪's avatar
耿迪迪 committed
57
            <if test="fCompanyInfoId != null  and fCompanyInfoId != ''"> and sup.f_company_info_id = #{fCompanyInfoId}</if>
58 59 60 61 62
            <if test="fPlanQuan != null "> and sup.f_plan_quan = #{fPlanQuan}</if>
            <if test="fApprQuan != null "> and sup.f_appr_quan = #{fApprQuan}</if>
            <if test="fSupGasVol != null "> and sup.f_sup_gas_vol = #{fSupGasVol}</if>
            <if test="fStorageVol != null "> and sup.f_storage_vol = #{fStorageVol}</if>
            <if test="fRepStatus != null  and fRepStatus != ''"> and sup.f_rep_status = #{fRepStatus}</if>
耿迪迪's avatar
耿迪迪 committed
63
            <if test="beginRepDate != null and endRepDate != null">and sup.f_gov_upload_time between #{beginRepDate} and #{endRepDate}</if>
64
            <if test="enterpriseName != null  and enterpriseName != ''"> and en.enterprise_name like concat('%', #{enterpriseName}, '%')</if>
65
            <if test="calendarDate != null"> and f_calendar_date = #{calendarDate}</if>
耿迪迪's avatar
耿迪迪 committed
66 67 68
            <if test="beginCurrentMonthDate != null and endCurrentMonthDate != null">and sup.f_calendar_date between #{beginCurrentMonthDate} and #{endCurrentMonthDate}</if>
            <if test="fGovUploadStatus != null  and fGovUploadStatus != ''"> and sup.f_gov_upload_status = #{fGovUploadStatus}</if>
            <if test="fGovUploadTime != null "> and sup.f_gov_upload_time = #{fGovUploadTime}</if>
69
        </where>
70
        order by create_time desc
71
    </select>
xulihui's avatar
xulihui committed
72 73 74 75 76 77 78 79

    <!--查询统计信息-->
    <select id="tSupBalGasSupStatistics" resultType="com.zehong.system.domain.Statistics">
        SELECT
        SUM(f_plan_quan) as 'count',
        SUM(f_appr_quan) as 'count1',
        SUM(f_sup_gas_vol) as 'count2',
        SUM(f_storage_vol) as 'count3',
wanghao's avatar
wanghao committed
80
        DATE_FORMAT( f_calendar_date, '%Y-%m-%d' ) AS date
xulihui's avatar
xulihui committed
81 82 83 84 85
        FROM
        t_sup_bal_gas_sup
        WHERE
        is_del='0'
        and
wanghao's avatar
wanghao committed
86
        DATE_FORMAT( f_calendar_date, '%Y-%m-%d' ) IN
xulihui's avatar
xulihui committed
87 88 89 90
        <foreach collection="list" item="sevenDate" separator="," open="(" close=")">
            #{sevenDate}
        </foreach>
        GROUP BY
wanghao's avatar
wanghao committed
91
        DATE_FORMAT( f_calendar_date, '%Y-%m-%d' )
xulihui's avatar
xulihui committed
92
        ORDER BY
wanghao's avatar
wanghao committed
93
        DATE_FORMAT( f_calendar_date, '%Y-%m-%d' ) DESC;
xulihui's avatar
xulihui committed
94
    </select>
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
    
    <select id="selectTSupBalGasSupById" parameterType="Long" resultMap="TSupBalGasSupResult">
        <include refid="selectTSupBalGasSupVo"/>
        where sup.f_gas_sup_id = #{fGasSupId}
    </select>
        
    <insert id="insertTSupBalGasSup" parameterType="TSupBalGasSup" useGeneratedKeys="true" keyProperty="fGasSupId">
        insert into t_sup_bal_gas_sup
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fCompanyInfoId != null and fCompanyInfoId != ''">f_company_info_id,</if>
            <if test="fPlanQuan != null">f_plan_quan,</if>
            <if test="fApprQuan != null">f_appr_quan,</if>
            <if test="fSupGasVol != null">f_sup_gas_vol,</if>
            <if test="fStorageVol != null">f_storage_vol,</if>
            <if test="fSupDate != null">f_sup_date,</if>
            <if test="fRepStatus != null and fRepStatus != ''">f_rep_status,</if>
            <if test="fRepDate != null">f_rep_date,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isDel != null">is_del,</if>
            <if test="remarks != null">remarks,</if>
118
            <if test="calendarDate != null">f_calendar_date,</if>
耿迪迪's avatar
耿迪迪 committed
119 120
            <if test="fGovUploadStatus != null">f_gov_upload_status,</if>
            <if test="fGovUploadTime != null">f_gov_upload_time,</if>
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fCompanyInfoId != null and fCompanyInfoId != ''">#{fCompanyInfoId},</if>
            <if test="fPlanQuan != null">#{fPlanQuan},</if>
            <if test="fApprQuan != null">#{fApprQuan},</if>
            <if test="fSupGasVol != null">#{fSupGasVol},</if>
            <if test="fStorageVol != null">#{fStorageVol},</if>
            <if test="fSupDate != null">#{fSupDate},</if>
            <if test="fRepStatus != null and fRepStatus != ''">#{fRepStatus},</if>
            <if test="fRepDate != null">#{fRepDate},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="remarks != null">#{remarks},</if>
137
            <if test="calendarDate != null">#{calendarDate},</if>
耿迪迪's avatar
耿迪迪 committed
138 139
            <if test="fGovUploadStatus != null">#{fGovUploadStatus},</if>
            <if test="fGovUploadTime != null">#{fGovUploadTime},</if>
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
         </trim>
    </insert>

    <update id="updateTSupBalGasSup" parameterType="TSupBalGasSup">
        update t_sup_bal_gas_sup
        <trim prefix="SET" suffixOverrides=",">
            <if test="fCompanyInfoId != null and fCompanyInfoId != ''">f_company_info_id = #{fCompanyInfoId},</if>
            <if test="fPlanQuan != null">f_plan_quan = #{fPlanQuan},</if>
            <if test="fApprQuan != null">f_appr_quan = #{fApprQuan},</if>
            <if test="fSupGasVol != null">f_sup_gas_vol = #{fSupGasVol},</if>
            <if test="fStorageVol != null">f_storage_vol = #{fStorageVol},</if>
            <if test="fSupDate != null">f_sup_date = #{fSupDate},</if>
            <if test="fRepStatus != null and fRepStatus != ''">f_rep_status = #{fRepStatus},</if>
            <if test="fRepDate != null">f_rep_date = #{fRepDate},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
160
            <if test="calendarDate != null">f_calendar_date = #{calendarDate},</if>
耿迪迪's avatar
耿迪迪 committed
161 162
            <if test="fGovUploadStatus != null">f_gov_upload_status = #{fGovUploadStatus},</if>
            <if test="fGovUploadTime != null">f_gov_upload_time = #{fGovUploadTime},</if>
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
        </trim>
        where f_gas_sup_id = #{fGasSupId}
    </update>

    <delete id="deleteTSupBalGasSupById" parameterType="Long">
        delete from t_sup_bal_gas_sup where f_gas_sup_id = #{fGasSupId}
    </delete>

    <delete id="deleteTSupBalGasSupByIds" parameterType="String">
        delete from t_sup_bal_gas_sup where f_gas_sup_id in 
        <foreach item="fGasSupId" collection="array" open="(" separator="," close=")">
            #{fGasSupId}
        </foreach>
    </delete>

    <select id="getReportInfoByCompany" parameterType="Map" resultMap="TSupBalGasSupResult">
        <include refid="selectTSupBalGasSupVo"/>
耿迪迪's avatar
耿迪迪 committed
180
        where sup.f_company_info_id = #{companyId} and sup.f_calendar_date = #{calendarDate}
181 182
    </select>
</mapper>