ChartsConfigMapper.java 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package com.dao;
  2. import com.model.po.ChartConfig;
  3. import com.model.po.ChartConfigList;
  4. import org.apache.ibatis.annotations.*;
  5. import org.springframework.stereotype.Repository;
  6. import java.util.List;
  7. @Mapper
  8. @Repository
  9. public interface ChartsConfigMapper {
  10. @Insert("insert into bi_charts(CHART_NAME,CHART_TYPE,BD_DATA_ID,CHART_CONFIG,GROUP_BY,ACCESS_AUTHORITY,UPDATE_AUTHORITY,CHART_DESCRIBES,is_legend,is_tooltip,is_datazoom,is_toolbox,create_by,create_date) " +
  11. "VALUES (#{chartName},#{chartType}, #{dataId}, #{chartConfig}, #{groupBy}, #{accessAuthority}, #{updateAuthority}, #{describes},#{isLegend},#{isTooltip}, #{isDatazoom}, #{isToolbox}, #{createBy},to_date(#{createDate},'YYYY-MM-DD hh24:mi:ss'))")
  12. void insertCharts(ChartConfig chartConfig);
  13. @Delete("<script>" +
  14. "delete from bi_charts where id in " +
  15. "("+
  16. "<foreach collection=\"list\" index=\"index\" item=\"item\" separator=\",\">" +
  17. "#{item, jdbcType = NUMERIC}"+
  18. "</foreach>" +
  19. ")"+
  20. "</script>")
  21. void deleteCharts(List<Integer> idList);
  22. @Select("select id as chartId, chart_name as chartName, chart_type as chartType, create_by as createBy, create_date as createDate" +
  23. ",bc_filters as filters, BD_DATA_ID as dataId, bc_table_name as tableName, CHART_CONFIG as chartConfig, GROUP_BY as groupBy," +
  24. "ACCESS_AUTHORITY as accessAuthority, UPDATE_AUTHORITY as updateAuthority, CHART_DESCRIBES as describes, IS_LEGEND as isLegend," +
  25. "IS_TOOLTIP as isTooltip, IS_DATAZOOM as isDatazoom, IS_TOOLBOX as isToolbox, BC_FILTERS as filters " +
  26. " from bi_charts where id = #{id}")
  27. ChartConfig getOneChart(int id);
  28. @Select("select id as chartId, chart_name as chartName, chart_type as chartType, create_by as createBy, create_date as createDate" +
  29. ",bc_filters as filters from bi_charts")
  30. List<ChartConfigList> getListCharts();
  31. /*
  32. 更新图表配置
  33. */
  34. @Update("<script>" +
  35. "UPDATE bi_charts set " +
  36. "CHART_NAME = #{chartName}" +
  37. "<if test=\"chartType != null\"> , CHART_TYPE = #{chartType} </if>" +
  38. "<if test=\"createBy != null\"> , CREATE_BY = #{createBy} </if>" +
  39. "<if test=\"groupBy != null\"> , GROUP_BY = #{groupBy} </if>" +
  40. "<if test=\"chartConfig != null\"> , CHART_CONFIG = #{chartConfig} </if>" +
  41. // "<if test=\"chartDescribes != null\"> , CHART_DESCRIBES = #{chartDescribes} </if>" +
  42. "<if test=\"filters != null\"> , BC_FILTERS = #{filters} </if>" +
  43. "<if test=\"accessAuthority != null\"> , ACCESS_AUTHORITY = #{accessAuthority} </if>" +
  44. "<if test=\"updateAuthority != null\"> , UPDATE_AUTHORITY = #{updateAuthority} </if>" +
  45. "<if test=\"isDatazoom != null\"> , IS_DATAZOOM = #{isDatazoom} </if>" +
  46. "<if test=\"isLegend != null\"> , IS_LEGEND = #{isLegend} </if>" +
  47. "<if test=\"isToolbox != null\"> , IS_TOOLBOX = #{isToolbox} </if>" +
  48. "<if test=\"isTooltip != null\"> , IS_TOOLTIP = #{isTooltip} </if>" +
  49. "<if test=\"updateDate != null\"> , UPDATE_DATE = to_date(#{updateDate},'YYYY-MM-DD hh24:mi:ss') </if>" +
  50. "where id = #{chartId}" +
  51. "</script>")
  52. void updateChartConfig(ChartConfig chartConfig);
  53. }