<?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> 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=","> <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> </mapper>