gdg
2021-02-02 aab1d1e20e7b4b72a9bd98c5d26fdfb087b4c57b
src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml
@@ -60,8 +60,14 @@
    <result property="applyCode" column="apply_code"></result>
    <result property="num" column="num"></result>
    <result property="used" column="used"></result>
       <result property="status" column="status" typeHandler="com.nanometer.smartlab.entity.handler.ApplyStatusHandler"></result>
    <result property="arrivalNum" column="arrival_num"></result>
    <result property="status" column="status" typeHandler="com.nanometer.smartlab.entity.handler.ApplyStatusHandler"></result>
    <result property="applyUserId" column="apply_user_id"></result>
    <result property="applyUser" column="apply_user"></result>
    <result property="arrivalTime" column="arrival_time"></result>
    <result property="articleNumber" column="articleNumber"></result>
    <result property="projectManage" column="projectManage"/>
    <result property="project" column="project"/>
    <association property="reagent" javaType="com.nanometer.smartlab.entity.SysReagent">
      <id property="id" column="reagent_id"></id>
      <result property="name" column="reagentName"></result>
@@ -153,7 +159,7 @@
  <select id="getOpeApplyList" parameterType="java.util.Map" resultMap="OpeApply">
    select oa.*,sys.name as secondUserName,
    sr.name as reagentName, sr.cas as reagentCas, sr.reagent_type as reagentType, sr.reagent_character as reagentCharacter, sr.supplier_id as reagentSupplierId,
    sr.name as reagentName,sr.price as reagentPrice ,sr.cas as reagentCas, sr.reagent_type as reagentType, sr.reagent_character as reagentCharacter, sr.supplier_id as reagentSupplierId,
    sr.reagent_format as reagentFormat, sr.main_metering as reagentMainMetering, sr.reagent_unit as reagentUnit, sr.per_box as reagentPerBox,
    sr.memo as reagentMemo, sr.valid_flag as reagentValidFlag, sr.create_time as reagentCreateTime, sr.update_time as reagentUpdateTime, sr.product_sn as reagentProductSn,
    sr.dangerous_flag as reagentDangerousFlag,sr.control_products as controlProducts,sr.product_home as productHome,
