权限管理修改,接口优化

This commit is contained in:
2026-07-24 15:42:43 +08:00
parent b3494db4ec
commit 4fd371b8eb
52 changed files with 613 additions and 207 deletions

View File

@@ -0,0 +1,13 @@
package com.zf.foodpurchase.fdsafe.entity;
import lombok.Data;
@Data
public class FoodProductMaterial {
private Long id;
private Long foodProductId;
private Integer foodId;
}

View File

@@ -54,9 +54,7 @@ public class FoodSpec implements Serializable {
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/**
* 是否有效: 0 有效 1 无效
*/
private Integer status;
private Long deptId;
}

View File

@@ -31,7 +31,6 @@ public class Repository implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@NotNull(message = "仓库名称不能为空")
@TableField("repo_name")
private String repoName;
/**
@@ -57,7 +56,6 @@ public class Repository implements Serializable {
/**
* 详细地址
*/
@NotNull(message = "详细地址不能为空")
@TableField("detail_address")
private String detailAddress;
@@ -86,14 +84,12 @@ public class Repository implements Serializable {
private Long operId;
@TableField
@NotNull(message = "仓库管理员不能为空")
private Long manager;
@TableField
private String repoNum;
@TableField
@NotNull(message = "排序号不能为空")
private Integer orderNum;
@TableField(exist = false)
private List<Long> deptIds;

View File

@@ -17,4 +17,6 @@ import java.util.List;
public interface SupplierMapper extends BaseMapper<Supplier> {
List<SupplierVO> querySupplierVO(SupplierVO supplierVO);
Integer selectMaxId();
}

View File

@@ -1,26 +1,29 @@
package com.zf.foodpurchase.fdsafe.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.zf.foodpurchase.common.constant.FoodStatusConstants;
import com.zf.foodpurchase.common.core.domain.AjaxResult;
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
import com.zf.foodpurchase.common.utils.bean.BeanUtils;
import com.zf.foodpurchase.fdsafe.entity.Food;
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
import com.zf.foodpurchase.fdsafe.mapper.FoodMapper;
import com.zf.foodpurchase.fdsafe.entity.FoodProductMaterial;
import com.zf.foodpurchase.fdsafe.mapper.FoodProductMapper;
import com.zf.foodpurchase.fdsafe.service.IFoodProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
import com.zf.foodpurchase.system.mapper.FoodProductMaterialMapper;
import com.zf.foodpurchase.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@@ -37,9 +40,21 @@ public class FoodProductServiceImpl extends ServiceImpl<FoodProductMapper, FoodP
@Autowired
private FoodProductMapper foodProductMapper;
@Autowired
private FoodProductMaterialMapper foodProductMaterialMapper;
@Override
public List<FoodProductVO> queryFoodProductVO(FoodProductVO foodProductVO) {
List<FoodProductVO> list = baseMapper.queryFoodProductVO(foodProductVO);
if(CollectionUtil.isNotEmpty(list)){
for (FoodProductVO foodProductVO1 : list) {
List<FoodProductMaterial> foodProductMaterials = foodProductMaterialMapper.selectByFoodProductId(foodProductVO1.getFoodProductId());
if(CollectionUtil.isNotEmpty(foodProductMaterials)){
foodProductVO1.setFoodProductMaterials(foodProductMaterials);
}
}
}
return list;
}
@@ -50,9 +65,17 @@ public class FoodProductServiceImpl extends ServiceImpl<FoodProductMapper, FoodP
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult supplierAdd(FoodProductVO foodProductVO) {
FoodProduct foodProduct = dealSupplierProductAdd(foodProductVO);
boolean save = save(foodProduct);
List<FoodProductMaterial> list = foodProductVO.getFoodProductMaterials();
if(CollectionUtil.isNotEmpty(list)){
for(FoodProductMaterial foodProductMaterial : list){
foodProductMaterial.setFoodProductId(foodProduct.getFoodProductId());
}
foodProductMaterialMapper.batchInsert(foodProductVO.getFoodProductMaterials());
}
return save ? AjaxResult.success("商品发布成功") : AjaxResult.error("商品发布失败");
}
@@ -126,7 +149,7 @@ public class FoodProductServiceImpl extends ServiceImpl<FoodProductMapper, FoodP
}
//foodProduct.setEduId(food.getEduId());
// 审核项置空.
foodProduct.setCheckStatus(FoodStatusConstants.PRODUCT_WAIT_CHECK);
foodProduct.setCheckStatus(FoodStatusConstants.PRODUCT_CHECK_PASS);
foodProduct.setCheckRemark(null);
foodProduct.setCheckTime(null);
return foodProduct;

