JBOSS 点滴

丰丰的博客

2017年10月17日 #

mysql5.x忘记密码

参考:https://blog.csdn.net/qq_34102150/article/details/126120056


1、停止MySQL服务,输入 net stop mysql 停止服务。
2、切换到MySQL的bin文件下,
    mysql5.x:  mysqld --console --skip-grant-tables --shared-memory

mysqld --console --skip-grant-tables --shared-memory
3、输入mysql -uroot -p回车,不用输入密码,直接按回车跳过,
    输入:  use mysql 
    输入:  update user set password=PASSWORD('123456') where USER='root';
    或者:   GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
    输入:  FLUSH PRIVILEGES;
4、重启服务

posted @ 2024-02-17 15:09 半导体 阅读(15) | 评论 (0)编辑 收藏

微信小程序开发流程

准备工作:
    需要https的域名
    1、域名申请、备案   (我是在阿里云买的服务器,域名也在阿里云购买  )
    2、域名与IP绑定 
    3、ssl安全证书 申请(https
    4、下载ssl安全证书布署在tomcat服务器
    4、在云服务器tomcat中布署https           
           参考   https://blog.csdn.net/qq_35206244/article/details/97613498

          ps:任何操作不会,直接打阿里云客服电话 95187
    
小程序开发流程:
    1、在微信官网注册帐号
    2、下载小程序开发工具
    3、小程序开发、上传   
    4、小程序送审,审核通过即可分享给你的朋友

posted @ 2020-08-08 10:11 半导体 阅读(98) | 评论 (0)编辑 收藏

mall 工程创建踩坑

新建项目坑 
www.macrozheng.com项目,打开maven总是引入失败,后来
https://www.cnblogs.com/dk1024/p/10778841.html


https://blog.csdn.net/ken_ding/article/details/85623092这个是前端有可能遇见的坑的解决办法


 安装环境文档:
http://www.macrozheng.com/#/deploy/mall_deploy_windows

posted @ 2020-07-20 21:52 半导体 阅读(100) | 评论 (0)编辑 收藏

springboot 打包 后,在dos命令行运行提示没有主清单属性的解决办法

1.在pom.xml文件中插入
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
2.双击IDEA右侧Maven Projects的lifecycle下的package,打包成jar,重新执行以上命令。

posted @ 2020-06-27 16:42 半导体 阅读(188) | 评论 (0)编辑 收藏

MyBatis出现org.apache.ibatis.executor.ExecutorException异常

DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- Opening JDBC Connection
DEBUG [main] 
- Created connection 29011566.
DEBUG [main] 
- Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@1baae6e]
DEBUG [main] 
- ==>  Preparing: select * from user where username like concat(?,'%') 
DEBUG [main] - ==> Parameters: 张(String)

org.apache.ibatis.exceptions.PersistenceException: 
### 
Error querying database.  Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'username' from result set.  Cause: java.sql.SQLException: Cannot convert value '张三' from column 2 to TIMESTAMP.
### The error may exist in sqlmap/User.xml
### The 
error may involve test.findUserByName3
### The 
error occurred while handling results
### SQL: 
select * from user where username like concat(?,'%')
### Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'username' from result set.  Cause: java.sql.SQLException: Cannot convert value '张三' from column 2 to TIMESTAMP.

    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:
30)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
149)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
140)
    at com.swjd.test.B.test2(B.java:
40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
    at java.lang.reflect.Method.invoke(Method.java:
497)
    at org.junit.runners.model.FrameworkMethod$
1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:
17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:
325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
57)
    at org.junit.runners.ParentRunner$
3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$
1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:
288)
    at org.junit.runners.ParentRunner.access$
000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$
2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:
363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:
137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:
68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:
47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:
242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:
70)
Caused by: org.apache.ibatis.executor.result.ResultMapException: 
Error attempting to get column 'username' from result set.  Cause: java.sql.SQLException: Cannot convert value '张三' from column 2 to TIMESTAMP.
    at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:83)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createUsingConstructor(DefaultResultSetHandler.java:
671)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createByConstructorSignature(DefaultResultSetHandler.java:
654)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:
618)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:
591)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:
397)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:
354)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:
328)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:
301)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:
194)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:
65)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:
79)
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:
63)
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:
324)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:
156)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:
109)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:
83)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
147)
     
