| | |
| | | <?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.ProcessRouteMapper"> |
| | | |
| | | <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProcessRoute"> |
| | | <id property="id" column="id"/> |
| | | <result property="productModelId" column="product_model_id"/> |
| | | <result property="productModelIds" column="product_model_ids"/> |
| | | <result property="description" column="description"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="processRouteCode" column="process_route_code"/> |
| | | <result property="bomId" column="bom_id"/> |
| | | </resultMap> |
| | | |
| | | <select id="pageProcessRouteDto" resultType="com.ruoyi.production.dto.ProcessRouteDto"> |
| | | select ps.*, pm.speculative_trading_name |
| | | select ps.*, |
| | | t.product_name, |
| | | t.product_id, |
| | | t.model, |
| | | pb.bom_no |
| | | from process_route ps |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product_bom pb on ps.bom_id = pb.id |
| | | left join ( |
| | | select pr.id as route_id, |
| | | group_concat( |
| | | distinct p.product_name |
| | | order by |
| | | case |
| | | when pr.product_model_ids is null or pr.product_model_ids = '' then pm.id |
| | | else find_in_set(pm.id, pr.product_model_ids) |
| | | end |
| | | separator ',' |
| | | ) as product_name, |
| | | max(pm.product_id) as product_id, |
| | | group_concat( |
| | | distinct pm.model |
| | | order by |
| | | case |
| | | when pr.product_model_ids is null or pr.product_model_ids = '' then pm.id |
| | | else find_in_set(pm.id, pr.product_model_ids) |
| | | end |
| | | separator ',' |
| | | ) as model |
| | | from process_route pr |
| | | left join product_model pm |
| | | on (find_in_set(pm.id, pr.product_model_ids) > 0 |
| | | or ((pr.product_model_ids is null or pr.product_model_ids = '') and pm.id = pr.product_model_id)) |
| | | left join product p on pm.product_id = p.id |
| | | group by pr.id |
| | | ) t on t.route_id = ps.id |
| | | <where> |
| | | <if test="c.speculativeTradingName != null || c.speculativeTradingName != ''"> |
| | | and pm.speculative_trading_name like concat('%',#{c.speculativeTradingName},'%') |
| | | <if test="c.model != null and c.model != ''"> |
| | | and t.model like concat('%',#{c.model},'%') |
| | | </if> |
| | | </where> |
| | | order by ps.id asc |
| | | </select> |
| | | </mapper> |