lidongdong
2022-10-08 43bf83f004149bf7bb92ba343c539dff5c335af8
新增组织机构部门下属查询接口
3个文件已修改
64 ■■■■■ 已修改文件
flower_city/src/main/java/com/dg/core/controller/OrganizationController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/entity/OrganizationChartEntity.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/OrganizationChartMapper.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/controller/OrganizationController.java
@@ -18,6 +18,7 @@
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@@ -127,4 +128,52 @@
    }
    /**
     * 通过父级id查询对应机构下的全部部门id
     * @param departmentId
     * @return
     */
    @ApiOperation(value = "根据id查取消组织机构",response = OrganizationChartEntity.class)
    @GetMapping("/getdepartment")
    public TableDataInfo getIds(@RequestParam(value = "department",required = false) String departmentId)
    {
        List<OrganizationChartEntity> ids=new ArrayList<>();
        List<OrganizationChartEntity> lists = iOrganizationChartService.selectConfigList(departmentId,"");
        if(lists.size()<1)
        {
            lists.add(iOrganizationChartService.selectConfigById(departmentId));
        }
        ids=disposestreetId(lists);
        if(ids.size()<1)
        {
            return null;
        }
//        ids.add(streetId);
        ids.add(iOrganizationChartService.selectConfigById(departmentId));
        return getDataTable(ids);
    }
    //递归取id
    private List<OrganizationChartEntity> disposestreetId(List<OrganizationChartEntity> lists)
    {
        List<OrganizationChartEntity> ids=new ArrayList<>();
        for (OrganizationChartEntity sysStreet:lists)
        {
            ids.add(sysStreet);
            if(sysStreet.getChild()!=null && sysStreet.getChild().size()>0)
            {
                ids.addAll(disposestreetId(sysStreet.getChild()));
            }
            else
            {
                ids.add(sysStreet);
            }
        }
        return ids;
    }
}
flower_city/src/main/java/com/dg/core/db/gen/entity/OrganizationChartEntity.java
@@ -99,6 +99,12 @@
    private String contactNumber;
    /**
     * areaList
     */
    @ApiModelProperty("areaList")
    private String areaList;
    /**
     * 机构等级
     */
    @ApiModelProperty("部门应用")
flower_city/src/main/resources/mapper/OrganizationChartMapper.xml
@@ -17,6 +17,7 @@
        <id     property="contactNumber"      column="contact_number"      />
        <id     property="departmentalApplication"      column="departmental_application"      />
        <id     property="updateUserId"      column="update_user_id"      />
        <id     property="areaList"      column="area_list"      />
    </resultMap>
@@ -37,9 +38,12 @@
            city,
            district,
            village,
            (select name from area_code_2022 where city=area_code_2022.code) as cityName,
            (select name from area_code_2022 where district=area_code_2022.code) as districtName,
            (select name from area_code_2022 where village=area_code_2022.code) as villageName,
            detailed_address,
            grade,
            resume,contact_number
            resume,contact_number,area_list
        FROM
            automessage_organization_chart
    </sql>
@@ -99,6 +103,7 @@
        <if test="village != null and village != '' ">village,</if>
        <if test="detailedAddress != null and detailedAddress != '' ">detailed_address,</if>
        <if test="grade != null and grade != '' ">grade,</if>
        <if test="areaList != null and areaList != '' ">area_list,</if>
        update_time,
        create_time
        )values(
@@ -110,6 +115,7 @@
        <if test="village != null and village != '' ">#{village},</if>
        <if test="detailedAddress != null and detailedAddress != '' ">#{detailedAddress},</if>
        <if test="grade != null and grade != '' ">#{grade},</if>
        <if test="areaList != null and areaList != '' ">#{areaList},</if>
        sysdate(),
        sysdate()
        )
@@ -128,6 +134,7 @@
            <if test="grade != null and grade != '' ">grade=#{grade},</if>
            <if test="departmentalApplication != null and departmentalApplication != '' ">departmental_application=#{departmentalApplication},</if>
            <if test="updateUserId != null">update_user_id=#{updateUserId},</if>
            <if test="areaList != null and areaList != '' ">area_list=#{areaList},</if>
            update_time=sysdate()
        </set>
        where  id= #{id}