2024-09-14 11:31:53 +08:00
|
|
|
|
<?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.project.mapper.RepairWaresMapper">
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
|
|
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
|
|
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
|
|
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
|
|
|
-->
|
|
|
|
|
<select id="queryListPage" resultType="cn.iocoder.yudao.module.project.vo.RepairWaresRespVO">
|
2024-09-18 14:12:48 +08:00
|
|
|
|
SELECT
|
|
|
|
|
drw.*,
|
|
|
|
|
dbt.`name` AS typeName,
|
|
|
|
|
dbw.`name` AS warehouseName,
|
2024-11-27 15:12:15 +08:00
|
|
|
|
sdd.label AS unit_text,
|
2024-09-18 14:12:48 +08:00
|
|
|
|
GROUP_CONCAT( bc.corp_name ) AS corpNames
|
|
|
|
|
FROM
|
|
|
|
|
dl_repair_wares drw
|
|
|
|
|
LEFT JOIN base_company bc ON FIND_IN_SET( bc.id, drw.corp_id ) > 0
|
|
|
|
|
LEFT JOIN dl_base_type dbt ON drw.type = dbt.id AND dbt.deleted = 0
|
|
|
|
|
LEFT JOIN dl_base_warehouse dbw ON drw.warehouse = dbw.id AND dbw.deleted = 0
|
2024-11-27 15:12:15 +08:00
|
|
|
|
LEFT JOIN system_dict_data sdd ON drw.unit = sdd.value AND sdd.dict_type='repair_unit'
|
2024-09-18 14:12:48 +08:00
|
|
|
|
<where>
|
|
|
|
|
drw.deleted = 0
|
|
|
|
|
<if test="entity.name != null and entity.name != ''">
|
2024-09-25 17:44:20 +08:00
|
|
|
|
and drw.name like concat('%', #{entity.name}, '%')
|
2024-09-18 14:12:48 +08:00
|
|
|
|
</if>
|
2024-10-22 16:37:05 +08:00
|
|
|
|
<if test="entity.type != null and entity.type != ''">
|
|
|
|
|
and drw.type =#{entity.type}
|
|
|
|
|
</if>
|
2024-09-18 14:12:48 +08:00
|
|
|
|
</where>
|
|
|
|
|
GROUP BY
|
|
|
|
|
drw.id
|
|
|
|
|
ORDER BY
|
|
|
|
|
drw.create_time DESC
|
2024-09-14 11:31:53 +08:00
|
|
|
|
</select>
|
2024-10-11 17:15:27 +08:00
|
|
|
|
|
|
|
|
|
<select id="getWaresByName" resultType="cn.iocoder.yudao.module.project.vo.RepairWaresRespVO">
|
|
|
|
|
SELECT
|
|
|
|
|
drw.*,
|
|
|
|
|
dbt.`name` AS typeName,
|
|
|
|
|
dbw.`name` AS warehouseName,
|
|
|
|
|
GROUP_CONCAT( bc.corp_name ) AS corpNames
|
|
|
|
|
FROM
|
|
|
|
|
dl_repair_wares drw
|
|
|
|
|
LEFT JOIN base_company bc ON FIND_IN_SET( bc.id, drw.corp_id ) > 0
|
|
|
|
|
LEFT JOIN dl_base_type dbt ON drw.type = dbt.id AND dbt.deleted = 0
|
|
|
|
|
LEFT JOIN dl_base_warehouse dbw ON drw.warehouse = dbw.id AND dbw.deleted = 0
|
|
|
|
|
where drw.name = #{name} order by drw.create_time desc limit 1
|
|
|
|
|
</select>
|
2024-10-22 16:37:05 +08:00
|
|
|
|
<select id="selectAllType" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
2024-11-27 15:12:15 +08:00
|
|
|
|
tmp.type AS id,
|
2024-10-22 16:37:05 +08:00
|
|
|
|
dbt.`name`
|
|
|
|
|
FROM
|
|
|
|
|
( SELECT DISTINCT type FROM dl_repair_wares ) tmp
|
|
|
|
|
LEFT JOIN dl_base_type dbt ON tmp.type = dbt.id
|
2024-11-27 15:12:15 +08:00
|
|
|
|
WHERE tmp.type is not null AND tmp.type !=''
|
|
|
|
|
ORDER BY dbt.create_time DESC
|
2024-10-22 16:37:05 +08:00
|
|
|
|
</select>
|
2024-09-14 11:31:53 +08:00
|
|
|
|
</mapper>
|