Просмотр исходного кода

Merge branch 'master' of http://124.70.58.209:3000/ytrd-project-management/purchase

hexiao 2 лет назад
Родитель
Сommit
867b62e78d
20 измененных файлов с 1164 добавлено и 117 удалено
  1. 78 0
      purchase-admin/src/main/java/com/ozs/web/controller/plan/PlanOfYearsController.java
  2. 15 0
      purchase-admin/src/main/java/com/ozs/web/controller/system/SysProcurementStandardController.java
  3. 26 0
      purchase-common/src/main/java/com/ozs/common/core/domain/entity/SysDept.java
  4. 27 0
      purchase-common/src/main/java/com/ozs/common/enums/DataIsDelete.java
  5. 30 0
      purchase-common/src/main/java/com/ozs/common/enums/PlanPurchaseMode.java
  6. 29 0
      purchase-common/src/main/java/com/ozs/common/enums/ProjectAttribute.java
  7. 29 0
      purchase-common/src/main/java/com/ozs/common/enums/ProjectStatus.java
  8. 29 0
      purchase-common/src/main/java/com/ozs/common/enums/ProjectTypes.java
  9. 118 0
      purchase-system/src/main/java/com/ozs/plan/doman/PlanOfYears.java
  10. 105 0
      purchase-system/src/main/java/com/ozs/plan/doman/vo/requestVo/PlanOfYearsStandardVo.java
  11. 118 0
      purchase-system/src/main/java/com/ozs/plan/doman/vo/responseVo/PlanOfYearsResponseVo.java
  12. 64 0
      purchase-system/src/main/java/com/ozs/plan/mapper/PlanOfYearsMapper.java
  13. 46 0
      purchase-system/src/main/java/com/ozs/plan/service/PlanOfYearsService.java
  14. 95 0
      purchase-system/src/main/java/com/ozs/plan/service/impl/PlanOfYearsServiceImpl.java
  15. 43 0
      purchase-system/src/main/java/com/ozs/system/domain/vo/requestVo/SysDeptRequestVo.java
  16. 46 0
      purchase-system/src/main/java/com/ozs/system/domain/vo/responseVo/SysDeptResponseVo.java
  17. 3 1
      purchase-system/src/main/java/com/ozs/system/service/ISysDeptService.java
  18. 22 2
      purchase-system/src/main/java/com/ozs/system/service/impl/SysDeptServiceImpl.java
  19. 120 0
      purchase-system/src/main/resources/mapper/plan/PlanOfYearsMapper.xml
  20. 121 114
      purchase-system/src/main/resources/mapper/system/SysDeptMapper.xml

+ 78 - 0
purchase-admin/src/main/java/com/ozs/web/controller/plan/PlanOfYearsController.java

@@ -0,0 +1,78 @@
+package com.ozs.web.controller.plan;
+
+import com.ozs.common.core.controller.BaseController;
+import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.common.core.domain.model.LoginUser;
+import com.ozs.common.core.page.TableDataInfo;
+import com.ozs.framework.web.service.TokenService;
+import com.ozs.plan.doman.PlanOfYears;
+import com.ozs.plan.doman.vo.requestVo.PlanOfYearsStandardVo;
+import com.ozs.plan.doman.vo.responseVo.PlanOfYearsResponseVo;
+import com.ozs.plan.service.PlanOfYearsService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * 年度计划信息控制层
+ *
+ * @author buzhanyi
+ */
+@RestController
+@RequestMapping("/plan/planOfYears")
+public class PlanOfYearsController extends BaseController {
+    @Autowired
+    private PlanOfYearsService planOfYearsService;
+    @Autowired
+    private TokenService tokenService;
+
+    @ApiOperation(value = "查询年度计划")
+    @PostMapping("/list")
+    public TableDataInfo list(@RequestBody PlanOfYearsStandardVo yearsStandardVo) {
+        startPage();
+        List<PlanOfYears> list = planOfYearsService.selectPlanOfYearsList(yearsStandardVo);
+        return getDataTable(list);
+    }
+
+    @ApiOperation(value = "创建年度计划")
+    @PostMapping("/add")
+    public AjaxResult add(@RequestBody PlanOfYearsStandardVo yearsStandardVo, HttpServletRequest request) {
+        //获取采购单位-
+        LoginUser loginUser = tokenService.getLoginUser(request);
+        yearsStandardVo.setPurchaseUnit(loginUser.getDeptId());
+        yearsStandardVo.setCreateBy(String.valueOf(loginUser.getUserId()));
+        return planOfYearsService.insertPlanOfYears(yearsStandardVo);
+    }
+
+    @ApiOperation(value = "修改年度计划")
+    @PostMapping("/update")
+    public AjaxResult update(@RequestBody PlanOfYearsStandardVo yearsStandardVo) {
+        return planOfYearsService.update(yearsStandardVo);
+    }
+
+    @ApiOperation(value = "删除年度计划")
+    @PostMapping("/delete")
+    public AjaxResult delete(@RequestBody PlanOfYearsStandardVo yearsStandardVo) {
+        return planOfYearsService.deletePlanOfYearsById(yearsStandardVo.getPlanYearId());
+    }
+
+    //@ApiOperation(value = "删除年度计划")
+    //@PostMapping("/delete")
+    //public AjaxResult delete(@RequestBody Long[] planIds) {
+    //    return planOfYearsService.deletePlanOfYearsByIds(planIds);
+    //}
+
+    @ApiOperation(value = "根据id获取年度计划信息")
+    @PostMapping("/view")
+    public AjaxResult view(@RequestBody PlanOfYearsStandardVo yearsStandardVo) {
+        return planOfYearsService.view(yearsStandardVo);
+    }
+
+
+}

