parent
a17677dfd0
commit
8812ddc61b
@ -0,0 +1,24 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.ReagentInfo; |
||||
import cn.toesbieya.jxc.model.vo.result.ReagentResult; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface ReagentMapper extends BaseMapper<ReagentInfo> { |
||||
|
||||
//List<ReagentResult> search(@Param(Constants.WRAPPER) Wrapper<ReagentInfo> wrapper);
|
||||
|
||||
|
||||
/* |
||||
// List<StockExport> export(@Param(Constants.WRAPPER) Wrapper<BizStock> wrapper);
|
||||
|
||||
int insertBatch(@Param("list") List<DetailInfo> list); |
||||
|
||||
int outbound(@Param("id") Integer id, @Param("quantity") Integer num); |
||||
*/ |
||||
|
||||
} |
||||
@ -0,0 +1,114 @@ |
||||
package cn.toesbieya.jxc.model.entity; |
||||
|
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.ToString; |
||||
|
||||
import javax.persistence.Column; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* reagent_info |
||||
* @author 强子烨 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@ToString |
||||
public class ReagentInfo implements Serializable { |
||||
/** |
||||
* 试剂id |
||||
*/ |
||||
private Integer id; |
||||
|
||||
/** |
||||
* 名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 生产日期 |
||||
*/ |
||||
private Long productionDate; |
||||
|
||||
/** |
||||
* 有效期(天) |
||||
*/ |
||||
private Integer effective; |
||||
|
||||
/** |
||||
* 产品批次 |
||||
*/ |
||||
private String batch; |
||||
|
||||
/** |
||||
* 数量 |
||||
*/ |
||||
private Integer quantity; |
||||
|
||||
/** |
||||
* 货位 |
||||
*/ |
||||
private String location; |
||||
|
||||
/** |
||||
* 仓库 |
||||
*/ |
||||
private String storehouse; |
||||
|
||||
/** |
||||
* 规格 |
||||
*/ |
||||
private String specification; |
||||
|
||||
/** |
||||
* 单位 |
||||
*/ |
||||
private String unit; |
||||
|
||||
/** |
||||
* 状态,0停用,1启用 |
||||
*/ |
||||
private Boolean enable = false; |
||||
|
||||
/** |
||||
* 创建人id |
||||
*/ |
||||
private Integer creatorId; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Long createTime; |
||||
|
||||
/** |
||||
* 修改人id |
||||
*/ |
||||
private Integer updateId; |
||||
|
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Long updateTime; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String remark; |
||||
|
||||
/** |
||||
* 试剂厂商 |
||||
*/ |
||||
@Column |
||||
private String manufacture; |
||||
/** |
||||
* 试剂类型 |
||||
*/ |
||||
@Column |
||||
private String type; |
||||
/** |
||||
* 危险说明 |
||||
*/ |
||||
@Column |
||||
private String risk; |
||||
|
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
package cn.toesbieya.jxc.model.vo.result; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class ReagentResult { |
||||
private Integer id; |
||||
private String name; //试剂名称(名称不唯一)
|
||||
private String storehouse; //仓库名称
|
||||
private String location; //货位名称
|
||||
private Integer quantity; //库存数量
|
||||
private String unit; //单位
|
||||
} |
||||
@ -0,0 +1,17 @@ |
||||
package cn.toesbieya.jxc.model.vo.search; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.ToString; |
||||
|
||||
@Data |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class ReagentSearch extends BaseSearch{ |
||||
|
||||
private String name; |
||||
private String manufacture; |
||||
private String type; |
||||
private String risk; |
||||
|
||||
} |
||||
@ -0,0 +1,93 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.mapper.ReagentMapper; |
||||
import cn.toesbieya.jxc.model.entity.ReagentInfo; |
||||
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||
import cn.toesbieya.jxc.model.vo.search.ReagentSearch; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.github.pagehelper.PageHelper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.util.StringUtils; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class ReagentService { |
||||
@Resource |
||||
private ReagentMapper mapper; |
||||
|
||||
/*private final ExcelUtil.CommonMergeOptions mergeOptions = |
||||
new ExcelUtil.CommonMergeOptions( |
||||
new String[]{"id", "cname", "totalNum", "totalPrice", "cgddid", "cgPrice", "cgNum"}, |
||||
"cid", |
||||
"id" |
||||
);*/ |
||||
|
||||
|
||||
public PageResult<ReagentInfo> search(ReagentSearch vo) { |
||||
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||
return new PageResult<>(getByCondition(vo)); |
||||
} |
||||
|
||||
public List<ReagentInfo> getByCondition(ReagentSearch vo) { |
||||
return mapper.selectList(getSearchCondition(vo)); |
||||
} |
||||
|
||||
public List<ReagentInfo> getDetail(String name) { |
||||
return mapper.selectList( |
||||
Wrappers.lambdaQuery(ReagentInfo.class) |
||||
.eq(!StringUtils.isEmpty(name), ReagentInfo::getName, name) |
||||
.gt(ReagentInfo::getQuantity, 0) |
||||
//.orderByDesc(ReagentInfo::getCgddid, ReagentInfo::getCgrkid)
|
||||
); |
||||
} |
||||
|
||||
public List<ReagentInfo> getDetailById(String ids) { |
||||
return mapper.selectList( |
||||
Wrappers.lambdaQuery(ReagentInfo.class) |
||||
.inSql(!StringUtils.isEmpty(ids), ReagentInfo::getId, ids) |
||||
); |
||||
} |
||||
|
||||
/*public void export(ReagentSearch vo, HttpServletResponse response) throws Exception { |
||||
List<ReagentExport> list = mapper.export(getSearchCondition(vo)); |
||||
ExcelUtil.export(list, response, "库存导出", mergeOptions); |
||||
}*/ |
||||
|
||||
|
||||
private Wrapper<ReagentInfo> getSearchCondition(ReagentSearch vo) { |
||||
String name = vo.getName(); |
||||
String manufacture = vo.getManufacture(); |
||||
String type = vo.getType(); |
||||
String risk = vo.getRisk(); |
||||
|
||||
return Wrappers.lambdaQuery(ReagentInfo.class) |
||||
.inSql(!StringUtils.isEmpty(name), ReagentInfo::getId, name) |
||||
.inSql(!StringUtils.isEmpty(manufacture), ReagentInfo::getManufacture, manufacture) |
||||
.inSql(!StringUtils.isEmpty(type), ReagentInfo::getType, type) |
||||
.inSql(!StringUtils.isEmpty(risk), ReagentInfo::getRisk, risk); |
||||
|
||||
|
||||
/*String ids = vo.getIds(); |
||||
String cids = vo.getCids(); |
||||
String cgddids = vo.getCgddids(); |
||||
String cgrkids = vo.getCgrkids(); |
||||
Long startTime = vo.getStartTime(); |
||||
Long endTime = vo.getEndTime(); |
||||
|
||||
return Wrappers.lambdaQuery(ReagentInfo.class) |
||||
.inSql(!StringUtils.isEmpty(ids), ReagentInfo::getId, ids) |
||||
.inSql(!StringUtils.isEmpty(cids), ReagentInfo::getCid, cids) |
||||
.inSql(!StringUtils.isEmpty(cgddids), ReagentInfo::getCgddid, cgddids) |
||||
.inSql(!StringUtils.isEmpty(cgrkids), ReagentInfo::getCgrkid, cgrkids) |
||||
.gt(ReagentInfo::getNum, 0) |
||||
.ge(startTime != null, ReagentInfo::getCtime, startTime) |
||||
.le(endTime != null, ReagentInfo::getCtime, endTime);*/ |
||||
|
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,55 @@ |
||||
<?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="cn.toesbieya.jxc.mapper.ReagentMapper"> |
||||
<!--<select id="search" resultType="cn.toesbieya.jxc.model.vo.result.ReagentResult"> |
||||
select name, |
||||
locationId, |
||||
quantity, |
||||
unit |
||||
from detail_info ${ew.customSqlSegment} |
||||
group by id |
||||
</select>--> |
||||
|
||||
<!--<select id="export" parameterType="cn.toesbieya.jxc.model.vo.search.StockSearch" |
||||
resultType="cn.toesbieya.jxc.model.vo.export.StockExport"> |
||||
select a.cid, |
||||
a.cname, |
||||
a.total_num, |
||||
a.total_price, |
||||
b.cgddid, |
||||
b.cgrkid, |
||||
b.price cg_price, |
||||
from_unixtime(b.ctime / 1000, '%Y-%m-%d %H:%m:%s') ctime, |
||||
c.num rk_num, |
||||
d.num cg_num |
||||
from ( |
||||
select cid, |
||||
cname, |
||||
sum(num) total_num, |
||||
sum(num * price) total_price |
||||
from biz_stock ${ew.customSqlSegment} |
||||
group by cid |
||||
) a |
||||
join biz_stock b using (cid) |
||||
left join biz_purchase_inbound_sub c on c.cid = a.cid and c.pid = b.cgrkid |
||||
left join biz_purchase_order_sub d on c.cid = d.cid and d.pid = b.cgddid |
||||
order by a.cid, b.cgddid desc, b.cgrkid desc |
||||
</select> |
||||
|
||||
<insert id="insertBatch" keyColumn="id" keyProperty="id" parameterType="cn.toesbieya.jxc.model.entity.BizStock" |
||||
useGeneratedKeys="true"> |
||||
insert into biz_stock (cid, cname, num, price, ctime, cgrkid, cgddid) values |
||||
<foreach collection="list" item="item" separator=","> |
||||
(#{item.cid,jdbcType=INTEGER}, #{item.cname,jdbcType=VARCHAR}, #{item.num,jdbcType=DECIMAL}, |
||||
#{item.price,jdbcType=DECIMAL}, #{item.ctime,jdbcType=BIGINT}, #{item.cgrkid,jdbcType=VARCHAR}, |
||||
#{item.cgddid,jdbcType=VARCHAR}) |
||||
</foreach> |
||||
</insert> |
||||
|
||||
<update id="outbound"> |
||||
update biz_stock |
||||
set num = num - #{num,jdbcType=DECIMAL} |
||||
where id = #{id,jdbcType=INTEGER} |
||||
and num <![CDATA[ >= ]]> #{num,jdbcType=DECIMAL} |
||||
</update>--> |
||||
</mapper> |
||||
@ -1,7 +1,7 @@ |
||||
import {GetApi, PostApi} from "@/api/request" |
||||
|
||||
export const search = new PostApi(`/stock/current/search`) |
||||
export const search = new PostApi(`/stock/reagent/search`) |
||||
|
||||
export const getDetail = new GetApi(`/stock/current/getDetail`, cids => ({params: {cids}})) |
||||
export const getDetail = new GetApi(`/stock/reagent/getDetail`, name => ({params: {name}})) |
||||
|
||||
export const getDetailById = new GetApi(`/stock/current/getDetailById`, ids => ({params: {ids}})) |
||||
export const getDetailById = new GetApi(`/stock/reagent/getDetailById`, id => ({params: {id}})) |
||||
|
||||
Loading…
Reference in new issue