LIVE_YE hace 1 año
padre
commit
f41959ee53

+ 105 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/info/OrientationInfoController.java

@@ -0,0 +1,105 @@
+package org.dromara.system.controller.info;
+
+import java.util.List;
+
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.system.domain.vo.OrientationInfoVo;
+import org.dromara.system.domain.bo.OrientationInfoBo;
+import org.dromara.system.service.IOrientationInfoService;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+
+/**
+ * 定位信息
+ *
+ * @author boman
+ * @date 2023-08-30
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/orientation/info")
+public class OrientationInfoController extends BaseController {
+
+    private final IOrientationInfoService orientationInfoService;
+
+    /**
+     * 查询定位信息列表
+     */
+    @SaCheckPermission("orientation:info:list")
+    @GetMapping("/list")
+    public TableDataInfo<OrientationInfoVo> list(OrientationInfoBo bo, PageQuery pageQuery) {
+        return orientationInfoService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出定位信息列表
+     */
+    @SaCheckPermission("orientation:info:export")
+    @Log(title = "定位信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(OrientationInfoBo bo, HttpServletResponse response) {
+        List<OrientationInfoVo> list = orientationInfoService.queryList(bo);
+        ExcelUtil.exportExcel(list, "定位信息", OrientationInfoVo.class, response);
+    }
+
+    /**
+     * 获取定位信息详细信息
+     *
+     * @param id 主键
+     */
+    @SaCheckPermission("orientation:info:query")
+    @GetMapping("/{id}")
+    public R<OrientationInfoVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable Long id) {
+        return R.ok(orientationInfoService.queryById(id));
+    }
+
+    /**
+     * 新增定位信息
+     */
+    @SaCheckPermission("orientation:info:add")
+    @Log(title = "定位信息", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody OrientationInfoBo bo) {
+        return toAjax(orientationInfoService.insertByBo(bo));
+    }
+
+    /**
+     * 修改定位信息
+     */
+    @SaCheckPermission("orientation:info:edit")
+    @Log(title = "定位信息", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PostMapping("/put")
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody OrientationInfoBo bo) {
+        return toAjax(orientationInfoService.updateByBo(bo));
+    }
+
+    /**
+     * 删除定位信息
+     *
+     * @param ids 主键串
+     */
+    @SaCheckPermission("orientation:info:remove")
+    @Log(title = "定位信息", businessType = BusinessType.DELETE)
+    @GetMapping("/delete/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable Long[] ids) {
+        return toAjax(orientationInfoService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 63 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/OrientationInfo.java

@@ -0,0 +1,63 @@
+package org.dromara.system.domain;
+
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+
+/**
+ * 定位信息对象 orientation_info
+ *
+ * @author boman
+ * @date 2023-08-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("orientation_info")
+public class OrientationInfo extends BaseEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    private String tenantId;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+
+    /**
+     * 用户名
+     */
+    private String userName;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 经度
+     */
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    private String latitude;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 68 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/OrientationInfoBo.java

@@ -0,0 +1,68 @@
+package org.dromara.system.domain.bo;
+
+import org.dromara.system.domain.OrientationInfo;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+
+/**
+ * 定位信息业务对象 orientation_info
+ *
+ * @author boman
+ * @date 2023-08-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = OrientationInfo.class, reverseConvertGenerate = false)
+public class OrientationInfoBo extends BaseEntity {
+
+    /**
+     * ID
+     */
+    //@NotBlank(message = "ID不能为空", groups = { EditGroup.class })
+    private Long id;
+
+    private String tenantId;
+
+    /**
+     * 用户id
+     */
+    //@NotBlank(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
+    private Long userId;
+
+    /**
+     * 用户名
+     */
+    @NotBlank(message = "用户名不能为空", groups = { AddGroup.class, EditGroup.class })
+    private String userName;
+
+    /**
+     * 地址
+     */
+    @NotBlank(message = "地址不能为空", groups = { AddGroup.class, EditGroup.class })
+    private String address;
+
+    /**
+     * 经度
+     */
+    @NotBlank(message = "经度不能为空", groups = { AddGroup.class, EditGroup.class })
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    @NotBlank(message = "纬度不能为空", groups = { AddGroup.class, EditGroup.class })
+    private String latitude;
+
+    /**
+     * 备注
+     */
+    @NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
+    private String remark;
+
+
+}

+ 96 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/OrientationInfoVo.java

@@ -0,0 +1,96 @@
+package org.dromara.system.domain.vo;
+
+import org.dromara.system.domain.OrientationInfo;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+
+/**
+ * 定位信息视图对象 orientation_info
+ *
+ * @author boman
+ * @date 2023-08-30
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = OrientationInfo.class)
+public class OrientationInfoVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    @ExcelProperty(value = "ID")
+    private Long id;
+
+    private String tenantId;
+
+    /**
+     * 用户id
+     */
+    @ExcelProperty(value = "用户id")
+    private Long userId;
+
+    /**
+     * 用户名
+     */
+    @ExcelProperty(value = "用户名")
+    private String userName;
+
+    /**
+     * 地址
+     */
+    @ExcelProperty(value = "地址")
+    private String address;
+
+    /**
+     * 经度
+     */
+    @ExcelProperty(value = "经度")
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    @ExcelProperty(value = "纬度")
+    private String latitude;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    /**
+     * 创建者
+     */
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新者
+     */
+    private Long updateBy;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+
+}

