Browse Source

20230315 9:15

wangzhuo 2 years ago
parent
commit
7debe1d500

+ 136 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/cost/TCostManagementController.java

@@ -0,0 +1,136 @@
+package com.ruoyi.web.controller.cost;
+
+import java.util.List;
+
+import com.ruoyi.anpin.domain.TCostManagement;
+import com.ruoyi.anpin.service.ITCostManagementService;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.framework.web.service.TokenService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 费用管理Controller
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+@RestController
+@RequestMapping("/anpin/management")
+public class TCostManagementController extends BaseController
+{
+    @Autowired
+    private ITCostManagementService tCostManagementService;
+
+    /**
+     * 查询费用管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:management:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TCostManagement tCostManagement)
+    {
+        startPage();
+        List<TCostManagement> list = tCostManagementService.selectTCostManagementList(tCostManagement);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出费用管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:management:export')")
+    @Log(title = "费用管理", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TCostManagement tCostManagement)
+    {
+        List<TCostManagement> list = tCostManagementService.selectTCostManagementList(tCostManagement);
+        ExcelUtil<TCostManagement> util = new ExcelUtil<TCostManagement>(TCostManagement.class);
+        return util.exportExcel(list, "费用管理");
+    }
+
+    /**
+     * 获取费用管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:management:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId)
+    {
+        return AjaxResult.success(tCostManagementService.selectTCostManagementById(fId));
+    }
+
+    /**
+     * 新增费用管理
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:management:add')")
+    @Log(title = "费用管理", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/managementAdd")
+    @RepeatSubmit
+    public AjaxResult managementAdd(@RequestParam("tCostManagement") String tCostManagement,
+                                    @RequestParam("tCostManagementItem") String tCostManagementItem,
+                                    @RequestParam("tEnclosure") String tEnclosure)
+    {
+        if (StringUtils.isNull(tCostManagement) || "{}".equals(tCostManagement)) {
+            return AjaxResult.error("未找到主表数据,请确认");
+        }
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tCostManagementService.insertTCostManagement(tCostManagement,tCostManagementItem,tEnclosure,loginUser);
+    }
+
+    /**
+     * 修改费用管理
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:management:edit')")
+    @Log(title = "费用管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TCostManagement tCostManagement)
+    {
+        return toAjax(tCostManagementService.updateTCostManagement(tCostManagement));
+    }
+
+    /**
+     * 删除费用管理
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:management:remove')")
+    @Log(title = "费用管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds)
+    {
+        return toAjax(tCostManagementService.deleteTCostManagementByIds(fIds));
+    }
+
+    /**
+     * 费用管理提交审批
+     * @param tCostManagement
+     * @param tCostManagementItem
+     * @param tEnclosure
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:management:submitCostManagement')")
+    @Log(title = "费用管理审批", businessType = BusinessType.INSERT)
+    @PostMapping("/submitCostManagement")
+    public AjaxResult submitCostManagement(@RequestParam("tCostManagement") String tCostManagement,
+                                     @RequestParam("tCostManagementItem") String tCostManagementItem,
+                                     @RequestParam("tEnclosure") String tEnclosure)
+    {
+        if (StringUtils.isEmpty(tCostManagement) || "{}".equals(tCostManagement)){
+            return AjaxResult.error("主表数据不能为空");
+        }
+        if (StringUtils.isEmpty(tCostManagementItem)|| "[]".equals(tCostManagementItem)){
+            return AjaxResult.error("明细表数据不能为空");
+        }
+        String billType = "FYGL";
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tCostManagementService.submitCostManagement(tCostManagement,tCostManagementItem,tEnclosure,loginUser,billType);
+    }
+}

+ 103 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/cost/TCostManagementItemController.java

@@ -0,0 +1,103 @@
+package com.ruoyi.web.controller.cost;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.anpin.domain.TCostManagementItem;
+import com.ruoyi.anpin.service.ITCostManagementItemService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 费用管理明细Controller
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+@RestController
+@RequestMapping("/anpin/managementItem")
+public class TCostManagementItemController extends BaseController
+{
+    @Autowired
+    private ITCostManagementItemService tCostManagementItemService;
+
+    /**
+     * 查询费用管理明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:managementItem:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TCostManagementItem tCostManagementItem)
+    {
+        startPage();
+        List<TCostManagementItem> list = tCostManagementItemService.selectTCostManagementItemList(tCostManagementItem);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出费用管理明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:managementItem:export')")
+    @Log(title = "费用管理明细", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TCostManagementItem tCostManagementItem)
+    {
+        List<TCostManagementItem> list = tCostManagementItemService.selectTCostManagementItemList(tCostManagementItem);
+        ExcelUtil<TCostManagementItem> util = new ExcelUtil<TCostManagementItem>(TCostManagementItem.class);
+        return util.exportExcel(list, "item");
+    }
+
+    /**
+     * 获取费用管理明细详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:managementItem:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId)
+    {
+        return AjaxResult.success(tCostManagementItemService.selectTCostManagementItemById(fId));
+    }
+
+    /**
+     * 新增费用管理明细
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:managementItem:add')")
+    @Log(title = "费用管理明细", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TCostManagementItem tCostManagementItem)
+    {
+        return toAjax(tCostManagementItemService.insertTCostManagementItem(tCostManagementItem));
+    }
+
+    /**
+     * 修改费用管理明细
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:managementItem:edit')")
+    @Log(title = "费用管理明细", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TCostManagementItem tCostManagementItem)
+    {
+        return toAjax(tCostManagementItemService.updateTCostManagementItem(tCostManagementItem));
+    }
+
+    /**
+     * 删除费用管理明细
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:managementItem:remove')")
+    @Log(title = "费用管理明细", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds)
+    {
+        return toAjax(tCostManagementItemService.deleteTCostManagementItemByIds(fIds));
+    }
+}

+ 214 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/domain/TCostManagement.java

@@ -0,0 +1,214 @@
+package com.ruoyi.anpin.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.warehouseBusiness.domain.TEnclosure;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 费用管理对象 t_cost_management
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+public class TCostManagement extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long fId;
+
+    /** 编号 */
+    @Excel(name = "编号")
+    private String fNo;
+
+    /** 删除状态 */
+    private String delFlag;
+
+    /** 状态(0录入,1请核,2审批中,3审批通过,4完成) */
+    @Excel(name = "状态")
+    private String fStatus;
+
+    /** 部门id */
+    @Excel(name = "部门id")
+    private Long deptId;
+
+    /** 部门名称 */
+    @Excel(name = "部门名称")
+    private String deptName;
+
+    /** 创建人部门 */
+    @Excel(name = "创建人部门")
+    private String createDept;
+
+    /** 业务日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "业务日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date businessTime;
+
+    /** 业务类型 */
+    @Excel(name = "业务类型")
+    private String businessType;
+
+    /** 报销方式 */
+    @Excel(name = "报销方式")
+    private String expenseTypr;
+
+    /** 金额合计 */
+    @Excel(name = "金额合计")
+    private BigDecimal totalAmount;
+
+    /**
+     * 明细集合
+     */
+    private List<TCostManagementItem> itemList;
+
+    /**
+     * 附件集合
+     */
+    private List<TEnclosure> fileList;
+
+    public void setfId(Long fId)
+    {
+        this.fId = fId;
+    }
+
+    public Long getfId()
+    {
+        return fId;
+    }
+    public void setfNo(String fNo)
+    {
+        this.fNo = fNo;
+    }
+
+    public String getfNo()
+    {
+        return fNo;
+    }
+    public void setDelFlag(String delFlag)
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag()
+    {
+        return delFlag;
+    }
+    public void setfStatus(String fStatus)
+    {
+        this.fStatus = fStatus;
+    }
+
+    public String getfStatus()
+    {
+        return fStatus;
+    }
+    public void setDeptId(Long deptId)
+    {
+        this.deptId = deptId;
+    }
+
+    public Long getDeptId()
+    {
+        return deptId;
+    }
+    public void setDeptName(String deptName)
+    {
+        this.deptName = deptName;
+    }
+
+    public String getDeptName()
+    {
+        return deptName;
+    }
+    public void setCreateDept(String createDept)
+    {
+        this.createDept = createDept;
+    }
+
+    public String getCreateDept()
+    {
+        return createDept;
+    }
+    public void setBusinessTime(Date businessTime)
+    {
+        this.businessTime = businessTime;
+    }
+
+    public Date getBusinessTime()
+    {
+        return businessTime;
+    }
+    public void setBusinessType(String businessType)
+    {
+        this.businessType = businessType;
+    }
+
+    public String getBusinessType()
+    {
+        return businessType;
+    }
+    public void setExpenseTypr(String expenseTypr)
+    {
+        this.expenseTypr = expenseTypr;
+    }
+
+    public String getExpenseTypr()
+    {
+        return expenseTypr;
+    }
+    public void setTotalAmount(BigDecimal totalAmount)
+    {
+        this.totalAmount = totalAmount;
+    }
+
+    public BigDecimal getTotalAmount()
+    {
+        return totalAmount;
+    }
+
+    public List<TCostManagementItem> getItemList() {
+        return itemList;
+    }
+
+    public void setItemList(List<TCostManagementItem> itemList) {
+        this.itemList = itemList;
+    }
+
+    public List<TEnclosure> getFileList() {
+        return fileList;
+    }
+
+    public void setFileList(List<TEnclosure> fileList) {
+        this.fileList = fileList;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("fId", getfId())
+            .append("fNo", getfNo())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .append("delFlag", getDelFlag())
+            .append("fStatus", getfStatus())
+            .append("deptId", getDeptId())
+            .append("deptName", getDeptName())
+            .append("createDept", getCreateDept())
+            .append("businessTime", getBusinessTime())
+            .append("businessType", getBusinessType())
+            .append("expenseTypr", getExpenseTypr())
+            .append("totalAmount", getTotalAmount())
+            .toString();
+    }
+}