View File

@@ -3,13 +3,17 @@ package com.zf.foodpurchase.fdsafe.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zf.foodpurchase.common.core.domain.AjaxResult;
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
import com.zf.foodpurchase.common.utils.bean.BeanUtils;
import com.zf.foodpurchase.fdsafe.entity.FoodSpec;
import com.zf.foodpurchase.fdsafe.mapper.FoodSpecMapper;
import com.zf.foodpurchase.fdsafe.service.IFoodSpecService;
import com.zf.foodpurchase.fdsafe.vo.FoodSpecVO;
import com.zf.foodpurchase.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@@ -23,6 +27,9 @@ import java.util.List;
@Service
public class FoodSpecServiceImpl extends ServiceImpl<FoodSpecMapper, FoodSpec> implements IFoodSpecService {
@Autowired
private ISysUserService sysUserService;
@Override
public List<FoodSpecVO> queryFoodSpecVO(FoodSpecVO foodSpecVO) {
List<FoodSpecVO> list = baseMapper.queryFoodSpecVO(foodSpecVO);
@@ -31,11 +38,16 @@ public class FoodSpecServiceImpl extends ServiceImpl<FoodSpecMapper, FoodSpec> i
@Override
public AjaxResult saveVO(FoodSpecVO foodSpecVO) {
SysUser user = sysUserService.getUser();
if(!user.isAdmin()){
foodSpecVO.setDeptId(user.getDeptId());
}
FoodSpec foodSpec=new FoodSpec();
BeanUtils.copyProperties(foodSpecVO, foodSpec);
if(!uniqueSpecCheck(foodSpec)){
return AjaxResult.error("规格/单位已存在,不可重复添加");
}
foodSpec.setCreateTime(new Date());
boolean result = save(foodSpec);
return result ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败");
}
@@ -47,6 +59,7 @@ public class FoodSpecServiceImpl extends ServiceImpl<FoodSpecMapper, FoodSpec> i
if(!uniqueSpecCheck(foodSpec)){
return AjaxResult.error("规格/单位已存在,不可修改为该规格/单位");
}
foodSpec.setUpdateTime(new Date());
boolean result = updateById(foodSpec);
return result ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
}

View File

@@ -1,5 +1,6 @@
package com.zf.foodpurchase.fdsafe.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -53,34 +54,45 @@ public class RepositoryServiceImpl extends ServiceImpl<RepositoryMapper, Reposit
throw new RuntimeException("登录人员部门为空,不能生成订单编号");
}
Date date = DateUtils.getNowDate();
String repoNo = "";
String dateStr = DateUtils.getShortYearMonthDay( date);
Long deptId = user.getDeptId();
XhCreate xhCreate = new XhCreate();
xhCreate.setDeptId(deptId);
xhCreate.setTimeStr(dateStr);
XhCreateVO xhCreateVO = new XhCreateVO();
BeanUtils.copyProperties(xhCreate,xhCreateVO);
XhCreate xhCreateNew = xhMapper.queryXhCreate(xhCreateVO);
if(ObjectUtil.isNull(xhCreateNew)){
Integer deptNum = xhMapper.selectMaxDeptNum();
Integer num = 1;
if(ObjectUtil.isNotNull(deptNum)){
num = deptNum+1;
if(StringUtils.isBlank(repository.getRepoNum())){
String repoNo = "";
String dateStr = DateUtils.getShortYearMonthDay( date);
Long deptId = user.getDeptId();
XhCreate xhCreate = new XhCreate();
xhCreate.setDeptId(deptId);
xhCreate.setTimeStr(dateStr);
XhCreateVO xhCreateVO = new XhCreateVO();
BeanUtils.copyProperties(xhCreate,xhCreateVO);
XhCreate xhCreateNew = xhMapper.queryXhCreate(xhCreateVO);
if(ObjectUtil.isNull(xhCreateNew)){
Integer deptNum = xhMapper.selectMaxDeptNum();
Integer num = 1;
if(ObjectUtil.isNotNull(deptNum)){
num = deptNum+1;
}
xhCreate.setDeptNum(num);
xhCreate.setXh(1);
xhMapper.insertXhCreate(xhCreate);
repoNo = StringUtils.formatNumThree(deptNum)+dateStr+"001";
}else{
Integer deptNum = xhCreateNew.getDeptNum();
Integer xhNum = xhCreateNew.getXh()+1;
String xhNumStr = StringUtils.formatNumThree(xhNum);
repoNo = StringUtils.formatNumThree(deptNum)+dateStr+xhNumStr;
xhCreateNew.setXh(xhNum);
xhMapper.updateXhCreate(xhCreateNew);
}
xhCreate.setDeptNum(num);
xhCreate.setXh(1);
xhMapper.insertXhCreate(xhCreate);
repoNo = StringUtils.formatNumThree(deptNum)+dateStr+"001";
repository.setRepoNum(repoNo);
}else{
Integer deptNum = xhCreateNew.getDeptNum();
Integer xhNum = xhCreateNew.getXh()+1;
String xhNumStr = StringUtils.formatNumThree(xhNum);
repoNo = StringUtils.formatNumThree(deptNum)+dateStr+xhNumStr;
xhCreateNew.setXh(xhNum);
xhMapper.updateXhCreate(xhCreateNew);
String repoNum = repository.getRepoNum();
Repository queryRepository = new Repository();
queryRepository.setRepoNum(repoNum);
List<RepositoryVO> list = repositoryMapper.queryRepoList(queryRepository);
if(CollectionUtil.isNotEmpty( list)){
return AjaxResult.error("仓库编号已存在请更换仓库编号");
}
}
repository.setRepoNum(repoNo);
if (checkRepoNameUnique(repository)) {
return AjaxResult.error("仓库名称已存在请更换仓库名称");
}

View File

@@ -116,9 +116,9 @@ public class SchoolOrderServiceImpl extends ServiceImpl<SchoolOrderMapper, Schoo
if (foodProduct == null) {
throw new RuntimeException("部分商品不存在,请刷新页面后,确认提交的商品状态正常后重新提交订单");
}
if (!FoodStatusConstants.PRODUCT_CHECK_PASS.equals(foodProduct.getCheckStatus())) {
/*if (!FoodStatusConstants.PRODUCT_CHECK_PASS.equals(foodProduct.getCheckStatus())) {
throw new RuntimeException("部分商品审核未通过,请刷新页面后,确认提交的商品状态正常后重新提交订单");
}
}*/
totalMoney = totalMoney.add(foodProduct.getPrice().multiply(new BigDecimal(schoolCartItem.getProductNum())));
// 设置子单项目信息
// 食材信息
@@ -130,6 +130,9 @@ public class SchoolOrderServiceImpl extends ServiceImpl<SchoolOrderMapper, Schoo
BeanUtils.copyProperties(schoolCartItem, schoolOrderItem);
BeanUtils.copyProperties(foodProduct, schoolOrderItem);
//BeanUtils.copyProperties(food, schoolOrderItem);
schoolOrderItem.setFoodId(foodProduct.getFoodId());
schoolOrderItem.setFoodName(foodProduct.getName());
schoolOrderItem.setFoodProductId(foodProduct.getFoodProductId().intValue());
schoolOrderItem.setOrderItemStatus(OrderStatusConstants.WAIT_ACCEPT);
// 将备注信息保存到子订单中.
schoolOrderItem.setOrderItemRemark(schoolCartItem.getItemRemark());

View File

@@ -1,6 +1,8 @@
package com.zf.foodpurchase.fdsafe.service.impl;
import com.zf.foodpurchase.common.core.domain.AjaxResult;
import com.zf.foodpurchase.common.core.domain.entity.SysDept;
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
import com.zf.foodpurchase.common.utils.StringUtils;
import com.zf.foodpurchase.fdsafe.entity.Supplier;
import com.zf.foodpurchase.fdsafe.mapper.SupplierMapper;
@@ -9,9 +11,12 @@ import com.zf.foodpurchase.fdsafe.service.ISupplierService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
import com.zf.foodpurchase.fdsafe.vo.SupplierVO;
import com.zf.foodpurchase.system.mapper.SysDeptMapper;
import com.zf.foodpurchase.system.service.ISysUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
@@ -28,7 +33,12 @@ import java.util.List;
public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements ISupplierService {
@Autowired
private CommonService commonService;
@Autowired
private SupplierMapper supplierMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private ISysUserService sysUserService;
// 菜品 :dishes
// 食品: foodstuff
// dish
@@ -59,7 +69,13 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult saveVO(SupplierVO supplierVO) {
SysUser user = sysUserService.getUser();
Long deptId = user.getDeptId();
SysDept parentDept = sysDeptMapper.selectDeptById(deptId);
String tenantId = parentDept.getTenantId();
String ancestors = parentDept.getAncestors()+","+deptId;
Supplier supplier = new Supplier();
BeanUtils.copyProperties(supplierVO, supplier);
supplier.setFoodLicenseImg(ArrayStringUtils.arrayToString(supplierVO.getFoodLicenseImg()));
@@ -67,6 +83,20 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
supplier.setAreaCode(ArrayStringUtils.arrayToString(supplierVO.getAreaCode()));
// 供货商上下架有专门的接口
supplier.setStatus(null);
Integer orgMaxId = supplierMapper.selectMaxId()+1;
Long deptMaxIdL = sysDeptMapper.selectMaxId()+1;
Integer deptMaxId = deptMaxIdL.intValue();
int max = deptMaxId > orgMaxId ? deptMaxId : orgMaxId;
supplier.setSupplierId( max);
SysDept dept = new SysDept();
dept.setDeptId((long) max);
dept.setParentId(deptId);
dept.setTenantId(tenantId);
dept.setDeptName(supplier.getSupplierName());
dept.setAncestors(ancestors);
dept.setMerchantFlag("1");
sysDeptMapper.insertDept(dept);
boolean result = save(supplier);
return result ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
}

View File

@@ -4,6 +4,7 @@ import com.zf.foodpurchase.common.valigroud.AddGroup;
import com.zf.foodpurchase.common.valigroud.CheckGroup;
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
import com.zf.foodpurchase.common.vo.CommonVO;
import com.zf.foodpurchase.fdsafe.entity.FoodProductMaterial;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@@ -125,4 +126,6 @@ public class FoodProductVO extends CommonVO implements Serializable {
private List<Long> deptIds;
private String imageUrl;
private List<FoodProductMaterial> foodProductMaterials;
}

View File

@@ -8,6 +8,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author:lilj
@@ -43,9 +44,8 @@ public class FoodSpecVO implements Serializable {
* 更新时间
*/
private Date updateTime;
/**
* 是否有效: 0 有效 1 无效
*/
@NotNull(message = "是否有效不能为空", groups = {UpdateGroup.class, AddGroup.class})
private Integer status;
private List<Long> deptIds;
private Long deptId;
}

View File

@@ -113,4 +113,6 @@ public class SchoolOrderItemVO extends CommonVO implements Serializable {
private String modelName;
private String num;
}

View File

@@ -117,4 +117,8 @@ public class SchoolOrderVO extends CommonVO implements Serializable {
private String signImage;
private List<Long> deptIds;
private Date beginTime;
private Date endTime;
}

View File

@@ -129,4 +129,6 @@ public class SupplierVO extends CommonVO implements Serializable {
* 1 已上架
*/
private Integer status;
private List<Long> deptIds;
}

View File

@@ -0,0 +1,14 @@
package com.zf.foodpurchase.system.mapper;
import com.zf.foodpurchase.fdsafe.entity.FoodProductMaterial;
import java.util.List;
public interface FoodProductMaterialMapper {
int insert(FoodProductMaterial record);
void batchInsert(List<FoodProductMaterial> records);
List<FoodProductMaterial> selectByFoodProductId(Long foodProductId);
}

View File

@@ -125,4 +125,7 @@ public interface SysDeptMapper
public List<Long> selectAllZSByDeptId(Long deptId);
List<SysDept> selectIdByDeptIds(@Param("deptIds") List<Integer> deptIds);
Long selectMaxId();
}

View File

@@ -0,0 +1,27 @@
<?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="com.zf.foodpurchase.system.mapper.FoodProductMaterialMapper">
<select id="selectByFoodProductId" resultType="com.zf.foodpurchase.fdsafe.entity.FoodProductMaterial"
parameterType="java.lang.Long">
select id,food_product_id foodProductId,food_id foodId from food_product_material where food_product_id = #{foodProductId}
</select>
<insert id="insert" parameterType="com.zf.foodpurchase.fdsafe.entity.FoodProductMaterial" useGeneratedKeys="true" keyProperty="id">
insert into food_product_material(
<if test="foodProductId != null">food_product_id,</if>
<if test="foodId != null">food_id</if>
)values(
<if test="foodProductId != null">#{foodProductId},</if>
<if test="foodId != null">#{foodId}</if>
</insert>
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true">
INSERT INTO food_product_material (food_product_id, food_id)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.foodProductId}, #{item.foodId})
</foreach>
</insert>
</mapper>

View File

@@ -4,7 +4,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
spec_id, spec_label, del_flag, create_time, update_time,status
spec_id, spec_label, del_flag, create_time, update_time, dept_id
</sql>
<select id="queryFoodSpecVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodSpecVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.FoodSpecVO">
@@ -21,8 +21,11 @@
<if test="delFlag != null">
and del_flag = #{delFlag}
</if>
<if test="status != null">
and status = #{status}
<if test="deptIds != null and deptIds.size() > 0">
and dept_id in
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
</where>
</select>

View File

@@ -50,7 +50,7 @@
</foreach>
</if>
</where>
group by r.id,r.merchant_id,r.repo_num,r.repo_name,r.area_code,r.detail_address,r.default_repo,r.create_time,r.update_time,r.oper_id,r.manager,r.order_num,d.dept_name;
group by r.id,r.merchant_id,r.repo_num,r.repo_name,r.area_code,r.detail_address,r.default_repo,r.create_time,r.update_time,r.oper_id,r.manager,r.order_num,d.dept_name order by r.order_num
</select>
</mapper>

View File

@@ -9,7 +9,7 @@
<select id="querySchoolOrderItemVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO">
select soi.order_item_no, soi.order_no,soi.food_id, soi.school_id, soi.edu_id, soi.supplier_id, soi.food_product_id, soi.food_name, soi.price, soi.product_num, soi.type_id, soi.unit_id, soi.order_item_status, soi.create_time, soi.update_time, soi.order_item_remark,soi.refund_num,
ft.type_label,fu.unit_label,fp.remark as food_product_remark,sup.supplier_name supplierName,fu.unit_label modelName
ft.type_label,fu.unit_label,fp.remark as food_product_remark,sup.supplier_name supplierName,fu.unit_label modelName,fp.num
from school_order_item soi
left join supplier sup on soi.supplier_id=sup.supplier_id
left join school_order so on soi.order_no = so.order_no

View File

@@ -32,11 +32,17 @@
<if test="orderStatus != null">
and so.order_status = #{orderStatus}
</if>
<if test="operatorPerson != null and operatorPerson != ''">
and so.operator_person = #{operatorPerson}
</if>
<if test="operatorPhone != null and operatorPhone != ''">
and so.operator_phone = #{operatorPhone}
</if>
<if test="beginTime != null">
AND date_format(so.create_time,'%Y%m%d') &gt;= date_format(#{beginTime},'%Y%m%d')
AND so.create_time &gt;= #{beginTime}
</if>
<if test="endTime != null">
and date_format(so.create_time,'%Y%m%d') &lt;=date_format(#{endTime},'%Y%m%d')
AND so.create_time &lt;= #{endTime}
</if>
<if test = 'orderSettleStatus !=null'>
and so.order_settle_status = #{orderSettleStatus}

View File

@@ -38,7 +38,16 @@
<if test="status!=null">
and sp.status = #{status}
</if>
<if test="deptIds != null and deptIds.size() > 0">
and sp.supplier_id in
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
</where>
</select>
<select id="selectMaxId" resultType="java.lang.Integer">
select max(supplier_id) id
from supplier
</select>
</mapper>

View File

@@ -101,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
@@ -117,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
@@ -137,6 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
@@ -183,6 +186,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept
<set>
<if test="dept.parentId != null and dept.parentId != 0">parent_id = #{dept.parentId},</if>
<if test="dept.tenantId != null and dept.tenantId != ''">tenant_id = #{dept.tenantId},</if>
<if test="dept.deptName != null and dept.deptName != ''">dept_name = #{dept.deptName},</if>
<if test="dept.ancestors != null and dept.ancestors != ''">ancestors = #{dept.ancestors},</if>
<if test="dept.orderNum != null">order_num = #{dept.orderNum},</if>
@@ -231,4 +235,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</select>
<select id="selectMaxId" resultType="java.lang.Long">
select max(dept_id) id
from sys_dept
</select>
</mapper>