|
|
@ -4,37 +4,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
|
|
<mapper namespace="com.ruoyi.erp.mapper.ErpBomMapper"> |
|
|
|
<resultMap type="ErpBomVo" id="ErpBomResult"> |
|
|
|
<result property="id" column="id" /> |
|
|
|
<result property="delFlag" column="del_flag" /> |
|
|
|
<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="bomNo" column="bom_no" /> |
|
|
|
<result property="materialNo" column="material_no" /> |
|
|
|
<result property="materialName" column="material_name" /> |
|
|
|
<result property="materialType" column="material_type" /> |
|
|
|
<result property="processMethod" column="process_method" /> |
|
|
|
<result property="unit" column="unit" /> |
|
|
|
<result property="brand" column="brand" /> |
|
|
|
<result property="describe" column="describe" /> |
|
|
|
<result property="useNum" column="use_num" /> |
|
|
|
<result property="lossRate" column="loss_rate" /> |
|
|
|
<result property="parentId" column="parent_id" /> |
|
|
|
<result property="level" column="level" /> |
|
|
|
<result property="sortNo" column="sort_no" /> |
|
|
|
<result property="auditStatus" column="audit_status" /> |
|
|
|
<result property="useStatus" column="use_status" /> |
|
|
|
<result property="instanceId" column="instance_id" /> |
|
|
|
<result property="instanceType" column="instance_type" /> |
|
|
|
<result property="instanceTypeName" column="instance_type_name" /> |
|
|
|
<result property="submitInstanceId" column="submit_instance_id" /> |
|
|
|
<result property="cancelInstanceId" column="cancel_instance_id" /> |
|
|
|
<result property="restoreInstanceId" column="restore_instance_id" /> |
|
|
|
<result property="applyTitle" column="apply_title" /> |
|
|
|
<result property="applyUser" column="apply_user" /> |
|
|
|
<result property="applyTime" column="apply_time" /> |
|
|
|
<result property="id" column="id" /> |
|
|
|
<result property="delFlag" column="del_flag" /> |
|
|
|
<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="bomNo" column="bom_no" /> |
|
|
|
<result property="materialNo" column="material_no" /> |
|
|
|
<result property="materialName" column="material_name" /> |
|
|
|
<result property="materialType" column="material_type" /> |
|
|
|
<result property="processMethod" column="process_method" /> |
|
|
|
<result property="engineer" column="engineer" /> |
|
|
|
<result property="unit" column="unit" /> |
|
|
|
<result property="brand" column="brand" /> |
|
|
|
<result property="describe" column="describe" /> |
|
|
|
<result property="useNum" column="use_num" /> |
|
|
|
<result property="lossRate" column="loss_rate" /> |
|
|
|
<result property="parentId" column="parent_id" /> |
|
|
|
<result property="level" column="level" /> |
|
|
|
<result property="sortNo" column="sort_no" /> |
|
|
|
<result property="auditStatus" column="audit_status" /> |
|
|
|
<result property="useStatus" column="use_status" /> |
|
|
|
<result property="instanceId" column="instance_id" /> |
|
|
|
<result property="instanceType" column="instance_type" /> |
|
|
|
<result property="instanceTypeName" column="instance_type_name" /> |
|
|
|
<result property="submitInstanceId" column="submit_instance_id" /> |
|
|
|
<result property="cancelInstanceId" column="cancel_instance_id" /> |
|
|
|
<result property="restoreInstanceId" column="restore_instance_id" /> |
|
|
|
<result property="applyTitle" column="apply_title" /> |
|
|
|
<result property="applyUser" column="apply_user" /> |
|
|
|
<result property="applyTime" column="apply_time" /> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<resultMap id="ErpBomErpBomSubResult" type="ErpBom" extends="ErpBomResult"> |
|
|
@ -42,47 +43,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<resultMap type="ErpBom" id="ErpBomSubResult"> |
|
|
|
<result property="id" column="sub_id" /> |
|
|
|
<result property="delFlag" column="sub_del_flag" /> |
|
|
|
<result property="createBy" column="sub_create_by" /> |
|
|
|
<result property="createTime" column="sub_create_time" /> |
|
|
|
<result property="updateBy" column="sub_update_by" /> |
|
|
|
<result property="updateTime" column="sub_update_time" /> |
|
|
|
<result property="remark" column="sub_remark" /> |
|
|
|
<result property="bomNo" column="sub_bom_no" /> |
|
|
|
<result property="materialNo" column="sub_material_no" /> |
|
|
|
<result property="materialName" column="sub_material_name" /> |
|
|
|
<result property="materialType" column="sub_material_type" /> |
|
|
|
<result property="id" column="sub_id" /> |
|
|
|
<result property="delFlag" column="sub_del_flag" /> |
|
|
|
<result property="createBy" column="sub_create_by" /> |
|
|
|
<result property="createTime" column="sub_create_time" /> |
|
|
|
<result property="updateBy" column="sub_update_by" /> |
|
|
|
<result property="updateTime" column="sub_update_time" /> |
|
|
|
<result property="remark" column="sub_remark" /> |
|
|
|
<result property="bomNo" column="sub_bom_no" /> |
|
|
|
<result property="materialNo" column="sub_material_no" /> |
|
|
|
<result property="materialName" column="sub_material_name" /> |
|
|
|
<result property="materialType" column="sub_material_type" /> |
|
|
|
<result property="processMethod" column="sub_process_method" /> |
|
|
|
<result property="unit" column="sub_unit" /> |
|
|
|
<result property="brand" column="sub_brand" /> |
|
|
|
<result property="describe" column="sub_describe" /> |
|
|
|
<result property="useNum" column="sub_use_num" /> |
|
|
|
<result property="lossRate" column="sub_loss_rate" /> |
|
|
|
<result property="parentId" column="sub_parent_id" /> |
|
|
|
<result property="level" column="sub_level" /> |
|
|
|
<result property="sortNo" column="sub_sort_no" /> |
|
|
|
<result property="auditStatus" column="sub_audit_status" /> |
|
|
|
<result property="useStatus" column="sub_use_status" /> |
|
|
|
<result property="engineer" column="engineer" /> |
|
|
|
<result property="unit" column="sub_unit" /> |
|
|
|
<result property="brand" column="sub_brand" /> |
|
|
|
<result property="describe" column="sub_describe" /> |
|
|
|
<result property="useNum" column="sub_use_num" /> |
|
|
|
<result property="lossRate" column="sub_loss_rate" /> |
|
|
|
<result property="parentId" column="sub_parent_id" /> |
|
|
|
<result property="level" column="sub_level" /> |
|
|
|
<result property="sortNo" column="sub_sort_no" /> |
|
|
|
<result property="auditStatus" column="sub_audit_status" /> |
|
|
|
<result property="useStatus" column="sub_use_status" /> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<sql id="selectErpBomVo"> |
|
|
|
select id, del_flag, create_by, create_time, update_by, update_time, remark, bom_no, |
|
|
|
material_no, material_name, material_type, process_method, unit, brand, `describe`, |
|
|
|
use_num, loss_rate, parent_id, `level`, sort_no, audit_status, use_status,instance_id, |
|
|
|
instance_type,submit_instance_id,cancel_instance_id,restore_instance_id,apply_title, |
|
|
|
apply_user,apply_time from erp_bom |
|
|
|
engineer,use_num, loss_rate, parent_id, `level`, sort_no, audit_status, use_status, |
|
|
|
instance_id,instance_type,submit_instance_id,cancel_instance_id,restore_instance_id, |
|
|
|
apply_title,apply_user,apply_time from erp_bom |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="selectErpBomList" parameterType="ErpBomVo" resultMap="ErpBomResult"> |
|
|
|
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time |
|
|
|
, erp.remark,erp.bom_no,erp.material_no,erp.material_name, erp.audit_status, erp.use_status |
|
|
|
, erp.material_type, erp.process_method,erp.unit, erp.brand, erp.`describe`,erp.use_num |
|
|
|
, erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id,erp.instance_type |
|
|
|
, processDict.dict_label as instance_type_name, erp.submit_instance_id,erp.cancel_instance_id |
|
|
|
, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time |
|
|
|
, file.url as photo_url,cate.name as material_type_name |
|
|
|
from erp_bom as erp |
|
|
|
, erp.material_type, erp.process_method,erp.unit, erp.brand, erp.`describe`,erp.engineer, |
|
|
|
erp.use_num,erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id, |
|
|
|
erp.instance_type, processDict.dict_label as instance_type_name, erp.submit_instance_id, |
|
|
|
erp.cancel_instance_id, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time |
|
|
|
, file.url as photo_url,cate.name as material_type_name from erp_bom as erp |
|
|
|
left join ( |
|
|
|
select id,material_no,material_name from erp_material |
|
|
|
) erp_material |
|
|
@ -121,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="unit != null and unit != ''"> and erp.unit = #{unit}</if> |
|
|
|
<if test="brand != null and brand != ''"> and erp.brand = #{brand}</if> |
|
|
|
<if test="describe != null and describe != ''"> and erp.`describe` = #{describe}</if> |
|
|
|
<if test="engineer != null and engineer != ''"> and erp.engineer = #{engineer}</if> |
|
|
|
<if test="useNum != null "> and erp.use_num = #{useNum}</if> |
|
|
|
<if test="lossRate != null "> and erp.loss_rate = #{lossRate}</if> |
|
|
|
<if test="parentId != null "> and erp.parent_id = #{parentId}</if> |
|
|
@ -142,16 +144,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<select id="selectErpBomList1" resultMap="ErpBomResult"> |
|
|
|
select bom_no, id, create_by, create_time, update_by, update_time, remark, |
|
|
|
material_no, material_name, material_type, process_method, unit, |
|
|
|
brand, `describe`, use_num, loss_rate, parent_id, `level`, |
|
|
|
brand, `describe`,engineer,use_num, loss_rate, parent_id, `level`, |
|
|
|
sort_no, audit_status, use_status from erp_bom |
|
|
|
where bom_no != "" ORDER BY id DESC; |
|
|
|
</select> |
|
|
|
<select id="selectErpBomById" parameterType="Long" resultMap="ErpBomResult"> |
|
|
|
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time, erp.remark,erp.bom_no, erp.material_no |
|
|
|
, erp.material_name, erp.audit_status, erp.use_status, erp.material_type |
|
|
|
, erp.process_method, erp.unit, erp.brand, erp.describe, erp.use_num, erp.loss_rate, erp.parent_id, erp.level, erp.sort_no |
|
|
|
,erp.instance_id,erp.instance_type,erp.submit_instance_id,erp.cancel_instance_id,erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time |
|
|
|
,att.id as photo_attach_id |
|
|
|
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time, |
|
|
|
erp.remark,erp.bom_no, erp.material_no , erp.material_name, erp.audit_status, erp.use_status, |
|
|
|
erp.material_type, erp.process_method, erp.unit, erp.brand, erp.describe, erp.use_num, erp.engineer, |
|
|
|
erp.loss_rate, erp.parent_id, erp.level, erp.sort_no,erp.instance_id,erp.instance_type, |
|
|
|
erp.submit_instance_id,erp.cancel_instance_id,erp.restore_instance_id,erp.apply_title, |
|
|
|
erp.apply_user,erp.apply_time, |
|
|
|
att.id as photo_attach_id |
|
|
|
from erp_bom erp |
|
|
|
left join ( |
|
|
|
select id,material_no,material_name from erp_material |
|
|
@ -180,6 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="unit != null and unit != ''"> and unit = #{unit}</if> |
|
|
|
<if test="brand != null and brand != ''"> and brand = #{brand}</if> |
|
|
|
<if test="describe != null and describe != ''"> and `describe` = #{describe}</if> |
|
|
|
<if test="engineer != null and engineer != ''"> and engineer = #{engineer}</if> |
|
|
|
<if test="useNum != null "> and use_num = #{useNum}</if> |
|
|
|
<if test="lossRate != null "> and loss_rate = #{lossRate}</if> |
|
|
|
<if test="parentId != null "> and parent_id = #{parentId}</if> |
|
|
@ -195,7 +200,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
insert into erp_bom |
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if> |
|
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if> |
|
|
|
<if test="remark != null and remark != ''">remark,</if> |
|
|
|
<if test="bomNo != null and bomNo != '' ">bom_no,</if> |
|
|
|
<if test="materialNo != null and materialNo != '' ">material_no,</if> |
|
|
@ -205,6 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="unit != null and unit != '' ">unit,</if> |
|
|
|
<if test="brand != null and brand != '' ">brand,</if> |
|
|
|
<if test="describe != null and describe != '' ">`describe`,</if> |
|
|
|
<if test="engineer != null and engineer != '' ">engineer,</if> |
|
|
|
<if test="useNum != null">use_num,</if> |
|
|
|
<if test="lossRate != null">loss_rate,</if> |
|
|
|
<if test="parentId != null">parent_id,</if> |
|
|
@ -220,13 +225,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="applyTitle != null and applyTitle != '' ">apply_title,</if> |
|
|
|
<if test="applyUser != null">apply_user,</if> |
|
|
|
<if test="applyTime != null">apply_time,</if> |
|
|
|
del_flag, |
|
|
|
create_time, |
|
|
|
update_time, |
|
|
|
<if test="delFlag != null">del_flag,</if> |
|
|
|
<if test="createTime != null">create_time,</if> |
|
|
|
</trim> |
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if> |
|
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if> |
|
|
|
<if test="remark != null and remark != '' ">#{remark},</if> |
|
|
|
<if test="bomNo != null and bomNo != '' ">#{bomNo},</if> |
|
|
|
<if test="materialNo != null and materialNo != '' ">#{materialNo},</if> |
|
|
@ -251,9 +254,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="applyTitle != null and applyTitle != '' ">#{applyTitle},</if> |
|
|
|
<if test="applyUser != null">#{applyUser},</if> |
|
|
|
<if test="applyTime != null">#{applyTime},</if> |
|
|
|
0, |
|
|
|
now(), |
|
|
|
now(), |
|
|
|
<if test="delFlag != null">#{delFlag},</if> |
|
|
|
<if test="createTime != null">#{createTime},</if> |
|
|
|
</trim> |
|
|
|
</insert> |
|
|
|
|
|
|
@ -261,9 +263,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
update erp_bom |
|
|
|
<trim prefix="SET" suffixOverrides=","> |
|
|
|
<if test="delFlag != null">del_flag = #{delFlag},</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="remark != null and remark != '' ">remark = #{remark},</if> |
|
|
|
<if test="bomNo != null and bomNo != '' ">bom_no = #{bomNo},</if> |
|
|
|
<if test="materialNo != null and materialNo != '' ">material_no = #{materialNo},</if> |
|
|
@ -288,7 +287,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="applyTitle != null and applyTitle != '' ">apply_title = #{applyTitle},</if> |
|
|
|
<if test="applyUser != null">apply_user = #{applyUser},</if> |
|
|
|
<if test="applyTime != null">apply_time = #{applyTime},</if> |
|
|
|
update_time = now() |
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if> |
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if> |
|
|
|
</trim> |
|
|
|
where id = #{id} |
|
|
|
</update> |
|
|
@ -360,15 +360,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
and material_no = #{materialNo} |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectErpBomByMaterialNo" resultMap="ErpBomResult"> |
|
|
|
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time, erp.remark,erp.bomNo, erp.material_no |
|
|
|
,erp.material_name, erp.audit_status, erp.use_status, erp.material_type |
|
|
|
,erp.process_method, erp.unit, erp.brand, erp.describe, erp.use_num, erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.audit_status, erp.use_status |
|
|
|
,erp.instance_id,erp.instance_type,erp.submit_instance_id,erp.cancel_instance_id,erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time |
|
|
|
,att.id as photo_attach_id |
|
|
|
from erp_material erp |
|
|
|
left join sys_attach att |
|
|
|
on erp.id = att.rel_id and att.source_type = 'erpMaterial' and att.source_sub_type = 'photo' |
|
|
|
<select id="selectErpBomByMaterialNo" parameterType="String" resultMap="ErpBomResult"> |
|
|
|
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time, |
|
|
|
erp.remark,erp.bom_no,erp.material_no,erp.material_name, erp.audit_status, erp.use_status, |
|
|
|
erp.material_type, erp.process_method,erp.unit, erp.brand, erp.`describe`,erp.engineer, |
|
|
|
erp.use_num,erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id, |
|
|
|
erp.instance_type, processDict.dict_label as instance_type_name, erp.submit_instance_id, |
|
|
|
erp.cancel_instance_id, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time, |
|
|
|
file.url as photo_url,cate.name as material_type_name from erp_bom as erp |
|
|
|
left join ( |
|
|
|
select id,material_no,material_name from erp_material |
|
|
|
) erp_material |
|
|
|
on erp.material_no = erp_material.material_no |
|
|
|
left join( |
|
|
|
select dict_value,dict_label from sys_dict_data |
|
|
|
where dict_type = 'processType' |
|
|
|
) processDict |
|
|
|
on erp.instance_type = processDict.dict_value |
|
|
|
left join ( |
|
|
|
select code,name from sys_category |
|
|
|
where parent_id in( |
|
|
|
select id from sys_category |
|
|
|
where parent_id = (select id from sys_category where code = 'materialType') ) |
|
|
|
) cate |
|
|
|
on erp.material_type = cate.code |
|
|
|
left join ( |
|
|
|
select att.rel_id,file.url,min(file.create_time) as create_time from sys_attach as att |
|
|
|
left join sys_attach_file as file |
|
|
|
on att.id = file.attach_id |
|
|
|
where att.source_type = 'erpMaterial' and att.source_sub_type = 'photo' |
|
|
|
group by att.rel_id |
|
|
|
) file |
|
|
|
on erp_material.id = file.rel_id |
|
|
|
where erp.material_no = #{materialNo} |
|
|
|
</select> |
|
|
|
</mapper> |