This commit is contained in:
LiJianZhao 2025-04-30 10:34:26 +08:00
parent 9ac8ef0eee
commit 10929596a4
4 changed files with 16 additions and 25 deletions

View File

@ -4,7 +4,8 @@ import lombok.Data;
@Data @Data
public class DockerSearchQuery { public class DockerSearchQuery {
private String name; private String keyword;
private Integer sectionId;
private Integer role; private Integer role;
} }

View File

@ -2,6 +2,7 @@ package com.syjiaer.clinic.server.mapper.organization;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.syjiaer.clinic.server.entity.organization.OrganizationMember; import com.syjiaer.clinic.server.entity.organization.OrganizationMember;
import com.syjiaer.clinic.server.entity.organization.dto.DockerSearchQuery;
import com.syjiaer.clinic.server.entity.organization.vo.MemberVo; import com.syjiaer.clinic.server.entity.organization.vo.MemberVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@ -20,6 +21,6 @@ import java.util.List;
*/ */
public interface OrganizationMemberMapper extends BaseMapper<OrganizationMember> { public interface OrganizationMemberMapper extends BaseMapper<OrganizationMember> {
List<MemberVo> selectDetailByIds(@Param("ids") List<Integer> ids); List<MemberVo> selectDetailByQuery(DockerSearchQuery query);
} }

View File

@ -153,21 +153,6 @@ public class OrganizationMemberService extends BaseService {
if (dockerSearchQuery == null){ if (dockerSearchQuery == null){
return new ArrayList<>(); return new ArrayList<>();
} }
QueryWrapper<OrganizationMember> queryWrapper = new QueryWrapper<>(); return organizationMemberMapper.selectDetailByQuery(dockerSearchQuery);
queryWrapper.select("id");
if (dockerSearchQuery.getName() != null){
queryWrapper.like("name", dockerSearchQuery.getName());
}
if (dockerSearchQuery.getSectionId() != null){
queryWrapper.eq("section_id", dockerSearchQuery.getSectionId());
}
if (dockerSearchQuery.getRole() != null){
queryWrapper.eq("role", dockerSearchQuery.getRole());
}
List<Integer> ids = organizationMemberMapper.selectObjs(queryWrapper);
return organizationMemberMapper.selectDetailByIds(ids);
} }
} }

View File

@ -2,13 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.syjiaer.clinic.server.mapper.organization.OrganizationMemberMapper"> <mapper namespace="com.syjiaer.clinic.server.mapper.organization.OrganizationMemberMapper">
<select id="selectDetailByIds" resultType="com.syjiaer.clinic.server.entity.organization.vo.MemberVo"> <select id="selectDetailByQuery" resultType="com.syjiaer.clinic.server.entity.organization.vo.MemberVo">
SELECT om.*,os.name AS section_name SELECT om.*,os.name AS section_name
FROM organization_member AS om LEFT JOIN organization_section AS os ON om.section_id = os.id FROM organization_member AS om LEFT JOIN organization_section AS os ON om.section_id = os.id
WHERE om.id IN <where>
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=","> <if test="keyword != null and keyword != ''">
#{id} om.name LIKE concat('%', #{keyword}, '%')
</foreach> or os.name LIKE concat('%', #{keyword}, '%')
</if>
<if test="role != null">
And om.role = #{role}
</if>
</where>
</select> </select>
</mapper> </mapper>