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

69 lines
2.7 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.WarehouseKeeperMapper">
<insert id="add">
insert into ma_type_keeper(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_keeper WHERE `type_id` = #{typeId}
</delete>
<delete id="deleteByIdsAll">
delete from ma_type_keeper where type_id in
<foreach item="typeIds" collection="array" open="(" separator="," close=")">
#{typeIds}
</foreach>
</delete>
<select id="getWarehouseKeeperInfoAll" resultType="com.bonus.sgzb.base.domain.WarehouseKeeper">
SELECT mt.type_id as modelId ,mt.type_name as modelName,
2024-04-11 10:40:04 +08:00
mt2.type_name as typeName,
mt4.type_name as kindName,
2024-06-04 18:10:42 +08:00
su.user_id as userId,
GROUP_CONCAT(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_keeper 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-01-22 21:02:51 +08:00
AND mt2.type_name like concat('%', #{typeName}, '%')
</if>
2025-03-21 15:19:32 +08:00
<if test="userId != null">
AND mtk.user_id = #{userId}
</if>
2024-11-22 10:00:54 +08:00
<if test="modelName != null and modelName != ''">
AND mt.type_name like concat('%', #{modelName}, '%')
</if>
2024-06-04 18:10:42 +08:00
GROUP BY mt.type_id
2024-11-25 16:12:25 +08:00
ORDER BY su.user_id DESC, mt.type_id DESC
</select>
<select id="getMaUserList" resultType="com.bonus.sgzb.base.domain.WarehouseKeeper">
2024-06-03 18:45:24 +08:00
SELECT distinct
2024-05-14 16:44:16 +08:00
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-05-14 16:44:16 +08:00
WHERE
sr.role_id IN ( '132', '139' )
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>
2024-06-06 17:59:23 +08:00
<select id="getUsers" resultType="java.lang.Integer">
select user_id from ma_type_keeper where type_id = #{typeId}
</select>
</mapper>