fix():修复SaaS运营平台
parent
c3c4b9f7f6
commit
5b9f43ab6d
|
@ -1,20 +1,17 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.muyu.enterprise.controller.form.DeleteEnterpriseByIds;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.enterprise.controller.form.InsertEnterprise;
|
import com.muyu.enterprise.controller.form.*;
|
||||||
import com.muyu.enterprise.controller.form.SearchEnterpriseName;
|
|
||||||
import com.muyu.enterprise.controller.form.UpdateEnterprise;
|
|
||||||
import com.muyu.enterprise.domain.Enterprise;
|
import com.muyu.enterprise.domain.Enterprise;
|
||||||
import com.muyu.enterprise.service.EnterpriseService;
|
import com.muyu.enterprise.service.EnterpriseService;
|
||||||
import com.muyu.enterprise.util.PageUtils;
|
import com.muyu.enterprise.util.PageUtils;
|
||||||
import com.muyu.enterprise.util.R;
|
import com.muyu.enterprise.util.R;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,14 +33,17 @@ public class EnterpriseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectEnterprise")
|
@PostMapping("/selectEnterprise")
|
||||||
public R selectEnterprise(@RequestBody @Valid SearchEnterpriseName form){
|
public Result selectEnterprise(@RequestBody @Valid SearchEnterpriseName form) {
|
||||||
int page = form.getPage();
|
Integer page = form.getPage();
|
||||||
int length = form.getLength();
|
Integer length = form.getLength();
|
||||||
int start = (page - 1) * length;
|
int start = (page - 1) * length;
|
||||||
Map param = BeanUtil.beanToMap(form);
|
Map param = BeanUtil.beanToMap(form);
|
||||||
param.put("start",start);
|
param.put("start", start);
|
||||||
PageUtils pageUtils = enterpriseService.selectEnterprise(param);
|
PageUtils pageUtils = enterpriseService.selectEnterprise(param);
|
||||||
return R.ok().put("page",pageUtils);
|
|
||||||
|
System.out.println(pageUtils);
|
||||||
|
|
||||||
|
return Result.success(pageUtils);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class EnterpriseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
public R insert(@RequestBody @Valid InsertEnterprise form){
|
public Result insert(@RequestBody @Valid InsertEnterprise form){
|
||||||
Enterprise enterprise = new Enterprise();
|
Enterprise enterprise = new Enterprise();
|
||||||
|
|
||||||
enterprise.setEnterpriseName(form.getEnterpriseName());
|
enterprise.setEnterpriseName(form.getEnterpriseName());
|
||||||
|
@ -61,7 +61,19 @@ public class EnterpriseController {
|
||||||
enterprise.setEnterpriseFenceCount(form.getEnterpriseFenceCount());
|
enterprise.setEnterpriseFenceCount(form.getEnterpriseFenceCount());
|
||||||
|
|
||||||
int rows = enterpriseService.insert(enterprise);
|
int rows = enterpriseService.insert(enterprise);
|
||||||
return R.ok().put("rows",rows);
|
return Result.success(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编号查询企业信息
|
||||||
|
* @param enterpriseId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/searchById")
|
||||||
|
public Result searchById(@RequestParam("enterpriseId") Integer enterpriseId){
|
||||||
|
HashMap map = enterpriseService.searchById(enterpriseId);
|
||||||
|
return Result.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +83,7 @@ public class EnterpriseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateEnterEnterprise")
|
@PostMapping("/updateEnterEnterprise")
|
||||||
public R updateEnterprise(@RequestBody @Valid UpdateEnterprise form){
|
public Result updateEnterprise(@RequestBody @Valid UpdateEnterprise form){
|
||||||
Enterprise enterprise = new Enterprise();
|
Enterprise enterprise = new Enterprise();
|
||||||
|
|
||||||
enterprise.setEnterpriseId(form.getEnterpriseId());
|
enterprise.setEnterpriseId(form.getEnterpriseId());
|
||||||
|
@ -80,7 +92,7 @@ public class EnterpriseController {
|
||||||
enterprise.setEnterpriseFenceCount(form.getEnterpriseFenceCount());
|
enterprise.setEnterpriseFenceCount(form.getEnterpriseFenceCount());
|
||||||
|
|
||||||
int rows = enterpriseService.updateEnterprise(enterprise);
|
int rows = enterpriseService.updateEnterprise(enterprise);
|
||||||
return R.ok().put("rows",rows);
|
return Result.success(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,9 +102,9 @@ public class EnterpriseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/deleteByIds")
|
@PostMapping("/deleteByIds")
|
||||||
public R deleteByIds(@RequestBody @Valid DeleteEnterpriseByIds form){
|
public Result deleteByIds(@RequestBody @Valid DeleteEnterpriseByIds form){
|
||||||
int rows = enterpriseService.deleteByIds(form.getIds());
|
int rows = enterpriseService.deleteByIds(form.getIds());
|
||||||
return R.ok().put("rows",rows);
|
return Result.success(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,15 @@ import org.hibernate.validator.constraints.Range;
|
||||||
@Data
|
@Data
|
||||||
public class SearchEnterpriseName {
|
public class SearchEnterpriseName {
|
||||||
|
|
||||||
@Pattern(regexp = "^[0-9a-zA-Z\\u4e00-\\u9fa5]{1,10}$", message = "enterpriseName内容不正确")
|
// @Pattern(regexp = "^[0-9a-zA-Z\\u4e00-\\u9fa5]{1,10}$", message = "enterpriseName内容不正确")
|
||||||
private String enterpriseName;
|
private String enterpriseName;
|
||||||
|
|
||||||
@NotNull(message = "page不能为空")
|
@NotNull(message = "page不能为空")
|
||||||
@Min(value = 1,message = "page不能小于1")
|
@Min(value = 1, message = "page不能小于1")
|
||||||
private Integer page;
|
private Integer page;
|
||||||
|
|
||||||
@NotNull(message = "length不能为空")
|
@NotNull(message = "length不能为空")
|
||||||
@Range(min = 10,max = 50,message = "length必须在10~50之间")
|
@Range(min = 10, max = 50, message = "length必须在10~50之间")
|
||||||
private Integer length;
|
private Integer length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
import com.muyu.enterprise.domain.Enterprise;
|
import com.muyu.enterprise.domain.Enterprise;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -19,6 +20,8 @@ public interface EnterpriseDao {
|
||||||
public int insert(Enterprise enterprise);
|
public int insert(Enterprise enterprise);
|
||||||
|
|
||||||
|
|
||||||
|
//根据编号查询企业信息
|
||||||
|
public HashMap searchById(int enterpriseId);
|
||||||
//修改企业信息
|
//修改企业信息
|
||||||
public int updateEnterprise(Enterprise enterprise);
|
public int updateEnterprise(Enterprise enterprise);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.enterprise.service;
|
||||||
import com.muyu.enterprise.domain.Enterprise;
|
import com.muyu.enterprise.domain.Enterprise;
|
||||||
import com.muyu.enterprise.util.PageUtils;
|
import com.muyu.enterprise.util.PageUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface EnterpriseService {
|
public interface EnterpriseService {
|
||||||
|
@ -14,6 +15,8 @@ public interface EnterpriseService {
|
||||||
public int insert(Enterprise enterprise);
|
public int insert(Enterprise enterprise);
|
||||||
|
|
||||||
|
|
||||||
|
//根据编号查询企业信息
|
||||||
|
public HashMap searchById(int enterpriseId);
|
||||||
//修改企业信息
|
//修改企业信息
|
||||||
public int updateEnterprise(Enterprise enterprise);
|
public int updateEnterprise(Enterprise enterprise);
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,18 @@ public class EnterpriseServiceImpl implements EnterpriseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编号查询企业信息
|
||||||
|
* @param enterpriseId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HashMap searchById(int enterpriseId) {
|
||||||
|
HashMap map = enterpriseDao.searchById(enterpriseId);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改企业信息
|
* 修改企业信息
|
||||||
* @param enterprise
|
* @param enterprise
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
-->
|
-->
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.EnterpriseDao">
|
<mapper namespace="com.muyu.enterprise.mapper.EnterpriseDao">
|
||||||
|
|
||||||
<!--查询企业信息-->
|
<!--查询enterprise_id,
|
||||||
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
|
||||||
select enterprise_id,
|
|
||||||
enterprise_name,
|
enterprise_name,
|
||||||
enterprise_car_count,
|
enterprise_car_count,
|
||||||
enterprise_fence_count
|
enterprise_fence_count企业信息-->
|
||||||
|
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
||||||
|
select *
|
||||||
from tb_enterprise
|
from tb_enterprise
|
||||||
<where>
|
<where>
|
||||||
<if test="enterpriseName != null">
|
<if test="enterpriseName != null">
|
||||||
|
@ -30,9 +30,6 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--新增企业信息-->
|
<!--新增企业信息-->
|
||||||
<insert id="insert" parameterType="com.muyu.enterprise.domain.Enterprise">
|
<insert id="insert" parameterType="com.muyu.enterprise.domain.Enterprise">
|
||||||
insert into tb_enterprise
|
insert into tb_enterprise
|
||||||
|
@ -43,7 +40,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--根据编号查询企业信息-->
|
||||||
|
<select id="searchById" resultType="java.util.HashMap">
|
||||||
|
select enterprise_id,enterprise_name,enterprise_car_count,enterprise_fence_count
|
||||||
|
from tb_enterprise
|
||||||
|
where enterprise_id = #{enterpriseId}
|
||||||
|
</select>
|
||||||
<!--修改企业信息-->
|
<!--修改企业信息-->
|
||||||
<update id="updateEnterprise" parameterType="com.muyu.enterprise.domain.Enterprise">
|
<update id="updateEnterprise" parameterType="com.muyu.enterprise.domain.Enterprise">
|
||||||
update tb_enterprise
|
update tb_enterprise
|
||||||
|
|
Loading…
Reference in New Issue