mybatis学习(41):使用逆向工程

新建一个项目,将逆向工程的生成的拷贝进来

配置文件

log4j.properties

### \u914D\u7F6E\u6839 ###
log4j.rootLogger = debug,console ,fileAppender,dailyRollingFile,ROLLING_FILE,MAIL,DATABASE### \u8BBE\u7F6E\u8F93\u51FAsql\u7684\u7EA7\u522B\uFF0C\u5176\u4E2Dlogger\u540E\u9762\u7684\u5185\u5BB9\u5168\u90E8\u4E3Ajar\u5305\u4E2D\u6240\u5305\u542B\u7684\u5305\u540D ###
log4j.logger.org.apache=dubug
log4j.logger.java.sql.Connection=dubug
log4j.logger.java.sql.Statement=dubug
log4j.logger.java.sql.PreparedStatement=dubug
log4j.logger.java.sql.ResultSet=dubug### \u914D\u7F6E\u8F93\u51FA\u5230\u63A7\u5236\u53F0 ###
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.Target = System.out
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern =  %d{ABSOLUTE} %5p %c{1}:%L - %m%n

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings><setting name="useGeneratedKeys" value="true"/>
</settings>
<typeAliases><typeAlias type="com.geyao.mybatis.pojo.Blog" alias="Blog"/>
</typeAliases><environments default="development"><environment id="development"><transactionManager type="JDBC" /><!-- 配置数据库连接信息 --><dataSource type="POOLED"><property name="driver" value="com.mysql.cj.jdbc.Driver" /><property name="url" value="jdbc:mysql://localhost:3306/blog_gp1701?serverTimezone=GMT%2B8" /><property name="username" value="root" /><property name="password" value="123" /></dataSource></environment></environments><mappers><!-- 注册userMapper.xml文件, userMapper.xml位于me.gacl.mapping这个包下,所以resource写成me/gacl/mapping/userMapper.xml--><mapper resource="com/geyao/mybatis/mapper/BlogMapper.xml"/></mappers>
</configuration>

com.geyao.mybatis.mapper

BlogMapper.java

package com.geyao.mybatis.mapper;import com.geyao.mybatis.pojo.Blog;
import com.geyao.mybatis.pojo.BlogExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;public interface BlogMapper {int countByExample(BlogExample example);int deleteByExample(BlogExample example);int insert(Blog record);int insertSelective(Blog record);List<Blog> selectByExample(BlogExample example);int updateByExampleSelective(@Param("record") Blog record, @Param("example") BlogExample example);int updateByExample(@Param("record") Blog record, @Param("example") BlogExample example);
}

BlogMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.geyao.mybatis.mapper.BlogMapper" ><resultMap id="BaseResultMap" type="com.geyao.mybatis.pojo.Blog" ><result column="id" property="id" jdbcType="INTEGER" /><result column="title" property="title" jdbcType="VARCHAR" /><result column="authod_id" property="authodId" jdbcType="INTEGER" /><result column="state" property="state" jdbcType="VARCHAR" /><result column="featured" property="featured" jdbcType="TINYINT" /><result column="style" property="style" jdbcType="VARCHAR" /></resultMap><sql id="Example_Where_Clause" ><where ><foreach collection="oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Update_By_Example_Where_Clause" ><where ><foreach collection="example.oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Base_Column_List" >id, title, authod_id, state, featured, style</sql><select id="selectByExample" resultMap="BaseResultMap" parameterType="com.geyao.mybatis.pojo.BlogExample" >select<if test="distinct" >distinct</if><include refid="Base_Column_List" />from blog<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if><if test="orderByClause != null" >order by ${orderByClause}</if></select><delete id="deleteByExample" parameterType="com.geyao.mybatis.pojo.BlogExample" >delete from blog<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if></delete><insert id="insert" parameterType="com.geyao.mybatis.pojo.Blog" >insert into blog (id, title, authod_id, state, featured, style)values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{authodId,jdbcType=INTEGER}, #{state,jdbcType=VARCHAR}, #{featured,jdbcType=TINYINT}, #{style,jdbcType=VARCHAR})</insert><insert id="insertSelective" parameterType="com.geyao.mybatis.pojo.Blog" >insert into blog<trim prefix="(" suffix=")" suffixOverrides="," ><if test="id != null" >id,</if><if test="title != null" >title,</if><if test="authodId != null" >authod_id,</if><if test="state != null" >state,</if><if test="featured != null" >featured,</if><if test="style != null" >style,</if></trim><trim prefix="values (" suffix=")" suffixOverrides="," ><if test="id != null" >#{id,jdbcType=INTEGER},</if><if test="title != null" >#{title,jdbcType=VARCHAR},</if><if test="authodId != null" >#{authodId,jdbcType=INTEGER},</if><if test="state != null" >#{state,jdbcType=VARCHAR},</if><if test="featured != null" >#{featured,jdbcType=TINYINT},</if><if test="style != null" >#{style,jdbcType=VARCHAR},</if></trim></insert><select id="countByExample" parameterType="com.geyao.mybatis.pojo.BlogExample" resultType="java.lang.Integer" >select count(*) from blog<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if></select><update id="updateByExampleSelective" parameterType="map" >update blog<set ><if test="record.id != null" >id = #{record.id,jdbcType=INTEGER},</if><if test="record.title != null" >title = #{record.title,jdbcType=VARCHAR},</if><if test="record.authodId != null" >authod_id = #{record.authodId,jdbcType=INTEGER},</if><if test="record.state != null" >state = #{record.state,jdbcType=VARCHAR},</if><if test="record.featured != null" >featured = #{record.featured,jdbcType=TINYINT},</if><if test="record.style != null" >style = #{record.style,jdbcType=VARCHAR},</if></set><if test="_parameter != null" ><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByExample" parameterType="map" >update blogset id = #{record.id,jdbcType=INTEGER},title = #{record.title,jdbcType=VARCHAR},authod_id = #{record.authodId,jdbcType=INTEGER},state = #{record.state,jdbcType=VARCHAR},featured = #{record.featured,jdbcType=TINYINT},style = #{record.style,jdbcType=VARCHAR}<if test="_parameter != null" ><include refid="Update_By_Example_Where_Clause" /></if></update>
</mapper>

com.geyao.mybatis.pojo

Blog

package com.geyao.mybatis.pojo;public class Blog {private Integer id;private String title;private Integer authodId;private String state;private Byte featured;private String style;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title == null ? null : title.trim();}public Integer getAuthodId() {return authodId;}public void setAuthodId(Integer authodId) {this.authodId = authodId;}public String getState() {return state;}public void setState(String state) {this.state = state == null ? null : state.trim();}public Byte getFeatured() {return featured;}public void setFeatured(Byte featured) {this.featured = featured;}public String getStyle() {return style;}public void setStyle(String style) {this.style = style == null ? null : style.trim();}
}

BlogExample

