Blame view

WorkstationRequireMappingMapper.xml 3.24 KB
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
<?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.laowu.mapper.WorkstationRequireMappingMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.laowu.model.WorkstationRequireMappingDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="delete_date" property="deleteDate" />
        <result column="station_id" property="stationId" />
        <result column="require_id" property="requireId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, station_id, require_id
    </sql>

    <select id="requires" resultType="com.laowu.vo.station.RequiresVO">
        SELECT
        distinct t.id,
        t.company_id,
        t.item_status,
        t2.company_name,
        t.province,
        t.city,
        t.county,
        t.item_name,
33 34
        t.start_date,
        t.end_date,
35
        t.job_id,
36 37 38
        t4.station_id,
        t.address,
        t.amount
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
        FROM
        position_require_item t
        LEFT JOIN company_dict t2 ON t.company_id = t2.id
        LEFT JOIN position_item_info t3 ON t.id = t3.position_require_id
        left join workstation_require_mapping t4 on t.id = t4.require_id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        and t3.delete_date is null
        and t4.delete_date is null
        <if test="itemName != null and itemName != ''">
            and t.item_name like concat('%', #{itemName}, '%')
        </if>
        <if test="itemStatus != null and itemStatus != ''">
            and t.item_status = #{itemStatus}
        </if>
        <if test="province != null and province !=''">
            AND t.province = #{province}
        </if>
        <if test="city != null and city != ''">
            AND t.city = #{city}
        </if>
        <if test="county != null and county != ''">
            AND t.county = #{county}
        </if>
        <if test="positionId != null and positionId != ''">
            and t3.position_id = #{positionId}
        </if>
        <if test="stationId != null and stationId != ''">
            and t4.station_id = #{stationId}
        </if>
70 71 72
        <if test="stationId == null ">
            and t.origin_id is null
        </if>
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
    </select>

    <select id="requiresStations" parameterType="long" resultType="long">
        SELECT
            t.station_id
        FROM
            workstation_require_mapping t
        WHERE
            t.delete_date IS NULL
            AND t.require_id = #{requireId}
    </select>

    <select id="requireWorkstations" parameterType="long" resultType="com.laowu.vo.position.RequireWorkstationsVO">
        SELECT
            t2.id,
            t2.workstation_name,
            t.create_date
        FROM
            workstation_require_mapping t
            LEFT JOIN workstation_dict t2 ON t.station_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.require_id = #{requireId}
    </select>

</mapper>