WallboxApplyMapper.xml 17.4 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 44 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
<?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.boco.nbd.wios.manage.mapper.def.WallboxApplyMapper">

    <resultMap type="com.boco.nbd.wios.manage.entity.bo.WallboxApply" id="WallboxApplyResult">
        <result property="id" column="id"/>
        <result property="orderId" column="order_id"/>
        <result property="supplierId" column="supplier_id"/>
        <result property="supplierTeam" column="supplier_team"/>
        <result property="wallboxItemId" column="wallbox_item_id"/>
        <result property="wallboxModel" column="wallbox_model"/>
        <result property="materialType" column="material_type"/>
        <result property="trackingNumber" column="tracking_number"/>
        <result property="trackingStatus" column="tracking_status"/>
        <result property="installStatus" column="install_status"/>
        <result property="regionId" column="region_id"/>
        <result property="address" column="address"/>
        <result property="outOrderId" column="out_order_id"/>
        <result property="ifEmergency" column="if_emergency"/>
        <result property="ifTimeout" column="if_timeout"/>
        <result property="checkAccount" column="check_account"/>
        <result property="checkStatus" column="check_status"/>
        <result property="checkRemarks" column="check_remarks"/>
        <result property="checkTime" column="check_time"/>
        <result property="installReserveTime" column="install_reserve_time"/>
        <result property="installProcess" column="install_process"/>
        <result property="createAccount" column="create_account"/>
        <result property="createdTime" column="created_time"/>
        <result property="modifyAccount" column="modify_account"/>
        <result property="modifyTime" column="modify_time"/>
    </resultMap>

    <sql id="selectWallboxApplyVo">
        select id,
               order_id,
               supplier_id,
               supplier_team,
               wallbox_item_id,
               wallbox_model,
               material_type,
               tracking_number,
               tracking_status,
               install_status,
               region_id,
               address,
               out_order_id,
               if_emergency,
               if_timeout,
               check_account,
               check_status,
               check_remarks,
               check_time,
               install_reserve_time,
               install_process,
               create_account,
               created_time,
               modify_account,
               modify_time
        from t_wallbox_apply
    </sql>

    <select id="selectWallboxApplyList" parameterType="com.boco.nbd.wios.manage.entity.bo.WallboxApply"
            resultMap="WallboxApplyResult">
        <include refid="selectWallboxApplyVo"/>
        <where>
            <if test="orderId != null  and orderId != ''">and order_id = #{orderId}</if>
            <if test="supplierId != null ">and supplier_id = #{supplierId}</if>
            <if test="supplierTeam != null  and supplierTeam != ''">and supplier_team like concat('%', #{supplierTeam},
                '%')
            </if>
            <if test="wallboxItemId != null  and wallboxItemId != ''">and wallbox_item_id = #{wallboxItemId}</if>
            <if test="wallboxModel != null  and wallboxModel != ''">and wallbox_model = #{wallboxModel}</if>
            <if test="materialType != null  and materialType != ''">and material_type = #{materialType}</if>
            <if test="trackingNumber != null  and trackingNumber != ''">and tracking_number = #{trackingNumber}</if>
            <if test="trackingStatus != null  and trackingStatus != ''">and tracking_status = #{trackingStatus}</if>
            <if test="installStatus != null  and installStatus != ''">and install_status = #{installStatus}</if>
            <if test="regionId != null  and regionId != ''">and region_id = #{regionId}</if>
            <if test="address != null  and address != ''">and address = #{address}</if>
            <if test="outOrderId != null  and outOrderId != ''">and out_order_id = #{outOrderId}</if>
            <if test="ifEmergency != null ">and if_emergency = #{ifEmergency}</if>
            <if test="ifTimeout != null ">and if_timeout = #{ifTimeout}</if>
            <if test="checkAccount != null  and checkAccount != ''">and check_account = #{checkAccount}</if>
            <if test="checkStatus != null ">and check_status = #{checkStatus}</if>
            <if test="checkRemarks != null  and checkRemarks != ''">and check_remarks = #{checkRemarks}</if>
            <if test="checkTime != null ">and check_time = #{checkTime}</if>
            <if test="installReserveTime != null ">and install_reserve_time = #{installReserveTime}</if>
            <if test="installProcess != null ">and install_process = #{installProcess}</if>
            <if test="createAccount != null  and createAccount != ''">and create_account = #{createAccount}</if>
            <if test="createdTime != null ">and created_time = #{createdTime}</if>
            <if test="modifyAccount != null  and modifyAccount != ''">and modify_account = #{modifyAccount}</if>
            <if test="modifyTime != null ">and modify_time = #{modifyTime}</if>
        </where>
    </select>

    <select id="selectWallboxApplyListFromOrder" parameterType="com.boco.nbd.wios.manage.entity.vo.WallboxApplyReqVO"
            resultType="com.boco.nbd.wios.manage.entity.vo.WallboxApplyInstallListVO">
        SELECT t_wallbox_apply.id,
        t_wallbox_apply.order_id,
        t_wallbox_apply.supplier_id,
        t_wallbox_apply.supplier_team,
        t_wallbox_apply.wallbox_item_id,
        t_wallbox_apply.wallbox_model,
        t_wallbox_apply.material_type,
        t_wallbox_apply.tracking_status,
        t_order.region_id,
        reg.name as region_name,
        t_order.address,
        t_wallbox_apply.out_order_id,
        t_wallbox_apply.if_emergency,
        t_wallbox_apply.if_timeout,
        t_wallbox_apply.check_account,
        t_wallbox_apply.check_status,
        t_wallbox_apply.check_remarks,
        t_wallbox_apply.check_time,
        t_wallbox_apply.install_reserve_time,
        t_wallbox_apply.install_process,
        t_wallbox_apply.create_account,
        t_wallbox_apply.created_time,
        t_wallbox_apply.modify_account,
        t_wallbox_apply.modify_time,
        t_order.shipno as tracking_number,
        t_order.status as install_status
        FROM t_wallbox_apply
        LEFT JOIN t_order ON t_wallbox_apply.order_id = t_order.id
        left join t_region reg on reg.id=t_wallbox_apply.region_id
        <where>
            <if test="supplierTeam != null  and supplierTeam != ''">and t_wallbox_apply.supplier_team like concat('%',
                #{supplierTeam},
                '%')
            </if>
            <if test="checkStatus != null ">and t_wallbox_apply.check_status = #{checkStatus}</if>