24 more
Caused by: java.sql.SQLException: Cannot convert value 
'张三' from column 2 to TIMESTAMP.
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
956)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
926)
    at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:
1328)
    at com.mysql.jdbc.ByteArrayRow.getTimestampFast(ByteArrayRow.java:
124)
    at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:
6669)
    at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:
5988)
    at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:
6026)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
    at java.lang.reflect.Method.invoke(Method.java:
497)
    at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:
69)
    at com.sun.proxy.$Proxy6.getTimestamp(Unknown Source)
    at org.apache.ibatis.type.DateTypeHandler.getNullableResult(DateTypeHandler.java:
39)
    at org.apache.ibatis.type.DateTypeHandler.getNullableResult(DateTypeHandler.java:
28)
    at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:
81)
     
41 more
Caused by: java.lang.NumberFormatException: 张三
    at com.mysql.jdbc.StringUtils.getInt(StringUtils.java:
756)
    at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:
1253)
     
54 more


Process finished 
with exit code -1

上网找了一些答案也没有解决我的问题,

后来发现原来是User类的构造函数问题,找不到相关的构造函数;试着在User中加一个默认的构造函数,就解决了。。。

希望能帮到大家。

         默认的构造函数在创建构造函数后,不会自动创建默认构造函数

DEBUG [main] 
- Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- PooledDataSource forcefully closed/removed all connections.
DEBUG [main] 
- Opening JDBC Connection
DEBUG [main] 
- Created connection 27155935.
DEBUG [main] 
- Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@19e5ddf]
DEBUG [main] 
- ==>  Preparing: select * from user where id=
DEBUG [main] 
- ==> Parameters: 27(Integer)

org.apache.ibatis.exceptions.PersistenceException: 
### 
Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class com.swjd.po.User with invalid types () or values (). Cause: java.lang.NoSuchMethodException: com.swjd.po.User.<init>()
### The 
error may exist in sqlmap/User.xml
### The 
error may involve test.findUserById-Inline
### The 
error occurred while setting parameters
### SQL: 
select * from user where id=?
### Cause: org.apache.ibatis.reflection.ReflectionException: 
Error instantiating class com.swjd.po.User with invalid types () or values (). Cause: java.lang.NoSuchMethodException: com.swjd.po.User.<init>()

    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:
26)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
111)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
102)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:
66)
    at com.test.Test1.test1(Test1.java:
31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
    at java.lang.reflect.Method.invoke(Method.java:
497)
    at org.junit.runners.model.FrameworkMethod$
1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:
17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:
325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
57)
    at org.junit.runners.ParentRunner$
3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$
1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:
288)
    at org.junit.runners.ParentRunner.access$
000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$
2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:
363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:
137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:
68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:
47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:
242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:
70)
Caused by: org.apache.ibatis.reflection.ReflectionException: 
Error instantiating class com.swjd.po.User with invalid types () or values (). Cause: java.lang.NoSuchMethodException: com.swjd.po.User.<init>()
    at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:
86)
    at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:
48)
    at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:
41)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:
528)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:
507)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:
331)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:
291)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:
266)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:
236)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:
150)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:
60)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:
73)
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:
60)
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:
267)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:
137)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:
96)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:
77)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
108)
     
25 more
Caused by: java.lang.NoSuchMethodException: com.swjd.po.User.
<init>()
    at java.lang.Class.getConstructor0(Class.java:
3082)
    at java.lang.Class.getDeclaredConstructor(Class.java:
2178)
    at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:
60)
     
42 more


Process finished 
with exit code -1


  

这种错也是同样的问题,


加上无参构造函数就可以了。


当创建对象来接受sql结果时会遍历实体类的构造方法找到与之匹配的,如果实体类中有构造方法了但是参数不匹配的话就会报上述错误,此时添加无参构造方法(默认的构造方法),会走其他方法,
https://blog.csdn.net/qq_35975416/article/details/80488267




posted @ 2020-03-25 20:01 半导体 阅读(5362) | 评论 (0)编辑 收藏

