接口逻辑补充零碎修改等

This commit is contained in:
mi9688 2024-10-21 17:41:45 +08:00
parent a8faa7cdeb
commit 655e22579c
14 changed files with 180 additions and 33 deletions

View File

@ -41,7 +41,7 @@ public class SysDistrictController extends BaseController
/** /**
* 查询行政区划树状列表 * 查询行政区划树状列表
*/ */
@PreAuthorize("@ss.hasPermi('system:district:list')") // @PreAuthorize("@ss.hasPermi('system:district:list')")
@GetMapping("/tree") @GetMapping("/tree")
@ApiOperation("查询行政区划树状列表") @ApiOperation("查询行政区划树状列表")
public AjaxResult tree(){ public AjaxResult tree(){

View File

@ -0,0 +1,9 @@
package com.fastbee.common.constant;
/**
* 项目级别常量
*/
public class ProjectLevelConstant {
public static final String LEVEL_CITY = "1";//市级
public static final String LEVEL_COUNTY = "2";//县级
}

View File

@ -61,7 +61,7 @@ public class ResourcesConfig implements WebMvcConfigurer
"/tool/gen/**"); "/tool/gen/**");
//配置项目数据隔离拦截器 //配置项目数据隔离拦截器
registry.addInterceptor(projectDataIsolationInterceptor) registry.addInterceptor(projectDataIsolationInterceptor)
.addPathPatterns("/gis/groups/**", "/gis/legend/**","/gis/site/**"); .addPathPatterns("/gis/groups/**", "/gis/legend/**","/gis/site/**","/project/**");
} }
/** /**

View File

@ -131,6 +131,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
//安防小板 //安防小板
.antMatchers("/iot/photos","/iot/photos/**","/yinghsiyun/webhook").permitAll() .antMatchers("/iot/photos","/iot/photos/**","/yinghsiyun/webhook").permitAll()
.antMatchers("/test/**/*").permitAll() .antMatchers("/test/**/*").permitAll()
.antMatchers("/system/district/tree").permitAll()
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated() .anyRequest().authenticated()

View File

@ -15,9 +15,11 @@ import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -49,18 +51,52 @@ public class ProjectDataIsolationInterceptor implements HandlerInterceptor {
if ("PUT".equalsIgnoreCase(request.getMethod())) { if ("PUT".equalsIgnoreCase(request.getMethod())) {
return true; return true;
} }
//获取路径中的查询字符串参数 //当前项目信息
String projectIds = request.getParameter("projectIds"); ProjectInfo projectInfo = ProjectInfo.builder().build();
if (StringUtils.isBlank(projectIds)) { //获取cookie
return true; Cookie[] requestCookies = request.getCookies();
//获取cookie中的projectIds父项目及其子项目id,projectId(当前项目id),userId当前管理员id
if (requestCookies != null) {
for (Cookie cookie : requestCookies){
//获取cookie中的projectIds
if ("projectIds".equals(cookie.getName())) {
byte[] decode = Base64.decode(cookie.getValue());
//转成List集合
String decodedStr = new String(decode);
if (StringUtils.isNotBlank(decodedStr)) {
JSONArray objects = JSONUtil.parseArray(decodedStr);
projectInfo.setProjectIdList(objects.toList(Long.class));
}
}
//获取cookie中的projectId
if ("projectId".equals(cookie.getName())) {
projectInfo.setProjectId(cookie.getValue());
}
//获取cookie中的userId
if ("userId".equals(cookie.getName())) {
projectInfo.setProjectAdminId(cookie.getValue());
}
} }
byte[] decode = Base64.decode(projectIds);
//转成List集合 }
String decodedStr = new String(decode); ProjectHolder.setProjectInfo(projectInfo);
JSONArray objects = JSONUtil.parseArray(decodedStr);
ProjectHolder.setProjectInfo(ProjectInfo.builder() // //获取路径中的查询字符串参数
.projectIdList(objects.toList(Long.class)) // String projectIds = request.getParameter("projectIds");
.build()); //
// //为空则是超级管理员不做数据隔离
// if (StringUtils.isBlank(projectIds)) {
// ProjectHolder.setProjectInfo(ProjectInfo.builder().projectId("").build());
// return true;
// }
// byte[] decode = Base64.decode(projectIds);
// //转成List集合
// String decodedStr = new String(decode);
// JSONArray objects = JSONUtil.parseArray(decodedStr);
// ProjectHolder.setProjectInfo(ProjectInfo.builder()
// .projectIdList(objects.toList(Long.class))
// .build());
return true; return true;
} }
@Override @Override

