DashboardsMapper.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package com.dao.dashboard;
  2. import com.model.bo.DashOrder;
  3. import com.model.po.Dashboards;
  4. import com.model.pojo.TestPage;
  5. import org.apache.ibatis.annotations.*;
  6. import org.springframework.stereotype.Repository;
  7. import java.util.List;
  8. @Mapper
  9. @Repository
  10. public interface DashboardsMapper {
  11. /*
  12. 插入
  13. */
  14. @Insert("insert into " +
  15. "bi_dashboards(id, bd_name,bd_note,CONFIGURATION,create_by,create_date, BD_THUMBNAIL,relation_columns, create_id)" +
  16. "values(#{id}, #{bdName},#{bdNote},#{bdConfiguration},#{createBy}," +
  17. "to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'), #{thumbnail},#{relationColumns}, #{createId})")
  18. @SelectKey(before=true,keyProperty="id",resultType=Integer.class,statement="SELECT bi_dashboards_squence.nextval from dual",keyColumn = "id")
  19. void setDashboards(Dashboards dashboards);
  20. /*
  21. 更新
  22. */
  23. @Update("<script>" +
  24. "UPDATE BI_DASHBOARDS set " +
  25. "BD_NAME = #{bdName}" +
  26. "<if test=\"bdNote != null\"> , BD_NOTE = #{bdNote} </if>" +
  27. "<if test=\"bdConfiguration != null\"> , CONFIGURATION = #{bdConfiguration} </if>" +
  28. "<if test=\"thumbnail != null\"> , BD_THUMBNAIL = #{thumbnail} </if>" +
  29. "<if test=\"relationColumns != null\">, relation_columns = #{relationColumns} </if>"+
  30. " ,UPDATE_DATE = to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss') " +
  31. "where id = #{id}" +
  32. "</script>")
  33. void updateDashboards(Dashboards dashboards);
  34. /*
  35. 删除看板
  36. */
  37. @Delete("<script>" +
  38. "delete from BI_DASHBOARDS where id in " +
  39. "("+
  40. "<foreach collection=\"list\" index=\"index\" item=\"item\" separator=\",\">" +
  41. "#{item, jdbcType = NUMERIC}"+
  42. "</foreach>" +
  43. ")"+
  44. "</script>")
  45. void delDashboards(List<Integer> idList);
  46. /*
  47. 查询看板列表
  48. */
  49. @Select("select id, bd_note as bdNote, bd_name as bdName, CONFIGURATION as bdConfiguration, CREATE_BY as createBy, create_id as createId, CREATE_DATE as createDate, BD_THUMBNAIL as thumbnail " +
  50. "from BI_DASHBOARDS where id in " +
  51. " (select bo_da_id from bi_DASHBOARDS_object " +
  52. "where (bo_type = '0' and bo_ob_id in (select br_user_group from bi_user_rel_groups where br_user_id= #{userId})) " +
  53. " or (BO_TYPE='1' and bo_ob_id = #{userId} )) or create_id = #{userId}")
  54. List<Dashboards> getListDashboards(@Param("userId") int userId, TestPage testPage);
  55. /*
  56. 查询看板
  57. */
  58. @Select("select id, bd_note as bdNote, bd_name as bdName, CONFIGURATION as bdConfiguration, CREATE_BY as createBy, create_id as createId, CREATE_DATE as createDate, BD_THUMBNAIL as thumbnail, relation_columns as relationColumns" +
  59. " from BI_DASHBOARDS where (id in " +
  60. " (select bo_da_id from bi_DASHBOARDS_object " +
  61. " where (bo_type = '0' and bo_ob_id in (select br_user_group from bi_user_rel_groups where br_user_id= #{userId}))" +
  62. " or (BO_TYPE='1' and bo_ob_id = #{userId} )) or create_id = #{userId}) and id = #{id}")
  63. Dashboards getDashboards(@Param("userId") int userId, @Param("id") int id);
  64. /*
  65. 看板移交
  66. */
  67. @Update("update BI_DASHBOARDS set create_by = #{createBy}, create_id = #{createId} where id = #{id}")
  68. void changeDashOrder(@Param("createBy") String createBy, @Param("createId") int createId, @Param("id") int id);
  69. /*
  70. 查看看板分发对象类型
  71. */
  72. @Select("select bo_type from bi_dashboards_object where bo_da_id = #{id}")
  73. List<String> getType(int id);
  74. /*
  75. 查看看板分发用户
  76. */
  77. @Select("select bo_ob_id as id, BG_NAME as name from BI_USER_GROUPS left join BI_DASHBOARDS_OBJECT on bo_ob_id = bg_id where bo_type = '0' and bo_da_id = #{id}")
  78. List<DashOrder> getOrderGroupName(int id);
  79. /*
  80. 查看看板分发用户
  81. */
  82. @Select("select bo_ob_id as id, BU_NAME as name from bi_users left join BI_DASHBOARDS_OBJECT on bo_ob_id = bu_id where bo_type = '1' and bo_da_id = #{id}")
  83. List<DashOrder> getOrderName(int id);
  84. /*
  85. 添加看板对象
  86. */
  87. @Insert("insert into bi_dashboards_object(bo_id, bo_da_id, bo_type, bo_ob_id) values" +
  88. "(#{id}, #{daId}, #{objectType}, #{obId})")
  89. @SelectKey(before=true,keyProperty="id",resultType=int.class,statement="SELECT bi_dashboards_object_squence.nextval from dual",keyColumn = "bo_id")
  90. void addObject(@Param("daId") int daId, @Param("objectType") String objectType, @Param("obId") int obId);
  91. /*
  92. 删除对象
  93. */
  94. @Delete("delete from bi_dashboards_object where bo_da_id = #{daId}")
  95. void delObject(int daId);
  96. /*
  97. 获取看板拥有人ID
  98. */
  99. @Select("select create_id from bi_dashboards where id = #{id}")
  100. int getCreateIdById(int id);
  101. }