TGasStorageStationInfoMapper.xml 7.82 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5
<?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.TGasStorageStationInfoMapper">
吴卿华's avatar
吴卿华 committed
6

耿迪迪's avatar
耿迪迪 committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
    <resultMap type="TGasStorageStationInfo" id="TGasStorageStationInfoResult">
        <result property="stationId"    column="station_id"    />
        <result property="stationName"    column="station_name"    />
        <result property="stationCode"    column="station_code"    />
        <result property="director"    column="director"    />
        <result property="telNum"    column="tel_num"    />
        <result property="address"    column="address"    />
        <result property="licenceFile"    column="licence_file"    />
        <result property="licenceCode"    column="licence_code"    />
        <result property="licenceEffectiveDate"    column="licence_effective_date"    />
        <result property="licenceLimitDate"    column="licence_limit_date"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTGasStorageStationInfoVo">
        select station_id, station_name, station_code, director, tel_num, address, licence_file, licence_code, licence_effective_date, licence_limit_date, longitude, latitude, create_time, update_time, remark from t_gas_storage_station_info
    </sql>

    <select id="selectTGasStorageStationInfoList" parameterType="TGasStorageStationInfo" resultMap="TGasStorageStationInfoResult">
        <include refid="selectTGasStorageStationInfoVo"/>
吴卿华's avatar
吴卿华 committed
31
        <where>
耿迪迪's avatar
耿迪迪 committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
            <if test="stationName != null  and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
            <if test="stationCode != null  and stationCode != ''"> and station_code = #{stationCode}</if>
            <if test="director != null  and director != ''"> and director = #{director}</if>
            <if test="telNum != null  and telNum != ''"> and tel_num = #{telNum}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="licenceFile != null  and licenceFile != ''"> and licence_file = #{licenceFile}</if>
            <if test="licenceCode != null  and licenceCode != ''"> and licence_code = #{licenceCode}</if>
            <if test="licenceEffectiveDate != null "> and licence_effective_date = #{licenceEffectiveDate}</if>
            <if test="licenceLimitDate != null "> and licence_limit_date = #{licenceLimitDate}</if>
            <if test="longitude != null "> and longitude = #{longitude}</if>
            <if test="latitude != null "> and latitude = #{latitude}</if>
            <if test="createBeginTime != null and createEndTime != null">
                and create_time BETWEEN #{createBeginTime} AND #{createEndTime}
            </if>
        </where>
吴卿华's avatar
吴卿华 committed
47
        order by create_time desc
耿迪迪's avatar
耿迪迪 committed
48
    </select>
吴卿华's avatar
吴卿华 committed
49

耿迪迪's avatar
耿迪迪 committed
50 51 52 53
    <select id="selectTGasStorageStationInfoById" parameterType="Long" resultMap="TGasStorageStationInfoResult">
        <include refid="selectTGasStorageStationInfoVo"/>
        where station_id = #{stationId}
    </select>
吴卿华's avatar
吴卿华 committed
54

耿迪迪's avatar
耿迪迪 committed
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
    <insert id="insertTGasStorageStationInfo" parameterType="TGasStorageStationInfo" useGeneratedKeys="true" keyProperty="stationId">
        insert into t_gas_storage_station_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="stationName != null">station_name,</if>
            <if test="stationCode != null">station_code,</if>
            <if test="director != null">director,</if>
            <if test="telNum != null">tel_num,</if>
            <if test="address != null">address,</if>
            <if test="licenceFile != null">licence_file,</if>
            <if test="licenceCode != null">licence_code,</if>
            <if test="licenceEffectiveDate != null">licence_effective_date,</if>
            <if test="licenceLimitDate != null">licence_limit_date,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="stationName != null">#{stationName},</if>
            <if test="stationCode != null">#{stationCode},</if>
            <if test="director != null">#{director},</if>
            <if test="telNum != null">#{telNum},</if>
            <if test="address != null">#{address},</if>
            <if test="licenceFile != null">#{licenceFile},</if>
            <if test="licenceCode != null">#{licenceCode},</if>
            <if test="licenceEffectiveDate != null">#{licenceEffectiveDate},</if>
            <if test="licenceLimitDate != null">#{licenceLimitDate},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTGasStorageStationInfo" parameterType="TGasStorageStationInfo">
        update t_gas_storage_station_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="stationName != null">station_name = #{stationName},</if>
            <if test="stationCode != null">station_code = #{stationCode},</if>
            <if test="director != null">director = #{director},</if>
            <if test="telNum != null">tel_num = #{telNum},</if>
            <if test="address != null">address = #{address},</if>
            <if test="licenceFile != null">licence_file = #{licenceFile},</if>
            <if test="licenceCode != null">licence_code = #{licenceCode},</if>
            <if test="licenceEffectiveDate != null">licence_effective_date = #{licenceEffectiveDate},</if>
            <if test="licenceLimitDate != null">licence_limit_date = #{licenceLimitDate},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where station_id = #{stationId}
    </update>

    <delete id="deleteTGasStorageStationInfoById" parameterType="Long">
        delete from t_gas_storage_station_info where station_id = #{stationId}
    </delete>

    <delete id="deleteTGasStorageStationInfoByIds" parameterType="String">
吴卿华's avatar
吴卿华 committed
117
        delete from t_gas_storage_station_info where station_id in
耿迪迪's avatar
耿迪迪 committed
118 119 120 121
        <foreach item="stationId" collection="array" open="(" separator="," close=")">
            #{stationId}
        </foreach>
    </delete>
耿迪迪's avatar
耿迪迪 committed
122

耿迪迪's avatar
耿迪迪 committed
123
    <select id="baseInfoStatistics" parameterType="java.lang.Long" resultType="com.zehong.system.domain.BaseInfoStatistics">
耿迪迪's avatar
耿迪迪 committed
124 125 126 127 128 129 130 131 132 133 134 135 136
        SELECT
          station.station_name as stationName,
          (SELECT COUNT(1) FROM t_gas_bottle_info bottle WHERE bottle.station_id = station.station_id)as totalBottle,
          (SELECT COUNT(1) FROM t_vehicle_info vehicle WHERE vehicle.station_id = station.station_id) AS totalVehicle,
          (SELECT COUNT(1) FROM t_practitioner_info pr WHERE pr.station_id = station.station_id) AS totalPractitioner
        FROM
            t_gas_storage_station_info station
        <where>
            <if test="stationId != null" >
                station.station_id = #{stationId}
            </if>
        </where>
    </select>
吴卿华's avatar
吴卿华 committed
137
</mapper>