View File

@ -130,10 +130,10 @@ public class GGroupsController extends BaseController
/** /**
* 删除组 * 删除组
*/ */
@DeleteMapping("/{ids}") @DeleteMapping("/{id}")
@ApiOperation("删除组") @ApiOperation("删除组")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long id)
{ {
return toAjax(gGroupsService.deleteGGroupsByIds(ids)); return toAjax(gGroupsService.deleteGGroupsById(id));
} }
} }

View File

@ -86,6 +86,15 @@ public class ProjectController extends BaseController
{ {
return success(projectService.selectProjectByProjectId(projectId)); return success(projectService.selectProjectByProjectId(projectId));
} }
/**
* 查询管理员项目切换下拉框数据
*/
@GetMapping("/adminProjectList")
// @PreAuthorize("@ss.hasPermi('iot:project:adminProjectList')")
@ApiOperation("查询管理员项目切换下拉框数据")
public AjaxResult getAdminProjectList(){
return success(projectService.selectAdminProjectList());
}
/** /**
* 新增项目 * 新增项目

View File

@ -65,6 +65,11 @@ public interface IGGroupsService
*/ */
public int deleteGGroupsById(Long id); public int deleteGGroupsById(Long id);
/**
* 查询组和站点(叶子节点)的树状结构
* @param gGroups
* @return 列表
*/
List<?> selectGGroupsAndSitesList(GGroups gGroups); List<?> selectGGroupsAndSitesList(GGroups gGroups);
} }

View File

@ -62,11 +62,12 @@ public class GGroupsServiceImpl implements IGGroupsService
@Override @Override
public List<GGroups> selectGGroupsList(GGroups gGroups) public List<GGroups> selectGGroupsList(GGroups gGroups)
{ {
// List<GGroups> gGroupsList = gGroupsMapper.selectGGroupsList(gGroups);
List<GGroups> list = new LambdaQueryChainWrapper<>(gGroupsMapper).select(GGroups::getId, GGroups::getName, GGroups::getIcon, List<GGroups> list = new LambdaQueryChainWrapper<>(gGroupsMapper).select(GGroups::getId, GGroups::getName, GGroups::getIcon,
GGroups::getTag, GGroups::getParentId, GGroups::getProjectId, GGroups::getProjectName, GGroups::getTag, GGroups::getParentId, GGroups::getProjectId, GGroups::getProjectName,
GGroups::getOrderNum, GGroups::getSpace) GGroups::getOrderNum, GGroups::getSpace)
.in(GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList()) .in(Objects.nonNull(ProjectHolder.getProjectInfo().getProjectIdList())&&gGroups.getProjectId()==null,
GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList())
.eq(gGroups.getProjectId()!=null, GGroups::getProjectId, gGroups.getProjectId())
.list(); .list();
return buildTree(list); return buildTree(list);
} }
@ -86,7 +87,7 @@ public class GGroupsServiceImpl implements IGGroupsService
.leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId) .leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId)
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId) .leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
.eq(GSiteGroups::getParentId, gGroups.getParentId()) .eq(GSiteGroups::getParentId, gGroups.getParentId())
.like(StringUtils.isNotBlank(gGroups.getName()), GGroups::getName, gGroups.getName()); .like(StringUtils.isNotBlank(gGroups.getSearchValue()), GSites::getName, gGroups.getSearchValue());
return gSiteGroupsMapper.selectJoinList(GGroupSiteVo.class,gSiteGroupsMPJLambdaWrapper); return gSiteGroupsMapper.selectJoinList(GGroupSiteVo.class,gSiteGroupsMPJLambdaWrapper);
} }
@ -217,6 +218,7 @@ public class GGroupsServiceImpl implements IGGroupsService
@Override @Override
public int deleteGGroupsById(Long id) public int deleteGGroupsById(Long id)
{ {
//判断组下面是否有节点
return gGroupsMapper.deleteGGroupsById(id); return gGroupsMapper.deleteGGroupsById(id);
} }
@ -232,7 +234,7 @@ public class GGroupsServiceImpl implements IGGroupsService
GGroups::getIcon,GGroups::getTag, GGroups::getIcon,GGroups::getTag,
GGroups::getSpace, GGroups::getSpaceValue, GGroups::getProjectId) GGroups::getSpace, GGroups::getSpaceValue, GGroups::getProjectId)
.eq(Objects.nonNull(gGroups.getTag()), GGroups::getTag, gGroups.getTag()) .eq(Objects.nonNull(gGroups.getTag()), GGroups::getTag, gGroups.getTag())
.in(GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList()) .in(Objects.nonNull(ProjectHolder.getProjectInfo().getProjectIdList()),GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList())
.list(); .list();
System.err.println(ProjectHolder.getProjectInfo()); System.err.println(ProjectHolder.getProjectInfo());
list.forEach(System.err::println); list.forEach(System.err::println);

