bean:

package com.baiwang.moirai.model.sys;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
* 省市区三级
* ClassName: AreaInfo
* @author chengluchao
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SysProvCityDist {
private Integer id; private String province; private String type; private String city; private Integer provinceId; private String district; private Integer cityId; private String function; public String getFunction() {
return function;
} public void setFunction(String function) {
this.function = function;
} public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public String getProvince() {
return province;
} public void setProvince(String province) {
this.province = province == null ? null : province.trim();
} public String getType() {
return type;
} public void setType(String type) {
this.type = type == null ? null : type.trim();
} public String getCity() {
return city;
} public void setCity(String city) {
this.city = city == null ? null : city.trim();
} public Integer getProvinceId() {
return provinceId;
} public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId;
} public String getDistrict() {
return district;
} public void setDistrict(String district) {
this.district = district == null ? null : district.trim();
} public Integer getCityId() {
return cityId;
} public void setCityId(Integer cityId) {
this.cityId = cityId;
}
}

mybatis文件:

package com.baiwang.moirai.mapper;

import com.baiwang.moirai.model.sys.SysProvCityDist;
import org.apache.ibatis.annotations.Mapper; import java.util.List;
@Mapper
public interface SysProvCityDistMapper { int deleteByPrimaryKey(Integer id); int insert(SysProvCityDist record); int insertSelective(SysProvCityDist record); SysProvCityDist selectByPrimaryKey(Integer id); List<SysProvCityDist> selectByBean(SysProvCityDist sysProvCityDist); List<SysProvCityDist> selectByBeanVague(SysProvCityDist sysProvCityDist); int updateByPrimaryKeySelective(SysProvCityDist record); int updateByPrimaryKey(SysProvCityDist record);
}
<?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.baiwang.moirai.mapper.SysProvCityDistMapper">
<resultMap id="BaseResultMap" type="com.baiwang.moirai.model.sys.SysProvCityDist">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="province" jdbcType="VARCHAR" property="province" />
<result column="type" jdbcType="CHAR" property="type" />
<result column="city" jdbcType="VARCHAR" property="city" />
<result column="province_id" jdbcType="INTEGER" property="provinceId" />
<result column="district" jdbcType="VARCHAR" property="district" />
<result column="city_id" jdbcType="INTEGER" property="cityId" />
</resultMap>
<sql id="Base_Column_List">
id, province, type, city, province_id, district, city_id
</sql> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_prov_city_dist
where id = #{id,jdbcType=INTEGER}
</select> <select id="selectByBean" parameterType="com.baiwang.moirai.model.sys.SysProvCityDist" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_prov_city_dist
where 1=1
<if test="province != null">
AND province = #{province,jdbcType=VARCHAR}
</if>
<if test="type != null">
AND type = #{type,jdbcType=CHAR}
</if>
<if test="city != null">
AND city = #{city,jdbcType=VARCHAR}
</if>
<if test="provinceId != null">
AND province_id = #{provinceId,jdbcType=INTEGER}
</if>
<if test="district != null">
AND district = #{district,jdbcType=VARCHAR}
</if>
<if test="cityId != null">
AND city_id = #{cityId,jdbcType=INTEGER}
</if>
<if test="id != null">
AND id = #{id,jdbcType=INTEGER}
</if>
</select> <select id="selectByBeanVague" parameterType="com.baiwang.moirai.model.sys.SysProvCityDist" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_prov_city_dist
where 1=1
<if test="province != null">
AND province LIKE CONCAT(#{province,jdbcType=VARCHAR},'%')
</if>
<if test="type != null">
AND type = #{type,jdbcType=CHAR}
</if>
<if test="city != null">
AND city LIKE CONCAT(#{city,jdbcType=VARCHAR},'%')
</if>
<if test="provinceId != null">
AND province_id = #{provinceId,jdbcType=INTEGER}
</if>
<if test="district != null">
AND district LIKE CONCAT(#{district,jdbcType=VARCHAR},'%')
</if>
<if test="cityId != null">
AND city_id = #{cityId,jdbcType=INTEGER}
</if>
<if test="id != null">
AND id = #{id,jdbcType=INTEGER}
</if>
</select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys_prov_city_dist
where id = #{id,jdbcType=INTEGER}
</delete> <insert id="insert" parameterType="com.baiwang.moirai.model.sys.SysProvCityDist">
insert into sys_prov_city_dist (id, province, type,
city, province_id, district,
city_id)
values (#{id,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{type,jdbcType=CHAR},
#{city,jdbcType=VARCHAR}, #{provinceId,jdbcType=INTEGER}, #{district,jdbcType=VARCHAR},
#{cityId,jdbcType=INTEGER})
</insert> <insert id="insertSelective" parameterType="com.baiwang.moirai.model.sys.SysProvCityDist">
insert into sys_prov_city_dist
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="province != null">
province,
</if>
<if test="type != null">
type,
</if>
<if test="city != null">
city,
</if>
<if test="provinceId != null">
province_id,
</if>
<if test="district != null">
district,
</if>
<if test="cityId != null">
city_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="province != null">
#{province,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=CHAR},
</if>
<if test="city != null">
#{city,jdbcType=VARCHAR},
</if>
<if test="provinceId != null">
#{provinceId,jdbcType=INTEGER},
</if>
<if test="district != null">
#{district,jdbcType=VARCHAR},
</if>
<if test="cityId != null">
#{cityId,jdbcType=INTEGER},
</if>
</trim>
</insert> <update id="updateByPrimaryKeySelective" parameterType="com.baiwang.moirai.model.sys.SysProvCityDist">
update sys_prov_city_dist
<set>
<if test="province != null">
province = #{province,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=CHAR},
</if>
<if test="city != null">
city = #{city,jdbcType=VARCHAR},
</if>
<if test="provinceId != null">
province_id = #{provinceId,jdbcType=INTEGER},
</if>
<if test="district != null">
district = #{district,jdbcType=VARCHAR},
</if>
<if test="cityId != null">
city_id = #{cityId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update> <update id="updateByPrimaryKey" parameterType="com.baiwang.moirai.model.sys.SysProvCityDist">
update sys_prov_city_dist
set province = #{province,jdbcType=VARCHAR},
type = #{type,jdbcType=CHAR},
city = #{city,jdbcType=VARCHAR},
province_id = #{provinceId,jdbcType=INTEGER},
district = #{district,jdbcType=VARCHAR},
city_id = #{cityId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

省市区三级-javabean和mybatis的更多相关文章

  1. javaweb--json--ajax--mysql实现省市区三级联动(附三级联动数据库)

    在web中,实现三级联动很常见,尤其是利用jquery+json.但是从根本上来说jquery并不是最能让人容易理解的,接下来从最基本的javascript开始,实现由javascript+json+ ...

  2. jQuery省市区三级联动插件

    体验效果:http://hovertree.com/texiao/bootstrap/4/支持PC和手机移动端. 手机扫描二维码体验效果: 代码如下: <!DOCTYPE html> &l ...

  3. 省市区三级联动 pickerView

    效果图 概述 关于 省市区 三级联动的 pickerView,我想大多数的 iOS 开发者应该都遇到过这样的需求.在遇到这样的需求的时候,大多数人都会觉的这个很复杂,一时无从下手.其实真的没那么复杂. ...

  4. JS省市区三级联动

    不需要访问后台服务器端,不使用Ajax,无刷新,纯JS实现的省市区三级联动. 当省市区数据变动是只需调正js即可. 使用方法: <!DOCTYPE html><html>< ...

  5. ajax省市区三级联动

    jdbc+servlet+ajax开发省市区三级联动 技术点:jdbc操作数据库,ajax提交,字符拦截器,三级联动 特点:局部刷新达到省市区三级联动,举一反三可以做商品分类等 宗旨:从实战中学习 博 ...

  6. QQ JS省市区三级联动

    如下图: 首先写一个静态的页面: <!DOCTYPE html> <html> <head> <title>QQ JS省市区三级联动</title ...

  7. 省市区三级联动(二)JS部分简单版

    通过对上一篇<省市区三级联动>的学习发现JScript部分省市区的填充代码几乎相同,所以可以写成一个函数. 注意:html部分和chuli.php部分不变 1.下拉列表填充可以写成带参数的 ...

  8. 从QQ网站中提取的纯JS省市区三级联动

    在 http://ip.qq.com/ 的网站中有QQ自己的JS省市区三级联动 QQ是使用引用外部JS来实现三级联动的.JS如下:http://ip.qq.com/js/geo.js <!DOC ...

  9. 基于ThinkPHP+AJAX的省市区三级联动

    练习,就当练习. 省市区三级联动,样式如下图所示: 1,导入两个js文件并且导入数据库文件. 两个js文件分别是jquery-2.1.4.min.js和jquery-1.js,数据库文件,见附件. 2 ...

随机推荐

  1. springMVC model传对象数组 jq 获取

    这个问题网上没有什么解答,有两种可能性: 一.我使用的这种方法实在太蠢了正常人都不会去这个搞: 二.我太蠢了.... 以下解决方案 //后台代码如下 public String plant(Model ...

  2. Python数据结构--搜索树

    ''' 二叉搜索树(BST)是一棵树,其所有节点都遵循下述属性 - 节点的左子树的键小于或等于其父节点的键. 节点的右子树的键大于其父节点的键. 因此,BST将其所有子树分成两部分; 左边的子树和右边 ...

  3. luogu1463 [HAOI2007]反素数

    以下证明来自算法竞赛进阶指南 引理一: 答案就是 \([1,n]\) 之间约数个数最多的最小的数. 证明: 记 \(m\) 是 \([1,n]\) 之间约数个数最多的最小的数.则 \(\forall ...

  4. [luoguP3068] [USACO13JAN]派对邀请函Party Invitations(stl大乱交)

    传送门 记录每一个编号在那些组中,可以用vector,这里选择链式前向星. 每一组用set 将被邀请的放到queue中 #include <set> #include <queue& ...

  5. Nginx,Apache,Tomcat区别

    Nginx:一款能承受高并发的HTTP服务器,异步的,多个连接(万级别)可以对应一个进程,进行响应.基于事件驱动模型. Nginx优点:负载均衡.反向代理.处理静态文件优势. Apache:相对于Ng ...

  6. php责任链模式

    php 责任链模式 又叫职责链模式.包含了一些命令对象和一些处理对象,每个处理对象决定它能处理那些命令对象,它也知道应该把自己不能处理的命令对象交下一个处理对象,该模式还描述了往该链添加新的处理对象的 ...

  7. Django学习之 - 基础部分

    学习记录参考: 讲师博客:http://www.cnblogs.com/wupeiqi/articles/5433893.html 老男孩博客:http://oldboy.blog.51cto.com ...

  8. [RxJS] Use `lift` to Connect a `source` to a `subscriber` in RxJS

    The lift method on each source hides away the internals of RxJS so you can simply connect a source t ...

  9. libevent多线程使用事项

    转 http://www.cnblogs.com/Seapeak/archive/2010/04/08/1707807.html 在linux平台上使用c开发网络程序的同志们一般情况下都对鼎鼎大名的l ...

  10. 【问题记录】LoadRunner 接口压测-json格式报文

    [问题起因] 前段时间,协助其他项目录制接口压测脚本,对方要求请求报文内容实现参数化. 请求方法如下: 直接在Parameter List中新增一个parameter, 将请求报文放入dat文件中.这 ...