Browse Source

sql优化

hsh 7 months ago
parent
commit
e087e8db07
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpOutDetlYfMapper.java

+ 9 - 9
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpOutDetlYfMapper.java

@@ -51,20 +51,20 @@ public interface YpOutDetlYfMapper {
             "  a.draw_no," +
             "  a.group_no," +
             "  a.out_date," +
-            "  location=isnull(c.location,'')," +
+            "  c.location," +
             "  rtrim(a.charge_code)charge_code," +
             "  a.serial," +
             "  b.name," +
-            "  specification=b.specification," +
-            "  pack_retprice=a.pack_retprice," +
+            "  b.specification," +
+            "  a.pack_retprice," +
             "  a.stock_amount," +
             "  a.confirm_date," +
-            "  buy_price = case when isnull(a.buy_price,0)=0 then b.buy_price else a.buy_price end," +
-            "  curr_stock_amount=a.stock_amount-a.out_amt," +
-            "  profit_lossprofit_loss=-a.out_amt," +
-            "  profit_lossprofit_money=-a.out_amt*a.pack_retprice," +
-            "  py_code=b.py_code," +
-            "  manufactoryName=m.name" +
+            "  case when isnull(a.buy_price,0)=0 then b.buy_price else a.buy_price end as buy_price," +
+            "  a.stock_amount-a.out_amt as curr_stock_amount," +
+            "  -a.out_amt as profit_lossprofit_loss," +
+            "  -a.out_amt*a.pack_retprice as profit_lossprofit_money," +
+            "  b.py_code," +
+            "  m.name as manufactoryName" +
             " from yp_out_detl_yf a WITH(NOLOCK),yp_zd_dict b WITH(NOLOCK)" +
             " left join" +
             "  yp_zd_manufactory m WITH(NOLOCK) on b.manu_code = m.code" +