增加批次商品选择

This commit is contained in:
季圣华 2021-09-29 01:17:20 +08:00
parent 45adbe85e9
commit ef30a7cc3b
15 changed files with 419 additions and 34 deletions

View File

@ -743,27 +743,28 @@ INSERT INTO `jsh_sequence` VALUES ('depot_number_seq', '1', '999999999999999999'
-- ----------------------------
DROP TABLE IF EXISTS `jsh_serial_number`;
CREATE TABLE `jsh_serial_number` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`material_id` bigint(20) DEFAULT NULL COMMENT '产品表id',
`serial_number` varchar(64) DEFAULT NULL COMMENT '序列号',
`is_sell` varchar(1) DEFAULT '0' COMMENT '是否卖出0未卖出1卖出',
`remark` varchar(1024) DEFAULT NULL COMMENT '备注',
`delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`updater` bigint(20) DEFAULT NULL COMMENT '更新人',
`depot_head_id` bigint(20) DEFAULT NULL COMMENT '单据主表id用于跟踪序列号流向',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
PRIMARY KEY (`id`)
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`material_id` bigint(20) DEFAULT NULL COMMENT '产品表id',
`depot_id` bigint(20) DEFAULT NULL COMMENT '仓库id',
`serial_number` varchar(64) DEFAULT NULL COMMENT '序列号',
`is_sell` varchar(1) DEFAULT '0' COMMENT '是否卖出0未卖出1卖出',
`remark` varchar(1024) DEFAULT NULL COMMENT '备注',
`delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`updater` bigint(20) DEFAULT NULL COMMENT '更新人',
`depot_head_id` bigint(20) DEFAULT NULL COMMENT '单据主表id用于跟踪序列号流向',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8 COMMENT='序列号表';
-- ----------------------------
-- Records of jsh_serial_number
-- ----------------------------
INSERT INTO `jsh_serial_number` VALUES ('105', '586', '12312323423223', '0', 'abab', '0', '2019-12-28 12:14:39', '63', '2020-07-21 00:30:32', '63', null, '63');
INSERT INTO `jsh_serial_number` VALUES ('108', '586', '3215952626621201', '0', '', '0', '2020-07-21 00:31:02', '63', '2020-07-21 00:31:02', '63', null, '63');
INSERT INTO `jsh_serial_number` VALUES ('109', '586', '3215952626621202', '0', '', '0', '2020-07-21 00:31:02', '63', '2020-07-21 00:31:02', '63', null, '63');
INSERT INTO `jsh_serial_number` VALUES ('105', '586', '14', '12312323423223', '0', 'abab', '0', '2019-12-28 12:14:39', '63', '2020-07-21 00:30:32', '63', null, '63');
INSERT INTO `jsh_serial_number` VALUES ('108', '586', '14', '3215952626621201', '0', '', '0', '2020-07-21 00:31:02', '63', '2020-07-21 00:31:02', '63', null, '63');
INSERT INTO `jsh_serial_number` VALUES ('109', '586', '14', '3215952626621202', '0', '', '0', '2020-07-21 00:31:02', '63', '2020-07-21 00:31:02', '63', null, '63');
-- ----------------------------
-- Table structure for jsh_supplier

View File

@ -1248,4 +1248,11 @@ alter table jsh_depot_item add expiration_date datetime DEFAULT NULL COMMENT '
-- by jishenghua
-- 插入jsh_platform_config数据配置租户续费地址
-- --------------------------------------------------------
INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('pay_fee_url', '租户续费地址', '');
INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('pay_fee_url', '租户续费地址', '');
-- --------------------------------------------------------
-- 时间 2021年9月28日
-- by jishenghua
-- 给序列号表增加仓库id
-- --------------------------------------------------------
alter table jsh_serial_number add depot_id bigint(20) DEFAULT NULL COMMENT '仓库id' after material_Id;

View File

@ -6,6 +6,7 @@ import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.materialExtend.MaterialExtendService;
import com.jsh.erp.service.depotItem.DepotItemService;
@ -608,4 +609,38 @@ public class DepotItemController {
}
return res;
}
/**
* 获取批次商品列表信息
* @param request
* @return
*/
@GetMapping(value = "/getBatchNumberList")
public BaseResponseInfo getBatchNumberList(@RequestParam("name") String name,
@RequestParam("depotId") Long depotId,
@RequestParam("barCode") String barCode,
@RequestParam(value = "batchNumber", required = false) String batchNumber,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
List<DepotItemVoBatchNumberList> reslist = new ArrayList<>();
List<DepotItemVoBatchNumberList> list = depotItemService.getBatchNumberList(name, depotId, barCode, batchNumber);
for(DepotItemVoBatchNumberList bn: list) {
if(bn.getTotalNum()!=null && bn.getTotalNum().compareTo(BigDecimal.ZERO)>0) {
reslist.add(bn);
}
bn.setExpirationDateStr(Tools.parseDateToStr(bn.getExpirationDate()));
}
map.put("rows", reslist);
map.put("total", reslist.size());
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@ -3,10 +3,13 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.SerialNumber;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.serialNumber.SerialNumberService;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@ -84,4 +88,39 @@ public class SerialNumberController {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 获取序列号商品
* @param name
* @param depotId
* @param materialId
* @param currentPage
* @param pageSize
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getEnableSerialNumberList")
public BaseResponseInfo getEnableSerialNumberList(@RequestParam("name") String name,
@RequestParam("depotId") Long depotId,
@RequestParam("materialId") Long materialId,
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
List<SerialNumber> list = serialNumberService.getEnableSerialNumberList(name, depotId, materialId, (currentPage-1)*pageSize, pageSize);
Long total = serialNumberService.getEnableSerialNumberCount(name, depotId, materialId);
map.put("rows", list);
map.put("total", total);
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@ -7,6 +7,8 @@ public class SerialNumber {
private Long materialId;
private Long depotId;
private String serialNumber;
private String isSell;
@ -43,6 +45,14 @@ public class SerialNumber {
this.materialId = materialId;
}
public Long getDepotId() {
return depotId;
}
public void setDepotId(Long depotId) {
this.depotId = depotId;
}
public String getSerialNumber() {
return serialNumber;
}

View File

@ -28,6 +28,8 @@ public class SerialNumberEx extends SerialNumber{
/**单据类型(出库入库)*/
private String depotHeadType;
private String depotName;
public String getMaterialCode() {
return materialCode;
}
@ -75,4 +77,12 @@ public class SerialNumberEx extends SerialNumber{
public void setDepotHeadType(String depotHeadType) {
this.depotHeadType = depotHeadType;
}
public String getDepotName() {
return depotName;
}
public void setDepotName(String depotName) {
this.depotName = depotName;
}
}

View File

@ -225,6 +225,66 @@ public class SerialNumberExample {
return (Criteria) this;
}
public Criteria andDepotIdIsNull() {
addCriterion("depot_id is null");
return (Criteria) this;
}
public Criteria andDepotIdIsNotNull() {
addCriterion("depot_id is not null");
return (Criteria) this;
}
public Criteria andDepotIdEqualTo(Long value) {
addCriterion("depot_id =", value, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdNotEqualTo(Long value) {
addCriterion("depot_id <>", value, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdGreaterThan(Long value) {
addCriterion("depot_id >", value, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdGreaterThanOrEqualTo(Long value) {
addCriterion("depot_id >=", value, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdLessThan(Long value) {
addCriterion("depot_id <", value, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdLessThanOrEqualTo(Long value) {
addCriterion("depot_id <=", value, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdIn(List<Long> values) {
addCriterion("depot_id in", values, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdNotIn(List<Long> values) {
addCriterion("depot_id not in", values, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdBetween(Long value1, Long value2) {
addCriterion("depot_id between", value1, value2, "depotId");
return (Criteria) this;
}
public Criteria andDepotIdNotBetween(Long value1, Long value2) {
addCriterion("depot_id not between", value1, value2, "depotId");
return (Criteria) this;
}
public Criteria andSerialNumberIsNull() {
addCriterion("serial_number is null");
return (Criteria) this;

View File

@ -3,6 +3,7 @@ package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
@ -128,4 +129,11 @@ public interface DepotItemMapperEx {
@Param("mId") Long mId,
@Param("linkNumber") String linkNumber,
@Param("goToType") String goToType);
List<DepotItemVoBatchNumberList> getBatchNumberList(
@Param("name") String name,
@Param("depotId") Long depotId,
@Param("barCode") String barCode,
@Param("batchNumber") String batchNumber
);
}

View File

@ -1,5 +1,6 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.SerialNumber;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import org.apache.ibatis.annotations.Param;
@ -62,4 +63,13 @@ public interface SerialNumberMapperEx {
int batAddSerialNumber(@Param("list") List<SerialNumberEx> list);
int batchDeleteSerialNumberByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
List<SerialNumber> getEnableSerialNumberList(@Param("name") String name,
@Param("depotId") Long depotId,
@Param("materialId") Long materialId,
@Param("offset") Integer offset, @Param("rows") Integer rows);
Long getEnableSerialNumberCount(@Param("name") String name,
@Param("depotId") Long depotId,
@Param("materialId") Long materialId);
}

View File

@ -0,0 +1,90 @@
package com.jsh.erp.datasource.vo;
import java.math.BigDecimal;
import java.util.Date;
public class DepotItemVoBatchNumberList {
private String id;
private String barCode;
private String name;
private String standard;
private String model;
private String batchNumber;
private Date expirationDate;
private String expirationDateStr;
private BigDecimal totalNum;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBarCode() {
return barCode;
}
public void setBarCode(String barCode) {
this.barCode = barCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStandard() {
return standard;
}
public void setStandard(String standard) {
this.standard = standard;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getBatchNumber() {
return batchNumber;
}
public void setBatchNumber(String batchNumber) {
this.batchNumber = batchNumber;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
public String getExpirationDateStr() {
return expirationDateStr;
}
public void setExpirationDateStr(String expirationDateStr) {
this.expirationDateStr = expirationDateStr;
}
public BigDecimal getTotalNum() {
return totalNum;
}
public void setTotalNum(BigDecimal totalNum) {
this.totalNum = totalNum;
}
}

View File

@ -8,6 +8,7 @@ import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.materialExtend.MaterialExtendService;
@ -661,4 +662,8 @@ public class DepotItemService {
BigDecimal count = depotItemMapperEx.getFinishNumber(mId, linkNumber, goToType);
return count;
}
public List<DepotItemVoBatchNumberList> getBatchNumberList(String name, Long depotId, String barCode, String batchNumber){
return depotItemMapperEx.getBatchNumberList(name, depotId, barCode, batchNumber);
}
}

View File

@ -458,4 +458,24 @@ public class SerialNumberService {
}
return result;
}
public List<SerialNumber> getEnableSerialNumberList(String name, Long depotId, Long materialId, Integer offset, Integer rows)throws Exception {
List<SerialNumber> list =null;
try{
list = serialNumberMapperEx.getEnableSerialNumberList(StringUtil.toNull(name), depotId, materialId, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public Long getEnableSerialNumberCount(String name, Long depotId, Long materialId)throws Exception {
Long count = 0L;
try{
count = serialNumberMapperEx.getEnableSerialNumberCount(StringUtil.toNull(name), depotId, materialId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return count;
}
}

View File

@ -81,6 +81,17 @@
<result column="disAssemOutTotal" jdbcType="DECIMAL" property="disAssemOutTotal" />
</resultMap>
<resultMap id="batchNumberListMap" type="com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList">
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="standard" jdbcType="VARCHAR" property="standard" />
<result column="model" jdbcType="VARCHAR" property="model" />
<result column="batch_number" jdbcType="VARCHAR" property="batchNumber" />
<result column="expiration_date" jdbcType="TIMESTAMP" property="expirationDate" />
<result column="total_num" jdbcType="VARCHAR" property="totalNum" />
</resultMap>
<select id="selectByConditionDepotItem" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap">
select *
FROM jsh_depot_item
@ -473,4 +484,30 @@
</if>
)
</select>
<select id="getBatchNumberList" resultMap="batchNumberListMap">
select id, bar_code, name, standard, model, batch_number, expiration_date, sum(oper_number) total_num from
(select di.batch_number id, me.bar_code, m.name, m.standard, m.model,di.batch_number,di.expiration_date,
di.oper_number*(case dh.type when '入库' then 1 when '出库' then -1 end) as oper_number
from
jsh_depot_head dh
left join jsh_depot_item di on dh.id=di.header_id
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag, '0') != '1'
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_flag,'0') !='1'
where me.bar_code= #{barCode} and me.default_flag=1
<if test="name != null">
<bind name="bindName" value="'%'+name+'%'"/>
and di.batch_number like #{bindName}
</if>
<if test="depotId != null">
and di.depot_id= #{depotId}
</if>
<if test="batchNumber != null">
and di.batch_number= #{batchNumber}
</if>
and m.enable_batch_number =1
and di.delete_flag!=1) tb
group by batch_number
order by expiration_date asc
</select>
</mapper>

View File

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.SerialNumber">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="material_id" jdbcType="BIGINT" property="materialId" />
<result column="depot_id" jdbcType="BIGINT" property="depotId" />
<result column="serial_number" jdbcType="VARCHAR" property="serialNumber" />
<result column="is_sell" jdbcType="VARCHAR" property="isSell" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
@ -74,8 +75,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, material_id, serial_number, is_sell, remark, delete_flag, create_time, creator,
update_time, updater, depot_head_id, tenant_id
id, material_id, depot_id, serial_number, is_sell, remark, delete_flag, create_time,
creator, update_time, updater, depot_head_id, tenant_id
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SerialNumberExample" resultMap="BaseResultMap">
select
@ -108,16 +109,16 @@
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
insert into jsh_serial_number (id, material_id, serial_number,
is_sell, remark, delete_flag,
create_time, creator, update_time,
updater, depot_head_id, tenant_id
)
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{serialNumber,jdbcType=VARCHAR},
#{isSell,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
#{updater,jdbcType=BIGINT}, #{depotHeadId,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}
)
insert into jsh_serial_number (id, material_id, depot_id,
serial_number, is_sell, remark,
delete_flag, create_time, creator,
update_time, updater, depot_head_id,
tenant_id)
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{depotId,jdbcType=BIGINT},
#{serialNumber,jdbcType=VARCHAR}, #{isSell,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT},
#{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}, #{depotHeadId,jdbcType=BIGINT},
#{tenantId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
insert into jsh_serial_number
@ -128,6 +129,9 @@
<if test="materialId != null">
material_id,
</if>
<if test="depotId != null">
depot_id,
</if>
<if test="serialNumber != null">
serial_number,
</if>
@ -166,6 +170,9 @@
<if test="materialId != null">
#{materialId,jdbcType=BIGINT},
</if>
<if test="depotId != null">
#{depotId,jdbcType=BIGINT},
</if>
<if test="serialNumber != null">
#{serialNumber,jdbcType=VARCHAR},
</if>
@ -213,6 +220,9 @@
<if test="record.materialId != null">
material_id = #{record.materialId,jdbcType=BIGINT},
</if>
<if test="record.depotId != null">
depot_id = #{record.depotId,jdbcType=BIGINT},
</if>
<if test="record.serialNumber != null">
serial_number = #{record.serialNumber,jdbcType=VARCHAR},
</if>
@ -252,6 +262,7 @@
update jsh_serial_number
set id = #{record.id,jdbcType=BIGINT},
material_id = #{record.materialId,jdbcType=BIGINT},
depot_id = #{record.depotId,jdbcType=BIGINT},
serial_number = #{record.serialNumber,jdbcType=VARCHAR},
is_sell = #{record.isSell,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
@ -272,6 +283,9 @@
<if test="materialId != null">
material_id = #{materialId,jdbcType=BIGINT},
</if>
<if test="depotId != null">
depot_id = #{depotId,jdbcType=BIGINT},
</if>
<if test="serialNumber != null">
serial_number = #{serialNumber,jdbcType=VARCHAR},
</if>
@ -308,6 +322,7 @@
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
update jsh_serial_number
set material_id = #{materialId,jdbcType=BIGINT},
depot_id = #{depotId,jdbcType=BIGINT},
serial_number = #{serialNumber,jdbcType=VARCHAR},
is_sell = #{isSell,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},

View File

@ -9,16 +9,18 @@
<result column="updaterName" jdbcType="VARCHAR" property="updaterName" />
<result column="depotHeadNumber" jdbcType="VARCHAR" property="depotHeadNumber" />
<result column="depotHeadType" jdbcType="VARCHAR" property="depotHeadType" />
<result column="depotName" jdbcType="VARCHAR" property="depotName" />
</resultMap>
<select id="selectByConditionSerialNumber" resultMap="SerialNumberExBaseResultMap">
select
ser.id, ser.material_id, ser.serial_number, ser.is_sell, ser.remark, ser.delete_flag, ser.create_time,
ser.update_time,me.bar_code as materialCode,mat.name as materialName,null as creator,null as updater,null as creatorName,
null as updaterName,ser.depot_head_id, dh.number as depotHeadNumber,concat(dh.sub_type,dh.type) as depotHeadType
null as updaterName,ser.depot_head_id, dh.number as depotHeadNumber,concat(dh.sub_type,dh.type) as depotHeadType, depot_id, d.name depotName
FROM jsh_serial_number ser
left join jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_flag,'0') !='1'
left join jsh_material_extend me on mat.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_depot_head dh on dh.id= ser.depot_head_id and ifnull(dh.delete_flag,'0') !='1'
left join jsh_depot d on ser.depot_id=d.id and ifnull(d.delete_flag,'0') !='1'
where 1=1
<if test="serialNumber != null">
<bind name="serialNumber" value="'%' + _parameter.serialNumber + '%'" />
@ -240,8 +242,44 @@
)
</update>
<select id="getEnableSerialNumberList" resultMap="com.jsh.erp.datasource.mappers.SerialNumberMapper.BaseResultMap">
select
ser.id, ser.serial_number
FROM jsh_serial_number ser
where 1=1
<if test="name != null">
<bind name="bindName" value="'%'+name+'%'"/>
and ser.serial_number like #{bindName}
</if>
<if test="depotId != null">
and ser.depot_id =#{depotId}
</if>
<if test="materialId != null">
and ser.material_id =#{materialId}
</if>
and ser.is_sell = '0'
and ifnull(ser.delete_flag,'0') !='1'
order by ser.id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="getEnableSerialNumberCount" resultType="java.lang.Long">
select
count(1)
FROM jsh_serial_number ser
where 1=1
<if test="name != null">
<bind name="bindName" value="'%'+name+'%'"/>
and ser.serial_number like #{bindName}
</if>
<if test="depotId != null">
and ser.depot_id =#{depotId}
</if>
<if test="materialId != null">
and ser.material_id =#{materialId}
</if>
and ser.is_sell = '0'
and ifnull(ser.delete_flag,'0') !='1'
</select>
</mapper>