<?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.mom.mapper.RawInspectMapper">
|
<!--清空原材料检验结论-->
|
<update id="updById">
|
update mom_ocean.raw_inspect
|
set ins_state=0,
|
ins_time=null,
|
judge_state=null
|
where id = #{rawInspectId}
|
</update>
|
<select id="selCountRaw" resultType="java.lang.Integer">
|
select count(id)
|
from mom_ocean.raw_inspect
|
where state=1
|
and ins_state=1
|
and judge_state=#{judgeState}
|
<if test="begin != null and begin!=''">
|
and raw_inspect.create_time >= #{begin}
|
</if>
|
<if test="end != null and end!=''">
|
and raw_inspect.create_time <= #{end}
|
</if>
|
</select>
|
<select id="seAllCount" resultType="java.lang.Long">
|
select count(id)
|
from mom_ocean.raw_inspect
|
where state=1
|
<if test="begin != null and begin!=''">
|
and raw_inspect.create_time >= #{begin}
|
</if>
|
<if test="end != null and end!=''">
|
and raw_inspect.create_time <= #{end}
|
</if>
|
</select>
|
|
<!--分页查询原材料检验单列表-->
|
<select id="selectRawInspectsList" resultType="java.util.Map">
|
select id,
|
DATE_FORMAT(form_time, '%Y-%m-%d') formTime,
|
code,
|
name,
|
specifications,
|
unit,
|
number,
|
DATE_FORMAT(create_time, '%Y-%m-%d') createTime,
|
user_name,
|
DATE_FORMAT(ins_time, '%Y-%m-%d') insTime,
|
ins_state,
|
judge_state
|
from mom_ocean.raw_inspect
|
where state=1
|
<if test="formTime!=null and formTime!=''">
|
and form_time=#{formTime}
|
</if>
|
<if test="code!=null and code!=''">
|
and code like concat('%',#{code},'%')
|
</if>
|
<if test="insState!=null">
|
and ins_state=#{insState}
|
</if>
|
<if test="name!=null and name!=''">
|
and name like concat('%',#{name},'%')
|
</if>
|
ORDER BY id DESC
|
</select>
|
|
<!--根据原材料检验单id查看详情-->
|
<resultMap id="oneMap" type="map">
|
<id property="code" column="rcode"/>
|
<result property="formTime" column="formTime"/>
|
<result property="creatTime" column="creatTime"/>
|
<result property="name" column="rname"/>
|
<result property="specifications" column="specifications"/>
|
<result property="runit" column="runit"/>
|
<result property="number" column="number"/>
|
<result property="supplier" column="supplier"/>
|
<result property="judgeState" column="judge_state"/>
|
<result property="userName" column="user_name"/>
|
<collection property="children" resultMap="twoMap" javaType="List"/>
|
</resultMap>
|
<resultMap id="twoMap" type="Map">
|
<id property="rpId" column="rpId"/>
|
<result property="rpName" column="rpName"/>
|
<result property="rpUnit" column="rpUnit"/>
|
<result property="required" column="required"/>
|
<result property="internal" column="internal"/>
|
<result property="testValue" column="test_value"/>
|
<result property="testState" column="test_state"/>
|
<result property="deviceName" column="devName"/>
|
<result property="deviceId" column="deviceId"/>
|
<result property="uName" column="uName"/>
|
</resultMap>
|
|
<select id="selectRawInspectsListById" resultMap="oneMap">
|
select DATE_FORMAT(form_time, '%Y-%m-%d') formTime,
|
r.code rcode,
|
r.name rname,
|
specifications,
|
r.unit runit,
|
number,
|
DATE_FORMAT(r.create_time, '%Y-%m-%d') creatTime,
|
supplier,
|
judge_state,
|
user_name,
|
rp.id rpId,
|
rp.name rpName,
|
rp.unit rpUnit,
|
required,
|
internal,
|
test_value,
|
test_state,
|
device.name devName,
|
device.`id` deviceId,
|
user.name uName
|
from mom_ocean.raw_ins_product rp
|
left join mom_ocean.raw_inspect r on rp.raw_inspect_id = r.id
|
left join mom_ocean.device
|
on rp.device_id = device.id
|
left join mom_ocean.user on rp.user_id = user.id
|
where r.state = 1
|
and rp.state = 1
|
and r.id = #{id}
|
</select>
|
|
<!--根据原材料编码查询最近一条数据-->
|
<select id="selOneByCode" resultType="com.yuanchu.mom.pojo.RawInspect">
|
select *
|
from mom_ocean.raw_inspect
|
where state = 1
|
and code = #{code}
|
order by id desc
|
limit 1
|
</select>
|
</mapper>
|