web_factory_profitratelist.xml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <select>
  3. <selectstr>
  4. SELECT ISNULL(u_factory_profitrate.deptid, v_temp_1.deptid) AS deptid
  5. ,ISNULL(u_factory_profitrate.bednet_or_mattress, @kind) AS bednet_or_mattress
  6. ,ISNULL(u_factory_profitrate.bednettypeid_mattresstypeid, v_temp_1.bednettypeid) AS bednettypeid_mattresstypeid
  7. ,ISNULL(u_factory_profitrate.profitrate, 0) AS profitrate
  8. ,u_factory_profitrate.createtime
  9. ,u_factory_profitrate.createby
  10. ,v_temp_1.deptname
  11. ,v_temp_1.typename
  12. FROM u_factory_profitrate
  13. INNER JOIN (
  14. SELECT u_dept.deptid
  15. ,v_temp.bednettypeid
  16. ,u_dept.deptname
  17. ,v_temp.typename
  18. FROM u_dept
  19. INNER JOIN (
  20. SELECT 1 AS kind
  21. ,u_mattress_type.mattresstypeid AS bednettypeid
  22. ,u_mattress_type.typename
  23. FROM u_mattress_type
  24. UNION ALL
  25. SELECT 0 AS kind
  26. ,u_bednet_type.bednettypeid
  27. ,u_bednet_type.typename
  28. FROM u_bednet_type
  29. ) v_temp ON @kind = v_temp.kind
  30. ) v_temp_1 ON u_factory_profitrate.deptid = v_temp_1.deptid
  31. AND u_factory_profitrate.bednettypeid_mattresstypeid = v_temp_1.bednettypeid
  32. </selectstr>
  33. <where>
  34. <when>
  35. ISNULL(u_factory_profitrate.bednet_or_mattress,@kind) = @kind
  36. </when>
  37. <when notnull="@arg_deptid">
  38. u_factory_profitrate.deptid = @arg_deptid
  39. </when>
  40. <when notnull="@arg_bednettypeid_mattresstypeid">
  41. u_factory_profitrate.bednettypeid_mattresstypeid = @arg_bednettypeid_mattresstypeid
  42. </when>
  43. </where>
  44. <orderstr>
  45. </orderstr>
  46. <displayfields>
  47. </displayfields>
  48. </select>