|
|
@@ -1,65 +1,120 @@
|
|
|
<?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.zd.chemical.mapper.HxpChemicalMapper">
|
|
|
|
|
|
<resultMap type="com.zd.chemical.domain.HxpChemical" id="HxpChemicalResult">
|
|
|
- <result property="id" column="id" />
|
|
|
- <result property="chemicalNum" column="chemical_num" />
|
|
|
- <result property="chemicalName" column="chemical_name" />
|
|
|
- <result property="chemicalClassify" column="chemical_classify" />
|
|
|
- <result property="classifyAttribute" column="classify_attribute" />
|
|
|
- <result property="chemicalShape" column="chemical_shape" />
|
|
|
- <result property="labelType" column="label_type" />
|
|
|
- <result property="measuringMethod" column="measuring_method" />
|
|
|
- <result property="chemicalUnit" column="chemical_unit" />
|
|
|
- <result property="verification" column="verification" />
|
|
|
- <result property="anotherName" column="another_name" />
|
|
|
- <result property="casNum" column="cas_num" />
|
|
|
- <result property="factory" column="factory" />
|
|
|
- <result property="purity" column="purity" />
|
|
|
- <result property="collectHour" column="collect_hour" />
|
|
|
- <result property="collectMinute" column="collect_minute" />
|
|
|
- <result property="joinHazardId" column="join_hazard_id" />
|
|
|
- <result property="userId" column="user_id" />
|
|
|
- <result property="createBy" column="create_by" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateBy" column="update_by" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
- <result property="remark" column="remark" />
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="chemicalNum" column="chemical_num"/>
|
|
|
+ <result property="chemicalName" column="chemical_name"/>
|
|
|
+ <result property="chemicalClassify" column="chemical_classify"/>
|
|
|
+ <result property="classifyAttribute" column="classify_attribute"/>
|
|
|
+ <result property="chemicalShape" column="chemical_shape"/>
|
|
|
+ <result property="labelType" column="label_type"/>
|
|
|
+ <result property="measuringMethod" column="measuring_method"/>
|
|
|
+ <result property="chemicalUnit" column="chemical_unit"/>
|
|
|
+ <result property="verification" column="verification"/>
|
|
|
+ <result property="anotherName" column="another_name"/>
|
|
|
+ <result property="casNum" column="cas_num"/>
|
|
|
+ <result property="factory" column="factory"/>
|
|
|
+ <result property="purity" column="purity"/>
|
|
|
+ <result property="collectHour" column="collect_hour"/>
|
|
|
+ <result property="collectMinute" column="collect_minute"/>
|
|
|
+ <result property="joinHazardId" column="join_hazard_id"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="remark" column="remark"/>
|
|
|
+
|
|
|
+ <result property="criticality" column="criticality"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectHxpChemicalVo">
|
|
|
- select id, chemical_num, chemical_name, chemical_classify, classify_attribute, chemical_shape, label_type, measuring_method, chemical_unit, verification, another_name, cas_num, factory, purity, collect_hour, collect_minute, user_id, create_by, create_time, update_by, update_time, remark from hxp_chemical
|
|
|
+ select id,
|
|
|
+ chemical_num,
|
|
|
+ chemical_name,
|
|
|
+ chemical_classify,
|
|
|
+ classify_attribute,
|
|
|
+ chemical_shape,
|
|
|
+ label_type,
|
|
|
+ measuring_method,
|
|
|
+ chemical_unit,
|
|
|
+ verification,
|
|
|
+ another_name,
|
|
|
+ cas_num,
|
|
|
+ factory,
|
|
|
+ purity,
|
|
|
+ collect_hour,
|
|
|
+ collect_minute,
|
|
|
+ user_id,
|
|
|
+ create_by,
|
|
|
+ create_time,
|
|
|
+ update_by,
|
|
|
+ update_time,
|
|
|
+ remark,
|
|
|
+ criticality
|
|
|
+ from hxp_chemical
|
|
|
</sql>
|
|
|
<sql id="selectHxpChemicalListVo">
|
|
|
- select t.id, t.chemical_num, t.chemical_name, t.chemical_classify, classify_attribute, t.chemical_shape, t.label_type, t.measuring_method, t.chemical_unit, t.verification, t.another_name, t.cas_num, t.factory, t.purity, t.collect_hour, t.collect_minute, t.user_id, t.create_by, t.create_time, t.update_by, t.update_time, t.remark from hxp_chemical as t
|
|
|
+ select t.id,
|
|
|
+ t.chemical_num,
|
|
|
+ t.chemical_name,
|
|
|
+ t.chemical_classify,
|
|
|
+ classify_attribute,
|
|
|
+ t.chemical_shape,
|
|
|
+ t.label_type,
|
|
|
+ t.measuring_method,
|
|
|
+ t.chemical_unit,
|
|
|
+ t.verification,
|
|
|
+ t.another_name,
|
|
|
+ t.cas_num,
|
|
|
+ t.factory,
|
|
|
+ t.purity,
|
|
|
+ t.collect_hour,
|
|
|
+ t.collect_minute,
|
|
|
+ t.user_id,
|
|
|
+ t.create_by,
|
|
|
+ t.create_time,
|
|
|
+ t.update_by,
|
|
|
+ t.update_time,
|
|
|
+ t.remark,
|
|
|
+ t.criticality
|
|
|
+ from hxp_chemical as t
|
|
|
</sql>
|
|
|
- <select id="selectHxpChemicalList" parameterType="com.zd.chemical.domain.vo.HxpChemicalSearch" resultType="com.zd.chemical.domain.vo.HxpChemicalVo">
|
|
|
+ <select id="selectHxpChemicalList" parameterType="com.zd.chemical.domain.vo.HxpChemicalSearch"
|
|
|
+ resultType="com.zd.chemical.domain.vo.HxpChemicalVo">
|
|
|
select hc.id, hc.chemical_num, hc.chemical_name, hc.chemical_classify,
|
|
|
(select ccf.classify_name from hxp_chemical_classify ccf where ccf.id = hc.chemical_classify) classifyName,
|
|
|
- (SELECT GROUP_CONCAT(dda.dict_label) FROM sys_dict_data dda WHERE dda.dict_type = 'hxp_classifyattribute' AND FIND_IN_SET(dda.dict_value, hc.classify_attribute)) classifyAttribute,
|
|
|
- (SELECT GROUP_CONCAT(CONCAT(dda.dict_label,'(',hc.chemical_unit,')')) FROM sys_dict_data dda WHERE dda.dict_type = 'chemical_shape' AND dda.dict_value = hc.chemical_shape) chemicalShapeInfo,
|
|
|
- (SELECT GROUP_CONCAT(dda.dict_label) FROM sys_dict_data dda WHERE dda.dict_type = 'chemical_shape' AND dda.dict_value = hc.chemical_shape) chemicalShapeInfo2,
|
|
|
+ (SELECT GROUP_CONCAT(dda.dict_label) FROM sys_dict_data dda WHERE dda.dict_type = 'hxp_classifyattribute' AND
|
|
|
+ FIND_IN_SET(dda.dict_value, hc.classify_attribute)) classifyAttribute,
|
|
|
+ (SELECT GROUP_CONCAT(CONCAT(dda.dict_label,'(',hc.chemical_unit,')')) FROM sys_dict_data dda WHERE dda.dict_type
|
|
|
+ = 'chemical_shape' AND dda.dict_value = hc.chemical_shape) chemicalShapeInfo,
|
|
|
+ (SELECT GROUP_CONCAT(dda.dict_label) FROM sys_dict_data dda WHERE dda.dict_type = 'chemical_shape' AND
|
|
|
+ dda.dict_value = hc.chemical_shape) chemicalShapeInfo2,
|
|
|
case when hc.label_type=1 then 'RFID' else '二维码' end labelContent, hc.measuring_method, hc.chemical_unit,
|
|
|
- case when hc.verification=1 then '单人验证' else '双人双卡' end verificationContent, hc.another_name, hc.cas_num, hc.factory, hc.purity, hc.collect_hour, hc.collect_minute, hc.user_id,
|
|
|
+ case when hc.verification=1 then '单人验证' else '双人双卡' end verificationContent, hc.another_name, hc.cas_num,
|
|
|
+ hc.factory, hc.purity, hc.collect_hour, hc.collect_minute, hc.user_id,
|
|
|
(SELECT ur.nick_name FROM sys_user ur WHERE ur.user_id = hc.user_id) create_by, hc.create_time,
|
|
|
hc.update_by, hc.update_time, hc.remark,
|
|
|
- CASE WHEN hc.measuring_method = 1 THEN '重量' ELSE CASE WHEN hc.measuring_method = 2 THEN '体积' ELSE '个数' END END measuringMethodContent
|
|
|
+ CASE WHEN hc.measuring_method = 1 THEN '重量' ELSE CASE WHEN hc.measuring_method = 2 THEN '体积' ELSE '个数' END END
|
|
|
+ measuringMethodContent
|
|
|
from hxp_chemical hc LEFT JOIN sys_user su ON hc.user_id = su.user_id
|
|
|
<where>
|
|
|
<if test="searchValue != null and searchValue != ''">
|
|
|
- and (hc.chemical_name like concat('%',#{searchValue},'%') or hc.another_name like concat('%',#{searchValue},'%') or hc.cas_num like concat('%',#{searchValue},'%'))
|
|
|
+ and (hc.chemical_name like concat('%',#{searchValue},'%') or hc.another_name like
|
|
|
+ concat('%',#{searchValue},'%') or hc.cas_num like concat('%',#{searchValue},'%'))
|
|
|
</if>
|
|
|
- <if test="chemicalClassify != null "> and hc.chemical_classify = #{chemicalClassify}</if>
|
|
|
- <if test="classifyAttribute != null "> AND FIND_IN_SET(#{classifyAttribute}, hc.classify_attribute)</if>
|
|
|
- <if test="labelType != null "> and hc.label_type = #{labelType}</if>
|
|
|
+ <if test="chemicalClassify != null ">and hc.chemical_classify = #{chemicalClassify}</if>
|
|
|
+ <if test="classifyAttribute != null ">AND FIND_IN_SET(#{classifyAttribute}, hc.classify_attribute)</if>
|
|
|
+ <if test="labelType != null ">and hc.label_type = #{labelType}</if>
|
|
|
<if test="ids!=null and ids.size > 0">
|
|
|
AND hc.id IN
|
|
|
<foreach item="item" collection="ids" separator="," open="(" close=")" index="">'${item}'</foreach>
|
|
|
</if>
|
|
|
- <if test="casNum != null "> and hc.cas_num = #{casNum}</if>
|
|
|
+ <if test="casNum != null ">and hc.cas_num = #{casNum}</if>
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
|
</where>
|
|
|
@@ -79,50 +134,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <insert id="insertHxpChemical" parameterType="com.zd.chemical.domain.HxpChemical" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ <insert id="insertHxpChemical" parameterType="com.zd.chemical.domain.HxpChemical" useGeneratedKeys="true"
|
|
|
+ keyProperty="id">
|
|
|
insert into hxp_chemical
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="chemicalNum != null">chemical_num,</if>
|
|
|
+ <if test="chemicalNum != null">chemical_num,</if>
|
|
|
|
|
|
- <if test="chemicalName != null">chemical_name,</if>
|
|
|
+ <if test="chemicalName != null">chemical_name,</if>
|
|
|
|
|
|
- <if test="chemicalClassify != null">chemical_classify,</if>
|
|
|
+ <if test="chemicalClassify != null">chemical_classify,</if>
|
|
|
|
|
|
- <if test="classifyAttribute != null">classify_attribute,</if>
|
|
|
+ <if test="classifyAttribute != null">classify_attribute,</if>
|
|
|
|
|
|
- <if test="chemicalShape != null">chemical_shape,</if>
|
|
|
+ <if test="chemicalShape != null">chemical_shape,</if>
|
|
|
|
|
|
- <if test="labelType != null">label_type,</if>
|
|
|
+ <if test="labelType != null">label_type,</if>
|
|
|
|
|
|
- <if test="measuringMethod != null">measuring_method,</if>
|
|
|
+ <if test="measuringMethod != null">measuring_method,</if>
|
|
|
|
|
|
- <if test="chemicalUnit != null">chemical_unit,</if>
|
|
|
+ <if test="chemicalUnit != null">chemical_unit,</if>
|
|
|
|
|
|
- <if test="verification != null">verification,</if>
|
|
|
+ <if test="verification != null">verification,</if>
|
|
|
|
|
|
- <if test="anotherName != null">another_name,</if>
|
|
|
+ <if test="anotherName != null">another_name,</if>
|
|
|
|
|
|
- <if test="casNum != null">cas_num,</if>
|
|
|
+ <if test="casNum != null">cas_num,</if>
|
|
|
|
|
|
- <if test="factory != null">factory,</if>
|
|
|
+ <if test="factory != null">factory,</if>
|
|
|
|
|
|
- <if test="purity != null">purity,</if>
|
|
|
+ <if test="purity != null">purity,</if>
|
|
|
|
|
|
- <if test="collectHour != null">collect_hour,</if>
|
|
|
+ <if test="collectHour != null">collect_hour,</if>
|
|
|
|
|
|
- <if test="collectMinute != null">collect_minute,</if>
|
|
|
+ <if test="collectMinute != null">collect_minute,</if>
|
|
|
|
|
|
- <if test="userId != null">user_id,</if>
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
|
|
|
- <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
|
|
|
- <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
|
|
|
- <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
|
|
|
- <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
|
|
|
- <if test="remark != null">remark,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
|
|
|
<if test="chemicalNamePinyin != null">chemical_name_pinyin,</if>
|
|
|
|
|
|
@@ -132,29 +188,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<if test="anotherNameChar != null">another_name_char,</if>
|
|
|
|
|
|
- </trim>
|
|
|
+ <if test="criticality != null">criticality,</if>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="chemicalNum != null">#{chemicalNum},</if>
|
|
|
- <if test="chemicalName != null">#{chemicalName},</if>
|
|
|
- <if test="chemicalClassify != null">#{chemicalClassify},</if>
|
|
|
- <if test="classifyAttribute != null">#{classifyAttribute},</if>
|
|
|
- <if test="chemicalShape != null">#{chemicalShape},</if>
|
|
|
- <if test="labelType != null">#{labelType},</if>
|
|
|
- <if test="measuringMethod != null">#{measuringMethod},</if>
|
|
|
- <if test="chemicalUnit != null">#{chemicalUnit},</if>
|
|
|
- <if test="verification != null">#{verification},</if>
|
|
|
- <if test="anotherName != null">#{anotherName},</if>
|
|
|
- <if test="casNum != null">#{casNum},</if>
|
|
|
- <if test="factory != null">#{factory},</if>
|
|
|
- <if test="purity != null">#{purity},</if>
|
|
|
- <if test="collectHour != null">#{collectHour},</if>
|
|
|
- <if test="collectMinute != null">#{collectMinute},</if>
|
|
|
- <if test="userId != null">#{userId},</if>
|
|
|
- <if test="createBy != null">#{createBy},</if>
|
|
|
- <if test="createTime != null">#{createTime},</if>
|
|
|
- <if test="updateBy != null">#{updateBy},</if>
|
|
|
- <if test="updateTime != null">#{updateTime},</if>
|
|
|
- <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="chemicalNum != null">#{chemicalNum},</if>
|
|
|
+ <if test="chemicalName != null">#{chemicalName},</if>
|
|
|
+ <if test="chemicalClassify != null">#{chemicalClassify},</if>
|
|
|
+ <if test="classifyAttribute != null">#{classifyAttribute},</if>
|
|
|
+ <if test="chemicalShape != null">#{chemicalShape},</if>
|
|
|
+ <if test="labelType != null">#{labelType},</if>
|
|
|
+ <if test="measuringMethod != null">#{measuringMethod},</if>
|
|
|
+ <if test="chemicalUnit != null">#{chemicalUnit},</if>
|
|
|
+ <if test="verification != null">#{verification},</if>
|
|
|
+ <if test="anotherName != null">#{anotherName},</if>
|
|
|
+ <if test="casNum != null">#{casNum},</if>
|
|
|
+ <if test="factory != null">#{factory},</if>
|
|
|
+ <if test="purity != null">#{purity},</if>
|
|
|
+ <if test="collectHour != null">#{collectHour},</if>
|
|
|
+ <if test="collectMinute != null">#{collectMinute},</if>
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
<if test="chemicalNamePinyin != null">#{chemicalNamePinyin},</if>
|
|
|
|
|
|
<if test="chemicalNameChar != null">#{chemicalNameChar},</if>
|
|
|
@@ -162,7 +219,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="anotherNamePinyin != null">#{anotherNamePinyin},</if>
|
|
|
|
|
|
<if test="anotherNameChar != null">#{anotherNameChar},</if>
|
|
|
- </trim>
|
|
|
+
|
|
|
+ <if test="criticality != null">#{criticality},</if>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateHxpChemical" parameterType="com.zd.chemical.domain.HxpChemical">
|
|
|
@@ -196,18 +255,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="anotherNamePinyin != null">another_name_pinyin = #{anotherNamePinyin},</if>
|
|
|
<if test="anotherNameChar != null">another_name_char = #{anotherNameChar},</if>
|
|
|
|
|
|
+ <if test="criticality != null">criticality = #{criticality},</if>
|
|
|
+
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
<update id="clearHxpChemicalByJoinHazard" parameterType="com.zd.chemical.domain.HxpChemical">
|
|
|
- update hxp_chemical set
|
|
|
- join_hazard_id = NULL
|
|
|
+ update hxp_chemical
|
|
|
+ set join_hazard_id = NULL
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteHxpChemicalById" parameterType="Long">
|
|
|
- delete from hxp_chemical where id = #{id}
|
|
|
+ delete
|
|
|
+ from hxp_chemical
|
|
|
+ where id = #{id}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteHxpChemicalByIds" parameterType="String">
|
|
|
@@ -218,7 +281,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
- <select id="chemicalUsageCount" parameterType="com.zd.chemical.domain.HxpChemical" resultType="com.zd.chemical.domain.vo.HxpHomeChemicalVo">
|
|
|
+ <select id="chemicalUsageCount" parameterType="com.zd.chemical.domain.HxpChemical"
|
|
|
+ resultType="com.zd.chemical.domain.vo.HxpHomeChemicalVo">
|
|
|
SELECT
|
|
|
(SELECT IFNULL(COUNT(1),0) FROM hxp_stock sk
|
|
|
LEFT JOIN sys_user ur ON sk.user_id = ur.user_id WHERE sk.status=1
|
|
|
@@ -241,7 +305,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
${params.dataScope}
|
|
|
) chemicalCancelNum,
|
|
|
(SELECT IFNULL(COUNT(1),0) FROM hxp_stock sk INNER JOIN hxp_chemical_join_cabinet cjc ON sk.join_id = cjc.id
|
|
|
- LEFT JOIN sys_user ur ON sk.user_id = ur.user_id WHERE DATE_SUB(cjc.expire_time, INTERVAL 3 DAY)<=NOW()
|
|
|
+ LEFT JOIN sys_user ur ON sk.user_id = ur.user_id WHERE DATE_SUB(cjc.expire_time, INTERVAL 3 DAY)<=NOW()
|
|
|
AND cjc.expire_time>NOW()
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
|
@@ -249,7 +313,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
FROM DUAL
|
|
|
</select>
|
|
|
|
|
|
- <select id="chemicalUnusualCount" parameterType="com.zd.chemical.domain.HxpChemical" resultType="com.zd.chemical.domain.vo.HxpHomeChemicalUnusualVo">
|
|
|
+ <select id="chemicalUnusualCount" parameterType="com.zd.chemical.domain.HxpChemical"
|
|
|
+ resultType="com.zd.chemical.domain.vo.HxpHomeChemicalUnusualVo">
|
|
|
SELECT
|
|
|
(SELECT IFNULL(COUNT(1),0) FROM hxp_userecord rd
|
|
|
LEFT JOIN sys_user ur ON rd.user_id = ur.user_id WHERE rd.use_status = 1
|
|
|
@@ -262,31 +327,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
${params.dataScope}
|
|
|
) overtimeReturn,
|
|
|
(SELECT IFNULL(COUNT(1),0) FROM hxp_userecord rd
|
|
|
- LEFT JOIN sys_user ur ON rd.user_id = ur.user_id WHERE DATE_FORMAT(rd.collect_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
+ LEFT JOIN sys_user ur ON rd.user_id = ur.user_id WHERE DATE_FORMAT(rd.collect_time,'%Y-%m-%d') =
|
|
|
+ DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
|
) todayCollect,
|
|
|
(SELECT IFNULL(COUNT(1),0) FROM hxp_userecord rd
|
|
|
- LEFT JOIN sys_user ur ON rd.user_id = ur.user_id WHERE rd.use_status = 0 AND DATE_FORMAT(rd.collect_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
+ LEFT JOIN sys_user ur ON rd.user_id = ur.user_id WHERE rd.use_status = 0 AND
|
|
|
+ DATE_FORMAT(rd.collect_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
|
) todayReturn,
|
|
|
(SELECT IFNULL(COUNT(1),0) FROM hxp_stock sk
|
|
|
- LEFT JOIN sys_user ur ON sk.user_id = ur.user_id WHERE sk.status=2 AND DATE_FORMAT(sk.out_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
+ LEFT JOIN sys_user ur ON sk.user_id = ur.user_id WHERE sk.status=2 AND DATE_FORMAT(sk.out_time,'%Y-%m-%d') =
|
|
|
+ DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
|
) todayOutNum,
|
|
|
(SELECT IFNULL(COUNT(1),0) FROM hxp_stock sk
|
|
|
- LEFT JOIN sys_user ur ON sk.user_id = ur.user_id WHERE sk.status=3 AND DATE_FORMAT(sk.out_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
+ LEFT JOIN sys_user ur ON sk.user_id = ur.user_id WHERE sk.status=3 AND DATE_FORMAT(sk.out_time,'%Y-%m-%d') =
|
|
|
+ DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
|
) todayCancelNum
|
|
|
FROM DUAL
|
|
|
</select>
|
|
|
|
|
|
- <select id="chemicalUsagesCount" parameterType="com.zd.chemical.domain.HxpChemical" resultType="com.zd.chemical.domain.vo.HxpHomeChemicalUsagesVo">
|
|
|
- SELECT CONCAT(cl.`chemical_name`,'使用重量',CONCAT(SUM(sk.usages-sk.out_usages),cl.chemical_unit)) chemicalUsages, SUM(sk.usages-sk.out_usages)usages,
|
|
|
- (SELECT ur.nick_name FROM sys_user ur WHERE ur.user_id = cl.user_id) adminUser,
|
|
|
+ <select id="chemicalUsagesCount" parameterType="com.zd.chemical.domain.HxpChemical"
|
|
|
+ resultType="com.zd.chemical.domain.vo.HxpHomeChemicalUsagesVo">
|
|
|
+ SELECT CONCAT(cl.`chemical_name`,'使用重量',CONCAT(SUM(sk.usages-sk.out_usages),cl.chemical_unit)) chemicalUsages,
|
|
|
+ SUM(sk.usages-sk.out_usages)usages,
|
|
|
+ (SELECT ur.nick_name FROM sys_user ur WHERE ur.user_id = cl.user_id) adminUser,
|
|
|
(SELECT cc.classify_name FROM hxp_chemical_classify cc WHERE cc.id = cl.chemical_classify) classifyName,
|
|
|
(SELECT cc.hazard_level FROM hxp_chemical_classify cc WHERE cc.id = cl.chemical_classify) classifyLevel
|
|
|
FROM hxp_stock sk
|
|
|
@@ -300,8 +371,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
GROUP BY cl.`id` ORDER BY usages DESC LIMIT 6
|
|
|
</select>
|
|
|
|
|
|
- <select id="chemicalClassifyMix" parameterType="com.zd.chemical.domain.HxpChemical" resultType="java.util.LinkedHashMap">
|
|
|
- SELECT x1.dict_label classifyAttribute,CONCAT(CASE WHEN x2.chemical_name IS NULL THEN 0 ELSE COUNT(0) END,'') chemicalMix FROM (
|
|
|
+ <select id="chemicalClassifyMix" parameterType="com.zd.chemical.domain.HxpChemical"
|
|
|
+ resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT x1.dict_label classifyAttribute,CONCAT(CASE WHEN x2.chemical_name IS NULL THEN 0 ELSE COUNT(0) END,'')
|
|
|
+ chemicalMix FROM (
|
|
|
select xx1.* from(SELECT dda.`dict_label`,dda.dict_value
|
|
|
FROM sys_dict_data dda
|
|
|
WHERE dda.dict_type = 'hxp_classifyattribute'
|
|
|
@@ -312,7 +385,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
)x1
|
|
|
LEFT JOIN
|
|
|
(
|
|
|
- select xx.chemical_name,case when xx.classify_attribute='' or xx.classify_attribute is null then 99 else xx.classify_attribute end classify_attribute from (
|
|
|
+ select xx.chemical_name,case when xx.classify_attribute='' or xx.classify_attribute is null then 99 else
|
|
|
+ xx.classify_attribute end classify_attribute from (
|
|
|
SELECT cl.chemical_name,cl.classify_attribute
|
|
|
FROM hxp_stock sk
|
|
|
INNER JOIN hxp_chemical_join_cabinet cjc ON sk.join_id= cjc.id
|
|
|
@@ -355,14 +429,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
SELECT DATE_FORMAT(NOW(),'%Y-%m-%d') FROM DUAL
|
|
|
)x1 LEFT JOIN hxp_stock sk
|
|
|
<if test="status == 1">
|
|
|
- ON DATE_FORMAT(x1.nowData,'%Y-%m-%d') = DATE_FORMAT(sk.join_time,'%Y-%m-%d') AND (sk.status=#{status} or sk.status=4)
|
|
|
+ ON DATE_FORMAT(x1.nowData,'%Y-%m-%d') = DATE_FORMAT(sk.join_time,'%Y-%m-%d') AND (sk.status=#{status} or
|
|
|
+ sk.status=4)
|
|
|
</if>
|
|
|
<if test="status == 2">
|
|
|
- ON DATE_FORMAT(x1.nowData,'%Y-%m-%d') = DATE_FORMAT(sk.out_time,'%Y-%m-%d') AND (sk.status=#{status} or sk.status=3)
|
|
|
+ ON DATE_FORMAT(x1.nowData,'%Y-%m-%d') = DATE_FORMAT(sk.out_time,'%Y-%m-%d') AND (sk.status=#{status} or
|
|
|
+ sk.status=3)
|
|
|
</if>
|
|
|
LEFT JOIN sys_user ur ON sk.user_id = ur.user_id
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
|
GROUP BY x1.nowData
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="queryCriticaliBySubId" resultType="java.util.Map">
|
|
|
+ select
|
|
|
+ t.subId,
|
|
|
+ cast((sum(t.critica)) as decimal(5,2)) as criticali
|
|
|
+ from (
|
|
|
+ select
|
|
|
+ s.subId,
|
|
|
+ ifnull((sum(s.suttle)/1000/1000/s.criticality), 0) as critica
|
|
|
+ from (
|
|
|
+ select
|
|
|
+ jo.sub_id as subId,
|
|
|
+ jo.chemical_id as chemicalId,
|
|
|
+ ifnull(che.criticality, 0) as criticality,
|
|
|
+ (s.usages - s.tare) as suttle
|
|
|
+ from hxp_stock s left join hxp_chemical_join_cabinet jo on s.join_id = jo.id
|
|
|
+ left join hxp_chemical che on jo.chemical_id = che.id
|
|
|
+ <where>
|
|
|
+ s.status != 2 and s.status != 3
|
|
|
+ <if test="subIds != null and subIds.size > 0">
|
|
|
+ and jo.sub_id in
|
|
|
+ <foreach item="id" collection="list" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) s
|
|
|
+ group by s.subId
|
|
|
+ ) t
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|