package com.geyao.mybatis.pojo;import java.util.ArrayList;
import java.util.List;public class BlogExample {protected String orderByClause;protected boolean distinct;protected List<Criteria> oredCriteria;public BlogExample() {oredCriteria = new ArrayList<Criteria>();}public void setOrderByClause(String orderByClause) {this.orderByClause = orderByClause;}public String getOrderByClause() {return orderByClause;}public void setDistinct(boolean distinct) {this.distinct = distinct;}public boolean isDistinct() {return distinct;}public List<Criteria> getOredCriteria() {return oredCriteria;}public void or(Criteria criteria) {oredCriteria.add(criteria);}public Criteria or() {Criteria criteria = createCriteriaInternal();oredCriteria.add(criteria);return criteria;}public Criteria createCriteria() {Criteria criteria = createCriteriaInternal();if (oredCriteria.size() == 0) {oredCriteria.add(criteria);}return criteria;}protected Criteria createCriteriaInternal() {Criteria criteria = new Criteria();return criteria;}public void clear() {oredCriteria.clear();orderByClause = null;distinct = false;}protected abstract static class GeneratedCriteria {protected List<Criterion> criteria;protected GeneratedCriteria() {super();criteria = new ArrayList<Criterion>();}public boolean isValid() {return criteria.size() > 0;}public List<Criterion> getAllCriteria() {return criteria;}public List<Criterion> getCriteria() {return criteria;}protected void addCriterion(String condition) {if (condition == null) {throw new RuntimeException("Value for condition cannot be null");}criteria.add(new Criterion(condition));}protected void addCriterion(String condition, Object value, String property) {if (value == null) {throw new RuntimeException("Value for " + property + " cannot be null");}criteria.add(new Criterion(condition, value));}protected void addCriterion(String condition, Object value1, Object value2, String property) {if (value1 == null || value2 == null) {throw new RuntimeException("Between values for " + property + " cannot be null");}criteria.add(new Criterion(condition, value1, value2));}public Criteria andIdIsNull() {addCriterion("id is null");return (Criteria) this;}public Criteria andIdIsNotNull() {addCriterion("id is not null");return (Criteria) this;}public Criteria andIdEqualTo(Integer value) {addCriterion("id =", value, "id");return (Criteria) this;}public Criteria andIdNotEqualTo(Integer value) {addCriterion("id <>", value, "id");return (Criteria) this;}public Criteria andIdGreaterThan(Integer value) {addCriterion("id >", value, "id");return (Criteria) this;}public Criteria andIdGreaterThanOrEqualTo(Integer value) {addCriterion("id >=", value, "id");return (Criteria) this;}public Criteria andIdLessThan(Integer value) {addCriterion("id <", value, "id");return (Criteria) this;}public Criteria andIdLessThanOrEqualTo(Integer value) {addCriterion("id <=", value, "id");return (Criteria) this;}public Criteria andIdIn(List<Integer> values) {addCriterion("id in", values, "id");return (Criteria) this;}public Criteria andIdNotIn(List<Integer> values) {addCriterion("id not in", values, "id");return (Criteria) this;}public Criteria andIdBetween(Integer value1, Integer value2) {addCriterion("id between", value1, value2, "id");return (Criteria) this;}public Criteria andIdNotBetween(Integer value1, Integer value2) {addCriterion("id not between", value1, value2, "id");return (Criteria) this;}public Criteria andTitleIsNull() {addCriterion("title is null");return (Criteria) this;}public Criteria andTitleIsNotNull() {addCriterion("title is not null");return (Criteria) this;}public Criteria andTitleEqualTo(String value) {addCriterion("title =", value, "title");return (Criteria) this;}public Criteria andTitleNotEqualTo(String value) {addCriterion("title <>", value, "title");return (Criteria) this;}public Criteria andTitleGreaterThan(String value) {addCriterion("title >", value, "title");return (Criteria) this;}public Criteria andTitleGreaterThanOrEqualTo(String value) {addCriterion("title >=", value, "title");return (Criteria) this;}public Criteria andTitleLessThan(String value) {addCriterion("title <", value, "title");return (Criteria) this;}public Criteria andTitleLessThanOrEqualTo(String value) {addCriterion("title <=", value, "title");return (Criteria) this;}public Criteria andTitleLike(String value) {addCriterion("title like", value, "title");return (Criteria) this;}public Criteria andTitleNotLike(String value) {addCriterion("title not like", value, "title");return (Criteria) this;}public Criteria andTitleIn(List<String> values) {addCriterion("title in", values, "title");return (Criteria) this;}public Criteria andTitleNotIn(List<String> values) {addCriterion("title not in", values, "title");return (Criteria) this;}public Criteria andTitleBetween(String value1, String value2) {addCriterion("title between", value1, value2, "title");return (Criteria) this;}public Criteria andTitleNotBetween(String value1, String value2) {addCriterion("title not between", value1, value2, "title");return (Criteria) this;}public Criteria andAuthodIdIsNull() {addCriterion("authod_id is null");return (Criteria) this;}public Criteria andAuthodIdIsNotNull() {addCriterion("authod_id is not null");return (Criteria) this;}public Criteria andAuthodIdEqualTo(Integer value) {addCriterion("authod_id =", value, "authodId");return (Criteria) this;}public Criteria andAuthodIdNotEqualTo(Integer value) {addCriterion("authod_id <>", value, "authodId");return (Criteria) this;}public Criteria andAuthodIdGreaterThan(Integer value) {addCriterion("authod_id >", value, "authodId");return (Criteria) this;}public Criteria andAuthodIdGreaterThanOrEqualTo(Integer value) {addCriterion("authod_id >=", value, "authodId");return (Criteria) this;}public Criteria andAuthodIdLessThan(Integer value) {addCriterion("authod_id <", value, "authodId");return (Criteria) this;}public Criteria andAuthodIdLessThanOrEqualTo(Integer value) {addCriterion("authod_id <=", value, "authodId");return (Criteria) this;}public Criteria andAuthodIdIn(List<Integer> values) {addCriterion("authod_id in", values, "authodId");return (Criteria) this;}public Criteria andAuthodIdNotIn(List<Integer> values) {addCriterion("authod_id not in", values, "authodId");return (Criteria) this;}public Criteria andAuthodIdBetween(Integer value1, Integer value2) {addCriterion("authod_id between", value1, value2, "authodId");return (Criteria) this;}public Criteria andAuthodIdNotBetween(Integer value1, Integer value2) {addCriterion("authod_id not between", value1, value2, "authodId");return (Criteria) this;}public Criteria andStateIsNull() {addCriterion("state is null");return (Criteria) this;}public Criteria andStateIsNotNull() {addCriterion("state is not null");return (Criteria) this;}public Criteria andStateEqualTo(String value) {addCriterion("state =", value, "state");return (Criteria) this;}public Criteria andStateNotEqualTo(String value) {addCriterion("state <>", value, "state");return (Criteria) this;}public Criteria andStateGreaterThan(String value) {addCriterion("state >", value, "state");return (Criteria) this;}public Criteria andStateGreaterThanOrEqualTo(String value) {addCriterion("state >=", value, "state");return (Criteria) this;}public Criteria andStateLessThan(String value) {addCriterion("state <", value, "state");return (Criteria) this;}public Criteria andStateLessThanOrEqualTo(String value) {addCriterion("state <=", value, "state");return (Criteria) this;}public Criteria andStateLike(String value) {addCriterion("state like", value, "state");return (Criteria) this;}public Criteria andStateNotLike(String value) {addCriterion("state not like", value, "state");return (Criteria) this;}public Criteria andStateIn(List<String> values) {addCriterion("state in", values, "state");return (Criteria) this;}public Criteria andStateNotIn(List<String> values) {addCriterion("state not in", values, "state");return (Criteria) this;}public Criteria andStateBetween(String value1, String value2) {addCriterion("state between", value1, value2, "state");return (Criteria) this;}public Criteria andStateNotBetween(String value1, String value2) {addCriterion("state not between", value1, value2, "state");return (Criteria) this;}public Criteria andFeaturedIsNull() {addCriterion("featured is null");return (Criteria) this;}public Criteria andFeaturedIsNotNull() {addCriterion("featured is not null");return (Criteria) this;}public Criteria andFeaturedEqualTo(Byte value) {addCriterion("featured =", value, "featured");return (Criteria) this;}public Criteria andFeaturedNotEqualTo(Byte value) {addCriterion("featured <>", value, "featured");return (Criteria) this;}public Criteria andFeaturedGreaterThan(Byte value) {addCriterion("featured >", value, "featured");return (Criteria) this;}public Criteria andFeaturedGreaterThanOrEqualTo(Byte value) {addCriterion("featured >=", value, "featured");return (Criteria) this;}public Criteria andFeaturedLessThan(Byte value) {addCriterion("featured <", value, "featured");return (Criteria) this;}public Criteria andFeaturedLessThanOrEqualTo(Byte value) {addCriterion("featured <=", value, "featured");return (Criteria) this;}public Criteria andFeaturedIn(List<Byte> values) {addCriterion("featured in", values, "featured");return (Criteria) this;}public Criteria andFeaturedNotIn(List<Byte> values) {addCriterion("featured not in", values, "featured");return (Criteria) this;}public Criteria andFeaturedBetween(Byte value1, Byte value2) {addCriterion("featured between", value1, value2, "featured");return (Criteria) this;}public Criteria andFeaturedNotBetween(Byte value1, Byte value2) {addCriterion("featured not between", value1, value2, "featured");return (Criteria) this;}public Criteria andStyleIsNull() {addCriterion("style is null");return (Criteria) this;}public Criteria andStyleIsNotNull() {addCriterion("style is not null");return (Criteria) this;}public Criteria andStyleEqualTo(String value) {addCriterion("style =", value, "style");return (Criteria) this;}public Criteria andStyleNotEqualTo(String value) {addCriterion("style <>", value, "style");return (Criteria) this;}public Criteria andStyleGreaterThan(String value) {addCriterion("style >", value, "style");return (Criteria) this;}public Criteria andStyleGreaterThanOrEqualTo(String value) {addCriterion("style >=", value, "style");return (Criteria) this;}public Criteria andStyleLessThan(String value) {addCriterion("style <", value, "style");return (Criteria) this;}public Criteria andStyleLessThanOrEqualTo(String value) {addCriterion("style <=", value, "style");return (Criteria) this;}public Criteria andStyleLike(String value) {addCriterion("style like", value, "style");return (Criteria) this;}public Criteria andStyleNotLike(String value) {addCriterion("style not like", value, "style");return (Criteria) this;}public Criteria andStyleIn(List<String> values) {addCriterion("style in", values, "style");return (Criteria) this;}public Criteria andStyleNotIn(List<String> values) {addCriterion("style not in", values, "style");return (Criteria) this;}public Criteria andStyleBetween(String value1, String value2) {addCriterion("style between", value1, value2, "style");return (Criteria) this;}public Criteria andStyleNotBetween(String value1, String value2) {addCriterion("style not between", value1, value2, "style");return (Criteria) this;}}public static class Criteria extends GeneratedCriteria {protected Criteria() {super();}}public static class Criterion {private String condition;private Object value;private Object secondValue;private boolean noValue;private boolean singleValue;private boolean betweenValue;private boolean listValue;private String typeHandler;public String getCondition() {return condition;}public Object getValue() {return value;}public Object getSecondValue() {return secondValue;}public boolean isNoValue() {return noValue;}public boolean isSingleValue() {return singleValue;}public boolean isBetweenValue() {return betweenValue;}public boolean isListValue() {return listValue;}public String getTypeHandler() {return typeHandler;}protected Criterion(String condition) {super();this.condition = condition;this.typeHandler = null;this.noValue = true;}protected Criterion(String condition, Object value, String typeHandler) {super();this.condition = condition;this.value = value;this.typeHandler = typeHandler;if (value instanceof List<?>) {this.listValue = true;} else {this.singleValue = true;}}protected Criterion(String condition, Object value) {this(condition, value, null);}protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {super();this.condition = condition;this.value = value;this.secondValue = secondValue;this.typeHandler = typeHandler;this.betweenValue = true;}protected Criterion(String condition, Object value, Object secondValue) {this(condition, value, secondValue, null);}}
}

