| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?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="cn.iocoder.yudao.module.iscs.dal.mysql.materials.MaterialsMapper">
- <!--
- 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
- 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
- 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
- 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
- -->
- <select id="getIsMaterialsPage"
- resultType="cn.iocoder.yudao.module.iscs.controller.admin.materials.vo.MaterialsRespVO">
- SELECT
- m.*,
- t.materials_type_name,
- c.cabinet_name,
- t.materials_type_icon,
- t.materials_type_picture
- FROM
- isc_materials m
- LEFT JOIN isc_materials_type t ON t.id = m.materials_type_id
- LEFT JOIN isc_materials_cabinet c ON c.id = m.materials_cabinet_id
- <where>
- m.deleted = 0
- <if test="vo.materialsCode != null and vo.materialsCode.trim != ''">
- and m.materials_code like concat('%',#{vo.materialsCode},'%')
- </if>
- <if test="vo.materialsName != null and vo.materialsName.trim != ''">
- and m.materials_name like concat('%',#{vo.materialsName},'%')
- </if>
- <if test="vo.loanState != null and vo.loanState.trim != ''">
- and m.loan_state = #{vo.loanState}
- </if>
- <if test="vo.status != null and vo.status.trim != ''">
- and m.status = #{vo.status}
- </if>
- <if test="vo.materialsCabinetId != null and vo.materialsCabinetId > 0">
- and m.materials_cabinet_id = #{vo.materialsCabinetId}
- </if>
- <if test="vo.materialsCabinetId != null and vo.materialsCabinetId == 0">
- and (m.materials_cabinet_id is null or m.materials_cabinet_id = 0)
- </if>
- <if test="vo.materialsTypeId != null">
- and m.materials_type_id = #{vo.materialsTypeId}
- </if>
- <if test="vo.startTime != null and vo.startTime.trim != ''">
- and m.create_time >= #{vo.startTime}
- </if>
- <if test="vo.endTime != null and vo.endTime.trim != ''">
- and m.create_time <= #{vo.endTime}
- </if>
- <if test="vo.startExpirationDate != null and vo.startExpirationDate.trim != ''">
- and m.expiration_date >= #{vo.startExpirationDate}
- </if>
- <if test="vo.endExpirationDate != null and vo.endExpirationDate.trim != ''">
- and m.expiration_date <= #{vo.endExpirationDate}
- </if>
- <if test="vo.supplier != null and vo.supplier.trim != ''">
- and m.supplier like concat('%',#{vo.supplier},'%')
- </if>
- <if test="vo.materialsRfid != null and vo.materialsRfid.trim != ''">
- and m.materials_rfid like concat('%',#{vo.materialsRfid},'%')
- </if>
- <if test="vo.propertyId != null and vo.propertyId.trim != ''">
- and m.properties like concat('%',#{vo.propertyId},'%')
- </if>
- <if test="vo.recordId != null and vo.recordId.trim != ''">
- and m.properties like concat('%',#{vo.recordId},'%')
- </if>
- </where>
- ORDER BY m.id DESC
- </select>
- <select id="getExMaterials"
- resultType="cn.iocoder.yudao.module.iscs.controller.admin.materials.vo.MaterialsRespVO">
- SELECT
- m.*,
- t.materials_type_name,
- c.cabinet_name,
- t.materials_type_icon,
- t.materials_type_picture
- FROM
- isc_materials m
- LEFT JOIN isc_materials_type t ON t.id = m.materials_type_id
- LEFT JOIN isc_materials_cabinet c ON c.id = m.materials_cabinet_id
- <where>
- m.deleted = 0 and
- m.materials_id in
- <foreach collection="materialsIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </where>
- </select>
- <select id="getCheckMaterialsByCabinetId"
- resultType="cn.iocoder.yudao.module.iscs.controller.admin.hardwareapi.hardwareMaterialApi.CheckMaterialsDateVO">
- SELECT
- m.id as materials_id,
- m.materials_name,
- m.status,
- m.materials_cabinet_id,
- m.materials_type_id,
- m.materials_rfid,
- t.materials_type_name,
- t.materials_type_icon,
- t.materials_type_picture,
- t.check_standard
- FROM
- isc_materials m
- LEFT JOIN isc_materials_type t ON t.id = m.materials_type_id
- where m.materials_cabinet_id = #{cabinetId} and m.loan_state = "1"
- </select>
- </mapper>
|