营业执照文件上传逻辑优化

This commit is contained in:
sxu 2024-10-30 09:41:25 +08:00
parent 4e1d425147
commit be0f3ff1a5
4 changed files with 17 additions and 17 deletions

View File

@ -37,12 +37,12 @@ public class BmFileInfo extends BaseEntity
/** 文件名称 */
@Excel(name = "文件名称")
@ApiModelProperty(value = "文件名称")
private String fileName;
private String name;
/** 文件路径 */
@Excel(name = "文件路径")
@ApiModelProperty(value = "文件路径")
private String fileUrl;
private String url;
/** 数据字典 */
@Excel(name = "数据字典")

View File

@ -77,6 +77,6 @@ public class SupplierInfo extends BaseEntity {
* 营业执照文件列表
*/
@ApiModelProperty(value = "营业执照文件列表")
List<BmFileInfo> businessLicenseFileList;
List<BmFileInfo> bmFileInfos;
}

View File

@ -49,7 +49,7 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService {
bmFileInfo.setModelId(supplierInfo.getSupplierId());
bmFileInfo.setDicId(MaterialConstants.FILE_TYPE_YINGYEZHIZHAO);
List<BmFileInfo> fileInfos = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
supplierInfo.setBusinessLicenseFileList(fileInfos);
supplierInfo.setBmFileInfos(fileInfos);
return supplierInfo;
}
@ -76,11 +76,11 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService {
supplierInfo.setCreateTime(DateUtils.getNowDate());
int insertedSupplierInfoResult = supplierInfoMapper.insertSupplierInfo(supplierInfo);
if (insertedSupplierInfoResult > 0) {
if (CollectionUtils.isEmpty(supplierInfo.getBusinessLicenseFileList())) {
if (CollectionUtils.isEmpty(supplierInfo.getBmFileInfos())) {
return AjaxResult.success("新增任务成功,无营业执照附件");
}
AtomicBoolean addFileInfoResult = new AtomicBoolean(false);
supplierInfo.getBusinessLicenseFileList().forEach(bmFileInfo -> {
supplierInfo.getBmFileInfos().forEach(bmFileInfo -> {
bmFileInfo.setModelId(supplierInfo.getSupplierId());
addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0);
});

View File

@ -6,23 +6,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.bonus.material.basic.domain.BmFileInfo" id="BmFileInfoResult">
<result property="id" column="id" />
<result property="modelId" column="model_id" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="name" column="name" />
<result property="url" column="url" />
<result property="dicId" column="dic_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectBmFileInfoVo">
select id, model_id, file_name, file_url, dic_id, create_by, create_time from bm_file_info
select id, model_id, name, url, dic_id, create_by, create_time from bm_file_info
</sql>
<select id="selectBmFileInfoList" parameterType="com.bonus.material.basic.domain.BmFileInfo" resultMap="BmFileInfoResult">
<include refid="selectBmFileInfoVo"/>
<where>
<if test="modelId != null "> and model_id = #{modelId}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="url != null and url != ''"> and url = #{url}</if>
<if test="dicId != null "> and dic_id = #{dicId}</if>
</where>
</select>
@ -36,16 +36,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into bm_file_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelId != null">model_id,</if>
<if test="fileName != null">file_name,</if>
<if test="fileUrl != null">file_url,</if>
<if test="name != null">name,</if>
<if test="url != null">url,</if>
<if test="dicId != null">dic_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelId != null">#{modelId},</if>
<if test="fileName != null">#{fileName},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="name != null">#{name},</if>
<if test="url != null">#{url},</if>
<if test="dicId != null">#{dicId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -56,8 +56,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update bm_file_info
<trim prefix="SET" suffixOverrides=",">
<if test="modelId != null">model_id = #{modelId},</if>
<if test="fileName != null">file_name = #{fileName},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="name != null">name = #{name},</if>
<if test="url != null">url = #{url},</if>
<if test="dicId != null">dic_id = #{dicId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>