TProjectInfoMapper.xml 7.98 KB
Newer Older
wuqinghua's avatar
wuqinghua committed
1 2 3 4 5 6 7 8
<?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"    />
wuqinghua's avatar
wuqinghua committed
9
        <result property="enterpriseCode"    column="enterprise_code"    />
wuqinghua's avatar
wuqinghua committed
10
        <result property="projectYear"    column="project_year"    />
wuqinghua's avatar
wuqinghua committed
11
        <result property="beyondEnterpriseId"    column="beyond_enterprise_id"    />
wuqinghua's avatar
wuqinghua committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
        <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">
wuqinghua's avatar
wuqinghua committed
27
        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
wuqinghua's avatar
wuqinghua committed
28 29 30 31 32 33 34
    </sql>

    <select id="selectTProjectInfoList" parameterType="TProjectInfo" resultMap="TProjectInfoResult">
        <include refid="selectTProjectInfoVo"/>
        <where>
            is_del='0'
            <if test="projectYear != null "> and project_year = #{projectYear}</if>
wuqinghua's avatar
wuqinghua committed
35
            <if test="beyondEnterpriseId != null and beyondEnterpriseId != -2 "> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
wuqinghua's avatar
wuqinghua committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
            <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>
        group by  project_id desc
    </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=",">
wuqinghua's avatar
wuqinghua committed
56
            <if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
wuqinghua's avatar
wuqinghua committed
57
            <if test="projectYear != null">project_year,</if>
wuqinghua's avatar
wuqinghua committed
58
            <if test="enterpriseCode != null">enterprise_code,</if>
wuqinghua's avatar
wuqinghua committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72
            <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=",">
wuqinghua's avatar
wuqinghua committed
73
            <if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
wuqinghua's avatar
wuqinghua committed
74
            <if test="projectYear != null">#{projectYear},</if>
wuqinghua's avatar
wuqinghua committed
75
            <if test="enterpriseCode != null">#{enterpriseCode},</if>
wuqinghua's avatar
wuqinghua committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
            <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>
wuqinghua's avatar
wuqinghua committed
95
            <if test="enterpriseCode != null">enterprise_code = #{enterpriseCode},</if>
wuqinghua's avatar
wuqinghua committed
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
            <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">
wuqinghua's avatar
wuqinghua committed
125
        select project_id from t_project_info where project_year=#{projectYear} and beyond_enterprise_id=#{beyondEnterpriseId}
wuqinghua's avatar
wuqinghua committed
126 127 128 129
    </select>

    <!--重复年份删除方法-->
    <update id="deleteisSameYear">
wuqinghua's avatar
wuqinghua committed
130
        update t_project_info set is_del='1' where project_year=#{isSameYear} and beyond_enterprise_id=#{beyondEnterpriseId}
wuqinghua's avatar
wuqinghua committed
131 132 133 134 135 136
    </update>

    <!--查询修改文件之前的路径-->
    <select id="selectNearbyAddress" resultMap="TProjectInfoResult">
        select nearby_address from t_project_info where project_id=#{projectId}
    </select>
wuqinghua's avatar
wuqinghua committed
137 138 139 140 141 142

    <!--查询企业名称-->
    <select id="selectEnterpriseName" resultType="java.lang.String">
       select enterprise_name from t_enterprise_info where
           enterprise_id =#{deptId} and  is_del='0'
    </select>
wuqinghua's avatar
wuqinghua committed
143
</mapper>