正在显示
9 个修改的文件
包含
173 行增加
和
14 行删除
1 | +package com.sunyo.wlpt.dispatch.controller; | ||
2 | + | ||
3 | +import com.github.pagehelper.PageInfo; | ||
4 | +import com.sunyo.wlpt.dispatch.domain.CompanyInfo; | ||
5 | +import com.sunyo.wlpt.dispatch.response.ResultJson; | ||
6 | +import com.sunyo.wlpt.dispatch.service.CompanyInfoService; | ||
7 | +import com.sunyo.wlpt.dispatch.utils.GetUUID; | ||
8 | +import io.swagger.annotations.Api; | ||
9 | +import io.swagger.annotations.ApiOperation; | ||
10 | +import io.swagger.annotations.ApiParam; | ||
11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
12 | +import org.springframework.web.bind.annotation.*; | ||
13 | + | ||
14 | +/** | ||
15 | + * @author 子诚 | ||
16 | + * Description:公司信息 Controller | ||
17 | + * 时间:2020/4/28 15:41 | ||
18 | + */ | ||
19 | +@Api(value = "公司信息,业务", tags = "业务管理——公司信息") | ||
20 | +@RequestMapping("dispatch/companyInfo") | ||
21 | +@RestController | ||
22 | +public class CompanyInfoController { | ||
23 | + @Autowired | ||
24 | + private CompanyInfoService companyInfoService; | ||
25 | + | ||
26 | + @ApiOperation("分页查询,公司信息列表") | ||
27 | + @GetMapping("/selectCompanyInfoList") | ||
28 | + public ResultJson<PageInfo> selectCompanyInfoList( | ||
29 | + @ApiParam(name = "companyName", value = "公司名称", required = false) | ||
30 | + @RequestParam(value = "companyName", required = false) String companyName, | ||
31 | + @ApiParam(name = "companyMobile", value = "公司联系方式", required = false) | ||
32 | + @RequestParam(value = "companyMobile", required = false) String companyMobile, | ||
33 | + @ApiParam(name = "pageNum", value = "第几页,默认为第一页", required = false) | ||
34 | + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | ||
35 | + @ApiParam(name = "pageSize", value = "每页数量,默认10条", required = false) | ||
36 | + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | ||
37 | + ResultJson<PageInfo> result = new ResultJson<>(); | ||
38 | + CompanyInfo companyInfo = new CompanyInfo(); | ||
39 | + if("".equals(companyName)){ | ||
40 | + companyInfo.setCompanyName(companyName); | ||
41 | + } | ||
42 | + if("".equals(companyMobile)){ | ||
43 | + companyInfo.setCompanyMobile(companyMobile); | ||
44 | + } | ||
45 | + PageInfo pageInfo = companyInfoService.selectCompanyInfoList(companyInfo, pageNum, pageSize); | ||
46 | + if (pageInfo.getTotal() > 0) { | ||
47 | + result.setData(pageInfo); | ||
48 | + result.setMsg("查询公司信息,成功"); | ||
49 | + } else { | ||
50 | + result.setCode("400"); | ||
51 | + result.setMsg("查询公司信息,失败"); | ||
52 | + } | ||
53 | + return result; | ||
54 | + } | ||
55 | + | ||
56 | + @ApiOperation("增加,公司信息") | ||
57 | + @PostMapping("/insertCompanyInfo") | ||
58 | + public ResultJson insertCompanyInfo(@RequestBody CompanyInfo companyInfo) { | ||
59 | + ResultJson result = new ResultJson(); | ||
60 | + companyInfo.setId(GetUUID.getuuid()); | ||
61 | + int num = companyInfoService.insertSelective(companyInfo); | ||
62 | + if (num > 0) { | ||
63 | + result.setMsg("增加公司信息,成功"); | ||
64 | + } else { | ||
65 | + result.setCode("400"); | ||
66 | + result.setMsg("增加公司信息,失败"); | ||
67 | + } | ||
68 | + return result; | ||
69 | + } | ||
70 | + | ||
71 | + @ApiOperation("编辑,公司信息") | ||
72 | + @PutMapping("/updateCompanyInfo") | ||
73 | + public ResultJson updateCompanyInfo(@RequestBody CompanyInfo companyInfo) { | ||
74 | + ResultJson result = new ResultJson(); | ||
75 | + int num = companyInfoService.updateByPrimaryKeySelective(companyInfo); | ||
76 | + if (num > 0) { | ||
77 | + result.setMsg("修改公司信息,成功"); | ||
78 | + } else { | ||
79 | + result.setCode("400"); | ||
80 | + result.setMsg("修改公司信息,失败"); | ||
81 | + } | ||
82 | + return result; | ||
83 | + } | ||
84 | + | ||
85 | + @ApiOperation("删除,公司信息") | ||
86 | + @DeleteMapping("/deleteCompanyInfo") | ||
87 | + public ResultJson deleteCompanyInfo(@RequestBody CompanyInfo companyInfo) { | ||
88 | + ResultJson result = new ResultJson(); | ||
89 | + int num = companyInfoService.deleteByPrimaryKey(companyInfo.getId()); | ||
90 | + if (num > 0) { | ||
91 | + result.setMsg("删除公司信息,成功"); | ||
92 | + } else { | ||
93 | + result.setCode("400"); | ||
94 | + result.setMsg("删除公司信息,失败"); | ||
95 | + } | ||
96 | + return result; | ||
97 | + } | ||
98 | +} |
@@ -21,7 +21,7 @@ import java.util.Date; | @@ -21,7 +21,7 @@ import java.util.Date; | ||
21 | * 时间:2020/4/24 20:30 | 21 | * 时间:2020/4/24 20:30 |
22 | */ | 22 | */ |
23 | @Api(value = "调度记录信息,业务", tags = "业务管理——车辆调度记录信息") | 23 | @Api(value = "调度记录信息,业务", tags = "业务管理——车辆调度记录信息") |
24 | -@RequestMapping("dispatchNote") | 24 | +@RequestMapping("dispatch/dispatchNote") |
25 | @RestController | 25 | @RestController |
26 | public class DispatchNoteController { | 26 | public class DispatchNoteController { |
27 | @Autowired | 27 | @Autowired |
@@ -95,7 +95,7 @@ public class DispatchNoteController { | @@ -95,7 +95,7 @@ public class DispatchNoteController { | ||
95 | } | 95 | } |
96 | 96 | ||
97 | @ApiOperation("删除调度记录信息") | 97 | @ApiOperation("删除调度记录信息") |
98 | - @DeleteMapping("/updateDispatchNote") | 98 | + @DeleteMapping("/deleteDispatchNote") |
99 | public ResultJson<DispatchNote> deleteDispatchNote(@RequestBody DispatchNote dispatchNote) { | 99 | public ResultJson<DispatchNote> deleteDispatchNote(@RequestBody DispatchNote dispatchNote) { |
100 | ResultJson<DispatchNote> result = new ResultJson<>(); | 100 | ResultJson<DispatchNote> result = new ResultJson<>(); |
101 | /** | 101 | /** |
@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*; | @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*; | ||
17 | * 时间:2020/4/26 14:04 | 17 | * 时间:2020/4/26 14:04 |
18 | */ | 18 | */ |
19 | @Api(value = "驾驶员信息管理", tags = "业务管理——驾驶员信息管理") | 19 | @Api(value = "驾驶员信息管理", tags = "业务管理——驾驶员信息管理") |
20 | -@RequestMapping("/driverInfo") | 20 | +@RequestMapping("dispatch/driverInfo") |
21 | @RestController | 21 | @RestController |
22 | public class DriverInfoController { | 22 | public class DriverInfoController { |
23 | @Autowired | 23 | @Autowired |
@@ -19,7 +19,7 @@ import java.util.Date; | @@ -19,7 +19,7 @@ import java.util.Date; | ||
19 | * 时间:2020/4/24 17:03 | 19 | * 时间:2020/4/24 17:03 |
20 | */ | 20 | */ |
21 | @Api(value = "车辆信息", tags = "业务管理——车辆信息管理") | 21 | @Api(value = "车辆信息", tags = "业务管理——车辆信息管理") |
22 | -@RequestMapping("vehicleInfo") | 22 | +@RequestMapping("dispatch/vehicleInfo") |
23 | @RestController | 23 | @RestController |
24 | public class VehicleInfoController { | 24 | public class VehicleInfoController { |
25 | @Autowired | 25 | @Autowired |
@@ -23,7 +23,7 @@ public class CompanyInfo implements Serializable { | @@ -23,7 +23,7 @@ public class CompanyInfo implements Serializable { | ||
23 | /** | 23 | /** |
24 | * 公司信息编号uuid | 24 | * 公司信息编号uuid |
25 | */ | 25 | */ |
26 | - private String id = UUID.randomUUID().toString().replaceAll("-", ""); | 26 | + private String id; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * 公司名称 | 29 | * 公司名称 |
1 | package com.sunyo.wlpt.dispatch.mapper; | 1 | package com.sunyo.wlpt.dispatch.mapper; |
2 | 2 | ||
3 | import com.sunyo.wlpt.dispatch.domain.CompanyInfo; | 3 | import com.sunyo.wlpt.dispatch.domain.CompanyInfo; |
4 | + | ||
4 | import java.util.List; | 5 | import java.util.List; |
5 | 6 | ||
6 | import org.apache.ibatis.annotations.Mapper; | 7 | import org.apache.ibatis.annotations.Mapper; |
@@ -13,6 +14,14 @@ import org.apache.ibatis.annotations.Param; | @@ -13,6 +14,14 @@ import org.apache.ibatis.annotations.Param; | ||
13 | */ | 14 | */ |
14 | @Mapper | 15 | @Mapper |
15 | public interface CompanyInfoMapper { | 16 | public interface CompanyInfoMapper { |
17 | + /** | ||
18 | + * 获取,公司信息列表 | ||
19 | + * | ||
20 | + * @param record | ||
21 | + * @return | ||
22 | + */ | ||
23 | + List<CompanyInfo> selectCompanyInfoList(CompanyInfo record); | ||
24 | + | ||
16 | int deleteByPrimaryKey(String id); | 25 | int deleteByPrimaryKey(String id); |
17 | 26 | ||
18 | int insert(CompanyInfo record); | 27 | int insert(CompanyInfo record); |
1 | package com.sunyo.wlpt.dispatch.service; | 1 | package com.sunyo.wlpt.dispatch.service; |
2 | 2 | ||
3 | +import com.github.pagehelper.PageInfo; | ||
3 | import com.sunyo.wlpt.dispatch.domain.CompanyInfo; | 4 | import com.sunyo.wlpt.dispatch.domain.CompanyInfo; |
5 | +import com.sunyo.wlpt.dispatch.domain.DispatchNote; | ||
4 | 6 | ||
5 | import java.util.List; | 7 | import java.util.List; |
6 | 8 | ||
@@ -10,7 +12,15 @@ import java.util.List; | @@ -10,7 +12,15 @@ import java.util.List; | ||
10 | * 时间:2020/4/21 14:29 | 12 | * 时间:2020/4/21 14:29 |
11 | */ | 13 | */ |
12 | public interface CompanyInfoService { | 14 | public interface CompanyInfoService { |
13 | - | 15 | + /** |
16 | + * 分页查询,公司信息 | ||
17 | + * | ||
18 | + * @param companyInfo | ||
19 | + * @param pageNum | ||
20 | + * @param pageSize | ||
21 | + * @return | ||
22 | + */ | ||
23 | + PageInfo selectCompanyInfoList(CompanyInfo companyInfo, Integer pageNum, Integer pageSize); | ||
14 | 24 | ||
15 | int deleteByPrimaryKey(String id); | 25 | int deleteByPrimaryKey(String id); |
16 | 26 |
1 | package com.sunyo.wlpt.dispatch.service.impl; | 1 | package com.sunyo.wlpt.dispatch.service.impl; |
2 | 2 | ||
3 | +import com.github.pagehelper.PageHelper; | ||
4 | +import com.github.pagehelper.PageInfo; | ||
5 | +import com.sunyo.wlpt.dispatch.domain.DispatchNote; | ||
6 | +import com.sunyo.wlpt.dispatch.domain.VehicleInfo; | ||
3 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
4 | 8 | ||
5 | import javax.annotation.Resource; | 9 | import javax.annotation.Resource; |
@@ -22,6 +26,24 @@ public class CompanyInfoServiceImpl implements CompanyInfoService { | @@ -22,6 +26,24 @@ public class CompanyInfoServiceImpl implements CompanyInfoService { | ||
22 | @Resource | 26 | @Resource |
23 | private CompanyInfoMapper companyInfoMapper; | 27 | private CompanyInfoMapper companyInfoMapper; |
24 | 28 | ||
29 | + /** | ||
30 | + * 分页查询,调度列表 | ||
31 | + * | ||
32 | + * @param companyInfo | ||
33 | + * @param pageNum | ||
34 | + * @param pageSize | ||
35 | + * @return | ||
36 | + */ | ||
37 | + @Override | ||
38 | + public PageInfo selectCompanyInfoList(CompanyInfo companyInfo, Integer pageNum, Integer pageSize) { | ||
39 | + /* 获取,公司信息列表 */ | ||
40 | + List<CompanyInfo> companyInfoList = companyInfoMapper.selectCompanyInfoList(companyInfo); | ||
41 | + /* 使用 PageHelper 分页插件 */ | ||
42 | + PageHelper.startPage(pageNum, pageSize); | ||
43 | + PageInfo<VehicleInfo> pageInfo = new PageInfo(companyInfoList); | ||
44 | + return pageInfo; | ||
45 | + } | ||
46 | + | ||
25 | @Override | 47 | @Override |
26 | public int deleteByPrimaryKey(String id) { | 48 | public int deleteByPrimaryKey(String id) { |
27 | return companyInfoMapper.deleteByPrimaryKey(id); | 49 | return companyInfoMapper.deleteByPrimaryKey(id); |
@@ -4,12 +4,12 @@ | @@ -4,12 +4,12 @@ | ||
4 | <resultMap id="BaseResultMap" type="com.sunyo.wlpt.dispatch.domain.CompanyInfo"> | 4 | <resultMap id="BaseResultMap" type="com.sunyo.wlpt.dispatch.domain.CompanyInfo"> |
5 | <!--@mbg.generated--> | 5 | <!--@mbg.generated--> |
6 | <!--@Table company_info--> | 6 | <!--@Table company_info--> |
7 | - <id column="id" jdbcType="VARCHAR" property="id" /> | ||
8 | - <result column="company_name" jdbcType="VARCHAR" property="companyName" /> | ||
9 | - <result column="company_address" jdbcType="VARCHAR" property="companyAddress" /> | ||
10 | - <result column="company_mobile" jdbcType="VARCHAR" property="companyMobile" /> | ||
11 | - <result column="company_id" jdbcType="VARCHAR" property="companyId" /> | ||
12 | - <result column="company_representative" jdbcType="VARCHAR" property="companyRepresentative" /> | 7 | + <id column="id" jdbcType="VARCHAR" property="id"/> |
8 | + <result column="company_name" jdbcType="VARCHAR" property="companyName"/> | ||
9 | + <result column="company_address" jdbcType="VARCHAR" property="companyAddress"/> | ||
10 | + <result column="company_mobile" jdbcType="VARCHAR" property="companyMobile"/> | ||
11 | + <result column="company_id" jdbcType="VARCHAR" property="companyId"/> | ||
12 | + <result column="company_representative" jdbcType="VARCHAR" property="companyRepresentative"/> | ||
13 | </resultMap> | 13 | </resultMap> |
14 | <sql id="Base_Column_List"> | 14 | <sql id="Base_Column_List"> |
15 | <!--@mbg.generated--> | 15 | <!--@mbg.generated--> |
@@ -18,10 +18,29 @@ | @@ -18,10 +18,29 @@ | ||
18 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | 18 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> |
19 | <!--@mbg.generated--> | 19 | <!--@mbg.generated--> |
20 | select | 20 | select |
21 | - <include refid="Base_Column_List" /> | 21 | + <include refid="Base_Column_List"/> |
22 | from company_info | 22 | from company_info |
23 | where id = #{id,jdbcType=VARCHAR} | 23 | where id = #{id,jdbcType=VARCHAR} |
24 | </select> | 24 | </select> |
25 | + <!-- 获取公司信息列表 --> | ||
26 | + <select id="selectCompanyInfoList" parameterType="com.sunyo.wlpt.dispatch.domain.CompanyInfo" | ||
27 | + resultMap="BaseResultMap"> | ||
28 | + select | ||
29 | + <include refid="Base_Column_List"/> | ||
30 | + from company_info | ||
31 | + <where> | ||
32 | + <trim suffixOverrides=","> | ||
33 | + <!-- 用户姓名 --> | ||
34 | + <if test="companyName != null and companyName != ''"> | ||
35 | + company_name = #{companyName,jdbcType=VARCHAR}, | ||
36 | + </if> | ||
37 | + <!-- 用户联系方式 --> | ||
38 | + <if test="companyMobile != null and companyMobile != ''"> | ||
39 | + AND company_mobile = #{companyMobile,jdbcType=VARCHAR} | ||
40 | + </if> | ||
41 | + </trim> | ||
42 | + </where> | ||
43 | + </select> | ||
25 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> | 44 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> |
26 | <!--@mbg.generated--> | 45 | <!--@mbg.generated--> |
27 | delete from company_info | 46 | delete from company_info |
@@ -200,7 +219,8 @@ | @@ -200,7 +219,8 @@ | ||
200 | values | 219 | values |
201 | <foreach collection="list" item="item" separator=","> | 220 | <foreach collection="list" item="item" separator=","> |
202 | (#{item.id,jdbcType=VARCHAR}, #{item.companyName,jdbcType=VARCHAR}, #{item.companyAddress,jdbcType=VARCHAR}, | 221 | (#{item.id,jdbcType=VARCHAR}, #{item.companyName,jdbcType=VARCHAR}, #{item.companyAddress,jdbcType=VARCHAR}, |
203 | - #{item.companyMobile,jdbcType=VARCHAR}, #{item.companyId,jdbcType=VARCHAR}, #{item.companyRepresentative,jdbcType=VARCHAR} | 222 | + #{item.companyMobile,jdbcType=VARCHAR}, #{item.companyId,jdbcType=VARCHAR}, |
223 | + #{item.companyRepresentative,jdbcType=VARCHAR} | ||
204 | ) | 224 | ) |
205 | </foreach> | 225 | </foreach> |
206 | </insert> | 226 | </insert> |
-
请 注册 或 登录 后发表评论