Complishing the search of area.
This commit is contained in:
parent
f2c8c125a8
commit
1aee8e8d76
@ -0,0 +1,31 @@
|
||||
package com.xhpc.general.controller;
|
||||
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.general.service.IXhpcAreaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-26 15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/area")
|
||||
public class XhpcAreaController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcAreaService iXhpcAreaService;
|
||||
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
public TableDataInfo list (Integer code){
|
||||
|
||||
startPage();
|
||||
return getDataTable(iXhpcAreaService.list(code));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xhpc.general.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-26 15
|
||||
*/
|
||||
public interface XhpcAreaMapper {
|
||||
|
||||
List<Map<String,Object>> selectBy(@Param(value = "code") Integer code);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xhpc.general.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-26 15
|
||||
*/
|
||||
public interface IXhpcAreaService {
|
||||
|
||||
List<Map<String,Object>> list(Integer code);
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xhpc.general.service;
|
||||
|
||||
import com.xhpc.general.mapper.XhpcAreaMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-26 15
|
||||
*/
|
||||
@Service
|
||||
public class XhpcAreaServiceImpl implements IXhpcAreaService {
|
||||
|
||||
@Autowired
|
||||
private XhpcAreaMapper xhpcAreaMapper;
|
||||
@Override
|
||||
public List<Map<String, Object>> list(Integer code) {
|
||||
|
||||
return xhpcAreaMapper.selectBy(code);
|
||||
}
|
||||
}
|
||||
@ -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">
|
||||
<mapper namespace="com.xhpc.general.mapper.XhpcAreaMapper">
|
||||
|
||||
<select id="selectBy" resultType="map">
|
||||
select name, code
|
||||
from xhpc_area
|
||||
<if test="code != null and code != ''">
|
||||
where pcode = #{code}
|
||||
</if>
|
||||
<if test="code == null || code == ''">
|
||||
where pcode = 100000
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user