调整,区分销售和库存扫码数量

main
masong 2 years ago
parent fcf647a03b
commit 7123261c12
  1. 4
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/controller/admin/scanrecord/ScanRecordController.java
  2. 7
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/dal/mysql/scanrecord/ScanRecordMapper.java
  3. 2
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/service/scanrecord/ScanRecordService.java
  4. 8
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/service/scanrecord/ScanRecordServiceImpl.java
  5. 12
      cjy-module-traceability/cjy-module-traceability-biz/src/main/resources/mapper/scanrecord/ScanRecordMapper.xml

@ -120,8 +120,8 @@ public class ScanRecordController {
}
@GetMapping("/staticScanRecord")
public CommonResult<Map<String,Object>> staticScanRecord() {
Map<String,Object> map =scanRecordService.staticScanRecord();
public CommonResult<Map<String,Object>> staticScanRecord(@RequestParam("type") Integer type) {
Map<String,Object> map =scanRecordService.staticScanRecord(type);
return success(map);
}
}

@ -8,6 +8,7 @@ import com.cjy.traceability.framework.mybatis.core.mapper.BaseMapperX;
import com.cjy.traceability.module.traceability.dal.dataobject.scanrecord.ScanRecordDO;
import org.apache.ibatis.annotations.Mapper;
import com.cjy.traceability.module.traceability.controller.admin.scanrecord.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* 扫码记录 Mapper
@ -44,7 +45,7 @@ public interface ScanRecordMapper extends BaseMapperX<ScanRecordDO> {
*/
List<Map<String,Object>> getTraceability();
Long staticScanRecordTotal();
Long staticScanRecordToday();
Long staticScanRecordYesterday();
Long staticScanRecordTotal(@Param("type") Integer type);
Long staticScanRecordToday(@Param("type") Integer type);
Long staticScanRecordYesterday(@Param("type") Integer type);
}

@ -70,5 +70,5 @@ public interface ScanRecordService {
*/
Map<String,Object> getTraceability();
Map<String,Object> staticScanRecord();
Map<String,Object> staticScanRecord(Integer type);
}

@ -222,11 +222,11 @@ public class ScanRecordServiceImpl implements ScanRecordService {
return returnMap;
}
@Override
public Map<String, Object> staticScanRecord() {
public Map<String, Object> staticScanRecord(Integer type) {
Map<String,Object> map = new HashMap<>(3);
map.put("totalScan",scanRecordMapper.staticScanRecordTotal());
map.put("todayScan",scanRecordMapper.staticScanRecordToday());
map.put("yesterdayScan",scanRecordMapper.staticScanRecordYesterday());
map.put("totalScan",scanRecordMapper.staticScanRecordTotal(type));
map.put("todayScan",scanRecordMapper.staticScanRecordToday(type));
map.put("yesterdayScan",scanRecordMapper.staticScanRecordYesterday(type));
return map;
}
}

@ -50,14 +50,24 @@
<select id="staticScanRecordTotal" resultType="java.lang.Long">
select count(id)as totalNum from traceability_scan_record
<if test=" type == 2">
<where>
product_id in ( select product_id from traceability_materials)
</where>
</if>
</select>
<select id="staticScanRecordToday" resultType="java.lang.Long">
select count(id) as todayNum from traceability_scan_record where DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d')
<if test="type ==2">
and product_id in(select product_id from traceability_materials)
</if>
</select>
<select id="staticScanRecordYesterday" resultType="java.lang.Long">
select count(id) as yesterday from traceability_scan_record where DATE_FORMAT(create_time,'%Y-%m-%d') = DATE(DATE_SUB(NOW(), INTERVAL 1 DAY))
<if test="type ==2">
and product_id in(select product_id from traceability_materials)
</if>
</select>
</mapper>
Loading…
Cancel
Save