Procházet zdrojové kódy

地址更换成API

Signed-off-by: anderx <312518615@qq.com>
anderx před 6 roky
rodič
revize
c11c9d7cf7

+ 1 - 1
src/main/java/com/kede/banners/controller/AdminBannersApiController.java

@@ -18,7 +18,7 @@ import com.kede.common.utils.StringUtils;
 
 
 @RestController
-@RequestMapping(value = "/open/admin/banners")
+@RequestMapping(value = "/api/admin/banners")
 public class AdminBannersApiController extends BaseApiController {
 	@Resource
  	private BannersService	bannersService;

+ 4 - 0
src/main/java/com/kede/common/dao/CustomerCaseMapper.java

@@ -2,6 +2,8 @@ package com.kede.common.dao;
 
 import com.kede.common.model.CustomerCase;
 import com.kede.common.model.CustomerCaseExample;
+import com.kede.customerCase.bo.outCustomerCase;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
@@ -72,4 +74,6 @@ public interface CustomerCaseMapper {
 	 * @mbg.generated  Wed Dec 25 19:51:04 CST 2019
 	 */
 	int updateByPrimaryKey(CustomerCase record);
+
+	outCustomerCase selectByid(Integer id);
 }

+ 48 - 0
src/main/java/com/kede/common/mapper/CustomerCaseMapper.xml

@@ -348,4 +348,52 @@
       region = #{region,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  
+  <select id="selectByid" resultType="com.kede.customerCase.bo.outCustomerCase">
+   select id,name,status, release_status releaseStatus,province,region,
+   date_format(release_time,'%Y-%m-%d %H:%i:%S') as releaseTimeConvert,
+   date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert
+    from customer_case where id = #{id,jdbcType=INTEGER}
+  </select>
+  
+  <select id="findCustomerCaseList" resultType="com.kede.customerCase.bo.outCustomerCase">
+     select id,name,status, release_status releaseStatus,province,region,
+   date_format(release_time,'%Y-%m-%d %H:%i:%S') as releaseTimeConvert,
+   date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert
+    from customer_case where 1=1
+    <if test="c.id!=null">
+    and id = #{c.id}
+    </if>
+    <if test="c.name!=null">
+    and name = #{c.name}
+    </if>
+    <if test="c.province!=null">
+    and province = #{c.province}
+    </if>
+    <if test="c.region!=null">
+    and region = #{c.region}
+    </if>
+    order by release_status desc,status desc,create_time desc
+     <if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  <select id="findCustomerCaseList" resultType="com.kede.customerCase.bo.outCustomerCase">
+     select id,name,status, release_status releaseStatus,province,region,
+   date_format(release_time,'%Y-%m-%d %H:%i:%S') as releaseTimeConvert,
+   date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert
+    from customer_case where 1=1
+    <if test="c.id!=null">
+    and id = #{c.id}
+    </if>
+    <if test="c.name!=null">
+    and name = #{c.name}
+    </if>
+    <if test="c.province!=null">
+    and province = #{c.province}
+    </if>
+    <if test="c.region!=null">
+    and region = #{c.region}
+    </if>
+  </select>
 </mapper>

+ 7 - 0
src/main/java/com/kede/customerCase/bo/InputCustomerCase.java

@@ -0,0 +1,7 @@
+package com.kede.customerCase.bo;
+
+import com.kede.common.model.CustomerCase;
+
+public class InputCustomerCase extends CustomerCase {
+
+}

+ 21 - 0
src/main/java/com/kede/customerCase/bo/outCustomerCase.java

@@ -0,0 +1,21 @@
+package com.kede.customerCase.bo;
+
+import com.kede.common.model.CustomerCase;
+
+public class outCustomerCase extends CustomerCase{
+		private String releaseTimeConvert;
+		private String createTimeConvert;
+		public String getReleaseTimeConvert() {
+			return releaseTimeConvert;
+		}
+		public void setReleaseTimeConvert(String releaseTimeConvert) {
+			this.releaseTimeConvert = releaseTimeConvert;
+		}
+		public String getCreateTimeConvert() {
+			return createTimeConvert;
+		}
+		public void setCreateTimeConvert(String createTimeConvert) {
+			this.createTimeConvert = createTimeConvert;
+		}
+		
+}

+ 98 - 0
src/main/java/com/kede/customerCase/controller/AdminCustomerCaseApiController.java

@@ -0,0 +1,98 @@
+package com.kede.customerCase.controller;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.kede.common.bo.Result;
+import com.kede.common.constant.ErrorConstants;
+import com.kede.common.controller.BaseApiController;
+import com.kede.common.utils.StringUtils;
+import com.kede.customerCase.bo.InputCustomerCase;
+import com.kede.customerCase.service.CustomerCaseService;
+
+
+
+
+@RestController
+@RequestMapping(value = "/api/admin/customerCase")
+public class AdminCustomerCaseApiController extends BaseApiController {
+	@Resource
+ 	private CustomerCaseService	customerCaseService;
+	
+
+	@RequestMapping(value = "/addCustomerCase", method = RequestMethod.POST)
+	public Result addCustomerCase(InputCustomerCase ic) {
+		Result res =new Result();
+		if(StringUtils.isBlank(ic.getPictureUrl())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"图片","图片"));
+			return res;
+		}
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+		res.data(customerCaseService.addCustomerCase(ic));
+		return res;
+	}
+
+		
+		
+	
+	@RequestMapping(value = "/updateCustomerCase", method = RequestMethod.POST)
+	public Result updateCustomerCase(InputCustomerCase ic) {
+		Result res =new Result();
+		if(StringUtils.isBlank(ic.getPictureUrl())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"图片","图片"));
+			return res;
+		}
+		if (!res.getError().isEmpty()) return res;
+		
+		res.data(customerCaseService.updateCustomerCase(ic));
+		return res;
+	}
+	
+	@RequestMapping(value = "/deleteCustomerCase", method = RequestMethod.POST)
+	public Result deleteCustomerCase(InputCustomerCase ic) {
+		Result res =new Result();
+		if(ic.getId()==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"ID","ID"));
+			return res;
+		}
+		res.data(customerCaseService.deleteCustomerCase(ic));
+		return res;
+	}
+	
+	@RequestMapping(value = "/listCustomerCase", method = RequestMethod.GET)
+	public Result listCustomerCase(InputCustomerCase ic,Integer pageSize,Integer pageNo) {
+		Result res =new Result();
+		
+		res.data(customerCaseService.listCustomerCase(ic,pageSize,pageNo));
+		return res;
+	}
+	
+	@RequestMapping(value = "/selectCustomerCase", method = RequestMethod.GET)
+	public Result selectCustomerCase(InputCustomerCase ic) {
+		Result res =new Result();
+		if(ic.getId()==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"ID","ID"));
+			return res;
+		}
+		if (!res.getError().isEmpty()) return res;
+		res.data(customerCaseService.selectCustomerCase(ic));
+		return res;
+	}
+	
+	/** 上传图片 **/
+	@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
+	public Result uploadOrderInvoiceFile(HttpServletRequest req){
+		Result res = new Result();
+		res.setData(handleFile(res, "/customer_Case/", false, req, "customer_Case"));
+		return res;
+	}
+
+	
+
+}