idea jsp代码不提示Java代码

在<head>里写java代码有提示,在<body>里不写%>就有提示。

这是由于按提示快捷键alt+enter导致。解决方法一直未找到合适的。 
解决方法:

posted @ 2020-03-08 20:11 半导体 阅读(222) | 评论 (0)编辑 收藏

项目管理推荐好文

挣值管理(PV、EV、AC、SV、CV、SPI、CPI)记忆之我见 http://www.cnitpm.com/pm/7707.html https://blog.csdn.net/weixin_38197294/article/details/79852129

posted @ 2020-03-08 11:41 半导体 阅读(102) | 评论 (0)编辑 收藏

jquery传参及获取方式

html写法
<form id="myform">
<input type="radio" value="1" name="gender">
<input type="radio" value="2" name="gender">
<input type="text" name="username" />
<input type="button" value="提交" onclick="fun()"/>
</form>
<div id="myText"></div>



获取值方式一
    <script src="js/jquery-3.3.1.min.js"></script>
    
<script>
        
//定义方法
        function fun(){
           alert($('#myform').serialize());
            
//使用ajax发送异步请求
              $.post("ajaxServletH",$('#myform').serialize(),function(data){
                  
var divA = document.getElementById("myText");
                  divA.innerHTML 
= "<br/><hr><br/>"+data;
               },
"text")
        }
    
</script>
获取值方式二:

var gender = $ ("input [name= 'gender' ] : checked") .val() ;

posted @ 2020-02-08 18:36 半导体 阅读(143) | 评论 (0)编辑 收藏

spring boot结合thymeleaf通过后台传入的数值循环生成标签

spring boot结合thymeleaf通过后台传入的数值循环生成标签

 <span th:each="i:${#numbers.sequence(1,page.pages)}">
   
<span th:text="${i}"/>
</span>

posted @ 2019-10-16 16:06 半导体 阅读(315) | 评论 (0)编辑 收藏

模态框传值

模态框传值:
https://blog.csdn.net/linhaiyun_ytdx/article/details/77417702

posted @ 2019-10-12 16:35 半导体 阅读(136) | 评论 (0)编辑 收藏

Bootstrap 模态框 + iframe > 打开子页面 > 数据传输/关闭模态框

     摘要: 父页面bootstrap模态框: <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" > <div class="modal-dialog modal-lg"> ...  阅读全文

posted @ 2019-05-28 21:23 半导体 阅读(320) | 评论 (0)编辑 收藏

mybatis学习之路----mysql批量新增数据

来源:
https://blog.csdn.net/xu1916659422/article/details/77971867
 
   mysql新增语句 
    insert into 表名(字段,字段。。。) values ( 值,值 。。。);此种适合单条插入。
批量插入,
   一种可以在代码中循环着执行上面的语句,但是这种效率太差,下面会有对比,看看它有多差。
另一种,可以用mysql支持的批量插入语句,
insert into
     表名(字段,字段。。。) values ( 值,值 。。。),( 值,值 。。。),( 值,值 。。。)....