com.geyao.mybatis.util

MybatisUtil

package com.geyao.mybatis.util;import java.io.InputStream;
import java.io.Reader;import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;public class MyBatisUtil {private static SqlSessionFactory sqlSessionFactory =null;static {try {InputStream in = Resources.getResourceAsStream("mybatis-config.xml");sqlSessionFactory = new SqlSessionFactoryBuilder().build(in);} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}private MyBatisUtil() {}public static SqlSession getSqlSession() {return sqlSessionFactory.openSession();}
}

com.geyao.mybatis.mapper

BlogMapperTest

package com.geyao.mybatis.mapper;import java.util.ArrayList;
import java.util.List;import org.apache.ibatis.session.SqlSession;
import org.junit.Test;import com.geyao.mybatis.pojo.Blog;
import com.geyao.mybatis.pojo.BlogExample;
import com.geyao.mybatis.pojo.BlogExample.Criteria;
import com.geyao.mybatis.util.MyBatisUtil;public class BlogMapperTest {@Testpublic void testSelect() {SqlSession session =MyBatisUtil.getSqlSession();BlogMapper blogMapper =session.getMapper(BlogMapper.class);BlogExample blogExample=new BlogExample();BlogExample.Criteria blogcriteria=blogExample.createCriteria();blogcriteria.andTitleLike("%g%");List<Blog> blogList=blogMapper.selectByExample(blogExample);System.out.print(blogList);}
}