+ 15 - 0
purchase-admin/src/main/java/com/ozs/web/controller/system/SysProcurementStandardController.java

@@ -48,5 +48,20 @@ public class SysProcurementStandardController {
         }
         return R.ok();
     }
+
+    @ApiOperation("修改采购单位管理中标准信息")
+    @PostMapping("update")
+    public R<String> update(@RequestBody List<SysProcurementStandardVo> sysProcurementStandardVoList) {
+        boolean isSuccess = false;
+        SysProcurementStandard sysProcurementStandard = new SysProcurementStandard();
+        for (SysProcurementStandardVo sysProcurementStandardVo : sysProcurementStandardVoList) {
+            BeanUtils.copyProperties(sysProcurementStandardVo, sysProcurementStandard);
+            isSuccess = sysProcurementStandardService.updateById(sysProcurementStandard);
+            if (!isSuccess) {
+                return R.fail();
+            }
+        }
+        return R.ok();
+    }
 }
 

+ 26 - 0
purchase-common/src/main/java/com/ozs/common/core/domain/entity/SysDept.java

@@ -54,6 +54,30 @@ public class SysDept extends BaseEntity
 
     /** 子部门 */
     private List<SysDept> children = new ArrayList<SysDept>();
+    /**
+     * 备注
+     */
+    private  String remarks;
+    /**
+     * 地址
+     */
+    private String address;
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
 
     public Long getDeptId()
     {
@@ -198,6 +222,8 @@ public class SysDept extends BaseEntity
             .append("createTime", getCreateTime())
             .append("updateBy", getUpdateBy())
             .append("updateTime", getUpdateTime())
+            .append("remarks",getRemarks())
+            .append("address",getAddress())
             .toString();
     }
 }

+ 27 - 0
purchase-common/src/main/java/com/ozs/common/enums/DataIsDelete.java

