7 changed files with 417 additions and 0 deletions
-
55src/main/java/com/spring/modules/part/controller/PartInformationController.java
-
118src/main/java/com/spring/modules/part/entity/PartInformationEntity.java
-
16src/main/java/com/spring/modules/part/mapper/PartInformationMapper.java
-
11src/main/java/com/spring/modules/part/service/PartInformationService.java
-
60src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java
-
42src/main/java/com/spring/modules/part/vo/PartInformationVo.java
-
115src/main/resources/mapper/part/PartInformationMapper.xml
@ -0,0 +1,55 @@ |
|||||
|
package com.spring.modules.part.controller; |
||||
|
|
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.common.utils.R; |
||||
|
import com.spring.modules.part.entity.PartInformationEntity; |
||||
|
import com.spring.modules.part.service.PartInformationService; |
||||
|
import com.spring.modules.part.vo.PartInformationVo; |
||||
|
import com.spring.modules.quotation.entity.QuotationInformationEntity; |
||||
|
import com.spring.modules.quotation.vo.QuotationInformationVo; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @description: 材料信息 |
||||
|
* @author: fengyuan_yang |
||||
|
* @date: 2023/10/16 10:51 |
||||
|
* @param: |
||||
|
* @return: |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequestMapping("plm/partInformation") |
||||
|
public class PartInformationController { |
||||
|
|
||||
|
@Autowired |
||||
|
private PartInformationService partInformationService; |
||||
|
|
||||
|
/** |
||||
|
* @description: 材料信息列表 |
||||
|
* @author: fengyuan_yang |
||||
|
* @date: 2023/10/16 10:53 |
||||
|
* @param: [data] |
||||
|
* @return: com.spring.common.utils.R |
||||
|
**/ |
||||
|
@PostMapping(value="/partInformationSearch") |
||||
|
@ResponseBody |
||||
|
public R partInformationSearch(@RequestBody PartInformationVo data) { |
||||
|
PageUtils page = partInformationService.partInformationSearch(data); |
||||
|
return R.ok().put("page", page); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 材料信息新增 |
||||
|
* @author: fengyuan_yang |
||||
|
* @date: 2023/10/17 10:57 |
||||
|
* @param: [data] |
||||
|
* @return: com.spring.common.utils.R |
||||
|
**/ |
||||
|
@PostMapping(value="/partInformationSave") |
||||
|
@ResponseBody |
||||
|
public R partInformationSave(@RequestBody PartInformationEntity data) { |
||||
|
partInformationService.partInformationSave(data); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,118 @@ |
|||||
|
package com.spring.modules.part.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.FieldFill; |
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.spring.common.utils.QueryPage; |
||||
|
import com.spring.modules.quotation.entity.QuotationInformationEntity; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Data |
||||
|
@TableName("part") |
||||
|
public class PartInformationEntity extends QueryPage implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 工厂 |
||||
|
**/ |
||||
|
private String site; |
||||
|
/** |
||||
|
* 物料编码 |
||||
|
**/ |
||||
|
private String partNo; |
||||
|
/** |
||||
|
* 物料描述 |
||||
|
**/ |
||||
|
private String partDesc; |
||||
|
/** |
||||
|
* 规格型号 |
||||
|
**/ |
||||
|
private String spec; |
||||
|
/** |
||||
|
* 物料类型(数据) |
||||
|
**/ |
||||
|
private String partTypeDb; |
||||
|
/** |
||||
|
* 物料类型 |
||||
|
**/ |
||||
|
private String partType; |
||||
|
/** |
||||
|
* 分类一 |
||||
|
**/ |
||||
|
private String familyId; |
||||
|
/** |
||||
|
* 分类二 |
||||
|
**/ |
||||
|
private String groupId; |
||||
|
/** |
||||
|
* 计量单位 |
||||
|
**/ |
||||
|
private String umId; |
||||
|
/** |
||||
|
* 是否在用 |
||||
|
**/ |
||||
|
private String active; |
||||
|
/** |
||||
|
* 备注 |
||||
|
**/ |
||||
|
private String remark; |
||||
|
/** |
||||
|
* 供应商编码 |
||||
|
**/ |
||||
|
private String supplierId; |
||||
|
/** |
||||
|
* 商品组1 |
||||
|
**/ |
||||
|
private String otherGroup1; |
||||
|
/** |
||||
|
* 商品组2 |
||||
|
**/ |
||||
|
private String otherGroup2; |
||||
|
/** |
||||
|
* 商品组3 |
||||
|
**/ |
||||
|
private String otherGroup3; |
||||
|
/** |
||||
|
* 商品组4 |
||||
|
**/ |
||||
|
private String otherGroup4; |
||||
|
/** |
||||
|
* erp物料编码 |
||||
|
**/ |
||||
|
private String erpPartNo; |
||||
|
/** |
||||
|
* 属性模板 |
||||
|
**/ |
||||
|
private String codeNo; |
||||
|
/** |
||||
|
* 制造商编码 |
||||
|
**/ |
||||
|
private String manufacturerId; |
||||
|
/** |
||||
|
* 创建时间 |
||||
|
**/ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private Date createDate; |
||||
|
/** |
||||
|
* 创建人 |
||||
|
**/ |
||||
|
private String createBy; |
||||
|
/** |
||||
|
* 更新时间 |
||||
|
**/ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private Date updateDate; |
||||
|
/** |
||||
|
* 更新人 |
||||
|
**/ |
||||
|
private String updateBy; |
||||
|
/** |
||||
|
* 数据集 |
||||
|
*/ |
||||
|
@TableField(exist = false) |
||||
|
private List<QuotationInformationEntity> informationList; |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
package com.spring.modules.part.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.spring.modules.part.entity.PartInformationEntity; |
||||
|
import com.spring.modules.part.vo.PartInformationVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface PartInformationMapper extends BaseMapper<PartInformationEntity> { |
||||
|
IPage<PartInformationVo> partInformationSearch(Page<PartInformationVo> partInformationVoPage, @Param("query") PartInformationVo data); |
||||
|
|
||||
|
String getPartNo(PartInformationEntity data); |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
package com.spring.modules.part.service; |
||||
|
|
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.modules.part.entity.PartInformationEntity; |
||||
|
import com.spring.modules.part.vo.PartInformationVo; |
||||
|
|
||||
|
public interface PartInformationService { |
||||
|
PageUtils partInformationSearch(PartInformationVo data); |
||||
|
|
||||
|
void partInformationSave(PartInformationEntity data); |
||||
|
} |
||||
@ -0,0 +1,60 @@ |
|||||
|
package com.spring.modules.part.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.modules.oss.dao.SysOssDao; |
||||
|
import com.spring.modules.oss.service.SysOssService; |
||||
|
import com.spring.modules.part.entity.PartInformationEntity; |
||||
|
import com.spring.modules.part.mapper.PartInformationMapper; |
||||
|
import com.spring.modules.part.service.PartInformationService; |
||||
|
import com.spring.modules.part.vo.PartInformationVo; |
||||
|
import com.spring.modules.quotation.vo.QuotationInformationVo; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class PartInformationServiceImpl extends ServiceImpl<PartInformationMapper, PartInformationEntity> implements PartInformationService { |
||||
|
|
||||
|
@Autowired |
||||
|
private PartInformationMapper partInformationMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private SysOssService sysOssService; |
||||
|
|
||||
|
@Autowired |
||||
|
private SysOssDao sysOssDao; |
||||
|
|
||||
|
@Value("${sys-file.file-path}") |
||||
|
private String filePath; |
||||
|
|
||||
|
/** |
||||
|
* @description: 材料信息列表 |
||||
|
* @author: fengyuan_yang |
||||
|
* @date: 2023/10/16 10:54 |
||||
|
* @param: [data] |
||||
|
* @return: com.spring.common.utils.PageUtils |
||||
|
**/ |
||||
|
@Override |
||||
|
public PageUtils partInformationSearch(PartInformationVo data) { |
||||
|
IPage<PartInformationVo> resultList = this.partInformationMapper.partInformationSearch(new Page<PartInformationVo>(data.getPage(), data.getLimit()), data); |
||||
|
return new PageUtils(resultList); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 材料信息新增 |
||||
|
* @author: fengyuan_yang |
||||
|
* @date: 2023/10/17 10:57 |
||||
|
* @param: [data] |
||||
|
* @return: void |
||||
|
**/ |
||||
|
@Override |
||||
|
public void partInformationSave(PartInformationEntity data) { |
||||
|
// 获取材料编码 |
||||
|
String partNo = partInformationMapper.getPartNo(data); |
||||
|
data.setPartNo("P" + partNo); |
||||
|
partInformationMapper.insert(data); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
package com.spring.modules.part.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.spring.modules.part.entity.PartInformationEntity; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
public class PartInformationVo extends PartInformationEntity { |
||||
|
|
||||
|
/** |
||||
|
* 类型名称 |
||||
|
**/ |
||||
|
private String familyName; |
||||
|
/** |
||||
|
* 分组名称 |
||||
|
**/ |
||||
|
private String groupName; |
||||
|
/** |
||||
|
* 供应商名称 |
||||
|
**/ |
||||
|
private String supplierName; |
||||
|
/** |
||||
|
* 制造商名称 |
||||
|
**/ |
||||
|
private String manufacturerName; |
||||
|
/** |
||||
|
* 要求完成日期(开始) |
||||
|
**/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
private Date startDate; |
||||
|
/** |
||||
|
* 要求完成日期(结束) |
||||
|
**/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
private Date endDate; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,115 @@ |
|||||
|
<?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.spring.modules.part.mapper.PartInformationMapper"> |
||||
|
|
||||
|
<!-- 材料信息列表 --> |
||||
|
<select id="partInformationSearch" parameterType="com.spring.modules.part.vo.PartInformationVo" resultType="com.spring.modules.part.vo.PartInformationVo"> |
||||
|
SELECT |
||||
|
site, |
||||
|
part_no, |
||||
|
part_desc, |
||||
|
spec, |
||||
|
part_type_db, |
||||
|
part_type, |
||||
|
family_id, |
||||
|
dbo.get_family_name(site, family_id) as familyName, |
||||
|
group_id, |
||||
|
dbo.get_group_name(site, group_id) as groupName, |
||||
|
umid, |
||||
|
active, |
||||
|
supplier_id, |
||||
|
dbo.get_supplier_name(site, supplier_id) as supplierName, |
||||
|
other_group1, |
||||
|
other_group2, |
||||
|
other_group3, |
||||
|
other_group4, |
||||
|
erp_part_no, |
||||
|
code_no, |
||||
|
manufacturer_id, |
||||
|
dbo.get_manufacturer_name(site, supplier_id) as manufacturerName, |
||||
|
create_date, |
||||
|
create_by, |
||||
|
update_date, |
||||
|
update_by |
||||
|
FROM part |
||||
|
<where> |
||||
|
site = #{query.site} |
||||
|
<if test = "query.partNo != null and query.partNo != ''"> |
||||
|
AND part_no like #{query.partNo} |
||||
|
</if> |
||||
|
<if test = "query.erpPartNo != null and query.erpPartNo != ''"> |
||||
|
AND erp_part_no like #{query.erpPartNo} |
||||
|
</if> |
||||
|
<if test = "query.partDesc != null and query.partDesc != ''"> |
||||
|
AND part_desc like #{query.partDesc} |
||||
|
</if> |
||||
|
<if test = "query.spec != null and query.spec != ''"> |
||||
|
AND spec like #{query.spec} |
||||
|
</if> |
||||
|
<if test="query.startDate != null "> |
||||
|
AND required_completion_date >= #{query.startDate} |
||||
|
</if> |
||||
|
<if test="query.endDate != null "> |
||||
|
AND #{query.endDate} >= required_completion_date |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 获取材料编码 --> |
||||
|
<select id="getPartNo" resultType="string" parameterType="PartInformationEntity"> |
||||
|
SELECT |
||||
|
Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(part_no, 3, 10))), 0) + 1), 8) |
||||
|
FROM part |
||||
|
WHERE site = #{site} |
||||
|
</select> |
||||
|
|
||||
|
<!--按照orderRef1查询文件文件参数--> |
||||
|
<select id="getFileContentList" resultType="SysOssEntity" parameterType="SysOssEntity"> |
||||
|
SELECT |
||||
|
id, |
||||
|
url, |
||||
|
create_date, |
||||
|
file_name, |
||||
|
new_file_name, |
||||
|
create_by, |
||||
|
order_ref1, |
||||
|
order_ref2, |
||||
|
order_ref3, |
||||
|
file_type, |
||||
|
file_suffix, |
||||
|
file_type_code, |
||||
|
file_remark |
||||
|
FROM sys_oss |
||||
|
<where> |
||||
|
<if test="orderRef1 != '' and orderRef1 != null "> |
||||
|
and order_ref1 = #{orderRef1} |
||||
|
</if> |
||||
|
<if test="orderRef2 != '' and orderRef2 != null "> |
||||
|
and order_ref2 = #{orderRef2} |
||||
|
</if> |
||||
|
<if test="orderRef3 != '' and orderRef3 != null "> |
||||
|
and order_ref3 = #{orderRef3} |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 获得报价单号 --> |
||||
|
<select id="getQuotationNo" resultType="string" parameterType="QuotationInformationEntity"> |
||||
|
SELECT |
||||
|
Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(quotation_no, 3, 10))), 0) + 1), 8) |
||||
|
FROM plm_quotation_information |
||||
|
WHERE site = #{site} |
||||
|
</select> |
||||
|
|
||||
|
<!-- 批量删除文件--> |
||||
|
<delete id="batchDeleteQuotationFile" parameterType="com.spring.modules.quotation.vo.SysOssVo"> |
||||
|
DELETE FROM sys_oss |
||||
|
<where> |
||||
|
order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2} |
||||
|
<if test = "fileName != null and fileName != ''"> |
||||
|
AND file_name = #{fileName} |
||||
|
</if> |
||||
|
</where> |
||||
|
</delete> |
||||
|
|
||||
|
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue