1. @Mapper
    public interface FinancingMapper {
  2.  
  3. @Insert("<script>" +
    "insert into financingproduct values(#{id},#{risk},#{income},#{saleStarting},#{saleEnd},#{end})" +
    "</script>")
    int insertFinancingProduct (String id,int risk,String income,String saleStarting,String saleEnd,String end);
  4.  
  5. @Delete("<script>" +
    "delete from financingproduct where id = #{id}" +
    "</script>")
    int delFinancingProductById (String id);
  6.  
  7. @Update("<script>" +
    "update financingproduct set risk=#{risk},income=#{income},saleStarting=#{saleStarting},saleEnd=#{saleEnd},end=#{end} where id = #{id}" +
    "</script>")
    int updFinancingProductById (int risk,String income,String saleStarting,String saleEnd,String end,String id);
  8.  
  9. @Select("<script>" +
    "select * from financingproduct where id = #{id}" +
    "</script>")
    FinancingProduct getFinancingProductById(@Param("id") String id);
  10.  
  11. @Select("<script>" +
    "select count(1) from financingproduct limit #{offset},#{limit}"
    +
    "</script>")
    long getFinancingProductCount(Integer offset,Integer limit);
  12.  
  13. @Select("<script>" +
    "select * from financingproduct limit #{offset},#{limit}"
    +
    "</script>")
    List<FinancingProduct> getFinancingProductList(Integer offset,Integer limit);
    }
  1.  
  1. @Service
    public class FinancingService {
    @Autowired
    FinancingMapper financingMapper;
  2.  
  3. public FinancingProduct getFinancingProductById(String id){
    return financingMapper.getFinancingProductById(id);
    }
  4.  
  5. public int insertFinancingProduct(String id,int risk,String income,String saleStarting,String saleEnd,String end){
    return financingMapper.insertFinancingProduct(id, risk,income,saleStarting,saleEnd,end);
    }
  6.  
  7. public int delFinancingProductById (String id){
    return financingMapper.delFinancingProductById(id);
    }
  8.  
  9. public int updFinancingProductById (int risk,String income,String saleStarting,String saleEnd,String end,String id){
    return financingMapper.updFinancingProductById(risk,income,saleStarting,saleEnd,end,id);
    }
  10.  
  11. public long getFinancingProductCount(Integer offset,Integer limit){
    return financingMapper.getFinancingProductCount(offset,limit);
    }
  12.  
  13. public List<FinancingProduct> getFinancingProductList(Integer offset,Integer limit){
    return financingMapper.getFinancingProductList(offset,limit);
    }
    }

  1. @Controller

    public class FinancingController {
    @Autowired
    FinancingService financingServiceImpl;
  2.  
  3. @RequestMapping("/insertFinancingProduct")
    @ResponseBody
    public int insertFinancingProduct(HttpServletRequest httpServletRequest, ModelMap modelMap,String id,int risk,String income,String saleStarting,String saleEnd,String end){
    return financingServiceImpl.insertFinancingProduct(id, risk,income+"%",saleStarting,saleEnd,end);
    }
  4.  
  5. @RequestMapping("/delFinancingProductById")
    public String delFinancingProductById(HttpServletRequest httpServletRequest, ModelMap modelMap,String id){
    financingServiceImpl.delFinancingProductById(id);
    return "getFinancingProductList";
    }
  6.  
  7. @RequestMapping("/updFinancingProductById")
    @ResponseBody
    public int updFinancingProductById(HttpServletRequest httpServletRequest, ModelMap modelMap,int risk,String income,String saleStarting,String saleEnd,String end,String id){
    return financingServiceImpl.updFinancingProductById(risk,income+"%",saleStarting,saleEnd,end,id);
    }
  8.  
  9. @RequestMapping("/getFinancingProductById")
    public String getFinancingProductById(HttpServletRequest httpServletRequest, ModelMap modelMap,String id){
    FinancingProduct financingProduct = financingServiceImpl.getFinancingProductById(id);
    modelMap.addAttribute("financingProduct", financingProduct);
    return "index";
    }
  10.  
  11. @RequestMapping("/getFinancingProductList")
    public String getFinancingProductList(HttpServletRequest httpServletRequest, ModelMap modelMap){
    int limit = 3;
    int offset = 0;
    Long total = 0L;
    PageHelper pageHelper = PageHelper.builder();
    offset = (pageHelper.getPageNumFromUrl(httpServletRequest) - 1)*limit; //limit后第一个参数
    total = pageHelper.getTotalFromUrl(httpServletRequest); //limit后最后一个参数
  12.  
  13. //如果total为空,那么查询获取总记录数
    if (total == null) total = financingServiceImpl.getFinancingProductCount(offset,limit);
  14.  
  15. //查询获取数据
    List<FinancingProduct> result = financingServiceImpl.getFinancingProductList(offset,limit);
    String banner = pageHelper.getPageBanner(limit, total, httpServletRequest);
    modelMap.addAttribute("page", banner);
    modelMap.addAttribute("result", result);
    return "index";
    }
  16.  
  17. }
  18.  
  19. utils中的PageHelper
  1. /**
    * 一个基于GET请求进行的分页类,可做适当的设置
    * 使用方法:
    * 默认样式PageHelper.builder()
    * 或者定制样式
    * PageHelper.builder("myid","mytotal",80000L,1000,7)
    * 完整例子:(控制器某方法)
    * public String foo(HttpServletRequest request,ModelMap model,Condition cond){
    * //从con参数进行解析...省略....
    * Integer limit = 20; //每页限制显示20条
    * PageHelper page = PageHelper.builder();
    * Long total = page.getTotalFromUrl(request);
    * if(total ==null){
    * total = service.getTotalFromDb(); //用自己的方法从数据库获取总记录数
    * }
    * Integer pageNum = page.getPageNumFromUrl(request);//得到请求的页码
    * String banner = page.getPageBanner(limit,total,request);//返回生成的分页按钮
    * model.put("pagebanner",banner);//加入模板引擎里
    * List<Object> list = service.getRecords(pageNum * limit,.....);//给出本次查询返回值的offset
    * .....省略
    */
    public class PageHelper {
    //样式属性,可设置
    private String pagetag = "_pgid_";//下一页在url上的name属性名
    private String totaltag = "_totalnums_";//总记录数在url上的name属性名
    private Long switchNumber = 100000L;//总记录数到达这数字,则切换样式(无尾页按钮)
    private Integer bannerWidth = 800;//分页banner的宽度
    private Integer btnNumber = 5;//分页显示的按钮数,需要单数,比如5,7,9
    //一些初始设置值
    private Integer pgid=1;//当前按钮页
    private Integer firstBtn=0;//第一个页按钮
    private Integer lastBtn=0;//最后一个页按钮
    private String baseURL="";//除_total=10000&_pgid=2 之外的uri
    private Integer pages=1; //总分页数
    private Long total=0L;//总记录数
    //省略号样式
    private String points = "style='margin:0;border-style:none;background:none;padding:5px 0px;color:#808080;float:left;'";
    //未选中的页码按钮样式
    private String a_style = "style='box-sizing:border-box;display:block;float:left;margin-right:10px;"
    + "padding:2px 12px;height:30px;line-height:24px;border:1px #cccccc solid;background:#fff;"
    + "text-decoration:none;color:#808080;font-size:12px;'";
    // 禁止使用的样式disable
    private String disable_style = "style='box-sizing:border-box;float:left;padding:2px 12px;height:30px;line-height:24px;font-size:12px;"
    + "color:#bbb;border:1px #ccc solid;background:#fcfcfc;margin:0;margin-right:10px;'";
  2.  
  3. //选中按钮的样式
    private String select_style = "style='box-sizing:border-box;display:block;float:left;margin-right:10px;"
    + "padding:2px 12px;height:30px;line-height:24px;"
    + "text-decoration:none;font-size:12px;border:1px #cccccc solid;background:#077ee3;color:#fff;'";
  4.  
  5. //总分页数和总记录数的样式
    private String total_style ="style='box-sizing:border-box;border-style:none;background:none;font-size:12px;"
    + "margin:0px;height:30px;padding:3px 0px;color:#666;display:block;float:left;line-height:24px;'";
  6.  
  7. //按钮鼠标进入和离开时候的事件属性
    private String mouseEvent = "onmouseenter='nbf_mouseenter(this)' onmouseleave='nbf_mouseleave(this)'";
  8.  
  9. //要执行的鼠标script语句
    private String scripts ="<script type='text/javascript'>"
    + "function nbf_mouseenter(obj){obj.style.color='#077ee3';obj.style.border='1px #077ee3 solid';}"
    + "function nbf_mouseleave(obj){obj.style.color='#808080';obj.style.border='1px #cccccc solid';}</script>";
  10.  
  11. /**
    * 使用默认样式的构建方法
    * @return
    */
    public static PageHelper builder(){
    return new PageHelper();
    }
  12.  
  13. /**
    * 带样式的构建方法
    * @param pagetag 页码的name值(附加在url上)
    * @param totaltag 记录总数的name值(附加在url上)
    * @param switchNumber 总记录数到达该值,则切换样式
    * @param bannerWidth 分页div的宽度
    * @param btnNumber 分页按钮的个数(必须是单数,至少5个)
    * @return 该类的实例
    */
    public static PageHelper builder(String pagetag, String totaltag
    , Long switchNumber, Integer bannerWidth
    , Integer btnNumber){
    return new PageHelper(pagetag,totaltag,switchNumber,bannerWidth,btnNumber);
    }
  14.  
  15. private PageHelper(){}
  16.  
  17. /**
    * 给对象赋样式的自定义值
    * @param pagetag
    * @param totaltag
    * @param switchNumber
    * @param bannerWidth
    * @param btnNumber
    */
    private PageHelper(String pagetag, String totaltag
    , Long switchNumber, Integer bannerWidth
    , Integer btnNumber){
    if(pagetag!=null && pagetag.trim().isEmpty()==false)
    this.pagetag = pagetag;
    if(totaltag!=null && totaltag.trim().isEmpty()==false)
    this.totaltag = totaltag;
    if(switchNumber!=null)
    this.switchNumber = switchNumber;
    if(bannerWidth!=null)
    this.bannerWidth = bannerWidth;
    if(btnNumber!=null)
    this.btnNumber = btnNumber;
    }
  18.  
  19. /**
    * 从url上获取total的总记录值
    * @param request 由控制器透传的httpserverrequest
    * @return Long
    */
    public Long getTotalFromUrl(HttpServletRequest request) {
    String totalTag = request.getParameter(totaltag); //从页面获取总记录数
    if (totalTag != null && totalTag.trim().isEmpty() == false) { //说明已经查询过总数了
    try {
    return Long.valueOf(totalTag); //将String 类型的数字转化为Long类型
    } catch (Exception e) {
    return null; //报错则返回null
    }
  20.  
  21. }
    return null; //如果页面没有传回总记录数那么返回null
    }
  22.  
  23. /**
    * 从url上获取请求的页码数值,最小值是1
    * @param request
    * @return Integer
    */
    public Integer getPageNumFromUrl(HttpServletRequest request) {
    String pgid = request.getParameter(pagetag); //获取请求参数
    if (pgid != null && pgid.trim().isEmpty() == false) { //从url获取请求的页码
    try {
    return Integer.valueOf(pgid); //将String类型的数字转化为数字
    } catch (Exception e) {
    return 1; //如果发生错误,当前页数默认为1
    }
  24.  
  25. }
    return 1; //如果没有从前端页面获取当前页数,默认为1
    }
  26.  
  27. /**
    * 得到一个分页按钮的HTML字符串,可直接嵌入网页内
    * @param limit 每页限制返回的记录数
    * @param total 该查询返回的总记录数(需要提取用count语句获得)
    * @param request 控制器透传的HttpServletRequest
    * @return 分页的html代码(String)
    */
    public String getPageBanner(Integer limit,Long total,HttpServletRequest request){
    if(total<=limit) return "";
    this.total = total;
    String URI = request.getRequestURI();
    pgid = getPageNumFromUrl(request);
  28.  
  29. String params ="";
    Enumeration<String> names = request.getParameterNames();
    while (names.hasMoreElements()){
    String name = names.nextElement();
    if(name.equalsIgnoreCase(pagetag) || name.equalsIgnoreCase(totaltag))
    continue;
    String value = request.getParameter(name);
    params+=name+"="+value+"&";
    }
    //params=params.substring(0,params.lastIndexOf("&"));
    baseURL=URI+"?"+params;
    pages =(int)Math.ceil(((double)total / (double)limit));//计算出总分页数
    Integer baseBtnNum = (int)Math.floor((double)(btnNumber/2));//计算当前按钮两边的按钮数
    //第一个页按钮
    firstBtn = pgid - baseBtnNum;
    //最后一个页按钮
    lastBtn = pgid + baseBtnNum;
    if(firstBtn<1){
    lastBtn=lastBtn+(1-firstBtn);
    firstBtn=1;
    }
    if(lastBtn>pages){
    firstBtn = firstBtn - (lastBtn-pages);
    lastBtn = pages;
    }
    if (firstBtn<1)
    firstBtn=1;
  30.  
  31. //开始构建banner的html代码
    String Banner ="<div class='nbf_pageslice' "+buildBanner()+ ">"
    + buildHome()
    + buildPreBtn();
    if(total>0){
    Banner+=buildBtns();
    }
    Banner+=buildNextBtn();
    if(total>0 && total<switchNumber){
    Banner+=buildTail();
    }
    Banner+=buildTotalPage();
    Banner+=scripts;
    Banner+="<div style='clear:both'></div></div>";
    return Banner;
    }
  32.  
  33. private String buildUrl(Integer pgid){
    String newUri = baseURL+totaltag+"="+total+"&"+pagetag+"="+pgid;
  34.  
  35. return newUri;
    }
  36.  
  37. /**
    * 构建首页
    * @return
    */
    private String buildHome(){
    if(pgid!=1){
    String URI = buildUrl(1);
    return "<a class='enable_btn' "+mouseEvent+" "+ a_style+" href='"+URI+"' title='首页'>首页</a>";
    }else{
    return "<p class='nbf_p_style' "+disable_style+">首页</p>";
    }
    }
  38.  
  39. /**
    * 构建尾页
    * @return
    */
    private String buildTail(){
    if (pgid != pages) {
    String URI = buildUrl(pages);
    return "<a class='enable_btn'"+mouseEvent+" "+a_style+" href='"+URI+"' title='尾页'>尾页</a>";
    } else {
    return "<p class='nbf_p_style' "+disable_style+">尾页</p>";
    }
    }
  40.  
  41. /**
    * 构建整个banner的样式
    * @return
    */
    private String buildBanner(){
    return "style='width:"+ bannerWidth +"px;margin-left:auto;margin-right:auto;height:40px;padding:20px 0px;'";
    }
  42.  
  43. /**
    * 构建上一页按钮
    * @return
    */
    private String buildPreBtn(){
    if (pgid != 1) {
    String URI = buildUrl(pgid - 1);
    return "<a class='enable_btn' "+mouseEvent+" "+a_style+" href='"+URI+"' title='上一页'>上一页</a>";
    } else {
    return "<p class='nbf_p_style' "+disable_style+">上一页</p>";
    }
    }
  44.  
  45. /**
    * 构建下一页按钮
    * @return
    */
    private String buildNextBtn(){
    if (pgid != pages) {
    String URI = buildUrl(pgid + 1);
    return "<a class='enable_btn'"+mouseEvent+" "+a_style+" href='"+URI+"' title='下一页'>下一页</a>";
    } else {
    return"<p class='nbf_p_style' "+disable_style+">下一页</p>";
    }
    }
  46.  
  47. /**
    * 构建中间的所有页按钮
    * @return
    */
    private String buildBtns(){
    String btns="";
    if(firstBtn>1){
    btns="<p class='nbf_p_style' "+points+">...</p>";
    }
    for(int i=firstBtn;i<=lastBtn;i++){
    if(i==pgid){
    btns+="<a class='disable_btn' "+select_style+" href='javascript:;' title='第" + i + "页' >"+i+"</a>";
    }else{
    String URI = buildUrl(i);
    btns+="<a class='enable_btn' "+mouseEvent+" "+a_style+" href='"+URI+"' title='第" +i+ "页'>"+i+"</a>";
    }
    }
    if(lastBtn<pages){
    btns+="<p class='nbf_p_style' "+points+">...</p>";
    }
    return btns;
    }
  48.  
  49. private String buildTotalPage(){
    return "<p class='nbf_p_style' "+total_style+" >共<span style='color:red;'> " + pages
    +" </span>页<span style='color:red;'> " + total + " </span>条数据</p>";
    }
  50.  
  51. }
  1.  
  2. index.html页面中的内容
  1. <script src="${request.contextPath}/static/dist/jquery.js"></script>
    <body>
  2.  
  3. <div class="x-body lay-change-page">
    <div class="layui-card">
    <div class="layui-card-body">
    <table class="layui-table">
    <thead>
    <tr>
    <th>ID</th>
    <th>风险评级</th>
    <th>预期收益</th>
    <th>发售起始日</th>
    <th>发售结束日</th>
    <th>产品到期日</th>
    <th style="min-width:150px">操作</th>
    </tr>
    </thead>
    <tbody>
    <#if result??>
    <#list result as list>
    <tr>
    <td>${list.id}</td>
    <td>${list.risk!}</td>
    <td>${list.income!}</td>
    <td>
    <#if list.saleStarting??>
    ${list.saleStarting?string('yyyy-MM-dd hh:mm:ss')}
    </#if>
    </td>
    <td>
    <#if list.saleEnd??>
    ${list.saleEnd?string('yyyy-MM-dd hh:mm:ss')}
    </#if>
    </td>
    <td>
    <#if list.end??>
    ${list.end?string('yyyy-MM-dd hh:mm:ss')}
    </#if>
    </td>
    <td class="td-manage">
    <a title="删除" href="${request.contextPath}/delFinancingProductById?id=${list.id}"
    class="a-link" ><!--onclick="delFinancingById(${list.id})"-->
    删除
    </a>
    <a title="修改" href="javascript:;"
    class="a-link" onclick="OpenLayer('edit?id=${list.id}',['700px','80%'])">
    修改
    </a>
    |
    <a class="a-link" title="通过" href="javascript:;"
    onclick="audit(${list.id})"> <!--OpenFrame('停用','${request.contextPath}/search/pass?id=${list.id}',['确定','取消'],'.commit',['800px','400px'])-->
    通过
    </a>
    </td>
    </tr>
    </#list>
    </#if>
    </tbody>
    </table>
    </div>
    </div>
    <#if page??>${page}</#if>
    </div>
  4.  
  5. <script>
  6.  
  7. /*function delFinancingById(id) {
    alert(id);
    $.ajax({
    url:'delFinancingProductById',
    type:'GET',
    dataType:'text',
    data:{id:id},
    success:function (msg) {
    alert(id);
    alert(msg);
    alert("删除成功!");
    }
    })
    }*/
    </script>
    </body>
  1. application.yml
  1. server:
    port: 8083
    spring:
    profiles:
    active: dev
    mvc:
    static-path-pattern: /static/**
  2.  
  3. ---
    spring:
    profiles: release
    datasource:
    url: jdbc:mysql://192.168.10.5:3306/keyword?useSSL=false
    password: xcm123
    username: client
    resources:
    static-locations:
    - file:/keywords/
    - file:/keywords/static/
    freemarker:
    cache: false
    charset: utf-8
    allow-request-override: false
    check-template-location: true
    content-type: text/html
    expose-request-attributes: true
    expose-session-attributes: true
    suffix: .html
    template-loader-path: file:/keywords/templates/
    request-context-attribute: request
  4.  
  5. ---
    spring:
  6.  
  7. profiles: dev
    datasource:
    # url: jdbc:mysql://10.0.0.191/keyword?useUnicode=true&characterEncoding=utf-8&useSSL=false
    # password: xcM@12345
    # username: client
    url: jdbc:mysql://127.0.0.1/licai?useUnicode=true&characterEncoding=utf-8&useSSL=false
    password: root
    username: root
    freemarker:
    cache: false
    charset: utf-8
    allow-request-override: false
    check-template-location: true
    content-type: text/html
    expose-request-attributes: true
    expose-session-attributes: true
    suffix: .html
    template-loader-path: classpath:/templates/
    request-context-attribute: request
  8.  
  9. logging:
    level:
    com.hstt.antiweb.mapper.*: debug
  10.  
  11. pom.xml
  1. <dependencies>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-freemarker</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.0.0</version>
    </dependency>
    <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
    </dependency>
    <dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-collections4</artifactId>
    <version>4.0</version>
    </dependency>
    <dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.4</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
    <dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
    <version>1.10</version>
    </dependency>
  2.  
  3. <dependency>
    <groupId>com.aliyun.oss</groupId>
    <artifactId>aliyun-sdk-oss</artifactId>
    <version>2.5.0</version>
  4.  
  5. </dependency>
  6.  
  7. <dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
    </dependency>
  8.  
  9. <dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    </dependency>
  10.  
  11. <dependency>
    <groupId>com.google.collections</groupId>
    <artifactId>google-collections</artifactId>
    <version>1.0-rc2</version>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    </dependency>
    </dependencies>
  1.  
  1.  

springboot例子的更多相关文章

  1. mybatis-spring-boot-starter 1.3.0 操作实体类的SpringBoot例子

    例程下载:https://files.cnblogs.com/files/xiandedanteng/gatling20200428-02.zip 需求:使用mybatis实现对hy_emp表的CRU ...

  2. 用IntelliJ IDEA搭建第一个SpringBoot例子

    前言:最近把IntelliJ IDEA弄好了,也偶然接触到了springboot这个新的微服务框架.发现这个框架简单但也有一些不足.听说springboot可以在140个字符内发布一个web应用.所以 ...

  3. 一个简单SpringBoot例子

    一:为什么使用springBoot: 有利于开发(整合框架,例如整合了springMVC,Mybatis等框架); 启动无需配置tomcat(java应用程序运行,实际以jar包运行),内置tomca ...

  4. Duboo整合SpringBoot超级详细例子(附源码)

    dubbo3.0整合SpringBoot例子 dubbo新版本(3.0以上)在相对于 dubbo 旧版本(2.5.2.6.2.7),有很多的不相同的地方. 官方文档也说了新版本的特性: https:/ ...

  5. springboot学习目录

    1.spring boot 简单示例 一个简单的springboot 例子  https://www.cnblogs.com/shoshana-kong/p/9641696.html 2. sprin ...

  6. SpringBoot 2.0 编程方式配置,不使用默认配置方式

    SpringBoot的一般配置是直接使用application.properties或者application.yml,因为SpringBoot会读取.perperties和yml文件来覆盖默认配置: ...

  7. Springboot中WebMvcConfigurer接口详解

    Springboot 使用越来越多,企业的基本框架,到Springcloud分布式,可以说无论面试还是平常技术学习,一说到spring几乎就就代替了Java,可以说spring,springboot的 ...

  8. java-框架-索引

    spring 整体了解 spring 入门demo Spring整体了解 spring梳理 Spring线程池的5个要素 spring的事务隔离级别以及传播性 事务4个隔离界别及脏读,不可重复读,幻读 ...

  9. RabbitMQ不讲武德,发个消息也这么多花招

    前言 本篇博客已被收录GitHub:https://zhouwenxing.github.io/ 文中所涉及的源码也已被收录GitHub:https://github.com/zhouwenxing/ ...

随机推荐

  1. MP4转mp3

    python实现: 依赖: glob,pydub "Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not wo ...

  2. 剑指offer面试题30.包含min函数的栈

    一开始写的垃圾代码,push和pop都是O(N) class Solution { public: vector<int> vec; int min_val=INT_MAX,min_cnt ...

  3. 普及C组第二题(8.5)

    1565. [GDKOI]神秘山庄 (Standard IO) 时间限制: 1000 ms  空间限制: 262144 KB 题目: 翠亨村是一个神秘的山庄,并不是因为它孕育了伟人孙中山,更神秘的是山 ...

  4. 类欧几里得模板 p5170

    //类欧几里得的模板题 p5170 //求这三个式子: //第一个跟后两个没关联 //后两个跟其余两个都有关联: #include<cstdio> #include<algorith ...

  5. 第一struts2程序

    今天学习了第一个struts2程序 第一步建立一个java web程序 第二步 加入jar包 第三步 添加两个jsp文件 login.jsp和result.jsp文件 login.jsp 在body部 ...

  6. PHP获取用户的真实IP地址,非代理IP

    function getClientIP(){ global $ip; if(getenv("HTTP_CLIENT_IP")){ $ip = getenv("HTTP_ ...

  7. 【10】DP青蛙跳台阶

    一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶.求该青蛙跳上一个 n 级的台阶总共有多少种跳法. 答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1 ...

  8. 【C语言】(指针) 将两个数排序

    原理就不讲了,这里用来理解指针的使用方法 代码1: #include <stdio.h> int main() { int a, b;/* 实际变量的声明 */ int* p, * q;/ ...

  9. C语言字符串类型转换为double浮点数类型

    #include <stdio.h>#include <stdlib.h>char *record; double re = atof(record); 使用 atof()函数 ...

  10. RedHat7.0 网络源的配置

    RedHat7.0 yum源的配置 写这篇随笔的目的 为了记录自己的操作,能够为以后的再次配置提供参考 因为网上的教程都有些年代了,为了方便其他同学方便配置 提高下自己的写作水平 参考资料 RedHa ...