select
distinct
a.id,
a.material_id,
a.user_id,
a.scrq,
b.name as materialName,
c.user_name as userName,
b.code as wllbCode,
c.real_name,
a.modify_time,
f.user_name as modifyUser
from tld_user_material a
left join tld_material b on a.material_id = b.code
left join tld_user c on a.user_id = c.id
left join tld_user f on a.modify_user = f.id
and a.material_id = #{materialId}
and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
and a.user_id = #{userId}
and a.id = #{id}
order by a.id desc
insert into tld_user_material(material_id,user_id,scrq,modify_user,modify_time) value(#{materialId},#{userId},now(),#{modifyUser},now())
update tld_user_material
material_id = #{materialId},
user_id = #{userId},
modify_user = #{modifyUser},modify_time=now(),
where id = #{id}
delete from tld_user_material where id = #{id}
select
a.id,
a.code,
a.user_name,
a.password,
a.real_name,
a.email,
a.landline,
a.phone,
a.department,
a.role,
b.menu
from tld_user a
left join tld_role b on a.role = b.id
select COUNT(*) from tld_material where code = #{wllbCode}
SELECT DISTINCT
b.CODE AS wllbCode,
b.NAME AS materialName,
c.user_name AS userName
FROM
tld_user_material a
LEFT JOIN tld_material b ON a.material_id = b.CODE
LEFT JOIN tld_user c ON a.user_id = c.id
and a.material_id = #{materialId}
and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
and c.user_name like CONCAT(CONCAT('%', #{userName}), '%')
and a.user_id = #{userId}
and a.id = #{id}
order by a.id desc