web_factory_profitratelist.xml 1.5 KB

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