+ 252 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/domain/TCostManagementItem.java

@@ -0,0 +1,252 @@
+package com.ruoyi.anpin.domain;
+
+import java.math.BigDecimal;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 费用管理明细对象 t_cost_management_item
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+public class TCostManagementItem extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long fId;
+
+    /** 主表主键 */
+    @Excel(name = "主表主键")
+    private Long fPid;
+
+    /** 创建人部门 */
+    @Excel(name = "创建人部门")
+    private String createDept;
+
+    /** 删除状态 */
+    private String delFlag;
+
+    /** 状态 */
+    @Excel(name = "状态")
+    private String fStatus;
+
+    /** 费用名称 */
+    @Excel(name = "费用名称")
+    private String expenseName;
+
+    /** 费用id */
+    @Excel(name = "费用id")
+    private Long expenseId;
+
+    /** 金额 */
+    @Excel(name = "金额")
+    private BigDecimal amount;
+
+    /** 项目id */
+    @Excel(name = "项目id")
+    private Long belongsProjectId;
+
+    /** 项目名称 */
+    @Excel(name = "项目名称")
+    private String belongsProjectName;
+
+    /** 所属人员id */
+    @Excel(name = "所属人员id")
+    private Long personnelId;
+
+    /** 所属人员名称 */
+    @Excel(name = "所属人员名称")
+    private String personnelName;
+
+    /** 所属部门id */
+    @Excel(name = "所属部门id")
+    private Long departmentId;
+
+    /** 所属部门名称 */
+    @Excel(name = "所属部门名称")
+    private String departmentName;
+
+    /** 物料id */
+    @Excel(name = "物料id")
+    private Long matterId;
+
+    /** 物料名称 */
+    @Excel(name = "物料名称")
+    private String matterName;
+
+    public void setfId(Long fId)
+    {
+        this.fId = fId;
+    }
+
+    public Long getfId()
+    {
+        return fId;
+    }
+    public void setfPid(Long fPid)
+    {
+        this.fPid = fPid;
+    }
+
+    public Long getfPid()
+    {
+        return fPid;
+    }
+    public void setCreateDept(String createDept)
+    {
+        this.createDept = createDept;
+    }
+
+    public String getCreateDept()
+    {
+        return createDept;
+    }
+    public void setDelFlag(String delFlag)
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag()
+    {
+        return delFlag;
+    }
+    public void setfStatus(String fStatus)
+    {
+        this.fStatus = fStatus;
+    }
+
+    public String getfStatus()
+    {
+        return fStatus;
+    }
+    public void setExpenseName(String expenseName)
+    {
+        this.expenseName = expenseName;
+    }
+
+    public String getExpenseName()
+    {
+        return expenseName;
+    }
+    public void setExpenseId(Long expenseId)
+    {
+        this.expenseId = expenseId;
+    }
+
+    public Long getExpenseId()
+    {
+        return expenseId;
+    }
+    public void setAmount(BigDecimal amount)
+    {
+        this.amount = amount;
+    }
+
+    public BigDecimal getAmount()
+    {
+        return amount;
+    }
+    public void setBelongsProjectId(Long belongsProjectId)
+    {
+        this.belongsProjectId = belongsProjectId;
+    }
+
+    public Long getBelongsProjectId()
+    {
+        return belongsProjectId;
+    }
+    public void setBelongsProjectName(String belongsProjectName)
+    {
+        this.belongsProjectName = belongsProjectName;
+    }
+
+    public String getBelongsProjectName()
+    {
+        return belongsProjectName;
+    }
+    public void setPersonnelId(Long personnelId)
+    {
+        this.personnelId = personnelId;
+    }
+
+    public Long getPersonnelId()
+    {
+        return personnelId;
+    }
+    public void setPersonnelName(String personnelName)
+    {
+        this.personnelName = personnelName;
+    }
+
+    public String getPersonnelName()
+    {
+        return personnelName;
+    }
+    public void setDepartmentId(Long departmentId)
+    {
+        this.departmentId = departmentId;
+    }
+
+    public Long getDepartmentId()
+    {
+        return departmentId;
+    }
+    public void setDepartmentName(String departmentName)
+    {
+        this.departmentName = departmentName;
+    }
+
+    public String getDepartmentName()
+    {
+        return departmentName;
+    }
+    public void setMatterId(Long matterId)
+    {
+        this.matterId = matterId;
+    }
+
+    public Long getMatterId()
+    {
+        return matterId;
+    }
+    public void setMatterName(String matterName)
+    {
+        this.matterName = matterName;
+    }
+
+    public String getMatterName()
+    {
+        return matterName;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("fId", getfId())
+            .append("fPid", getfPid())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("createDept", getCreateDept())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .append("delFlag", getDelFlag())
+            .append("fStatus", getfStatus())
+            .append("expenseName", getExpenseName())
+            .append("expenseId", getExpenseId())
+            .append("amount", getAmount())
+            .append("belongsProjectId", getBelongsProjectId())
+            .append("belongsProjectName", getBelongsProjectName())
+            .append("personnelId", getPersonnelId())
+            .append("personnelName", getPersonnelName())
+            .append("departmentId", getDepartmentId())
+            .append("departmentName", getDepartmentName())
+            .append("matterId", getMatterId())
+            .append("matterName", getMatterName())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/mapper/TCostManagementItemMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.anpin.mapper;
+
+import java.util.List;
+import com.ruoyi.anpin.domain.TCostManagementItem;
+
+/**
+ * 费用管理明细Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+public interface TCostManagementItemMapper 
+{
+    /**
+     * 查询费用管理明细
+     * 
+     * @param fId 费用管理明细ID
+     * @return 费用管理明细
+     */
+    public TCostManagementItem selectTCostManagementItemById(Long fId);
+
+    /**
+     * 查询费用管理明细列表
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 费用管理明细集合
+     */
+    public List<TCostManagementItem> selectTCostManagementItemList(TCostManagementItem tCostManagementItem);
+
+    /**
+     * 新增费用管理明细
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 结果
+     */
+    public int insertTCostManagementItem(TCostManagementItem tCostManagementItem);
+
+    /**
+     * 修改费用管理明细
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 结果
+     */
+    public int updateTCostManagementItem(TCostManagementItem tCostManagementItem);
+
+    /**
+     * 删除费用管理明细
+     * 
+     * @param fId 费用管理明细ID
+     * @return 结果
+     */
+    public int deleteTCostManagementItemById(Long fId);
+
+    /**
+     * 批量删除费用管理明细
+     * 
+     * @param fIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTCostManagementItemByIds(Long[] fIds);
+}

+ 62 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/mapper/TCostManagementMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.anpin.mapper;
+
+import com.ruoyi.anpin.domain.TCostManagement;
+
+import java.util.List;
+
+/**
+ * 费用管理Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+public interface TCostManagementMapper 
+{
+    /**
+     * 查询费用管理
+     * 
+     * @param fId 费用管理ID
+     * @return 费用管理
+     */
+    public TCostManagement selectTCostManagementById(Long fId);
+
+    /**
+     * 查询费用管理列表
+     * 
+     * @param tCostManagement 费用管理
+     * @return 费用管理集合
+     */
+    public List<TCostManagement> selectTCostManagementList(TCostManagement tCostManagement);
+
+    /**
+     * 新增费用管理
+     * 
+     * @param tCostManagement 费用管理
+     * @return 结果
+     */
+    public int insertTCostManagement(TCostManagement tCostManagement);
+
+    /**
+     * 修改费用管理
+     * 
+     * @param tCostManagement 费用管理
+     * @return 结果
+     */
+    public int updateTCostManagement(TCostManagement tCostManagement);
+
+    /**
+     * 删除费用管理
+     * 
+     * @param fId 费用管理ID
+     * @return 结果
+     */
+    public int deleteTCostManagementById(Long fId);
+
+    /**
+     * 批量删除费用管理
+     * 
+     * @param fIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTCostManagementByIds(Long[] fIds);
+}

+ 61 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/service/ITCostManagementItemService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.anpin.service;
+
+import java.util.List;
+import com.ruoyi.anpin.domain.TCostManagementItem;
+
+/**
+ * 费用管理明细Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+public interface ITCostManagementItemService 
+{
+    /**
+     * 查询费用管理明细
+     * 
+     * @param fId 费用管理明细ID
+     * @return 费用管理明细
+     */
+    public TCostManagementItem selectTCostManagementItemById(Long fId);
+
+    /**
+     * 查询费用管理明细列表
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 费用管理明细集合
+     */
+    public List<TCostManagementItem> selectTCostManagementItemList(TCostManagementItem tCostManagementItem);
+
+    /**
+     * 新增费用管理明细
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 结果
+     */
+    public int insertTCostManagementItem(TCostManagementItem tCostManagementItem);
+
+    /**
+     * 修改费用管理明细
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 结果
+     */
+    public int updateTCostManagementItem(TCostManagementItem tCostManagementItem);
+
+    /**
+     * 批量删除费用管理明细
+     * 
+     * @param fIds 需要删除的费用管理明细ID
+     * @return 结果
+     */
+    public int deleteTCostManagementItemByIds(Long[] fIds);
+
+    /**
+     * 删除费用管理明细信息
+     * 
+     * @param fId 费用管理明细ID
+     * @return 结果
+     */
+    public int deleteTCostManagementItemById(Long fId);
+}

