feat:新管家
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.dto.region.BigRegionDTO;
|
||||
import com.cool.store.entity.BigRegionDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.BigRegionMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/5/9 14:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Repository
|
||||
public class BigRegionDAO {
|
||||
|
||||
@Resource
|
||||
BigRegionMapper bigRegionMapper;
|
||||
|
||||
public List<BigRegionDTO> queryAllBigRegion(String keyword){
|
||||
return bigRegionMapper.queryAllBigRegion(keyword);
|
||||
}
|
||||
|
||||
public BigRegionDO queryOrgInfoByBigRegionAndJoinMode(Long regionId, Integer joinMode){
|
||||
if (regionId==null||joinMode==null){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||
}
|
||||
return bigRegionMapper.queryOrgInfoByBigRegionAndJoinMode(regionId,joinMode);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.region.BigRegionDTO;
|
||||
import com.cool.store.entity.BigRegionDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BigRegionMapper extends Mapper<BigRegionDO> {
|
||||
|
||||
/**
|
||||
* 根据关键字查询大区
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
List<BigRegionDTO> queryAllBigRegion(String keyword);
|
||||
|
||||
/**
|
||||
* 根据所属大区与加盟模式查询新管家信息
|
||||
* 注意:加盟模式不能直接传加盟模式 对于加盟自有店 传1 对于其他店 传0
|
||||
* @param regionId
|
||||
* @param joinMode
|
||||
* @return
|
||||
*/
|
||||
BigRegionDO queryOrgInfoByBigRegionAndJoinMode(Long regionId,Integer joinMode);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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.cool.store.mapper.BigRegionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.BigRegionDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="region_id" jdbcType="BIGINT" property="regionId" />
|
||||
<result column="region_name" jdbcType="VARCHAR" property="regionName" />
|
||||
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
|
||||
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
|
||||
<result column="org_name" jdbcType="VARCHAR" property="orgName" />
|
||||
<result column="join_mode" jdbcType="TINYINT" property="joinMode" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="queryAllBigRegion" resultType="com.cool.store.dto.region.BigRegionDTO">
|
||||
select DISTINCT
|
||||
region_id as regionId,
|
||||
region_name as regionName
|
||||
FROM `xfsg_big_region`
|
||||
<where>
|
||||
<if test="keyword!=null and keyword !=''">
|
||||
and region_name like CONCAT('%',#{keyword},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryOrgInfoByBigRegionAndJoinMode" resultMap="BaseResultMap">
|
||||
select *
|
||||
FROM `xfsg_big_region`
|
||||
<where>
|
||||
<if test="regionId !=null ">
|
||||
and region_id = #{regionId}
|
||||
</if>
|
||||
<if test="joinMode !=null ">
|
||||
and join_mode = #{joinMode}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user