+ 20 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/OrientationInfoMapper.java

@@ -0,0 +1,20 @@
+package org.dromara.system.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+import org.dromara.system.domain.OrientationInfo;
+import org.dromara.system.domain.vo.OrientationInfoVo;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+/**
+ * 定位信息Mapper接口
+ *
+ * @author boman
+ * @date 2023-08-30
+ */
+public interface OrientationInfoMapper extends BaseMapperPlus<OrientationInfo, OrientationInfoVo> {
+
+    Page<OrientationInfoVo> selectVoMapperPage(@Param("page")Page<Object> build,  @Param(Constants.WRAPPER)LambdaQueryWrapper<OrientationInfo> lqw);
+}

+ 2 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java

@@ -68,4 +68,6 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
 
     @InterceptorIgnore(tenantLine = "true")
     List<SysDeptVo> selectDeptListMapperByIdList(List<Long> deptIdList);
+
+    List<SysDeptVo> selectDeptSelfListMapper(SysDeptBo dept);
 }

+ 49 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/IOrientationInfoService.java

@@ -0,0 +1,49 @@
+package org.dromara.system.service;
+
+import org.dromara.system.domain.OrientationInfo;
+import org.dromara.system.domain.vo.OrientationInfoVo;
+import org.dromara.system.domain.bo.OrientationInfoBo;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 定位信息Service接口
+ *
+ * @author boman
+ * @date 2023-08-30
+ */
+public interface IOrientationInfoService {
+
+    /**
+     * 查询定位信息
+     */
+    OrientationInfoVo queryById(Long id);
+
+    /**
+     * 查询定位信息列表
+     */
+    TableDataInfo<OrientationInfoVo> queryPageList(OrientationInfoBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询定位信息列表
+     */
+    List<OrientationInfoVo> queryList(OrientationInfoBo bo);
+
+    /**
+     * 新增定位信息
+     */
+    Boolean insertByBo(OrientationInfoBo bo);
+
+    /**
+     * 修改定位信息
+     */
+    Boolean updateByBo(OrientationInfoBo bo);
+
+    /**
+     * 校验并批量删除定位信息信息
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 0 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/CourseChangeServiceImpl.java

@@ -125,7 +125,6 @@ public class CourseChangeServiceImpl implements ICourseChangeService {
         lqw.eq(bo.getSubjectTime() != null, CourseChange::getSubjectTime, bo.getSubjectTime());
         lqw.eq(StringUtils.isNotBlank(bo.getSubjectWeek()), CourseChange::getSubjectWeek, bo.getSubjectWeek());
         lqw.eq(StringUtils.isNotBlank(bo.getBePersonnel()), CourseChange::getBePersonnel, bo.getBePersonnel());
-        lqw.eq(bo.getBePersonnelId()!= null, CourseChange::getBePersonnelId, bo.getBePersonnelId());
         lqw.eq(StringUtils.isNotBlank(bo.getBeSubject()), CourseChange::getBeSubject, bo.getBeSubject());
         lqw.eq(StringUtils.isNotBlank(bo.getBeIsNum()), CourseChange::getBeIsNum, bo.getBeIsNum());
         lqw.eq(bo.getBeSubjectTime() != null, CourseChange::getBeSubjectTime, bo.getBeSubjectTime());

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/CourseTableServiceImpl.java

@@ -200,7 +200,7 @@ public class CourseTableServiceImpl implements ICourseTableService {
         table.setSchoolId(bo.getSchoolId());
         table.setClassId(bo.getClassId());
         table.setWeek(bo.getWeek());
-        LambdaQueryWrapper<CourseTable> lqw = buildQueryWrapper(bo);
+        LambdaQueryWrapper<CourseTable> lqw = buildQueryWrapper(table);
         List<CourseTableVo> courseTableList = baseMapper.selectVoList(lqw);
         if(courseTableList!=null && courseTableList.size()>0){
             return R.fail("当前课表已存在,请前去修改");

+ 121 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/OrientationInfoServiceImpl.java

@@ -0,0 +1,121 @@
+package org.dromara.system.service.impl;
+
+import org.dromara.common.core.domain.model.LoginUser;
+import org.dromara.common.core.utils.DateUtils;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.satoken.utils.LoginHelper;
+import org.springframework.stereotype.Service;
+import org.dromara.system.domain.bo.OrientationInfoBo;
+import org.dromara.system.domain.vo.OrientationInfoVo;
+import org.dromara.system.domain.OrientationInfo;
+import org.dromara.system.mapper.OrientationInfoMapper;
+import org.dromara.system.service.IOrientationInfoService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * 定位信息Service业务层处理
+ *
+ * @author boman
+ * @date 2023-08-30
+ */
+@RequiredArgsConstructor
+@Service
+public class OrientationInfoServiceImpl implements IOrientationInfoService {
+
+    private final OrientationInfoMapper baseMapper;
+
+    /**
+     * 查询定位信息
+     */
+    @Override
+    public OrientationInfoVo queryById(Long id){
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 查询定位信息列表
+     */
+    @Override
+    public TableDataInfo<OrientationInfoVo> queryPageList(OrientationInfoBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<OrientationInfo> lqw = buildQueryWrapper(bo);
+        Page<OrientationInfoVo> result = baseMapper.selectVoMapperPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询定位信息列表
+     */
+    @Override
+    public List<OrientationInfoVo> queryList(OrientationInfoBo bo) {
+        LambdaQueryWrapper<OrientationInfo> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<OrientationInfo> buildQueryWrapper(OrientationInfoBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<OrientationInfo> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getUserId() != null, OrientationInfo::getUserId, bo.getUserId());
+        lqw.like(StringUtils.isNotBlank(bo.getUserName()), OrientationInfo::getUserName, bo.getUserName());
+        lqw.eq(StringUtils.isNotBlank(bo.getAddress()), OrientationInfo::getAddress, bo.getAddress());
+        lqw.eq(StringUtils.isNotBlank(bo.getLongitude()), OrientationInfo::getLongitude, bo.getLongitude());
+        lqw.eq(StringUtils.isNotBlank(bo.getLatitude()), OrientationInfo::getLatitude, bo.getLatitude());
+        return lqw;
+    }
+
+    /**
+     * 新增定位信息
+     */
+    @Override
+    public Boolean insertByBo(OrientationInfoBo bo) {
+        LoginUser user = LoginHelper.getLoginUser();
+        bo.setUserId(user.getUserId());
+        bo.setUserName(user.getUsername());
+        bo.setCreateTime(DateUtils.getNowDate());
+        bo.setUpdateTime(DateUtils.getNowDate());
+        OrientationInfo add = MapstructUtils.convert(bo, OrientationInfo.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改定位信息
+     */
+    @Override
+    public Boolean updateByBo(OrientationInfoBo bo) {
+        OrientationInfo update = MapstructUtils.convert(bo, OrientationInfo.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(OrientationInfo entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 批量删除定位信息
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteBatchIds(ids) > 0;
+    }
+}

+ 21 - 7
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.dromara.common.core.constant.CacheNames;
 import org.dromara.common.core.constant.UserConstants;
+import org.dromara.common.core.domain.dto.RoleDTO;
 import org.dromara.common.core.domain.model.LoginUser;
 import org.dromara.common.core.exception.ServiceException;
 import org.dromara.common.core.service.DeptService;
@@ -379,21 +380,34 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
     @Override
     public List<SysDeptVo> pcSelfList(SysDeptBo dept) {
         LoginUser loginUser = LoginHelper.getLoginUser();
+        List<RoleDTO> roles = loginUser.getRoles();
 
         if("admin".equals(loginUser.getUsername())){
-            return baseMapper.selectDeptListMapper(dept);
+            return baseMapper.selectDeptSelfListMapper(dept);
         }else {
-            if("school".equals(loginUser.getUsername())){
-                dept.setDeptId(loginUser.getDeptId());
-                dept.setParentId(loginUser.getDeptId());
-                return baseMapper.selectDeptListMapper(dept);
-            }else if("teacher".equals(loginUser.getUsername())){
+            int type = 0;
+            for (RoleDTO role : roles) {
+                if("school".equals(role.getRoleKey())){
+                    type = 1;
+                    break;
+                }else if("teacher".equals(role.getRoleKey())){
+                    type = 2;
+                }
+            }
+            if(type==1){
+                if(dept.getParentId()==null || dept.getParentId()==0L){
+                    dept.setDeptId(loginUser.getDeptId());
+                }
+                return baseMapper.selectDeptSelfListMapper(dept);
+            }else if(type==2){
                 //查询老师的班级
                 FormalTeacherClassBo bo = new FormalTeacherClassBo();
                 bo.setTeacherId(loginUser.getUserId());
                 List<FormalTeacherClassVo> teacherClass = formalTeacherClassService.getTeacherClass(String.valueOf(loginUser.getUserId()));
                 List<Long> deptIdList = teacherClass.stream().map(FormalTeacherClassVo::getClassId).collect(Collectors.toList());
-                deptIdList.add(loginUser.getDeptId());
+                if(dept.getParentId()==null || dept.getParentId()==0L){
+                    deptIdList.add(loginUser.getDeptId());
+                }
                 return baseMapper.selectDeptListMapperByIdList(deptIdList);
             }
             return new ArrayList<>();

+ 29 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/OrientationInfoMapper.xml

@@ -0,0 +1,29 @@
+<?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="org.dromara.system.mapper.OrientationInfoMapper">
+
+    <resultMap type="org.dromara.system.domain.vo.OrientationInfoVo" id="OrientationInfoResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="userName"    column="user_name"    />
+        <result property="address"    column="address"    />
+        <result property="longitude"    column="longitude"    />
+        <result property="latitude"    column="latitude"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectOrientationInfoVo">
+        select id,tenant_id, user_id, user_name, address, longitude, latitude, create_by, create_time, update_by, update_time, remark from orientation_info
+    </sql>
+
+    <select id="selectVoMapperPage" resultMap="OrientationInfoResult">
+        <include refid="selectOrientationInfoVo"/>
+        ${ew.getCustomSqlSegment}
+    </select>
+</mapper>

+ 19 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -85,11 +85,29 @@
     <select id="selectDeptListMapperByIdList" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
         where d.del_flag = '0' and dept_id in
-        <foreach item="deptId" collection="array" open="(" separator="," close=")">
+        <foreach item="deptId" collection="list" open="(" separator="," close=")">
             #{deptId}
         </foreach>
     </select>
 
+    <select id="selectDeptSelfListMapper" resultMap="SysDeptResult">
+        <include refid="selectDeptVo"/>
+        where d.del_flag = '0'
+        <if test="deptId != null and deptId != 0">
+            AND (dept_id = #{deptId} or parent_id = #{deptId})
+        </if>
+        <if test="parentId != null and parentId != 0">
+			AND parent_id = #{parentId}
+		</if>
+        <if test="deptName != null and deptName != ''">
+            AND dept_name like concat('%', #{deptName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        order by d.parent_id, d.order_num
+    </select>
+
     <insert id="insertDeptList">
         insert into sys_dept(parent_id,dept_name,ancestors,order_num,status,create_time) values
         <foreach item="item" index="index" collection="list" separator=",">