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. LaTeX模板

    学校linux机子根本跑不动libreoffice,wps没有公式,只好上LaTeX了. 先 beamer: 需要安装firasans和firamono字体,思源黑体SC \documentclass ...

  2. IDEA+Tomcat热部署自动编译

    https://www.cnblogs.com/1024zy/p/6344000.html 之前太傻瓜了,一直以为用了IDEA改了类或者js的时候全都要手动构建发布,其实不用,IDEA这么好的工具怎么 ...

  3. 67. @Transactional的类注入失败【从零开始学Spring Boot】

    [从零开始学习Spirng Boot-常见异常汇总] Spring的代理模式有两种:java自带的动态代理模式和cglib代理模式,cglib代码模式适用于没有接口的类,而java自带适用于接口类,默 ...

  4. left join 与left outer join的区别

    joinn 语句有三种:inner join, left outer join 和 right outer join都可以简写,分别为join,left join,right join.

  5. NYOJ-676小明的求助,快速幂求模,快速幂核心代码;

    小明的求助 时间限制:2000 ms  |  内存限制:65535 KB 难度:2 描述 小明对数学很有兴趣,今天老师出了道作业题,让他求整数N的后M位,他瞬间感觉老师在作弄他,因为这是so easy ...

  6. Robot Framework中的未解之谜

    今天在写测试用例的时候偶然发现了一个问题: 一.看脚本逻辑上没有问题,但是在引用变量的时候不能成功引用,脚本截图如下: 这个是关键字A的截图,没有参数. 此时在case中引用${phonesign}和 ...

  7. MyBatis使用Mapper动态代理开发Dao层

    开发规范 Mapper接口开发方法只需要程序员编写Mapper接口(相当于Dao接口),由Mybatis框架根据接口定义创建接口的动态代理对象,代理对象的方法体同原始Dao接口实现类方法. Mappe ...

  8. @Temporal()注解的使用

    数据库的字段类型有date.time.datetime而Temporal注解的作用就是帮Java的Date类型进行格式化,一共有三种注解值: 第一种:@Temporal(TemporalType.DA ...

  9. linux 常见名词及命令(一)

    linux  PK  wondows 稳定且有效率.免费或少许费用.漏洞少且修补快.多任务多用户. 安全的用户及文件权限策略.适合小内核程序的嵌入系统.相对不耗资源. 热门的开源系统 红帽企业系统(R ...

  10. 0c-适配 iOS 11

    参考路径:https://mp.weixin.qq.com/s?__biz=MzA3NTYzODYzMg==&mid=2653579210&idx=1&sn=d5ea8d46c ...