devicesmgt/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaintenanceGangMapper.xml

63 lines
2.5 KiB
XML
Raw Normal View History

<?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.bonus.sgzb.base.mapper.MaintenanceGangMapper">
<insert id="add">
insert into ma_type_repair(type_id, user_id,company_id ,time) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.typeIds},#{item.userId},#{item.companyId},NOW())
</foreach>
</insert>
<delete id="deleteByIds">
DELETE FROM ma_type_repair WHERE `type_id` = #{typeId}
</delete>
<delete id="deleteByIdsAll">
delete from ma_type_repair where type_id in
<foreach item="typeIds" collection="array" open="(" separator="," close=")">
#{typeIds}
</foreach>
</delete>
<select id="getMaintenanceGangInfoAll" resultType="com.bonus.sgzb.base.domain.MaintenanceGang">
2024-04-29 17:42:02 +08:00
SELECT mt.type_id as modelId ,
mt.type_name as modelName,
mt2.type_id,
mt2.type_name as typeName,
mt3.type_id as typeId,
mt3.type_id as kindId,
mt4.type_name as kindName,
su.user_id as userId,
su.nick_name as userName
FROM ma_type mt
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id AND mt2.`level` = '3'
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id AND mt3.`level` = '2'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.`level` = '1'
LEFT JOIN ma_type_repair mtk ON mtk.type_id = mt.type_id
LEFT JOIN sys_user su ON su.user_id = mtk.user_id
WHERE mt.`level` = '4' AND mt.`del_flag` = '0'
<if test="typeName != null and typeName != ''">
2024-04-29 17:42:02 +08:00
AND mt2.type_name like concat('%', #{typeName}, '%')
</if>
2024-11-25 16:33:12 +08:00
ORDER BY su.user_id DESC, mt.type_id DESC
</select>
<select id="getMaUserList" resultType="com.bonus.sgzb.base.domain.MaintenanceGang">
2024-06-26 09:35:50 +08:00
SELECT DISTINCT
su.user_id AS userId,
su.nick_name AS userName
FROM
`sys_user` su
LEFT JOIN sys_user_role sur ON su.user_id = sur.user_id
LEFT JOIN sys_role sr ON sr.role_id = sur.role_id
2024-06-26 09:35:50 +08:00
WHERE
sr.role_id in (133,134)
AND su.del_flag = '0'
<if test="userName != null and userName != ''">
2024-03-11 17:35:30 +08:00
AND su.nick_name like concat('%', #{userName}, '%')
</if>
ORDER BY su.user_id DESC
</select>
</mapper>