TProjectInfoMapper.xml 8.31 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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
<?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.TProjectInfoMapper">

    <resultMap type="TProjectInfo" id="TProjectInfoResult">
        <result property="projectId"    column="project_id"    />
        <result property="enterpriseCode"    column="enterprise_code"    />
        <result property="projectYear"    column="project_year"    />
        <result property="beyondEnterpriseId"    column="beyond_enterprise_id"    />
        <result property="gateStationAddress"    column="gate_station_address"    />
        <result property="gateStationInvestment"    column="gate_station_investment"    />
        <result property="numberGateStations"    column="number_gate_stations"    />
        <result property="pipeLength"    column="pipe_length"    />
        <result property="pipeInvestment"    column="pipe_investment"    />
        <result property="nearbyAddress"    column="nearby_address"    />
        <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"    />
    </resultMap>

    <sql id="selectTProjectInfoVo">
        select project_id,enterprise_code,project_year, gate_station_address, gate_station_investment, number_gate_stations, pipe_length, pipe_investment, nearby_address, create_by, create_time, update_by, update_time, is_del, remarks from t_project_info
    </sql>

    <select id="selectTProjectInfoList" parameterType="TProjectInfo" resultMap="TProjectInfoResult">
        <include refid="selectTProjectInfoVo"/>
        <where>
            is_del='0'
            <if test="projectYear != null "> and project_year = #{projectYear}</if>
            <if test="beyondEnterpriseId != null and beyondEnterpriseId != -2 "> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
            <if test="gateStationAddress != null  and gateStationAddress != ''"> and gate_station_address = #{gateStationAddress}</if>
            <if test="gateStationInvestment != null "> and gate_station_investment = #{gateStationInvestment}</if>
            <if test="numberGateStations != null "> and number_gate_stations = #{numberGateStations}</if>
            <if test="pipeLength != null "> and pipe_length = #{pipeLength}</if>
            <if test="pipeInvestment != null "> and pipe_investment = #{pipeInvestment}</if>
            <if test="nearbyAddress != null  and nearbyAddress != ''"> and nearby_address = #{nearbyAddress}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        </where>
44
        order by project_id desc
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    </select>

    <select id="selectTProjectInfoById" parameterType="Long" resultMap="TProjectInfoResult">
        <include refid="selectTProjectInfoVo"/>
        where project_id = #{projectId} and is_del='0'
    </select>


    <insert id="insertTProjectInfo" parameterType="TProjectInfo" useGeneratedKeys="true" keyProperty="projectId">
        insert into t_project_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
            <if test="projectYear != null">project_year,</if>
            <if test="enterpriseCode != null">enterprise_code,</if>
            <if test="gateStationAddress != null">gate_station_address,</if>
            <if test="gateStationInvestment != null">gate_station_investment,</if>
            <if test="numberGateStations != null">number_gate_stations,</if>
            <if test="pipeLength != null">pipe_length,</if>
            <if test="pipeInvestment != null">pipe_investment,</if>
            <if test="nearbyAddress != null">nearby_address,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
            <if test="projectYear != null">#{projectYear},</if>
            <if test="enterpriseCode != null">#{enterpriseCode},</if>
            <if test="gateStationAddress != null">#{gateStationAddress},</if>
            <if test="gateStationInvestment != null">#{gateStationInvestment},</if>
            <if test="numberGateStations != null">#{numberGateStations},</if>
            <if test="pipeLength != null">#{pipeLength},</if>
            <if test="pipeInvestment != null">#{pipeInvestment},</if>
            <if test="nearbyAddress != null">#{nearbyAddress},</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>
         </trim>
    </insert>

    <update id="updateTProjectInfo" parameterType="TProjectInfo">
        update t_project_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="projectYear != null">project_year = #{projectYear},</if>
            <if test="enterpriseCode != null">enterprise_code = #{enterpriseCode},</if>
            <if test="gateStationAddress != null">gate_station_address = #{gateStationAddress},</if>
            <if test="gateStationInvestment != null">gate_station_investment = #{gateStationInvestment},</if>
            <if test="numberGateStations != null">number_gate_stations = #{numberGateStations},</if>
            <if test="pipeLength != null">pipe_length = #{pipeLength},</if>
            <if test="pipeInvestment != null">pipe_investment = #{pipeInvestment},</if>
            <if test="nearbyAddress != null">nearby_address = #{nearbyAddress},</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>
        </trim>
        where project_id = #{projectId}
    </update>

    <update id="deleteTProjectInfoById" parameterType="Long">
        update  t_project_info set is_del='1' where project_id = #{projectId}
    </update>

    <update id="deleteTProjectInfoByIds" parameterType="String">
        update  t_project_info set is_del='1' where project_id in
        <foreach item="projectId" collection="array" open="(" separator="," close=")">
            #{projectId}
        </foreach>
    </update>

    <!--查询是否已经有重复的年份数据-->
    <select id="selectSameYear" resultMap="TProjectInfoResult">
        select project_id from t_project_info where project_year=#{projectYear} and beyond_enterprise_id=#{beyondEnterpriseId}
    </select>

    <!--重复年份删除方法-->
    <update id="deleteisSameYear">
        update t_project_info set is_del='1' where project_year=#{isSameYear} and beyond_enterprise_id=#{beyondEnterpriseId}
    </update>

    <!--查询修改文件之前的路径-->
    <select id="selectNearbyAddress" resultMap="TProjectInfoResult">
        select nearby_address from t_project_info where project_id=#{projectId}
    </select>

    <!--查询企业名称-->
    <select id="selectEnterpriseName" resultType="java.lang.String">
       select enterprise_name from t_enterprise_info where
           enterprise_id =#{deptId} and  is_del='0'
    </select>
    <select id="selectNum" resultType="java.util.HashMap">
        SELECT IFNULL(SUM(number_gate_stations),0) AS zhanNum,
            IFNULL(SUM(pipe_length),0) AS pipeNum ,
            IFNULL(SUM(gate_station_investment),0) AS moneyZhan,
            IFNULL(SUM(pipe_investment),0) AS moneyPipe
        FROM  t_project_info
    </select>
</mapper>