2024-11-12 10:51:15 +08:00
|
|
|
<?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.bonus.gzgqj.business.bases.mapper.PartInputMapper" >
|
2024-11-12 13:53:41 +08:00
|
|
|
<insert id="addInputData" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into t_part_input(
|
|
|
|
|
code,creator,create_time,is_flag,remark,updater,update_time,
|
|
|
|
|
all_price,input_day,input_num,input_user
|
|
|
|
|
)values (#{code},#{creator},now(),#{isFlag},#{remark},#{updater},now(),
|
|
|
|
|
#{allPrice},#{inputDay},#{inputNum},#{inputUser})
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addDetails">
|
2024-11-12 16:38:35 +08:00
|
|
|
insert into t_part_put_details(
|
2024-11-12 13:53:41 +08:00
|
|
|
put_id,part_id,part_type,part_name,part_model,part_unit,input_num,part_price,
|
2024-11-13 10:22:42 +08:00
|
|
|
total_price,vender_id,vender_name,remark) values
|
2024-11-12 13:53:41 +08:00
|
|
|
<foreach collection="list" item="item" separator=",">
|
|
|
|
|
(#{param.id},#{item.partId},#{item.partType},#{item.partName},
|
|
|
|
|
#{item.partModel},#{item.partUnit},#{item.inputNum},#{item.partPrice},
|
2024-11-13 10:22:42 +08:00
|
|
|
#{item.totalPrice},#{item.vendId},#{item.vendName},#{item.remark})
|
2024-11-12 13:53:41 +08:00
|
|
|
</foreach>
|
|
|
|
|
|
|
|
|
|
</insert>
|
2024-11-12 16:38:35 +08:00
|
|
|
|
|
|
|
|
<update id="updateTypeNum">
|
2024-11-13 16:26:51 +08:00
|
|
|
update pa_type set num=#{num},price=#{price},all_num=#{allNum}
|
|
|
|
|
where id=#{id}
|
2024-11-12 20:19:09 +08:00
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateTypeNum2">
|
|
|
|
|
update pa_type set price=#{price} where id=#{id}
|
2024-11-12 16:38:35 +08:00
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="uploadDetails">
|
2024-11-13 13:23:42 +08:00
|
|
|
update t_part_put_details set part_price=#{partPrice}, vender_id=#{vendId},
|
2024-11-16 17:15:45 +08:00
|
|
|
total_price=#{totalPrice},vender_name=#{vendName},remark=#{remark}
|
2024-11-13 13:23:42 +08:00
|
|
|
where id=#{id}
|
2024-11-12 16:38:35 +08:00
|
|
|
</update>
|
|
|
|
|
<update id="updateInputData">
|
|
|
|
|
update t_part_input set updater=#{updater},update_time=now(),all_price=#{allPrice},
|
|
|
|
|
input_user=#{inputUser},input_day=#{inputDay},remark=#{remark}
|
|
|
|
|
WHERE id=#{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
2024-11-12 10:51:15 +08:00
|
|
|
<!--分页查询-->
|
|
|
|
|
<select id="findByPage" resultType="com.bonus.gzgqj.business.bases.entity.PartInputVo">
|
2025-03-08 09:33:15 +08:00
|
|
|
select tpi.id,tpi.code,tpi.creator,tpi.input_day inputDay,tpi.input_user inputUser,
|
|
|
|
|
tpi.input_num inputNum,tpi.all_price allPrice,tpi.remark,tpi.is_flag isFlag
|
|
|
|
|
from t_part_input tpi
|
2024-11-12 10:51:15 +08:00
|
|
|
<where>
|
|
|
|
|
<if test="keyWord!=null and keyWord!=''">
|
|
|
|
|
and (tpi.code like concat('%',#{keyWord},'%') or
|
2025-03-08 09:33:15 +08:00
|
|
|
tpi.input_user like concat('%',#{keyWord},'%') or
|
|
|
|
|
tpi.input_day like concat('%',#{keyWord},'%') or
|
|
|
|
|
tpi.remark like concat('%',#{keyWord},'%')
|
2024-11-12 10:51:15 +08:00
|
|
|
)
|
|
|
|
|
</if>
|
2025-03-08 09:33:15 +08:00
|
|
|
<if test="startDay!=null and startDay!='' and endDay!=null and endDay!='' ">
|
|
|
|
|
and STR_TO_DATE(tpi.input_day, '%Y-%m-%d') between STR_TO_DATE(#{startDay} ,'%Y-%m-%d') AND STR_TO_DATE(#{endDay},'%Y-%m-%d')
|
|
|
|
|
</if>
|
2024-11-12 10:51:15 +08:00
|
|
|
</where>
|
2024-11-13 13:23:42 +08:00
|
|
|
order by tpi.create_time desc
|
2024-11-12 10:51:15 +08:00
|
|
|
</select>
|
2024-11-12 13:53:41 +08:00
|
|
|
<!--入库数量-->
|
|
|
|
|
<select id="getInputNum" resultType="java.lang.Integer">
|
|
|
|
|
select count(1)
|
|
|
|
|
from t_part_input
|
|
|
|
|
where DATE_FORMAT(create_time,'%Y-%m-%d')=CURRENT_DATE
|
|
|
|
|
</select>
|
2024-11-13 16:26:51 +08:00
|
|
|
<select id="getPaTypeById" resultType="com.bonus.gzgqj.business.bases.entity.PaTypeVo">
|
|
|
|
|
select id ,num,ck_num ckNum,all_num allNum
|
|
|
|
|
from pa_type where id=#{partId}
|
2024-11-12 16:38:35 +08:00
|
|
|
</select>
|
|
|
|
|
<!--查询 入库详情-->
|
|
|
|
|
<select id="getInputDetails" resultType="com.bonus.gzgqj.business.bases.entity.PartInputVo">
|
2025-03-08 09:33:15 +08:00
|
|
|
select tpi.id,tpi.code,tpi.creator,tpi.input_day inputDay,tpi.input_user inputUser,
|
2024-11-12 16:38:35 +08:00
|
|
|
tpi.input_num inputNum,tpi.all_price allPrice,tpi.remark,tpi.is_flag isFlag
|
|
|
|
|
from t_part_input tpi
|
|
|
|
|
WHERE tpi.id=#{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getInfoById" resultType="java.lang.String">
|
|
|
|
|
select CONCAT(part_name,":",SUM(input_num)) detail
|
|
|
|
|
from t_part_put_details
|
|
|
|
|
where put_id=#{id}
|
|
|
|
|
GROUP BY part_name
|
|
|
|
|
</select>
|
|
|
|
|
<!--入库详情查询-->
|
|
|
|
|
<select id="getInputDetailList" resultType="com.bonus.gzgqj.business.bases.entity.PartInputDetails">
|
|
|
|
|
select ppd.id, ppd.put_id inputId,ppd.part_id partId, ppd.part_type partType,
|
|
|
|
|
ppd.part_name partName, ppd.part_model partModel, ppd.part_unit partUnit, ppd.input_num inputNum,
|
|
|
|
|
ppd.part_price partPrice, ppd.total_price totalPrice, ppd.vender_id vendId,
|
2024-11-13 13:23:42 +08:00
|
|
|
ppd.vender_name vendName,remark
|
2024-11-12 16:38:35 +08:00
|
|
|
FROM t_part_put_details ppd
|
|
|
|
|
where ppd.put_id=#{id}
|
2024-11-13 13:23:42 +08:00
|
|
|
<if test="type!=null and type!=''">
|
|
|
|
|
and ppd.part_type like concat('%',#{type},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="name!=null and name!=''">
|
|
|
|
|
and ppd.part_name like concat('%',#{name},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="model!=null and model!=''">
|
|
|
|
|
and ppd.part_model like concat('%',#{model},'%')
|
|
|
|
|
</if>
|
2024-11-12 16:38:35 +08:00
|
|
|
</select>
|
2024-11-12 20:19:09 +08:00
|
|
|
<select id="getPzPrice" resultType="java.lang.String">
|
|
|
|
|
select ROUND(IFNULL(AVG(part_price),0),2) price
|
2024-11-13 10:22:42 +08:00
|
|
|
from t_part_put_details ppd
|
2024-11-12 20:19:09 +08:00
|
|
|
where ppd.part_id=#{partId}
|
|
|
|
|
</select>
|
2024-11-12 10:51:15 +08:00
|
|
|
</mapper>
|