@@ -322,6 +328,12 @@
        <if test="status != null and status != ''">
            and oa.status =#{status}
        </if>
        <if test="productSn != null and productSn != ''">
            and sr.product_sn like concat('%',#{productSn},'%')
        </if>
        <if test="applyCode != null and applyCode != ''">
            and oa.apply_code = #{applyCode}
        </if>
   </sql>
   <select id="getOpeApplyReserveTotalCount" parameterType="java.util.Map"
@@ -336,10 +348,31 @@
    <select id="getOpeApplyReserveTotalCountFor" parameterType="java.util.Map"
            resultType="int">
        select count(1)
        from
        (select count(1)
        from ope_apply as oa
        <include refid="getOpeApplyReserveList_queryJoins1" />
        LEFT JOIN sys_reagent sr ON sr.id = oa.reagent_id
        LEFT JOIN sys_user su ON su.id = oa.apply_user_id
        LEFT JOIN base_meta AS bm2 ON sr.control_products = bm2.id
        LEFT JOIN base_meta AS bm3 ON sr.reagent_format = bm3.id
        LEFT JOIN base_meta AS bm4 ON sr.reagent_character = bm4.id
        LEFT JOIN base_meta AS bm1 ON sr.product_home = bm1.id
        LEFT JOIN sys_project as project on project.project = su.project
        LEFT JOIN sys_user as su1 on su1.id = project.sys_user_id
        where oa.valid_flag = 1 and (oa.status=4 or oa.status=6)
        <include refid="getOpeApplyReserveList_queryWhereSql" />
        <if test="isAllApply != null">
            <choose>
                <when test="isAllApply == 1">
                    and oa.used = oa.num
                </when>
                <otherwise>
                    and oa.used != oa.num
                </otherwise>
            </choose>
        </if>
        GROUP BY oa.id
        )as oaa
    </select>
   <select id="getOpeApplyReserveList" parameterType="java.util.Map"
@@ -350,7 +383,7 @@
      <include refid="getOpeApplyReserveList_queryJoins2" />
      where oa.valid_flag = 1
      <include refid="getOpeApplyReserveList_queryWhereSql" />
        GROUP BY oa.id
      order by oa.update_time desc
      <if test="first != null and pageSize != null">
         limit #{first}, #{pageSize}
@@ -359,13 +392,52 @@
    <select id="getOpeApplyReserveListFor" parameterType="java.util.Map"
            resultMap="OpeApplyReserve">
        <include refid="getOpeApplyReserveList_queryColumns" />
        from ope_apply as oa
        <include refid="getOpeApplyReserveList_queryJoins1" />
        <include refid="getOpeApplyReserveList_queryJoins2" />
        SELECT
        oa.id,
        oa.apply_code,
        sr.id reagent_id,
        oa. STATUS,
        sr.product_sn reagentProductSn,
        sr.`name` reagentName,
        bm2.meta_value controlProducts,
        bm3.meta_value reagentFormat,
        sr.main_metering reagentMainMetering,
        sr.price reagentPrice,
        sr.cas reagentCas,
        oa.article_number articleNumber,
        bm4.meta_value reagentCharacter,
        bm1.meta_value productHome,
        sr.dangerous_flag,
        oa.num,
        oa.apply_user_id apply_user,
        oa.used,
        su.`name` apply_user_id,
        su.project,
        su1.`name` as projectManage,
        oa.arrival_time
        FROM
        ope_apply AS oa
        LEFT JOIN sys_reagent sr ON sr.id = oa.reagent_id
        LEFT JOIN sys_user su ON su.id = oa.apply_user_id
        LEFT JOIN base_meta AS bm2 ON sr.control_products = bm2.id
        LEFT JOIN base_meta AS bm3 ON sr.reagent_format = bm3.id
        LEFT JOIN base_meta AS bm4 ON sr.reagent_character = bm4.id
        LEFT JOIN base_meta AS bm1 ON sr.product_home = bm1.id
        LEFT JOIN sys_project as project on project.project = su.project
        LEFT JOIN sys_user as su1 on su1.id = project.sys_user_id
        where oa.valid_flag = 1 and (oa.status=4 or oa.status=6)
        <include refid="getOpeApplyReserveList_queryWhereSql" />
        <if test="isAllApply != null">
            <choose>
                <when test="isAllApply == 1">
                    and oa.used = oa.num
                </when>
                <otherwise>
                    and oa.used != oa.num
                </otherwise>
            </choose>
        </if>
        GROUP BY oa.id
        order by oa.update_time desc
        <if test="first != null and pageSize != null">
            limit #{first}, #{pageSize}
@@ -383,8 +455,52 @@
    <select id="selectByReId" resultMap="OpeApply">
        select * from ope_apply where reagent_id=#{id}
    </select>
    <select id="getOpeApplyDetail" resultMap="OpeApplyReserve">
        select oa.id, oa.apply_code,
      sr.id reagent_id,
      oa.status,
      sr.product_sn reagentProductSn,
      sr.`name` reagentName,
      bm2.meta_value controlProducts,
      bm3.meta_value reagentFormat,
      sr.main_metering reagentMainMetering,
      sr.price reagentPrice,
      sr.cas reagentCas,
      oa.article_number articleNumber,
      bm4.meta_value reagentCharacter,
      bm1.meta_value productHome,
      sr.dangerous_flag,
      oa.num,
      oa.used,
      oa.arrival_num,
      su.id apply_user_id
        from ope_apply as oa
        left JOIN sys_reagent sr on sr.id = oa.reagent_id
        left JOIN sys_user su on su.id = oa.apply_user_id
        left join base_meta as bm2 on sr.control_products = bm2.id
        left join base_meta as bm3 on sr.reagent_format = bm3.id
        left join base_meta as bm4 on sr.reagent_character = bm4.id
        left join base_meta as bm1 on sr.product_home = bm1.id
        where oa.valid_flag = 1
        and oa.id = #{0}
    </select>
    <update id="updateByReId" parameterType="java.util.Map">
        update ope_apply set reagent_id=#{newReId} where reagent_id=#{oldReId}
    </update>
    <update id="updateOpeApplyInfo" parameterType="java.util.Map">
        update
        ope_apply
        set status = #{status}
        <if test="arrivalTime!=null" >
            ,arrival_time = #{arrivalTime}
        </if>
        <if test="consigneeId!=null" >
            ,consignee_id = #{consigneeId}
        </if>
        where valid_flag = 1
        and id = #{applyId}
    </update>
</mapper>