| | |
| | | <?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"> |
| | | <?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.ruoyi.production.mapper.ProcessRouteItemMapper"> |
| | | |
| | | <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProcessRouteItem"> |
| | |
| | | <result property="routeId" column="route_id"/> |
| | | <result property="processId" column="process_id"/> |
| | | <result property="productModelId" column="product_model_id"/> |
| | | <result property="productModelIds" column="product_model_ids"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="dragSort" column="drag_sort"/> |
| | | <result property="isQuality" column="is_quality"/> |
| | | </resultMap> |
| | | |
| | | <select id="listProcessRouteItemDto" resultType="com.ruoyi.production.dto.ProcessRouteItemDto"> |
| | | select pri.*, |
| | | pr.description , |
| | | pr.description as route_name, |
| | | pp.name as process_name, |
| | | pm.speculative_trading_name |
| | | from |
| | | process_route_item pri |
| | | left join product_model pm on pri.product_model_id = pm.id |
| | | left join product_process pp on pp.id = pri.process_id |
| | | left join process_route pr on pr.id = pri.route_id |
| | | where |
| | | pri.route_id = #{c.routeId} |
| | | |
| | | |
| | | t.speculative_trading_name, |
| | | t.product_id, |
| | | t.model, |
| | | t.product_name, |
| | | t.unit |
| | | from process_route_item pri |
| | | left join product_process pp on pp.id = pri.process_id |
| | | left join process_route pr on pr.id = pri.route_id |
| | | left join ( |
| | | select item.id as item_id, |
| | | group_concat( |
| | | distinct pm.speculative_trading_name |
| | | order by |
| | | case |
| | | when item.product_model_ids is null or item.product_model_ids = '' then pm.id |
| | | else find_in_set(pm.id, item.product_model_ids) |
| | | end |
| | | separator ',' |
| | | ) as speculative_trading_name, |
| | | max(pm.product_id) as product_id, |
| | | group_concat( |
| | | distinct pm.model |
| | | order by |
| | | case |
| | | when item.product_model_ids is null or item.product_model_ids = '' then pm.id |
| | | else find_in_set(pm.id, item.product_model_ids) |
| | | end |
| | | separator ',' |
| | | ) as model, |
| | | group_concat( |
| | | distinct p.product_name |
| | | order by |
| | | case |
| | | when item.product_model_ids is null or item.product_model_ids = '' then pm.id |
| | | else find_in_set(pm.id, item.product_model_ids) |
| | | end |
| | | separator ',' |
| | | ) as product_name, |
| | | group_concat( |
| | | distinct pm.unit |
| | | order by |
| | | case |
| | | when item.product_model_ids is null or item.product_model_ids = '' then pm.id |
| | | else find_in_set(pm.id, item.product_model_ids) |
| | | end |
| | | separator ',' |
| | | ) as unit |
| | | from process_route_item item |
| | | left join product_model pm |
| | | on (find_in_set(pm.id, item.product_model_ids) > 0 |
| | | or ((item.product_model_ids is null or item.product_model_ids = '') and pm.id = item.product_model_id)) |
| | | left join product p on p.id = pm.product_id |
| | | group by item.id |
| | | ) t on t.item_id = pri.id |
| | | where pri.route_id = #{c.routeId} |
| | | <if test="c.productModelId != null"> |
| | | and exists ( |
| | | select 1 |
| | | from product_model pm_filter |
| | | where ( |
| | | find_in_set(pm_filter.id, pri.product_model_ids) > 0 |
| | | or ((pri.product_model_ids is null or pri.product_model_ids = '') and pm_filter.id = pri.product_model_id) |
| | | ) |
| | | and pm_filter.id = #{c.productModelId} |
| | | ) |
| | | </if> |
| | | order by pri.drag_sort |
| | | </select> |
| | | </mapper> |