+ 72 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/service/ITCostManagementService.java

@@ -0,0 +1,72 @@
+package com.ruoyi.anpin.service;
+
+import com.ruoyi.anpin.domain.TCostManagement;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 费用管理Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+public interface ITCostManagementService 
+{
+    /**
+     * 查询费用管理
+     * 
+     * @param fId 费用管理ID
+     * @return 费用管理
+     */
+    public Map<String, Object> selectTCostManagementById(Long fId);
+
+    /**
+     * 查询费用管理列表
+     * 
+     * @param tCostManagement 费用管理
+     * @return 费用管理集合
+     */
+    public List<TCostManagement> selectTCostManagementList(TCostManagement tCostManagement);
+
+    /**
+     * 新增费用管理
+     * 
+     * @param tCostManagement 费用管理
+     * @return 结果
+     */
+    public AjaxResult insertTCostManagement(String tCostManagement, String tCostManagementItem, String tEnclosure, LoginUser loginUser);
+
+    /**
+     * 修改费用管理
+     * 
+     * @param tCostManagement 费用管理
+     * @return 结果
+     */
+    public int updateTCostManagement(TCostManagement tCostManagement);
+
+    /**
+     * 批量删除费用管理
+     * 
+     * @param fIds 需要删除的费用管理ID
+     * @return 结果
+     */
+    public int deleteTCostManagementByIds(Long[] fIds);
+
+    /**
+     * 删除费用管理信息
+     * 
+     * @param fId 费用管理ID
+     * @return 结果
+     */
+    public int deleteTCostManagementById(Long fId);
+
+    /**
+     * 费用管理提交审批
+     */
+    public AjaxResult submitCostManagement(String tCostManagement,String tCostManagementItem,String tEnclosure,LoginUser loginUser,String billType);
+}

