新购批量导入
This commit is contained in:
parent
450725293a
commit
7405c26534
|
|
@ -2,18 +2,20 @@ package com.bonus.purchase.controller;
|
|||
import com.bonus.common.core.domain.ResultBean;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.purchase.domain.BpmPurchaseInfo;
|
||||
import com.bonus.purchase.service.impl.BpmPurchaseInfoService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新购到货验收表bpm_purchase_info(bpm_purchase_info)表控制层
|
||||
*
|
||||
* 新购到货验收表(bpm_purchase_info)控制层
|
||||
* @author 阮世耀
|
||||
*/
|
||||
@RestController
|
||||
|
|
@ -31,6 +33,7 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
* 分页查询数据
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
||||
public TableDataInfo getList(BpmPurchaseInfo bpmPurchaseInfo) {
|
||||
startPage();
|
||||
List<BpmPurchaseInfo> list = this.bpmPurchaseInfoService.selectAll(bpmPurchaseInfo);
|
||||
|
|
@ -45,19 +48,23 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResultBean<BpmPurchaseInfo> queryById(@NotNull(message = "ID不能为空") @PathVariable("id") Integer id) {
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
||||
public ResultBean<BpmPurchaseInfo> queryById(@NotNull(message = "ID不能为空")
|
||||
@PathVariable("id")
|
||||
@Positive(message = "ID必须为正整数") Integer id) {
|
||||
return ResultBean.success(this.bpmPurchaseInfoService.selectByPrimaryKey(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* 新增数据---批量导入
|
||||
*
|
||||
* @param bpmPurchaseInfo 实体
|
||||
* @param items 新购设备列表
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public ResultBean< Boolean> add(@NotNull @Valid @RequestBody BpmPurchaseInfo bpmPurchaseInfo) {
|
||||
this.bpmPurchaseInfoService.insertSelective(bpmPurchaseInfo);
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:add")
|
||||
public ResultBean< Boolean> add(@RequestBody @Valid @NotEmpty List<BpmPurchaseInfo> items) {
|
||||
this.bpmPurchaseInfoService.insertList(items);
|
||||
return ResultBean.success(true);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +75,8 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping(value = "/update")
|
||||
public ResultBean< Boolean> edit(@NotNull @RequestBody BpmPurchaseInfo bpmPurchaseInfo) {
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:edit")
|
||||
public ResultBean< Boolean> edit(@RequestBody @NotNull(message = "参数不能为空") BpmPurchaseInfo bpmPurchaseInfo) {
|
||||
this.bpmPurchaseInfoService.updateByPrimaryKeySelective(bpmPurchaseInfo);
|
||||
return ResultBean.success(true);
|
||||
}
|
||||
|
|
@ -80,6 +88,7 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:remove")
|
||||
public ResultBean< Boolean> deleteById(@PathVariable("id") Integer id) {
|
||||
this.bpmPurchaseInfoService.deleteByPrimaryKey(id);
|
||||
return ResultBean.success(true);
|
||||
|
|
|
|||
|
|
@ -6,15 +6,9 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*@PackagePath: com.bonus.purchase
|
||||
*@author : 阮世耀
|
||||
*@CreateTime: 2024-08-19 16:31
|
||||
*@Description: 描述
|
||||
*@version : 1.0
|
||||
*/
|
||||
/**
|
||||
* 新购到货验收表bpm_purchase_info
|
||||
* @author 阮世耀
|
||||
*/
|
||||
@ApiModel(description="新购到货验收表bpm_purchase_info")
|
||||
@Data
|
||||
|
|
@ -134,9 +128,9 @@ public class BpmPurchaseInfo implements Serializable {
|
|||
private String remark;
|
||||
|
||||
/**
|
||||
* 文件路径需讨论
|
||||
* 文件路径
|
||||
*/
|
||||
@ApiModelProperty(value="文件路径需讨论")
|
||||
@ApiModelProperty(value="文件路径")
|
||||
private String fileUrl;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public interface BpmPurchaseInfoMapper {
|
|||
|
||||
List<BpmPurchaseInfo> selectAll(BpmPurchaseInfo bpmPurchaseInfo);
|
||||
|
||||
int insertList(@Param("list")List<BpmPurchaseInfo> list);
|
||||
|
||||
/**
|
||||
* delete by primary key
|
||||
|
|
|
|||
|
|
@ -67,6 +67,13 @@ public class BpmPurchaseInfoService{
|
|||
return bpmPurchaseInfoMapper.selectAll(bpmPurchaseInfo);
|
||||
}
|
||||
|
||||
public int insertList(List<BpmPurchaseInfo> list){
|
||||
return bpmPurchaseInfoMapper.insertList(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -545,5 +545,50 @@
|
|||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from bpm_purchase_info
|
||||
where is_active = 1
|
||||
</select>
|
||||
|
||||
<!--by syruan on 2024-08-20-->
|
||||
<insert id="insertList" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO bpm_purchase_info(
|
||||
task_id,
|
||||
type_id,
|
||||
purchase_num,
|
||||
purchase_price,
|
||||
notax_price,
|
||||
tax_rate,
|
||||
supplier_id,
|
||||
product_date,
|
||||
`status`,
|
||||
bind_num,
|
||||
input_num,
|
||||
updater,
|
||||
update_time,
|
||||
auditor,
|
||||
is_active,
|
||||
remark,
|
||||
file_url
|
||||
)VALUES
|
||||
<foreach collection="list" item="element" index="index" separator=",">
|
||||
(
|
||||
#{element.taskId,jdbcType=INTEGER},
|
||||
#{element.typeId,jdbcType=INTEGER},
|
||||
#{element.purchaseNum,jdbcType=INTEGER},
|
||||
#{element.purchasePrice,jdbcType=INTEGER},
|
||||
#{element.notaxPrice,jdbcType=INTEGER},
|
||||
#{element.taxRate,jdbcType=INTEGER},
|
||||
#{element.supplierId,jdbcType=INTEGER},
|
||||
#{element.productDate,jdbcType=TIMESTAMP},
|
||||
#{element.status,jdbcType=TINYINT},
|
||||
#{element.bindNum,jdbcType=INTEGER},
|
||||
#{element.inputNum,jdbcType=INTEGER},
|
||||
#{element.updater,jdbcType=VARCHAR},
|
||||
now(),
|
||||
#{element.auditor,jdbcType=VARCHAR},
|
||||
1,
|
||||
#{element.remark,jdbcType=VARCHAR},
|
||||
#{element.fileUrl,jdbcType=VARCHAR}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue