diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java index 9714845..bdb1904 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java @@ -80,7 +80,7 @@ public class DevChangeServiceImpl implements DevChangeService { if (StringUtils.isBlank(vo.getType())) { return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修"); } - String json=vo.getJsonData(); + String json = vo.getJsonData(); if (StringUtils.isBlank(json)) { return AjaxResult.error("请选择变更的设备"); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/controller/MaSupplierController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/controller/MaSupplierController.java new file mode 100644 index 0000000..b20a283 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/controller/MaSupplierController.java @@ -0,0 +1,74 @@ +package com.bonus.material.supplier.controller; + +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.material.supplier.domain.MaSupplier; +import com.bonus.material.supplier.service.MaSupplierService; +import com.bonus.material.ma.vo.TreeSelect; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +@Api(value = "厂家管理", tags = "厂家管理") +@RestController +@RequestMapping("/ma_supplier_info") +public class MaSupplierController extends BaseController { + + @Resource + private MaSupplierService maSupplierService; + + @ApiOperation("分页列表") + @GetMapping("/list") + public AjaxResult list(MaSupplier query) { + startPage(); + List list = maSupplierService.list(query); + TableDataInfo dataTable = getDataTable(list); + return AjaxResult.success(dataTable); + } + + @ApiOperation("详情") + @GetMapping("/{supplierId}") + public AjaxResult detail(@PathVariable Long supplierId) { + return AjaxResult.success(maSupplierService.getById(supplierId)); + } + + @ApiOperation("新增") + @PostMapping + public AjaxResult add(@RequestBody MaSupplier bean) { + int i = maSupplierService.add(bean); + return i > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败"); + } + + @ApiOperation("修改") + @PutMapping + public AjaxResult edit(@RequestBody MaSupplier bean) { + int i = maSupplierService.edit(bean); + return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败"); + } + + @ApiOperation("删除") + @DeleteMapping("/{supplierId}") + public AjaxResult del(@PathVariable Long supplierId) { + int i = maSupplierService.remove(supplierId); + return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败"); + } + + @ApiOperation("厂家下拉框") + @GetMapping("/select") + public AjaxResult options(){ + List options = maSupplierService.listEnabled().stream().map(s -> { + TreeSelect t = new TreeSelect(); + t.setId(s.getSupplierId()); + t.setLabel(s.getSupplierName()); + return t; + }).collect(Collectors.toList()); + return AjaxResult.success(options); + } +} + + diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/domain/MaSupplier.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/domain/MaSupplier.java new file mode 100644 index 0000000..9387386 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/domain/MaSupplier.java @@ -0,0 +1,52 @@ +package com.bonus.material.supplier.domain; + +import com.bonus.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 物资厂家表实体 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class MaSupplier extends BaseEntity { + + @ApiModelProperty("厂家主键ID") + private Long supplierId; + + @ApiModelProperty("厂家编号(如:SUP202510001)") + private String supplierCode; + + @ApiModelProperty("厂家名称") + private String supplierName; + + @ApiModelProperty("联系人") + private String contactPerson; + + @ApiModelProperty("联系电话") + private String contactPhone; + + @ApiModelProperty("厂家地址") + private String address; + + @ApiModelProperty("资质信息或营业执照编号") + private String qualification; + + @ApiModelProperty("状态(1启用,0停用)") + private Integer status; + + @ApiModelProperty("备注") + private String remark; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; +} + + diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/mapper/MaSupplierMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/mapper/MaSupplierMapper.java new file mode 100644 index 0000000..daf6bf3 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/mapper/MaSupplierMapper.java @@ -0,0 +1,27 @@ +package com.bonus.material.supplier.mapper; + +import com.bonus.material.supplier.domain.MaSupplier; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface MaSupplierMapper { + + MaSupplier selectById(@Param("supplierId") Long supplierId); + + List list(@Param("supplierCode") String supplierCode, + @Param("supplierName") String supplierName, + @Param("status") Integer status); + + int insert(MaSupplier supplier); + + int update(MaSupplier supplier); + + int deleteById(@Param("supplierId") Long supplierId); + + List listEnabled(); +} + + diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/service/MaSupplierService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/service/MaSupplierService.java new file mode 100644 index 0000000..d392ee2 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/service/MaSupplierService.java @@ -0,0 +1,21 @@ +package com.bonus.material.supplier.service; + +import com.bonus.material.supplier.domain.MaSupplier; + +import java.util.List; + +public interface MaSupplierService { + MaSupplier getById(Long supplierId); + + List list(MaSupplier query); + + int add(MaSupplier supplier); + + int edit(MaSupplier supplier); + + int remove(Long supplierId); + + List listEnabled(); +} + + diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/service/impl/MaSupplierServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/service/impl/MaSupplierServiceImpl.java new file mode 100644 index 0000000..a0937b6 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/supplier/service/impl/MaSupplierServiceImpl.java @@ -0,0 +1,48 @@ +package com.bonus.material.supplier.service.impl; + +import com.bonus.material.supplier.domain.MaSupplier; +import com.bonus.material.supplier.mapper.MaSupplierMapper; +import com.bonus.material.supplier.service.MaSupplierService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class MaSupplierServiceImpl implements MaSupplierService { + + @Resource + private MaSupplierMapper maSupplierMapper; + + @Override + public MaSupplier getById(Long supplierId) { + return maSupplierMapper.selectById(supplierId); + } + + @Override + public List list(MaSupplier query) { + return maSupplierMapper.list(query.getSupplierCode(), query.getSupplierName(), query.getStatus()); + } + + @Override + public int add(MaSupplier supplier) { + return maSupplierMapper.insert(supplier); + } + + @Override + public int edit(MaSupplier supplier) { + return maSupplierMapper.update(supplier); + } + + @Override + public int remove(Long supplierId) { + return maSupplierMapper.deleteById(supplierId); + } + + @Override + public List listEnabled() { + return maSupplierMapper.listEnabled(); + } +} + + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/supplier/MaSupplierMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/supplier/MaSupplierMapper.xml new file mode 100644 index 0000000..3d98b2a --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/supplier/MaSupplierMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + supplier_id, supplier_code, supplier_name, contact_person, contact_phone, + address, qualification, `status`, remark, create_time, update_time + + + + + + + + + + insert into ma_supplier ( + supplier_code, supplier_name, contact_person, contact_phone, + address, qualification, status, remark, create_time, update_time + ) values ( + #{supplierCode}, #{supplierName}, #{contactPerson}, #{contactPhone}, + #{address}, #{qualification}, #{status}, #{remark}, now(), now() + ) + + + + update ma_supplier + + supplier_code = #{supplierCode}, + supplier_name = #{supplierName}, + contact_person = #{contactPerson}, + contact_phone = #{contactPhone}, + address = #{address}, + qualification = #{qualification}, + status = #{status}, + remark = #{remark}, + update_time = now() + + where supplier_id = #{supplierId} + + + + delete from ma_supplier where supplier_id = #{supplierId} + + + + +