View File

@ -13,6 +13,7 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONException; import cn.hutool.json.JSONException;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fastbee.common.config.RuoYiConfig; import com.fastbee.common.config.RuoYiConfig;
import com.fastbee.common.exception.ServiceException; import com.fastbee.common.exception.ServiceException;
@ -200,7 +201,27 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int deleteGSitesById(Long id) { public int deleteGSitesById(Long id) {
//判断该站点是否跟其他组建立关系没有跟其他组建立关系则删除关联并删除该站点
List<GSiteGroups> gSiteGroupsList = new LambdaQueryChainWrapper<>(gSiteGroupsMapper)
.select(GSiteGroups::getParentId, GSiteGroups::getSiteId)
.eq(GSiteGroups::getId, id)
.list();
List<GSiteGroups> gSiteGroupsList1 = new LambdaQueryChainWrapper<>(gSiteGroupsMapper)
.select(GSiteGroups::getParentId, GSiteGroups::getSiteId)
.eq(GSiteGroups::getSiteId, gSiteGroupsList.get(0).getSiteId())
.ne(GSiteGroups::getParentId, gSiteGroupsList.get(0).getParentId())
.list();
//没有跟其他组建立关联
if (gSiteGroupsList1.isEmpty()){
//删除关联
int deleteGSiteGroupsById = gSiteGroupsMapper.deleteById(id);
//删除站点
int deleteSitesById= gSitesMapper.deleteById(gSiteGroupsList.get(0).getSiteId());
return deleteSitesById==1&& deleteGSiteGroupsById==1? 1 : 0;
}
//如果有跟其他组建立关系只删除跟当前组的关系
return gSiteGroupsMapper.deleteById(id); return gSiteGroupsMapper.deleteById(id);
} }
/** /**
@ -212,6 +233,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
public int relateGroup(GGroupSiteRelateDto gGroupSiteRelateDto) { public int relateGroup(GGroupSiteRelateDto gGroupSiteRelateDto) {
return super.saveBatch(gGroupSiteRelateDto.getSiteIds() return super.saveBatch(gGroupSiteRelateDto.getSiteIds()
.stream() .stream()
//转成数据库存储对象
.map(siteId -> { .map(siteId -> {
GSiteGroups gSiteGroups = new GSiteGroups(); GSiteGroups gSiteGroups = new GSiteGroups();
gSiteGroups.setSiteId(siteId); gSiteGroups.setSiteId(siteId);
@ -219,6 +241,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
}) })
.collect(Collectors.toList()) .collect(Collectors.toList())
.stream() .stream()
//设置项目id,所属组id
.peek(item -> { .peek(item -> {
item.setParentId(gGroupSiteRelateDto.getParentId()); item.setParentId(gGroupSiteRelateDto.getParentId());
item.setProjectId(gGroupSiteRelateDto.getProjectId()); item.setProjectId(gGroupSiteRelateDto.getProjectId());
@ -226,15 +249,19 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
.collect(Collectors.toList()))? 1 : 0; .collect(Collectors.toList()))? 1 : 0;
} }
/**
* 搜索站点列表
* @param gSites 站点对象
* @return 结果
*/
@Override @Override
public List<GSites> searchGSitesList(GSites gSites) { public List<GSites> searchGSitesList(GSites gSites) {
return gSitesMapper.selectList(new LambdaQueryWrapper<GSites>() return new LambdaQueryChainWrapper<>(gSitesMapper)
.eq(GSites::getProjectId, gSites.getProjectId()) .select(GSites::getId, GSites::getName, GSites::getType, GSites::getIcon)
.select(GSites::getId, GSites::getName, GSites::getType, GSites::getIcon) .eq(GSites::getProjectId, gSites.getProjectId())
.like(GSites::getName, gSites.getSearchValue())); .like(GSites::getName, gSites.getSearchValue())
.list();
} }
} }