+ 96 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/service/impl/TCostManagementItemServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.anpin.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.anpin.mapper.TCostManagementItemMapper;
+import com.ruoyi.anpin.domain.TCostManagementItem;
+import com.ruoyi.anpin.service.ITCostManagementItemService;
+
+/**
+ * 费用管理明细Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+@Service
+public class TCostManagementItemServiceImpl implements ITCostManagementItemService 
+{
+    @Autowired
+    private TCostManagementItemMapper tCostManagementItemMapper;
+
+    /**
+     * 查询费用管理明细
+     * 
+     * @param fId 费用管理明细ID
+     * @return 费用管理明细
+     */
+    @Override
+    public TCostManagementItem selectTCostManagementItemById(Long fId)
+    {
+        return tCostManagementItemMapper.selectTCostManagementItemById(fId);
+    }
+
+    /**
+     * 查询费用管理明细列表
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 费用管理明细
+     */
+    @Override
+    public List<TCostManagementItem> selectTCostManagementItemList(TCostManagementItem tCostManagementItem)
+    {
+        return tCostManagementItemMapper.selectTCostManagementItemList(tCostManagementItem);
+    }
+
+    /**
+     * 新增费用管理明细
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 结果
+     */
+    @Override
+    public int insertTCostManagementItem(TCostManagementItem tCostManagementItem)
+    {
+        tCostManagementItem.setCreateTime(DateUtils.getNowDate());
+        return tCostManagementItemMapper.insertTCostManagementItem(tCostManagementItem);
+    }
+
+    /**
+     * 修改费用管理明细
+     * 
+     * @param tCostManagementItem 费用管理明细
+     * @return 结果
+     */
+    @Override
+    public int updateTCostManagementItem(TCostManagementItem tCostManagementItem)
+    {
+        tCostManagementItem.setUpdateTime(DateUtils.getNowDate());
+        return tCostManagementItemMapper.updateTCostManagementItem(tCostManagementItem);
+    }
+
+    /**
+     * 批量删除费用管理明细
+     * 
+     * @param fIds 需要删除的费用管理明细ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTCostManagementItemByIds(Long[] fIds)
+    {
+        return tCostManagementItemMapper.deleteTCostManagementItemByIds(fIds);
+    }
+
+    /**
+     * 删除费用管理明细信息
+     * 
+     * @param fId 费用管理明细ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTCostManagementItemById(Long fId)
+    {
+        return tCostManagementItemMapper.deleteTCostManagementItemById(fId);
+    }
+}

+ 344 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/service/impl/TCostManagementServiceImpl.java

@@ -0,0 +1,344 @@
+package com.ruoyi.anpin.service.impl;
+
+import java.util.*;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.anpin.domain.TCostManagement;
+import com.ruoyi.anpin.domain.TCostManagementItem;
+import com.ruoyi.anpin.mapper.TCostManagementItemMapper;
+import com.ruoyi.anpin.mapper.TCostManagementMapper;
+import com.ruoyi.anpin.service.ITCostManagementService;
+import com.ruoyi.approvalFlow.domain.AuditItems;
+import com.ruoyi.approvalFlow.service.impl.AuditItemsServiceImpl;
+import com.ruoyi.basicData.domain.TFees;
+import com.ruoyi.basicData.mapper.TFeesMapper;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.warehouseBusiness.domain.TEnclosure;
+import com.ruoyi.warehouseBusiness.mapper.TEnclosureMapper;
+import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+/**
+ * 费用管理Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-03-13
+ */
+@Service
+public class TCostManagementServiceImpl implements ITCostManagementService
+{
+    @Autowired
+    private TCostManagementMapper tCostManagementMapper;
+
+    @Autowired
+    private BillnoSerialServiceImpl billnoSerialServiceImpl;
+
+    @Autowired
+    private TCostManagementItemMapper tCostManagementItemMapper;
+
+    @Autowired
+    private TEnclosureMapper tEnclosureMapper;
+
+    @Autowired
+    private TFeesMapper tFeesMapper;
+
+    @Autowired
+    private SysConfigMapper sysConfigMapper;
+
+    @Autowired
+    private AuditItemsServiceImpl auditItemsService;
+
+    /**
+     * 查询费用管理
+     * 
+     * @param fId 费用管理ID
+     * @return 费用管理
+     */
+    @Override
+    public Map<String, Object> selectTCostManagementById(Long fId)
+    {
+        Map<String, Object> map = new HashMap<>();
+        //查询费用管理主表数据
+        TCostManagement tCostManagement = tCostManagementMapper.selectTCostManagementById(fId);
+        // 费用
+        List<Long> feesId = new ArrayList<>();
+        //查询明细信息
+        TCostManagementItem tCostManagementItem = new TCostManagementItem();
+        tCostManagementItem.setfPid(tCostManagement.getfId());
+        List<TCostManagementItem> itemList = tCostManagementItemMapper.selectTCostManagementItemList(tCostManagementItem);
+        if (StringUtils.isNotEmpty(itemList)) {
+            for (TCostManagementItem fees : itemList) {
+                feesId.add(fees.getExpenseId());
+            }
+        }
+        //查询费用
+        List<TFees> feesList = new ArrayList<>();
+        List<Long> longList = StringUtils.integerDeduplication(feesId);
+        for (Long fees : longList) {
+            TFees tFees = tFeesMapper.selectTFeesById(fees);
+            if (StringUtils.isNotNull(tFees)) {
+                feesList.add(tFees);
+            }
+        }
+
+        // 查询附件表数据
+        TEnclosure enclosure = new TEnclosure();
+        enclosure.setfPid(fId);
+        List<TEnclosure> enclosures = tEnclosureMapper.selectTEnclosureList(enclosure);
+        if (StringUtils.isNotEmpty(enclosures)) {
+            map.put("enclosures", enclosures);
+        }
+
+        map.put("tCostManagement", tCostManagement);
+        map.put("itemList", itemList);
+        map.put("feesList", feesList);
+        return map;
+    }
+
+    /**
+     * 查询费用管理列表
+     * 
+     * @param tCostManagement 费用管理
+     * @return 费用管理
+     */
+    @Override
+    public List<TCostManagement> selectTCostManagementList(TCostManagement tCostManagement)
+    {
+        return tCostManagementMapper.selectTCostManagementList(tCostManagement);
+    }
+
+    /**
+     * 新增费用管理
+     * 
+     * @param tCostManagement 费用管理
+     * @return 结果
+     */
+    @Override
+    public AjaxResult insertTCostManagement(String tCostManagement, String tCostManagementItem, String tEnclosure, LoginUser loginUser)
+    {
+        Map<String, Object> map = new HashMap<>();
+        TCostManagement detailed = JSONArray.parseObject(tCostManagement, TCostManagement.class);
+
+        //保存主表信息
+        if (StringUtils.isNull(detailed.getfId())) {// 如果是新数据
+            // 业务编码
+            String billNo = billnoSerialServiceImpl.getBillNo("FY", new Date());
+            detailed.setfNo(billNo);
+            detailed.setCreateBy(loginUser.getUser().getUserName());
+            detailed.setCreateTime(new Date());
+            detailed.setCreateDept(String.valueOf(loginUser.getUser().getDeptId()));
+            tCostManagementMapper.insertTCostManagement(detailed);
+        } else {
+            detailed.setUpdateBy(loginUser.getUser().getUserName());
+            detailed.setUpdateTime(new Date());
+            tCostManagementMapper.updateTCostManagement(detailed);
+        }
+        //获得明细信息并保存
+        List<TCostManagementItem> itemList = new ArrayList<>();
+        if (StringUtils.isNotNull(tCostManagementItem) && !"[]".equals(tCostManagementItem)) {
+            JSONArray jsonDrArray = JSONArray.parseArray(tCostManagementItem);
+            itemList = JSONObject.parseArray(jsonDrArray.toJSONString(), TCostManagementItem.class);
+
+            for (TCostManagementItem item : itemList) {
+                if (StringUtils.isNull(item.getfId())) {// 如果是新数据
+                    item.setCreateBy(loginUser.getUser().getUserName());
+                    item.setCreateTime(new Date());
+                    item.setCreateDept(String.valueOf(loginUser.getUser().getDeptId()));
+                    tCostManagementItemMapper.insertTCostManagementItem(item);
+                } else {
+                    item.setUpdateBy(loginUser.getUser().getUserName());
+                    item.setUpdateTime(new Date());
+                    tCostManagementItemMapper.updateTCostManagementItem(item);
+                }
+            }
+        }
+        //保存附件信息
+        List<TEnclosure> enclosuresList = new ArrayList<>();
+        if (StringUtils.isNotNull(tEnclosure) && !"[]".equals(tEnclosure)) {
+            JSONArray jsonEnclosureArray = JSONArray.parseArray(tEnclosure);
+            enclosuresList = JSONObject.parseArray(jsonEnclosureArray.toJSONString(), TEnclosure.class);
+            long lineNo = 0L;
+            for (TEnclosure enclosure : enclosuresList) {
+                lineNo++;
+                if (enclosure.getfId() == null) {
+                    enclosure.setfPid(detailed.getfId());
+                    enclosure.setfLineno(lineNo);
+                    enclosure.setCreateTime(new Date());
+                    enclosure.setCreateBy(loginUser.getUser().getUserName());
+                    tEnclosureMapper.insertTEnclosure(enclosure);
+                } else {
+                    enclosure.setUpdateBy(loginUser.getUser().getUserName());
+                    enclosure.setUpdateTime(new Date());
+                    tEnclosureMapper.updateTEnclosure(enclosure);
+                }
+            }
+        }
+
+        map.put("tCostManagement",detailed);
+        map.put("itemList", itemList);
+        map.put("enclosuresList", enclosuresList);
+
+        return AjaxResult.success("成功", map);
+    }
+
+    /**
+     * 修改费用管理
+     * 
+     * @param tCostManagement 费用管理
+     * @return 结果
+     */
+    @Override
+    public int updateTCostManagement(TCostManagement tCostManagement)
+    {
+        tCostManagement.setUpdateTime(DateUtils.getNowDate());
+        return tCostManagementMapper.updateTCostManagement(tCostManagement);
+    }
+
+    /**
+     * 批量删除费用管理
+     * 
+     * @param fIds 需要删除的费用管理ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTCostManagementByIds(Long[] fIds)
+    {
+        return tCostManagementMapper.deleteTCostManagementByIds(fIds);
+    }
+
+    /**
+     * 删除费用管理信息
+     * 
+     * @param fId 费用管理ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTCostManagementById(Long fId)
+    {
+        return tCostManagementMapper.deleteTCostManagementById(fId);
+    }
+
+    @Override
+    public AjaxResult submitCostManagement(String tCostManagement, String tCostManagementItem, String tEnclosure, LoginUser loginUser, String billType) {
+        boolean isApprove = false;//是否开启审批流
+        String key = "";//键
+        long actId = 0L;//活动id
+        Long billStatus = null;
+        Integer i = null;
+        Map<String, Object> map = new HashMap<>();
+        if ("FYGL".equals(billType)) {
+            actId = 560L;
+            key = "anPingJingYuan.costManagement.ApprovalFlow";
+        }
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
+        if (StringUtils.isNull(sysConfig)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return AjaxResult.error("系统参数异常,未找到开启审批流参数");
+        }
+        if ("0".equals(sysConfig.getConfigValue())) {
+            isApprove = true;
+        }
+        if (isApprove) {
+            billStatus = 1L;
+        } else {
+            billStatus = 3L;
+        }
+        TCostManagement detailed = JSONArray.parseObject(tCostManagement, TCostManagement.class);
+
+        //保存主表信息
+        if (StringUtils.isNull(detailed.getfId())) {// 如果是新数据
+            // 业务编码
+            String billNo = billnoSerialServiceImpl.getBillNo("FY", new Date());
+            detailed.setfNo(billNo);
+            detailed.setCreateBy(loginUser.getUser().getUserName());
+            detailed.setCreateTime(new Date());
+            detailed.setCreateDept(String.valueOf(loginUser.getUser().getDeptId()));
+            tCostManagementMapper.insertTCostManagement(detailed);
+        } else {
+            detailed.setUpdateBy(loginUser.getUser().getUserName());
+            detailed.setUpdateTime(new Date());
+            tCostManagementMapper.updateTCostManagement(detailed);
+        }
+        //获得明细信息并保存
+        List<TCostManagementItem> itemList = new ArrayList<>();
+        if (StringUtils.isNotNull(tCostManagementItem) && !"[]".equals(tCostManagementItem)) {
+            JSONArray jsonDrArray = JSONArray.parseArray(tCostManagementItem);
+            itemList = JSONObject.parseArray(jsonDrArray.toJSONString(), TCostManagementItem.class);
+
+            for (TCostManagementItem item : itemList) {
+                if (StringUtils.isNull(item.getfId())) {// 如果是新数据
+                    item.setCreateBy(loginUser.getUser().getUserName());
+                    item.setCreateTime(new Date());
+                    item.setCreateDept(String.valueOf(loginUser.getUser().getDeptId()));
+                    tCostManagementItemMapper.insertTCostManagementItem(item);
+                } else {
+                    item.setUpdateBy(loginUser.getUser().getUserName());
+                    item.setUpdateTime(new Date());
+                    tCostManagementItemMapper.updateTCostManagementItem(item);
+                }
+            }
+        }
+        //保存附件信息
+        List<TEnclosure> enclosuresList = new ArrayList<>();
+        if (StringUtils.isNotNull(tEnclosure) && !"[]".equals(tEnclosure)) {
+            JSONArray jsonEnclosureArray = JSONArray.parseArray(tEnclosure);
+            enclosuresList = JSONObject.parseArray(jsonEnclosureArray.toJSONString(), TEnclosure.class);
+            long lineNo = 0L;
+            for (TEnclosure enclosure : enclosuresList) {
+                lineNo++;
+                if (enclosure.getfId() == null) {
+                    enclosure.setfPid(detailed.getfId());
+                    enclosure.setfLineno(lineNo);
+                    enclosure.setCreateTime(new Date());
+                    enclosure.setCreateBy(loginUser.getUser().getUserName());
+                    tEnclosureMapper.insertTEnclosure(enclosure);
+                } else {
+                    enclosure.setUpdateBy(loginUser.getUser().getUserName());
+                    enclosure.setUpdateTime(new Date());
+                    tEnclosureMapper.updateTEnclosure(enclosure);
+                }
+            }
+        }
+        if (isApprove) {
+            AuditItems auditItems = new AuditItems();
+            auditItems.setLevelId(0L);
+            auditItems.setBillId(detailed.getfId());
+            auditItems.setActId(actId);
+            auditItems.setIffinalItem("F");
+            auditItems.setBillNo(detailed.getfNo());
+            // 存储业务类型(业务类型)
+            auditItems.setRefno2(billType);
+            auditItems.setRefno3(detailed.getfNo());
+            auditItems.setSendUserId(loginUser.getUser().getUserId());
+            auditItems.setSendName(SecurityUtils.getUsername());
+            auditItems.setSendTime(new Date());
+            auditItems.setAuditUserId(loginUser.getUser().getUserId());
+            auditItems.setAuditItem(new Date());
+            auditItems.setAuditOpTime(new Date());
+            auditItems.setAuditMsg("提交");
+            auditItems.setAuditStatus("O");
+            AjaxResult approvalFlow = auditItemsService.createApprovalFlow(auditItems);
+//            Long code = Long.valueOf(String.valueOf(approvalFlow.get("code"))).longValue();
+            String code = approvalFlow.get("code").toString();
+//                Long code = Long.valueOf(String.valueOf(ajaxResult.get("code"))).longValue();
+            if ("500".equals(code)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            }
+            return approvalFlow;
+        }
+        map.put("tCostManagement",detailed);
+        map.put("itemList", itemList);
+        map.put("enclosuresList", enclosuresList);
+
+        return null;
+    }
+}

+ 146 - 0
ruoyi-anpin/src/main/resources/mapper/anpin/TCostManagementItemMapper.xml

@@ -0,0 +1,146 @@
+<?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.ruoyi.anpin.mapper.TCostManagementItemMapper">
+    
+    <resultMap type="TCostManagementItem" id="TCostManagementItemResult">
+        <result property="fId"    column="f_id"    />
+        <result property="fPid"    column="f_pid"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createDept"    column="create_dept"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="fStatus"    column="f_status"    />
+        <result property="expenseName"    column="expense_name"    />
+        <result property="expenseId"    column="expense_id"    />
+        <result property="amount"    column="amount"    />
+        <result property="belongsProjectId"    column="belongs_project_id"    />
+        <result property="belongsProjectName"    column="belongs_project_name"    />
+        <result property="personnelId"    column="personnel_id"    />
+        <result property="personnelName"    column="personnel_name"    />
+        <result property="departmentId"    column="department_id"    />
+        <result property="departmentName"    column="department_name"    />
+        <result property="matterId"    column="matter_id"    />
+        <result property="matterName"    column="matter_name"    />
+    </resultMap>
+
+    <sql id="selectTCostManagementItemVo">
+        select f_id, f_pid, create_by, create_time, create_dept, update_by, update_time, remark, del_flag, f_status, expense_name, expense_id, amount, belongs_project_id, belongs_project_name, personnel_id, personnel_name, department_id, department_name, matter_id, matter_name from t_cost_management_item
+    </sql>
+
+    <select id="selectTCostManagementItemList" parameterType="TCostManagementItem" resultMap="TCostManagementItemResult">
+        <include refid="selectTCostManagementItemVo"/>
+        <where>  
+            <if test="fPid != null "> and f_pid = #{fPid}</if>
+            <if test="createDept != null  and createDept != ''"> and create_dept = #{createDept}</if>
+            <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
+            <if test="expenseName != null  and expenseName != ''"> and expense_name like concat('%', #{expenseName}, '%')</if>
+            <if test="expenseId != null "> and expense_id = #{expenseId}</if>
+            <if test="amount != null "> and amount = #{amount}</if>
+            <if test="belongsProjectId != null "> and belongs_project_id = #{belongsProjectId}</if>
+            <if test="belongsProjectName != null  and belongsProjectName != ''"> and belongs_project_name like concat('%', #{belongsProjectName}, '%')</if>
+            <if test="personnelId != null "> and personnel_id = #{personnelId}</if>
+            <if test="personnelName != null  and personnelName != ''"> and personnel_name like concat('%', #{personnelName}, '%')</if>
+            <if test="departmentId != null "> and department_id = #{departmentId}</if>
+            <if test="departmentName != null  and departmentName != ''"> and department_name like concat('%', #{departmentName}, '%')</if>
+            <if test="matterId != null "> and matter_id = #{matterId}</if>
+            <if test="matterName != null  and matterName != ''"> and matter_name like concat('%', #{matterName}, '%')</if>
+        </where>
+    </select>
+    
+    <select id="selectTCostManagementItemById" parameterType="Long" resultMap="TCostManagementItemResult">
+        <include refid="selectTCostManagementItemVo"/>
+        where f_id = #{fId}
+    </select>
+        
+    <insert id="insertTCostManagementItem" parameterType="TCostManagementItem" useGeneratedKeys="true" keyProperty="fId">
+        insert into t_cost_management_item
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="fPid != null">f_pid,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createDept != null">create_dept,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="fStatus != null and fStatus != ''">f_status,</if>
+            <if test="expenseName != null">expense_name,</if>
+            <if test="expenseId != null">expense_id,</if>
+            <if test="amount != null">amount,</if>
+            <if test="belongsProjectId != null">belongs_project_id,</if>
+            <if test="belongsProjectName != null">belongs_project_name,</if>
+            <if test="personnelId != null">personnel_id,</if>
+            <if test="personnelName != null">personnel_name,</if>
+            <if test="departmentId != null">department_id,</if>
+            <if test="departmentName != null">department_name,</if>
+            <if test="matterId != null">matter_id,</if>
+            <if test="matterName != null">matter_name,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="fPid != null">#{fPid},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createDept != null">#{createDept},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="fStatus != null and fStatus != ''">#{fStatus},</if>
+            <if test="expenseName != null">#{expenseName},</if>
+            <if test="expenseId != null">#{expenseId},</if>
+            <if test="amount != null">#{amount},</if>
+            <if test="belongsProjectId != null">#{belongsProjectId},</if>
+            <if test="belongsProjectName != null">#{belongsProjectName},</if>
+            <if test="personnelId != null">#{personnelId},</if>
+            <if test="personnelName != null">#{personnelName},</if>
+            <if test="departmentId != null">#{departmentId},</if>
+            <if test="departmentName != null">#{departmentName},</if>
+            <if test="matterId != null">#{matterId},</if>
+            <if test="matterName != null">#{matterName},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTCostManagementItem" parameterType="TCostManagementItem">
+        update t_cost_management_item
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fPid != null">f_pid = #{fPid},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createDept != null">create_dept = #{createDept},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="fStatus != null and fStatus != ''">f_status = #{fStatus},</if>
+            <if test="expenseName != null">expense_name = #{expenseName},</if>
+            <if test="expenseId != null">expense_id = #{expenseId},</if>
+            <if test="amount != null">amount = #{amount},</if>
+            <if test="belongsProjectId != null">belongs_project_id = #{belongsProjectId},</if>
+            <if test="belongsProjectName != null">belongs_project_name = #{belongsProjectName},</if>
+            <if test="personnelId != null">personnel_id = #{personnelId},</if>
+            <if test="personnelName != null">personnel_name = #{personnelName},</if>
+            <if test="departmentId != null">department_id = #{departmentId},</if>
+            <if test="departmentName != null">department_name = #{departmentName},</if>
+            <if test="matterId != null">matter_id = #{matterId},</if>
+            <if test="matterName != null">matter_name = #{matterName},</if>
+        </trim>
+        where f_id = #{fId}
+    </update>
+
+    <delete id="deleteTCostManagementItemById" parameterType="Long">
+        delete from t_cost_management_item where f_id = #{fId}
+    </delete>
+
+    <delete id="deleteTCostManagementItemByIds" parameterType="String">
+        delete from t_cost_management_item where f_id in 
+        <foreach item="fId" collection="array" open="(" separator="," close=")">
+            #{fId}
+        </foreach>
+    </delete>
+    
+</mapper>

+ 121 - 0
ruoyi-anpin/src/main/resources/mapper/anpin/TCostManagementMapper.xml

@@ -0,0 +1,121 @@
+<?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.ruoyi.anpin.mapper.TCostManagementMapper">
+    
+    <resultMap type="TCostManagement" id="TCostManagementResult">
+        <result property="fId"    column="f_id"    />
+        <result property="fNo"    column="f_no"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="fStatus"    column="f_status"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="deptName"    column="dept_name"    />
+        <result property="createDept"    column="create_dept"    />
+        <result property="businessTime"    column="business_time"    />
+        <result property="businessType"    column="business_type"    />
+        <result property="expenseTypr"    column="expense_typr"    />
+        <result property="totalAmount"    column="total_amount"    />
+    </resultMap>
+
+    <sql id="selectTCostManagementVo">
+        select f_id, f_no, create_by, create_time, update_by, update_time, remark, del_flag, f_status, dept_id, dept_name, create_dept, business_time, business_type, expense_typr, total_amount from t_cost_management
+    </sql>
+
+    <select id="selectTCostManagementList" parameterType="TCostManagement" resultMap="TCostManagementResult">
+        <include refid="selectTCostManagementVo"/>
+        <where>  
+            <if test="fNo != null  and fNo != ''"> and f_no = #{fNo}</if>
+            <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
+            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
+            <if test="createDept != null  and createDept != ''"> and create_dept = #{createDept}</if>
+            <if test="businessTime != null "> and business_time = #{businessTime}</if>
+            <if test="businessType != null  and businessType != ''"> and business_type = #{businessType}</if>
+            <if test="expenseTypr != null  and expenseTypr != ''"> and expense_typr = #{expenseTypr}</if>
+            <if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
+        </where>
+    </select>
+    
+    <select id="selectTCostManagementById" parameterType="Long" resultMap="TCostManagementResult">
+        <include refid="selectTCostManagementVo"/>
+        where f_id = #{fId}
+    </select>
+        
+    <insert id="insertTCostManagement" parameterType="TCostManagement" useGeneratedKeys="true" keyProperty="fId">
+        insert into t_cost_management
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="fNo != null">f_no,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="fStatus != null and fStatus != ''">f_status,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="deptName != null">dept_name,</if>
+            <if test="createDept != null">create_dept,</if>
+            <if test="businessTime != null">business_time,</if>
+            <if test="businessType != null">business_type,</if>
+            <if test="expenseTypr != null">expense_typr,</if>
+            <if test="totalAmount != null">total_amount,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="fNo != null">#{fNo},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="fStatus != null and fStatus != ''">#{fStatus},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="deptName != null">#{deptName},</if>
+            <if test="createDept != null">#{createDept},</if>
+            <if test="businessTime != null">#{businessTime},</if>
+            <if test="businessType != null">#{businessType},</if>
+            <if test="expenseTypr != null">#{expenseTypr},</if>
+            <if test="totalAmount != null">#{totalAmount},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTCostManagement" parameterType="TCostManagement">
+        update t_cost_management
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fNo != null">f_no = #{fNo},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="fStatus != null and fStatus != ''">f_status = #{fStatus},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="createDept != null">create_dept = #{createDept},</if>
+            <if test="businessTime != null">business_time = #{businessTime},</if>
+            <if test="businessType != null">business_type = #{businessType},</if>
+            <if test="expenseTypr != null">expense_typr = #{expenseTypr},</if>
+            <if test="totalAmount != null">total_amount = #{totalAmount},</if>
+        </trim>
+        where f_id = #{fId}
+    </update>
+
+    <delete id="deleteTCostManagementById" parameterType="Long">
+        delete from t_cost_management where f_id = #{fId}
+    </delete>
+
+    <delete id="deleteTCostManagementByIds" parameterType="String">
+        delete from t_cost_management where f_id in 
+        <foreach item="fId" collection="array" open="(" separator="," close=")">
+            #{fId}
+        </foreach>
+    </delete>
+    
+</mapper>