@@ -0,0 +1,27 @@
+package com.ozs.common.enums;
+
+/**
+ * 数据的删除状态枚举
+ *
+ * @author buzhanyi
+ */
+public enum DataIsDelete {
+    DataNOTDelete("0", "正常数据"),
+    DataDeleted("1", "已删除");
+
+    private final String code;
+    private final String info;
+
+    DataIsDelete(String code, String info) {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+}

+ 30 - 0
purchase-common/src/main/java/com/ozs/common/enums/PlanPurchaseMode.java

@@ -0,0 +1,30 @@
+package com.ozs.common.enums;
+
+/**
+ * 采购方式
+ *
+ * @author buzhanyi
+ */
+public enum PlanPurchaseMode {
+    INVITETENDERS("0", "公开招标"),
+    SINGSOURCE("1", "单一来源"),
+    INVITATIONTENDER("2", "邀请招标"),
+    NEGOTIATION("3", "竞争式谈判"),
+    INQUIRY("4", "询价");
+
+    private final String code;
+    private final String info;
+
+    PlanPurchaseMode(String code, String info) {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+}

+ 29 - 0
purchase-common/src/main/java/com/ozs/common/enums/ProjectAttribute.java

@@ -0,0 +1,29 @@
+package com.ozs.common.enums;
+
+/**
+ * 项目类型
+ *
+ * @author buzhanyi
+ */
+public enum ProjectAttribute {
+    emergency("0", "应急应战项目"),
+    majorPlan("1", "重大规划任务项目"),
+    plan("2", "规划任务项目"),
+    commonly("3", "一般项目");
+
+    private final String code;
+    private final String info;
+
+    ProjectAttribute(String code, String info) {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+}

+ 29 - 0
purchase-common/src/main/java/com/ozs/common/enums/ProjectStatus.java

@@ -0,0 +1,29 @@
+package com.ozs.common.enums;
+
+/**
+ * 项目审核状态
+ *
+ * @author buzhanyi
+ */
+public enum ProjectStatus {
+    PLANWAITCOMMIT("0", "计划待提交"),
+    PLANWAIEXAMINE("1", "计划待审核"),
+    PLANTOBACK("2", "计划已退回"),
+    PLANTOEXAMINE("3", "计划已审核");
+
+    private final String code;
+    private final String info;
+
+    ProjectStatus(String code, String info) {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+}

+ 29 - 0
purchase-common/src/main/java/com/ozs/common/enums/ProjectTypes.java

@@ -0,0 +1,29 @@
+package com.ozs.common.enums;
+
+/**
+ * 项目类型
+ *
+ * @author buzhanyi
+ */
+public enum ProjectTypes {
+    EQUIPMENTTYPE("0", "装备类"),
+    MATERIALTYPE("1", "物资类"),
+    SERVICESTYPE("2", "服务类"),
+    PLANTOEXAMINETYPE("3", "工程类");
+
+    private final String code;
+    private final String info;
+
+    ProjectTypes(String code, String info) {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+}

+ 118 - 0
purchase-system/src/main/java/com/ozs/plan/doman/PlanOfYears.java

@@ -0,0 +1,118 @@
+package com.ozs.plan.doman;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ozs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author buzhanyi
+ */
+@Data
+public class PlanOfYears extends BaseEntity {
+
+    /**
+     * 主键编号
+     */
+    private Long planYearId;
+    /**
+     * 采购单位(登录账号的单位)
+     */
+    @NotNull(message = "采购单位不能为空")
+    private Long purchaseUnit;
+    /**
+     * 项目名称
+     */
+    @NotNull(message = "项目名称不能为空")
+    private String projectName;
+    /**
+     * 项目类型(1:装备类;2:物资类;3:服务类;)
+     */
+    @NotNull(message = "项目类型不能为空")
+    private String projectType;
+    /**
+     * 需求概况
+     */
+    @NotNull(message = "需求概况不能为空")
+    private String demandOverview;
+    /**
+     * 概算金额(万元(保留小数点后两位)
+     */
+    @NotNull(message = "概算金额不能为空")
+    private BigDecimal evaluation;
+    /**
+     * 是否为超限额计划()
+     */
+    @NotNull(message = "是否为超限额计划不能为空")
+    private String isExcess;
+    /**
+     * 采购服务站
+     */
+    @NotNull(message = "采购服务站不能为空")
+    private String purchaseServices;
+    /**
+     * 采购方式
+     */
+    @NotNull(message = "采购方式不能为空")
+    private String purchaseMode;
+    /**
+     * 计划提报需求时间--->需求单位成功提报采购需求的日期(具体到月)
+     */
+    @NotNull(message = "计划提报需求时间不能为空")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date demandCommitTime;
+    /**
+     * 计划完成采购时间--->公示中标结果的日期,即填制中标信息的日期(具体到月)
+     */
+    @NotNull(message = "计划完成采购时间不能为空")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date purchaseFinishTime;
+    /**
+     * 计划交付时间--->供应商完成并交付后,使用单位收到标的日期,即填制建设文档的日期
+     */
+    @NotNull(message = "计划交付时间不能为空")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date deliverTime;
+    /**
+     * 项目属性--->应急应战项目、重大规划任务项目、规划任务项目或一般项目
+     */
+    @NotNull(message = "项目属性不能为空")
+    private String projectAttribute;
+    /**
+     * 计划调整情况及理由--->如计划需要变更,在填写申请修改时需填写调整情况及理由,审核单位审核通过后显示
+     */
+    @NotNull(message = "计划调整情况及理由不能为空")
+    private String readjustOfPlan;
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 项目状态--->包括计划待提交、计划待审核、计划已退回、计划已审核
+     */
+    private String projectStatus;
+    /**
+     * 退回原因--->审核不通过就是退回
+     */
+    private String reason_of_return;
+    /**
+     * 创建者
+     */
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    /**
+     * 逻辑删除字段--->(0:正常,1:已删除)
+     */
+    private Integer isDelete;
+
+
+}

+ 105 - 0
purchase-system/src/main/java/com/ozs/plan/doman/vo/requestVo/PlanOfYearsStandardVo.java

@@ -0,0 +1,105 @@
+package com.ozs.plan.doman.vo.requestVo;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ozs.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author buzhanyi
+ */
+@Data
+public class PlanOfYearsStandardVo extends BaseEntity {
+
+    /**
+     * 主键编号
+     */
+    @ApiModelProperty(value = "主键编号")
+    private Long planYearId;
+
+    /**
+     * 采购单位(登录账号的单位)
+     */
+    @ApiModelProperty(value = "采购单位")
+    private Long purchaseUnit;
+
+    /**
+     * 项目名称
+     */
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    /**
+     * 项目类型(1:装备类;2:物资类;3:服务类;)
+     */
+    @ApiModelProperty(value = "项目类型不能为空(1:装备类;2:物资类;3:服务类;)")
+    private String projectType;
+
+    /**
+     * 需求概况
+     */
+    @ApiModelProperty(value = "需求概况")
+    private String demandOverview;
+    /**
+     * 概算金额(万元(保留小数点后两位)
+     */
+    @ApiModelProperty(value = "概算金额")
+    private BigDecimal evaluation;
+    /**
+     * 是否为超限额计划(0:未超额,1:超额)
+     */
+    @ApiModelProperty(value = "是否为超限额计划(0:未超额,1:超额)")
+    private String isExcess;
+    /**
+     * 采购服务站
+     */
+    @ApiModelProperty(value = "采购服务站")
+    private String purchaseServices;
+    /**
+     * 采购方式
+     */
+    @ApiModelProperty(value = "采购方式")
+    private String purchaseMode;
+    /**
+     * 计划提报需求时间--->需求单位成功提报采购需求的日期(具体到月)
+     */
+    @ApiModelProperty(value = "计划提报需求时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date demandCommitTime;
+    /**
+     * 计划完成采购时间--->公示中标结果的日期,即填制中标信息的日期(具体到月)
+     */
+    @ApiModelProperty(value = "计划完成采购时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date purchaseFinishTime;
+    /**
+     * 计划交付时间--->供应商完成并交付后,使用单位收到标的日期,即填制建设文档的日期
+     */
+    @ApiModelProperty(value = "计划交付时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date deliverTime;
+    /**
+     * 项目属性--->应急应战项目、重大规划任务项目、规划任务项目或一般项目
+     */
+    @ApiModelProperty(value = "项目属性")
+    private String projectAttribute;
+    /**
+     * 项目状态--->包括计划待提交、计划待审核、计划已退回、计划已审核
+     */
+    @ApiModelProperty(value = "项目状态")
+    private String projectStatus;
+    /**
+     * 备注
+     */
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+    /**
+     * 创建者
+     */
+    private String createBy;
+}

+ 118 - 0
purchase-system/src/main/java/com/ozs/plan/doman/vo/responseVo/PlanOfYearsResponseVo.java

@@ -0,0 +1,118 @@
+package com.ozs.plan.doman.vo.responseVo;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ozs.common.annotation.Excel;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author buzhanyi
+ */
+@Data
+public class PlanOfYearsResponseVo {
+
+    /**
+     * 主键编号
+     */
+    private Long planYearId;
+    /**
+     * 采购单位(登录账号的单位)
+     */
+    @Excel(name = "采购单位")
+    private Long purchaseUnit;
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称")
+    private String projectName;
+    /**
+     * 需求概况
+     */
+    @Excel(name = "需求概况")
+    private String demandOverview;
+    /**
+     * 概算金额(万元(保留小数点后两位)
+     */
+    @Excel(name = "概算金额")
+    private BigDecimal evaluation;
+    /**
+     * 是否为超限额计划
+     */
+    @Excel(name = "是否为超限额计划")
+    private String isExcess;
+    /**
+     * 采购服务站
+     */
+    @Excel(name = "采购服务站")
+    private String purchaseServices;
+    /**
+     * 采购方式
+     */
+    @Excel(name = "采购方式")
+    private String purchaseMode;
+    /**
+     * 计划提报需求时间--->需求单位成功提报采购需求的日期(具体到月)
+     */
+    @Excel(name = "计划提报需求时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date demandCommitTime;
+    /**
+     * 计划完成采购时间--->公示中标结果的日期,即填制中标信息的日期(具体到月)
+     */
+    @Excel(name = "计划完成采购时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date purchaseFinishTime;
+    /**
+     * 计划交付时间--->供应商完成并交付后,使用单位收到标的日期,即填制建设文档的日期
+     */
+    @Excel(name = "计划交付时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date deliverTime;
+    /**
+     * 项目属性--->应急应战项目、重大规划任务项目、规划任务项目或一般项目
+     */
+    @Excel(name = "项目属性")
+    private String projectAttribute;
+    /**
+     * 计划调整情况及理由--->如计划需要变更,在填写申请修改时需填写调整情况及理由,审核单位审核通过后显示
+     */
+    @Excel(name = "计划调整情况及理由")
+    private String readjustOfPlan;
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    private String remarks;
+    /**
+     * 项目状态--->包括计划待提交、计划待审核、计划已退回、计划已审核
+     */
+    @Excel(name = "项目状态")
+    private String projectStatus;
+
+
+    @Override
+    public String toString() {
+        return "PlanOfYears{" +
+                "planYearId=" + planYearId +
+                ", purchaseUnit=" + purchaseUnit +
+                ", projectName='" + projectName + '\'' +
+                ", demandOverview='" + demandOverview + '\'' +
+                ", evaluation=" + evaluation +
+                ", isExcess=" + isExcess +
+                ", purchaseServices=" + purchaseServices +
+                ", purchaseMode=" + purchaseMode +
+                ", demandCommitTime=" + demandCommitTime +
+                ", purchaseFinishTime=" + purchaseFinishTime +
+                ", deliverTime=" + deliverTime +
+                ", projectAttribute=" + projectAttribute +
+                ", readjustOfPlan='" + readjustOfPlan + '\'' +
+                ", remarks='" + remarks + '\'' +
+                ", projectStatus='" + projectStatus +
+
+                '}';
+    }
+}

+ 64 - 0
purchase-system/src/main/java/com/ozs/plan/mapper/PlanOfYearsMapper.java

@@ -0,0 +1,64 @@
+package com.ozs.plan.mapper;
+
+
+import com.ozs.base.mapper.BaseSupplierMapper;
+import com.ozs.plan.doman.PlanOfYears;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 用户与角色关联表 数据层
+ *
+ * @author bu
+ */
+@Mapper
+public interface PlanOfYearsMapper {
+
+    /**
+     * 查询年度计划记录集合
+     *
+     * @param planOfYears 年度计划请求对象
+     * @return 年度计划记录集合
+     */
+    public List<PlanOfYears> selectPlanOfYearsList(PlanOfYears planOfYears);
+
+    /**
+     * 创建年度计划
+     *
+     * @param planOfYears 年度计划请求对象
+     */
+    public int insertPlanOfYears(PlanOfYears planOfYears);
+
+    /**
+     * 批量删除年度计划
+     *
+     * @param planIds 需要删除的年度计划ID
+     * @return 结果
+     */
+    public int deletePlanOfYearsByIds(Long[] planIds);
+
+    /**
+     * 查询项目名称是否存在
+     *
+     * @param projectName 项目名称
+     * @return 结果
+     */
+    public int countProjectName(String projectName);
+
+    PlanOfYears getById(Long planYearId);
+
+    /**
+     * 查询项目名称是否存在(除自己以外)
+     *
+     * @param projectName 项目名称
+     * @return 结果
+     */
+    public int countProjectNameOther(@Param("projectName") String projectName, @Param("planYearId") String planYearId);
+
+    public int updateById(PlanOfYears ofYears);
+
+
+    public int deletePlanOfYearsById(Long planId);
+}

+ 46 - 0
purchase-system/src/main/java/com/ozs/plan/service/PlanOfYearsService.java

@@ -0,0 +1,46 @@
+package com.ozs.plan.service;
+
+
+import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.plan.doman.PlanOfYears;
+import com.ozs.plan.doman.vo.requestVo.PlanOfYearsStandardVo;
+import com.ozs.plan.doman.vo.responseVo.PlanOfYearsResponseVo;
+
+import java.util.List;
+
+/**
+ * 系统访问日志情况信息 服务层
+ *
+ * @author bu
+ */
+public interface PlanOfYearsService {
+
+    /**
+     * 查询年度计划记录集合
+     *
+     * @param vo 年度计划请求对象
+     * @return 年度计划记录集合
+     */
+    public List<PlanOfYears> selectPlanOfYearsList(PlanOfYearsStandardVo vo);
+
+    /**
+     * 创建年度计划
+     *
+     * @param yearsStandardVo 年度计划请求对象
+     */
+    public AjaxResult insertPlanOfYears(PlanOfYearsStandardVo yearsStandardVo);
+
+    /**
+     * 批量删除年度计划
+     *
+     * @param planIds 需要删除的年度计划ID
+     * @return 结果
+     */
+    public AjaxResult deletePlanOfYearsByIds(Long[] planIds);
+
+    public AjaxResult deletePlanOfYearsById(Long planYearId);
+
+    public AjaxResult view(PlanOfYearsStandardVo yearsStandardVo);
+
+    public AjaxResult update(PlanOfYearsStandardVo yearsStandardVo);
+}

+ 95 - 0
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanOfYearsServiceImpl.java

@@ -0,0 +1,95 @@
+package com.ozs.plan.service.impl;
+
+import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.common.enums.ProjectStatus;
+import com.ozs.common.utils.bean.BeanUtils;
+import com.ozs.plan.doman.PlanOfYears;
+import com.ozs.plan.doman.vo.requestVo.PlanOfYearsStandardVo;
+import com.ozs.plan.doman.vo.responseVo.PlanOfYearsResponseVo;
+import com.ozs.plan.mapper.PlanOfYearsMapper;
+import com.ozs.plan.service.PlanOfYearsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author buzhanyi
+ */
+@Service
+public class PlanOfYearsServiceImpl implements PlanOfYearsService {
+
+    @Autowired
+    PlanOfYearsMapper planOfYearsMapper;
+
+    @Override
+    public List<PlanOfYears> selectPlanOfYearsList(PlanOfYearsStandardVo vo) {
+        PlanOfYears ofYears = new PlanOfYears();
+        List<PlanOfYears> planOfYears = new ArrayList<>();
+        try {
+            BeanUtils.copyProperties(vo, ofYears);
+            planOfYears = planOfYearsMapper.selectPlanOfYearsList(ofYears);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return planOfYears;
+    }
+
+    @Override
+    public AjaxResult insertPlanOfYears(PlanOfYearsStandardVo yearsStandardVo) {
+        if (planOfYearsMapper.countProjectName(yearsStandardVo.getProjectName()) > 0) {
+            return AjaxResult.error("该项目名称已经存在");
+        }
+        PlanOfYears ofYears = new PlanOfYears();
+        try {
+            BeanUtils.copyProperties(yearsStandardVo, ofYears);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //判断是否为超额计划---
+
+        ofYears.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
+        ofYears.setCreateTime(new Date());
+        planOfYearsMapper.insertPlanOfYears(ofYears);
+        return AjaxResult.success();
+    }
+
+    @Override
+    public AjaxResult deletePlanOfYearsByIds(Long[] planIds) {
+        planOfYearsMapper.deletePlanOfYearsByIds(planIds);
+        return AjaxResult.success();
+    }
+
+    @Override
+    public AjaxResult deletePlanOfYearsById(Long planId) {
+        planOfYearsMapper.deletePlanOfYearsById(planId);
+        return AjaxResult.success();
+    }
+
+    @Override
+    public AjaxResult view(PlanOfYearsStandardVo yearsStandardVo) {
+        PlanOfYears byId = planOfYearsMapper.getById(yearsStandardVo.getPlanYearId());
+        if (byId == null) {
+            return AjaxResult.error("数据查询失败");
+        }
+        return AjaxResult.success(byId);
+    }
+
+    @Override
+    public AjaxResult update(PlanOfYearsStandardVo yearsStandardVo) {
+        if (planOfYearsMapper.countProjectNameOther(yearsStandardVo.getProjectName(), String.valueOf(yearsStandardVo.getPlanYearId())) > 0) {
+            return AjaxResult.error("该项目名称已经存在");
+        }
+        PlanOfYears ofYears = new PlanOfYears();
+        try {
+            BeanUtils.copyProperties(yearsStandardVo, ofYears);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        planOfYearsMapper.updateById(ofYears);
+        return AjaxResult.success();
+    }
+
+}

+ 43 - 0
purchase-system/src/main/java/com/ozs/system/domain/vo/requestVo/SysDeptRequestVo.java

@@ -0,0 +1,43 @@
+package com.ozs.system.domain.vo.requestVo;
+
+
+import java.io.Serializable;
+
+/**
+ * @author Administrator
+ */
+public class SysDeptRequestVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 部门ID
+     */
+    private Long deptId;
+
+    /**
+     * 父部门ID
+     */
+    private Long parentId;
+
+    /**
+     * 部门名称
+     */
+    private String deptName;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNum;
+    /**
+     * 联系电话
+     */
+    private String phone;
+    /**
+     * 备注
+     */
+    private String remarks;
+    /**
+     * 地址
+     */
+    private String address;
+}

+ 46 - 0
purchase-system/src/main/java/com/ozs/system/domain/vo/responseVo/SysDeptResponseVo.java

@@ -0,0 +1,46 @@
+package com.ozs.system.domain.vo.responseVo;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author Administrator
+ */
+@Data
+public class SysDeptResponseVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 部门ID
+     */
+    private Long deptId;
+
+    /**
+     * 父部门ID
+     */
+    private Long parentId;
+
+    /**
+     * 部门名称
+     */
+    private String deptName;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNum;
+    /**
+     * 联系电话
+     */
+    private String phone;
+    /**
+     * 备注
+     */
+    private String remarks;
+    /**
+     * 地址
+     */
+    private String address;
+}

+ 3 - 1
purchase-system/src/main/java/com/ozs/system/service/ISysDeptService.java

@@ -1,6 +1,8 @@
 package com.ozs.system.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.ozs.common.core.domain.TreeSelect;
 import com.ozs.common.core.domain.entity.SysDept;
 
@@ -57,7 +59,7 @@ public interface ISysDeptService
      * @param deptId 部门ID
      * @return 部门信息
      */
-    public SysDept selectDeptById(Long deptId);
+    public Map<String, Object> selectDeptById(Long deptId);
 
     /**
      * 根据ID查询所有子部门(正常状态)

+ 22 - 2
purchase-system/src/main/java/com/ozs/system/service/impl/SysDeptServiceImpl.java

@@ -1,13 +1,20 @@
 package com.ozs.system.service.impl;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ozs.common.core.domain.entity.SysProcurementStandard;
+import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
 import com.ozs.system.mapper.SysDeptMapper;
+import com.ozs.system.mapper.SysProcurementStandardMapper;
 import com.ozs.system.mapper.SysRoleMapper;
 import com.ozs.system.service.ISysDeptService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ozs.common.annotation.DataScope;
@@ -22,6 +29,8 @@ import com.ozs.common.utils.SecurityUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.spring.SpringUtils;
 
+import javax.annotation.Resource;
+
 /**
  * 部门管理 服务实现
  *
@@ -35,6 +44,8 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     @Autowired
     private SysRoleMapper roleMapper;
+    @Resource
+    private SysProcurementStandardMapper sysProcurementStandardMapper;
 
     /**
      * 查询部门管理数据
@@ -122,9 +133,18 @@ public class SysDeptServiceImpl implements ISysDeptService
      * @return 部门信息
      */
     @Override
-    public SysDept selectDeptById(Long deptId)
+    public Map<String, Object> selectDeptById(Long deptId)
     {
-        return deptMapper.selectDeptById(deptId);
+        SysDept sysDept = deptMapper.selectDeptById(deptId);
+        SysDeptResponseVo sysDeptResponseVo = new SysDeptResponseVo();
+        BeanUtils.copyProperties(sysDept, sysDeptResponseVo);
+        QueryWrapper<SysProcurementStandard> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("dept_id",deptId);
+        List<SysProcurementStandard> sysProcurementStandardsList = sysProcurementStandardMapper.selectList(queryWrapper);
+        Map<String, Object> returnMap = new HashMap<>();
+        returnMap.put("sysDept",sysDeptResponseVo);
+        returnMap.put("sysProcurementStandardsList",sysProcurementStandardsList);
+        return returnMap;
     }
 
     /**

+ 120 - 0
purchase-system/src/main/resources/mapper/plan/PlanOfYearsMapper.xml

@@ -0,0 +1,120 @@
+<?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.ozs.plan.mapper.PlanOfYearsMapper">
+
+	<resultMap type="com.ozs.plan.doman.PlanOfYears" id="PlanOfYearsResult">
+		<id property="plan_year_id" column="planYearId"/>
+		<result property="purchase_unit" column="purchaseUnit"/>
+		<result property="project_name" column="projectName"/>
+		<result property="project_type" column="projectType"/>
+		<result property="demand_overview" column="demandOverview"/>
+		<result property="evaluation" column="evaluation"/>
+		<result property="is_excess" column="isExcess"/>
+		<result property="purchase_services" column="purchaseServices"/>
+		<result property="purchase_mode" column="purchaseMode"/>
+		<result property="demand_commit_time" column="demandCommitTime"/>
+		<result property="purchase_finish_time" column="purchaseFinishTime"/>
+		<result property="deliver_time" column="deliverTime"/>
+		<result property="project_attribute" column="projectAttribute"/>
+		<result property="readjust_of_plan" column="readjustOfPlan"/>
+		<result property="remarks" column="remarks"/>
+		<result property="project_status" column="projectStatus"/>
+		<result property="create_by" column="createBy"/>
+		<result property="create_time" column="createTime"/>
+		<result property="is_delete" column="isDelete"/>
+	</resultMap>
+
+	<update id="updateById" parameterType="com.ozs.plan.doman.PlanOfYears">
+		update plan_of_years
+		set purchase_unit=#{purchaseUnit},
+			project_name=#{projectName},
+			project_type=#{projectType},
+			demand_overview=#{demandOverview},
+			evaluation=#{evaluation},
+			is_excess=#{isExcess},
+			purchase_services=#{purchaseServices},
+			purchase_mode=#{purchaseMode},
+			demand_commit_time=#{demandCommitTime},
+			purchase_finish_time=#{purchaseFinishTime},
+			deliver_time=#{deliverTime},
+			project_attribute=#{projectAttribute},
+			readjust_of_plan=#{readjustOfPlan},
+			remarks=#{remarks},
+			project_status=#{projectStatus}
+		where plan_year_id = #{planYearId}
+	</update>
+
+	<select id="selectPlanOfYearsList" parameterType="com.ozs.plan.doman.PlanOfYears" resultMap="PlanOfYearsResult">
+		select * from plan_of_years
+		<where>
+			<if test="projectName != null and projectName != ''">
+				AND project_name like concat('%', #{projectName}, '%')
+			</if>
+			<if test="purchaseServices != null and purchaseServices != ''">
+				AND purchase_services = #{purchaseServices}
+			</if>
+			<if test="isExcess != null and isExcess != ''">
+				AND is_excess like = #{isExcess}
+			</if>
+			<if test="projectStatus != null and projectStatus != ''">
+				AND project_status = #{projectStatus}
+			</if>
+			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+				and date_format(demand_commit_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			</if>
+			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+				and date_format(demand_commit_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			</if>
+		</where>
+		order by create_time desc
+	</select>
+
+	<select id="countProjectName" resultType="java.lang.Integer" parameterType="java.lang.String">
+		select count(plan_of_years.plan_year_id)
+		from plan_of_years
+		where project_name = #{projectName}
+	</select>
+
+	<select id="getById" resultType="com.ozs.plan.doman.PlanOfYears" parameterType="java.lang.Long">
+		select *
+		from plan_of_years
+		where plan_year_id = #{planYearId}
+	</select>
+
+	<select id="countProjectNameOther" resultType="java.lang.Integer" parameterType="java.lang.String">
+		select count(plan_of_years.plan_year_id)
+		from plan_of_years
+		where project_name = #{projectName}
+		  and plan_year_id != #{planYearId}
+	</select>
+
+	<insert id="insertPlanOfYears" parameterType="com.ozs.plan.doman.PlanOfYears">
+		insert into plan_of_years (purchase_unit, project_name, project_type, demand_overview, evaluation, is_excess,
+								   purchase_services, purchase_mode, demand_commit_time, purchase_finish_time,
+								   deliver_time, project_attribute, readjust_of_plan, remarks, project_status,
+								   create_by, create_time, is_delete)
+		values (#{purchaseUnit}, #{projectName}, #{projectType}, #{demandOverview}, #{evaluation}, #{isExcess},
+				#{purchaseServices}, #{purchaseMode}, #{demandCommitTime}, #{purchaseFinishTime}, #{deliverTime},
+				#{projectAttribute}, #{readjustOfPlan}, #{remarks}, #{projectStatus}, #{createBy}, #{createTime}, 0)
+	</insert>
+
+	<update id="deletePlanOfYearsByIds" parameterType="java.lang.Long">
+		update plan_of_years set is_delete=1 where plan_year_id in
+		<foreach collection="array" item="item" open="(" separator="," close=")">
+			#{item}
+		</foreach>
+	</update>
+
+	<update id="deletePlanOfYearsById" parameterType="java.lang.Long">
+		update plan_of_years
+		set is_delete=1
+		where plan_year_id = #{plan_year_id}
+	</update>
+
+	<!--    <update id="cleanLogininfor">-->
+	<!--        truncate table sys_logininfor-->
+	<!--    </update>-->
+
+</mapper>

+ 121 - 114
purchase-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -1,62 +1,63 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ozs.system.mapper.SysDeptMapper">
 
-	<resultMap type="SysDept" id="SysDeptResult">
-		<id     property="deptId"     column="dept_id"     />
-		<result property="parentId"   column="parent_id"   />
-		<result property="ancestors"  column="ancestors"   />
-		<result property="deptName"   column="dept_name"   />
-		<result property="orderNum"   column="order_num"   />
-		<result property="leader"     column="leader"      />
-		<result property="phone"      column="phone"       />
-		<result property="email"      column="email"       />
-		<result property="status"     column="status"      />
-		<result property="delFlag"    column="del_flag"    />
-		<result property="parentName" column="parent_name" />
-		<result property="createBy"   column="create_by"   />
-		<result property="createTime" column="create_time" />
-		<result property="updateBy"   column="update_by"   />
-		<result property="updateTime" column="update_time" />
-	</resultMap>
-
-	<sql id="selectDeptVo">
+    <resultMap type="SysDept" id="SysDeptResult">
+        <id property="deptId" column="dept_id"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="ancestors" column="ancestors"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="orderNum" column="order_num"/>
+        <result property="leader" column="leader"/>
+        <result property="phone" column="phone"/>
+        <result property="email" column="email"/>
+        <result property="status" column="status"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="parentName" column="parent_name"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectDeptVo">
         select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
         from sys_dept d
     </sql>
 
-	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
+    <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
         where d.del_flag = '0'
-		<if test="deptId != null and deptId != 0">
-			AND dept_id = #{deptId}
-		</if>
+        <if test="deptId != null and deptId != 0">
+            AND dept_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>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-		order by d.parent_id, d.order_num
+            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>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by d.parent_id, d.order_num
     </select>
 
     <select id="selectDeptListByRoleId" resultType="Long">
-		select d.dept_id
-		from sys_dept d
-            left join sys_role_dept rd on d.dept_id = rd.dept_id
+        select d.dept_id
+        from sys_dept d
+        left join sys_role_dept rd on d.dept_id = rd.dept_id
         where rd.role_id = #{roleId}
-            <if test="deptCheckStrictly">
-              and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
-            </if>
-		order by d.parent_id, d.order_num
-	</select>
+        <if test="deptCheckStrictly">
+            and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id =
+            rd.dept_id and rd.role_id = #{roleId})
+        </if>
+        order by d.parent_id, d.order_num
+    </select>
 
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
@@ -69,90 +70,96 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
 	</select>
 
-	<select id="hasChildByDeptId" parameterType="Long" resultType="int">
+    <select id="hasChildByDeptId" parameterType="Long" resultType="int">
 		select count(1) from sys_dept
 		where del_flag = '0' and parent_id = #{deptId} limit 1
 	</select>
 
-	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
+    <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select * from sys_dept where find_in_set(#{deptId}, ancestors)
 	</select>
 
-	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
+    <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
 		select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
 	</select>
 
-	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
-	    <include refid="selectDeptVo"/>
-		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
-	</select>
+    <select id="checkDeptNameUnique" resultMap="SysDeptResult">
+        <include refid="selectDeptVo"/>
+        where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
+    </select>
 
     <insert id="insertDept" parameterType="SysDept">
- 		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="deptName != null and deptName != ''">dept_name,</if>
- 			<if test="ancestors != null and ancestors != ''">ancestors,</if>
- 			<if test="orderNum != null">order_num,</if>
- 			<if test="leader != null and leader != ''">leader,</if>
- 			<if test="phone != null and phone != ''">phone,</if>
- 			<if test="email != null and email != ''">email,</if>
- 			<if test="status != null">status,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			create_time
- 		)values(
- 			<if test="deptId != null and deptId != 0">#{deptId},</if>
- 			<if test="parentId != null and parentId != 0">#{parentId},</if>
- 			<if test="deptName != null and deptName != ''">#{deptName},</if>
- 			<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
- 			<if test="orderNum != null">#{orderNum},</if>
- 			<if test="leader != null and leader != ''">#{leader},</if>
- 			<if test="phone != null and phone != ''">#{phone},</if>
- 			<if test="email != null and email != ''">#{email},</if>
- 			<if test="status != null">#{status},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
- 		)
-	</insert>
-
-	<update id="updateDept" parameterType="SysDept">
- 		update sys_dept
- 		<set>
- 			<if test="parentId != null and parentId != 0">parent_id = #{parentId},</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>
- 			<if test="leader != null">leader = #{leader},</if>
- 			<if test="phone != null">phone = #{phone},</if>
- 			<if test="email != null">email = #{email},</if>
- 			<if test="status != null and status != ''">status = #{status},</if>
- 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
- 		</set>
- 		where dept_id = #{deptId}
-	</update>
-
-	<update id="updateDeptChildren" parameterType="java.util.List">
-	    update sys_dept set ancestors =
-	    <foreach collection="depts" item="item" index="index"
-	        separator=" " open="case dept_id" close="end">
-	        when #{item.deptId} then #{item.ancestors}
-	    </foreach>
-	    where dept_id in
-	    <foreach collection="depts" item="item" index="index"
-	        separator="," open="(" close=")">
-	        #{item.deptId}
-	    </foreach>
-	</update>
-
-	<update id="updateDeptStatusNormal" parameterType="Long">
- 	    update sys_dept set status = '0' where dept_id in
- 	    <foreach collection="array" item="deptId" open="(" separator="," close=")">
-        	#{deptId}
+        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="deptName != null and deptName != ''">dept_name,</if>
+        <if test="ancestors != null and ancestors != ''">ancestors,</if>
+        <if test="orderNum != null">order_num,</if>
+        <if test="leader != null and leader != ''">leader,</if>
+        <if test="phone != null and phone != ''">phone,</if>
+        <if test="email != null and email != ''">email,</if>
+        <if test="address != null and address != ''">address,</if>
+        <if test="remarks != null and remarks != ''">remarks,</if>
+        <if test="status != null">status,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        create_time
+        )values(
+        <if test="deptId != null and deptId != 0">#{deptId},</if>
+        <if test="parentId != null and parentId != 0">#{parentId},</if>
+        <if test="deptName != null and deptName != ''">#{deptName},</if>
+        <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
+        <if test="orderNum != null">#{orderNum},</if>
+        <if test="leader != null and leader != ''">#{leader},</if>
+        <if test="phone != null and phone != ''">#{phone},</if>
+        <if test="email != null and email != ''">#{email},</if>
+        <if test="address != null and address != ''">#{address},</if>
+        <if test="remarks != null and remarks != ''">#{remarks},</if>
+        <if test="status != null">#{status},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        sysdate()
+        )
+    </insert>
+
+    <update id="updateDept" parameterType="SysDept">
+        update sys_dept
+        <set>
+            <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
+            <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
+            <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
+            <if test="address != null and address != ''">#{address},</if>
+            <if test="remarks != null and remarks != ''">#{remarks},</if>
+            <if test="orderNum != null">order_num = #{orderNum},</if>
+            <if test="leader != null">leader = #{leader},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="email != null">email = #{email},</if>
+            <if test="status != null and status != ''">status = #{status},</if>
+            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            update_time = sysdate()
+        </set>
+        where dept_id = #{deptId}
+    </update>
+
+    <update id="updateDeptChildren" parameterType="java.util.List">
+        update sys_dept set ancestors =
+        <foreach collection="depts" item="item" index="index"
+                 separator=" " open="case dept_id" close="end">
+            when #{item.deptId} then #{item.ancestors}
+        </foreach>
+        where dept_id in
+        <foreach collection="depts" item="item" index="index"
+                 separator="," open="(" close=")">
+            #{item.deptId}
+        </foreach>
+    </update>
+
+    <update id="updateDeptStatusNormal" parameterType="Long">
+        update sys_dept set status = '0' where dept_id in
+        <foreach collection="array" item="deptId" open="(" separator="," close=")">
+            #{deptId}
         </foreach>
-	</update>
+    </update>
 
-	<delete id="deleteDeptById" parameterType="Long">
+    <delete id="deleteDeptById" parameterType="Long">
 		update sys_dept set del_flag = '2' where dept_id = #{deptId}
 	</delete>