HINOTOR 2 years ago
parent a26e102088
commit a31e7c2cf5

@ -1,11 +0,0 @@
CREATE TABLE `dianpingdb`.`user` (
`id` int NOT NULL AUTO_INCREMENT,
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`telephone` varchar(40) NOT NULL DEFAULT '',
`password` varchar(200) NOT NULL DEFAULT '',
`nick_name` varchar(40) NOT NULL DEFAULT '',
`gender` int NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE INDEX `telephone_unique_index`(`telephone`) USING BTREE
);

@ -8,11 +8,11 @@
<version>2.7.16</version> <version>2.7.16</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<groupId>com.imooc</groupId> <groupId>com.example</groupId>
<artifactId>dianping</artifactId> <artifactId>recommend</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>dianping</name> <name>recommend</name>
<description>dianping</description> <description>recommend</description>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -73,7 +73,7 @@
</dependencies> </dependencies>
<build> <build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (maybe moved to parent pom) -->
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.mybatis.generator</groupId> <groupId>org.mybatis.generator</groupId>

@ -1,17 +1,17 @@
package com.imooc.dianping; package com.example.recommend;
import org.mybatis.spring.annotation.MapperScan; 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;
import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.EnableAspectJAutoProxy;
@SpringBootApplication(scanBasePackages = {"com.imooc.dianping"}) @SpringBootApplication(scanBasePackages = {"com.example.recommend"})
@MapperScan("com.imooc.dianping.dal") @MapperScan("com.example.recommend.dal")
@EnableAspectJAutoProxy(proxyTargetClass = true) @EnableAspectJAutoProxy(proxyTargetClass = true)
public class DianpingApplication { public class RecommendApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(DianpingApplication.class, args); SpringApplication.run(RecommendApplication.class, args);
} }
} }

