| | |
| | | <?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"> |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.ld.igds.check.mapper.CheckStandardMapper"> |
| | | |
| | | <!--新增化验数据 --> |
| | | <insert id="insertCheckItem" parameterType="com.ld.igds.check.dto.CheckItemData"> |
| | | insert into |
| | | D_CHECK_ITEM( |
| | | COMPANY_ID_, |
| | | CHECK_ID_, |
| | | STANDARD_ID_, |
| | | STANDARD_NAME_, |
| | | UNIT_, |
| | | UPPER_LIMIT_, |
| | | OPERA_SYMBOL_, |
| | | RULE_NUM_, |
| | | RULE_ADD_, |
| | | RULE_ADD_END_, |
| | | RULE_REDUCE_, |
| | | VALUE_, |
| | | RULE_PRICE_, |
| | | RULE_REDUCE_PRICE_, |
| | | ADD_NUM_, |
| | | DE_NUM_, |
| | | ADD_PRICE_, |
| | | DE_PRICE_, |
| | | RESULT_, |
| | | REMARKS_ |
| | | )values ( |
| | | #{data.companyId}, |
| | | #{data.checkId}, |
| | | #{data.standardId}, |
| | | #{data.standardName}, |
| | | #{data.unit}, |
| | | #{data.upperLimit}, |
| | | #{data.operaSymbol}, |
| | | #{data.ruleNum}, |
| | | #{data.ruleAdd}, |
| | | #{data.ruleAddEnd}, |
| | | #{data.ruleReduce}, |
| | | #{data.value}, |
| | | #{data.rulePrice}, |
| | | #{data.ruleReducePrice}, |
| | | #{data.addNum}, |
| | | #{data.deNum}, |
| | | #{data.addPrice}, |
| | | #{data.dePrice}, |
| | | #{data.result}, |
| | | #{data.remarks} |
| | | ) |
| | | </insert> |
| | | <!--新增化验数据 --> |
| | | <insert id="insertCheckItem" parameterType="com.ld.igds.check.dto.CheckItemData"> |
| | | insert into D_CHECK_ITEM(COMPANY_ID_, |
| | | CHECK_ID_, |
| | | STANDARD_ID_, |
| | | STANDARD_NAME_, |
| | | UNIT_, |
| | | UPPER_LIMIT_, |
| | | OPERA_SYMBOL_, |
| | | RULE_NUM_, |
| | | RULE_ADD_, |
| | | RULE_ADD_END_, |
| | | RULE_REDUCE_, |
| | | VALUE_, |
| | | RULE_PRICE_, |
| | | RULE_REDUCE_PRICE_, |
| | | ADD_NUM_, |
| | | DE_NUM_, |
| | | ADD_PRICE_, |
| | | DE_PRICE_, |
| | | RESULT_, |
| | | REMARKS_) |
| | | values (#{data.companyId}, |
| | | #{data.checkId}, |
| | | #{data.standardId}, |
| | | #{data.standardName}, |
| | | #{data.unit}, |
| | | #{data.upperLimit}, |
| | | #{data.operaSymbol}, |
| | | #{data.ruleNum}, |
| | | #{data.ruleAdd}, |
| | | #{data.ruleAddEnd}, |
| | | #{data.ruleReduce}, |
| | | #{data.value}, |
| | | #{data.rulePrice}, |
| | | #{data.ruleReducePrice}, |
| | | #{data.addNum}, |
| | | #{data.deNum}, |
| | | #{data.addPrice}, |
| | | #{data.dePrice}, |
| | | #{data.result}, |
| | | #{data.remarks}) |
| | | </insert> |
| | | |
| | | <!--更新化验项数据 --> |
| | | <update id="updateCheckItem" parameterType="com.ld.igds.check.dto.CheckItemData"> |
| | | update D_CHECK_ITEM |
| | | <set> |
| | | <if test="data.standardName != null and data.standardName != '' ">STANDARD_NAME_ = #{data.standardName},</if> |
| | | <if test="data.upperLimit != null and data.upperLimit != '' ">UPPER_LIMIT_ = #{data.upperLimit},</if> |
| | | <if test="data.unit != null and data.unit != '' ">UNIT_ = #{data.unit},</if> |
| | | <if test="data.value != null and data.value != '' ">VALUE_ = #{data.value},</if> |
| | | <if test="data.addNum != null">ADD_NUM_ = #{data.addNum},</if> |
| | | <if test="data.deNum != null">DE_NUM_ = #{data.deNum},</if> |
| | | <if test="data.addPrice != null">ADD_PRICE_ = #{data.addPrice},</if> |
| | | <if test="data.dePrice != null">DE_PRICE_ = #{data.dePrice},</if> |
| | | <if test="data.result != null and data.result != '' ">RESULT_ = #{data.result},</if> |
| | | <if test="data.remarks != null and data.remarks != '' ">REMARKS_ = #{data.remarks},</if> |
| | | <if test="data.operaSymbol != null and data.operaSymbol != '' ">OPERA_SYMBOL_ = #{data.operaSymbol}</if> |
| | | </set> |
| | | <where> |
| | | <if test="data.companyId != null and data.companyId != '' "> COMPANY_ID_= #{data.companyId}</if> |
| | | <if test="data.checkId != null">AND CHECK_ID_ = #{data.checkId}</if> |
| | | <if test="data.standardId != null and data.standardId != '' ">AND STANDARD_ID_ = #{data.standardId}</if> |
| | | </where> |
| | | </update> |
| | | <!--更新化验项数据 --> |
| | | <update id="updateCheckItem" parameterType="com.ld.igds.check.dto.CheckItemData"> |
| | | update D_CHECK_ITEM |
| | | <set> |
| | | <if test="data.standardName != null and data.standardName != '' ">STANDARD_NAME_ = #{data.standardName}, |
| | | </if> |
| | | <if test="data.upperLimit != null and data.upperLimit != '' ">UPPER_LIMIT_ = #{data.upperLimit},</if> |
| | | <if test="data.unit != null and data.unit != '' ">UNIT_ = #{data.unit},</if> |
| | | <if test="data.value != null and data.value != '' ">VALUE_ = #{data.value},</if> |
| | | <if test="data.addNum != null">ADD_NUM_ = #{data.addNum},</if> |
| | | <if test="data.deNum != null">DE_NUM_ = #{data.deNum},</if> |
| | | <if test="data.addPrice != null">ADD_PRICE_ = #{data.addPrice},</if> |
| | | <if test="data.dePrice != null">DE_PRICE_ = #{data.dePrice},</if> |
| | | <if test="data.result != null and data.result != '' ">RESULT_ = #{data.result},</if> |
| | | <if test="data.remarks != null and data.remarks != '' ">REMARKS_ = #{data.remarks},</if> |
| | | <if test="data.operaSymbol != null and data.operaSymbol != '' ">OPERA_SYMBOL_ = #{data.operaSymbol}</if> |
| | | </set> |
| | | <where> |
| | | <if test="data.companyId != null and data.companyId != '' ">COMPANY_ID_= #{data.companyId}</if> |
| | | <if test="data.checkId != null">AND CHECK_ID_ = #{data.checkId}</if> |
| | | <if test="data.standardId != null and data.standardId != '' ">AND STANDARD_ID_ = #{data.standardId}</if> |
| | | </where> |
| | | </update> |
| | | |
| | | <!--更新数据 要求结果值必须为空,避免认为更新后被替换 --> |
| | | <update id="updateItemByResult" parameterType="com.ld.igds.check.dto.CheckItemData"> |
| | | update D_CHECK_ITEM |
| | | <set> |
| | | <if test="data.unit != null and data.unit != '' ">UNIT_ = #{data.unit},</if> |
| | | <if test="data.value != null and data.value != '' ">VALUE_ = #{data.value},</if> |
| | | <if test="data.remarks != null and data.remarks != '' ">REMARKS_ = #{data.remarks},</if> |
| | | <if test="data.operaSymbol != null and data.operaSymbol != '' ">OPERA_SYMBOL_ = #{data.operaSymbol}</if> |
| | | </set> |
| | | <where> |
| | | <if test="data.companyId != null and data.companyId != '' "> COMPANY_ID_= #{data.companyId}</if> |
| | | <if test="data.checkId != null and data.checkId != '' ">AND CHECK_ID_ = #{data.checkId}</if> |
| | | <if test="data.standardId != null and data.standardId != '' ">AND STANDARD_ID_ = #{data.standardId}</if> |
| | | </where> |
| | | AND VALUE_ IS NULL |
| | | </update> |
| | | <!--更新数据 要求结果值必须为空,避免认为更新后被替换 --> |
| | | <update id="updateItemByResult" parameterType="com.ld.igds.check.dto.CheckItemData"> |
| | | update D_CHECK_ITEM |
| | | <set> |
| | | <if test="data.unit != null and data.unit != '' ">UNIT_ = #{data.unit},</if> |
| | | <if test="data.value != null and data.value != '' ">VALUE_ = #{data.value},</if> |
| | | <if test="data.remarks != null and data.remarks != '' ">REMARKS_ = #{data.remarks},</if> |
| | | <if test="data.operaSymbol != null and data.operaSymbol != '' ">OPERA_SYMBOL_ = #{data.operaSymbol}</if> |
| | | </set> |
| | | <where> |
| | | <if test="data.companyId != null and data.companyId != '' ">COMPANY_ID_= #{data.companyId}</if> |
| | | <if test="data.checkId != null and data.checkId != '' ">AND CHECK_ID_ = #{data.checkId}</if> |
| | | <if test="data.standardId != null and data.standardId != '' ">AND STANDARD_ID_ = #{data.standardId}</if> |
| | | </where> |
| | | AND VALUE_ IS NULL |
| | | </update> |
| | | <!-- 根据条件删除化验项--> |
| | | <delete id="delCheckItemByParam" parameterType="com.ld.igds.check.dto.CheckItemData"> |
| | | DELETE |
| | | FROM D_CHECK_ITEM |
| | | <where> |
| | | <if test="data.companyId != null and data.companyId != '' ">COMPANY_ID_= #{data.companyId}</if> |
| | | <if test="data.checkId != null and data.checkId != '' ">AND CHECK_ID_ = #{data.checkId}</if> |
| | | </where> |
| | | </delete> |
| | | |
| | | <!-- 根据checkId获取检测结果 --> |
| | | <select id="getCheckItemById" parameterType="java.lang.String" |
| | | resultType="com.ld.igds.check.dto.CheckItemData"> |
| | | select |
| | | CHECK_ID_ as checkId, |
| | | COMPANY_ID_ as companyId, |
| | | STANDARD_ID_ as standardId, |
| | | STANDARD_NAME_ as standardName, |
| | | UNIT_ as unit, |
| | | UPPER_LIMIT_ as upperLimit, |
| | | OPERA_SYMBOL_ as operaSymbol, |
| | | RULE_NUM_ as ruleNum, |
| | | RULE_ADD_ as ruleAdd, |
| | | RULE_ADD_END_ as ruleAddEnd, |
| | | RULE_REDUCE_ as ruleReduce, |
| | | VALUE_ as value, |
| | | <!-- 根据checkId获取检测结果 --> |
| | | <select id="getCheckItemById" parameterType="java.lang.String" |
| | | resultType="com.ld.igds.check.dto.CheckItemData"> |
| | | select CHECK_ID_ as checkId, |
| | | COMPANY_ID_ as companyId, |
| | | STANDARD_ID_ as standardId, |
| | | STANDARD_NAME_ as standardName, |
| | | UNIT_ as unit, |
| | | UPPER_LIMIT_ as upperLimit, |
| | | OPERA_SYMBOL_ as operaSymbol, |
| | | RULE_NUM_ as ruleNum, |
| | | RULE_ADD_ as ruleAdd, |
| | | RULE_ADD_END_ as ruleAddEnd, |
| | | RULE_REDUCE_ as ruleReduce, |
| | | VALUE_ as value, |
| | | RULE_PRICE_ as rulePrice, |
| | | RULE_REDUCE_PRICE_ as ruleReducePrice, |
| | | ADD_NUM_ as addNum, |
| | |
| | | DE_PRICE_ as dePrice, |
| | | RESULT_ as result, |
| | | REMARKS_ as remarks |
| | | from |
| | | D_CHECK_ITEM |
| | | where COMPANY_ID_ = #{companyId} |
| | | and CHECK_ID_ = #{checkId} |
| | | ORDER by STANDARD_ID_ +0 |
| | | </select> |
| | | from |
| | | D_CHECK_ITEM |
| | | where COMPANY_ID_ = #{companyId} |
| | | and CHECK_ID_ = #{checkId} |
| | | ORDER by STANDARD_ID_ +0 |
| | | </select> |
| | | |
| | | <!-- 根据粮食品种获取配的化验信息 --> |
| | | <select id="getCheckStandard" parameterType="java.lang.String" |
| | | resultType="com.ld.igds.check.dto.CheckStandardData"> |
| | | select |
| | | ID_ as id, |
| | | COMPANY_ID_ as companyId, |
| | | FOOD_VARIETY_ as foodVariety, |
| | | STANDARD_ID_ as standardId, |
| | | STANDARD_NAME_ as standardName, |
| | | UNIT_ as unit, |
| | | OPERA_SYMBOL_ as operaSymbol, |
| | | UPPER_LIMIT_ as upperLimit, |
| | | RULE_NUM_ as ruleNum, |
| | | RULE_REDUCE_ as ruleReduce, |
| | | RULE_ADD_ as ruleAdd, |
| | | RULE_ADD_END_ as ruleAddEnd, |
| | | RULE_PRICE_ as rulePrice, |
| | | RULE_REDUCE_PRICE_ as ruleReducePrice, |
| | | UPDATE_TIME_ as updateTime, |
| | | REMARKS_ as remarks |
| | | FROM D_CHECK_STANDARD |
| | | WHERE |
| | | COMPANY_ID_ = #{companyId} |
| | | AND FOOD_VARIETY_ = #{foodVariety} |
| | | ORDER by STANDARD_ID_ + 0 |
| | | </select> |
| | | <!-- 根据粮食品种获取配的化验信息 --> |
| | | <select id="getCheckStandard" parameterType="java.lang.String" |
| | | resultType="com.ld.igds.check.dto.CheckStandardData"> |
| | | select ID_ as id, |
| | | COMPANY_ID_ as companyId, |
| | | FOOD_VARIETY_ as foodVariety, |
| | | STANDARD_ID_ as standardId, |
| | | STANDARD_NAME_ as standardName, |
| | | UNIT_ as unit, |
| | | OPERA_SYMBOL_ as operaSymbol, |
| | | UPPER_LIMIT_ as upperLimit, |
| | | RULE_NUM_ as ruleNum, |
| | | RULE_REDUCE_ as ruleReduce, |
| | | RULE_ADD_ as ruleAdd, |
| | | RULE_ADD_END_ as ruleAddEnd, |
| | | RULE_PRICE_ as rulePrice, |
| | | RULE_REDUCE_PRICE_ as ruleReducePrice, |
| | | UPDATE_TIME_ as updateTime, |
| | | REMARKS_ as remarks |
| | | FROM D_CHECK_STANDARD |
| | | WHERE COMPANY_ID_ = #{companyId} |
| | | AND FOOD_VARIETY_ = #{foodVariety} |
| | | ORDER by STANDARD_ID_ + 0 |
| | | </select> |
| | | |
| | | </mapper> |