<?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.thhy.materials.modules.biz.rebarprint.mapper.TSteelProduceMapper">
|
<resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.rebarprint.entity.TSteelProduce">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
This element was generated on Sat May 06 09:52:00 CST 2023.
|
-->
|
<id column="steel_produce_id" jdbcType="VARCHAR" property="steelProduceId" />
|
<result column="produce_number" jdbcType="VARCHAR" property="produceNumber" />
|
<result column="pro_id" jdbcType="VARCHAR" property="proId" />
|
<result column="size_id" jdbcType="VARCHAR" property="sizeId" />
|
<result column="reinforcement_id" jdbcType="VARCHAR" property="reinforcementId" />
|
<result column="block_num" jdbcType="VARCHAR" property="blockNum" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="quality_time" jdbcType="TIMESTAMP" property="qualityTime" />
|
<result column="quality_user" jdbcType="VARCHAR" property="qualityUser" />
|
<result column="is_qualified" jdbcType="INTEGER" property="isQualified" />
|
<result column="is_model" jdbcType="INTEGER" property="isModel" />
|
<result column="is_user" jdbcType="INTEGER" property="isUser" />
|
</resultMap>
|
<select id="steelProduceList" resultType="com.thhy.materials.modules.biz.rebarprint.entity.dto.ProduceDto">
|
select
|
DISTINCT tsp.steel_produce_id as steelProduceId,
|
tsp.size_id as sizeId,
|
tsp.reinforcement_id reinforcementId,
|
tsp.block_num blockNum,
|
tsp.produce_number as produceNumber,
|
tsp.pro_id as proId,
|
sp.pro_name as proName,
|
sd.dict_name as sizeName,
|
sd1.dict_name as reinforcementName,
|
sd2.dict_name as blockName,
|
su.real_name as realName,
|
sg.group_name as groupName,
|
su1.real_name as qualityUserName,
|
tsp.quality_time as qualityTime,
|
tsp.is_qualified as isQualified,
|
tsp.is_model as isModel,
|
tsp.print_time as printTime,
|
spu.real_name as platUserName
|
from t_steel_produce tsp
|
left join sys_project sp on tsp.pro_id=sp.pro_id
|
left join sys_dict sd on tsp.size_id=sd.dict_id
|
left join sys_dict sd1 on tsp.reinforcement_id=sd1.dict_id
|
left join sys_dict sd2 on tsp.block_num=sd2.dict_id
|
left join sys_users su on tsp.create_user=su.user_id
|
left join sys_users su1 on tsp.quality_user=su1.user_id
|
left join t_steel_print stp on stp.steel_print_id = tsp.steel_print_id
|
left join sys_plat_user spu on spu.user_id = stp.plat_user_id
|
left join sys_group_user sgu on spu.user_id=sgu.user_id
|
left join sys_group sg on sgu.group_id=sg.group_id
|
where tsp.is_use=1
|
<if test="produceNumber!=null and produceNumber!='' ">
|
and tsp.produce_number like concat('%',#{produceNumber},'%')
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and sp.company_id=#{companyId}
|
</if>
|
<if test="proId!=null and proId!='' ">
|
and tsp.pro_id=#{proId}
|
</if>
|
<if test="blockNum!=null and blockNum!='' ">
|
and tsp.block_num=#{blockNum}
|
</if>
|
<if test="realName!=null and realName!='' ">
|
and su.real_name like concat('%',#{realName},'%')
|
</if>
|
<if test="groupId!=null and groupId!='' ">
|
and sgu.group_id=#{groupId}
|
</if>
|
<if test="isQualified!=null and isQualified!='' ">
|
and tsp.is_qualified=#{isQualified}
|
</if>
|
<if test="reinforcementId!=null and reinforcementId!='' ">
|
and tsp.reinforcement_id=#{reinforcementId}
|
</if>
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and tsp.print_time between #{strTime} and #{endTime}
|
</if>
|
<if test="strTimes!=null and strTimes!='' and endTimes!=null and endTimes!='' ">
|
and tsp.quality_time between #{strTimes} and #{endTimes}
|
</if>
|
<if test="steelPrintId!=null and steelPrintId!='' ">
|
and tsp.steel_print_id=#{steelPrintId}
|
</if>
|
<if test="isModel!=null and isModel!='' ">
|
and tsp.is_model=#{isModel}
|
</if>
|
<if test="sizeId!=null and sizeId!='' ">
|
and tsp.size_id=#{sizeId}
|
</if>
|
<if test="platUserName!=null and platUserName!='' ">
|
and spu.real_name regexp #{platUserName}
|
</if>
|
|
order by tsp.produce_number desc
|
</select>
|
<select id="steelProduceInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.rebarprint.entity.dto.ProduceDto">
|
select
|
DISTINCT tsp.steel_produce_id as steelProduceId,
|
tsp.produce_number as produceNumber,
|
tsp.pro_id as proId,sp.pro_name as proName,
|
sd.dict_name as sizeName,sd1.dict_name as reinforcementName,
|
sd2.dict_name as blockName,su.real_name as realName,
|
sg.group_name as groupName,su1.real_name as qualityUserName,
|
tsp.quality_time as qualityTime,tsp.is_qualified as isQualified,
|
tsp.is_model as isModel,tsp.print_time as printTime,
|
spu.real_name as platUserName
|
from t_steel_produce tsp
|
left join sys_project sp on tsp.pro_id=sp.pro_id
|
left join sys_dict sd on tsp.size_id=sd.dict_id
|
left join sys_dict sd1 on tsp.reinforcement_id=sd1.dict_id
|
left join sys_dict sd2 on tsp.block_num=sd2.dict_id
|
left join sys_users su on tsp.create_user=su.user_id
|
left join sys_users su1 on tsp.quality_user=su1.user_id
|
left join t_steel_print stp on stp.steel_print_id = tsp.steel_print_id
|
left join sys_plat_user spu on spu.user_id = stp.plat_user_id
|
left join sys_group_user sgu on spu.user_id=sgu.user_id
|
left join sys_group sg on sgu.group_id=sg.group_id
|
where tsp.is_use=1 and tsp.steel_produce_id=#{steelProduceId}
|
</select>
|
<select id="produceInventory" resultType="com.thhy.materials.modules.biz.rebarprint.entity.dto.ProduceInventoryDto">
|
SELECT
|
sp.pro_name AS proName,
|
sd.dict_name AS sizeName,
|
sd1.dict_name AS reinforcementName,
|
sd2.dict_name AS blockName,
|
COUNT( tsp.steel_produce_id ) as inventory,
|
tsp.pro_id as proId,
|
tsp.size_id as sizeId,
|
tsp.reinforcement_id as reinforcementId,
|
tsp.block_num as blockNum
|
FROM
|
t_steel_produce tsp
|
LEFT JOIN sys_project sp ON tsp.pro_id = sp.pro_id
|
LEFT JOIN sys_dict sd ON tsp.size_id = sd.dict_id
|
LEFT JOIN sys_dict sd1 ON tsp.reinforcement_id = sd1.dict_id
|
LEFT JOIN sys_dict sd2 ON tsp.block_num = sd2.dict_id
|
where tsp.is_use=1 and tsp.is_qualified=1 and tsp.is_model!=1
|
<if test="proId!=null and proId!='' ">
|
and tsp.pro_id=#{proId}
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and sp.company_id=#{companyId}
|
</if>
|
<if test="sizeId!=null and sizeId!='' ">
|
and tsp.size_id=#{sizeId}
|
</if>
|
<if test="reinforcementId!=null and reinforcementId!='' ">
|
and tsp.reinforcement_id=#{reinforcementId}
|
</if>
|
<if test="blockNum!=null and blockNum!='' ">
|
and tsp.block_num=#{blockNum}
|
</if>
|
GROUP BY
|
tsp.pro_id,
|
tsp.size_id,
|
tsp.reinforcement_id,
|
tsp.block_num
|
</select>
|
<select id="produceInventoryReinforcementId" resultType="com.thhy.materials.modules.biz.rebarprint.entity.dto.ProduceInventoryDto">
|
SELECT
|
sp.pro_name AS proName,
|
sd.dict_name AS sizeName,
|
sd1.dict_name AS reinforcementName,
|
COUNT( tsp.steel_produce_id ) as inventory,
|
tsp.pro_id as proId,
|
tsp.size_id as sizeId,
|
tsp.reinforcement_id as reinforcementId
|
FROM
|
t_steel_produce tsp
|
LEFT JOIN sys_project sp ON tsp.pro_id = sp.pro_id
|
LEFT JOIN sys_dict sd ON tsp.size_id = sd.dict_id
|
LEFT JOIN sys_dict sd1 ON tsp.reinforcement_id = sd1.dict_id
|
LEFT JOIN sys_dict sd2 ON tsp.block_num = sd2.dict_id
|
where tsp.is_use=1 and tsp.is_qualified=1 and tsp.is_model!=1
|
<if test="proId!=null and proId!='' ">
|
and tsp.pro_id=#{proId}
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and sp.company_id=#{companyId}
|
</if>
|
<if test="sizeId!=null and sizeId!='' ">
|
and tsp.size_id=#{sizeId}
|
</if>
|
<if test="reinforcementId!=null and reinforcementId!='' ">
|
and tsp.reinforcement_id=#{reinforcementId}
|
</if>
|
<if test="blockNum!=null and blockNum!='' ">
|
and tsp.block_num=#{blockNum}
|
</if>
|
GROUP BY
|
tsp.pro_id,
|
tsp.size_id,
|
tsp.reinforcement_id
|
</select>
|
<select id="blockNumSelectAll" parameterType="java.lang.String" resultType="java.lang.String">
|
select block_num from sys_pro_blok where pro_id=#{proId}
|
</select>
|
|
<select id="steelProduceCheck" resultType="com.thhy.materials.modules.biz.rebarprint.entity.TSteelCheckRecord">
|
select
|
tscr.check_id as checkId,
|
tscr.steel_produce_id as steelProduceId,
|
tscr.steel_produce_num as steelProduceNum,
|
tscr.check_result as checkResult,
|
tscr.create_time as createTime,
|
tscr.create_user as createUser,
|
tscr.check_faild_reason as checkFaildReason,
|
tscr.remark as remark,
|
tscr.exec_result as execResult,
|
tscr.exec_flag as execFlag,
|
su.real_name as realName
|
from t_steel_check_record tscr
|
left join sys_users su on tscr.create_user=su.user_id
|
where
|
tscr.steel_produce_num=#{steelProduceNum}
|
ORDER BY tscr.create_time desc
|
limit 0,1
|
</select>
|
<select id="checkInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.rebarprint.entity.dto.CheckDto">
|
select reason_type as reasonType,
|
reason_name as reasonName,
|
reason_kind as reasonKind
|
from t_check_reason
|
where id=#{sId}
|
</select>
|
<update id="steelProduceFeedback">
|
update t_steel_check_record
|
<set>
|
<if test="remark != null">
|
remark = #{remark,jdbcType=VARCHAR},
|
</if>
|
<if test="execResult != null">
|
exec_result = #{execResult,jdbcType=VARCHAR},
|
</if>
|
<if test="execFlag != null">
|
exec_flag = #{execFlag,jdbcType=INTEGER},
|
</if>
|
</set>
|
where check_id = #{checkId,jdbcType=VARCHAR}
|
</update>
|
|
<select id="checkFile" parameterType="java.lang.String" resultType="java.lang.String">
|
select check_file as checkFile from t_steel_check_file where steel_check_id=#{checkId}
|
</select>
|
|
<select id="appProduceLooping" resultType="java.util.Map">
|
<!-- SELECT proName,SUM(inventory) inventory FROM (SELECT-->
|
<!-- proName,-->
|
<!-- COUNT(inventory) num,-->
|
<!-- MIN(inventory) inventory-->
|
<!-- FROM (-->
|
<!-- SELECT-->
|
<!-- sp.pro_name AS proName,-->
|
<!-- sd1.dict_name AS reinforcementName,-->
|
<!-- COUNT( tsp.steel_produce_id ) as inventory-->
|
<!-- FROM-->
|
<!-- sys_project sp-->
|
<!-- LEFT JOIN t_steel_produce tsp ON tsp.pro_id = sp.pro_id-->
|
<!-- LEFT JOIN sys_dict sd ON tsp.size_id = sd.dict_id-->
|
<!-- LEFT JOIN sys_dict sd1 ON tsp.reinforcement_id = sd1.dict_id-->
|
<!-- LEFT JOIN sys_dict sd2 ON tsp.block_num = sd2.dict_id-->
|
<!-- where tsp.is_use=1 and tsp.is_qualified=1 and sp.pro_id =#{proId} and tsp.size_id = #{sizeId}-->
|
<!-- GROUP BY-->
|
<!-- tsp.pro_id,-->
|
<!-- tsp.size_id,-->
|
<!-- tsp.reinforcement_id,-->
|
<!-- tsp.block_num-->
|
<!-- ) a-->
|
<!-- GROUP BY reinforcementName-->
|
<!-- ) c-->
|
<!-- WHERE c.num=(SELECT count(id) FROM sys_pro_blok WHERE pro_id =#{proId})-->
|
<!-- GROUP BY proName-->
|
SELECT proName,SUM(inventory) inventory FROM (SELECT
|
proName,
|
COUNT(inventory) num,
|
MIN(inventory) inventory
|
FROM (
|
SELECT
|
sp.pro_name AS proName,
|
sd1.dict_name AS reinforcementName,
|
COUNT( tsp.reinforcement ) as inventory
|
FROM
|
sys_project sp
|
LEFT JOIN t_pipe_info tsp ON tsp.pro_id = sp.pro_id
|
LEFT JOIN sys_dict sd ON tsp.size = sd.dict_id
|
LEFT JOIN sys_dict sd1 ON tsp.reinforcement = sd1.dict_id
|
LEFT JOIN sys_dict sd2 ON tsp.block_num = sd2.dict_id
|
where tsp.check_result=1 and sp.pro_id =#{proId} and tsp.size = #{sizeId}
|
GROUP BY
|
tsp.pro_id,
|
tsp.size,
|
tsp.reinforcement,
|
tsp.block_num
|
) a
|
GROUP BY reinforcementName
|
) c
|
WHERE c.num=(SELECT count(id) FROM sys_pro_blok WHERE pro_id =#{proId})
|
GROUP BY proName
|
</select>
|
<select id="getProName" resultType="java.lang.String">
|
SELECT pro_name FROM sys_project WHERE pro_id =#{proId}
|
</select>
|
|
<select id="allproduceInventory" resultType="com.thhy.materials.modules.biz.rebarprint.entity.dto.ProduceInventoryDto">
|
SELECT
|
sp.pro_name AS proName,
|
sd.dict_name AS sizeName,
|
sd1.dict_name AS reinforcementName,
|
sd2.dict_name AS blockName,
|
COUNT( tsp.steel_produce_id ) as inventory,
|
tsp.pro_id as proId,
|
tsp.size_id as sizeId,
|
tsp.reinforcement_id as reinforcementId,
|
tsp.block_num as blockNum
|
FROM
|
t_steel_produce tsp
|
LEFT JOIN sys_project sp ON tsp.pro_id = sp.pro_id
|
LEFT JOIN sys_dict sd ON tsp.size_id = sd.dict_id
|
LEFT JOIN sys_dict sd1 ON tsp.reinforcement_id = sd1.dict_id
|
LEFT JOIN sys_dict sd2 ON tsp.block_num = sd2.dict_id
|
where tsp.is_use=1 and tsp.is_qualified=1
|
<if test="proId!=null and proId!='' ">
|
and tsp.pro_id=#{proId}
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and sp.company_id=#{companyId}
|
</if>
|
<if test="sizeId!=null and sizeId!='' ">
|
and tsp.size_id=#{sizeId}
|
</if>
|
<if test="reinforcementId!=null and reinforcementId!='' ">
|
and tsp.reinforcement_id=#{reinforcementId}
|
</if>
|
<if test="blockNum!=null and blockNum!='' ">
|
and tsp.block_num=#{blockNum}
|
</if>
|
GROUP BY
|
tsp.pro_id,
|
tsp.size_id,
|
tsp.reinforcement_id,
|
tsp.block_num
|
</select>
|
|
|
|
<select id="allProduceInventoryReinforcementId" resultType="com.thhy.materials.modules.biz.rebarprint.entity.dto.ProduceInventoryDto">
|
SELECT
|
sp.pro_name AS proName,
|
sd.dict_name AS sizeName,
|
sd1.dict_name AS reinforcementName,
|
COUNT( tsp.steel_produce_id ) as inventory,
|
tsp.pro_id as proId,
|
tsp.size_id as sizeId,
|
tsp.reinforcement_id as reinforcementId
|
FROM
|
t_steel_produce tsp
|
LEFT JOIN sys_project sp ON tsp.pro_id = sp.pro_id
|
LEFT JOIN sys_dict sd ON tsp.size_id = sd.dict_id
|
LEFT JOIN sys_dict sd1 ON tsp.reinforcement_id = sd1.dict_id
|
LEFT JOIN sys_dict sd2 ON tsp.block_num = sd2.dict_id
|
where tsp.is_use=1 and tsp.is_qualified=1
|
<if test="proId!=null and proId!='' ">
|
and tsp.pro_id=#{proId}
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and sp.company_id=#{companyId}
|
</if>
|
<if test="sizeId!=null and sizeId!='' ">
|
and tsp.size_id=#{sizeId}
|
</if>
|
<if test="reinforcementId!=null and reinforcementId!='' ">
|
and tsp.reinforcement_id=#{reinforcementId}
|
</if>
|
<if test="blockNum!=null and blockNum!='' ">
|
and tsp.block_num=#{blockNum}
|
</if>
|
GROUP BY
|
tsp.pro_id,
|
tsp.size_id,
|
tsp.reinforcement_id
|
</select>
|
|
|
|
|
|
</mapper>
|