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. Codeforces 5D Follow Traffic Rules

    [题意概述] 某个物体要从A途经B到达C,在通过B的时候速度不能超过vd.  它的加速度为a,最大速度为vm:AB之间距离为d,AC之间距离为L: 问物体最少花多少时间到达C. [题解] 分情况讨论. ...

  2. jsp从servlet中获取的值为空

    System.out.println("进入servlet"); UserServiceImpl us=new UserServiceImpl(); List<User> ...

  3. 【02】koala编译中文出错(已放弃不用)

    http://koala-app.com/index-zh.html koala 下载地址.     sass.中文编译出错: 打开 Koala文件夹位置->rubygems->gems- ...

  4. spring boot学习01【搭建环境、创建第一个spring boot项目】

    1.给eclipse安装spring boot插件 Eclipse中安装Spring工具套件(STS): Help -> Eclipse Marketplace... 在Search标签或者Po ...

  5. php中configure报错问题

    https://blog.csdn.net/dodott/article/details/49664379 PHP的安装虽然有时候很简单,可是如果应用一多,我们安装起来就很头痛了!出错最多的就是安装P ...

  6. 生产环境下lnmp的权限说明

    https://www.cnblogs.com/zrp2013/p/4183546.html 有关权限说明:-rwxrw-r‐-1 root root 1213 Feb 2 09:39 50.html ...

  7. /etc/fstab readyonly 解决办法

    阿里云主机切换地区强制升级后,“新的磁盘盘符识别为vdb1,但是在/etc/fstab中记录的挂载信息还是旧的xvdb1,导致磁盘挂载失败” 机子启动出错了. 按提示 输入 root的密码,进入以Re ...

  8. Object-C Xcode 编译提示 note: please rebuild precompiled header ZWYLPrefixHeader

    错误提示如下图 解决思路: 由于手欠不小心,在.pch文件上的第一行加了几个文字,删除以后,还有一个空行,估计是这个空行引起的.删除这个空行,就好了.

  9. eclipse导入maven工程步骤

    转自:http://jingyan.baidu.com/article/cbf0e500a6e3252eaa2893c1.html 感谢作者 步骤一 : 选择 “Import”操作 有两个途径可以选择 ...

  10. 学习swift从青铜到王者之swift闭包06

    语法表达式 一般形式:{ (parameters) -> returnType in statements } 这里的参数(parameters),可以是in-out(输入输出参数),但不能设定 ...