131938af 康伟

kangwei: 解决mybaitsPlus的getById,时有时无的问题

1 个父辈 7c9c329e
......@@ -211,8 +211,8 @@ public class MaterialAcceptanceFormController {
@AutoLog(value = "erp--物料验收单-送货/供方人员签字")
@ApiOperation(value="erp--物料验收单-送货/供方人员签字", notes="erp--物料验收单-送货/供方人员签字")
@PutMapping(value = "/senderSign")
public Result<MaterialAcceptanceForm> senderSign(@RequestBody MaterialAcceptanceForm acceptanceForm) {
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
public Result<MaterialAcceptanceForm> senderSign(@RequestBody MaterialAcceptanceForm materialAcceptanceForm) {
/*R
MaterialAcceptanceForm materialAcceptanceFormEntity = materialAcceptanceFormService.getById(acceptanceForm.getId());
if(materialAcceptanceFormEntity==null) {
result.error500("未找到对应实体");
......@@ -223,7 +223,30 @@ public class MaterialAcceptanceFormController {
if(ok) {
result.success("修改成功!");
}
}*/
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
if(StringUtils.isNotBlank(materialAcceptanceForm.getReceiverSign())){
materialAcceptanceForm.setConfirmStatus("1");
}
if(StringUtils.isNotBlank(materialAcceptanceForm.getSenderSign())){
materialAcceptanceForm.setConfirmStatus("2");
}
if(StringUtils.isNotEmpty(materialAcceptanceForm.getSenderSign()) && StringUtils.isNotEmpty(materialAcceptanceForm.getReceiverSign()) ){
materialAcceptanceForm.setConfirmStatus("9");
}
MaterialAcceptanceForm acceptanceForm = materialAcceptanceFormService.getById(materialAcceptanceForm.getId());
if(acceptanceForm==null) {
//result.error500("未找到对应实体");
materialAcceptanceFormService.save(materialAcceptanceForm);
}else {
materialAcceptanceFormService.updateById(materialAcceptanceForm);
}
MaterialIN materialIN =materialINService.getById(materialAcceptanceForm.getId());
materialIN.setConfirmStatus(materialAcceptanceForm.getConfirmStatus());
materialINService.updateById( materialIN);
result.setResult(materialAcceptanceForm);
result.success("修改成功!");
return result;
}
@AutoLog(value = "erp--物料验收单-收货人员签字")
......
......@@ -291,24 +291,15 @@ public class MaterialINController {
@GetMapping(value = "/queryById")
public Result<MaterialIN> queryById(@RequestParam(name="id",required=true) String id) {
Result<MaterialIN> result = new Result<MaterialIN>();
MaterialIN materialIN = materialINService.getById(id);
MaterialIN materialIN = materialINService.queryById(id);
/**/
if(materialIN==null) {
result.error500("未找到对应实体");
}else {
SupplierManage supplier = supplierManageService.getById(materialIN.getSupplierId());
if(supplier != null ){
materialIN.setSupplierName( supplier.getSuppName() );
}
EquipmentSparepartType sparepartType = sparepartTypeService.getById(materialIN.getSparepartType());
if(sparepartType != null ){
materialIN.setSparepartTypeName( sparepartType.getItemText() );
}
result.setResult(materialIN);
result.setSuccess(true);
}
return result;
}
......
......@@ -218,4 +218,8 @@ public class MaterialIN {
@ApiModelProperty(value = "供应商名称")
private String supplierName;
@TableField(exist = false)
@Excel(name="机构/部门名称",width=15)
private String departName;
}
......
......@@ -3,8 +3,8 @@ package com.skua.modules.erp.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.skua.modules.erp.vo.AgentiaStatisticsVO;
import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO;
import com.skua.tool.annotation.Anonymous;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.erp.entity.MaterialIN;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -29,5 +29,6 @@ public interface MaterialINMapper extends BaseMapper<MaterialIN> {
*/
List<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, @Param("materialIN") MaterialIN materialIN);
public MaterialIN queryById(String id);
@Anonymous
public MaterialIN queryById(@Param("id") String id);
}
......
<?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.skua.modules.erp.mapper.MaterialINMapper">
<select id="queryById" resultType="com.skua.modules.erp.entity.MaterialIN">
select d.depart_name 'departName', st.item_text 'sparepartTypeName', sm.supp_name 'supplierName', t.* from erp_material_in t
left join sys_depart d on t.depart_id = d.id
left join equipment_sparepart_type st on st.id = t.sparepart_type
left join ajh_supplier_manage sm on sm.id = t.supplier_id
where t.id = #{id}
</select>
</mapper>
......@@ -45,5 +45,10 @@ public interface IMaterialINService extends IService<MaterialIN> {
*/
String updateMaterialIN(MaterialIN materialIN);
/***
* 根据id查询入库单
* @param id
* @return
*/
MaterialIN queryById(String id);
}
......
......@@ -173,6 +173,14 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
this.baseMapper.updateById(materialIN );
return null;
}
/***
* 根据id查询入库单
* @param id
* @return
*/
public MaterialIN queryById(String id){
return this.baseMapper.queryById(id );
}
/***
* 出库
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!