This commit is contained in:
shuo.wang
2025-04-12 18:52:03 +08:00
parent 49ec1df2c7
commit 8f15b46ab4
5 changed files with 124 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
package com.cool.store.dao;
import com.cool.store.entity.OldShopDO;
import com.cool.store.mapper.OldShopMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/12/18:36
* @Version 1.0
* @注释:
*/
@Repository
public class OldShopDAO {
@Resource
private OldShopMapper oldShopMapper;
public List<OldShopDO> getByMobile(String mobile) {
if (StringUtils.isBlank(mobile)){
return null;
}
Example example = new Example(OldShopDO.class);
example.createCriteria().andEqualTo("mobile", mobile);
return oldShopMapper.selectByExample(example);
}
}

View File

@@ -0,0 +1,14 @@
package com.cool.store.mapper;
import com.cool.store.entity.OldShopDO;
import tk.mybatis.mapper.common.BaseMapper;
import tk.mybatis.mapper.common.Mapper;
/**
* @Author: WangShuo
* @Date: 2025/04/12/18:33
* @Version 1.0
* @注释:
*/
public interface OldShopMapper extends Mapper<OldShopDO> {
}

View File

@@ -0,0 +1,17 @@
<?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">
<!--mybatis-3-mapper.dtd:约束文件的名称限制和检查在当前文件中出现的标签和属性符合mybatis的要求-->
<!--namespace命名空间要有唯一的值要求使用dao接口的权限定名称一个dao接口对应一个mappernamespace指明对应哪个dao接口-->
<mapper namespace="com.cool.store.mapper.OldShopMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.OldShopDO">
<result column="id" property="id" jdbcType="BIGINT"/>
<result column="shop_code" property="shopCode" jdbcType="VARCHAR"/>
<result column="shop_name" property="shopName" jdbcType="VARCHAR"/>
<result column="mobile" property="mobile" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, shop_code, shop_name,mobile, create_time, update_time
</sql>
</mapper>