库存日志

This commit is contained in:
sxu 2024-08-15 16:01:29 +08:00
parent e70beeca33
commit 30f4e3bd10
5 changed files with 368 additions and 1 deletions

View File

@ -21,7 +21,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("/receive")
@RequestMapping("/base/receive")
public class MaReceiveController extends BaseController {
@Resource

View File

@ -0,0 +1,54 @@
package com.bonus.sgzb.system.controller;
import com.bonus.sgzb.base.api.domain.BmStorageLog;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.security.annotation.InnerAuth;
import com.bonus.sgzb.system.service.impl.BmStorageLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* (bm_storage_log)表控制层
*
* @author syruan
*/
@RestController
@RequestMapping("/bm_storage_logs")
public class BmStorageLogController extends BaseController {
/**
* 服务对象
*/
@Autowired
private BmStorageLogService bmStorageLogService;
@GetMapping("/list")
public TableDataInfo list(BmStorageLog record) {
startPage();
List<BmStorageLog> list = bmStorageLogService.selectAll(record);
return getDataTable(list);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectByPrimaryKey")
public BmStorageLog selectByPrimaryKey(Integer id) {
return bmStorageLogService.selectByPrimaryKey(id);
}
@InnerAuth
@PostMapping
public AjaxResult batchInsert(@RequestBody List<BmStorageLog> bmStorageLogList) {
return toAjax(bmStorageLogService.batchInsert(bmStorageLogList));
}
}

View File

@ -0,0 +1,25 @@
package com.bonus.sgzb.system.mapper;
import com.bonus.sgzb.base.api.domain.BmStorageLog;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface BmStorageLogMapper {
int deleteByPrimaryKey(Integer id);
// int insert(BmStorageLog record);
int batchInsert(List<BmStorageLog> records);
int insertSelective(BmStorageLog record);
BmStorageLog selectByPrimaryKey(Integer id);
List<BmStorageLog> selectAll(BmStorageLog record);
int updateByPrimaryKeySelective(BmStorageLog record);
int updateByPrimaryKey(BmStorageLog record);
}

View File

@ -0,0 +1,57 @@
package com.bonus.sgzb.system.service.impl;
import com.bonus.sgzb.base.api.domain.BmStorageLog;
import com.bonus.sgzb.system.mapper.BmStorageLogMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class BmStorageLogService {
@Autowired
private BmStorageLogMapper bmStorageLogMapper;
private static ObjectMapper objectMapper = new ObjectMapper();
public int deleteByPrimaryKey(Integer id) {
return bmStorageLogMapper.deleteByPrimaryKey(id);
}
// public int insert(BmStorageLog record) {
// return bmStorageLogMapper.insert(record);
// }
public int batchInsert(List<BmStorageLog> records) {
log.info("batch insert log {}", records);
return bmStorageLogMapper.batchInsert(records);
}
public List<BmStorageLog> selectAll(BmStorageLog record) {
return bmStorageLogMapper.selectAll(record);
}
public int insertSelective(BmStorageLog record) {
return bmStorageLogMapper.insertSelective(record);
}
public BmStorageLog selectByPrimaryKey(Integer id) {
return bmStorageLogMapper.selectByPrimaryKey(id);
}
public int updateByPrimaryKeySelective(BmStorageLog record) {
return bmStorageLogMapper.updateByPrimaryKeySelective(record);
}
public int updateByPrimaryKey(BmStorageLog record) {
return bmStorageLogMapper.updateByPrimaryKey(record);
}
}

View File

@ -0,0 +1,231 @@
<?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.bonus.sgzb.system.mapper.BmStorageLogMapper">
<resultMap id="BaseResultMap" type="com.bonus.sgzb.base.api.domain.BmStorageLog">
<!--@mbg.generated-->
<!--@Table bm_storage_log-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="model_title" jdbcType="VARCHAR" property="modelTitle" />
<result column="method" jdbcType="VARCHAR" property="method" />
<result column="task_id" jdbcType="VARCHAR" property="taskId" />
<result column="agreement_id" jdbcType="INTEGER" property="agreementId" />
<result column="task_name" jdbcType="VARCHAR" property="taskName" />
<result column="type_id" jdbcType="INTEGER" property="typeId" />
<result column="type_name" jdbcType="VARCHAR" property="typeName" />
<result column="type_parent_name" jdbcType="VARCHAR" property="typeParentName" />
<result column="pre_store_num" jdbcType="INTEGER" property="preStoreNum" />
<result column="in_num" jdbcType="INTEGER" property="inNum" />
<result column="out_num" jdbcType="INTEGER" property="outNum" />
<result column="back_num" jdbcType="INTEGER" property="backNum" />
<result column="pass_num" jdbcType="INTEGER" property="passNum" />
<result column="maintenance_num" jdbcType="INTEGER" property="maintenanceNum" />
<result column="scrap_num" jdbcType="INTEGER" property="scrapNum" />
<result column="post_store_num" jdbcType="INTEGER" property="postStoreNum" />
<result column="json_result" jdbcType="VARCHAR" property="jsonResult" />
<result column="result_code" jdbcType="INTEGER" property="resultCode" />
<result column="result_msg" jdbcType="VARCHAR" property="resultMsg" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="status" jdbcType="TINYINT" property="status" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, model_title, `method`, task, type_id, num, `description`, json_result, `time`, creator,
remark, `status`
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
bsl.id, bsl.model_title, bsl.`method`, bsl.task_id, bsl.type_id, bsl.pre_store_num, bsl.in_num, bsl.out_num,bsl.post_store_num,bsl.result_code,bsl.result_msg,
bsl.back_num, bsl.pass_num, bsl.maintenance_num, bsl.scrap_num, bsl.json_result, bsl.create_time, bsl.creator, bsl.manage_type, bsl.agreement_id,
bsl.remark, bsl.`status`, mt.type_name, mt1.type_name as type_parent_name, tt.code as task_name
from bm_storage_log bsl
left join ma_type mt on bsl.type_id = mt.type_id
inner join ma_type mt1 on mt.parent_id = mt1.type_id
left join tm_task tt on bsl.task_id = tt.task_id
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select
bsl.id, bsl.model_title, bsl.`method`, bsl.task_id, bsl.type_id, bsl.pre_store_num, bsl.in_num, bsl.out_num,bsl.post_store_num,bsl.result_code,bsl.result_msg,
bsl.back_num, bsl.pass_num, bsl.maintenance_num, bsl.scrap_num, bsl.json_result, bsl.create_time, bsl.creator, bsl.manage_type, bsl.agreement_id,
bsl.remark, bsl.`status`, mt.type_name, mt1.type_name as type_parent_name, tt.code as task_name
from bm_storage_log bsl
left join ma_type mt on bsl.type_id = mt.type_id
inner join ma_type mt1 on mt.parent_id = mt1.type_id
left join tm_task tt on bsl.task_id = tt.task_id
<where>
<if test="modelTitle != null and modelTitle != ''">
and bsl.model_title like concat('%', #{modelTitle}, '%')
</if>
<if test="typeName != null and typeName != ''">
and mt1.type_name like concat('%', #{typeName}, '%')
</if>
</where>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from bm_storage_log
where id = #{id,jdbcType=INTEGER}
</delete>
<!-- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.system.api.domain.BmStorageLog" useGeneratedKeys="true">-->
<!-- &lt;!&ndash;@mbg.generated&ndash;&gt;-->
<!-- insert into bm_storage_log (model_title, `method`, task_id, type_id,-->
<!-- description, json_result, create_time, creator, remark,-->
<!-- pre_num, input_num, out_num, audit_num, manage_type,-->
<!-- type_name, type_model_name, pre_store_num, in_num,-->
<!-- back_num, pass_num, maintenance_num, scrap_num, `status`, post_store_num-->
<!-- )-->
<!-- values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{typeId,jdbcType=INTEGER},-->
<!-- #{description,jdbcType=VARCHAR}, #{jsonResult,jdbcType=VARCHAR}, now(), #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},-->
<!-- #{preNum,jdbcType=VARCHAR}, #{inputNum,jdbcType=VARCHAR}, #{outNum,jdbcType=VARCHAR}, #{auditNum,jdbcType=VARCHAR}, #{manageType,jdbcType=VARCHAR},-->
<!-- #{typeName,jdbcType=VARCHAR}, #{typeModelName,jdbcType=VARCHAR}, #{preStoreNum,jdbcType=VARCHAR}, #{inNum,jdbcType=VARCHAR},-->
<!-- #{backNum,jdbcType=VARCHAR}, #{passNum,jdbcType=VARCHAR}, #{maintenanceNum,jdbcType=VARCHAR}, #{scrapNum,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},-->
<!-- #{postStoreNum,jdbcType=VARCHAR}-->
<!-- )-->
<!-- </insert>-->
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.BmStorageLog" useGeneratedKeys="true">
insert into bm_storage_log (model_title, `method`, task_id, type_id,
create_time, creator, remark, out_num, manage_type,
type_name, type_model_name, pre_store_num, in_num,
back_num, pass_num, maintenance_num, agreement_id,
scrap_num, `status`, post_store_num, result_code, result_msg, json_result
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.modelTitle,jdbcType=VARCHAR}, #{item.method,jdbcType=VARCHAR}, #{item.taskId,jdbcType=VARCHAR}, #{item.typeId,jdbcType=INTEGER},
now(), #{item.creator,jdbcType=VARCHAR}, #{item.remark,jdbcType=VARCHAR}, #{item.outNum,jdbcType=INTEGER}, #{item.manageType,jdbcType=VARCHAR},
#{item.typeName,jdbcType=VARCHAR}, #{item.typeModelName,jdbcType=VARCHAR}, #{item.preStoreNum,jdbcType=INTEGER}, #{item.inNum,jdbcType=INTEGER},
#{item.backNum,jdbcType=INTEGER}, #{item.passNum,jdbcType=INTEGER}, #{item.maintenanceNum,jdbcType=INTEGER}, #{item.agreementId,jdbcType=INTEGER},
#{item.scrapNum,jdbcType=INTEGER}, #{item.status,jdbcType=VARCHAR}, #{item.postStoreNum,jdbcType=INTEGER},
#{item.resultCode,jdbcType=INTEGER}, #{item.resultMsg,jdbcType=VARCHAR}, #{item.jsonResult,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.BmStorageLog" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_storage_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelTitle != null and modelTitle != ''">
model_title,
</if>
<if test="method != null and method != ''">
`method`,
</if>
<if test="task != null and task != ''">
task,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="num != null and num != ''">
num,
</if>
<if test="description != null and description != ''">
`description`,
</if>
<if test="jsonResult != null and jsonResult != ''">
json_result,
</if>
<if test="time != null">
`time`,
</if>
<if test="creator != null and creator != ''">
creator,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelTitle != null and modelTitle != ''">
#{modelTitle,jdbcType=VARCHAR},
</if>
<if test="method != null and method != ''">
#{method,jdbcType=VARCHAR},
</if>
<if test="task != null and task != ''">
#{task,jdbcType=VARCHAR},
</if>
<if test="typeId != null">
#{typeId,jdbcType=INTEGER},
</if>
<if test="num != null and num != ''">
#{num,jdbcType=VARCHAR},
</if>
<if test="description != null and description != ''">
#{description,jdbcType=VARCHAR},
</if>
<if test="jsonResult != null and jsonResult != ''">
#{jsonResult,jdbcType=VARCHAR},
</if>
<if test="time != null">
#{time,jdbcType=TIMESTAMP},
</if>
<if test="creator != null and creator != ''">
#{creator,jdbcType=VARCHAR},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.sgzb.base.api.domain.BmStorageLog">
<!--@mbg.generated-->
update bm_storage_log
<set>
<if test="modelTitle != null and modelTitle != ''">
model_title = #{modelTitle,jdbcType=VARCHAR},
</if>
<if test="method != null and method != ''">
`method` = #{method,jdbcType=VARCHAR},
</if>
<if test="task != null and task != ''">
task = #{task,jdbcType=VARCHAR},
</if>
<if test="typeId != null">
type_id = #{typeId,jdbcType=INTEGER},
</if>
<if test="description != null and description != ''">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="jsonResult != null and jsonResult != ''">
json_result = #{jsonResult,jdbcType=VARCHAR},
</if>
<if test="time != null">
`time` = #{time,jdbcType=TIMESTAMP},
</if>
<if test="creator != null and creator != ''">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bonus.sgzb.base.api.domain.BmStorageLog">
<!--@mbg.generated-->
update bm_storage_log
set model_title = #{modelTitle,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
task = #{task,jdbcType=VARCHAR},
type_id = #{typeId,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
json_result = #{jsonResult,jdbcType=VARCHAR},
`time` = #{time,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>