+ 21 - 0
src/main/java/com/kede/customerCase/service/CustomerCaseService.java

@@ -0,0 +1,21 @@
+package com.kede.customerCase.service;
+
+import com.kede.core.mybatis.page.Pagination;
+import com.kede.customerCase.bo.InputCustomerCase;
+import com.kede.customerCase.bo.outCustomerCase;
+
+public interface CustomerCaseService {
+
+	int addCustomerCase(InputCustomerCase ic);
+
+	int updateCustomerCase(InputCustomerCase ic);
+
+	int deleteCustomerCase(InputCustomerCase ic);
+
+	Pagination<outCustomerCase> listCustomerCase(InputCustomerCase ic, Integer pageSize, Integer pageNo);
+
+	outCustomerCase selectCustomerCase(InputCustomerCase ic);
+
+	
+
+}

+ 55 - 0
src/main/java/com/kede/customerCase/service/impl/CustomerCaseServiceImpl.java

@@ -0,0 +1,55 @@
+package com.kede.customerCase.service.impl;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.kede.common.dao.BannerDetailsMapper;
+import com.kede.common.dao.CustomerCaseMapper;
+import com.kede.core.mybatis.BaseMybatisDao;
+import com.kede.core.mybatis.page.Pagination;
+import com.kede.customerCase.bo.InputCustomerCase;
+import com.kede.customerCase.bo.outCustomerCase;
+import com.kede.customerCase.service.CustomerCaseService;
+@Service
+public class CustomerCaseServiceImpl extends BaseMybatisDao<BannerDetailsMapper> implements CustomerCaseService {
+	
+	@Autowired
+	private CustomerCaseMapper	customerCaseMapper;
+
+	@Override
+	public int addCustomerCase(InputCustomerCase ic) {
+		return customerCaseMapper.insertSelective(ic);
+	}
+
+	@Override
+	public int updateCustomerCase(InputCustomerCase ic) {
+		return customerCaseMapper.updateByPrimaryKeySelective(ic);
+	}
+
+	@Override
+	public int deleteCustomerCase(InputCustomerCase ic) {
+		return customerCaseMapper.deleteByPrimaryKey(ic.getId());
+	}
+
+	@SuppressWarnings({ "unchecked" })
+	@Override
+	public Pagination<outCustomerCase> listCustomerCase(InputCustomerCase ic, Integer pageSize, Integer pageNo) {
+		Map<String, Object> params = new HashMap<>();
+		if(pageSize==null||pageSize<0)pageSize=10;
+		if(pageNo==null||pageNo<0)pageNo=1;
+		params.put("c", ic);
+		return (Pagination<outCustomerCase>) findPage("findCustomerCaseList", "findCustomerCaseCount", params, pageNo, pageSize);
+	}
+
+	@Override
+	public outCustomerCase selectCustomerCase(InputCustomerCase ic) {
+		return customerCaseMapper.selectByid(ic.getId());
+	} 
+	
+
+
+}

+ 1 - 1
src/main/java/com/kede/news/controller/AdminNewsApiController.java

@@ -19,7 +19,7 @@ import com.kede.news.service.NewsService;
 
 
 @RestController
-@RequestMapping(value = "/open/admin/news")
+@RequestMapping(value = "/api/admin/news")
 public class AdminNewsApiController extends BaseApiController {
 	@Resource
  	private NewsService	newsService;