This commit is contained in:
parent
6d13c8a996
commit
f8663453d2
@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -57,9 +58,9 @@ public class ApplyFormController {
|
||||
@Parameter(description = "页面大小") @RequestParam(name = "size", required = false, defaultValue = "10") int size,
|
||||
@Parameter(description = "申请类型(1入库 3出库 4盘点)") @RequestParam(name = "applyType") Integer applyType,
|
||||
@Parameter(description = "物料类型") @RequestParam(name = "type", required = false) String type,
|
||||
@Parameter(description = "物料编码") @RequestParam(name = "code", required = false) String code,
|
||||
@Parameter(description = "物料名称") @RequestParam(name = "name", required = false) String name) {
|
||||
IPage<ApplyDTO> result = applyFormService.search(page, size, applyType, type, code, name);
|
||||
@Parameter(description = "编码/名称") @RequestParam(name = "key", required = false) String key) {
|
||||
String[] types = StringUtils.isNotBlank(type) ? type.split(",") : new String[0];
|
||||
IPage<ApplyDTO> result = applyFormService.search(page, size, applyType, List.of(types), key);
|
||||
result.getRecords().forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||
return result;
|
||||
}
|
||||
@ -68,10 +69,9 @@ public class ApplyFormController {
|
||||
@Operation(summary = "导出申请单列表")
|
||||
public void downloadExcel(@Parameter(description = "申请类型(1入库 3出库 4盘点)") @RequestParam(name = "applyType") Integer applyType,
|
||||
@Parameter(description = "物料类型") @RequestParam(name = "type", required = false) String type,
|
||||
@Parameter(description = "物料编码") @RequestParam(name = "code", required = false) String code,
|
||||
@Parameter(description = "物料名称") @RequestParam(name = "name", required = false) String name,
|
||||
@Parameter(description = "编码/名称") @RequestParam(name = "code", required = false) String key,
|
||||
HttpServletResponse response) {
|
||||
IPage<ApplyDTO> applyDTOIPage = searchPage(1, 10000, applyType, type, code, name);
|
||||
IPage<ApplyDTO> applyDTOIPage = searchPage(1, 10000, applyType, type, key);
|
||||
List<ApplyDTO> applyDTOList = applyDTOIPage.getRecords();
|
||||
// 导出excel
|
||||
String sheetName = "申请单列表";
|
||||
|
@ -13,11 +13,11 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum ApplyTypeEnum implements ICodeBook {
|
||||
|
||||
PURCHASE_RECEIPT("1", "采购入库申请"),
|
||||
RETURN_RECEIPT("2", "归还入库申请"),
|
||||
LOAN_OUT("3", "外借出库申请"),
|
||||
AUDIT("4", "盘点申请"),
|
||||
SCRAP_OUT("5", "报废出库申请"),
|
||||
PURCHASE_RECEIPT("1", "采购入库"),
|
||||
RETURN_RECEIPT("2", "归还入库"),
|
||||
LOAN_OUT("3", "外借出库"),
|
||||
AUDIT("4", "盘点"),
|
||||
SCRAP_OUT("5", "报废出库"),
|
||||
;
|
||||
|
||||
@EnumValue
|
||||
|
@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import tech.riemann.ims.dto.response.ApplyDTO;
|
||||
import tech.riemann.ims.entity.material.ApplyForm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author mayong
|
||||
* @since 2024/11/28 15:38
|
||||
*/
|
||||
public interface ApplyFormMapper extends BaseMapper<ApplyForm> {
|
||||
|
||||
IPage<ApplyDTO> searchPage(IPage<ApplyDTO> page, Integer applyType, String type, String code, String name);
|
||||
IPage<ApplyDTO> searchPage(IPage<ApplyDTO> page, Integer applyType, List<String> types, String key);
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
||||
import tech.riemann.ims.dto.response.ApplyDTO;
|
||||
import tech.riemann.ims.entity.material.ApplyForm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author mayong
|
||||
* @since 2024/11/28 15:35
|
||||
@ -17,10 +19,8 @@ public interface IApplyFormService extends IService<ApplyForm>, IdNameEntityServ
|
||||
* @param page 页码
|
||||
* @param size 每页数量
|
||||
* @param applyType 申请类型
|
||||
* @param type 申请材料类型
|
||||
* @param code 申请材料编码
|
||||
* @param name 申请材料名称
|
||||
* @param key 编码或名称关键字
|
||||
* @return IPage<ApplyDTO>
|
||||
*/
|
||||
IPage<ApplyDTO> search(int page, int size, Integer applyType, String type, String code, String name);
|
||||
IPage<ApplyDTO> search(int page, int size, Integer applyType, List<String> types, String key);
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ import tech.riemann.ims.entity.material.ApplyForm;
|
||||
import tech.riemann.ims.mapper.material.ApplyFormMapper;
|
||||
import tech.riemann.ims.service.material.IApplyFormService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author mayong
|
||||
* @since 2024/11/28 15:36
|
||||
@ -28,7 +30,7 @@ public class ApplyFormServiceImpl extends ServiceImpl<ApplyFormMapper, ApplyForm
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ApplyDTO> search(int page, int size, Integer applyType, String type, String code, String name) {
|
||||
return applyFormMapper.searchPage(Page.of(page, size), applyType, type, code, name);
|
||||
public IPage<ApplyDTO> search(int page, int size, Integer applyType, List<String> types, String key) {
|
||||
return applyFormMapper.searchPage(Page.of(page, size), applyType, types, key);
|
||||
}
|
||||
}
|
||||
|
@ -54,15 +54,20 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="type!= null and type!= ''">
|
||||
and( m.m_type LIKE CONCAT('%', #{type}, '%') or m.m_code LIKE CONCAT('%', #{code}, '%') or m.m_name LIKE CONCAT('%', #{name}, '%') )
|
||||
<if test="types != null and types.size() > 0">
|
||||
and (
|
||||
<foreach collection="types" item="item" separator="or">
|
||||
( m_type like concat(#{item},'%') )
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="key != null and key.trim().length() > 0">
|
||||
and (
|
||||
m_code like concat('%',#{key},'%')
|
||||
or m_name like concat('%',#{key},'%')
|
||||
)
|
||||
</if>
|
||||
<!-- <if test="code!= null and code!= ''">-->
|
||||
<!-- AND m.m_code LIKE CONCAT('%', #{code}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="name!= null and name!= ''">-->
|
||||
<!-- AND m.m_name LIKE CONCAT('%', #{name}, '%')-->
|
||||
<!-- </if>-->
|
||||
ORDER BY f.af_apply_date DESC
|
||||
|
||||
</select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user