Commit c17b5208 by zhengxj

finish 地区信息查询 on 20190124 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@17055 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 9b52ecea
/*
* Copyright (c) 2018, 2028, glsx and/or its affiliates. All rights reserved.
* GLSX PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.glsx.ordercenter.constants;
/**
* @ClassName: BizConstants
* @Description: TODO(这里用一句话描述这个类的作用)
* @author Zheng Xiajun
* @date 2019年1月24日
*
*/
public interface BizConstants {
final static String SELECT_AREA_TYPE = "children";
}
...@@ -25,14 +25,15 @@ ...@@ -25,14 +25,15 @@
package com.glsx.ordercenter.controller; package com.glsx.ordercenter.controller;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.glsx.common.constants.ResultObject; import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.dto.QueryOrderReq; import com.glsx.common.utils.StringUtils;
import com.glsx.ordercenter.service.IOrderService; import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.pojo.SysAreaExample;
import com.glsx.ordercenter.service.IAreaService;
/** /**
* @ClassName: AreaController * @ClassName: AreaController
...@@ -46,13 +47,17 @@ import com.glsx.ordercenter.service.IOrderService; ...@@ -46,13 +47,17 @@ import com.glsx.ordercenter.service.IOrderService;
public class AreaController { public class AreaController {
@Autowired @Autowired
private IOrderService orderService; private IAreaService areaService;
@RequestMapping(value = "/getByParams", method = { RequestMethod.GET, RequestMethod.POST },consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/getById", method = { RequestMethod.GET, RequestMethod.POST })
public ResultObject getByParams(QueryOrderReq oueryOrderReq) { public ResultObject getByParams(Integer id,String type) {
if(!StringUtils.isEmpty(type)&&type.equals("children")){
return null; SysAreaExample example=new SysAreaExample();
example.createCriteria().andParentIdEqualTo(id);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), areaService.selectByExample(example));
}
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), areaService.getAllChargeItems(id));
} }
@RequestMapping(value = "/add", method = { RequestMethod.GET, RequestMethod.POST }) @RequestMapping(value = "/add", method = { RequestMethod.GET, RequestMethod.POST })
......
...@@ -20,5 +20,7 @@ public interface SysAreaMapper { ...@@ -20,5 +20,7 @@ public interface SysAreaMapper {
int updateByPrimaryKeySelective(SysArea record); int updateByPrimaryKeySelective(SysArea record);
int updateByPrimaryKey(SysArea record); int updateByPrimaryKey(SysArea record);
List<SysArea> getAllChargeItems(Integer parentId );
} }
\ No newline at end of file \ No newline at end of file
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
*/ */
package com.glsx.ordercenter.service; package com.glsx.ordercenter.service;
import java.util.List;
import com.glsx.ordercenter.pojo.SysArea;
import com.glsx.ordercenter.pojo.SysAreaExample;
/** /**
* @ClassName: IAreaService * @ClassName: IAreaService
* @Description: TODO(这里用一句话描述这个类的作用) * @Description: TODO(这里用一句话描述这个类的作用)
...@@ -33,4 +38,7 @@ package com.glsx.ordercenter.service; ...@@ -33,4 +38,7 @@ package com.glsx.ordercenter.service;
*/ */
public interface IAreaService { public interface IAreaService {
List<SysArea> selectByExample(SysAreaExample example);
SysArea getAllChargeItems(Integer parentId);
} }
...@@ -24,6 +24,14 @@ ...@@ -24,6 +24,14 @@
*/ */
package com.glsx.ordercenter.service.impl; package com.glsx.ordercenter.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.glsx.ordercenter.mapper.SysAreaMapper;
import com.glsx.ordercenter.pojo.SysArea;
import com.glsx.ordercenter.pojo.SysAreaExample;
import com.glsx.ordercenter.service.IAreaService; import com.glsx.ordercenter.service.IAreaService;
/** /**
...@@ -33,6 +41,33 @@ import com.glsx.ordercenter.service.IAreaService; ...@@ -33,6 +41,33 @@ import com.glsx.ordercenter.service.IAreaService;
* @date 2019年1月23日 * @date 2019年1月23日
* *
*/ */
@Service
public class AreaServiceImpl implements IAreaService { public class AreaServiceImpl implements IAreaService {
@Autowired
private SysAreaMapper areaDao;
@Override
public List<SysArea> selectByExample(SysAreaExample example) {
return areaDao.selectByExample(example);
}
@Override
public SysArea getAllChargeItems(Integer id) {
SysAreaExample example=new SysAreaExample ();
example.createCriteria().andIdEqualTo(id);
List<SysArea> child = areaDao.selectByExample(example);
example.clear();
example.createCriteria().andIdEqualTo(child.get(0).getParentId());
List<SysArea> parent= areaDao.selectByExample(example);
example.clear();
example.createCriteria().andIdEqualTo(parent.get(0).getParentId());
SysArea prandPa= areaDao.selectByExample(example).get(0);
parent.get(0).setChildren(child);
prandPa.setChildren(parent);
return prandPa;
}
} }
...@@ -107,6 +107,9 @@ public class OrderServiceImpl implements IOrderService { ...@@ -107,6 +107,9 @@ public class OrderServiceImpl implements IOrderService {
@Override @Override
public int updateByPrimaryKeySelective(SysOrder record) { public int updateByPrimaryKeySelective(SysOrder record) {
SysOrder sysOrder = orderDao.selectByPrimaryKey(record.getId(), record.getOrderSn()); SysOrder sysOrder = orderDao.selectByPrimaryKey(record.getId(), record.getOrderSn());
// TODO 产品未确认具体修改内容 // TODO 产品未确认具体修改内容
return orderDao.updateByPrimaryKey(record); return orderDao.updateByPrimaryKey(record);
} }
......
...@@ -150,12 +150,16 @@ ...@@ -150,12 +150,16 @@
<select id="getAllChargeItems" resultMap="chargeItemSelectMap"> <select id="getAllChargeItems" resultMap="chargeItemSelectMap">
SELECT SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
sys_area WHERE parent_id = 0 from sys_area WHERE parent_id = 0
</select> </select>
<!-- 3.定义查询子的方法 --> <!-- 3.定义查询子的方法 -->
<select id="getSubChargeItem" resultMap="chargeItemSelectMap"> <select id="getSubChargeItem" resultMap="chargeItemSelectMap">
SELECT SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
sys_area WHERE parent_id = #{id} from sys_area WHERE parent_id = #{id}
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!