zhangf
2024-05-08 0414ddb0b2b3a7199ae6181a770f97ac140dbd73
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?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.gkhy.safePlatform.equipment.repository.MaterialReceiveRecordsBaseInfoRepository">
 
    <resultMap type="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseInfo" id="resultMap">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="material_name" property="materialName" jdbcType="VARCHAR"/>
        <result column="receive_uid" property="receiveId" jdbcType="BIGINT"/>
        <result column="receive_uname" property="receiveName" jdbcType="VARCHAR"/>
        <result column="receive_count" property="receiveCount" jdbcType="INTEGER"/>
        <result column="revert_count" property="revertCount" jdbcType="INTEGER"/>
        <result column="consume_count" property="consumeCount" jdbcType="INTEGER"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="remark" property="remark" jdbcType="VARCHAR"/>
        <result column="sm_id" property="smId" jdbcType="BIGINT"/>
        <result column="del_flag" property="delFlag" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="create_uid" property="createUid" jdbcType="BIGINT"/>
        <result column="create_uname" property="createUname" jdbcType="VARCHAR"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="update_uid" property="updateUid" jdbcType="BIGINT"/>
        <result column="update_uname" property="updateUname" jdbcType="VARCHAR"/>
    </resultMap>
    <select id="listByConditions" resultType="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseDO">
        SELECT b.id,
               b.material_name,
               b.receive_uid,
               b.receive_uname,
               b.receive_count,
               b.revert_count,
               b.consume_count,
               b.status,
               b.remark,
               b.create_time,
               b.sm_id,
               s.dep_id,
               s.dep_name
               from material_receive_records_base b
                inner join safe_material s on b.sm_id = s.id
                where b.del_flag = 0
                <if test="query.materialName != null and query.materialName != '' ">
                    and instr(b.material_name,#{query.materialName})>0
                </if>
                <if test="query.receiveUname != null and query.receiveUname != '' ">
                    and instr(b.receive_uname,#{query.receiveUname})>0
                </if>
                <if test="query.depId != null">
                    and s.dep_id = #{query.depId}
                </if>
                <if test="query.startTime != null ">
                    and DATE_FORMAT(b.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{query.startTime},'%Y-%m-%d')
                </if>
                <if test="query.endTime != null ">
                    and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{query.endTime},'%Y-%m-%d')
                </if>
                order by b.create_time desc
    </select>
 
</mapper>