这种方式相比起来,更高效。
实现过程mapper.xml
 

    <!-- 跟普通的insert没有什么不同的地方 ,主要用来跟下面的批量插入做对比。-->
    <insert id="insert" parameterType="com.soft.mybatis.model.Customer">
        <!-- 跟自增主键方式相比,这里的不同之处只有两点
                    1  insert语句需要写id字段了,并且 values里面也不能省略
                    2 selectKey 的order属性需要写成BEFORE 因为这样才能将生成的uuid主键放入到model中,
                    这样后面的insert的values里面的id才不会获取为空
              跟自增主键相比就这点区别,当然了这里的获取主键id的方式为 select uuid()
              当然也可以另写别生成函数。-->
        <selectKey keyProperty="id" order="BEFORE" resultType="String">
            select uuid()
        </selectKey>
        insert into t_customer (id,c_name,c_sex,c_ceroNo,c_ceroType,c_age)
        values (#{id},#{name},#{sex},#{ceroNo},#{ceroType},#{age})
    </insert>
 
    <!-- 批量插入, -->
    <insert id="batchInsert" parameterType="java.util.Map">
        <!-- 这里只做演示用,真正项目中不会写的这么简单。 -->
        insert into
          t_customer (id,c_name,c_sex,c_ceroNo,c_ceroType,c_age)
        values
        <!-- foreach mybatis循环集合用的
              collection="list" 接收的map集合中的key 用以循环key对应的属性
                 separator=","  表示每次循环完毕,在sql后面放一个逗号
                 item="cus" 每次循环的实体对象 名称随意-->
        <foreach collection="list" separator="," item="cus">
            <!-- 组装values对象,因为这张表的主键为非自增主键,所以这里 (select uuid()) 用于生成id的值-->
            ((select uuid()),#{cus.name},#{cus.sex},#{cus.ceroNo},#{cus.ceroType},#{cus.age})
        </foreach>
    </insert>
实体model对象

package com.soft.mybatis.model;

 

/**

 * Created by xuweiwei on 2017/9/10.

 */

public class Customer {

 

    private String id;

    private String name;

    private Integer age;

    private Integer sex;

    private String ceroNo;

    private Integer ceroType;

 

    public String getId() {

        return id;

    }

 

    public void setId(String id) {

        this.id = id;

    }

 

    public String getName() {

        return name;

    }

 

    public void setName(String name) {

        this.name = name;

    }

 

    public Integer getAge() {

        return age;

    }

 

    public void setAge(Integer age) {

        this.age = age;

    }

 

    public Integer getSex() {

        return sex;

    }

 

    public void setSex(Integer sex) {

        this.sex = sex;

    }

 

    public String getCeroNo() {

        return ceroNo;

    }

 

    public void setCeroNo(String ceroNo) {

        this.ceroNo = ceroNo;

    }

 

    public Integer getCeroType() {

        return ceroType;

    }

 

    public void setCeroType(Integer ceroType) {

        this.ceroType = ceroType;

    }

 

    @Override

    public String toString() {

        return "Customer{" +

                "id='" + id + '\'' +

                ", name='" + name + '\'' +

                ", age=" + age +

                ", sex=" + sex +

                ", ceroNo='" + ceroNo + '\'' +

                ", ceroType='" + ceroType + '\'' +

                '}';

    }

}
接口
  1. int add(Customer customer);
  2.     int batchInsert(Map<String,Object> param);

    实现
实现

   
/**

     * 新增数据

     * 
@param customer

     * 
@return

     
*/

    
public int add(Customer customer) {

        
return insert("customer.insert", customer);

    }

 

    
/**

     * 批量插入数据

     * 
@param param

     * 
@return

     
*/

    
public int batchInsert(Map<String,Object> param) {

        
return insert("customer.batchInsert", param);

    }

 

    
/**

     * 公共部分

     * 
@param statementId

     * 
@param obj

     * 
@return

     
*/

    
private int insert(String statementId, Object obj){

        SqlSession sqlSession 
= null;

        
try {

            sqlSession 
= SqlsessionUtil.getSqlSession();

            
int key =  sqlSession.insert(statementId, obj);

            
// commit

            sqlSession.commit();

            
return key;

        } 
catch (Exception e) {

            sqlSession.rollback();

            e.printStackTrace();

        } 
finally {

            SqlsessionUtil.closeSession(sqlSession);

        }

        
return 0;

    }

posted @ 2019-05-23 11:29 半导体 阅读(120) | 评论 (0)编辑 收藏

springboot中树形结构的开发

POM中引入
        <!--JSON树形结构 转换-->
        
<dependency>
            
<groupId>net.sf.json-lib</groupId>
            
<artifactId>json-lib</artifactId>
            
<version>2.4</version>
            
<classifier>jdk15</classifier>
        
</dependency>
实体类创建
import net.sf.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

/**
 * 构造目录JSON树
 * Created by   network on 2019/5/22
 
*/
public class TreeBuilder {

    List
<Node> nodes = new ArrayList<>();

    
public String buildTree(List<Node> nodes) {

        TreeBuilder treeBuilder 
= new TreeBuilder(nodes);

        
return treeBuilder.buildJSONTree();
    }

    
public TreeBuilder() {
    }

    
public TreeBuilder(List<Node> nodes) {
        
super();
        
this.nodes = nodes;
    }

    
// 构建JSON树形结构
    public String buildJSONTree() {
        List
<Node> nodeTree = buildTree();
        JSONArray jsonArray 
= JSONArray.fromObject(nodeTree);
        
return jsonArray.toString();
    }

    
// 构建树形结构
    public List<Node> buildTree() {
        List
<Node> treeNodes = new ArrayList<>();
        List
<Node> rootNodes = getRootNodes();
        
for (Node rootNode : rootNodes) {
            buildChildNodes(rootNode);
            treeNodes.add(rootNode);
        }
        
return treeNodes;
    }

    
// 递归子节点
    public void buildChildNodes(Node node) {
        List
<Node> children = getChildNodes(node);
        
if (!children.isEmpty()) {
            
for (Node child : children) {
                buildChildNodes(child);
            }
            node.setChildren(children);
        }
    }

    
// 获取父节点下所有的子节点
    public List<Node> getChildNodes(Node pnode) {
        List
<Node> childNodes = new ArrayList<>();
        
for (Node n : nodes) {
            
if (pnode.getId().equals(n.getPid())) {
                childNodes.add(n);
            }
        }
        
return childNodes;
    }

    
// 判断是否为根节点
    public boolean rootNode(Node node) {
        
boolean isRootNode = true;
        
for (Node n : nodes) {
            
if (node.getPid().equals(n.getId())) {
                isRootNode 
= false;
                
break;
            }
        }
        
return isRootNode;
    }

    
// 获取集合中所有的根节点
    public List<Node> getRootNodes() {
        List
<Node> rootNodes = new ArrayList<>();
        
for (Node n : nodes) {
            
if (rootNode(n)) {
                rootNodes.add(n);
            }
        }
        
return rootNodes;
    }

    
public static class Node {

        
private String id;
        
private String pid;
        
private String name;
        
private List<Node> children;

        
public Node() {
        }

        
public Node(String id, String pid, String name) {
            
super();
            
this.id = id;
            
this.pid = pid;
            
this.name = name;
        }

        
public String getId() {
            
return id;
        }

        
public void setId(String id) {
            
this.id = id;
        }

        
public String getPid() {
            
return pid;
        }

        
public void setPid(String pid) {
            
this.pid = pid;
        }

        
public String getName() {
            
return name;
        }

        
public void setName(String name) {
            
this.name = name;
        }


        
public List<Node> getChildren() {
            
return children;
        }

        
public void setChildren(List<Node> children) {
            
this.children = children;
        }
    }
}
mapper.xml
    <!--根据条件查询返回Node-->
    
<select id="findByItemtypeTree" parameterType="BsItemtype" resultType="Node">
        SELECT upcode as pid,itemname as name,itemtypecode as id FROM 表名 WHERE 1=1
        
<if test="upcode != null  and upcode != '' ">
            and upcode = #{值}
        
</if>
    
</select>
controller:返回结果
    //树形结构
    @RequestMapping("left")
    ModelAndView left() 
throws JSONException {
        String mavStr 
= "";
        BsItemtype queryItemtype 
= new BsItemtype();
        
//查询根目录树
      
//  queryItemtype.setUpcode("00");
        
// 获取全部目录节点
        List<TreeBuilder.Node> itemtypeTree = itemtypeService.findByItemtypeTree();

        
// 拼装树形json字符串
         mavStr = new TreeBuilder().buildTree(itemtypeTree);
        mavStr 
= mavStr.replaceAll("\"children\"","\"nodes\"");
        mavStr
= mavStr.replaceAll("\"id\"","\"value\"");
        mavStr 
= mavStr.replaceAll("\"name\"","\"text\"");
        ModelAndView mav 
= new ModelAndView("/bs/itemtype/itemtypeLeft.html");//配置返回路径
        System.out.println(mavStr);
        mav.addObject(
"mavStr", mavStr.toString());
        
return mav;
    }
DAO层:
List<TreeBuilder.Node> findByItemtypeTree();

html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    
<meta charset="UTF-8">
    
<title></title>

    
<!-- Required Stylesheets -->
    
<link href="/oastyle/css/bootstrap.css" rel="stylesheet">
    
<!-- Required Javascript -->
    
<script src="/js/jquery.js"></script>
    
<script src="/js//bootstrap-treeview.js"></script>
</head>
<body>
<div id="tree"></div>
<script th:inline="javascript">
var tree = eval([[${mavStr}]]);
         
function getTree() {
        
// Some logic to retrieve, or generate tree structure
        return tree;
    }

    $('#tree').treeview({
        data: getTree(),
        enableLinks: 
true});

    $('#tree').on('nodeSelected',
function(event, data) {
          window.parent.itemtypeRight.location.href
="/itemtype/list?upcode="+data.value;
    });

</script>

</body>
</html>

posted @ 2019-05-21 19:08 半导体 阅读(2047) | 评论 (0)编辑 收藏

技巧

layui
可以做表格排序。

posted @ 2019-05-16 21:14 半导体 阅读(67) | 评论 (0)编辑 收藏

分页方式:

前台:
<form   method="post" action = "/bbs/list"  id="queryform">
        
<input type="hidden" name="start" id="start"/>
        
<li>搜索:</li>
                
<input type="text" placeholder="请输入公告名称" name="title"  th:value ="${queryBbs.title}" />
              
<href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a>
    
</form>
    //搜索
    function changesearch() {
        $(
"#queryform").submit();
    }
通过page传值
<div class="pagelist" th:include="common/footer::page"/>
包含页面
<!--fotter-->
<div class="pagelist" th:fragment="page">
    
<a th:onclick="javascript:page(0)">[首 页]</a>
    
<a th:onclick="javascript:page([[${page.pageNum}]]-1)">[上一页]</a>
    
<a th:onclick="javascript:page([[${page.pageNum}]]+1)">[下一页]</a>
    
<a th:onclick="javascript:page([[${page.pages}]])">[尾 页]</a>
    共[[${page.total}]]条记录
</div>
//分页跳转方法
function page(pageNum) {
$(
"#start").val(pageNum);
$(
"#queryform").submit();
}
此种方法可以将搜索查询框内容通过form表单的方式提交给controller,controller再分页,但点“下一页”事件多点二次很容易导致浏览器假死。

第二种方式:直接通过href传值,这种方式不死机。
                        <div class="pagelist">
                        
<th:href="@{/bbs/list(start=0,title=${queryBbs.title})}">[首  页]</a>
                        
<th:href="@{/bbs/list(start=${page.pageNum-1},title=${queryBbs.title})}">[上一页]</a>
                        
<th:href="@{/bbs/list(start=${page.pageNum+1},title=${queryBbs.title})}">[下一页]</a>
                        
<th:href="@{/bbs/list(start=${page.pages},title=${queryBbs.title})}">[尾  页]</a>
                            共[[${page.total}]]条记录
                        
</div>

posted @ 2019-05-15 15:21 半导体 阅读(104) | 评论 (0)编辑 收藏

org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing

     摘要: 错误如下:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->org.thymeleaf.exceptions.TemplateInputException: An error happened during&nbs...  阅读全文

posted @ 2019-05-12 15:15 半导体 阅读(7795) | 评论 (0)编辑 收藏

好看的界面

windows风格
https://www.toufu.xyz
layui

网页模板素材
http://www.htmlsucai.com/forum-78-1.html
http://www.cssmoban.com/cssthemes/houtaimoban/
http://www.16sucai.com/
https://www.58pic.com/

posted @ 2019-05-11 23:17 半导体 阅读(92) | 评论 (0)编辑 收藏

Spring+Mybatis 查询所有数据时发生异常:org.apache.ibatis.reflection.ReflectionException: There is no getter for

Spring+Mybatis框架整合时,根据条件查询数据,发生异常
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'sname' in 'class java.lang.String'
userinfoMapper.xml文件:
<select id="findAll" parameterType="string" resultMap="userinfoMap">  select * from userinfo where sname like '%${sname}%' </select>
UserinfoMapper接口:

public List<Userinfo> findAll(String sname);
解决方法:在参数前加@Param标签
public List<Userinfo> findAll(@Param("sname") String sname);

posted @ 2019-05-11 16:05 半导体 阅读(1585) | 评论 (0)编辑 收藏

全选输出checkbox的值

$("input[name='a']").each(function () {
            Aval 
= $(this).val();
            alert(Aval);
        });

解释:取当前页面所有name='a'的input元素,循环每一个取到的元素,将其value的值赋

给Aval,并输出。


posted @ 2019-05-11 14:48 半导体 阅读(81) | 评论 (0)编辑 收藏

mysql8.0使用sqlyog无法连接时

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

如果mysql只能本地连接,不能远程 连接
第一步:
 update user set host='%' where user='root';
第二步:重启服务

posted @ 2019-05-06 10:14 半导体 阅读(241) | 评论 (0)编辑 收藏

jquery常用语法

$(":text[name='username']").val()

$("#logOn").click(function () {
});
1、jquery引入基本语法:
 $(function(){});

2、触发所有button元素的click事件
    $(
":button").click( ); // 调用不带任何参数的click()函数,会触发每个匹配元素的click事件.
 3、// 点击链接时,阻止链接跳转
    $(
"a").click( function(){
       
return false;
    } );

posted @ 2019-05-04 21:57 半导体 阅读(88) | 评论 (0)编辑 收藏

springboot+ssm+mysql 错误记录

HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)
解决办法:在application.properties数据库连接中增加:&serverTimezone=UTC
Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
解决办法:打开mysql,输入set global time_zone='+8:00';
还有给我自己提个醒,报错信息千万别只看一句,如果第一句报错没给你答案,后面的报错信息继续看。

posted @ 2019-04-29 23:05 半导体 阅读(477) | 评论 (0)编辑 收藏

字符串型转换为JSON并获取值

@RequestMapping(value = "updateInvestorApplyAccountNo", method = RequestMethod.POST)
@ResponseBody
public void updateInvestorApplyAccountNo(HttpServletRequest request,
HttpServletResponse response,
@RequestBody String requestBody) {
int num = 0;
String result = "";
//下面是把拿到的json字符串转成 json对象
JSONObject jsStr = JSONObject.parseObject(requestBody); //将字符串{“id”:1}
//int jsID = Integer.parseInt(jsStr.getString("id"));//获取id的值


/** 
* json对象转换成java对象 
*/ 
InvestorApplyModel stud = (InvestorApplyModel) JSONObject.toJavaObject(jsStr,InvestorApplyModel.class);

}

posted @ 2018-08-25 15:38 半导体 阅读(156) | 评论 (0)编辑 收藏

redirect_uri域名与后台配置不一样,错误码10003

微信获取openid时,如遇到以下错误

解决方法如下:
1、获取openid时,链接地址https://open.weixin.qq.com/connect/oauth2/authorize? 中redirect_uri一定要带上http,
   公众号设置->功能设置->网页授权域名中的域名与redirect_uri域名要一模一样,记得一定要加上http://

posted @ 2018-08-22 10:14 半导体 阅读(604) | 评论 (0)编辑 收藏

JAVA+ORACLE+BLOB+Mybatis

实体类:
    private  byte[] richContent;
    
public byte[] getRichContent() {
        
return richContent;
    }


    
public void setRichContent(byte[] richContent) {
        
this.richContent = richContent;
    }

Mapper.xml
    <result column="RICH_CONTENT" property="richContent" jdbcType="BLOB" typeHandler="org.apache.ibatis.type.BlobTypeHandler"/>

      <if test="richContent != null" >
        UPDATE_DATE = #{richContent,jdbcType=BLOB},
      
</if>
JSP
<td class="propname">发布内容:</td>
<td class="propvalue" colspan="6">
<div id="myEditor" type="text/plain" name='content' style="width: 900px;height:400px;"/>
</td>
CONTROL保存
    //利用content转换为二进制,存入richcontent
String strRich = newsBean.getContent();
if(strRich.length()>0) {
byte[] temp = strRich.getBytes();
newsBean.setRichContent(temp);
newsBean.setContent("");
}

CONTROL显示:
if(casNewsModel.getRichContent().length>0) {
content = new String(casNewsModel.getRichContent());
casNewsModel.setContent(content);
}



posted @ 2018-01-22 20:34 半导体 阅读(197) | 评论 (0)编辑 收藏

模拟登录解决方案

最近一直在做单点登录,随着客户需求不同,解决方案也是多种多样,来说说我总结的解决方案:
一、采用标准接口方式实现单点登录,由于夜已深,以后再上传。
二、采用模拟登录,在门户中让用户输入用户名密码,再模拟用户登录的方式实现系统登录。
当客户提出这种方式时,本人是表示不理解,考虑到安全性本想拒绝,但。。。客户永远是god。
说说这种方式实现的思路吧,用户登录无非几种,
第一:输入用户名密码然后uget或post提交,有密码在手,get方式大家都会,post也很容易,登陆页另存为,form action填远程登陆地址,正常就O了。   
        千万注意,如果用户传的中文,一定要保证不乱码,传输的编码要与系统对应,在<post 中增加编码格式就行了,如:
<form action="远程提交地址"   accept-charset="GB2312" onsubmit="document.charset='GB2312';"/>
第二:如果碰到先加密,再私钥配对这种,模拟他的整个过程,因为密码在手,他调什么方法,你也调,他怎么混,你也照着混。只是步骤多,其他都一样,

posted @ 2017-12-24 00:13 半导体 阅读(125) | 评论 (0)编辑 收藏

ajax调用方法

i不跨域调用

$(document).ready(function() {
$.ajax({
type : 'post',
url :' <%=path%>/mplat/InitAllMenu',
data : {},
cache : false,
dataType : 'json',
success : function(data, stats) {alert(data.menus);
// var returnData=JSON.parse(data);
/* var returnData = data;
appname = returnData.appname;
allTreeNodes = JSON.parse(returnData.menus);*/
},
error : function() {debugger;
alert( "加载应用名出现问题..");
}
})
;

跨域请用jsonp访问,由于回调时会报callback错误,请直接用jquery-jsonp插件;

做跨域数据处理的时候经常使用Jquery的getJSONP方法。但是这个方法跟普通的Ajax是完全不一样的,尽管指定了error,当请求发生错误的时候也不会去执行这个函数。

jQuery-JSONP 是一个支持 JSONP 调用的 jQuery 插件,它支持出错时的 Ajax 回调。下载地址:https://github.com/jaubourg/jquery-jsonp

使用方法很简单,直接引用Down到的文件到你的页面。

$.jsonp({
        url: "/Handler/demo",
        data: { yourdata: "data" },
        callback:"callbackAction",
        success: function (json) {
            //your code            
        },
        error: function (xOptions, textStatus) {
            //your code           
        }
    });

  

注意事项:


http://blog.csdn.net/function_jx_/article/details/47124815
  1. callback:假如指定的值是callbackAction,服务端返回的json数据必须包含在callbackAction()里面。(具体原因请了解一下Jsonp实现原理)

posted @ 2017-12-13 16:50 半导体 阅读(173) | 评论 (0)编辑 收藏

java文件上传工具

uploadify:文件可以切片存放,目前常用

http://www.plupload.com/examples/ 

webUploader

swfUpload:界面漂亮,但文件不能切片存放

posted @ 2017-11-20 16:51 半导体 阅读(151) | 评论 (0)编辑 收藏

powerdesigner反向工程时报错odbc驱动问题

找了很久终于找到64位的powerdesigner16.5了,网上基本所有的默认为32位的,但是现在数据库基本都是64位的了,这样在逆向生成pdm时就会报错,请叫我雷锋。

链接:http://pan.baidu.com/s/1slwAjSh

提取密码:d4gw

需要破解文件的可以在我的上传资源里找到,绝对可以用,本人亲测的!

转自:http://blog.csdn.net/danfeixia123/article/details/53381733

posted @ 2017-11-07 15:17 半导体 阅读(232) | 评论 (0)编辑 收藏

IDE环境配置

oracle 下载地址:http://blog.itpub.net/16886618/viewspace-1365348/
MAVEN安装:http://www.cnblogs.com/izecsonLee/p/6155868.html   最后setting文件localRepository改为 本机地址。

posted @ 2017-10-17 23:43 半导体 阅读(211) | 评论 (0)编辑 收藏