Commit fddcd5220c2ed2dc52ac13d57f32ef47ace62d95
1 parent
17185d55
feat: add new ability
Showing
27 changed files
with
992 additions
and
453 deletions
docker-compose.yml
ruoyi-admin/admin-dockerfile
| ... | ... | @@ -5,8 +5,10 @@ MAINTAINER guzijian |
| 5 | 5 | ARG server_name |
| 6 | 6 | # 启动环境 |
| 7 | 7 | ARG env_name |
| 8 | +ARG path | |
| 8 | 9 | # 获取参数 |
| 9 | 10 | ENV jar_name=$server_name |
| 11 | +ENV path_url=$path | |
| 10 | 12 | # 获取环境 |
| 11 | 13 | ENV env_file=$env_name |
| 12 | 14 | # 抽取常量 |
| ... | ... | @@ -16,6 +18,6 @@ RUN mkdir -p ${jar_home} |
| 16 | 18 | # 指定工作区 |
| 17 | 19 | WORKDIR ${jar_home} |
| 18 | 20 | # 把jar包复制到容器内 |
| 19 | -ADD target/*.jar ${jar_home}${jar_name}.jar | |
| 21 | +ADD ${path_url} ${jar_home}${jar_name}.jar | |
| 20 | 22 | # 执行命令 |
| 21 | 23 | ENTRYPOINT java -jar ${jar_home}${jar_name}.jar --spring.profile.active=${env_file} |
| 22 | 24 | \ No newline at end of file | ... | ... |
ruoyi-admin/pom.xml
ruoyi-admin/src/main/java/com/ruoyi/config/RestTemplateConfig.java
0 → 100644
| 1 | +package com.ruoyi.config; | |
| 2 | + | |
| 3 | +import org.springframework.context.annotation.Bean; | |
| 4 | +import org.springframework.context.annotation.Configuration; | |
| 5 | +import org.springframework.web.client.RestTemplate; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * @author 20412 | |
| 9 | + */ | |
| 10 | +@Configuration | |
| 11 | +public class RestTemplateConfig { | |
| 12 | + @Bean | |
| 13 | + public RestTemplate getRestTemplate(){ | |
| 14 | + return new RestTemplate(); | |
| 15 | + } | |
| 16 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/controller/FeiAoController.java deleted
100644 → 0
| 1 | -package com.ruoyi.controller; | |
| 2 | - | |
| 3 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 4 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 5 | -import org.springframework.web.bind.annotation.RestController; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * @author 20412 | |
| 9 | - */ | |
| 10 | -@RestController | |
| 11 | -@RequestMapping("/api") | |
| 12 | -public class FeiAoController { | |
| 13 | - | |
| 14 | - @RequestMapping(value = "/test",method = RequestMethod.GET) | |
| 15 | - public String test(){ | |
| 16 | - return "测试"; | |
| 17 | - } | |
| 18 | -} |
ruoyi-admin/src/main/java/com/ruoyi/system/controller/TestHhhController.java renamed to ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
| 1 | -package com.ruoyi.system.controller; | |
| 1 | +package com.ruoyi.driver.controller; | |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import javax.servlet.http.HttpServletResponse; |
| ... | ... | @@ -16,89 +16,89 @@ import com.ruoyi.common.annotation.Log; |
| 16 | 16 | import com.ruoyi.common.core.controller.BaseController; |
| 17 | 17 | import com.ruoyi.common.core.domain.AjaxResult; |
| 18 | 18 | import com.ruoyi.common.enums.BusinessType; |
| 19 | -import com.ruoyi.system.domain.TestHhh; | |
| 20 | -import com.ruoyi.system.service.ITestHhhService; | |
| 19 | +import com.ruoyi.driver.domain.Driver; | |
| 20 | +import com.ruoyi.driver.service.IDriverService; | |
| 21 | 21 | import com.ruoyi.common.utils.poi.ExcelUtil; |
| 22 | 22 | import com.ruoyi.common.core.page.TableDataInfo; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * ceshiController | |
| 25 | + * 驾驶员信息Controller | |
| 26 | 26 | * |
| 27 | - * @author ruoyi | |
| 28 | - * @date 2023-06-27 | |
| 27 | + * @author 古自健 | |
| 28 | + * @date 2023-07-02 | |
| 29 | 29 | */ |
| 30 | 30 | @RestController |
| 31 | -@RequestMapping("/system/hhh") | |
| 32 | -public class TestHhhController extends BaseController | |
| 31 | +@RequestMapping("/driver/driver") | |
| 32 | +public class DriverController extends BaseController | |
| 33 | 33 | { |
| 34 | 34 | @Autowired |
| 35 | - private ITestHhhService testHhhService; | |
| 35 | + private IDriverService driverService; | |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * 查询ceshi列表 | |
| 38 | + * 查询驾驶员信息列表 | |
| 39 | 39 | */ |
| 40 | - @PreAuthorize("@ss.hasPermi('system:hhh:list')") | |
| 40 | + @PreAuthorize("@ss.hasPermi('driver:driver:list')") | |
| 41 | 41 | @GetMapping("/list") |
| 42 | - public TableDataInfo list(TestHhh testHhh) | |
| 42 | + public TableDataInfo list(Driver driver) | |
| 43 | 43 | { |
| 44 | 44 | startPage(); |
| 45 | - List<TestHhh> list = testHhhService.selectTestHhhList(testHhh); | |
| 45 | + List<Driver> list = driverService.selectDriverList(driver); | |
| 46 | 46 | return getDataTable(list); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * 导出ceshi列表 | |
| 50 | + * 导出驾驶员信息列表 | |
| 51 | 51 | */ |
| 52 | - @PreAuthorize("@ss.hasPermi('system:hhh:export')") | |
| 53 | - @Log(title = "ceshi", businessType = BusinessType.EXPORT) | |
| 52 | + @PreAuthorize("@ss.hasPermi('driver:driver:export')") | |
| 53 | + @Log(title = "驾驶员信息", businessType = BusinessType.EXPORT) | |
| 54 | 54 | @PostMapping("/export") |
| 55 | - public void export(HttpServletResponse response, TestHhh testHhh) | |
| 55 | + public void export(HttpServletResponse response, Driver driver) | |
| 56 | 56 | { |
| 57 | - List<TestHhh> list = testHhhService.selectTestHhhList(testHhh); | |
| 58 | - ExcelUtil<TestHhh> util = new ExcelUtil<TestHhh>(TestHhh.class); | |
| 59 | - util.exportExcel(response, list, "ceshi数据"); | |
| 57 | + List<Driver> list = driverService.selectDriverList(driver); | |
| 58 | + ExcelUtil<Driver> util = new ExcelUtil<Driver>(Driver.class); | |
| 59 | + util.exportExcel(response, list, "驾驶员信息数据"); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * 获取ceshi详细信息 | |
| 63 | + * 获取驾驶员信息详细信息 | |
| 64 | 64 | */ |
| 65 | - @PreAuthorize("@ss.hasPermi('system:hhh:query')") | |
| 65 | + @PreAuthorize("@ss.hasPermi('driver:driver:query')") | |
| 66 | 66 | @GetMapping(value = "/{id}") |
| 67 | 67 | public AjaxResult getInfo(@PathVariable("id") Long id) |
| 68 | 68 | { |
| 69 | - return success(testHhhService.selectTestHhhById(id)); | |
| 69 | + return success(driverService.selectDriverById(id)); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * 新增ceshi | |
| 73 | + * 新增驾驶员信息 | |
| 74 | 74 | */ |
| 75 | - @PreAuthorize("@ss.hasPermi('system:hhh:add')") | |
| 76 | - @Log(title = "ceshi", businessType = BusinessType.INSERT) | |
| 75 | + @PreAuthorize("@ss.hasPermi('driver:driver:add')") | |
| 76 | + @Log(title = "驾驶员信息", businessType = BusinessType.INSERT) | |
| 77 | 77 | @PostMapping |
| 78 | - public AjaxResult add(@RequestBody TestHhh testHhh) | |
| 78 | + public AjaxResult add(@RequestBody Driver driver) | |
| 79 | 79 | { |
| 80 | - return toAjax(testHhhService.insertTestHhh(testHhh)); | |
| 80 | + return toAjax(driverService.insertDriver(driver)); | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * 修改ceshi | |
| 84 | + * 修改驾驶员信息 | |
| 85 | 85 | */ |
| 86 | - @PreAuthorize("@ss.hasPermi('system:hhh:edit')") | |
| 87 | - @Log(title = "ceshi", businessType = BusinessType.UPDATE) | |
| 86 | + @PreAuthorize("@ss.hasPermi('driver:driver:edit')") | |
| 87 | + @Log(title = "驾驶员信息", businessType = BusinessType.UPDATE) | |
| 88 | 88 | @PutMapping |
| 89 | - public AjaxResult edit(@RequestBody TestHhh testHhh) | |
| 89 | + public AjaxResult edit(@RequestBody Driver driver) | |
| 90 | 90 | { |
| 91 | - return toAjax(testHhhService.updateTestHhh(testHhh)); | |
| 91 | + return toAjax(driverService.updateDriver(driver)); | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * 删除ceshi | |
| 95 | + * 删除驾驶员信息 | |
| 96 | 96 | */ |
| 97 | - @PreAuthorize("@ss.hasPermi('system:hhh:remove')") | |
| 98 | - @Log(title = "ceshi", businessType = BusinessType.DELETE) | |
| 97 | + @PreAuthorize("@ss.hasPermi('driver:driver:remove')") | |
| 98 | + @Log(title = "驾驶员信息", businessType = BusinessType.DELETE) | |
| 99 | 99 | @DeleteMapping("/{ids}") |
| 100 | 100 | public AjaxResult remove(@PathVariable Long[] ids) |
| 101 | 101 | { |
| 102 | - return toAjax(testHhhService.deleteTestHhhByIds(ids)); | |
| 102 | + return toAjax(driverService.deleteDriverByIds(ids)); | |
| 103 | 103 | } |
| 104 | 104 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
0 → 100644
| 1 | +package com.ruoyi.driver.domain; | |
| 2 | + | |
| 3 | +import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 4 | +import org.apache.commons.lang3.builder.ToStringStyle; | |
| 5 | +import com.ruoyi.common.annotation.Excel; | |
| 6 | +import com.ruoyi.common.core.domain.BaseEntity; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 驾驶员信息对象 driver | |
| 10 | + * | |
| 11 | + * @author 古自健 | |
| 12 | + * @date 2023-07-02 | |
| 13 | + */ | |
| 14 | +public class Driver extends BaseEntity | |
| 15 | +{ | |
| 16 | + private static final long serialVersionUID = 1L; | |
| 17 | + | |
| 18 | + /** 主键 */ | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + /** 工号 */ | |
| 22 | + @Excel(name = "工号") | |
| 23 | + private String jobCode; | |
| 24 | + | |
| 25 | + /** 公司编码 */ | |
| 26 | + @Excel(name = "公司编码") | |
| 27 | + private String companyCode; | |
| 28 | + | |
| 29 | + /** 分公司编码 */ | |
| 30 | + @Excel(name = "分公司编码") | |
| 31 | + private String brancheCompanyCode; | |
| 32 | + | |
| 33 | + /** 姓名 */ | |
| 34 | + @Excel(name = "姓名") | |
| 35 | + private String personnelName; | |
| 36 | + | |
| 37 | + /** 运营服务证书号 */ | |
| 38 | + @Excel(name = "运营服务证书号") | |
| 39 | + private String papersCode; | |
| 40 | + | |
| 41 | + /** 一卡通工作卡号 */ | |
| 42 | + @Excel(name = "一卡通工作卡号") | |
| 43 | + private String icCardCode; | |
| 44 | + | |
| 45 | + /** 性别 */ | |
| 46 | + @Excel(name = "性别") | |
| 47 | + private String personnelType; | |
| 48 | + | |
| 49 | + /** 所属岗位/工种 */ | |
| 50 | + @Excel(name = "所属岗位/工种") | |
| 51 | + private String posts; | |
| 52 | + | |
| 53 | + /** 身份证 */ | |
| 54 | + @Excel(name = "身份证") | |
| 55 | + private String card; | |
| 56 | + | |
| 57 | + /** 联系电话 */ | |
| 58 | + @Excel(name = "联系电话") | |
| 59 | + private String telphone; | |
| 60 | + | |
| 61 | + /** RFID 人卡IC号 */ | |
| 62 | + @Excel(name = "RFID 人卡IC号") | |
| 63 | + private String icRfid; | |
| 64 | + | |
| 65 | + /** RFID 人卡ID号(10进制) */ | |
| 66 | + @Excel(name = "RFID 人卡ID号", readConverterExp = "1=0进制") | |
| 67 | + private String idRfid; | |
| 68 | + | |
| 69 | + /** RFID 标签号 */ | |
| 70 | + @Excel(name = "RFID 标签号") | |
| 71 | + private String tagRfid; | |
| 72 | + | |
| 73 | + /** 线路名称 */ | |
| 74 | + @Excel(name = "线路名称") | |
| 75 | + private String lineName; | |
| 76 | + | |
| 77 | + /** 线路编码 */ | |
| 78 | + @Excel(name = "线路编码") | |
| 79 | + private String lineCode; | |
| 80 | + | |
| 81 | + public void setId(Long id) | |
| 82 | + { | |
| 83 | + this.id = id; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Long getId() | |
| 87 | + { | |
| 88 | + return id; | |
| 89 | + } | |
| 90 | + public void setJobCode(String jobCode) | |
| 91 | + { | |
| 92 | + this.jobCode = jobCode; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public String getJobCode() | |
| 96 | + { | |
| 97 | + return jobCode; | |
| 98 | + } | |
| 99 | + public void setCompanyCode(String companyCode) | |
| 100 | + { | |
| 101 | + this.companyCode = companyCode; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public String getCompanyCode() | |
| 105 | + { | |
| 106 | + return companyCode; | |
| 107 | + } | |
| 108 | + public void setBrancheCompanyCode(String brancheCompanyCode) | |
| 109 | + { | |
| 110 | + this.brancheCompanyCode = brancheCompanyCode; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public String getBrancheCompanyCode() | |
| 114 | + { | |
| 115 | + return brancheCompanyCode; | |
| 116 | + } | |
| 117 | + public void setPersonnelName(String personnelName) | |
| 118 | + { | |
| 119 | + this.personnelName = personnelName; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public String getPersonnelName() | |
| 123 | + { | |
| 124 | + return personnelName; | |
| 125 | + } | |
| 126 | + public void setPapersCode(String papersCode) | |
| 127 | + { | |
| 128 | + this.papersCode = papersCode; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public String getPapersCode() | |
| 132 | + { | |
| 133 | + return papersCode; | |
| 134 | + } | |
| 135 | + public void setIcCardCode(String icCardCode) | |
| 136 | + { | |
| 137 | + this.icCardCode = icCardCode; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public String getIcCardCode() | |
| 141 | + { | |
| 142 | + return icCardCode; | |
| 143 | + } | |
| 144 | + public void setPersonnelType(String personnelType) | |
| 145 | + { | |
| 146 | + this.personnelType = personnelType; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public String getPersonnelType() | |
| 150 | + { | |
| 151 | + return personnelType; | |
| 152 | + } | |
| 153 | + public void setPosts(String posts) | |
| 154 | + { | |
| 155 | + this.posts = posts; | |
| 156 | + } | |
| 157 | + | |
| 158 | + public String getPosts() | |
| 159 | + { | |
| 160 | + return posts; | |
| 161 | + } | |
| 162 | + public void setCard(String card) | |
| 163 | + { | |
| 164 | + this.card = card; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public String getCard() | |
| 168 | + { | |
| 169 | + return card; | |
| 170 | + } | |
| 171 | + public void setTelphone(String telphone) | |
| 172 | + { | |
| 173 | + this.telphone = telphone; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public String getTelphone() | |
| 177 | + { | |
| 178 | + return telphone; | |
| 179 | + } | |
| 180 | + public void setIcRfid(String icRfid) | |
| 181 | + { | |
| 182 | + this.icRfid = icRfid; | |
| 183 | + } | |
| 184 | + | |
| 185 | + public String getIcRfid() | |
| 186 | + { | |
| 187 | + return icRfid; | |
| 188 | + } | |
| 189 | + public void setIdRfid(String idRfid) | |
| 190 | + { | |
| 191 | + this.idRfid = idRfid; | |
| 192 | + } | |
| 193 | + | |
| 194 | + public String getIdRfid() | |
| 195 | + { | |
| 196 | + return idRfid; | |
| 197 | + } | |
| 198 | + public void setTagRfid(String tagRfid) | |
| 199 | + { | |
| 200 | + this.tagRfid = tagRfid; | |
| 201 | + } | |
| 202 | + | |
| 203 | + public String getTagRfid() | |
| 204 | + { | |
| 205 | + return tagRfid; | |
| 206 | + } | |
| 207 | + public void setLineName(String lineName) | |
| 208 | + { | |
| 209 | + this.lineName = lineName; | |
| 210 | + } | |
| 211 | + | |
| 212 | + public String getLineName() | |
| 213 | + { | |
| 214 | + return lineName; | |
| 215 | + } | |
| 216 | + public void setLineCode(String lineCode) | |
| 217 | + { | |
| 218 | + this.lineCode = lineCode; | |
| 219 | + } | |
| 220 | + | |
| 221 | + public String getLineCode() | |
| 222 | + { | |
| 223 | + return lineCode; | |
| 224 | + } | |
| 225 | + | |
| 226 | + @Override | |
| 227 | + public String toString() { | |
| 228 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |
| 229 | + .append("id", getId()) | |
| 230 | + .append("jobCode", getJobCode()) | |
| 231 | + .append("companyCode", getCompanyCode()) | |
| 232 | + .append("brancheCompanyCode", getBrancheCompanyCode()) | |
| 233 | + .append("personnelName", getPersonnelName()) | |
| 234 | + .append("papersCode", getPapersCode()) | |
| 235 | + .append("icCardCode", getIcCardCode()) | |
| 236 | + .append("personnelType", getPersonnelType()) | |
| 237 | + .append("posts", getPosts()) | |
| 238 | + .append("card", getCard()) | |
| 239 | + .append("telphone", getTelphone()) | |
| 240 | + .append("icRfid", getIcRfid()) | |
| 241 | + .append("idRfid", getIdRfid()) | |
| 242 | + .append("tagRfid", getTagRfid()) | |
| 243 | + .append("remark", getRemark()) | |
| 244 | + .append("lineName", getLineName()) | |
| 245 | + .append("lineCode", getLineCode()) | |
| 246 | + .toString(); | |
| 247 | + } | |
| 248 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/TestHhhMapper.java renamed to ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
| 1 | -package com.ruoyi.system.mapper; | |
| 1 | +package com.ruoyi.driver.mapper; | |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | -import com.ruoyi.system.domain.TestHhh; | |
| 4 | +import com.ruoyi.driver.domain.Driver; | |
| 5 | +import org.apache.ibatis.annotations.Param; | |
| 5 | 6 | |
| 6 | 7 | /** |
| 7 | - * ceshiMapper接口 | |
| 8 | + * 驾驶员信息Mapper接口 | |
| 8 | 9 | * |
| 9 | - * @author ruoyi | |
| 10 | - * @date 2023-06-27 | |
| 10 | + * @author 古自健 | |
| 11 | + * @date 2023-07-02 | |
| 11 | 12 | */ |
| 12 | -public interface TestHhhMapper | |
| 13 | +public interface DriverMapper | |
| 13 | 14 | { |
| 14 | 15 | /** |
| 15 | - * 查询ceshi | |
| 16 | + * 查询驾驶员信息 | |
| 16 | 17 | * |
| 17 | - * @param id ceshi主键 | |
| 18 | - * @return ceshi | |
| 18 | + * @param id 驾驶员信息主键 | |
| 19 | + * @return 驾驶员信息 | |
| 19 | 20 | */ |
| 20 | - public TestHhh selectTestHhhById(Long id); | |
| 21 | + public Driver selectDriverById(Long id); | |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | - * 查询ceshi列表 | |
| 24 | + * 查询驾驶员信息列表 | |
| 24 | 25 | * |
| 25 | - * @param testHhh ceshi | |
| 26 | - * @return ceshi集合 | |
| 26 | + * @param driver 驾驶员信息 | |
| 27 | + * @return 驾驶员信息集合 | |
| 27 | 28 | */ |
| 28 | - public List<TestHhh> selectTestHhhList(TestHhh testHhh); | |
| 29 | + public List<Driver> selectDriverList(Driver driver); | |
| 29 | 30 | |
| 30 | 31 | /** |
| 31 | - * 新增ceshi | |
| 32 | + * 新增驾驶员信息 | |
| 32 | 33 | * |
| 33 | - * @param testHhh ceshi | |
| 34 | + * @param driver 驾驶员信息 | |
| 34 | 35 | * @return 结果 |
| 35 | 36 | */ |
| 36 | - public int insertTestHhh(TestHhh testHhh); | |
| 37 | + public int insertDriver(Driver driver); | |
| 37 | 38 | |
| 38 | 39 | /** |
| 39 | - * 修改ceshi | |
| 40 | + * 修改驾驶员信息 | |
| 40 | 41 | * |
| 41 | - * @param testHhh ceshi | |
| 42 | + * @param driver 驾驶员信息 | |
| 42 | 43 | * @return 结果 |
| 43 | 44 | */ |
| 44 | - public int updateTestHhh(TestHhh testHhh); | |
| 45 | + public int updateDriver(Driver driver); | |
| 45 | 46 | |
| 46 | 47 | /** |
| 47 | - * 删除ceshi | |
| 48 | + * 删除驾驶员信息 | |
| 48 | 49 | * |
| 49 | - * @param id ceshi主键 | |
| 50 | + * @param id 驾驶员信息主键 | |
| 50 | 51 | * @return 结果 |
| 51 | 52 | */ |
| 52 | - public int deleteTestHhhById(Long id); | |
| 53 | + public int deleteDriverById(Long id); | |
| 53 | 54 | |
| 54 | 55 | /** |
| 55 | - * 批量删除ceshi | |
| 56 | + * 批量删除驾驶员信息 | |
| 56 | 57 | * |
| 57 | 58 | * @param ids 需要删除的数据主键集合 |
| 58 | 59 | * @return 结果 |
| 59 | 60 | */ |
| 60 | - public int deleteTestHhhByIds(Long[] ids); | |
| 61 | + public int deleteDriverByIds(Long[] ids); | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 批量保存 | |
| 65 | + * @param drivers | |
| 66 | + */ | |
| 67 | + void saveDrivers(@Param("drivers") List<Driver> drivers); | |
| 61 | 68 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
0 → 100644
| 1 | +package com.ruoyi.driver.service; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.ruoyi.driver.domain.Driver; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 驾驶员信息Service接口 | |
| 8 | + * | |
| 9 | + * @author 古自健 | |
| 10 | + * @date 2023-07-02 | |
| 11 | + */ | |
| 12 | +public interface IDriverService | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * 查询驾驶员信息 | |
| 16 | + * | |
| 17 | + * @param id 驾驶员信息主键 | |
| 18 | + * @return 驾驶员信息 | |
| 19 | + */ | |
| 20 | + public Driver selectDriverById(Long id); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询驾驶员信息列表 | |
| 24 | + * | |
| 25 | + * @param driver 驾驶员信息 | |
| 26 | + * @return 驾驶员信息集合 | |
| 27 | + */ | |
| 28 | + public List<Driver> selectDriverList(Driver driver); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 新增驾驶员信息 | |
| 32 | + * | |
| 33 | + * @param driver 驾驶员信息 | |
| 34 | + * @return 结果 | |
| 35 | + */ | |
| 36 | + public int insertDriver(Driver driver); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 修改驾驶员信息 | |
| 40 | + * | |
| 41 | + * @param driver 驾驶员信息 | |
| 42 | + * @return 结果 | |
| 43 | + */ | |
| 44 | + public int updateDriver(Driver driver); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 批量删除驾驶员信息 | |
| 48 | + * | |
| 49 | + * @param ids 需要删除的驾驶员信息主键集合 | |
| 50 | + * @return 结果 | |
| 51 | + */ | |
| 52 | + public int deleteDriverByIds(Long[] ids); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 删除驾驶员信息信息 | |
| 56 | + * | |
| 57 | + * @param id 驾驶员信息主键 | |
| 58 | + * @return 结果 | |
| 59 | + */ | |
| 60 | + public int deleteDriverById(Long id); | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 批量加入数据 | |
| 64 | + * @param drivers | |
| 65 | + */ | |
| 66 | + void insertDrivers(List<Driver> drivers); | |
| 67 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/TestHhhServiceImpl.java renamed to ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| 1 | -package com.ruoyi.system.service.impl; | |
| 1 | +package com.ruoyi.driver.service.impl; | |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | +import com.ruoyi.common.utils.SecurityUtils; | |
| 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | 6 | import org.springframework.stereotype.Service; |
| 6 | -import com.ruoyi.system.mapper.TestHhhMapper; | |
| 7 | -import com.ruoyi.system.domain.TestHhh; | |
| 8 | -import com.ruoyi.system.service.ITestHhhService; | |
| 7 | +import com.ruoyi.driver.mapper.DriverMapper; | |
| 8 | +import com.ruoyi.driver.domain.Driver; | |
| 9 | +import com.ruoyi.driver.service.IDriverService; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | - * ceshiService业务层处理 | |
| 12 | + * 驾驶员信息Service业务层处理 | |
| 12 | 13 | * |
| 13 | - * @author ruoyi | |
| 14 | - * @date 2023-06-27 | |
| 14 | + * @author 古自健 | |
| 15 | + * @date 2023-07-02 | |
| 15 | 16 | */ |
| 16 | 17 | @Service |
| 17 | -public class TestHhhServiceImpl implements ITestHhhService | |
| 18 | +public class DriverServiceImpl implements IDriverService | |
| 18 | 19 | { |
| 19 | 20 | @Autowired |
| 20 | - private TestHhhMapper testHhhMapper; | |
| 21 | + private DriverMapper driverMapper; | |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | - * 查询ceshi | |
| 24 | + * 查询驾驶员信息 | |
| 24 | 25 | * |
| 25 | - * @param id ceshi主键 | |
| 26 | - * @return ceshi | |
| 26 | + * @param id 驾驶员信息主键 | |
| 27 | + * @return 驾驶员信息 | |
| 27 | 28 | */ |
| 28 | 29 | @Override |
| 29 | - public TestHhh selectTestHhhById(Long id) | |
| 30 | + public Driver selectDriverById(Long id) | |
| 30 | 31 | { |
| 31 | - return testHhhMapper.selectTestHhhById(id); | |
| 32 | + return driverMapper.selectDriverById(id); | |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | /** |
| 35 | - * 查询ceshi列表 | |
| 36 | + * 查询驾驶员信息列表 | |
| 36 | 37 | * |
| 37 | - * @param testHhh ceshi | |
| 38 | - * @return ceshi | |
| 38 | + * @param driver 驾驶员信息 | |
| 39 | + * @return 驾驶员信息 | |
| 39 | 40 | */ |
| 40 | 41 | @Override |
| 41 | - public List<TestHhh> selectTestHhhList(TestHhh testHhh) | |
| 42 | + public List<Driver> selectDriverList(Driver driver) | |
| 42 | 43 | { |
| 43 | - return testHhhMapper.selectTestHhhList(testHhh); | |
| 44 | + return driverMapper.selectDriverList(driver); | |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | 47 | /** |
| 47 | - * 新增ceshi | |
| 48 | + * 新增驾驶员信息 | |
| 48 | 49 | * |
| 49 | - * @param testHhh ceshi | |
| 50 | + * @param driver 驾驶员信息 | |
| 50 | 51 | * @return 结果 |
| 51 | 52 | */ |
| 52 | 53 | @Override |
| 53 | - public int insertTestHhh(TestHhh testHhh) | |
| 54 | + public int insertDriver(Driver driver) | |
| 54 | 55 | { |
| 55 | - return testHhhMapper.insertTestHhh(testHhh); | |
| 56 | + return driverMapper.insertDriver(driver); | |
| 56 | 57 | } |
| 57 | 58 | |
| 58 | 59 | /** |
| 59 | - * 修改ceshi | |
| 60 | + * 修改驾驶员信息 | |
| 60 | 61 | * |
| 61 | - * @param testHhh ceshi | |
| 62 | + * @param driver 驾驶员信息 | |
| 62 | 63 | * @return 结果 |
| 63 | 64 | */ |
| 64 | 65 | @Override |
| 65 | - public int updateTestHhh(TestHhh testHhh) | |
| 66 | + public int updateDriver(Driver driver) | |
| 66 | 67 | { |
| 67 | - return testHhhMapper.updateTestHhh(testHhh); | |
| 68 | + return driverMapper.updateDriver(driver); | |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | /** |
| 71 | - * 批量删除ceshi | |
| 72 | + * 批量删除驾驶员信息 | |
| 72 | 73 | * |
| 73 | - * @param ids 需要删除的ceshi主键 | |
| 74 | + * @param ids 需要删除的驾驶员信息主键 | |
| 74 | 75 | * @return 结果 |
| 75 | 76 | */ |
| 76 | 77 | @Override |
| 77 | - public int deleteTestHhhByIds(Long[] ids) | |
| 78 | + public int deleteDriverByIds(Long[] ids) | |
| 78 | 79 | { |
| 79 | - return testHhhMapper.deleteTestHhhByIds(ids); | |
| 80 | + return driverMapper.deleteDriverByIds(ids); | |
| 80 | 81 | } |
| 81 | 82 | |
| 82 | 83 | /** |
| 83 | - * 删除ceshi信息 | |
| 84 | + * 删除驾驶员信息信息 | |
| 84 | 85 | * |
| 85 | - * @param id ceshi主键 | |
| 86 | + * @param id 驾驶员信息主键 | |
| 86 | 87 | * @return 结果 |
| 87 | 88 | */ |
| 88 | 89 | @Override |
| 89 | - public int deleteTestHhhById(Long id) | |
| 90 | + public int deleteDriverById(Long id) | |
| 90 | 91 | { |
| 91 | - return testHhhMapper.deleteTestHhhById(id); | |
| 92 | + return driverMapper.deleteDriverById(id); | |
| 92 | 93 | } |
| 94 | + | |
| 95 | + @Override | |
| 96 | + public void insertDrivers(List<Driver> drivers) { | |
| 97 | + driverMapper.saveDrivers(drivers); | |
| 98 | + } | |
| 99 | + | |
| 93 | 100 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
0 → 100644
| 1 | +package com.ruoyi.job; | |
| 2 | + | |
| 3 | +import com.ruoyi.driver.domain.Driver; | |
| 4 | +import com.ruoyi.driver.service.IDriverService; | |
| 5 | +import com.ruoyi.utils.ListUtils; | |
| 6 | +import org.springframework.beans.factory.InitializingBean; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.beans.factory.annotation.Value; | |
| 9 | +import org.springframework.core.ParameterizedTypeReference; | |
| 10 | +import org.springframework.http.HttpMethod; | |
| 11 | +import org.springframework.stereotype.Component; | |
| 12 | +import org.springframework.web.client.RestTemplate; | |
| 13 | + | |
| 14 | +import javax.annotation.Resource; | |
| 15 | +import java.security.MessageDigest; | |
| 16 | +import java.util.Arrays; | |
| 17 | +import java.util.HashMap; | |
| 18 | +import java.util.List; | |
| 19 | +import java.util.Map; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * 该定时任务用户获取驾驶员信息 | |
| 23 | + * | |
| 24 | + * @author 20412 | |
| 25 | + */ | |
| 26 | +@Component("driverJob") | |
| 27 | +public class DriverJob implements InitializingBean { | |
| 28 | + | |
| 29 | + @Resource | |
| 30 | + private RestTemplate restTemplate; | |
| 31 | + | |
| 32 | + @Autowired | |
| 33 | + private IDriverService driverService; | |
| 34 | + | |
| 35 | + @Value("${api.url.getDriverInfo}") | |
| 36 | + private String getDriverInfoUrl; | |
| 37 | + | |
| 38 | + @Value("${api.config.password}") | |
| 39 | + private String password; | |
| 40 | + | |
| 41 | + @Value("${api.config.nonce}") | |
| 42 | + private String nonce; | |
| 43 | + | |
| 44 | + private static IDriverService DRIVER_SERVICE; | |
| 45 | + private static RestTemplate RESTTEMPLATE; | |
| 46 | + | |
| 47 | + private static String GET_DRIVER_INFO_URL; | |
| 48 | + | |
| 49 | + private static String PASSWORD; | |
| 50 | + | |
| 51 | + private static String NONCE; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 通过该定时任务获取驾驶员信息 并保存到数据库 | |
| 55 | + */ | |
| 56 | + public void getDriverInfo(String params) throws Exception { | |
| 57 | + try { | |
| 58 | + String format = String.format(GET_DRIVER_INFO_URL, params); | |
| 59 | + Map<String, String> configMap = new HashMap<>(5); | |
| 60 | + long timestamp = System.currentTimeMillis(); | |
| 61 | + configMap.put("timestamp", String.valueOf(timestamp)); | |
| 62 | + configMap.put("nonce", NONCE); | |
| 63 | + configMap.put("password", PASSWORD); | |
| 64 | + String sign = getSHA1(configMap); | |
| 65 | + String url = format | |
| 66 | + + "?timestamp=" + timestamp | |
| 67 | + + "&nonce=" + NONCE | |
| 68 | + + "&password=" + PASSWORD | |
| 69 | + + "&sign=" + sign; | |
| 70 | + //生成签名 | |
| 71 | + List<Driver> drivers = RESTTEMPLATE.exchange( | |
| 72 | + url, | |
| 73 | + HttpMethod.GET, | |
| 74 | + null, | |
| 75 | + new ParameterizedTypeReference<List<Driver>>() { | |
| 76 | + }).getBody(); | |
| 77 | + List<List<Driver>> splitList = ListUtils.splitList(drivers, 1000); | |
| 78 | + System.out.println("开始更新数据-----"); | |
| 79 | + for (List<Driver> driverList : splitList) { | |
| 80 | + DRIVER_SERVICE.insertDrivers(driverList); | |
| 81 | + } | |
| 82 | + System.out.println("数据更新完毕-----"); | |
| 83 | + } catch (Exception e) { | |
| 84 | + System.out.println("执行失败:" + e.getMessage()); | |
| 85 | + } | |
| 86 | + System.out.println("执行结束"); | |
| 87 | + } | |
| 88 | + | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 获取签名 | |
| 92 | + * | |
| 93 | + * @param map | |
| 94 | + * @return | |
| 95 | + * @throws Exception | |
| 96 | + */ | |
| 97 | + public static String getSHA1(Map<String, String> map) throws Exception { | |
| 98 | + try { | |
| 99 | + String[] array = new String[map.size()]; | |
| 100 | + map.values().toArray(array); | |
| 101 | + StringBuffer sb = new StringBuffer(); | |
| 102 | + // 字符串排序 | |
| 103 | + Arrays.sort(array); | |
| 104 | + for (int i = 0; i < array.length; i++) { | |
| 105 | + sb.append(array[i]); | |
| 106 | + } | |
| 107 | + String str = sb.toString(); | |
| 108 | + // SHA1签名生成 | |
| 109 | + MessageDigest md = MessageDigest.getInstance("SHA-1"); | |
| 110 | + md.update(str.getBytes()); | |
| 111 | + byte[] digest = md.digest(); | |
| 112 | + StringBuffer hexstr = new StringBuffer(); | |
| 113 | + String shaHex = ""; | |
| 114 | + for (int i = 0; i < digest.length; i++) { | |
| 115 | + shaHex = Integer.toHexString(digest[i] & 0xFF); | |
| 116 | + if (shaHex.length() < 2) { | |
| 117 | + hexstr.append(0); | |
| 118 | + } | |
| 119 | + hexstr.append(shaHex); | |
| 120 | + } | |
| 121 | + return hexstr.toString(); | |
| 122 | + } catch (Exception e) { | |
| 123 | + throw e; | |
| 124 | + } | |
| 125 | + | |
| 126 | + | |
| 127 | + } | |
| 128 | + | |
| 129 | +// public static void main(String[] args) throws Exception{ | |
| 130 | +// RestTemplate restTemplate1 = new RestTemplate(); | |
| 131 | +// String url = "http://101.95.136.206:9089/webservice/rest/person/company/%s"; | |
| 132 | +// String format = String.format(url,"99"); | |
| 133 | +// Map<String, String> configMap = new HashMap<>(5); | |
| 134 | +// long timestamp = System.currentTimeMillis(); | |
| 135 | +// configMap.put("timestamp", String.valueOf(timestamp)); | |
| 136 | +// configMap.put("nonce", "NONCE"); | |
| 137 | +// configMap.put("password", "c4dd3d8cb9a82f6d6a625818618b28ca7bebb464"); | |
| 138 | +// String sign = getSHA1(configMap); | |
| 139 | +// String httpUrl = format | |
| 140 | +// + "?timestamp=" + timestamp | |
| 141 | +// + "&nonce=" + "NONCE" | |
| 142 | +// + "&password=" + "c4dd3d8cb9a82f6d6a625818618b28ca7bebb464" | |
| 143 | +// + "&sign=" + sign; | |
| 144 | +// Object forObject = restTemplate1.getForObject(httpUrl, Object.class); | |
| 145 | +// } | |
| 146 | + | |
| 147 | + @Override | |
| 148 | + public void afterPropertiesSet() throws Exception { | |
| 149 | + GET_DRIVER_INFO_URL = getDriverInfoUrl; | |
| 150 | + NONCE = nonce; | |
| 151 | + PASSWORD = password; | |
| 152 | + RESTTEMPLATE = restTemplate; | |
| 153 | + DRIVER_SERVICE = driverService; | |
| 154 | + } | |
| 155 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/system/domain/TestHhh.java deleted
100644 → 0
| 1 | -package com.ruoyi.system.domain; | |
| 2 | - | |
| 3 | -import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 4 | -import org.apache.commons.lang3.builder.ToStringStyle; | |
| 5 | -import com.ruoyi.common.annotation.Excel; | |
| 6 | -import com.ruoyi.common.core.domain.BaseEntity; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * ceshi对象 test_hhh | |
| 10 | - * | |
| 11 | - * @author ruoyi | |
| 12 | - * @date 2023-06-27 | |
| 13 | - */ | |
| 14 | -public class TestHhh extends BaseEntity | |
| 15 | -{ | |
| 16 | - private static final long serialVersionUID = 1L; | |
| 17 | - | |
| 18 | - /** $column.columnComment */ | |
| 19 | - private Long id; | |
| 20 | - | |
| 21 | - /** $column.columnComment */ | |
| 22 | - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") | |
| 23 | - private String name; | |
| 24 | - | |
| 25 | - /** $column.columnComment */ | |
| 26 | - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") | |
| 27 | - private Long age; | |
| 28 | - | |
| 29 | - public void setId(Long id) | |
| 30 | - { | |
| 31 | - this.id = id; | |
| 32 | - } | |
| 33 | - | |
| 34 | - public Long getId() | |
| 35 | - { | |
| 36 | - return id; | |
| 37 | - } | |
| 38 | - public void setName(String name) | |
| 39 | - { | |
| 40 | - this.name = name; | |
| 41 | - } | |
| 42 | - | |
| 43 | - public String getName() | |
| 44 | - { | |
| 45 | - return name; | |
| 46 | - } | |
| 47 | - public void setAge(Long age) | |
| 48 | - { | |
| 49 | - this.age = age; | |
| 50 | - } | |
| 51 | - | |
| 52 | - public Long getAge() | |
| 53 | - { | |
| 54 | - return age; | |
| 55 | - } | |
| 56 | - | |
| 57 | - @Override | |
| 58 | - public String toString() { | |
| 59 | - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |
| 60 | - .append("id", getId()) | |
| 61 | - .append("name", getName()) | |
| 62 | - .append("age", getAge()) | |
| 63 | - .toString(); | |
| 64 | - } | |
| 65 | -} |
ruoyi-admin/src/main/java/com/ruoyi/system/service/ITestHhhService.java deleted
100644 → 0
| 1 | -package com.ruoyi.system.service; | |
| 2 | - | |
| 3 | -import java.util.List; | |
| 4 | -import com.ruoyi.system.domain.TestHhh; | |
| 5 | - | |
| 6 | -/** | |
| 7 | - * ceshiService接口 | |
| 8 | - * | |
| 9 | - * @author ruoyi | |
| 10 | - * @date 2023-06-27 | |
| 11 | - */ | |
| 12 | -public interface ITestHhhService | |
| 13 | -{ | |
| 14 | - /** | |
| 15 | - * 查询ceshi | |
| 16 | - * | |
| 17 | - * @param id ceshi主键 | |
| 18 | - * @return ceshi | |
| 19 | - */ | |
| 20 | - public TestHhh selectTestHhhById(Long id); | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 查询ceshi列表 | |
| 24 | - * | |
| 25 | - * @param testHhh ceshi | |
| 26 | - * @return ceshi集合 | |
| 27 | - */ | |
| 28 | - public List<TestHhh> selectTestHhhList(TestHhh testHhh); | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 新增ceshi | |
| 32 | - * | |
| 33 | - * @param testHhh ceshi | |
| 34 | - * @return 结果 | |
| 35 | - */ | |
| 36 | - public int insertTestHhh(TestHhh testHhh); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 修改ceshi | |
| 40 | - * | |
| 41 | - * @param testHhh ceshi | |
| 42 | - * @return 结果 | |
| 43 | - */ | |
| 44 | - public int updateTestHhh(TestHhh testHhh); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 批量删除ceshi | |
| 48 | - * | |
| 49 | - * @param ids 需要删除的ceshi主键集合 | |
| 50 | - * @return 结果 | |
| 51 | - */ | |
| 52 | - public int deleteTestHhhByIds(Long[] ids); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 删除ceshi信息 | |
| 56 | - * | |
| 57 | - * @param id ceshi主键 | |
| 58 | - * @return 结果 | |
| 59 | - */ | |
| 60 | - public int deleteTestHhhById(Long id); | |
| 61 | -} |
ruoyi-admin/src/main/java/com/ruoyi/utils/ListUtils.java
0 → 100644
| 1 | +package com.ruoyi.utils; | |
| 2 | + | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 集合工具类 | |
| 8 | + * @author 20412 | |
| 9 | + */ | |
| 10 | +public class ListUtils<T>{ | |
| 11 | + public static <T> List<List<T>> splitList(List<T> list, int batchSize) { | |
| 12 | + List<List<T>> batchList = new ArrayList<>(); | |
| 13 | + for (int i = 0; i < list.size(); i += batchSize) { | |
| 14 | + int endIndex = Math.min(i + batchSize, list.size()); | |
| 15 | + List<T> subList = list.subList(i, endIndex); | |
| 16 | + batchList.add(subList); | |
| 17 | + } | |
| 18 | + return batchList; | |
| 19 | + } | |
| 20 | +} | ... | ... |
ruoyi-admin/src/main/resources/application-druid-dev.yml
| ... | ... | @@ -111,8 +111,24 @@ ruoyi: |
| 111 | 111 | # 实例演示开关 |
| 112 | 112 | demoEnabled: true |
| 113 | 113 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| 114 | - profile: /ruoyi/ruoyi/uploadPath | |
| 114 | + profile: D:/ruoyi/uploadPath | |
| 115 | 115 | # 获取ip地址开关 |
| 116 | 116 | addressEnabled: false |
| 117 | 117 | # 验证码类型 math 数字计算 char 字符验证 |
| 118 | - captchaType: math | |
| 119 | 118 | \ No newline at end of file |
| 119 | + captchaType: math | |
| 120 | +mybatis-plus: | |
| 121 | + # 搜索指定包别名 | |
| 122 | + typeAliasesPackage: com.ruoyi.**.domain | |
| 123 | + # 配置mapper的扫描,找到所有的mapper.xml映射文件 | |
| 124 | + mapperLocations: classpath*:mapper/**/*Mapper.xml | |
| 125 | + # 加载全局的配置文件 | |
| 126 | + configLocation: classpath:mybatis/mybatis-config.xml | |
| 127 | +api: | |
| 128 | + url: | |
| 129 | + # all 为获取所有驾驶员信息 | |
| 130 | + getDriverInfo: http://101.95.136.206:9089/webservice/rest/person/%s | |
| 131 | + getCompanyInfo: http://101.95.136.206:9089/webservice/rest/person/company/%d?timestamp=%&nonce=%s&password=%s&sign=%s | |
| 132 | + config: | |
| 133 | + password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 | |
| 134 | + # 随机字符串 | |
| 135 | + nonce: adfsad | ... | ... |
ruoyi-admin/src/main/resources/application-druid-prd.yml
| ... | ... | @@ -75,4 +75,20 @@ ruoyi: |
| 75 | 75 | # 获取ip地址开关 |
| 76 | 76 | addressEnabled: false |
| 77 | 77 | # 验证码类型 math 数字计算 char 字符验证 |
| 78 | - captchaType: math | |
| 79 | 78 | \ No newline at end of file |
| 79 | + captchaType: math | |
| 80 | +mybatis-plus: | |
| 81 | + # 搜索指定包别名 | |
| 82 | + typeAliasesPackage: com.ruoyi.**.domain | |
| 83 | + # 配置mapper的扫描,找到所有的mapper.xml映射文件 | |
| 84 | + mapperLocations: classpath*:mapper/**/*Mapper.xml | |
| 85 | + # 加载全局的配置文件 | |
| 86 | + configLocation: classpath:mybatis/mybatis-config.xml | |
| 87 | +api: | |
| 88 | + url: | |
| 89 | + # all 为获取所有驾驶员信息 | |
| 90 | + getDriverInfo: http://101.95.136.206:9089/webservice/rest/person/%s | |
| 91 | + getCompanyInfo: http://101.95.136.206:9089/webservice/rest/person/company/%d?timestamp=%&nonce=%s&password=%s&sign=%s | |
| 92 | + config: | |
| 93 | + password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 | |
| 94 | + # 随机字符串 | |
| 95 | + nonce: adfsad | |
| 80 | 96 | \ No newline at end of file | ... | ... |
ruoyi-admin/src/main/resources/application-druid-uat.yml
| ... | ... | @@ -115,4 +115,20 @@ ruoyi: |
| 115 | 115 | # 获取ip地址开关 |
| 116 | 116 | addressEnabled: false |
| 117 | 117 | # 验证码类型 math 数字计算 char 字符验证 |
| 118 | - captchaType: math | |
| 119 | 118 | \ No newline at end of file |
| 119 | + captchaType: math | |
| 120 | +mybatis-plus: | |
| 121 | + # 搜索指定包别名 | |
| 122 | + typeAliasesPackage: com.ruoyi.**.domain | |
| 123 | + # 配置mapper的扫描,找到所有的mapper.xml映射文件 | |
| 124 | + mapperLocations: classpath*:mapper/**/*Mapper.xml | |
| 125 | + # 加载全局的配置文件 | |
| 126 | + configLocation: classpath:mybatis/mybatis-config.xml | |
| 127 | +api: | |
| 128 | + url: | |
| 129 | + # all 为获取所有驾驶员信息 | |
| 130 | + getDriverInfo: http://101.95.136.206:9089/webservice/rest/person/%s | |
| 131 | + getCompanyInfo: http://101.95.136.206:9089/webservice/rest/person/company/%d?timestamp=%&nonce=%s&password=%s&sign=%s | |
| 132 | + config: | |
| 133 | + password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 | |
| 134 | + # 随机字符串 | |
| 135 | + nonce: adfsad | ... | ... |
ruoyi-admin/src/main/resources/application.yml
| ... | ... | @@ -94,7 +94,7 @@ token: |
| 94 | 94 | # 令牌密钥 |
| 95 | 95 | secret: abcdefghijklmnopqrstuvwxyz |
| 96 | 96 | # 令牌有效期(默认30分钟) |
| 97 | - expireTime: 30 | |
| 97 | + expireTime: 1440 | |
| 98 | 98 | |
| 99 | 99 | # MyBatis配置 |
| 100 | 100 | mybatis: |
| ... | ... | @@ -127,3 +127,21 @@ xss: |
| 127 | 127 | excludes: /system/notice |
| 128 | 128 | # 匹配链接 |
| 129 | 129 | urlPatterns: /system/*,/monitor/*,/tool/* |
| 130 | +mybatis-plus: | |
| 131 | + # 搜索指定包别名 | |
| 132 | + typeAliasesPackage: com.ruoyi.**.domain | |
| 133 | + # 配置mapper的扫描,找到所有的mapper.xml映射文件 | |
| 134 | + mapperLocations: classpath*:mapper/**/*Mapper.xml | |
| 135 | + # 加载全局的配置文件 | |
| 136 | + configLocation: classpath:mybatis/mybatis-config.xml | |
| 137 | + | |
| 138 | +api: | |
| 139 | + url: | |
| 140 | + # all 为获取所有驾驶员信息 | |
| 141 | + getDriverInfo: http://101.95.136.206:9089/webservice/rest/person/%s | |
| 142 | + getCompanyInfo: http://101.95.136.206:9089/webservice/rest/person/company/%d?timestamp=%&nonce=%s&password=%s&sign=%s | |
| 143 | + config: | |
| 144 | + password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 | |
| 145 | + # 随机字符串 | |
| 146 | + nonce: adfsad | |
| 147 | + | ... | ... |
ruoyi-admin/src/main/resources/mapper/TestHhhMapper.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8" ?> | |
| 2 | -<!DOCTYPE mapper | |
| 3 | -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | -<mapper namespace="com.ruoyi.system.mapper.TestHhhMapper"> | |
| 6 | - | |
| 7 | - <resultMap type="TestHhh" id="TestHhhResult"> | |
| 8 | - <result property="id" column="id" /> | |
| 9 | - <result property="name" column="name" /> | |
| 10 | - <result property="age" column="age" /> | |
| 11 | - </resultMap> | |
| 12 | - | |
| 13 | - <sql id="selectTestHhhVo"> | |
| 14 | - select id, name, age from test_hhh | |
| 15 | - </sql> | |
| 16 | - | |
| 17 | - <select id="selectTestHhhList" parameterType="TestHhh" resultMap="TestHhhResult"> | |
| 18 | - <include refid="selectTestHhhVo"/> | |
| 19 | - <where> | |
| 20 | - <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | |
| 21 | - <if test="age != null "> and age = #{age}</if> | |
| 22 | - </where> | |
| 23 | - </select> | |
| 24 | - | |
| 25 | - <select id="selectTestHhhById" parameterType="Long" resultMap="TestHhhResult"> | |
| 26 | - <include refid="selectTestHhhVo"/> | |
| 27 | - where id = #{id} | |
| 28 | - </select> | |
| 29 | - | |
| 30 | - <insert id="insertTestHhh" parameterType="TestHhh" useGeneratedKeys="true" keyProperty="id"> | |
| 31 | - insert into test_hhh | |
| 32 | - <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 33 | - <if test="name != null">name,</if> | |
| 34 | - <if test="age != null">age,</if> | |
| 35 | - </trim> | |
| 36 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 37 | - <if test="name != null">#{name},</if> | |
| 38 | - <if test="age != null">#{age},</if> | |
| 39 | - </trim> | |
| 40 | - </insert> | |
| 41 | - | |
| 42 | - <update id="updateTestHhh" parameterType="TestHhh"> | |
| 43 | - update test_hhh | |
| 44 | - <trim prefix="SET" suffixOverrides=","> | |
| 45 | - <if test="name != null">name = #{name},</if> | |
| 46 | - <if test="age != null">age = #{age},</if> | |
| 47 | - </trim> | |
| 48 | - where id = #{id} | |
| 49 | - </update> | |
| 50 | - | |
| 51 | - <delete id="deleteTestHhhById" parameterType="Long"> | |
| 52 | - delete from test_hhh where id = #{id} | |
| 53 | - </delete> | |
| 54 | - | |
| 55 | - <delete id="deleteTestHhhByIds" parameterType="String"> | |
| 56 | - delete from test_hhh where id in | |
| 57 | - <foreach item="id" collection="array" open="(" separator="," close=")"> | |
| 58 | - #{id} | |
| 59 | - </foreach> | |
| 60 | - </delete> | |
| 61 | -</mapper> | |
| 62 | 0 | \ No newline at end of file |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.ruoyi.driver.mapper.DriverMapper"> | |
| 6 | + | |
| 7 | + <resultMap type="Driver" id="DriverResult"> | |
| 8 | + <result property="id" column="id"/> | |
| 9 | + <result property="jobCode" column="jobCode"/> | |
| 10 | + <result property="companyCode" column="companyCode"/> | |
| 11 | + <result property="brancheCompanyCode" column="brancheCompanyCode"/> | |
| 12 | + <result property="personnelName" column="personnelName"/> | |
| 13 | + <result property="papersCode" column="papersCode"/> | |
| 14 | + <result property="icCardCode" column="icCardCode"/> | |
| 15 | + <result property="personnelType" column="personnelType"/> | |
| 16 | + <result property="posts" column="posts"/> | |
| 17 | + <result property="card" column="card"/> | |
| 18 | + <result property="telphone" column="telphone"/> | |
| 19 | + <result property="icRfid" column="icRfid"/> | |
| 20 | + <result property="idRfid" column="idRfid"/> | |
| 21 | + <result property="tagRfid" column="tagRfid"/> | |
| 22 | + <result property="remark" column="remark"/> | |
| 23 | + <result property="lineName" column="lineName"/> | |
| 24 | + <result property="lineCode" column="lineCode"/> | |
| 25 | + </resultMap> | |
| 26 | + | |
| 27 | + <sql id="selectDriverVo"> | |
| 28 | + select id, | |
| 29 | + jobCode, | |
| 30 | + companyCode, | |
| 31 | + brancheCompanyCode, | |
| 32 | + personnelName, | |
| 33 | + papersCode, | |
| 34 | + icCardCode, | |
| 35 | + personnelType, | |
| 36 | + posts, | |
| 37 | + card, | |
| 38 | + telphone, | |
| 39 | + icRfid, | |
| 40 | + idRfid, | |
| 41 | + tagRfid, | |
| 42 | + remark, | |
| 43 | + lineName, | |
| 44 | + lineCode | |
| 45 | + from driver | |
| 46 | + </sql> | |
| 47 | + | |
| 48 | + <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult"> | |
| 49 | + <include refid="selectDriverVo"/> | |
| 50 | + <where> | |
| 51 | + <if test="jobCode != null and jobCode != ''">and jobCode = #{jobCode}</if> | |
| 52 | + <if test="companyCode != null and companyCode != ''">and companyCode = #{companyCode}</if> | |
| 53 | + <if test="brancheCompanyCode != null and brancheCompanyCode != ''">and brancheCompanyCode = | |
| 54 | + #{brancheCompanyCode} | |
| 55 | + </if> | |
| 56 | + <if test="personnelName != null and personnelName != ''">and personnelName like concat('%', | |
| 57 | + #{personnelName}, '%') | |
| 58 | + </if> | |
| 59 | + <if test="papersCode != null and papersCode != ''">and papersCode = #{papersCode}</if> | |
| 60 | + <if test="icCardCode != null and icCardCode != ''">and icCardCode = #{icCardCode}</if> | |
| 61 | + <if test="personnelType != null and personnelType != ''">and personnelType = #{personnelType}</if> | |
| 62 | + <if test="posts != null and posts != ''">and posts = #{posts}</if> | |
| 63 | + <if test="card != null and card != ''">and card = #{card}</if> | |
| 64 | + <if test="telphone != null and telphone != ''">and telphone = #{telphone}</if> | |
| 65 | + <if test="icRfid != null and icRfid != ''">and icRfid = #{icRfid}</if> | |
| 66 | + <if test="idRfid != null and idRfid != ''">and idRfid = #{idRfid}</if> | |
| 67 | + <if test="tagRfid != null and tagRfid != ''">and tagRfid = #{tagRfid}</if> | |
| 68 | + <if test="lineName != null and lineName != ''">and lineName like concat('%', #{lineName}, '%')</if> | |
| 69 | + <if test="lineCode != null and lineCode != ''">and lineCode = #{lineCode}</if> | |
| 70 | + </where> | |
| 71 | + </select> | |
| 72 | + | |
| 73 | + <select id="selectDriverById" parameterType="Long" resultMap="DriverResult"> | |
| 74 | + <include refid="selectDriverVo"/> | |
| 75 | + where id = #{id} | |
| 76 | + </select> | |
| 77 | + | |
| 78 | + <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> | |
| 79 | + insert into driver | |
| 80 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 81 | + <if test="jobCode != null and jobCode != ''">jobCode,</if> | |
| 82 | + <if test="companyCode != null and companyCode != ''">companyCode,</if> | |
| 83 | + <if test="brancheCompanyCode != null">brancheCompanyCode,</if> | |
| 84 | + <if test="personnelName != null">personnelName,</if> | |
| 85 | + <if test="papersCode != null">papersCode,</if> | |
| 86 | + <if test="icCardCode != null">icCardCode,</if> | |
| 87 | + <if test="personnelType != null">personnelType,</if> | |
| 88 | + <if test="posts != null">posts,</if> | |
| 89 | + <if test="card != null">card,</if> | |
| 90 | + <if test="telphone != null">telphone,</if> | |
| 91 | + <if test="icRfid != null">icRfid,</if> | |
| 92 | + <if test="idRfid != null">idRfid,</if> | |
| 93 | + <if test="tagRfid != null">tagRfid,</if> | |
| 94 | + <if test="remark != null">remark,</if> | |
| 95 | + <if test="lineName != null">lineName,</if> | |
| 96 | + <if test="lineCode != null">lineCode,</if> | |
| 97 | + </trim> | |
| 98 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 99 | + <if test="jobCode != null and jobCode != ''">#{jobCode},</if> | |
| 100 | + <if test="companyCode != null and companyCode != ''">#{companyCode},</if> | |
| 101 | + <if test="brancheCompanyCode != null">#{brancheCompanyCode},</if> | |
| 102 | + <if test="personnelName != null">#{personnelName},</if> | |
| 103 | + <if test="papersCode != null">#{papersCode},</if> | |
| 104 | + <if test="icCardCode != null">#{icCardCode},</if> | |
| 105 | + <if test="personnelType != null">#{personnelType},</if> | |
| 106 | + <if test="posts != null">#{posts},</if> | |
| 107 | + <if test="card != null">#{card},</if> | |
| 108 | + <if test="telphone != null">#{telphone},</if> | |
| 109 | + <if test="icRfid != null">#{icRfid},</if> | |
| 110 | + <if test="idRfid != null">#{idRfid},</if> | |
| 111 | + <if test="tagRfid != null">#{tagRfid},</if> | |
| 112 | + <if test="remark != null">#{remark},</if> | |
| 113 | + <if test="lineName != null">#{lineName},</if> | |
| 114 | + <if test="lineCode != null">#{lineCode},</if> | |
| 115 | + </trim> | |
| 116 | + </insert> | |
| 117 | + <insert id="saveDrivers"> | |
| 118 | + INSERT INTO driver ( | |
| 119 | + jobCode, | |
| 120 | + companyCode, | |
| 121 | + brancheCompanyCode, | |
| 122 | + personnelName, | |
| 123 | + papersCode, | |
| 124 | + icCardCode, | |
| 125 | + personnelType, | |
| 126 | + posts, | |
| 127 | + card, | |
| 128 | + telphone, | |
| 129 | + icRfid, | |
| 130 | + idRfid, | |
| 131 | + tagRfid, | |
| 132 | + remark, | |
| 133 | + lineName, | |
| 134 | + lineCode | |
| 135 | + ) | |
| 136 | + VALUES | |
| 137 | + <foreach collection="drivers" item="item" index="index" separator=","> | |
| 138 | + ( | |
| 139 | + #{item.jobCode,jdbcType=VARCHAR}, | |
| 140 | + #{item.companyCode,jdbcType=VARCHAR}, | |
| 141 | + #{item.brancheCompanyCode,jdbcType=VARCHAR}, | |
| 142 | + #{item.personnelName,jdbcType=VARCHAR}, | |
| 143 | + #{item.papersCode,jdbcType=VARCHAR}, | |
| 144 | + #{item.icCardCode,jdbcType=VARCHAR}, | |
| 145 | + #{item.personnelType,jdbcType=VARCHAR}, | |
| 146 | + #{item.posts,jdbcType=VARCHAR}, | |
| 147 | + #{item.card,jdbcType=VARCHAR}, | |
| 148 | + #{item.telphone,jdbcType=VARCHAR}, | |
| 149 | + #{item.icRfid,jdbcType=VARCHAR}, | |
| 150 | + #{item.idRfid,jdbcType=VARCHAR}, | |
| 151 | + #{item.tagRfid,jdbcType=VARCHAR}, | |
| 152 | + #{item.remark,jdbcType=VARCHAR}, | |
| 153 | + #{item.lineName,jdbcType=VARCHAR}, | |
| 154 | + #{item.lineCode,jdbcType=VARCHAR} | |
| 155 | + ) | |
| 156 | + </foreach> | |
| 157 | + on duplicate key update | |
| 158 | + personnelName = values(personnelName) | |
| 159 | + </insert> | |
| 160 | + | |
| 161 | + <update id="updateDriver" parameterType="Driver"> | |
| 162 | + update driver | |
| 163 | + <trim prefix="SET" suffixOverrides=","> | |
| 164 | + <if test="jobCode != null and jobCode != ''">jobCode = #{jobCode},</if> | |
| 165 | + <if test="companyCode != null and companyCode != ''">companyCode = #{companyCode},</if> | |
| 166 | + <if test="brancheCompanyCode != null">brancheCompanyCode = #{brancheCompanyCode},</if> | |
| 167 | + <if test="personnelName != null">personnelName = #{personnelName},</if> | |
| 168 | + <if test="papersCode != null">papersCode = #{papersCode},</if> | |
| 169 | + <if test="icCardCode != null">icCardCode = #{icCardCode},</if> | |
| 170 | + <if test="personnelType != null">personnelType = #{personnelType},</if> | |
| 171 | + <if test="posts != null">posts = #{posts},</if> | |
| 172 | + <if test="card != null">card = #{card},</if> | |
| 173 | + <if test="telphone != null">telphone = #{telphone},</if> | |
| 174 | + <if test="icRfid != null">icRfid = #{icRfid},</if> | |
| 175 | + <if test="idRfid != null">idRfid = #{idRfid},</if> | |
| 176 | + <if test="tagRfid != null">tagRfid = #{tagRfid},</if> | |
| 177 | + <if test="remark != null">remark = #{remark},</if> | |
| 178 | + <if test="lineName != null">lineName = #{lineName},</if> | |
| 179 | + <if test="lineCode != null">lineCode = #{lineCode},</if> | |
| 180 | + </trim> | |
| 181 | + where id = #{id} | |
| 182 | + </update> | |
| 183 | + | |
| 184 | + <delete id="deleteDriverById" parameterType="Long"> | |
| 185 | + delete | |
| 186 | + from driver | |
| 187 | + where id = #{id} | |
| 188 | + </delete> | |
| 189 | + | |
| 190 | + <delete id="deleteDriverByIds" parameterType="String"> | |
| 191 | + delete from driver where id in | |
| 192 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | |
| 193 | + #{id} | |
| 194 | + </foreach> | |
| 195 | + </delete> | |
| 196 | +</mapper> | |
| 0 | 197 | \ No newline at end of file | ... | ... |
ruoyi-framework/pom.xml
| ... | ... | @@ -23,6 +23,11 @@ |
| 23 | 23 | <artifactId>spring-boot-starter-web</artifactId> |
| 24 | 24 | </dependency> |
| 25 | 25 | |
| 26 | + <dependency> | |
| 27 | + <groupId>com.baomidou</groupId> | |
| 28 | + <artifactId>mybatis-plus-boot-starter</artifactId> | |
| 29 | + <version>3.4.1</version> | |
| 30 | + </dependency> | |
| 26 | 31 | <!-- SpringBoot 拦截器 --> |
| 27 | 32 | <dependency> |
| 28 | 33 | <groupId>org.springframework.boot</groupId> | ... | ... |
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java deleted
100644 → 0
| 1 | -package com.ruoyi.framework.config; | |
| 2 | - | |
| 3 | -import java.io.IOException; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.Arrays; | |
| 6 | -import java.util.HashSet; | |
| 7 | -import java.util.List; | |
| 8 | -import javax.sql.DataSource; | |
| 9 | -import org.apache.ibatis.io.VFS; | |
| 10 | -import org.apache.ibatis.session.SqlSessionFactory; | |
| 11 | -import org.mybatis.spring.SqlSessionFactoryBean; | |
| 12 | -import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; | |
| 13 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | -import org.springframework.context.annotation.Bean; | |
| 15 | -import org.springframework.context.annotation.Configuration; | |
| 16 | -import org.springframework.core.env.Environment; | |
| 17 | -import org.springframework.core.io.DefaultResourceLoader; | |
| 18 | -import org.springframework.core.io.Resource; | |
| 19 | -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | |
| 20 | -import org.springframework.core.io.support.ResourcePatternResolver; | |
| 21 | -import org.springframework.core.type.classreading.CachingMetadataReaderFactory; | |
| 22 | -import org.springframework.core.type.classreading.MetadataReader; | |
| 23 | -import org.springframework.core.type.classreading.MetadataReaderFactory; | |
| 24 | -import org.springframework.util.ClassUtils; | |
| 25 | -import com.ruoyi.common.utils.StringUtils; | |
| 26 | - | |
| 27 | -/** | |
| 28 | - * Mybatis支持*匹配扫描包 | |
| 29 | - * | |
| 30 | - * @author ruoyi | |
| 31 | - */ | |
| 32 | -@Configuration | |
| 33 | -public class MyBatisConfig | |
| 34 | -{ | |
| 35 | - @Autowired | |
| 36 | - private Environment env; | |
| 37 | - | |
| 38 | - static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; | |
| 39 | - | |
| 40 | - public static String setTypeAliasesPackage(String typeAliasesPackage) | |
| 41 | - { | |
| 42 | - ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); | |
| 43 | - MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); | |
| 44 | - List<String> allResult = new ArrayList<String>(); | |
| 45 | - try | |
| 46 | - { | |
| 47 | - for (String aliasesPackage : typeAliasesPackage.split(",")) | |
| 48 | - { | |
| 49 | - List<String> result = new ArrayList<String>(); | |
| 50 | - aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX | |
| 51 | - + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; | |
| 52 | - Resource[] resources = resolver.getResources(aliasesPackage); | |
| 53 | - if (resources != null && resources.length > 0) | |
| 54 | - { | |
| 55 | - MetadataReader metadataReader = null; | |
| 56 | - for (Resource resource : resources) | |
| 57 | - { | |
| 58 | - if (resource.isReadable()) | |
| 59 | - { | |
| 60 | - metadataReader = metadataReaderFactory.getMetadataReader(resource); | |
| 61 | - try | |
| 62 | - { | |
| 63 | - result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); | |
| 64 | - } | |
| 65 | - catch (ClassNotFoundException e) | |
| 66 | - { | |
| 67 | - e.printStackTrace(); | |
| 68 | - } | |
| 69 | - } | |
| 70 | - } | |
| 71 | - } | |
| 72 | - if (result.size() > 0) | |
| 73 | - { | |
| 74 | - HashSet<String> hashResult = new HashSet<String>(result); | |
| 75 | - allResult.addAll(hashResult); | |
| 76 | - } | |
| 77 | - } | |
| 78 | - if (allResult.size() > 0) | |
| 79 | - { | |
| 80 | - typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); | |
| 81 | - } | |
| 82 | - else | |
| 83 | - { | |
| 84 | - throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); | |
| 85 | - } | |
| 86 | - } | |
| 87 | - catch (IOException e) | |
| 88 | - { | |
| 89 | - e.printStackTrace(); | |
| 90 | - } | |
| 91 | - return typeAliasesPackage; | |
| 92 | - } | |
| 93 | - | |
| 94 | - public Resource[] resolveMapperLocations(String[] mapperLocations) | |
| 95 | - { | |
| 96 | - ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); | |
| 97 | - List<Resource> resources = new ArrayList<Resource>(); | |
| 98 | - if (mapperLocations != null) | |
| 99 | - { | |
| 100 | - for (String mapperLocation : mapperLocations) | |
| 101 | - { | |
| 102 | - try | |
| 103 | - { | |
| 104 | - Resource[] mappers = resourceResolver.getResources(mapperLocation); | |
| 105 | - resources.addAll(Arrays.asList(mappers)); | |
| 106 | - } | |
| 107 | - catch (IOException e) | |
| 108 | - { | |
| 109 | - // ignore | |
| 110 | - } | |
| 111 | - } | |
| 112 | - } | |
| 113 | - return resources.toArray(new Resource[resources.size()]); | |
| 114 | - } | |
| 115 | - | |
| 116 | - @Bean | |
| 117 | - public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception | |
| 118 | - { | |
| 119 | - String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); | |
| 120 | - String mapperLocations = env.getProperty("mybatis.mapperLocations"); | |
| 121 | - String configLocation = env.getProperty("mybatis.configLocation"); | |
| 122 | - typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); | |
| 123 | - VFS.addImplClass(SpringBootVFS.class); | |
| 124 | - | |
| 125 | - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); | |
| 126 | - sessionFactory.setDataSource(dataSource); | |
| 127 | - sessionFactory.setTypeAliasesPackage(typeAliasesPackage); | |
| 128 | - sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); | |
| 129 | - sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); | |
| 130 | - return sessionFactory.getObject(); | |
| 131 | - } | |
| 132 | -} | |
| 133 | 0 | \ No newline at end of file |
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java
0 → 100644
| 1 | +package com.ruoyi.framework.config; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.DbType; | |
| 4 | +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; | |
| 5 | +import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; | |
| 6 | +import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; | |
| 7 | +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; | |
| 8 | +import org.springframework.context.annotation.Bean; | |
| 9 | +import org.springframework.context.annotation.Configuration; | |
| 10 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Mybatis Plus 配置 | |
| 14 | + * | |
| 15 | + * @author ruoyi | |
| 16 | + */ | |
| 17 | +@EnableTransactionManagement(proxyTargetClass = true) | |
| 18 | +@Configuration | |
| 19 | +public class MybatisPlusConfig | |
| 20 | +{ | |
| 21 | + @Bean | |
| 22 | + public MybatisPlusInterceptor mybatisPlusInterceptor() | |
| 23 | + { | |
| 24 | + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); | |
| 25 | + // 分页插件 | |
| 26 | + interceptor.addInnerInterceptor(paginationInnerInterceptor()); | |
| 27 | + // 乐观锁插件 | |
| 28 | + interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); | |
| 29 | + // 阻断插件 | |
| 30 | + interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); | |
| 31 | + return interceptor; | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 分页插件,自动识别数据库类型 https://baomidou.com/guide/interceptor-pagination.html | |
| 36 | + */ | |
| 37 | + public PaginationInnerInterceptor paginationInnerInterceptor() | |
| 38 | + { | |
| 39 | + PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); | |
| 40 | + // 设置数据库类型为mysql | |
| 41 | + paginationInnerInterceptor.setDbType(DbType.MYSQL); | |
| 42 | + // 设置最大单页限制数量,默认 500 条,-1 不受限制 | |
| 43 | + paginationInnerInterceptor.setMaxLimit(-1L); | |
| 44 | + return paginationInnerInterceptor; | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html | |
| 49 | + */ | |
| 50 | + public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() | |
| 51 | + { | |
| 52 | + return new OptimisticLockerInnerInterceptor(); | |
| 53 | + } | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html | |
| 57 | + */ | |
| 58 | + public BlockAttackInnerInterceptor blockAttackInnerInterceptor() | |
| 59 | + { | |
| 60 | + return new BlockAttackInnerInterceptor(); | |
| 61 | + } | |
| 62 | +} | ... | ... |
ruoyi-generator/pom.xml
| ... | ... | @@ -17,6 +17,11 @@ |
| 17 | 17 | |
| 18 | 18 | <dependencies> |
| 19 | 19 | |
| 20 | + <dependency> | |
| 21 | + <groupId>com.baomidou</groupId> | |
| 22 | + <artifactId>mybatis-plus-boot-starter</artifactId> | |
| 23 | + <version>3.4.1</version> | |
| 24 | + </dependency> | |
| 20 | 25 | <!--velocity代码生成使用模板 --> |
| 21 | 26 | <dependency> |
| 22 | 27 | <groupId>org.apache.velocity</groupId> | ... | ... |
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
| ... | ... | @@ -7,6 +7,7 @@ import com.ruoyi.common.utils.DateUtils; |
| 7 | 7 | #break |
| 8 | 8 | #end |
| 9 | 9 | #end |
| 10 | +import com.ruoyi.common.utils.SecurityUtils; | |
| 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 12 | import org.springframework.stereotype.Service; |
| 12 | 13 | #if($table.sub) |
| ... | ... | @@ -71,6 +72,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service |
| 71 | 72 | #if($column.javaField == 'createTime') |
| 72 | 73 | ${className}.setCreateTime(DateUtils.getNowDate()); |
| 73 | 74 | #end |
| 75 | +#if($column.javaField == 'createBy') | |
| 76 | + ${className}.setCreateBy(SecurityUtils.getUsername()); | |
| 77 | +#end | |
| 74 | 78 | #end |
| 75 | 79 | #if($table.sub) |
| 76 | 80 | int rows = ${className}Mapper.insert${ClassName}(${className}); |
| ... | ... | @@ -97,6 +101,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service |
| 97 | 101 | #if($column.javaField == 'updateTime') |
| 98 | 102 | ${className}.setUpdateTime(DateUtils.getNowDate()); |
| 99 | 103 | #end |
| 104 | +#if($column.javaField == 'updateBy') | |
| 105 | + ${className}.setUpdateBy(SecurityUtils.getUsername()); | |
| 106 | +#end | |
| 100 | 107 | #end |
| 101 | 108 | #if($table.sub) |
| 102 | 109 | ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); | ... | ... |
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
| 1 | 1 | <template> |
| 2 | 2 | <div class="app-container"> |
| 3 | - <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> | |
| 3 | + <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px"> | |
| 4 | 4 | #foreach($column in $columns) |
| 5 | 5 | #if($column.query) |
| 6 | 6 | #set($dictType=$column.dictType) |
| ... | ... | @@ -127,13 +127,13 @@ |
| 127 | 127 | </template> |
| 128 | 128 | </el-table-column> |
| 129 | 129 | #elseif($column.list && $column.htmlType == "imageUpload") |
| 130 | - <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> | |
| 130 | + <el-table-column label="${comment}" align="center" prop="${javaField}"> | |
| 131 | 131 | <template #default="scope"> |
| 132 | 132 | <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> |
| 133 | 133 | </template> |
| 134 | 134 | </el-table-column> |
| 135 | 135 | #elseif($column.list && "" != $column.dictType) |
| 136 | - <el-table-column label="${comment}" align="center" prop="${javaField}"> | |
| 136 | + <el-table-column label="${comment}" align="center" prop="${javaField}"> | |
| 137 | 137 | <template #default="scope"> |
| 138 | 138 | #if($column.htmlType == "checkbox") |
| 139 | 139 | <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> |
| ... | ... | @@ -146,7 +146,7 @@ |
| 146 | 146 | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| 147 | 147 | #end |
| 148 | 148 | #end |
| 149 | - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 149 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="160"> | |
| 150 | 150 | <template #default="scope"> |
| 151 | 151 | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button> |
| 152 | 152 | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button> | ... | ... |
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
| 1 | 1 | package com.ruoyi.quartz.task; |
| 2 | 2 | |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 4 | import org.springframework.stereotype.Component; |
| 4 | 5 | import com.ruoyi.common.utils.StringUtils; |
| 6 | +import org.springframework.web.client.RestTemplate; | |
| 7 | + | |
| 8 | +import java.security.MessageDigest; | |
| 9 | +import java.util.Arrays; | |
| 10 | +import java.util.HashMap; | |
| 11 | +import java.util.Map; | |
| 5 | 12 | |
| 6 | 13 | /** |
| 7 | 14 | * 定时任务调度测试 |
| 8 | - * | |
| 15 | + * | |
| 9 | 16 | * @author guzijain |
| 10 | 17 | */ |
| 11 | 18 | @Component("ryTask") |
| 12 | -public class RyTask | |
| 13 | -{ | |
| 14 | - public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) | |
| 15 | - { | |
| 19 | +public class RyTask { | |
| 20 | + @Autowired | |
| 21 | + private RestTemplate restTemplate; | |
| 22 | + | |
| 23 | + public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { | |
| 16 | 24 | System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); |
| 17 | 25 | } |
| 18 | 26 | |
| 19 | - public void ryParams(String params) | |
| 20 | - { | |
| 27 | + public void ryParams(String params) { | |
| 21 | 28 | System.out.println("执行有参方法:" + params); |
| 22 | 29 | } |
| 23 | 30 | |
| 24 | - public void ryNoParams() | |
| 25 | - { | |
| 31 | + public void ryNoParams() { | |
| 26 | 32 | System.out.println("执行无参方法"); |
| 27 | 33 | } |
| 34 | + | |
| 35 | + | |
| 28 | 36 | } | ... | ... |