运行结果

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/423758.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CentOS 7.2.1511 x64下载地址

CentOS 7.2.1511 x64下载地址 http://kuai.xunlei.com/d/5P9QCQKLGABYmIJW510 #快传关闭&#xff0c;下载链接已经失效 #百度网盘下载 http://pan.baidu.com/s/1jItqJ8y http://pan.baidu.com/s/1kVS08Ph CentOS-7-x86_64-DVD-1511.iso CentOS-7-x86_64-Everything-1…

[Alg] 二叉树的非递归遍历

1. 非递归遍历二叉树算法 (使用stack) 以非递归方式对二叉树进行遍历的算法需要借助一个栈来存放访问过得节点。 (1) 前序遍历 从整棵树的根节点开始&#xff0c;对于任意节点V&#xff0c;访问节点V并将节点V入栈&#xff0c;并判断节点V的左子节点L是否为空。若L不为空&#…

[c++]访MSN浮出窗口的示例

【声明】严格来讲&#xff0c;这篇文章不属于我的原创。我在这里参考了codeproject上的国外作者的模仿MSN浮出窗口的C#代码。换句话说&#xff0c;可以认为我把C#代码翻译成了C代码。另外&#xff0c;为了简化代码&#xff0c;CloseButton我没有采用自己绘制&#xff0c;而是用…

