mitao
12 小时以前 5b13db7e2c95385d69b8bdb449560bbbfe359146
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
<?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.ruoyi.system.mapper.AssetAdMaterialPriceMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.AssetAdMaterialPrice">
        <id column="id" property="id" />
        <result column="material_name" property="materialName" />
        <result column="unit_price" property="unitPrice" />
        <result column="price_unit" property="priceUnit" />
        <result column="remarks" property="remarks" />
        <result column="create_time" property="createTime" />
        <result column="create_by" property="createBy" />
        <result column="update_time" property="updateTime" />
        <result column="update_by" property="updateBy" />
        <result column="disabled" property="disabled" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, material_name, unit_price, price_unit, remarks, create_time, create_by, update_time, update_by, disabled
    </sql>
 
    <!-- 分页查询 -->
    <select id="getPageList" resultType="com.ruoyi.system.vo.asset.AssetAdMaterialPriceVO">
        SELECT
            aamp.id,
            aamp.material_name,
            aamp.dept_id,
            aamp.unit_price,
            aamp.price_unit,
            aamp.remarks,
            aamp.create_time,
            aamp.create_by,
            aamp.update_time,
            aamp.update_by
        FROM asset_ad_material_price aamp LEFT JOIN t_dept td ON aamp.dept_id = td.id
        <where>
            aamp.disabled = 0
            <if test="query.materialName != null and query.materialName != ''">
                AND aamp.material_name LIKE CONCAT('%', #{query.materialName}, '%')
            </if>
            <if test="query.deptId != null">
                AND (td.id = #{query.deptId} OR FIND_IN_SET(#{query.deptId}, td.parent_id))
            </if>
        </where>
        ORDER BY aamp.create_time DESC
    </select>
 
</mapper>