数据库连接
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.SysAreaService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 地区层级表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-11-10 15:56:00
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/dict/sysarea")
|
||||
@Anonymous
|
||||
public class SysAreaController {
|
||||
|
||||
@Autowired
|
||||
private SysAreaService sysAreaService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult jobCategory(SysArea sysArea){
|
||||
return AjaxResult.success(sysAreaService.getList(sysArea));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地区层级表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-11-10 15:56:00
|
||||
*/
|
||||
public interface SysAreaMapper{
|
||||
|
||||
List<SysArea> getList(SysArea sysArea);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地区层级表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-11-10 15:56:00
|
||||
*/
|
||||
public interface SysAreaService{
|
||||
|
||||
List<SysArea> getList(SysArea sysArea);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.mapper.SysAreaMapper;
|
||||
import com.ruoyi.cms.service.SysAreaService;
|
||||
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysAreaServiceImpl implements SysAreaService {
|
||||
|
||||
@Autowired
|
||||
SysAreaMapper sysAreaMapper;
|
||||
|
||||
public List<SysArea> getList(SysArea sysArea){
|
||||
return sysAreaMapper.getList(sysArea);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.ruoyi.cms.mapper.SysAreaMapper">
|
||||
|
||||
<sql id="selectAreaVo">
|
||||
select id, code, name, parent_code, del_flag, create_by, create_time, update_by, update_time, remark from sys_area
|
||||
</sql>
|
||||
|
||||
<select id="getList" resultType="com.ruoyi.common.core.domain.entity.SysArea" parameterType="com.ruoyi.common.core.domain.entity.SysArea">
|
||||
<include refid="selectAreaVo"/>
|
||||
<where> del_flag = '0'
|
||||
<if test="name != null and name != ''"> and name like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
|
||||
<if test="code != null and code != ''"> and code =#{code}</if>
|
||||
<choose>
|
||||
<when test="parentCode != null and parentCode != ''">
|
||||
and parent_code =#{parentCode}
|
||||
</when>
|
||||
<otherwise>
|
||||
and parent_code is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
order by code
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user