diff --git a/yanzhu-manage/src/main/java/com/yanzhu/base/controller/BaseAssetsTypeController.java b/yanzhu-manage/src/main/java/com/yanzhu/base/controller/BaseAssetsTypeController.java new file mode 100644 index 0000000..9bc7c64 --- /dev/null +++ b/yanzhu-manage/src/main/java/com/yanzhu/base/controller/BaseAssetsTypeController.java @@ -0,0 +1,104 @@ +package com.yanzhu.base.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.yanzhu.common.annotation.Log; +import com.yanzhu.common.core.controller.BaseController; +import com.yanzhu.common.core.domain.AjaxResult; +import com.yanzhu.common.enums.BusinessType; +import com.yanzhu.base.domain.BaseAssetsType; +import com.yanzhu.base.service.IBaseAssetsTypeService; +import com.yanzhu.common.utils.poi.ExcelUtil; +import com.yanzhu.common.core.page.TableDataInfo; + +/** + * 物资类型Controller + * + * @author yanZhu + * @date 2024-02-24 + */ +@RestController +@RequestMapping("/base/assetsType") +public class BaseAssetsTypeController extends BaseController +{ + @Autowired + private IBaseAssetsTypeService baseAssetsTypeService; + + /** + * 查询物资类型列表 + */ + @PreAuthorize("@ss.hasPermi('base:assetsType:list')") + @GetMapping("/list") + public TableDataInfo list(BaseAssetsType baseAssetsType) + { + startPage(); + List list = baseAssetsTypeService.selectBaseAssetsTypeList(baseAssetsType); + return getDataTable(list); + } + + /** + * 导出物资类型列表 + */ + @PreAuthorize("@ss.hasPermi('base:assetsType:export')") + @Log(title = "物资类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BaseAssetsType baseAssetsType) + { + List list = baseAssetsTypeService.selectBaseAssetsTypeList(baseAssetsType); + ExcelUtil util = new ExcelUtil(BaseAssetsType.class); + util.exportExcel(response, list, "物资类型数据"); + } + + /** + * 获取物资类型详细信息 + */ + @PreAuthorize("@ss.hasPermi('base:assetsType:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(baseAssetsTypeService.selectBaseAssetsTypeById(id)); + } + + /** + * 新增物资类型 + */ + @PreAuthorize("@ss.hasPermi('base:assetsType:add')") + @Log(title = "物资类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BaseAssetsType baseAssetsType) + { + return toAjax(baseAssetsTypeService.insertBaseAssetsType(baseAssetsType)); + } + + /** + * 修改物资类型 + */ + @PreAuthorize("@ss.hasPermi('base:assetsType:edit')") + @Log(title = "物资类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BaseAssetsType baseAssetsType) + { + return toAjax(baseAssetsTypeService.updateBaseAssetsType(baseAssetsType)); + } + + /** + * 删除物资类型 + */ + @PreAuthorize("@ss.hasPermi('base:assetsType:remove')") + @Log(title = "物资类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(baseAssetsTypeService.deleteBaseAssetsTypeByIds(ids)); + } +} diff --git a/yanzhu-mapper/src/main/java/com/yanzhu/base/domain/BaseAssetsType.java b/yanzhu-mapper/src/main/java/com/yanzhu/base/domain/BaseAssetsType.java new file mode 100644 index 0000000..d12be3b --- /dev/null +++ b/yanzhu-mapper/src/main/java/com/yanzhu/base/domain/BaseAssetsType.java @@ -0,0 +1,126 @@ +package com.yanzhu.base.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.yanzhu.common.annotation.Excel; +import com.yanzhu.common.core.domain.BaseEntity; + +/** + * 物资类型对象 base_assets_type + * + * @author yanZhu + * @date 2024-02-24 + */ +public class BaseAssetsType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 父级分类 */ + @Excel(name = "父级分类") + private Long parentId; + + /** 单位主键 */ + @Excel(name = "单位主键") + private Long deptId; + + /** 资产类型 */ + @Excel(name = "资产类型") + private String type; + + /** 资产名称 */ + @Excel(name = "资产名称") + private String name; + + /** 资产单位 */ + @Excel(name = "资产单位") + private String unit; + + /** 是否删除 */ + @Excel(name = "是否删除") + private String isDel; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public Long getParentId() + { + return parentId; + } + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public Long getDeptId() + { + return deptId; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setUnit(String unit) + { + this.unit = unit; + } + + public String getUnit() + { + return unit; + } + public void setIsDel(String isDel) + { + this.isDel = isDel; + } + + public String getIsDel() + { + return isDel; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("parentId", getParentId()) + .append("deptId", getDeptId()) + .append("type", getType()) + .append("name", getName()) + .append("unit", getUnit()) + .append("isDel", getIsDel()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/yanzhu-mapper/src/main/java/com/yanzhu/base/mapper/BaseAssetsTypeMapper.java b/yanzhu-mapper/src/main/java/com/yanzhu/base/mapper/BaseAssetsTypeMapper.java new file mode 100644 index 0000000..79ded93 --- /dev/null +++ b/yanzhu-mapper/src/main/java/com/yanzhu/base/mapper/BaseAssetsTypeMapper.java @@ -0,0 +1,61 @@ +package com.yanzhu.base.mapper; + +import java.util.List; +import com.yanzhu.base.domain.BaseAssetsType; + +/** + * 物资类型Mapper接口 + * + * @author yanZhu + * @date 2024-02-24 + */ +public interface BaseAssetsTypeMapper +{ + /** + * 查询物资类型 + * + * @param id 物资类型主键 + * @return 物资类型 + */ + public BaseAssetsType selectBaseAssetsTypeById(Long id); + + /** + * 查询物资类型列表 + * + * @param baseAssetsType 物资类型 + * @return 物资类型集合 + */ + public List selectBaseAssetsTypeList(BaseAssetsType baseAssetsType); + + /** + * 新增物资类型 + * + * @param baseAssetsType 物资类型 + * @return 结果 + */ + public int insertBaseAssetsType(BaseAssetsType baseAssetsType); + + /** + * 修改物资类型 + * + * @param baseAssetsType 物资类型 + * @return 结果 + */ + public int updateBaseAssetsType(BaseAssetsType baseAssetsType); + + /** + * 删除物资类型 + * + * @param id 物资类型主键 + * @return 结果 + */ + public int deleteBaseAssetsTypeById(Long id); + + /** + * 批量删除物资类型 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseAssetsTypeByIds(Long[] ids); +} diff --git a/yanzhu-mapper/src/main/java/com/yanzhu/base/service/IBaseAssetsTypeService.java b/yanzhu-mapper/src/main/java/com/yanzhu/base/service/IBaseAssetsTypeService.java new file mode 100644 index 0000000..ca47bbe --- /dev/null +++ b/yanzhu-mapper/src/main/java/com/yanzhu/base/service/IBaseAssetsTypeService.java @@ -0,0 +1,61 @@ +package com.yanzhu.base.service; + +import java.util.List; +import com.yanzhu.base.domain.BaseAssetsType; + +/** + * 物资类型Service接口 + * + * @author yanZhu + * @date 2024-02-24 + */ +public interface IBaseAssetsTypeService +{ + /** + * 查询物资类型 + * + * @param id 物资类型主键 + * @return 物资类型 + */ + public BaseAssetsType selectBaseAssetsTypeById(Long id); + + /** + * 查询物资类型列表 + * + * @param baseAssetsType 物资类型 + * @return 物资类型集合 + */ + public List selectBaseAssetsTypeList(BaseAssetsType baseAssetsType); + + /** + * 新增物资类型 + * + * @param baseAssetsType 物资类型 + * @return 结果 + */ + public int insertBaseAssetsType(BaseAssetsType baseAssetsType); + + /** + * 修改物资类型 + * + * @param baseAssetsType 物资类型 + * @return 结果 + */ + public int updateBaseAssetsType(BaseAssetsType baseAssetsType); + + /** + * 批量删除物资类型 + * + * @param ids 需要删除的物资类型主键集合 + * @return 结果 + */ + public int deleteBaseAssetsTypeByIds(Long[] ids); + + /** + * 删除物资类型信息 + * + * @param id 物资类型主键 + * @return 结果 + */ + public int deleteBaseAssetsTypeById(Long id); +} diff --git a/yanzhu-mapper/src/main/java/com/yanzhu/base/service/impl/BaseAssetsTypeServiceImpl.java b/yanzhu-mapper/src/main/java/com/yanzhu/base/service/impl/BaseAssetsTypeServiceImpl.java new file mode 100644 index 0000000..1f1959b --- /dev/null +++ b/yanzhu-mapper/src/main/java/com/yanzhu/base/service/impl/BaseAssetsTypeServiceImpl.java @@ -0,0 +1,96 @@ +package com.yanzhu.base.service.impl; + +import java.util.List; +import com.yanzhu.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yanzhu.base.mapper.BaseAssetsTypeMapper; +import com.yanzhu.base.domain.BaseAssetsType; +import com.yanzhu.base.service.IBaseAssetsTypeService; + +/** + * 物资类型Service业务层处理 + * + * @author yanZhu + * @date 2024-02-24 + */ +@Service +public class BaseAssetsTypeServiceImpl implements IBaseAssetsTypeService +{ + @Autowired + private BaseAssetsTypeMapper baseAssetsTypeMapper; + + /** + * 查询物资类型 + * + * @param id 物资类型主键 + * @return 物资类型 + */ + @Override + public BaseAssetsType selectBaseAssetsTypeById(Long id) + { + return baseAssetsTypeMapper.selectBaseAssetsTypeById(id); + } + + /** + * 查询物资类型列表 + * + * @param baseAssetsType 物资类型 + * @return 物资类型 + */ + @Override + public List selectBaseAssetsTypeList(BaseAssetsType baseAssetsType) + { + return baseAssetsTypeMapper.selectBaseAssetsTypeList(baseAssetsType); + } + + /** + * 新增物资类型 + * + * @param baseAssetsType 物资类型 + * @return 结果 + */ + @Override + public int insertBaseAssetsType(BaseAssetsType baseAssetsType) + { + baseAssetsType.setCreateTime(DateUtils.getNowDate()); + return baseAssetsTypeMapper.insertBaseAssetsType(baseAssetsType); + } + + /** + * 修改物资类型 + * + * @param baseAssetsType 物资类型 + * @return 结果 + */ + @Override + public int updateBaseAssetsType(BaseAssetsType baseAssetsType) + { + baseAssetsType.setUpdateTime(DateUtils.getNowDate()); + return baseAssetsTypeMapper.updateBaseAssetsType(baseAssetsType); + } + + /** + * 批量删除物资类型 + * + * @param ids 需要删除的物资类型主键 + * @return 结果 + */ + @Override + public int deleteBaseAssetsTypeByIds(Long[] ids) + { + return baseAssetsTypeMapper.deleteBaseAssetsTypeByIds(ids); + } + + /** + * 删除物资类型信息 + * + * @param id 物资类型主键 + * @return 结果 + */ + @Override + public int deleteBaseAssetsTypeById(Long id) + { + return baseAssetsTypeMapper.deleteBaseAssetsTypeById(id); + } +} diff --git a/yanzhu-mapper/src/main/resources/mapper/base/BaseAssetsTypeMapper.xml b/yanzhu-mapper/src/main/resources/mapper/base/BaseAssetsTypeMapper.xml new file mode 100644 index 0000000..e35b4c1 --- /dev/null +++ b/yanzhu-mapper/src/main/resources/mapper/base/BaseAssetsTypeMapper.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + select id, parent_id, dept_id, type, name, unit, is_del, create_by, create_time, update_by, update_time, remark from base_assets_type + + + + + + + + insert into base_assets_type + + id, + parent_id, + dept_id, + type, + name, + unit, + is_del, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{id}, + #{parentId}, + #{deptId}, + #{type}, + #{name}, + #{unit}, + #{isDel}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update base_assets_type + + parent_id = #{parentId}, + dept_id = #{deptId}, + type = #{type}, + name = #{name}, + unit = #{unit}, + is_del = #{isDel}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from base_assets_type where id = #{id} + + + + delete from base_assets_type where id in + + #{id} + + + \ No newline at end of file diff --git a/yanzhu-ui/src/api/base/assetsType.js b/yanzhu-ui/src/api/base/assetsType.js new file mode 100644 index 0000000..180d31f --- /dev/null +++ b/yanzhu-ui/src/api/base/assetsType.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询物资类型列表 +export function listAssetsType(query) { + return request({ + url: '/base/assetsType/list', + method: 'get', + params: query + }) +} + +// 查询物资类型详细 +export function getAssetsType(id) { + return request({ + url: '/base/assetsType/' + id, + method: 'get' + }) +} + +// 新增物资类型 +export function addAssetsType(data) { + return request({ + url: '/base/assetsType', + method: 'post', + data: data + }) +} + +// 修改物资类型 +export function updateAssetsType(data) { + return request({ + url: '/base/assetsType', + method: 'put', + data: data + }) +} + +// 删除物资类型 +export function delAssetsType(id) { + return request({ + url: '/base/assetsType/' + id, + method: 'delete' + }) +} diff --git a/yanzhu-ui/src/views/base/assetsType/index.vue b/yanzhu-ui/src/views/base/assetsType/index.vue new file mode 100644 index 0000000..1d0474a --- /dev/null +++ b/yanzhu-ui/src/views/base/assetsType/index.vue @@ -0,0 +1,327 @@ + + +