<?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.yuanchu.limslaboratory.mapper.QualificationRateStatisticsMapper">
|
<select id="selectSupplierByCondition" resultType="java.util.Map">
|
SELECT i.id,
|
i.type,
|
im.`name`,
|
im.supplier,
|
i.inspection_status inspectionStatus,
|
i.start_time startTime,
|
i.end_time endTime
|
FROM inspection i
|
INNER JOIN inspection_material im ON i.id = im.inspection_id
|
where (i.state = 1 and im.state=1)
|
<if test="dto.beginDate!=null and dto.endDate!=null">
|
and DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate}
|
AND #{dto.endDate}
|
AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate}
|
</if>
|
<if test="dto.type!=null">
|
and i.type=#{dto.type}
|
</if>
|
<if test="dto.supplier!=null and dto.supplier!=''">
|
and im.supplier=#{dto.supplier}
|
</if>
|
<if test="dto.sample!=null and dto.sample!=''">
|
and im.name=#{dto.sample}
|
</if>
|
<if test="dto.code!=null and dto.code!=''">
|
and im.code=#{dto.code}
|
</if>
|
</select>
|
<select id="selectProjectionsByCondition" resultMap="ImInfoMap">
|
SELECT
|
im.id imId,
|
im.`name` imName,
|
i.inspection_status inspectionStatus,
|
i.start_time startTime,
|
i.end_time endTime,
|
ipr.id iprId,
|
ipr.`name` iprName,
|
ipr.test_state testState,
|
im.code imCode,
|
i.type type
|
FROM
|
inspection i,
|
inspection_material im,
|
inspection_product ipr
|
WHERE
|
i.id = im.inspection_id
|
AND im.id = ipr.inspection_material_id
|
AND i.state = 1
|
AND im.state = 1
|
AND ipr.state = 1
|
AND i.inspection_status is NOT NULL
|
AND ipr.test_state is not null
|
AND ipr.test_state = 0
|
<if test="dto.beginDate!=null and dto.endDate!=null">
|
and DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate}
|
AND #{dto.endDate}
|
AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate}
|
</if>
|
<if test="dto.type!=null">
|
and i.type=#{dto.type}
|
</if>
|
<if test="dto.supplier!=null and dto.supplier!=''">
|
and im.supplier=#{dto.supplier}
|
</if>
|
<if test="dto.sample!=null and dto.sample!=''">
|
and im.name=#{dto.sample}
|
</if>
|
<if test="dto.code!=null and dto.code!=''">
|
and im.code=#{dto.code}
|
</if>
|
</select>
|
<select id="selectProjection" resultMap="ImInfoMap">
|
SELECT
|
im.id imId
|
FROM
|
inspection i,
|
inspection_material im,
|
inspection_product ipr
|
WHERE
|
i.id = im.inspection_id
|
AND im.id = ipr.inspection_material_id
|
AND i.state = 1
|
AND im.state = 1
|
AND ipr.state = 1
|
<if test="dto.beginDate!=null and dto.endDate!=null">
|
and DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate}
|
AND #{dto.endDate}
|
AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate}
|
</if>
|
<if test="dto.type!=null">
|
and i.type=#{dto.type}
|
</if>
|
<if test="dto.supplier!=null and dto.supplier!=''">
|
and im.supplier=#{dto.supplier}
|
</if>
|
<if test="dto.sample!=null and dto.sample!=''">
|
and im.name=#{dto.sample}
|
</if>
|
<if test="dto.code!=null and dto.code!=''">
|
and im.code=#{dto.code}
|
</if>
|
and im.code in
|
<foreach collection="list" item="l" open="(" close=")" separator="," >
|
#{l.code}
|
</foreach>
|
and im.name in
|
<foreach collection="list" item="l" open="(" close=")" separator=",">
|
#{l.name}
|
</foreach>
|
</select>
|
<select id="selectTestSamp" resultType="java.util.Map">
|
SELECT i.id,
|
i.type,
|
im.`name`,
|
im.supplier,
|
i.inspection_status inspectionStatus,
|
i.start_time startTime,
|
i.end_time endTime
|
FROM inspection i
|
INNER JOIN inspection_material im ON i.id = im.inspection_id
|
where (i.state = 1 and im.state=1)
|
<if test="dto.beginDate!=null and dto.endDate!=null">
|
and DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate}
|
AND #{dto.endDate}
|
AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate}
|
</if>
|
<if test="dto.type!=null">
|
and i.type=#{dto.type}
|
</if>
|
<if test="dto.supplier!=null and dto.supplier!=''">
|
and im.supplier=#{dto.supplier}
|
</if>
|
<if test="dto.sample!=null and dto.sample!=''">
|
and im.name=#{dto.sample}
|
</if>
|
<if test="dto.code!=null and dto.code!=''">
|
and im.code=#{dto.code}
|
</if>
|
</select>
|
<select id="getSampleOptions" resultType="java.util.Map">
|
SELECT
|
i.id,
|
i.type,
|
im.`name` name,
|
im.supplier,
|
i.inspection_status inspectionStatus,
|
i.start_time startTime,
|
i.end_time endTime,
|
im.`code` code
|
FROM
|
inspection i
|
INNER JOIN inspection_material im ON i.id = im.inspection_id
|
WHERE
|
( i.state = 1 AND im.state = 1 )
|
</select>
|
|
<resultMap id="ImInfoMap" type="com.yuanchu.limslaboratory.pojo.ImInfo">
|
<result property="imId" column="imId"/>
|
<result property="imCode" column="imCode"/>
|
<result property="imName" column="imName"/>
|
<result property="startTime" column="startTime"/>
|
<result property="endTime" column="endTime"/>
|
<result property="inspectionStatus" column="inspectionStatus"/>
|
<collection property="iprInfos" ofType="iprInfo">
|
<result property="iprId" column="iprId"/>
|
<result property="iprName" column="iprName"/>
|
<result property="testState" column="testState"/>
|
</collection>
|
</resultMap>
|
</mapper>
|