@ -1,4 +1,4 @@
package com.imooc.dianping.common; package com.example.recommend.common;
public class BusinessException extends Exception { public class BusinessException extends Exception {
private CommonError commonError; private CommonError commonError;

@ -1,4 +1,4 @@
package com.imooc.dianping.common; package com.example.recommend.common;
public class CommonError { public class CommonError {
//错误码 //错误码

@ -1,4 +1,4 @@
package com.imooc.dianping.common; package com.example.recommend.common;
public class CommonRes { public class CommonRes {
//表明读经请求的返回处理结果,"success"或"fail" //表明读经请求的返回处理结果,"success"或"fail"

@ -1,4 +1,4 @@
package com.imooc.dianping.common; package com.example.recommend.common;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError; import org.springframework.validation.FieldError;

@ -1,4 +1,4 @@
package com.imooc.dianping.common; package com.example.recommend.common;
public enum EmBusinessError { public enum EmBusinessError {
//通用的错误类型10000开头 //通用的错误类型10000开头

@ -1,4 +1,4 @@
package com.imooc.dianping.common; package com.example.recommend.common;
import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;

@ -1,12 +1,12 @@
package com.imooc.dianping.controller; package com.example.recommend.controller;
import com.imooc.dianping.common.BusinessException; import com.example.recommend.common.BusinessException;
import com.imooc.dianping.common.CommonRes; import com.example.recommend.common.CommonRes;
import com.imooc.dianping.common.CommonUtil; import com.example.recommend.common.CommonUtil;
import com.imooc.dianping.common.EmBusinessError; import com.example.recommend.common.EmBusinessError;
import com.imooc.dianping.model.UserModel; import com.example.recommend.request.RegisterReq;
import com.imooc.dianping.request.RegisterReq; import com.example.recommend.service.UserService;
import com.imooc.dianping.service.UserService; import com.example.recommend.model.UserModel;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;

@ -1,13 +1,13 @@
package com.imooc.dianping.dal; package com.example.recommend.dal;
import com.imooc.dianping.model.UserModel; import com.example.recommend.model.UserModel;
public interface UserModelMapper { public interface UserModelMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table user * This method corresponds to the database table user
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
@ -15,7 +15,7 @@ public interface UserModelMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table user * This method corresponds to the database table user
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
int insert(UserModel record); int insert(UserModel record);
@ -23,7 +23,7 @@ public interface UserModelMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table user * This method corresponds to the database table user
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
int insertSelective(UserModel record); int insertSelective(UserModel record);
@ -31,7 +31,7 @@ public interface UserModelMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table user * This method corresponds to the database table user
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
UserModel selectByPrimaryKey(Integer id); UserModel selectByPrimaryKey(Integer id);
@ -39,7 +39,7 @@ public interface UserModelMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table user * This method corresponds to the database table user
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
int updateByPrimaryKeySelective(UserModel record); int updateByPrimaryKeySelective(UserModel record);
@ -47,7 +47,7 @@ public interface UserModelMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table user * This method corresponds to the database table user
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
int updateByPrimaryKey(UserModel record); int updateByPrimaryKey(UserModel record);
} }

@ -1,4 +1,4 @@
package com.imooc.dianping.model; package com.example.recommend.model;
import java.util.Date; import java.util.Date;
@ -8,7 +8,7 @@ public class UserModel {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column user.id * This field corresponds to the database column user.id
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
private Integer id; private Integer id;
@ -17,7 +17,7 @@ public class UserModel {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column user.created_at * This field corresponds to the database column user.created_at
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
private Date createdAt; private Date createdAt;
@ -26,7 +26,7 @@ public class UserModel {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column user.updated_at * This field corresponds to the database column user.updated_at
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
private Date updatedAt; private Date updatedAt;
@ -35,7 +35,7 @@ public class UserModel {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column user.telephone * This field corresponds to the database column user.telephone
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
private String telephone; private String telephone;
@ -44,7 +44,7 @@ public class UserModel {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column user.password * This field corresponds to the database column user.password
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
private String password; private String password;
@ -53,7 +53,7 @@ public class UserModel {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column user.nick_name * This field corresponds to the database column user.nick_name
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
private String nickName; private String nickName;
@ -62,7 +62,7 @@ public class UserModel {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column user.gender * This field corresponds to the database column user.gender
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
private Integer gender; private Integer gender;
@ -72,7 +72,7 @@ public class UserModel {
* *
* @return the value of user.id * @return the value of user.id
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public Integer getId() { public Integer getId() {
return id; return id;
@ -84,7 +84,7 @@ public class UserModel {
* *
* @param id the value for user.id * @param id the value for user.id
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
@ -96,7 +96,7 @@ public class UserModel {
* *
* @return the value of user.created_at * @return the value of user.created_at
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public Date getCreatedAt() { public Date getCreatedAt() {
return createdAt; return createdAt;
@ -108,7 +108,7 @@ public class UserModel {
* *
* @param createdAt the value for user.created_at * @param createdAt the value for user.created_at
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public void setCreatedAt(Date createdAt) { public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt; this.createdAt = createdAt;
@ -120,7 +120,7 @@ public class UserModel {
* *
* @return the value of user.updated_at * @return the value of user.updated_at
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public Date getUpdatedAt() { public Date getUpdatedAt() {
return updatedAt; return updatedAt;
@ -132,7 +132,7 @@ public class UserModel {
* *
* @param updatedAt the value for user.updated_at * @param updatedAt the value for user.updated_at
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public void setUpdatedAt(Date updatedAt) { public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
@ -144,7 +144,7 @@ public class UserModel {
* *
* @return the value of user.telephone * @return the value of user.telephone
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public String getTelephone() { public String getTelephone() {
return telephone; return telephone;
@ -156,7 +156,7 @@ public class UserModel {
* *
* @param telephone the value for user.telephone * @param telephone the value for user.telephone
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public void setTelephone(String telephone) { public void setTelephone(String telephone) {
this.telephone = telephone == null ? null : telephone.trim(); this.telephone = telephone == null ? null : telephone.trim();
@ -168,7 +168,7 @@ public class UserModel {
* *
* @return the value of user.password * @return the value of user.password
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public String getPassword() { public String getPassword() {
return password; return password;
@ -180,7 +180,7 @@ public class UserModel {
* *
* @param password the value for user.password * @param password the value for user.password
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public void setPassword(String password) { public void setPassword(String password) {
this.password = password == null ? null : password.trim(); this.password = password == null ? null : password.trim();
@ -192,7 +192,7 @@ public class UserModel {
* *
* @return the value of user.nick_name * @return the value of user.nick_name
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public String getNickName() { public String getNickName() {
return nickName; return nickName;
@ -204,7 +204,7 @@ public class UserModel {
* *
* @param nickName the value for user.nick_name * @param nickName the value for user.nick_name
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public void setNickName(String nickName) { public void setNickName(String nickName) {
this.nickName = nickName == null ? null : nickName.trim(); this.nickName = nickName == null ? null : nickName.trim();
@ -216,7 +216,7 @@ public class UserModel {
* *
* @return the value of user.gender * @return the value of user.gender
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public Integer getGender() { public Integer getGender() {
return gender; return gender;
@ -228,7 +228,7 @@ public class UserModel {
* *
* @param gender the value for user.gender * @param gender the value for user.gender
* *
* @mbg.generated Fri Oct 06 13:41:12 CST 2023 * @mbg.generated Mon Oct 09 13:50:54 CST 2023
*/ */
public void setGender(Integer gender) { public void setGender(Integer gender) {
this.gender = gender; this.gender = gender;

@ -1,4 +1,4 @@
package com.imooc.dianping.request; package com.example.recommend.request;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;

@ -1,7 +1,7 @@
package com.imooc.dianping.service; package com.example.recommend.service;
import com.imooc.dianping.common.BusinessException; import com.example.recommend.common.BusinessException;
import com.imooc.dianping.model.UserModel; import com.example.recommend.model.UserModel;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -11,7 +11,7 @@ public interface UserService {
UserModel register(UserModel registerUser) throws BusinessException, UnsupportedEncodingException, NoSuchAlgorithmException; UserModel register(UserModel registerUser) throws BusinessException, UnsupportedEncodingException, NoSuchAlgorithmException;
UserModel login(String telphone, String password) throws UnsupportedEncodingException, NoSuchAlgorithmException, BusinessException; UserModel login(String telephone, String password) throws UnsupportedEncodingException, NoSuchAlgorithmException, BusinessException;
Integer countAllUser(); Integer countAllUser();
} }

@ -1,10 +1,10 @@
package com.imooc.dianping.service.impl; package com.example.recommend.service.impl;
import com.imooc.dianping.common.BusinessException; import com.example.recommend.common.BusinessException;
import com.imooc.dianping.common.EmBusinessError; import com.example.recommend.common.EmBusinessError;
import com.imooc.dianping.dal.UserModelMapper; import com.example.recommend.dal.UserModelMapper;
import com.imooc.dianping.model.UserModel; import com.example.recommend.model.UserModel;
import com.imooc.dianping.service.UserService; import com.example.recommend.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -43,7 +43,7 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public UserModel login(String telphone, String password) throws UnsupportedEncodingException, NoSuchAlgorithmException, BusinessException { public UserModel login(String telephone, String password) throws UnsupportedEncodingException, NoSuchAlgorithmException, BusinessException {
return null; return null;
} }

@ -1,8 +1,8 @@
server.port=8010 server.port=8010
mybatis.mapperLocations=classpath:mapping/*.xml mybatis.mapperLocations=classpath:mapping/*.xml
#??????????? #???????????
spring.datasource.name=dianpingdb spring.datasource.name=recommenddb
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/dianpingdb?useUnicode=true&characterEncoding=UTF-8&useSSL=false spring.datasource.url=jdbc:mysql://127.0.0.1:3306/recommenddb?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=123456 spring.datasource.password=123456
#??druid?????? #??druid??????

@ -0,0 +1,12 @@
CREATE TABLE `recommenddb`.`user`
(
`id` int NOT NULL AUTO_INCREMENT,
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`telephone` varchar(40) NOT NULL DEFAULT '',
`password` varchar(200) NOT NULL DEFAULT '',
`nick_name` varchar(40) NOT NULL DEFAULT '',
`gender` int NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE INDEX `telephone_unique_index` (`telephone`) USING BTREE
);

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.imooc.dianping.dal.UserModelMapper"> <mapper namespace="com.example.recommend.dal.UserModelMapper">
<resultMap id="BaseResultMap" type="com.imooc.dianping.model.UserModel"> <resultMap id="BaseResultMap" type="com.example.recommend.model.UserModel">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
@ -19,7 +19,7 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
id, created_at, updated_at, telephone, password, nick_name, gender id, created_at, updated_at, telephone, password, nick_name, gender
</sql> </sql>
@ -27,7 +27,7 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
@ -38,16 +38,16 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
delete from user delete from user
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" parameterType="com.imooc.dianping.model.UserModel"> <insert id="insert" parameterType="com.example.recommend.model.UserModel">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
@ -59,11 +59,11 @@
#{password,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER} #{password,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.imooc.dianping.model.UserModel"> <insert id="insertSelective" parameterType="com.example.recommend.model.UserModel">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
@ -110,11 +110,11 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.imooc.dianping.model.UserModel"> <update id="updateByPrimaryKeySelective" parameterType="com.example.recommend.model.UserModel">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
update user update user
<set> <set>
@ -139,11 +139,11 @@
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.imooc.dianping.model.UserModel"> <update id="updateByPrimaryKey" parameterType="com.example.recommend.model.UserModel">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Oct 06 13:41:12 CST 2023. This element was generated on Mon Oct 09 13:50:54 CST 2023.
--> -->
update user update user
set created_at = #{createdAt,jdbcType=TIMESTAMP}, set created_at = #{createdAt,jdbcType=TIMESTAMP},

@ -4,12 +4,14 @@
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration> <generatorConfiguration>
<context id="DB2Tables" targetRuntime="MyBatis3"> <context id="DB2Tables" targetRuntime="MyBatis3">
<!--数据库链接地址账号密码--> <!--数据库链接地址账号密码-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/dianpingdb?characterEncoding=utf8&amp;useSSL=false" userId="root" password="123456"> <jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/recommenddb?characterEncoding=utf8&amp;useSSL=false"
userId="root" password="123456">
</jdbcConnection> </jdbcConnection>
<!--生成DataObject类存放位置--> <!--生成DataObject类存放位置-->
<javaModelGenerator targetPackage="com.imooc.dianping.model" targetProject="src/main/java"> <javaModelGenerator targetPackage="com.example.recommend.model" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/> <property name="trimStrings" value="true"/>
</javaModelGenerator> </javaModelGenerator>
@ -23,7 +25,7 @@
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口
--> -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.imooc.dianping.dal" targetProject="src/main/java"> <javaClientGenerator type="XMLMAPPER" targetPackage="com.example.recommend.dal" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</javaClientGenerator> </javaClientGenerator>
@ -36,10 +38,10 @@
enableUpdateByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false"></table> enableSelectByExample="false" selectByExampleQueryId="false"></table>
--> -->
<table tableName="user" domainObjectName="UserModel" enableCountByExample="false" <table tableName="user" domainObjectName="UserModel" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false"> enableSelectByExample="false" selectByExampleQueryId="false">
<generatedKey column="id" sqlStatement="MySql" identity="true" /> <generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table> </table>
</context> </context>

@ -1,13 +1,13 @@
package com.imooc.dianping; package com.example.recommend;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest @SpringBootTest
class DianpingApplicationTests { class RecommendApplicationTests {
@Test @Test
void contextLoads() { void contextLoads() {
} }
} }
Loading…
Cancel
Save