ZengTao
2024-08-02 0929a160e01178712fb1d8bba7bdf0dc716a0cd7
hangzhoumesParent/moduleService/GlassStorageModule/src/main/resources/mapper/ShelfRackMapper.xml
@@ -2,15 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mes.shelfrack.mapper.ShelfRackMapper">
        <select id="selectshelf_rack" resultType="java.util.Map">
        <![CDATA[
            SELECT a.number, b.raw_type, b.raw_width, b.raw_height, b.raw_thickness, b.left_pieces, a.mod_time, a.enable_state, b.pieces,
                   datediff(now(), b.create_time) as rukutime,
                   concat(if(ROUND(b.left_pieces / b.pieces * 100, 0) < 20, 20, ROUND(b.left_pieces / b.pieces * 100, 0)), '%') as bfb
            FROM shelf_rack AS a
                     LEFT JOIN raw_usage AS b ON a.raw_package_id = b.id
            ]]>
    </select>
    <resultMap id="ShelfRackResultMap" type="com.mes.shelfrack.entity.request.RawUsageAndShelfRack">
        <result property="number" column="number"/>
        <result property="rawType" column="raw_type"/>
        <result property="rawWidth" column="raw_width"/>
        <result property="rawHeight" column="raw_height"/>
        <result property="rawThickness" column="raw_thickness"/>
        <result property="enableState" column="enable_state"/>
        <result property="pieces" column="pieces"/>
        <result property="createTime" column="createTime"  />
        <result property="batchId" column="batch_id"/>
    </resultMap>
    <select id="selectshelf_rack" resultMap="ShelfRackResultMap">
    <![CDATA[
        SELECT a.number, b.raw_type, b.raw_width, b.raw_height, b.raw_thickness, a.enable_state, b.pieces,
               b.batch_id,DATE_FORMAT(b.create_time, '%Y-%m-%d %H:%i:%s') as createTime
        FROM shelf_rack AS a
                 LEFT JOIN raw_usage AS b ON a.raw_package_id = b.id
        ]]>
</select>
</mapper>