134
            <if test="supplierId != null and regionId != ''">and t_wallbox_apply.supplier_id = #{supplierId}</if>
135 136 137 138 139 140 141 142
            <if test="trackingStatus != null ">and t_wallbox_apply.tracking_status = #{trackingStatus}</if>
            <if test="regionId != null  and regionId != ''">and t_wallbox_apply.region_id = #{regionId}</if>
            <if test="wallboxItemId != null  and wallboxItemId != ''">and t_wallbox_apply.wallbox_item_id like
                concat('%', #{wallboxItemId}, '%')
            </if>
        </where>
    </select>

143 144
    <select id="selectWallboxApplyById" parameterType="Long"
            resultType="com.boco.nbd.wios.manage.entity.vo.WallboxApplyInstallInfoVO">
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
        SELECT t_wallbox_apply.id,
               t_wallbox_apply.order_id,
               t_wallbox_apply.supplier_id,
               t_wallbox_apply.supplier_team,
               t_order.wallbox_model,
               t_order.item_model as material_type,
               t_wallbox_apply.tracking_status,
               t_order.region_id,
               reg.name           as region_name,
               t_order.install_reserve_time,
               t_order.address,
               t_order.out_order_id,
               t_wallbox_apply.if_emergency,
               t_wallbox_apply.if_timeout,
               t_wallbox_apply.check_account,
160
               wb_account.name    as check_name,
161 162 163 164 165 166 167 168 169 170 171 172 173
               t_wallbox_apply.check_status,
               t_wallbox_apply.check_remarks,
               t_wallbox_apply.check_time,
               t_order.install_reserve_time,
               t_wallbox_apply.create_account,
               t_wallbox_apply.created_time,
               t_wallbox_apply.modify_account,
               t_wallbox_apply.modify_time,
               t_order.shipno     as tracking_number,
               t_order.status     as install_status
        FROM t_wallbox_apply
                 LEFT JOIN t_order ON t_wallbox_apply.order_id = t_order.id
                 left join t_region reg on reg.id = t_wallbox_apply.region_id
174
                 left join wb_account on wb_account.id = t_wallbox_apply.check_account
175 176 177
        where t_wallbox_apply.id = #{id}
    </select>

178
    <select id="selectWallboxDetail" parameterType="com.boco.nbd.wios.manage.entity.dto.WallboxApplyDetailQueryDTO"
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
            resultType="com.boco.nbd.wios.manage.entity.vo.WallboxApplyDetailVO">
        SELECT t_wallbox_apply.id,
               t_wallbox_apply.order_id,
               t_wallbox_apply.supplier_team,
               t_wallbox_apply.tracking_status,
               t_wallbox_apply.tracking_number,
               t_wallbox_apply.supplier_id,
               t_wallbox_apply.wallbox_item_id as wallbox_code,
               t_wallbox_apply.if_emergency,
               t_wallbox_apply.if_timeout,
               t_wallbox_apply.check_account,
               t_wallbox_apply.check_status,
               t_wallbox_apply.check_remarks,
               t_wallbox_apply.check_time,
               t_wallbox_apply.create_account,
               t_wallbox_apply.created_time,
               t_wallbox_apply.modify_account,
196
               t_wallbox_apply.modify_time,
197
               wb_account.name                 as checkName,
198 199 200 201 202 203 204 205 206 207 208 209
               t_order.user_name,
               t_order.user_phone,
               t_order.wallbox_model,
               t_order.item_model,
               t_order.region_level,
               t_order.province_name,
               t_order.area_name,
               t_order.country_name,
               t_order.warehouse_id,
               t_order.address,
               t_order.out_order_id,
               t_order.install_finish_time,
210
               t_order.shipno                  as tracking_number
211

212 213
        FROM t_order
                 LEFT JOIN t_wallbox_apply ON t_wallbox_apply.order_id = t_order.id
214
                 left join wb_account on t_wallbox_apply.check_account = wb_account.id
215 216 217 218 219 220 221 222 223 224
        where t_wallbox_apply.order_id = #{orderId}
    </select>


    <select id="selectWallboxApplyByOrderId" parameterType="String" resultMap="WallboxApplyResult">
        <include refid="selectWallboxApplyVo"/>
        where order_id = #{id}
    </select>


225 226
    <insert id="insertWallboxApply" parameterType="com.boco.nbd.wios.manage.entity.bo.WallboxApply"
            useGeneratedKeys="true"
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
            keyProperty="id">
        insert into t_wallbox_apply
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="orderId != null and orderId != ''">order_id,</if>
            <if test="supplierId != null">supplier_id,</if>
            <if test="supplierTeam != null">supplier_team,</if>
            <if test="wallboxItemId != null and wallboxItemId != ''">wallbox_item_id,</if>
            <if test="wallboxModel != null">wallbox_model,</if>
            <if test="materialType != null">material_type,</if>
            <if test="trackingNumber != null">tracking_number,</if>
            <if test="trackingStatus != null">tracking_status,</if>
            <if test="installStatus != null">install_status,</if>
            <if test="regionId != null">region_id,</if>
            <if test="address != null">address,</if>
            <if test="outOrderId != null">out_order_id,</if>
            <if test="ifEmergency != null">if_emergency,</if>
            <if test="ifTimeout != null">if_timeout,</if>
            <if test="checkAccount != null">check_account,</if>
            <if test="checkStatus != null">check_status,</if>
            <if test="checkRemarks != null">check_remarks,</if>
            <if test="checkTime != null">check_time,</if>
            <if test="installReserveTime != null">install_reserve_time,</if>
            <if test="installProcess != null">install_process,</if>
            <if test="createAccount != null">create_account,</if>
            <if test="createdTime != null">created_time,</if>
            <if test="modifyAccount != null">modify_account,</if>
            <if test="modifyTime != null">modify_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orderId != null and orderId != ''">#{orderId},</if>
            <if test="supplierId != null">#{supplierId},</if>
            <if test="supplierTeam != null">#{supplierTeam},</if>
            <if test="wallboxItemId != null and wallboxItemId != ''">#{wallboxItemId},</if>
            <if test="wallboxModel != null">#{wallboxModel},</if>
            <if test="materialType != null">#{materialType},</if>
            <if test="trackingNumber != null">#{trackingNumber},</if>
            <if test="trackingStatus != null">#{trackingStatus},</if>
            <if test="installStatus != null">#{installStatus},</if>
            <if test="regionId != null">#{regionId},</if>
            <if test="address != null">#{address},</if>
            <if test="outOrderId != null">#{outOrderId},</if>
            <if test="ifEmergency != null">#{ifEmergency},</if>
            <if test="ifTimeout != null">#{ifTimeout},</if>
            <if test="checkAccount != null">#{checkAccount},</if>
            <if test="checkStatus != null">#{checkStatus},</if>
            <if test="checkRemarks != null">#{checkRemarks},</if>
            <if test="checkTime != null">#{checkTime},</if>
            <if test="installReserveTime != null">#{installReserveTime},</if>
            <if test="installProcess != null">#{installProcess},</if>
            <if test="createAccount != null">#{createAccount},</if>
            <if test="createdTime != null">#{createdTime},</if>
            <if test="modifyAccount != null">#{modifyAccount},</if>
            <if test="modifyTime != null">#{modifyTime},</if>
        </trim>
    </insert>

    <update id="updateWallboxApply" parameterType="com.boco.nbd.wios.manage.entity.bo.WallboxApply">
        update t_wallbox_apply
        <trim prefix="SET" suffixOverrides=",">
            <if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
            <if test="supplierId != null">supplier_id = #{supplierId},</if>
            <if test="supplierTeam != null">supplier_team = #{supplierTeam},</if>
            <if test="wallboxItemId != null and wallboxItemId != ''">wallbox_item_id = #{wallboxItemId},</if>
            <if test="wallboxModel != null">wallbox_model = #{wallboxModel},</if>
            <if test="materialType != null">material_type = #{materialType},</if>
            <if test="trackingNumber != null">tracking_number = #{trackingNumber},</if>
            <if test="trackingStatus != null">tracking_status = #{trackingStatus},</if>
            <if test="installStatus != null">install_status = #{installStatus},</if>
            <if test="regionId != null">region_id = #{regionId},</if>
            <if test="address != null">address = #{address},</if>
            <if test="outOrderId != null">out_order_id = #{outOrderId},</if>
            <if test="ifEmergency != null">if_emergency = #{ifEmergency},</if>
            <if test="ifTimeout != null">if_timeout = #{ifTimeout},</if>
            <if test="checkAccount != null">check_account = #{checkAccount},</if>
            <if test="checkStatus != null">check_status = #{checkStatus},</if>
            <if test="checkRemarks != null">check_remarks = #{checkRemarks},</if>
            <if test="checkTime != null">check_time = #{checkTime},</if>
            <if test="installReserveTime != null">install_reserve_time = #{installReserveTime},</if>
            <if test="installProcess != null">install_process = #{installProcess},</if>
            <if test="createAccount != null">create_account = #{createAccount},</if>
            <if test="createdTime != null">created_time = #{createdTime},</if>
            <if test="modifyAccount != null">modify_account = #{modifyAccount},</if>
            <if test="modifyTime != null">modify_time = #{modifyTime},</if>
        </trim>
        where id = #{id}
    </update>

    <!-- 批量更新 WallboxApply -->
    <update id="batchUpdateWallboxApply" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            UPDATE t_wallbox_apply
            SET check_status = #{item.checkStatus},
            check_remarks = #{item.checkRemarks},
            modify_account = #{item.modifyAccount},
            modify_time = CURRENT_TIMESTAMP
            WHERE id = #{item.id}
        </foreach>
    </update>


    <delete id="deleteWallboxApplyById" parameterType="Long">
        delete
        from t_wallbox_apply
        where id = #{id}
    </delete>

    <delete id="deleteWallboxApplyByIds" parameterType="String">
        delete from t_wallbox_apply where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>