小院 3.29

master
msb_221930 2 years ago
parent 2d8660c591
commit 43e0bf3289

@ -0,0 +1,15 @@
package com.mashibing.common.constant;
/**
* @author dch
* @create 2024-03-29 15:05
*/
public interface WebMasterConstants {
/**
* key
*/
String KAPTCHA = "kaptcha";
}

@ -17,15 +17,62 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.4.2</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- Shiro认证授权 -->
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring-boot-web-starter</artifactId> <artifactId>shiro-spring-boot-web-starter</artifactId>
<version>1.4.0</version> <version>1.4.0</version>
</dependency> </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>com.github.axet</groupId>
<artifactId>kaptcha</artifactId>
<version>0.0.9</version>
</dependency>
<dependency>
<groupId>com.mashibing</groupId>
<artifactId>beacon-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -1,5 +1,7 @@
package com.mashibing.webmaster; package com.mashibing.webmaster;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -8,6 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @create 2024-03-28 21:44 * @create 2024-03-28 21:44
*/ */
@SpringBootApplication @SpringBootApplication
@MapperScan(basePackages = "com.mashibing.webmaster.mapper")
public class WebMasterStarterApp { public class WebMasterStarterApp {
public static void main(String[] args) { public static void main(String[] args) {

@ -0,0 +1,39 @@
package com.mashibing.webmaster.config;
/**
* @author dch
* @create 2024-03-29 14:13
*/
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Properties;
/**
*
* @author zjw
* @description
*/
@Configuration
public class KaptchaConfig {
@Bean
public DefaultKaptcha kaptcha(){
//1、直接构建DefaultKaptcha
DefaultKaptcha kaptcha = new DefaultKaptcha();
//2、设置配置信息
Properties properties = new Properties();
// 验证码生成位数为4位。
properties.setProperty(Constants.KAPTCHA_TEXTPRODUCER_CHAR_LENGTH,"4");
Config config = new Config(properties);
kaptcha.setConfig(config);
//3、返回对象
return kaptcha;
}
}

@ -0,0 +1,50 @@
package com.mashibing.webmaster.controller;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.mashibing.common.constant.WebMasterConstants;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
/**
* @author dch
* @create 2024-03-29 14:53
*/
@Controller
public class KaptchaController {
private final String JPG = "jpg";
@Autowired
private DefaultKaptcha kaptcha;
@GetMapping("/captcha.jpg")
public void captcha(HttpServletResponse resp){
//1、验证码图片不需要做存储和缓存
resp.setHeader("Cache-Control","no-store, no-cahe");
//2、设置响应头信息
resp.setContentType("image/jpg");
//3、生成验证码文字
String text = kaptcha.createText();
// 认证需要验证验证码的准确性基于Shiro将text做存储
SecurityUtils.getSubject().getSession().setAttribute(WebMasterConstants.KAPTCHA,text);
//4、基于文字生成对应的图片
BufferedImage image = kaptcha.createImage(text);
//5、写回验证码图片信息
try {
ServletOutputStream outputStream = resp.getOutputStream();
ImageIO.write(image,JPG,outputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,54 @@
package com.mashibing.webmaster.controller;
import com.mashibing.common.constant.WebMasterConstants;
import com.mashibing.common.enums.ExceptionEnums;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author dch
* @create 2024-03-29 15:12
*/
@RestController
@RequestMapping("/sys")
@Slf4j
public class SmsUserController {
@PostMapping("/login")
public ResultVO login(@RequestBody @Valid UserDTO userDTO, BindingResult bindingResult) {
// * 1、请求参数的非空校验
if (bindingResult.hasErrors()) {
// 参数不合法响应对应的JSON信息
log.info("【认证操作】参数不合法userDTO = {}", userDTO);
return R.error(ExceptionEnums.PARAMETER_ERROR);
}
// * 2、基于验证码校验请求是否合理
String realKaptcha = (String) SecurityUtils.getSubject().getSession().getAttribute(WebMasterConstants.KAPTCHA);
if (!userDTO.getCaptcha().equalsIgnoreCase(realKaptcha)) {
log.info("【认证操作】验证码不正确kapacha = {}realKaptcha = {}", userDTO.getCaptcha(), realKaptcha);
return R.error(ExceptionEnums.KAPACHA_ERROR);
}
// * 3、基于用户名和密码做Shiro的认证操作
UsernamePasswordToken token = new UsernamePasswordToken(userDTO.getUsername(),userDTO.getPassword());
token.setRememberMe(userDTO.getRememberMe());
try {
SecurityUtils.getSubject().login(token);
} catch (AuthenticationException e) {
// * 4、根据Shiro的认证返回响应信息
log.info("【认证操作】用户名或密码错误ex = {}", e.getMessage());
return R.error(ExceptionEnums.AUTHEN_ERROR);
}
// 到这,代表认证成功
return R.ok();
}
}

@ -0,0 +1,165 @@
package com.mashibing.webmaster.entity;
import java.util.Date;
public class SmsMenu {
private Integer id;
private String name;
private Long parentId;
private String url;
private String icon;
private Integer type;
private Integer sort;
private Date created;
private Long createId;
private Date updated;
private Long updateId;
private Byte isDelete;
private String extend1;
private String extend2;
private String extend3;
private String extend4;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url == null ? null : url.trim();
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon == null ? null : icon.trim();
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Long getCreateId() {
return createId;
}
public void setCreateId(Long createId) {
this.createId = createId;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public Long getUpdateId() {
return updateId;
}
public void setUpdateId(Long updateId) {
this.updateId = updateId;
}
public Byte getIsDelete() {
return isDelete;
}
public void setIsDelete(Byte isDelete) {
this.isDelete = isDelete;
}
public String getExtend1() {
return extend1;
}
public void setExtend1(String extend1) {
this.extend1 = extend1 == null ? null : extend1.trim();
}
public String getExtend2() {
return extend2;
}
public void setExtend2(String extend2) {
this.extend2 = extend2 == null ? null : extend2.trim();
}
public String getExtend3() {
return extend3;
}
public void setExtend3(String extend3) {
this.extend3 = extend3 == null ? null : extend3.trim();
}
public String getExtend4() {
return extend4;
}
public void setExtend4(String extend4) {
this.extend4 = extend4 == null ? null : extend4.trim();
}
}

@ -0,0 +1,115 @@
package com.mashibing.webmaster.entity;
import java.util.Date;
public class SmsRole {
private Integer id;
private String name;
private Date created;
private Long createId;
private Date updated;
private Long updateId;
private Byte isDelete;
private String extend1;
private String extend2;
private String extend3;
private String extend4;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Long getCreateId() {
return createId;
}
public void setCreateId(Long createId) {
this.createId = createId;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public Long getUpdateId() {
return updateId;
}
public void setUpdateId(Long updateId) {
this.updateId = updateId;
}
public Byte getIsDelete() {
return isDelete;
}
public void setIsDelete(Byte isDelete) {
this.isDelete = isDelete;
}
public String getExtend1() {
return extend1;
}
public void setExtend1(String extend1) {
this.extend1 = extend1 == null ? null : extend1.trim();
}
public String getExtend2() {
return extend2;
}
public void setExtend2(String extend2) {
this.extend2 = extend2 == null ? null : extend2.trim();
}
public String getExtend3() {
return extend3;
}
public void setExtend3(String extend3) {
this.extend3 = extend3 == null ? null : extend3.trim();
}
public String getExtend4() {
return extend4;
}
public void setExtend4(String extend4) {
this.extend4 = extend4 == null ? null : extend4.trim();
}
}

@ -0,0 +1,910 @@
package com.mashibing.webmaster.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SmsRoleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SmsRoleExample() {
oredCriteria = new ArrayList<>();
}
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<>();
}
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 andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andCreatedIsNull() {
addCriterion("created is null");
return (Criteria) this;
}
public Criteria andCreatedIsNotNull() {
addCriterion("created is not null");
return (Criteria) this;
}
public Criteria andCreatedEqualTo(Date value) {
addCriterion("created =", value, "created");
return (Criteria) this;
}
public Criteria andCreatedNotEqualTo(Date value) {
addCriterion("created <>", value, "created");
return (Criteria) this;
}
public Criteria andCreatedGreaterThan(Date value) {
addCriterion("created >", value, "created");
return (Criteria) this;
}
public Criteria andCreatedGreaterThanOrEqualTo(Date value) {
addCriterion("created >=", value, "created");
return (Criteria) this;
}
public Criteria andCreatedLessThan(Date value) {
addCriterion("created <", value, "created");
return (Criteria) this;
}
public Criteria andCreatedLessThanOrEqualTo(Date value) {
addCriterion("created <=", value, "created");
return (Criteria) this;
}
public Criteria andCreatedIn(List<Date> values) {
addCriterion("created in", values, "created");
return (Criteria) this;
}
public Criteria andCreatedNotIn(List<Date> values) {
addCriterion("created not in", values, "created");
return (Criteria) this;
}
public Criteria andCreatedBetween(Date value1, Date value2) {
addCriterion("created between", value1, value2, "created");
return (Criteria) this;
}
public Criteria andCreatedNotBetween(Date value1, Date value2) {
addCriterion("created not between", value1, value2, "created");
return (Criteria) this;
}
public Criteria andCreateIdIsNull() {
addCriterion("create_id is null");
return (Criteria) this;
}
public Criteria andCreateIdIsNotNull() {
addCriterion("create_id is not null");
return (Criteria) this;
}
public Criteria andCreateIdEqualTo(Long value) {
addCriterion("create_id =", value, "createId");
return (Criteria) this;
}
public Criteria andCreateIdNotEqualTo(Long value) {
addCriterion("create_id <>", value, "createId");
return (Criteria) this;
}
public Criteria andCreateIdGreaterThan(Long value) {
addCriterion("create_id >", value, "createId");
return (Criteria) this;
}
public Criteria andCreateIdGreaterThanOrEqualTo(Long value) {
addCriterion("create_id >=", value, "createId");
return (Criteria) this;
}
public Criteria andCreateIdLessThan(Long value) {
addCriterion("create_id <", value, "createId");
return (Criteria) this;
}
public Criteria andCreateIdLessThanOrEqualTo(Long value) {
addCriterion("create_id <=", value, "createId");
return (Criteria) this;
}
public Criteria andCreateIdIn(List<Long> values) {
addCriterion("create_id in", values, "createId");
return (Criteria) this;
}
public Criteria andCreateIdNotIn(List<Long> values) {
addCriterion("create_id not in", values, "createId");
return (Criteria) this;
}
public Criteria andCreateIdBetween(Long value1, Long value2) {
addCriterion("create_id between", value1, value2, "createId");
return (Criteria) this;
}
public Criteria andCreateIdNotBetween(Long value1, Long value2) {
addCriterion("create_id not between", value1, value2, "createId");
return (Criteria) this;
}
public Criteria andUpdatedIsNull() {
addCriterion("updated is null");
return (Criteria) this;
}
public Criteria andUpdatedIsNotNull() {
addCriterion("updated is not null");
return (Criteria) this;
}
public Criteria andUpdatedEqualTo(Date value) {
addCriterion("updated =", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedNotEqualTo(Date value) {
addCriterion("updated <>", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedGreaterThan(Date value) {
addCriterion("updated >", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedGreaterThanOrEqualTo(Date value) {
addCriterion("updated >=", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedLessThan(Date value) {
addCriterion("updated <", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedLessThanOrEqualTo(Date value) {
addCriterion("updated <=", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedIn(List<Date> values) {
addCriterion("updated in", values, "updated");
return (Criteria) this;
}
public Criteria andUpdatedNotIn(List<Date> values) {
addCriterion("updated not in", values, "updated");
return (Criteria) this;
}
public Criteria andUpdatedBetween(Date value1, Date value2) {
addCriterion("updated between", value1, value2, "updated");
return (Criteria) this;
}
public Criteria andUpdatedNotBetween(Date value1, Date value2) {
addCriterion("updated not between", value1, value2, "updated");
return (Criteria) this;
}
public Criteria andUpdateIdIsNull() {
addCriterion("update_id is null");
return (Criteria) this;
}
public Criteria andUpdateIdIsNotNull() {
addCriterion("update_id is not null");
return (Criteria) this;
}
public Criteria andUpdateIdEqualTo(Long value) {
addCriterion("update_id =", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdNotEqualTo(Long value) {
addCriterion("update_id <>", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdGreaterThan(Long value) {
addCriterion("update_id >", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdGreaterThanOrEqualTo(Long value) {
addCriterion("update_id >=", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdLessThan(Long value) {
addCriterion("update_id <", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdLessThanOrEqualTo(Long value) {
addCriterion("update_id <=", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdIn(List<Long> values) {
addCriterion("update_id in", values, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdNotIn(List<Long> values) {
addCriterion("update_id not in", values, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdBetween(Long value1, Long value2) {
addCriterion("update_id between", value1, value2, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdNotBetween(Long value1, Long value2) {
addCriterion("update_id not between", value1, value2, "updateId");
return (Criteria) this;
}
public Criteria andIsDeleteIsNull() {
addCriterion("is_delete is null");
return (Criteria) this;
}
public Criteria andIsDeleteIsNotNull() {
addCriterion("is_delete is not null");
return (Criteria) this;
}
public Criteria andIsDeleteEqualTo(Byte value) {
addCriterion("is_delete =", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteNotEqualTo(Byte value) {
addCriterion("is_delete <>", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteGreaterThan(Byte value) {
addCriterion("is_delete >", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteGreaterThanOrEqualTo(Byte value) {
addCriterion("is_delete >=", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteLessThan(Byte value) {
addCriterion("is_delete <", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteLessThanOrEqualTo(Byte value) {
addCriterion("is_delete <=", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteIn(List<Byte> values) {
addCriterion("is_delete in", values, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteNotIn(List<Byte> values) {
addCriterion("is_delete not in", values, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteBetween(Byte value1, Byte value2) {
addCriterion("is_delete between", value1, value2, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteNotBetween(Byte value1, Byte value2) {
addCriterion("is_delete not between", value1, value2, "isDelete");
return (Criteria) this;
}
public Criteria andExtend1IsNull() {
addCriterion("extend1 is null");
return (Criteria) this;
}
public Criteria andExtend1IsNotNull() {
addCriterion("extend1 is not null");
return (Criteria) this;
}
public Criteria andExtend1EqualTo(String value) {
addCriterion("extend1 =", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotEqualTo(String value) {
addCriterion("extend1 <>", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1GreaterThan(String value) {
addCriterion("extend1 >", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1GreaterThanOrEqualTo(String value) {
addCriterion("extend1 >=", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1LessThan(String value) {
addCriterion("extend1 <", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1LessThanOrEqualTo(String value) {
addCriterion("extend1 <=", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1Like(String value) {
addCriterion("extend1 like", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotLike(String value) {
addCriterion("extend1 not like", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1In(List<String> values) {
addCriterion("extend1 in", values, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotIn(List<String> values) {
addCriterion("extend1 not in", values, "extend1");
return (Criteria) this;
}
public Criteria andExtend1Between(String value1, String value2) {
addCriterion("extend1 between", value1, value2, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotBetween(String value1, String value2) {
addCriterion("extend1 not between", value1, value2, "extend1");
return (Criteria) this;
}
public Criteria andExtend2IsNull() {
addCriterion("extend2 is null");
return (Criteria) this;
}
public Criteria andExtend2IsNotNull() {
addCriterion("extend2 is not null");
return (Criteria) this;
}
public Criteria andExtend2EqualTo(String value) {
addCriterion("extend2 =", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotEqualTo(String value) {
addCriterion("extend2 <>", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2GreaterThan(String value) {
addCriterion("extend2 >", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2GreaterThanOrEqualTo(String value) {
addCriterion("extend2 >=", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2LessThan(String value) {
addCriterion("extend2 <", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2LessThanOrEqualTo(String value) {
addCriterion("extend2 <=", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2Like(String value) {
addCriterion("extend2 like", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotLike(String value) {
addCriterion("extend2 not like", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2In(List<String> values) {
addCriterion("extend2 in", values, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotIn(List<String> values) {
addCriterion("extend2 not in", values, "extend2");
return (Criteria) this;
}
public Criteria andExtend2Between(String value1, String value2) {
addCriterion("extend2 between", value1, value2, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotBetween(String value1, String value2) {
addCriterion("extend2 not between", value1, value2, "extend2");
return (Criteria) this;
}
public Criteria andExtend3IsNull() {
addCriterion("extend3 is null");
return (Criteria) this;
}
public Criteria andExtend3IsNotNull() {
addCriterion("extend3 is not null");
return (Criteria) this;
}
public Criteria andExtend3EqualTo(String value) {
addCriterion("extend3 =", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3NotEqualTo(String value) {
addCriterion("extend3 <>", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3GreaterThan(String value) {
addCriterion("extend3 >", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3GreaterThanOrEqualTo(String value) {
addCriterion("extend3 >=", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3LessThan(String value) {
addCriterion("extend3 <", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3LessThanOrEqualTo(String value) {
addCriterion("extend3 <=", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3Like(String value) {
addCriterion("extend3 like", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3NotLike(String value) {
addCriterion("extend3 not like", value, "extend3");
return (Criteria) this;
}
public Criteria andExtend3In(List<String> values) {
addCriterion("extend3 in", values, "extend3");
return (Criteria) this;
}
public Criteria andExtend3NotIn(List<String> values) {
addCriterion("extend3 not in", values, "extend3");
return (Criteria) this;
}
public Criteria andExtend3Between(String value1, String value2) {
addCriterion("extend3 between", value1, value2, "extend3");
return (Criteria) this;
}
public Criteria andExtend3NotBetween(String value1, String value2) {
addCriterion("extend3 not between", value1, value2, "extend3");
return (Criteria) this;
}
public Criteria andExtend4IsNull() {
addCriterion("extend4 is null");
return (Criteria) this;
}
public Criteria andExtend4IsNotNull() {
addCriterion("extend4 is not null");
return (Criteria) this;
}
public Criteria andExtend4EqualTo(String value) {
addCriterion("extend4 =", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4NotEqualTo(String value) {
addCriterion("extend4 <>", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4GreaterThan(String value) {
addCriterion("extend4 >", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4GreaterThanOrEqualTo(String value) {
addCriterion("extend4 >=", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4LessThan(String value) {
addCriterion("extend4 <", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4LessThanOrEqualTo(String value) {
addCriterion("extend4 <=", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4Like(String value) {
addCriterion("extend4 like", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4NotLike(String value) {
addCriterion("extend4 not like", value, "extend4");
return (Criteria) this;
}
public Criteria andExtend4In(List<String> values) {
addCriterion("extend4 in", values, "extend4");
return (Criteria) this;
}
public Criteria andExtend4NotIn(List<String> values) {
addCriterion("extend4 not in", values, "extend4");
return (Criteria) this;
}
public Criteria andExtend4Between(String value1, String value2) {
addCriterion("extend4 between", value1, value2, "extend4");
return (Criteria) this;
}
public Criteria andExtend4NotBetween(String value1, String value2) {
addCriterion("extend4 not between", value1, value2, "extend4");
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);
}
}
}

@ -0,0 +1,165 @@
package com.mashibing.webmaster.entity;
import java.util.Date;
public class SmsUser {
private Integer id;
private String username;
private String password;
private String salt;
private String nickname;
private Date created;
private Long createId;
private Date updated;
private Long updateId;
private Byte isDelete;
private String extend1;
private String extend2;
private String extend3;
private String extend4;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt == null ? null : salt.trim();
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname == null ? null : nickname.trim();
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Long getCreateId() {
return createId;
}
public void setCreateId(Long createId) {
this.createId = createId;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public Long getUpdateId() {
return updateId;
}
public void setUpdateId(Long updateId) {
this.updateId = updateId;
}
public Byte getIsDelete() {
return isDelete;
}
public void setIsDelete(Byte isDelete) {
this.isDelete = isDelete;
}
public String getExtend1() {
return extend1;
}
public void setExtend1(String extend1) {
this.extend1 = extend1 == null ? null : extend1.trim();
}
public String getExtend2() {
return extend2;
}
public void setExtend2(String extend2) {
this.extend2 = extend2 == null ? null : extend2.trim();
}
public String getExtend3() {
return extend3;
}
public void setExtend3(String extend3) {
this.extend3 = extend3 == null ? null : extend3.trim();
}
public String getExtend4() {
return extend4;
}
public void setExtend4(String extend4) {
this.extend4 = extend4 == null ? null : extend4.trim();
}
@Override
public String toString() {
return "SmsUser{" +
"id=" + id +
", username='" + username + '\'' +
", password='" + password + '\'' +
", salt='" + salt + '\'' +
", nickname='" + nickname + '\'' +
", created=" + created +
", createId=" + createId +
", updated=" + updated +
", updateId=" + updateId +
", isDelete=" + isDelete +
", extend1='" + extend1 + '\'' +
", extend2='" + extend2 + '\'' +
", extend3='" + extend3 + '\'' +
", extend4='" + extend4 + '\'' +
'}';
}
}

@ -0,0 +1,30 @@
package com.mashibing.webmaster.mapper;
import com.mashibing.webmaster.entity.SmsMenu;
import com.mashibing.webmaster.entity.SmsMenuExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SmsMenuMapper {
long countByExample(SmsMenuExample example);
int deleteByExample(SmsMenuExample example);
int deleteByPrimaryKey(Integer id);
int insert(SmsMenu row);
int insertSelective(SmsMenu row);
List<SmsMenu> selectByExample(SmsMenuExample example);
SmsMenu selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("row") SmsMenu row, @Param("example") SmsMenuExample example);
int updateByExample(@Param("row") SmsMenu row, @Param("example") SmsMenuExample example);
int updateByPrimaryKeySelective(SmsMenu row);
int updateByPrimaryKey(SmsMenu row);
}

@ -0,0 +1,30 @@
package com.mashibing.webmaster.mapper;
import com.mashibing.webmaster.entity.SmsRole;
import com.mashibing.webmaster.entity.SmsRoleExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SmsRoleMapper {
long countByExample(SmsRoleExample example);
int deleteByExample(SmsRoleExample example);
int deleteByPrimaryKey(Integer id);
int insert(SmsRole row);
int insertSelective(SmsRole row);
List<SmsRole> selectByExample(SmsRoleExample example);
SmsRole selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("row") SmsRole row, @Param("example") SmsRoleExample example);
int updateByExample(@Param("row") SmsRole row, @Param("example") SmsRoleExample example);
int updateByPrimaryKeySelective(SmsRole row);
int updateByPrimaryKey(SmsRole row);
}

@ -0,0 +1,30 @@
package com.mashibing.webmaster.mapper;
import com.mashibing.webmaster.entity.SmsUser;
import com.mashibing.webmaster.entity.SmsUserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SmsUserMapper {
long countByExample(SmsUserExample example);
int deleteByExample(SmsUserExample example);
int deleteByPrimaryKey(Integer id);
int insert(SmsUser row);
int insertSelective(SmsUser row);
List<SmsUser> selectByExample(SmsUserExample example);
SmsUser selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("row") SmsUser row, @Param("example") SmsUserExample example);
int updateByExample(@Param("row") SmsUser row, @Param("example") SmsUserExample example);
int updateByPrimaryKeySelective(SmsUser row);
int updateByPrimaryKey(SmsUser row);
}

@ -5,6 +5,8 @@ package com.mashibing.webmaster.realm;
* @create 2024-03-29 1:55 * @create 2024-03-29 1:55
*/ */
import com.mashibing.webmaster.entity.SmsUser;
import com.mashibing.webmaster.service.SmsUserService;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.AuthenticationToken;
@ -14,6 +16,7 @@ import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource; import org.apache.shiro.util.ByteSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -24,6 +27,9 @@ import org.springframework.stereotype.Component;
@Component @Component
public class ShiroRealm extends AuthorizingRealm { public class ShiroRealm extends AuthorizingRealm {
@Autowired
private SmsUserService userService;
{ {
HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher(); HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher();
credentialsMatcher.setHashAlgorithmName("MD5"); credentialsMatcher.setHashAlgorithmName("MD5");
@ -43,15 +49,17 @@ public class ShiroRealm extends AuthorizingRealm {
String username = (String) token.getPrincipal(); String username = (String) token.getPrincipal();
//2、基于用户名获取用户信息(模拟数据库操作) //2、基于用户名获取用户信息(模拟数据库操作)
if(username == null || !username.equals("admin")) { SmsUser smsUser = userService.findByUsername(username);
//3、查询完毕后查看用户是否为null为null就直接返回即可
return null; //3、查询完毕后查看用户是否为null为null就直接返回即可
if(smsUser == null){
// 用户名错误
return null;
} }
String password = "b39dc5da02d002e6ac581e5bb929d2e5";
String salt = "09a8424ed5bf4373af6530fec2b29c0f";
//4、不为null说明用户名正确封装AuthenticationInfo返回即可,设置密码加密方式和信息 //4、不为null说明用户名正确封装AuthenticationInfo返回即可,设置密码加密方式和信息
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo("用户信息",password,"shiroRealm"); SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(smsUser,smsUser.getPassword(),"shiroRealm");
info.setCredentialsSalt(ByteSource.Util.bytes(salt)); info.setCredentialsSalt(ByteSource.Util.bytes(smsUser.getSalt()));
//5、返回 //5、返回
return info; return info;

@ -0,0 +1,13 @@
package com.mashibing.webmaster.service;
import com.mashibing.webmaster.entity.SmsUser;
/**
* @author dch
* @create 2024-03-29 10:40
*/
public interface SmsUserService {
public SmsUser findByUsername(String username);
}

@ -0,0 +1,33 @@
package com.mashibing.webmaster.service.impl;
import com.mashibing.webmaster.entity.SmsUser;
import com.mashibing.webmaster.entity.SmsUserExample;
import com.mashibing.webmaster.mapper.SmsUserMapper;
import com.mashibing.webmaster.service.SmsUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author dch
* @create 2024-03-29 10:41
*/
@Service
public class SmsUserServiceImpl implements SmsUserService {
@Resource
private SmsUserMapper userMapper;
@Override
public SmsUser findByUsername(String username) {
//1、封装查询条件
SmsUserExample example = new SmsUserExample();
SmsUserExample.Criteria criteria = example.createCriteria();
criteria.andUsernameEqualTo(username);
//2、基于userMapper查询
List<SmsUser> list = userMapper.selectByExample(example);
//3、返回
return list != null ? list.get(0) : null;
}
}

@ -1,3 +1,18 @@
# MyBatis和dataSource配置
spring:
datasource:
driver-class-name: org.gjt.mm.mysql.Driver
url: jdbc:mysql://192.168.1.121:3306/beacon_cloud?characterEncoding=utf-8
username: root
password: 1234
type: com.alibaba.druid.pool.DruidDataSource
# MyBatis
mybatis:
mapper-locations: classpath:mapper/*.xml
configuration:
map-underscore-to-camel-case: true
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
shiro: shiro:
# 默认登录页面 # 默认登录页面
loginUrl: /login.html loginUrl: /login.html

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 所有信息都在context里id是唯一标识targetRuntime在Mybatis3的环境-->
<context id="beaconCloud" targetRuntime="MyBatis3">
<!-- 去除注释-->
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.1.121:3306/beacon_cloud?characterEncoding=utf-8"
userId="root"
password="1234">
</jdbcConnection>
<javaTypeResolver >
<!-- 是否将decimal类型转换为Java中的BigDecimal默认false-->
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 将表对应的实体类生成,指定好位置-->
<javaModelGenerator targetPackage="com.mashibing.webmaster.entity" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<!-- 字符串get时去掉两边空格-->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 生成xml文件-->
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- 生成Mapper接口-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.mashibing.webmaster.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 生成那些表对应的信息-->
<table tableName="sms_user" domainObjectName="SmsUser" />
<table tableName="sms_role" domainObjectName="SmsRole" />
<table tableName="sms_menu" domainObjectName="SmsMenu" />
</context>
</generatorConfiguration>

@ -0,0 +1,385 @@
<?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.mashibing.webmaster.mapper.SmsMenuMapper">
<resultMap id="BaseResultMap" type="com.mashibing.webmaster.entity.SmsMenu">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="created" jdbcType="TIMESTAMP" property="created" />
<result column="create_id" jdbcType="BIGINT" property="createId" />
<result column="updated" jdbcType="TIMESTAMP" property="updated" />
<result column="update_id" jdbcType="BIGINT" property="updateId" />
<result column="is_delete" jdbcType="TINYINT" property="isDelete" />
<result column="extend1" jdbcType="VARCHAR" property="extend1" />
<result column="extend2" jdbcType="VARCHAR" property="extend2" />
<result column="extend3" jdbcType="VARCHAR" property="extend3" />
<result column="extend4" jdbcType="VARCHAR" property="extend4" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")">
<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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, name, parent_id, url, icon, type, sort, created, create_id, updated, update_id,
is_delete, extend1, extend2, extend3, extend4
</sql>
<select id="selectByExample" parameterType="com.mashibing.webmaster.entity.SmsMenuExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sms_menu
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sms_menu
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sms_menu
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.mashibing.webmaster.entity.SmsMenuExample">
delete from sms_menu
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.mashibing.webmaster.entity.SmsMenu">
insert into sms_menu (id, name, parent_id,
url, icon, type, sort,
created, create_id, updated,
update_id, is_delete, extend1,
extend2, extend3, extend4
)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT},
#{url,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER},
#{created,jdbcType=TIMESTAMP}, #{createId,jdbcType=BIGINT}, #{updated,jdbcType=TIMESTAMP},
#{updateId,jdbcType=BIGINT}, #{isDelete,jdbcType=TINYINT}, #{extend1,jdbcType=VARCHAR},
#{extend2,jdbcType=VARCHAR}, #{extend3,jdbcType=VARCHAR}, #{extend4,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.mashibing.webmaster.entity.SmsMenu">
insert into sms_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="url != null">
url,
</if>
<if test="icon != null">
icon,
</if>
<if test="type != null">
type,
</if>
<if test="sort != null">
sort,
</if>
<if test="created != null">
created,
</if>
<if test="createId != null">
create_id,
</if>
<if test="updated != null">
updated,
</if>
<if test="updateId != null">
update_id,
</if>
<if test="isDelete != null">
is_delete,
</if>
<if test="extend1 != null">
extend1,
</if>
<if test="extend2 != null">
extend2,
</if>
<if test="extend3 != null">
extend3,
</if>
<if test="extend4 != null">
extend4,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=BIGINT},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="icon != null">
#{icon,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="created != null">
#{created,jdbcType=TIMESTAMP},
</if>
<if test="createId != null">
#{createId,jdbcType=BIGINT},
</if>
<if test="updated != null">
#{updated,jdbcType=TIMESTAMP},
</if>
<if test="updateId != null">
#{updateId,jdbcType=BIGINT},
</if>
<if test="isDelete != null">
#{isDelete,jdbcType=TINYINT},
</if>
<if test="extend1 != null">
#{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
#{extend2,jdbcType=VARCHAR},
</if>
<if test="extend3 != null">
#{extend3,jdbcType=VARCHAR},
</if>
<if test="extend4 != null">
#{extend4,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.mashibing.webmaster.entity.SmsMenuExample" resultType="java.lang.Long">
select count(*) from sms_menu
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sms_menu
<set>
<if test="row.id != null">
id = #{row.id,jdbcType=INTEGER},
</if>
<if test="row.name != null">
name = #{row.name,jdbcType=VARCHAR},
</if>
<if test="row.parentId != null">
parent_id = #{row.parentId,jdbcType=BIGINT},
</if>
<if test="row.url != null">
url = #{row.url,jdbcType=VARCHAR},
</if>
<if test="row.icon != null">
icon = #{row.icon,jdbcType=VARCHAR},
</if>
<if test="row.type != null">
type = #{row.type,jdbcType=INTEGER},
</if>
<if test="row.sort != null">
sort = #{row.sort,jdbcType=INTEGER},
</if>
<if test="row.created != null">
created = #{row.created,jdbcType=TIMESTAMP},
</if>
<if test="row.createId != null">
create_id = #{row.createId,jdbcType=BIGINT},
</if>
<if test="row.updated != null">
updated = #{row.updated,jdbcType=TIMESTAMP},
</if>
<if test="row.updateId != null">
update_id = #{row.updateId,jdbcType=BIGINT},
</if>
<if test="row.isDelete != null">
is_delete = #{row.isDelete,jdbcType=TINYINT},
</if>
<if test="row.extend1 != null">
extend1 = #{row.extend1,jdbcType=VARCHAR},
</if>
<if test="row.extend2 != null">
extend2 = #{row.extend2,jdbcType=VARCHAR},
</if>
<if test="row.extend3 != null">
extend3 = #{row.extend3,jdbcType=VARCHAR},
</if>
<if test="row.extend4 != null">
extend4 = #{row.extend4,jdbcType=VARCHAR},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sms_menu
set id = #{row.id,jdbcType=INTEGER},
name = #{row.name,jdbcType=VARCHAR},
parent_id = #{row.parentId,jdbcType=BIGINT},
url = #{row.url,jdbcType=VARCHAR},
icon = #{row.icon,jdbcType=VARCHAR},
type = #{row.type,jdbcType=INTEGER},
sort = #{row.sort,jdbcType=INTEGER},
created = #{row.created,jdbcType=TIMESTAMP},
create_id = #{row.createId,jdbcType=BIGINT},
updated = #{row.updated,jdbcType=TIMESTAMP},
update_id = #{row.updateId,jdbcType=BIGINT},
is_delete = #{row.isDelete,jdbcType=TINYINT},
extend1 = #{row.extend1,jdbcType=VARCHAR},
extend2 = #{row.extend2,jdbcType=VARCHAR},
extend3 = #{row.extend3,jdbcType=VARCHAR},
extend4 = #{row.extend4,jdbcType=VARCHAR}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.mashibing.webmaster.entity.SmsMenu">
update sms_menu
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=BIGINT},
</if>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="icon != null">
icon = #{icon,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
<if test="createId != null">
create_id = #{createId,jdbcType=BIGINT},
</if>
<if test="updated != null">
updated = #{updated,jdbcType=TIMESTAMP},
</if>
<if test="updateId != null">
update_id = #{updateId,jdbcType=BIGINT},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=TINYINT},
</if>
<if test="extend1 != null">
extend1 = #{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
extend2 = #{extend2,jdbcType=VARCHAR},
</if>
<if test="extend3 != null">
extend3 = #{extend3,jdbcType=VARCHAR},
</if>
<if test="extend4 != null">
extend4 = #{extend4,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.mashibing.webmaster.entity.SmsMenu">
update sms_menu
set name = #{name,jdbcType=VARCHAR},
parent_id = #{parentId,jdbcType=BIGINT},
url = #{url,jdbcType=VARCHAR},
icon = #{icon,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
sort = #{sort,jdbcType=INTEGER},
created = #{created,jdbcType=TIMESTAMP},
create_id = #{createId,jdbcType=BIGINT},
updated = #{updated,jdbcType=TIMESTAMP},
update_id = #{updateId,jdbcType=BIGINT},
is_delete = #{isDelete,jdbcType=TINYINT},
extend1 = #{extend1,jdbcType=VARCHAR},
extend2 = #{extend2,jdbcType=VARCHAR},
extend3 = #{extend3,jdbcType=VARCHAR},
extend4 = #{extend4,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,306 @@
<?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.mashibing.webmaster.mapper.SmsRoleMapper">
<resultMap id="BaseResultMap" type="com.mashibing.webmaster.entity.SmsRole">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="created" jdbcType="TIMESTAMP" property="created" />
<result column="create_id" jdbcType="BIGINT" property="createId" />
<result column="updated" jdbcType="TIMESTAMP" property="updated" />
<result column="update_id" jdbcType="BIGINT" property="updateId" />
<result column="is_delete" jdbcType="TINYINT" property="isDelete" />
<result column="extend1" jdbcType="VARCHAR" property="extend1" />
<result column="extend2" jdbcType="VARCHAR" property="extend2" />
<result column="extend3" jdbcType="VARCHAR" property="extend3" />
<result column="extend4" jdbcType="VARCHAR" property="extend4" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")">
<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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, name, created, create_id, updated, update_id, is_delete, extend1, extend2, extend3,
extend4
</sql>
<select id="selectByExample" parameterType="com.mashibing.webmaster.entity.SmsRoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sms_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sms_role
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sms_role
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.mashibing.webmaster.entity.SmsRoleExample">
delete from sms_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.mashibing.webmaster.entity.SmsRole">
insert into sms_role (id, name, created,
create_id, updated, update_id,
is_delete, extend1, extend2,
extend3, extend4)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{created,jdbcType=TIMESTAMP},
#{createId,jdbcType=BIGINT}, #{updated,jdbcType=TIMESTAMP}, #{updateId,jdbcType=BIGINT},
#{isDelete,jdbcType=TINYINT}, #{extend1,jdbcType=VARCHAR}, #{extend2,jdbcType=VARCHAR},
#{extend3,jdbcType=VARCHAR}, #{extend4,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.mashibing.webmaster.entity.SmsRole">
insert into sms_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="created != null">
created,
</if>
<if test="createId != null">
create_id,
</if>
<if test="updated != null">
updated,
</if>
<if test="updateId != null">
update_id,
</if>
<if test="isDelete != null">
is_delete,
</if>
<if test="extend1 != null">
extend1,
</if>
<if test="extend2 != null">
extend2,
</if>
<if test="extend3 != null">
extend3,
</if>
<if test="extend4 != null">
extend4,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="created != null">
#{created,jdbcType=TIMESTAMP},
</if>
<if test="createId != null">
#{createId,jdbcType=BIGINT},
</if>
<if test="updated != null">
#{updated,jdbcType=TIMESTAMP},
</if>
<if test="updateId != null">
#{updateId,jdbcType=BIGINT},
</if>
<if test="isDelete != null">
#{isDelete,jdbcType=TINYINT},
</if>
<if test="extend1 != null">
#{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
#{extend2,jdbcType=VARCHAR},
</if>
<if test="extend3 != null">
#{extend3,jdbcType=VARCHAR},
</if>
<if test="extend4 != null">
#{extend4,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.mashibing.webmaster.entity.SmsRoleExample" resultType="java.lang.Long">
select count(*) from sms_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sms_role
<set>
<if test="row.id != null">
id = #{row.id,jdbcType=INTEGER},
</if>
<if test="row.name != null">
name = #{row.name,jdbcType=VARCHAR},
</if>
<if test="row.created != null">
created = #{row.created,jdbcType=TIMESTAMP},
</if>
<if test="row.createId != null">
create_id = #{row.createId,jdbcType=BIGINT},
</if>
<if test="row.updated != null">
updated = #{row.updated,jdbcType=TIMESTAMP},
</if>
<if test="row.updateId != null">
update_id = #{row.updateId,jdbcType=BIGINT},
</if>
<if test="row.isDelete != null">
is_delete = #{row.isDelete,jdbcType=TINYINT},
</if>
<if test="row.extend1 != null">
extend1 = #{row.extend1,jdbcType=VARCHAR},
</if>
<if test="row.extend2 != null">
extend2 = #{row.extend2,jdbcType=VARCHAR},
</if>
<if test="row.extend3 != null">
extend3 = #{row.extend3,jdbcType=VARCHAR},
</if>
<if test="row.extend4 != null">
extend4 = #{row.extend4,jdbcType=VARCHAR},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sms_role
set id = #{row.id,jdbcType=INTEGER},
name = #{row.name,jdbcType=VARCHAR},
created = #{row.created,jdbcType=TIMESTAMP},
create_id = #{row.createId,jdbcType=BIGINT},
updated = #{row.updated,jdbcType=TIMESTAMP},
update_id = #{row.updateId,jdbcType=BIGINT},
is_delete = #{row.isDelete,jdbcType=TINYINT},
extend1 = #{row.extend1,jdbcType=VARCHAR},
extend2 = #{row.extend2,jdbcType=VARCHAR},
extend3 = #{row.extend3,jdbcType=VARCHAR},
extend4 = #{row.extend4,jdbcType=VARCHAR}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.mashibing.webmaster.entity.SmsRole">
update sms_role
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
<if test="createId != null">
create_id = #{createId,jdbcType=BIGINT},
</if>
<if test="updated != null">
updated = #{updated,jdbcType=TIMESTAMP},
</if>
<if test="updateId != null">
update_id = #{updateId,jdbcType=BIGINT},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=TINYINT},
</if>
<if test="extend1 != null">
extend1 = #{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
extend2 = #{extend2,jdbcType=VARCHAR},
</if>
<if test="extend3 != null">
extend3 = #{extend3,jdbcType=VARCHAR},
</if>
<if test="extend4 != null">
extend4 = #{extend4,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.mashibing.webmaster.entity.SmsRole">
update sms_role
set name = #{name,jdbcType=VARCHAR},
created = #{created,jdbcType=TIMESTAMP},
create_id = #{createId,jdbcType=BIGINT},
updated = #{updated,jdbcType=TIMESTAMP},
update_id = #{updateId,jdbcType=BIGINT},
is_delete = #{isDelete,jdbcType=TINYINT},
extend1 = #{extend1,jdbcType=VARCHAR},
extend2 = #{extend2,jdbcType=VARCHAR},
extend3 = #{extend3,jdbcType=VARCHAR},
extend4 = #{extend4,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,353 @@
<?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.mashibing.webmaster.mapper.SmsUserMapper">
<resultMap id="BaseResultMap" type="com.mashibing.webmaster.entity.SmsUser">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="salt" jdbcType="VARCHAR" property="salt" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="created" jdbcType="TIMESTAMP" property="created" />
<result column="create_id" jdbcType="BIGINT" property="createId" />
<result column="updated" jdbcType="TIMESTAMP" property="updated" />
<result column="update_id" jdbcType="BIGINT" property="updateId" />
<result column="is_delete" jdbcType="TINYINT" property="isDelete" />
<result column="extend1" jdbcType="VARCHAR" property="extend1" />
<result column="extend2" jdbcType="VARCHAR" property="extend2" />
<result column="extend3" jdbcType="VARCHAR" property="extend3" />
<result column="extend4" jdbcType="VARCHAR" property="extend4" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")">
<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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, username, password, salt, nickname, created, create_id, updated, update_id, is_delete,
extend1, extend2, extend3, extend4
</sql>
<select id="selectByExample" parameterType="com.mashibing.webmaster.entity.SmsUserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sms_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sms_user
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sms_user
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.mashibing.webmaster.entity.SmsUserExample">
delete from sms_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.mashibing.webmaster.entity.SmsUser">
insert into sms_user (id, username, password,
salt, nickname, created,
create_id, updated, update_id,
is_delete, extend1, extend2,
extend3, extend4)
values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{salt,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, #{created,jdbcType=TIMESTAMP},
#{createId,jdbcType=BIGINT}, #{updated,jdbcType=TIMESTAMP}, #{updateId,jdbcType=BIGINT},
#{isDelete,jdbcType=TINYINT}, #{extend1,jdbcType=VARCHAR}, #{extend2,jdbcType=VARCHAR},
#{extend3,jdbcType=VARCHAR}, #{extend4,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.mashibing.webmaster.entity.SmsUser">
insert into sms_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="username != null">
username,
</if>
<if test="password != null">
password,
</if>
<if test="salt != null">
salt,
</if>
<if test="nickname != null">
nickname,
</if>
<if test="created != null">
created,
</if>
<if test="createId != null">
create_id,
</if>
<if test="updated != null">
updated,
</if>
<if test="updateId != null">
update_id,
</if>
<if test="isDelete != null">
is_delete,
</if>
<if test="extend1 != null">
extend1,
</if>
<if test="extend2 != null">
extend2,
</if>
<if test="extend3 != null">
extend3,
</if>
<if test="extend4 != null">
extend4,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="salt != null">
#{salt,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
#{nickname,jdbcType=VARCHAR},
</if>
<if test="created != null">
#{created,jdbcType=TIMESTAMP},
</if>
<if test="createId != null">
#{createId,jdbcType=BIGINT},
</if>
<if test="updated != null">
#{updated,jdbcType=TIMESTAMP},
</if>
<if test="updateId != null">
#{updateId,jdbcType=BIGINT},
</if>
<if test="isDelete != null">
#{isDelete,jdbcType=TINYINT},
</if>
<if test="extend1 != null">
#{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
#{extend2,jdbcType=VARCHAR},
</if>
<if test="extend3 != null">
#{extend3,jdbcType=VARCHAR},
</if>
<if test="extend4 != null">
#{extend4,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.mashibing.webmaster.entity.SmsUserExample" resultType="java.lang.Long">
select count(*) from sms_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sms_user
<set>
<if test="row.id != null">
id = #{row.id,jdbcType=INTEGER},
</if>
<if test="row.username != null">
username = #{row.username,jdbcType=VARCHAR},
</if>
<if test="row.password != null">
password = #{row.password,jdbcType=VARCHAR},
</if>
<if test="row.salt != null">
salt = #{row.salt,jdbcType=VARCHAR},
</if>
<if test="row.nickname != null">
nickname = #{row.nickname,jdbcType=VARCHAR},
</if>
<if test="row.created != null">
created = #{row.created,jdbcType=TIMESTAMP},
</if>
<if test="row.createId != null">
create_id = #{row.createId,jdbcType=BIGINT},
</if>
<if test="row.updated != null">
updated = #{row.updated,jdbcType=TIMESTAMP},
</if>
<if test="row.updateId != null">
update_id = #{row.updateId,jdbcType=BIGINT},
</if>
<if test="row.isDelete != null">
is_delete = #{row.isDelete,jdbcType=TINYINT},
</if>
<if test="row.extend1 != null">
extend1 = #{row.extend1,jdbcType=VARCHAR},
</if>
<if test="row.extend2 != null">
extend2 = #{row.extend2,jdbcType=VARCHAR},
</if>
<if test="row.extend3 != null">
extend3 = #{row.extend3,jdbcType=VARCHAR},
</if>
<if test="row.extend4 != null">
extend4 = #{row.extend4,jdbcType=VARCHAR},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sms_user
set id = #{row.id,jdbcType=INTEGER},
username = #{row.username,jdbcType=VARCHAR},
password = #{row.password,jdbcType=VARCHAR},
salt = #{row.salt,jdbcType=VARCHAR},
nickname = #{row.nickname,jdbcType=VARCHAR},
created = #{row.created,jdbcType=TIMESTAMP},
create_id = #{row.createId,jdbcType=BIGINT},
updated = #{row.updated,jdbcType=TIMESTAMP},
update_id = #{row.updateId,jdbcType=BIGINT},
is_delete = #{row.isDelete,jdbcType=TINYINT},
extend1 = #{row.extend1,jdbcType=VARCHAR},
extend2 = #{row.extend2,jdbcType=VARCHAR},
extend3 = #{row.extend3,jdbcType=VARCHAR},
extend4 = #{row.extend4,jdbcType=VARCHAR}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.mashibing.webmaster.entity.SmsUser">
update sms_user
<set>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="salt != null">
salt = #{salt,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
<if test="createId != null">
create_id = #{createId,jdbcType=BIGINT},
</if>
<if test="updated != null">
updated = #{updated,jdbcType=TIMESTAMP},
</if>
<if test="updateId != null">
update_id = #{updateId,jdbcType=BIGINT},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=TINYINT},
</if>
<if test="extend1 != null">
extend1 = #{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
extend2 = #{extend2,jdbcType=VARCHAR},
</if>
<if test="extend3 != null">
extend3 = #{extend3,jdbcType=VARCHAR},
</if>
<if test="extend4 != null">
extend4 = #{extend4,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.mashibing.webmaster.entity.SmsUser">
update sms_user
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
salt = #{salt,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},
created = #{created,jdbcType=TIMESTAMP},
create_id = #{createId,jdbcType=BIGINT},
updated = #{updated,jdbcType=TIMESTAMP},
update_id = #{updateId,jdbcType=BIGINT},
is_delete = #{isDelete,jdbcType=TINYINT},
extend1 = #{extend1,jdbcType=VARCHAR},
extend2 = #{extend2,jdbcType=VARCHAR},
extend3 = #{extend3,jdbcType=VARCHAR},
extend4 = #{extend4,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,33 @@
package com.mashibing.webmaster.mapper;
import com.mashibing.webmaster.entity.SmsUser;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import static org.junit.Assert.*;
/**
* @author dch
* @create 2024-03-29 10:32
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class SmsUserMapperTest {
@Autowired
private SmsUserMapper userMapper;
@Test
public void findById(){
SmsUser smsUser = userMapper.selectByPrimaryKey(1);
Assert.assertNotNull(smsUser);
System.out.println(smsUser);
}
}

@ -0,0 +1,27 @@
package com.mashibing.webmaster.mapper;
import com.mashibing.webmaster.entity.SmsUser;
import com.mashibing.webmaster.service.SmsUserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author dch
* @create 2024-03-29 10:43
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class SmsUserServiceTest {
@Autowired
private SmsUserService smsUserService;
@Test
public void findByUsername() {
SmsUser smsUser = smsUserService.findByUsername("admin");
System.out.println(smsUser);
}
}
Loading…
Cancel
Save