mybatis.config.SystemPropertyMapper.xml Maven / Gradle / Ivy
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mappers.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.higgschain.trust.slave.dao.mysql.config.SystemPropertyDao"> <!-- Result Map --> <resultMap id="baseResultMap" type="com.higgschain.trust.slave.dao.po.config.SystemPropertyPO"> <result column="id" property="id" /> <result column="key" property="key" /> <result column="value" property="value" /> <result column="desc" property="desc" /> <result column="create_time" property="createTime" /> <result column="update_time" property="updateTime" /> </resultMap> <!-- system_property table all fields --> <sql id="baseColumnList"> `key`,`value`,`desc`,create_time,update_time </sql> <!-- 插入记录 --> <insert id="add" parameterType="Object"> insert into system_property(`key`,`value`,`desc`,create_time,update_time) values(#{key},#{value},#{desc},now(3),now(3)) </insert> <!-- 根据Key查询 --> <select id="queryByKey" resultMap="baseResultMap" parameterType="Object"> select <include refid="baseColumnList" /> from system_property where `key`=#{key} </select> <!-- update --> <update id="update"> UPDATE `system_property` SET `value` = #{value}, <if test="desc != null and desc!=''"> `desc`=#{desc}, </if> `update_time`= now(3) WHERE `key` = #{key} and `value`!= #{value} </update> </mapper>