View File

@ -121,4 +121,9 @@ public class Project extends BaseEntity
@ApiModelProperty("项目所属机构名称") @ApiModelProperty("项目所属机构名称")
private String deptName; private String deptName;
/** 项目级别:市,县 */
@Excel(name = "项目级别:市,县")
@ApiModelProperty("项目级别:市,县")
private String level;
} }

View File

@ -62,6 +62,11 @@ public interface IProjectService
*/ */
public int deleteProjectByProjectId(Long projectId); public int deleteProjectByProjectId(Long projectId);
/**
* 查询项目基本信息
* @param userId 用户ID
* @return 项目信息
*/
Map<String,Object> selectProjectByUserId(Long userId); Map<String,Object> selectProjectByUserId(Long userId);
/** /**
@ -70,4 +75,10 @@ public interface IProjectService
*/ */
List<SysDept> getUnbindDeptList(); List<SysDept> getUnbindDeptList();
/**
* 查询管理员项目切换下拉框数据
* @return 项目列表
*/
List<Project> selectAdminProjectList();
} }

View File

@ -2,14 +2,17 @@ package com.fastbee.project.service.impl;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.common.constant.ProjectLevelConstant;
import com.fastbee.common.core.domain.entity.SysDept; import com.fastbee.common.core.domain.entity.SysDept;
import com.fastbee.common.exception.ServiceException; import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.holder.ProjectHolder;
import com.fastbee.common.utils.DateUtils; import com.fastbee.common.utils.DateUtils;
import com.fastbee.project.domain.Project; import com.fastbee.project.domain.Project;
import com.fastbee.project.mapper.ProjectMapper; import com.fastbee.project.mapper.ProjectMapper;
import com.fastbee.project.service.IProjectService; import com.fastbee.project.service.IProjectService;
import com.fastbee.system.mapper.SysDeptMapper; import com.fastbee.system.mapper.SysDeptMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -51,7 +54,13 @@ public class ProjectServiceImpl implements IProjectService
@Override @Override
public List<Project> selectProjectList(Project project) public List<Project> selectProjectList(Project project)
{ {
return projectMapper.selectProjectList(project); return new LambdaQueryChainWrapper<>(projectMapper)
.select(Project::getProjectId, Project::getProjectName, Project::getScope,
Project::getAdministrativeArea, Project::getDeptId,Project::getAdministrativeAreaCode,
Project::getLogo, Project::getImage, Project::getLevel, Project::getDeptName,
Project::getCreateTime)
.like(StringUtils.isNotBlank(project.getSearchValue()),Project::getProjectName, project.getSearchValue())
.list();
} }
/** /**
@ -63,9 +72,10 @@ public class ProjectServiceImpl implements IProjectService
@Override @Override
public int insertProject(Project project) public int insertProject(Project project)
{ //判断选择的机构下是否已经绑定项目 { //判断选择的机构下是否已经绑定项目
Project one = new LambdaQueryChainWrapper<>(projectMapper).select(Project::getProjectId, Project::getProjectName) List<Project> projectList = new LambdaQueryChainWrapper<>(projectMapper)
.eq(Project::getDeptId, project.getDeptId()).one(); .select(Project::getProjectId, Project::getProjectName)
if(Objects.nonNull(one)){ .eq(Project::getDeptId, project.getDeptId()).list();
if(!projectList.isEmpty()){
throw new ServiceException("该机构下已经存在项目"); throw new ServiceException("该机构下已经存在项目");
} }
project.setCreateTime(DateUtils.getNowDate()); project.setCreateTime(DateUtils.getNowDate());
@ -82,7 +92,8 @@ public class ProjectServiceImpl implements IProjectService
public int updateProject(Project project) public int updateProject(Project project)
{ {
//判断选择的机构下是否已经绑定项目 //判断选择的机构下是否已经绑定项目
Project one = new LambdaQueryChainWrapper<>(projectMapper).select(Project::getProjectId, Project::getProjectName,Project::getDeptId) Project one = new LambdaQueryChainWrapper<>(projectMapper)
.select(Project::getProjectId, Project::getProjectName,Project::getDeptId)
.eq(Project::getDeptId, project.getDeptId()).one(); .eq(Project::getDeptId, project.getDeptId()).one();
if(Objects.isNull(one)){ if(Objects.isNull(one)){
throw new ServiceException("项目不存在!"); throw new ServiceException("项目不存在!");
@ -128,7 +139,7 @@ public class ProjectServiceImpl implements IProjectService
public Map<String, Object> selectProjectByUserId(Long userId) { public Map<String, Object> selectProjectByUserId(Long userId) {
//查询该管理员所管理的项目id以及子项目id列表 //查询该管理员所管理的项目id以及子项目id列表
Project project = new LambdaQueryChainWrapper<>(projectMapper) Project project = new LambdaQueryChainWrapper<>(projectMapper)
.select(Project::getProjectId, Project::getProjectName) .select(Project::getProjectId, Project::getProjectName,Project::getLevel,Project::getDeptId)
.eq(Project::getOwnerId, userId) .eq(Project::getOwnerId, userId)
.one(); .one();
if(Objects.isNull(project)){ if(Objects.isNull(project)){
@ -142,6 +153,7 @@ public class ProjectServiceImpl implements IProjectService
map.put("projectIds",projectsBase64); map.put("projectIds",projectsBase64);
map.put("projectId",project.getProjectId()); map.put("projectId",project.getProjectId());
map.put("projectName", project.getProjectName()); map.put("projectName", project.getProjectName());
map.put("projectLevel",project.getLevel().equals("市级")? ProjectLevelConstant.LEVEL_CITY :ProjectLevelConstant.LEVEL_COUNTY);
return map; return map;
} }
@ -168,6 +180,31 @@ public class ProjectServiceImpl implements IProjectService
return sysDeptList; return sysDeptList;
} }
@Override
public List<Project> selectAdminProjectList() {
Map<String, Object> rest = new HashMap<>();
//判断管理员级别
List<Project> projectList=new ArrayList<>();
//超级管理员
if(Objects.isNull(ProjectHolder.getProjectInfo().getProjectIdList())){
//查询所有一级项目列表
projectList = new LambdaQueryChainWrapper<>(projectMapper)
.select(Project::getProjectId, Project::getProjectName)
.isNull(Project::getParentId)
.list();
}
//市级/县级项目
else if(Objects.nonNull(ProjectHolder.getProjectInfo().getProjectIdList())){
//查询所有子一级项目列表
projectList = new LambdaQueryChainWrapper<>(projectMapper)
.select(Project::getProjectId, Project::getProjectName)
.in(Project::getParentId, ProjectHolder.getProjectInfo().getProjectIdList())
.list();
}
return projectList;
}
public List<Long> getAllProjects(Long projectId) { public List<Long> getAllProjects(Long projectId) {
List<Long> allProjects = new ArrayList<>(); List<Long> allProjects = new ArrayList<>();

View File

@ -30,10 +30,11 @@
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id" />
<result property="administrativeAreaCode" column="administrative_area_code" /> <result property="administrativeAreaCode" column="administrative_area_code" />
<result property="deptName" column="dept_name" /> <result property="deptName" column="dept_name" />
<result property="level" column="level" />
</resultMap> </resultMap>
<sql id="selectProjectVo"> <sql id="selectProjectVo">
select project_id, project_name, sys_show_name, central_coordinates, scope, administrative_area, owner, logo, image, video_introduction, remark, p_params, introduce, del_flag, create_time, create_by, update_time, remarks, tenant_id, tenant_name, owner_id, parent_id, dept_id, administrative_area_code, dept_name from project select project_id, project_name, sys_show_name, central_coordinates, scope, administrative_area, owner, logo, image, video_introduction, remark, p_params, introduce, del_flag, create_time, create_by, update_time, remarks, tenant_id, tenant_name, owner_id, parent_id, dept_id, administrative_area_code, dept_name, level from project
</sql> </sql>
<select id="selectProjectList" parameterType="Project" resultMap="ProjectResult"> <select id="selectProjectList" parameterType="Project" resultMap="ProjectResult">
@ -58,6 +59,7 @@
<if test="deptId != null "> and dept_id = #{deptId}</if> <if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="administrativeAreaCode != null and administrativeAreaCode != ''"> and administrative_area_code = #{administrativeAreaCode}</if> <if test="administrativeAreaCode != null and administrativeAreaCode != ''"> and administrative_area_code = #{administrativeAreaCode}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if> <if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
<if test="level != null and level != ''"> and level = #{level}</if>
</where> </where>
</select> </select>
@ -94,6 +96,7 @@
<if test="deptId != null">dept_id,</if> <if test="deptId != null">dept_id,</if>
<if test="administrativeAreaCode != null">administrative_area_code,</if> <if test="administrativeAreaCode != null">administrative_area_code,</if>
<if test="deptName != null">dept_name,</if> <if test="deptName != null">dept_name,</if>
<if test="level != null">level,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if> <if test="projectId != null">#{projectId},</if>
@ -121,6 +124,7 @@
<if test="deptId != null">#{deptId},</if> <if test="deptId != null">#{deptId},</if>
<if test="administrativeAreaCode != null">#{administrativeAreaCode},</if> <if test="administrativeAreaCode != null">#{administrativeAreaCode},</if>
<if test="deptName != null">#{deptName},</if> <if test="deptName != null">#{deptName},</if>
<if test="level != null">#{level},</if>
</trim> </trim>
</insert> </insert>
@ -151,6 +155,7 @@
<if test="deptId != null">dept_id = #{deptId},</if> <if test="deptId != null">dept_id = #{deptId},</if>
<if test="administrativeAreaCode != null">administrative_area_code = #{administrativeAreaCode},</if> <if test="administrativeAreaCode != null">administrative_area_code = #{administrativeAreaCode},</if>
<if test="deptName != null">dept_name = #{deptName},</if> <if test="deptName != null">dept_name = #{deptName},</if>
<if test="level != null">level = #{level},</if>
</trim> </trim>
where project_id = #{projectId} where project_id = #{projectId}
</update> </update>