python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib

python 读取文件时报错UnicodeDecodeError: gbk codec cant decode byte 0x80 in position 205: illegal multibyte sequence python读取文件时提示"UnicodeDecodeError: gbk codec cant decode byte 0x80 in position 205: illegal multibyte sequence" 解决办法1. …

mybatis学习(42):mybatis的一级缓存

目录结构 com.geyao.mybatis.mapper BlogMapper类 package com.geyao.mybatis.mapper;import java.util.List; import java.util.Map;import org.apache.ibatis.annotations.Param;import com.geyao.mybatis.pojo.Blog;public interface BlogMapper {Blog selectBlog(Integer…

linux的nohup命令的用法。

linux的nohup命令的用法。 在应用Unix/Linux时&#xff0c;我们一般想让某个程序在后台运行&#xff0c;于是我们将常会用 & 在程序结尾来让程序自动运行。比如我们要运行mysql在后台&#xff1a; /usr/local/mysql/bin/mysqld_safe –usermysql &。可是有很多程序并不…

防止ASP.NET按钮多次提交的办法

方法一<asp:Button ID"btnSumbit" runat"server" UseSubmitBehavior"false" OnClientClick"this.valueSumbit;this.disabledtrue; " Text"Sumbit" OnClick"btnSumbit_Click" /> 方法二1<html xmlns"…

mybatis学习(43):一级缓存被刷新情况

目录结构 com.geyao.mybatis.mapper BlogMapper类 package com.geyao.mybatis.mapper;import java.util.List; import java.util.Map;import org.apache.ibatis.annotations.Param;import com.geyao.mybatis.pojo.Blog;public interface BlogMapper {Blog selectBlog(Integer…

liunx系统不能登陆的问题

第一装这系统&#xff0c;啥都不懂&#xff0c;设置了密码&#xff0c;好不容易安装完成&#xff0c;竟然不能登陆 有很多人怀疑用户名不是 root&#xff0c; 其实问题是在分配的user 文件夹的空间不足导致的 我在第一次给了3.2G给他&#xff0c;后来我没有自定义了&#xff0c…

提取字典的子集

有时候&#xff0c;需要根据已知的字典对象构造一个新的字典对象。这种场景可以使用字典生成式(dictionary comprehension)。如下&#xff1a; prices {ACME: 45.23,AAPL: 612.78,IBM: 205.55,HPQ: 37.20,FB: 10.75 }# Make a dictionary of all prices over 200 p1 {key: va…

python文件读写小结

读文件 打开一个文件用open()方法(open()返回一个文件对象&#xff0c;它是可迭代的)&#xff1a; >>> f open(test.txt, r) r表示是文本文件&#xff0c;rb是二进制文件。&#xff08;这个mode参数默认值就是r&#xff09; 如果文件不存在&#xff0c;open()函数就会…

mybatis学习(44):二级缓存1

目录结构 com.geyao.mybatis.mapper BlogMapper类 package com.geyao.mybatis.mapper;import java.util.List; import java.util.Map;import org.apache.ibatis.annotations.Param;import com.geyao.mybatis.pojo.Blog;public interface BlogMapper {Blog selectBlog(Integer…

Windows 系统补丁管理策略

Windows 系统补丁管理策略 (注&#xff0c;这几天我只是在整理我以前自己写的一些东西&#xff0c;有的可能已经有点过时&#xff0c;希望不要见怪&#xff0c;不过还是有一定参考价值的&#xff09; 大部分对计算机比较熟悉的朋友都知道&#xff0c;通常安装好Windows 操作系…

HDU6089 恐怖分子(变形线段树)

题目描述 n*m的平面内有K个不安全点&#xff0c;Q个询问位置在(x,y)的人能走到多少个点&#xff1f;从(x,y)走到(x,y)是合法的&#xff0c;当且仅当(x,y)和(x,y)之间的矩形中不包含不安全点。 题解 问题相当于平面中有若干障碍点&#xff0c;询问以某一个点为四个角之一的不包含…

mybatis学习(45):开启二级缓存

目录结构 com.geyao.mybatis.mapper BlogMapper类 package com.geyao.mybatis.mapper;import java.util.List; import java.util.Map;import org.apache.ibatis.annotations.Param;import com.geyao.mybatis.pojo.Blog;public interface BlogMapper {Blog selectBlog(Integer…

【读书笔记】重要的东西

以上摘自一本叫做《大道至简》的小册子&#xff0c;有关介绍可以参考下面的链接 http://www.china-pub.com/34356转载于:https://www.cnblogs.com/chenxizhang/archive/2008/08/11/1264917.html

七夕秀恩爱新姿势!这波操作我给十分!

一、前言 像每一滴酒回不了最初的葡萄&#xff0c;我回不到年少。爱情亦是如此&#xff0c;这就是写一篇小程序的初衷&#xff0c;用来记录我和她最美的恋爱。什么是最美恋爱&#xff1f;就是繁忙之余的一封书信&#xff0c;一起奋斗的目标&#xff0c;精彩的瞬间&#xff0c;旅…

mybatis学习(46):二级缓存被刷新的情况

目录结构 com.geyao.mybatis.mapper BlogMapper类 package com.geyao.mybatis.mapper;import java.util.List; import java.util.Map;import org.apache.ibatis.annotations.Param;import com.geyao.mybatis.pojo.Blog;public interface BlogMapper {Blog selectBlog(Integer…

python 主函数 输入

python 主函数 输入 看一段主函数调用函数的小程序&#xff1a; 1 import sys2 def Fuc():3 print hello4 5 if __name__ __main__:6 if len(sys.argv) ! 3:7 print Usage: python input_name output_name8 exit(1)9 f_input sys.argv[1] 10…

mybatis学习(47):嵌套查询--一对一

数据库 目录结构 映入jar包和junit单元测试 com.geyao.mybatis.mapper AuthorMapper类 package com.geyao.mybatis.mapper;import com.geyao.mybatis.pojo.Author; public interface AuthorMapper {Author selectAuthorById(Integer id); } BlogMapper类 package com.gey…