Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
store-system
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luoyangfei
store-system
Commits
f11f3e9a
Commit
f11f3e9a
authored
Nov 12, 2018
by
wangyihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 省 市 区县 接口
parent
487cabe9
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1812 additions
and
0 deletions
+1812
-0
PCAController.java
...rc/main/java/cn/com/fqy/controller/mgt/PCAController.java
+104
-0
AreaDao.java
...ore-system/src/main/java/cn/com/fqy/core/dao/AreaDao.java
+11
-0
CityDao.java
...ore-system/src/main/java/cn/com/fqy/core/dao/CityDao.java
+11
-0
ProvinceDao.java
...system/src/main/java/cn/com/fqy/core/dao/ProvinceDao.java
+11
-0
Area.java
...tore-system/src/main/java/cn/com/fqy/core/model/Area.java
+84
-0
City.java
...tore-system/src/main/java/cn/com/fqy/core/model/City.java
+84
-0
Province.java
...-system/src/main/java/cn/com/fqy/core/model/Province.java
+75
-0
AreaService.java
...em/src/main/java/cn/com/fqy/core/service/AreaService.java
+81
-0
CityService.java
...em/src/main/java/cn/com/fqy/core/service/CityService.java
+82
-0
ProvinceService.java
...rc/main/java/cn/com/fqy/core/service/ProvinceService.java
+82
-0
AreaServiceImpl.java
...in/java/cn/com/fqy/core/service/impl/AreaServiceImpl.java
+277
-0
CityServiceImpl.java
...in/java/cn/com/fqy/core/service/impl/CityServiceImpl.java
+278
-0
ProvinceServiceImpl.java
...ava/cn/com/fqy/core/service/impl/ProvinceServiceImpl.java
+278
-0
AreaMapper.xml
...e-system/src/main/resources/mybatis/mapper/AreaMapper.xml
+121
-0
CityMapper.xml
...e-system/src/main/resources/mybatis/mapper/CityMapper.xml
+121
-0
ProvinceMapper.xml
...stem/src/main/resources/mybatis/mapper/ProvinceMapper.xml
+112
-0
No files found.
2code/server/store-system/src/main/java/cn/com/fqy/controller/mgt/PCAController.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
controller
.
mgt
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
cn.com.fqy.common.ResultInfo
;
import
cn.com.fqy.core.common.BaseController
;
import
cn.com.fqy.core.model.Area
;
import
cn.com.fqy.core.model.City
;
import
cn.com.fqy.core.model.Province
;
import
cn.com.fqy.core.model.Query
;
import
cn.com.fqy.core.service.AreaService
;
import
cn.com.fqy.core.service.CityService
;
import
cn.com.fqy.core.service.ProvinceService
;
@Controller
@RequestMapping
(
"pca"
)
public
class
PCAController
extends
BaseController
{
@Resource
private
ProvinceService
provinceService
;
@Resource
private
CityService
cityService
;
@Resource
private
AreaService
areaService
;
/**
* 省、市
* @return
*/
@RequestMapping
(
"getProviceList"
)
@ResponseBody
public
ResultInfo
<
List
<
Province
>>
getProviceList
(){
ResultInfo
<
List
<
Province
>>
resultInfo
=
new
ResultInfo
<>();
List
<
Province
>
proList
=
provinceService
.
getProvinceList
(
new
Query
());
if
(
proList
.
size
()>
0
&&
proList
!=
null
)
{
resultInfo
.
setCode
(
"1"
);
resultInfo
.
setData
(
proList
);
}
else
{
resultInfo
.
setCode
(
"0"
);
resultInfo
.
setMsg
(
"暂无省/市数据"
);
}
return
resultInfo
;
}
/**
* 市
* @param codeP
* @return
*/
@RequestMapping
(
"getCityList"
)
@ResponseBody
public
ResultInfo
<
List
<
City
>>
getCityList
(
String
codeP
){
ResultInfo
<
List
<
City
>>
resultInfo
=
new
ResultInfo
<>();
if
(
codeP
==
null
||
""
.
equals
(
codeP
))
{
resultInfo
.
setCode
(
"0"
);
resultInfo
.
setMsg
(
"参数省编号为空"
);
}
City
city
=
new
City
();
city
.
setCodeP
(
codeP
);
List
<
City
>
cityList
=
cityService
.
getCityList
(
new
Query
(
city
));
if
(
cityList
.
size
()>
0
&&
cityList
!=
null
)
{
resultInfo
.
setCode
(
"1"
);
resultInfo
.
setData
(
cityList
);
}
else
{
resultInfo
.
setCode
(
"0"
);
resultInfo
.
setMsg
(
"暂无区数据"
);
}
return
resultInfo
;
}
/**
* 区、县
* @param codeC
* @return
*/
@RequestMapping
(
"getAreaList"
)
@ResponseBody
public
ResultInfo
<
List
<
Area
>>
getAreaList
(
String
codeC
){
ResultInfo
<
List
<
Area
>>
resultInfo
=
new
ResultInfo
<>();
if
(
codeC
==
null
||
""
.
equals
(
codeC
))
{
resultInfo
.
setCode
(
"0"
);
resultInfo
.
setMsg
(
"参数区编号为空"
);
}
Area
area
=
new
Area
();
area
.
setCodeC
(
codeC
);
List
<
Area
>
areaList
=
areaService
.
getAreaList
(
new
Query
(
area
));
if
(
areaList
.
size
()>
0
&&
areaList
!=
null
)
{
resultInfo
.
setCode
(
"1"
);
resultInfo
.
setData
(
areaList
);
}
else
{
resultInfo
.
setCode
(
"0"
);
resultInfo
.
setMsg
(
"暂无县数据"
);
}
return
resultInfo
;
}
}
2code/server/store-system/src/main/java/cn/com/fqy/core/dao/AreaDao.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
dao
;
import
cn.com.fqy.core.common.BaseDao
;
import
cn.com.fqy.core.model.Area
;
/**
* 该实体为行政区域划分等级 数据库处理类
*/
public
interface
AreaDao
extends
BaseDao
<
Area
,
String
>
{
}
2code/server/store-system/src/main/java/cn/com/fqy/core/dao/CityDao.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
dao
;
import
cn.com.fqy.core.common.BaseDao
;
import
cn.com.fqy.core.model.City
;
/**
* 该实体为行政区域划分等级 数据库处理类
*/
public
interface
CityDao
extends
BaseDao
<
City
,
String
>
{
}
2code/server/store-system/src/main/java/cn/com/fqy/core/dao/ProvinceDao.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
dao
;
import
cn.com.fqy.core.common.BaseDao
;
import
cn.com.fqy.core.model.Province
;
/**
* 该实体为行政区域划分等级 数据库处理类
*/
public
interface
ProvinceDao
extends
BaseDao
<
Province
,
String
>
{
}
2code/server/store-system/src/main/java/cn/com/fqy/core/model/Area.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
model
;
import
cn.com.fqy.common.Entity
;
/**
* 该实体为行政区域划分等级 数据实体类
*/
public
class
Area
extends
Entity
<
String
>
{
private
static
final
long
serialVersionUID
=
1
l
;
/*Auto generated properties start*/
private
String
id
;
private
String
codeA
;
private
String
name
;
private
String
codeC
;
/*Auto generated properties end*/
/*Customized properties start*/
/*Customized properties end*/
/*Auto generated methods start*/
@Override
public
String
getPK
(){
return
codeA
;
}
public
String
getId
(){
return
id
;
}
public
void
setId
(
String
id
){
this
.
id
=
id
;
}
public
String
getCodeA
(){
return
codeA
;
}
public
void
setCodeA
(
String
codeA
){
this
.
codeA
=
codeA
;
}
public
String
getName
(){
return
name
;
}
public
void
setName
(
String
name
){
this
.
name
=
name
;
}
public
String
getCodeC
(){
return
codeC
;
}
public
void
setCodeC
(
String
codeC
){
this
.
codeC
=
codeC
;
}
/*Auto generated methods end*/
/*Customized methods start*/
/*Customized methods end*/
@Override
public
String
toString
()
{
return
"Area ["
+
"id = "
+
id
+
", codeA = "
+
codeA
+
", name = "
+
name
+
", codeC = "
+
codeC
+
"]"
;
}
}
2code/server/store-system/src/main/java/cn/com/fqy/core/model/City.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
model
;
import
cn.com.fqy.common.Entity
;
/**
* 该实体为行政区域划分等级 数据实体类
*/
public
class
City
extends
Entity
<
String
>
{
private
static
final
long
serialVersionUID
=
1
l
;
/*Auto generated properties start*/
private
String
id
;
private
String
codeC
;
private
String
name
;
private
String
codeP
;
/*Auto generated properties end*/
/*Customized properties start*/
/*Customized properties end*/
/*Auto generated methods start*/
@Override
public
String
getPK
(){
return
codeC
;
}
public
String
getId
(){
return
id
;
}
public
void
setId
(
String
id
){
this
.
id
=
id
;
}
public
String
getCodeC
(){
return
codeC
;
}
public
void
setCodeC
(
String
codeC
){
this
.
codeC
=
codeC
;
}
public
String
getName
(){
return
name
;
}
public
void
setName
(
String
name
){
this
.
name
=
name
;
}
public
String
getCodeP
(){
return
codeP
;
}
public
void
setCodeP
(
String
codeP
){
this
.
codeP
=
codeP
;
}
/*Auto generated methods end*/
/*Customized methods start*/
/*Customized methods end*/
@Override
public
String
toString
()
{
return
"City ["
+
"id = "
+
id
+
", codeC = "
+
codeC
+
", name = "
+
name
+
", codeP = "
+
codeP
+
"]"
;
}
}
2code/server/store-system/src/main/java/cn/com/fqy/core/model/Province.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
model
;
import
cn.com.fqy.common.Entity
;
/**
* 该实体为行政区域划分等级 数据实体类
*/
public
class
Province
extends
Entity
<
String
>
{
private
static
final
long
serialVersionUID
=
1
l
;
/*Auto generated properties start*/
private
String
id
;
private
String
codeP
;
private
String
name
;
/*Auto generated properties end*/
/*Customized properties start*/
/*Customized properties end*/
/*Auto generated methods start*/
@Override
public
String
getPK
(){
return
codeP
;
}
public
String
getId
(){
return
id
;
}
public
void
setId
(
String
id
){
this
.
id
=
id
;
}
public
String
getCodeP
(){
return
codeP
;
}
public
void
setCodeP
(
String
codeP
){
this
.
codeP
=
codeP
;
}
public
String
getName
(){
return
name
;
}
public
void
setName
(
String
name
){
this
.
name
=
name
;
}
/*Auto generated methods end*/
/*Customized methods start*/
/*Customized methods end*/
@Override
public
String
toString
()
{
return
"Province ["
+
"id = "
+
id
+
", codeP = "
+
codeP
+
", name = "
+
name
+
"]"
;
}
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/AreaService.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
service
;
import
java.util.List
;
import
cn.com.fqy.common.Operator
;
import
cn.com.fqy.common.ResultInfo
;
import
cn.com.fqy.core.common.BaseService
;
import
cn.com.fqy.core.common.PageFinder
;
import
cn.com.fqy.core.model.Area
;
import
cn.com.fqy.core.model.Query
;
/**
* 该实体为行政区域划分等级 服务接口类
*/
public
interface
AreaService
extends
BaseService
{
/**
* 根据查询条件,查询并返回Area的列表
* @param q 查询条件
* @return
*/
public
List
<
Area
>
getAreaList
(
Query
q
);
/**
* 根据查询条件,分页查询并返回Area的分页结果
* @param q 查询条件
* @return
*/
public
PageFinder
<
Area
>
getAreaPagedList
(
Query
q
);
/**
* 根据主键,查询并返回一个Area对象
* @param id 主键id
* @return
*/
public
Area
getArea
(
String
id
);
/**
* 根据主键数组,查询并返回一组Area对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
public
List
<
Area
>
getAreaByIds
(
String
[]
ids
);
/**
* 根据主键,删除特定的Area记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
Area
>
delArea
(
String
id
,
Operator
operator
);
/**
* 新增一条Area记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param area 新增的Area数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
Area
>
addArea
(
Area
area
,
Operator
operator
);
/**
* 根据主键,更新一条Area记录
* @param area 更新的Area数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
Area
>
updateArea
(
Area
area
,
Operator
operator
);
/**
* 生成主键
* @return
*/
public
String
generatePK
();
/**
* 为Area对象设置默认值
* @param obj
*/
public
void
fillDefaultValues
(
Area
obj
);
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/CityService.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
service
;
import
java.util.List
;
import
cn.com.fqy.common.Operator
;
import
cn.com.fqy.common.ResultInfo
;
import
cn.com.fqy.core.common.BaseService
;
import
cn.com.fqy.core.common.PageFinder
;
import
cn.com.fqy.core.model.City
;
import
cn.com.fqy.core.model.Query
;
/**
* 该实体为行政区域划分等级 服务接口类
*/
public
interface
CityService
extends
BaseService
{
/**
* 根据查询条件,查询并返回City的列表
* @param q 查询条件
* @return
*/
public
List
<
City
>
getCityList
(
Query
q
);
/**
* 根据查询条件,分页查询并返回City的分页结果
* @param q 查询条件
* @return
*/
public
PageFinder
<
City
>
getCityPagedList
(
Query
q
);
/**
* 根据主键,查询并返回一个City对象
* @param id 主键id
* @return
*/
public
City
getCity
(
String
id
);
/**
* 根据主键数组,查询并返回一组City对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
public
List
<
City
>
getCityByIds
(
String
[]
ids
);
/**
* 根据主键,删除特定的City记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
City
>
delCity
(
String
id
,
Operator
operator
);
/**
* 新增一条City记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param city 新增的City数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
City
>
addCity
(
City
city
,
Operator
operator
);
/**
* 根据主键,更新一条City记录
* @param city 更新的City数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
City
>
updateCity
(
City
city
,
Operator
operator
);
/**
* 生成主键
* @return
*/
public
String
generatePK
();
/**
* 为City对象设置默认值
* @param obj
*/
public
void
fillDefaultValues
(
City
obj
);
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/ProvinceService.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
service
;
import
java.util.List
;
import
cn.com.fqy.common.Operator
;
import
cn.com.fqy.common.ResultInfo
;
import
cn.com.fqy.core.common.BaseService
;
import
cn.com.fqy.core.common.PageFinder
;
import
cn.com.fqy.core.model.Province
;
import
cn.com.fqy.core.model.Query
;
/**
* 该实体为行政区域划分等级 服务接口类
*/
public
interface
ProvinceService
extends
BaseService
{
/**
* 根据查询条件,查询并返回Province的列表
* @param q 查询条件
* @return
*/
public
List
<
Province
>
getProvinceList
(
Query
q
);
/**
* 根据查询条件,分页查询并返回Province的分页结果
* @param q 查询条件
* @return
*/
public
PageFinder
<
Province
>
getProvincePagedList
(
Query
q
);
/**
* 根据主键,查询并返回一个Province对象
* @param id 主键id
* @return
*/
public
Province
getProvince
(
String
id
);
/**
* 根据主键数组,查询并返回一组Province对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
public
List
<
Province
>
getProvinceByIds
(
String
[]
ids
);
/**
* 根据主键,删除特定的Province记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
Province
>
delProvince
(
String
id
,
Operator
operator
);
/**
* 新增一条Province记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param province 新增的Province数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
Province
>
addProvince
(
Province
province
,
Operator
operator
);
/**
* 根据主键,更新一条Province记录
* @param province 更新的Province数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
public
ResultInfo
<
Province
>
updateProvince
(
Province
province
,
Operator
operator
);
/**
* 生成主键
* @return
*/
public
String
generatePK
();
/**
* 为Province对象设置默认值
* @param obj
*/
public
void
fillDefaultValues
(
Province
obj
);
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/impl/AreaServiceImpl.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
cn.com.fqy.common.Operator
;
import
cn.com.fqy.common.ResultInfo
;
import
cn.com.fqy.common.constants.Constant
;
import
cn.com.fqy.core.common.PageFinder
;
import
cn.com.fqy.core.dao.AreaDao
;
import
cn.com.fqy.core.model.Area
;
import
cn.com.fqy.core.model.Query
;
import
cn.com.fqy.core.service.AreaService
;
/**
* 该实体为行政区域划分等级 服务实现类
*/
@Service
public
class
AreaServiceImpl
implements
AreaService
{
private
static
final
Log
log
=
LogFactory
.
getLog
(
AreaServiceImpl
.
class
);
@Resource
private
AreaDao
areaDao
;
/**
* 根据查询条件,查询并返回Area的列表
* @param q 查询条件
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
List
<
Area
>
getAreaList
(
Query
q
)
{
List
<
Area
>
list
=
null
;
try
{
//直接调用Dao方法进行查询
list
=
areaDao
.
queryAll
(
q
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
Area
>(
0
)
:
list
;
return
list
;
}
/**
* 根据查询条件,分页查询并返回Area的分页结果
* @param q 查询条件
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
PageFinder
<
Area
>
getAreaPagedList
(
Query
q
)
{
PageFinder
<
Area
>
page
=
new
PageFinder
<
Area
>();
List
<
Area
>
list
=
null
;
long
rowCount
=
0L
;
try
{
//调用dao查询满足条件的分页数据
list
=
areaDao
.
pageList
(
q
);
//调用dao统计满足条件的记录总数
rowCount
=
areaDao
.
count
(
q
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
Area
>(
0
)
:
list
;
//将分页数据和记录总数设置到分页结果对象中
page
.
setData
(
list
);
page
.
setRowCount
(
rowCount
);
return
page
;
}
/**
* 根据主键,查询并返回一个Area对象
* @param id 主键id
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
Area
getArea
(
String
id
)
{
Area
obj
=
null
;
if
(
id
==
null
||
id
.
length
()
==
0
)
{
//传入的主键无效时直接返回null
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" id = "
+
id
);
return
obj
;
}
try
{
//调用dao,根据主键查询
obj
=
areaDao
.
get
(
id
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
return
obj
;
}
/**
* 根据主键数组,查询并返回一组Area对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
List
<
Area
>
getAreaByIds
(
String
[]
ids
)
{
List
<
Area
>
list
=
null
;
if
(
ids
==
null
||
ids
.
length
==
0
)
{
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" ids is null or empty array."
);
}
else
{
try
{
//调用dao,根据主键数组查询
list
=
areaDao
.
getByIds
(
ids
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
Area
>(
0
)
:
list
;
return
list
;
}
/**
* 根据主键,删除特定的Area记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
Area
>
delArea
(
String
id
,
Operator
operator
)
{
ResultInfo
<
Area
>
resultInfo
=
new
ResultInfo
<
Area
>();
if
(
id
==
null
||
id
.
length
()
==
0
)
{
//传入的主键无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" id = "
+
id
);
return
resultInfo
;
}
try
{
//调用Dao执行删除,并判断删除语句执行结果
int
count
=
areaDao
.
delete
(
id
);
if
(
count
>
0
)
{
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
}
else
{
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_DATA_NOT_EXISTS
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
return
resultInfo
;
}
/**
* 新增一条Area记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param area 新增的Area数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
Area
>
addArea
(
Area
area
,
Operator
operator
)
{
ResultInfo
<
Area
>
resultInfo
=
new
ResultInfo
<
Area
>();
if
(
area
==
null
)
{
//传入参数无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" area = "
+
area
);
}
else
{
try
{
//如果传入参数的主键为null,则调用生成主键的方法获取新的主键
if
(
area
.
getCodeA
()
==
null
)
{
area
.
setCodeA
(
this
.
generatePK
());
}
//如果传入的操作人不为null,则设置新增记录的操作人类型和操作人id
// if (operator != null) {
// area.setOperatorType(operator.getOperatorType());
// area.setOperatorId(operator.getOperatorId());
// }
//设置创建时间和更新时间为当前时间
// Date now = new Date();
// area.setCreateTime(now);
// area.setUpdateTime(now);
//填充默认值
this
.
fillDefaultValues
(
area
);
//调用Dao执行插入操作
areaDao
.
add
(
area
);
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
resultInfo
.
setData
(
area
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
}
return
resultInfo
;
}
/**
* 根据主键,更新一条Area记录
* @param area 更新的Area数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
Area
>
updateArea
(
Area
area
,
Operator
operator
)
{
ResultInfo
<
Area
>
resultInfo
=
new
ResultInfo
<
Area
>();
if
(
area
==
null
||
area
.
getCodeA
()
==
null
)
{
//传入参数无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" area = "
+
area
);
}
else
{
try
{
//如果传入的操作人不为null,则设置更新记录的操作人类型和操作人id
// if (operator != null) {
// area.setOperatorType(operator.getOperatorType());
// area.setOperatorId(operator.getOperatorId());
// }
//设置更新时间为当前时间
// area.setUpdateTime(new Date());
//调用Dao执行更新操作,并判断更新语句执行结果
int
count
=
areaDao
.
update
(
area
);
if
(
count
>
0
)
{
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
}
else
{
resultInfo
.
setCode
(
Constant
.
FAIL
);
}
resultInfo
.
setData
(
area
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
}
return
resultInfo
;
}
/**
* 生成主键
* @return
*/
public
String
generatePK
()
{
return
null
;
}
/**
* 为Area对象设置默认值
* @param obj
*/
public
void
fillDefaultValues
(
Area
obj
)
{
if
(
obj
!=
null
)
{
}
}
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/impl/CityServiceImpl.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
cn.com.fqy.common.Operator
;
import
cn.com.fqy.common.ResultInfo
;
import
cn.com.fqy.common.constants.Constant
;
import
cn.com.fqy.core.common.PageFinder
;
import
cn.com.fqy.core.dao.CityDao
;
import
cn.com.fqy.core.model.City
;
import
cn.com.fqy.core.model.Query
;
import
cn.com.fqy.core.service.CityService
;
/**
* 该实体为行政区域划分等级 服务实现类
*/
@Service
public
class
CityServiceImpl
implements
CityService
{
private
static
final
Log
log
=
LogFactory
.
getLog
(
CityServiceImpl
.
class
);
@Resource
private
CityDao
cityDao
;
/**
* 根据查询条件,查询并返回City的列表
* @param q 查询条件
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
List
<
City
>
getCityList
(
Query
q
)
{
List
<
City
>
list
=
null
;
try
{
//直接调用Dao方法进行查询
list
=
cityDao
.
queryAll
(
q
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
City
>(
0
)
:
list
;
return
list
;
}
/**
* 根据查询条件,分页查询并返回City的分页结果
* @param q 查询条件
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
PageFinder
<
City
>
getCityPagedList
(
Query
q
)
{
PageFinder
<
City
>
page
=
new
PageFinder
<
City
>();
List
<
City
>
list
=
null
;
long
rowCount
=
0L
;
try
{
//调用dao查询满足条件的分页数据
list
=
cityDao
.
pageList
(
q
);
//调用dao统计满足条件的记录总数
rowCount
=
cityDao
.
count
(
q
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
City
>(
0
)
:
list
;
//将分页数据和记录总数设置到分页结果对象中
page
.
setData
(
list
);
page
.
setRowCount
(
rowCount
);
return
page
;
}
/**
* 根据主键,查询并返回一个City对象
* @param id 主键id
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
City
getCity
(
String
id
)
{
City
obj
=
null
;
if
(
id
==
null
||
id
.
length
()
==
0
)
{
//传入的主键无效时直接返回null
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" id = "
+
id
);
return
obj
;
}
try
{
//调用dao,根据主键查询
obj
=
cityDao
.
get
(
id
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
return
obj
;
}
/**
* 根据主键数组,查询并返回一组City对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
List
<
City
>
getCityByIds
(
String
[]
ids
)
{
List
<
City
>
list
=
null
;
if
(
ids
==
null
||
ids
.
length
==
0
)
{
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" ids is null or empty array."
);
}
else
{
try
{
//调用dao,根据主键数组查询
list
=
cityDao
.
getByIds
(
ids
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
City
>(
0
)
:
list
;
return
list
;
}
/**
* 根据主键,删除特定的City记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
City
>
delCity
(
String
id
,
Operator
operator
)
{
ResultInfo
<
City
>
resultInfo
=
new
ResultInfo
<
City
>();
if
(
id
==
null
||
id
.
length
()
==
0
)
{
//传入的主键无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" id = "
+
id
);
return
resultInfo
;
}
try
{
//调用Dao执行删除,并判断删除语句执行结果
int
count
=
cityDao
.
delete
(
id
);
if
(
count
>
0
)
{
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
}
else
{
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_DATA_NOT_EXISTS
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
return
resultInfo
;
}
/**
* 新增一条City记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param city 新增的City数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
City
>
addCity
(
City
city
,
Operator
operator
)
{
ResultInfo
<
City
>
resultInfo
=
new
ResultInfo
<
City
>();
if
(
city
==
null
)
{
//传入参数无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" city = "
+
city
);
}
else
{
try
{
//如果传入参数的主键为null,则调用生成主键的方法获取新的主键
if
(
city
.
getCodeC
()
==
null
)
{
city
.
setCodeC
(
this
.
generatePK
());
}
//如果传入的操作人不为null,则设置新增记录的操作人类型和操作人id
// if (operator != null) {
// city.setOperatorType(operator.getOperatorType());
// city.setOperatorId(operator.getOperatorId());
// }
//设置创建时间和更新时间为当前时间
// Date now = new Date();
// city.setCreateTime(now);
// city.setUpdateTime(now);
//填充默认值
this
.
fillDefaultValues
(
city
);
//调用Dao执行插入操作
cityDao
.
add
(
city
);
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
resultInfo
.
setData
(
city
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
}
return
resultInfo
;
}
/**
* 根据主键,更新一条City记录
* @param city 更新的City数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
City
>
updateCity
(
City
city
,
Operator
operator
)
{
ResultInfo
<
City
>
resultInfo
=
new
ResultInfo
<
City
>();
if
(
city
==
null
||
city
.
getCodeC
()
==
null
)
{
//传入参数无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" city = "
+
city
);
}
else
{
try
{
//如果传入的操作人不为null,则设置更新记录的操作人类型和操作人id
// if (operator != null) {
// city.setOperatorType(operator.getOperatorType());
// city.setOperatorId(operator.getOperatorId());
// }
//设置更新时间为当前时间
// city.setUpdateTime(new Date());
//调用Dao执行更新操作,并判断更新语句执行结果
int
count
=
cityDao
.
update
(
city
);
if
(
count
>
0
)
{
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
}
else
{
resultInfo
.
setCode
(
Constant
.
FAIL
);
}
resultInfo
.
setData
(
city
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
}
return
resultInfo
;
}
/**
* 生成主键
* @return
*/
public
String
generatePK
()
{
return
null
;
}
/**
* 为City对象设置默认值
* @param obj
*/
public
void
fillDefaultValues
(
City
obj
)
{
if
(
obj
!=
null
)
{
}
}
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/impl/ProvinceServiceImpl.java
0 → 100644
View file @
f11f3e9a
package
cn
.
com
.
fqy
.
core
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
cn.com.fqy.common.Operator
;
import
cn.com.fqy.common.ResultInfo
;
import
cn.com.fqy.common.constants.Constant
;
import
cn.com.fqy.core.common.PageFinder
;
import
cn.com.fqy.core.dao.ProvinceDao
;
import
cn.com.fqy.core.model.Province
;
import
cn.com.fqy.core.model.Query
;
import
cn.com.fqy.core.service.ProvinceService
;
/**
* 该实体为行政区域划分等级 服务实现类
*/
@Service
public
class
ProvinceServiceImpl
implements
ProvinceService
{
private
static
final
Log
log
=
LogFactory
.
getLog
(
ProvinceServiceImpl
.
class
);
@Resource
private
ProvinceDao
provinceDao
;
/**
* 根据查询条件,查询并返回Province的列表
* @param q 查询条件
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
List
<
Province
>
getProvinceList
(
Query
q
)
{
List
<
Province
>
list
=
null
;
try
{
//直接调用Dao方法进行查询
list
=
provinceDao
.
queryAll
(
q
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
Province
>(
0
)
:
list
;
return
list
;
}
/**
* 根据查询条件,分页查询并返回Province的分页结果
* @param q 查询条件
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
PageFinder
<
Province
>
getProvincePagedList
(
Query
q
)
{
PageFinder
<
Province
>
page
=
new
PageFinder
<
Province
>();
List
<
Province
>
list
=
null
;
long
rowCount
=
0L
;
try
{
//调用dao查询满足条件的分页数据
list
=
provinceDao
.
pageList
(
q
);
//调用dao统计满足条件的记录总数
rowCount
=
provinceDao
.
count
(
q
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
Province
>(
0
)
:
list
;
//将分页数据和记录总数设置到分页结果对象中
page
.
setData
(
list
);
page
.
setRowCount
(
rowCount
);
return
page
;
}
/**
* 根据主键,查询并返回一个Province对象
* @param id 主键id
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
Province
getProvince
(
String
id
)
{
Province
obj
=
null
;
if
(
id
==
null
||
id
.
length
()
==
0
)
{
//传入的主键无效时直接返回null
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" id = "
+
id
);
return
obj
;
}
try
{
//调用dao,根据主键查询
obj
=
provinceDao
.
get
(
id
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
return
obj
;
}
/**
* 根据主键数组,查询并返回一组Province对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
List
<
Province
>
getProvinceByIds
(
String
[]
ids
)
{
List
<
Province
>
list
=
null
;
if
(
ids
==
null
||
ids
.
length
==
0
)
{
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" ids is null or empty array."
);
}
else
{
try
{
//调用dao,根据主键数组查询
list
=
provinceDao
.
getByIds
(
ids
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
Province
>(
0
)
:
list
;
return
list
;
}
/**
* 根据主键,删除特定的Province记录
* @param id 主键id
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
Province
>
delProvince
(
String
id
,
Operator
operator
)
{
ResultInfo
<
Province
>
resultInfo
=
new
ResultInfo
<
Province
>();
if
(
id
==
null
||
id
.
length
()
==
0
)
{
//传入的主键无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" id = "
+
id
);
return
resultInfo
;
}
try
{
//调用Dao执行删除,并判断删除语句执行结果
int
count
=
provinceDao
.
delete
(
id
);
if
(
count
>
0
)
{
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
}
else
{
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_DATA_NOT_EXISTS
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
return
resultInfo
;
}
/**
* 新增一条Province记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param province 新增的Province数据(如果无特殊需求,新增对象的主键值请保留为null)
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
Province
>
addProvince
(
Province
province
,
Operator
operator
)
{
ResultInfo
<
Province
>
resultInfo
=
new
ResultInfo
<
Province
>();
if
(
province
==
null
)
{
//传入参数无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" province = "
+
province
);
}
else
{
try
{
//如果传入参数的主键为null,则调用生成主键的方法获取新的主键
if
(
province
.
getCodeP
()
==
null
)
{
province
.
setCodeP
(
this
.
generatePK
());
}
//如果传入的操作人不为null,则设置新增记录的操作人类型和操作人id
// if (operator != null) {
// province.setOperatorType(operator.getOperatorType());
// province.setOperatorId(operator.getOperatorId());
// }
//设置创建时间和更新时间为当前时间
// Date now = new Date();
// province.setCreateTime(now);
// province.setUpdateTime(now);
//填充默认值
this
.
fillDefaultValues
(
province
);
//调用Dao执行插入操作
provinceDao
.
add
(
province
);
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
resultInfo
.
setData
(
province
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
}
return
resultInfo
;
}
/**
* 根据主键,更新一条Province记录
* @param province 更新的Province数据,且其主键不能为空
* @param operator 操作人对象
* @return
*/
@Transactional
public
ResultInfo
<
Province
>
updateProvince
(
Province
province
,
Operator
operator
)
{
ResultInfo
<
Province
>
resultInfo
=
new
ResultInfo
<
Province
>();
if
(
province
==
null
||
province
.
getCodeP
()
==
null
)
{
//传入参数无效时直接返回失败结果
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_INVALID_ARG
);
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" province = "
+
province
);
}
else
{
try
{
//如果传入的操作人不为null,则设置更新记录的操作人类型和操作人id
// if (operator != null) {
// province.setOperatorType(operator.getOperatorType());
// province.setOperatorId(operator.getOperatorId());
// }
//设置更新时间为当前时间
// province.setUpdateTime(new Date());
//调用Dao执行更新操作,并判断更新语句执行结果
int
count
=
provinceDao
.
update
(
province
);
if
(
count
>
0
)
{
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
}
else
{
resultInfo
.
setCode
(
Constant
.
FAIL
);
}
resultInfo
.
setData
(
province
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
Constant
.
ERR_MSG_EXCEPTION_CATCHED
);
}
}
return
resultInfo
;
}
/**
* 生成主键
* @return
*/
public
String
generatePK
()
{
return
null
;
}
/**
* 为Province对象设置默认值
* @param obj
*/
public
void
fillDefaultValues
(
Province
obj
)
{
if
(
obj
!=
null
)
{
}
}
}
2code/server/store-system/src/main/resources/mybatis/mapper/AreaMapper.xml
0 → 100644
View file @
f11f3e9a
<?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=
"cn.com.fqy.core.dao.AreaDao"
>
<resultMap
type=
"Area"
id=
"Area"
>
<id
column=
"CODE_A"
property=
"codeA"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"ID"
property=
"id"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"NAME"
property=
"name"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"CODE_C"
property=
"codeC"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- 全部字段,一般用于明细查询 -->
<sql
id=
"AllColumnlist"
>
ID,CODE_A,NAME,CODE_C
</sql>
<!-- 常见字段,一般用于列表查询,可能不包含备注之类的字段 -->
<sql
id=
"CommonColumnlist"
>
ID,CODE_A,NAME,CODE_C
</sql>
<insert
id=
"add"
parameterType=
"Area"
useGeneratedKeys=
"true"
keyProperty=
"codeA"
>
insert into T_AREA(
ID,
<if
test=
"codeA!=null"
>
CODE_A,
</if>
NAME,
CODE_C
) values (
#{id,jdbcType = VARCHAR},
<if
test=
"codeA!=null"
>
#{codeA,jdbcType = VARCHAR},
</if>
#{name,jdbcType = VARCHAR},
#{codeC,jdbcType = VARCHAR}
)
</insert>
<update
id=
"update"
parameterType=
"Area"
>
update T_AREA
<set>
<if
test=
"id!=null and id!=''"
>
ID=#{id,jdbcType = VARCHAR},
</if>
<if
test=
"name!=null and name!=''"
>
NAME=#{name,jdbcType = VARCHAR},
</if>
<if
test=
"codeC!=null and codeC!=''"
>
CODE_C=#{codeC,jdbcType = VARCHAR},
</if>
</set>
<where>
AND CODE_A=#{codeA}
</where>
</update>
<delete
id=
"delete"
>
delete from T_AREA
<where>
CODE_A=#{0}
</where>
</delete>
<select
id=
"get"
resultMap=
"Area"
>
select
<include
refid=
"AllColumnlist"
/>
from T_AREA
<where>
CODE_A=#{0}
</where>
</select>
<select
id=
"getByIds"
resultMap=
"Area"
>
select
<include
refid=
"AllColumnlist"
/>
from T_AREA
<where>
CODE_A in
<foreach
item=
"item"
index=
"index"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</select>
<select
id=
"count"
parameterType=
"Query"
resultType=
"Long"
>
select count(CODE_A) from T_AREA
<where>
<include
refid=
"listCommonWhere"
/>
</where>
</select>
<select
id=
"queryAll"
parameterType=
"Query"
resultMap=
"Area"
>
select
<include
refid=
"CommonColumnlist"
/>
from T_AREA
<where>
<include
refid=
"listCommonWhere"
/>
</where>
</select>
<select
id=
"pageList"
parameterType=
"Query"
resultMap=
"Area"
>
select
<include
refid=
"CommonColumnlist"
/>
from T_AREA
<where>
<include
refid=
"listCommonWhere"
/>
</where>
<![CDATA[LIMIT #{rowIndex},#{pageSize} ]]>
</select>
<sql
id=
"listCommonWhere"
>
<if
test=
"q!=null"
>
<if
test=
"q.id!=null and q.id!=''"
>
AND ID=#{q.id}
</if>
<if
test=
"q.codeA!=null and q.codeA!=''"
>
AND CODE_A=#{q.codeA}
</if>
<if
test=
"q.name!=null and q.name!=''"
>
AND NAME=#{q.name}
</if>
<if
test=
"q.codeC!=null and q.codeC!=''"
>
AND CODE_C=#{q.codeC}
</if>
</if>
</sql>
</mapper>
\ No newline at end of file
2code/server/store-system/src/main/resources/mybatis/mapper/CityMapper.xml
0 → 100644
View file @
f11f3e9a
<?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=
"cn.com.fqy.core.dao.CityDao"
>
<resultMap
type=
"City"
id=
"City"
>
<id
column=
"CODE_C"
property=
"codeC"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"ID"
property=
"id"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"NAME"
property=
"name"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"CODE_P"
property=
"codeP"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- 全部字段,一般用于明细查询 -->
<sql
id=
"AllColumnlist"
>
ID,CODE_C,NAME,CODE_P
</sql>
<!-- 常见字段,一般用于列表查询,可能不包含备注之类的字段 -->
<sql
id=
"CommonColumnlist"
>
ID,CODE_C,NAME,CODE_P
</sql>
<insert
id=
"add"
parameterType=
"City"
useGeneratedKeys=
"true"
keyProperty=
"codeC"
>
insert into T_CITY(
ID,
<if
test=
"codeC!=null"
>
CODE_C,
</if>
NAME,
CODE_P
) values (
#{id,jdbcType = VARCHAR},
<if
test=
"codeC!=null"
>
#{codeC,jdbcType = VARCHAR},
</if>
#{name,jdbcType = VARCHAR},
#{codeP,jdbcType = VARCHAR}
)
</insert>
<update
id=
"update"
parameterType=
"City"
>
update T_CITY
<set>
<if
test=
"id!=null and id!=''"
>
ID=#{id,jdbcType = VARCHAR},
</if>
<if
test=
"name!=null and name!=''"
>
NAME=#{name,jdbcType = VARCHAR},
</if>
<if
test=
"codeP!=null and codeP!=''"
>
CODE_P=#{codeP,jdbcType = VARCHAR},
</if>
</set>
<where>
AND CODE_C=#{codeC}
</where>
</update>
<delete
id=
"delete"
>
delete from T_CITY
<where>
CODE_C=#{0}
</where>
</delete>
<select
id=
"get"
resultMap=
"City"
>
select
<include
refid=
"AllColumnlist"
/>
from T_CITY
<where>
CODE_C=#{0}
</where>
</select>
<select
id=
"getByIds"
resultMap=
"City"
>
select
<include
refid=
"AllColumnlist"
/>
from T_CITY
<where>
CODE_C in
<foreach
item=
"item"
index=
"index"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</select>
<select
id=
"count"
parameterType=
"Query"
resultType=
"Long"
>
select count(CODE_C) from T_CITY
<where>
<include
refid=
"listCommonWhere"
/>
</where>
</select>
<select
id=
"queryAll"
parameterType=
"Query"
resultMap=
"City"
>
select
<include
refid=
"CommonColumnlist"
/>
from T_CITY
<where>
<include
refid=
"listCommonWhere"
/>
</where>
</select>
<select
id=
"pageList"
parameterType=
"Query"
resultMap=
"City"
>
select
<include
refid=
"CommonColumnlist"
/>
from T_CITY
<where>
<include
refid=
"listCommonWhere"
/>
</where>
<![CDATA[LIMIT #{rowIndex},#{pageSize} ]]>
</select>
<sql
id=
"listCommonWhere"
>
<if
test=
"q!=null"
>
<if
test=
"q.id!=null and q.id!=''"
>
AND ID=#{q.id}
</if>
<if
test=
"q.codeC!=null and q.codeC!=''"
>
AND CODE_C=#{q.codeC}
</if>
<if
test=
"q.name!=null and q.name!=''"
>
AND NAME=#{q.name}
</if>
<if
test=
"q.codeP!=null and q.codeP!=''"
>
AND CODE_P=#{q.codeP}
</if>
</if>
</sql>
</mapper>
\ No newline at end of file
2code/server/store-system/src/main/resources/mybatis/mapper/ProvinceMapper.xml
0 → 100644
View file @
f11f3e9a
<?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=
"cn.com.fqy.core.dao.ProvinceDao"
>
<resultMap
type=
"Province"
id=
"Province"
>
<id
column=
"CODE_P"
property=
"codeP"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"ID"
property=
"id"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"NAME"
property=
"name"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- 全部字段,一般用于明细查询 -->
<sql
id=
"AllColumnlist"
>
ID,CODE_P,NAME
</sql>
<!-- 常见字段,一般用于列表查询,可能不包含备注之类的字段 -->
<sql
id=
"CommonColumnlist"
>
ID,CODE_P,NAME
</sql>
<insert
id=
"add"
parameterType=
"Province"
useGeneratedKeys=
"true"
keyProperty=
"codeP"
>
insert into T_PROVINCE(
ID,
<if
test=
"codeP!=null"
>
CODE_P,
</if>
NAME
) values (
#{id,jdbcType = VARCHAR},
<if
test=
"codeP!=null"
>
#{codeP,jdbcType = VARCHAR},
</if>
#{name,jdbcType = VARCHAR}
)
</insert>
<update
id=
"update"
parameterType=
"Province"
>
update T_PROVINCE
<set>
<if
test=
"id!=null and id!=''"
>
ID=#{id,jdbcType = VARCHAR},
</if>
<if
test=
"name!=null and name!=''"
>
NAME=#{name,jdbcType = VARCHAR},
</if>
</set>
<where>
AND CODE_P=#{codeP}
</where>
</update>
<delete
id=
"delete"
>
delete from T_PROVINCE
<where>
CODE_P=#{0}
</where>
</delete>
<select
id=
"get"
resultMap=
"Province"
>
select
<include
refid=
"AllColumnlist"
/>
from T_PROVINCE
<where>
CODE_P=#{0}
</where>
</select>
<select
id=
"getByIds"
resultMap=
"Province"
>
select
<include
refid=
"AllColumnlist"
/>
from T_PROVINCE
<where>
CODE_P in
<foreach
item=
"item"
index=
"index"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</select>
<select
id=
"count"
parameterType=
"Query"
resultType=
"Long"
>
select count(CODE_P) from T_PROVINCE
<where>
<include
refid=
"listCommonWhere"
/>
</where>
</select>
<select
id=
"queryAll"
parameterType=
"Query"
resultMap=
"Province"
>
select
<include
refid=
"CommonColumnlist"
/>
from T_PROVINCE
<where>
<include
refid=
"listCommonWhere"
/>
</where>
</select>
<select
id=
"pageList"
parameterType=
"Query"
resultMap=
"Province"
>
select
<include
refid=
"CommonColumnlist"
/>
from T_PROVINCE
<where>
<include
refid=
"listCommonWhere"
/>
</where>
<![CDATA[LIMIT #{rowIndex},#{pageSize} ]]>
</select>
<sql
id=
"listCommonWhere"
>
<if
test=
"q!=null"
>
<if
test=
"q.id!=null and q.id!=''"
>
AND ID=#{q.id}
</if>
<if
test=
"q.codeP!=null and q.codeP!=''"
>
AND CODE_P=#{q.codeP}
</if>
<if
test=
"q.name!=null and q.name!=''"
>
AND NAME=#{q.name}
</if>
</if>
</sql>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment