<?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.nanometer.smartlab.dao.SupplierOpeOrderDao">
|
<resultMap id="SupplierOrder" type="com.nanometer.smartlab.entity.SupplierOrder">
|
<id property="id" column="id"/>
|
<result property="orderCode" column="order_code"></result>
|
<result property="createTime" column="create_time"></result>
|
<result property="orderUserName" column="orderUserName"></result>
|
<result property="approveUserName" column="approveUserName"></result>
|
<result property="totalPrice" column="totlePrice"></result>
|
<result property="ids" column="ids"></result>
|
<result property="secondUserName" column="secondUserName"></result>
|
<result property="destoryFlag" column="destory_flag"></result>
|
<result property="firstUser" column="first_user"></result>
|
<result property="firName" column="firName"></result>
|
<result property="beforeApproveUserId" column="before_approve_user_id"></result>
|
</resultMap>
|
<sql id="queryWhereSql">
|
<if test="code != null and code != ''">
|
and oo.order_code like concat('%',#{code},'%')
|
</if>
|
<if test="status != null">
|
and oo.status = #{status}
|
</if>
|
<if test="orderTime != null">
|
and oo.create_time >= #{orderTime}
|
</if>
|
<if test="orderEndTime != null">
|
and #{orderEndTime} >= oo.create_time
|
</if>
|
<if test="applyCode != null">
|
and oa.apply_code like concat('%',#{applyCode},'%')
|
</if>
|
</sql>
|
|
<select id="getSupplierList" parameterType="java.util.Map" resultMap="SupplierOrder">
|
select oo.*,
|
sr.name as reagentName, 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, oa.apply_price as reagentPrice, 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,
|
ss.name as reagentSupplierName,
|
(SELECT sum(c.num*c.apply_price) from ope_order a LEFT JOIN ope_apply_order b on a.id = b.ope_order_id
|
LEFT JOIN ope_apply c on c.id = b.ope_apply_id
|
LEFT JOIN sys_reagent d on c.reagent_id = d.id where a.id = oo.id) as totlePrice,
|
suApprove.`name` as approveUserName,
|
sys.name as secondUserName,
|
su.`name` as orderUserName,
|
GROUP_CONCAT(oa.id) as Ids,
|
GROUP_CONCAT(suApprove.`name`)as approveUserName,
|
oa.first_user,fir.`name` firName,oa.before_approve_user_id
|
from ope_order oo
|
LEFT JOIN ope_apply_order oao on oo.id = oao.ope_order_id
|
left join ope_apply as oa on oao.ope_apply_id = oa.id
|
left join sys_reagent sr on oa.reagent_id = sr.id
|
left join sys_supplier as ss on sr.supplier_id = ss.id
|
left join sys_user as su on oa.apply_user_id = su.id
|
left join sys_user as suApprove on oa.approve_user_id = suApprove.id
|
left join sys_user as sys on sys.id=oa.before_approve_user_id
|
left join sys_user fir on fir.id=oa.first_user
|
where 1 = 1
|
<include refid="queryWhereSql"/>
|
GROUP BY id
|
order by oo.create_time desc
|
<if test="first != null and pageSize != null">
|
limit #{first}, #{pageSize}
|
</if>
|
</select>
|
<select id="selectById" resultType="com.nanometer.smartlab.entity.SupplierOrder">
|
select oo.*,
|
sr.name as reagentName, 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, oa.apply_price as reagentPrice, 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,
|
ss.name as reagentSupplierName,
|
(SELECT sum(c.num*c.apply_price) from ope_order a LEFT JOIN ope_apply_order b on a.id = b.ope_order_id
|
LEFT JOIN ope_apply c on c.id = b.ope_apply_id
|
LEFT JOIN sys_reagent d on c.reagent_id = d.id where a.id = oo.id) as totlePrice,
|
suApprove.`name` as approveUserName,
|
sys.name as secondUserName,
|
su.`name` as orderUserName,
|
GROUP_CONCAT(oa.id) as Ids,
|
GROUP_CONCAT(suApprove.`name`)as approveUserName,
|
oa.first_user,fir.`name` firName,oa.before_approve_user_id
|
from ope_order oo
|
LEFT JOIN ope_apply_order oao on oo.id = oao.ope_order_id
|
left join ope_apply as oa on oao.ope_apply_id = oa.id
|
left join sys_reagent sr on oa.reagent_id = sr.id
|
left join sys_supplier as ss on sr.supplier_id = ss.id
|
left join sys_user as su on oa.apply_user_id = su.id
|
left join sys_user as suApprove on oa.approve_user_id = suApprove.id
|
left join sys_user as sys on sys.id=oa.before_approve_user_id
|
left join sys_user fir on fir.id=oa.first_user
|
where 1 = 1
|
and oo.id = #{id}
|
</select>
|
<select id="getSupplierListTotal" resultType="java.lang.Integer">
|
select (count(0))
|
from (
|
select count(0)
|
from ope_order oo
|
LEFT JOIN ope_apply_order oao on oo.id = oao.ope_order_id
|
left join ope_apply as oa on oao.ope_apply_id = oa.id
|
where 1 = 1
|
<if test="code != null and code != ''">
|
and oo.order_code like concat('%',#{code},'%')
|
</if>
|
<if test="status != null">
|
and oo.status = #{status}
|
</if>
|
<if test="orderTime != null">
|
and oo.create_time >= #{orderTime}
|
</if>
|
<if test="orderEndTime != null">
|
and #{orderEndTime} >= oo.create_time
|
</if>
|
<if test="applyCode != null and applyCode != ''">
|
and oa.apply_code like concat('%',#{applyCode},'%')
|
</if>
|
GROUP BY oo.id
|
) as a
|
|
</select>
|
|
<update id="updateDestoryFlagById" parameterType="com.nanometer.smartlab.entity.SupplierOrder">
|
update ope_order set destory_flag=1 where id=#{id}
|
</update>
|
</mapper>
|