| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.mom.mapper.FinishedInspectMapper"> |
| | | <select id="selectFinishedInspectPage" resultType="map"> |
| | | SELECT f.`id`, f.`order_number`, f.`customer_name`, f.`project_name`, f.`quality_traceability`, |
| | | f.`material_code`, f.`material`, f.`specifications_model`, f.`unit`, |
| | | f.`quantity`, u.`name`, DATE_FORMAT(f.`create_time`, '%Y-%m-%d') detectionPeriod, f.`result` |
| | | FROM finished_inspect f, `user` u |
| | | SELECT f.`id`, |
| | | f.`order_number`, |
| | | f.`customer_name`, |
| | | f.`project_name`, |
| | | f.`quality_traceability`, |
| | | f.`material_code`, |
| | | f.`material`, |
| | | f.`specifications_model`, |
| | | f.`unit`, |
| | | f.`quantity`, |
| | | u.`name`, |
| | | DATE_FORMAT(f.`create_time`, '%Y-%m-%d') detectionPeriod, |
| | | f.`result` |
| | | FROM mom_ocean.finished_inspect f, mom_ocean.`user` u |
| | | WHERE f.`user_id` = u.`id` |
| | | AND f.`state` = 1 |
| | | <if test="inspectResult != null and inspectResult != ''"> |
| | | AND f.result = #{inspectResult} |
| | | <if test="result != null "> |
| | | AND f.result = #{result} |
| | | </if> |
| | | <if test="inspectDate != null and inspectDate != ''"> |
| | | AND DATE_FORMAT(f.`create_time`, '%Y-%m-%d') = #{inspectDate} |
| | | </if> |
| | | <if test="inspectUsername != null and inspectUsername != ''"> |
| | | AND u.`name` LIKE CONCAT('%',#{inspectUsername},'%') |
| | | <if test="material != null and material != ''"> |
| | | AND f.`material` LIKE CONCAT('%',#{material},'%') |
| | | </if> |
| | | </select> |
| | | <select id="selCountFin" resultType="java.lang.Integer"> |
| | | select count(id) |
| | | from mom_ocean.finished_inspect |
| | | where state=1 |
| | | and result=#{result} |
| | | and type=#{type} |
| | | <if test="begin != null and begin!=''"> |
| | | and finished_inspect.create_time >= #{begin} |
| | | </if> |
| | | <if test="end != null and end!=''"> |
| | | and finished_inspect.create_time <= #{end} |
| | | </if> |
| | | </select> |
| | | <select id="seAllCount" resultType="java.lang.Long"> |
| | | select count(id) |
| | | from mom_ocean.finished_inspect |
| | | where state=1 |
| | | and type=#{type} |
| | | <if test="begin != null and begin!=''"> |
| | | and finished_inspect.create_time >= #{begin} |
| | | </if> |
| | | <if test="end != null and end!=''"> |
| | | and finished_inspect.create_time <= #{end} |
| | | </if> |
| | | </select> |
| | | <!--新增过程检验单-根据订单号选择产品信息--> |
| | | |
| | | <!--新增检验单-根据订单号选择产品信息--> |
| | | <resultMap id="oneMap" type="map"> |
| | | <id property="name" column="material"/> |
| | | <result property="code" column="code"/> |
| | | <result property="specifications" column="specifications"/> |
| | | <result property="unit" column="unit"/> |
| | | <id property="prname" column="prname"/> |
| | | <result property="sname" column="sname"/> |
| | | <collection property="children" resultMap="twoMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="twoMap" type="map"> |
| | | <result property="name" column="techfather"/> |
| | | <id property="id" column="moid"/> |
| | | <result property="name" column="material"/> |
| | | <result property="mcode" column="mcode"/> |
| | | <result property="qualityTraceability" column="quality_traceability"/> |
| | | <result property="specifications" column="specifications"/> |
| | | <result property="unit" column="unit"/> |
| | | <collection property="children" resultMap="threeMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="threeMap" type="map"> |
| | | <id property="id" column="technologyId"/> |
| | | <result property="name" column="techname"/> |
| | | </resultMap> |
| | | <select id="chooseMater" resultMap="oneMap"> |
| | | select mo.name material, |
| | | code, |
| | | select s.proname prname, |
| | | s.name sname, |
| | | quality_traceability, |
| | | m.code mcode, |
| | | mo.name material, |
| | | specifications, |
| | | unit, |
| | | technology_id technologyId, |
| | | techfather, |
| | | techname |
| | | from mom_ocean.manual_technology mt |
| | | left join mom_ocean.manufacture_order mo on mt.manufacture_order_id = mo.id |
| | | mo.id moid |
| | | from mom_ocean.manufacture_order mo |
| | | left join mom_ocean.material m on m.name = mo.name |
| | | left join mom_ocean.sale s on order_number = order_code |
| | | where mo.state = 1 |
| | | and type = 1 |
| | | and m.type = 1 |
| | | and order_code = #{orderNumber} |
| | | </select> |
| | | |
| | | <!--根据检验单id查询成品检验单详情--> |
| | | <resultMap id="seProInsListById" type="map"> |
| | | <id property="name" column="order_number"/> |
| | | <result property="customerName" column="customer_name"/> |
| | | <result property="projectName" column="project_name"/> |
| | | <result property="qualityTraceability" column="quality_traceability"/> |
| | | <result property="materialCode" column="material_code"/> |
| | | <result property="material" column="material"/> |
| | | <result property="specifications" column="specifications_model"/> |
| | | <result property="funit" column="funit"/> |
| | | <result property="quantity" column="quantity"/> |
| | | <result property="fresult" column="fresult"/> |
| | | <collection property="children" resultMap="seProInsListByIdmap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="seProInsListByIdmap" type="map"> |
| | | <result property="ifather" column="ifather"/> |
| | | <collection property="children" resultMap="seProInsListByIdmaps" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="seProInsListByIdmaps" type="map"> |
| | | <id property="iid" column="iid"/> |
| | | <result property="iname" column="iname"/> |
| | | <result property="iunit" column="iunit"/> |
| | | <result property="required" column="required"/> |
| | | <result property="internal" column="internal"/> |
| | | <result property="inspectionValue" column="inspection_value"/> |
| | | <result property="dname" column="dname"/> |
| | | <result property="iresult" column="iresult"/> |
| | | <result property="username" column="username"/> |
| | | </resultMap> |
| | | <select id="selectFinishInspectsListById" resultMap="seProInsListById"> |
| | | select order_number, |
| | | customer_name, |
| | | project_name, |
| | | quality_traceability, |
| | | material_code, |
| | | material, |
| | | specifications_model, |
| | | fi.unit funit, |
| | | quantity, |
| | | ii.id iid, |
| | | ii.father ifather, |
| | | ii.name iname, |
| | | ii.unit iunit, |
| | | required, |
| | | internal, |
| | | inspection_value, |
| | | device.name dname, |
| | | ii.result iresult, |
| | | username, |
| | | fi.result fresult |
| | | from mom_ocean.inspection_item ii |
| | | left join mom_ocean.finished_inspect fi on fi.id = inspect_id |
| | | left join mom_ocean.device |
| | | on ii.device_id = device.id |
| | | where ii.type = 2 |
| | | and ii.state = 1 |
| | | and fi.state = 1 |
| | | and fi.id = #{id} |
| | | </select> |
| | | </mapper> |