增加多数据源

This commit is contained in:
bo.yang 2021-05-28 16:08:52 +08:00
parent da8f3b4cf8
commit 33747ab132
55 changed files with 3073 additions and 11 deletions

28
box-bps/pom.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>4.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>box-bps</artifactId>
<description>
bps系统模块
</description>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>

28
box-test/pom.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>4.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>box-test</artifactId>
<description>
test系统模块
</description>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,61 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.common.core.domain.AjaxResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* 测试权限登录访问请求
*
* 登录访问返回token POST / http://localhost:80/jwt/login?username=ry&password=admin123
*
* 测试任意权限header携带token GET / http://localhost:80/api/list
*
* 测试菜单权限header携带token GET / http://localhost:80/api/user/list
*
* 测试角色权限header携带token GET / http://localhost:80/api/role/list
*
*/
@RestController
@RequestMapping("/api")
public class ApiController
{
/**
* 无权限访问
*
* @return
*/
@GetMapping("/list")
public AjaxResult list()
{
return AjaxResult.success("list success");
}
/**
* 菜单权限 system:user:list
*/
@GetMapping("/user/list")
@RequiresPermissions("system:user:list")
public AjaxResult userlist()
{
return AjaxResult.success("user list success");
}
/**
* 角色权限 admin
*/
@GetMapping("/role/list")
@RequiresRoles("admin")
public AjaxResult rolelist()
{
return AjaxResult.success("role list success");
}
}

View File

@ -0,0 +1,18 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.test.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/test")
public class BoxTestController {
@Autowired
private TestService testService;
@RequestMapping("test")
public String test(){
testService.test();
return testService.test();
}
}

View File

@ -0,0 +1,45 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.test.service.OracleDdlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalTime;
import java.util.Map;
@RestController
public class FrForCrController {
@Autowired
private OracleDdlService oracleDdlService;
@CrossOrigin
@RequestMapping("/test/frforcr")
public void frforcr(@RequestBody Map<String,Object> map){
for(Object value:map.values()){
String dbName="ds7";
String tableName=value.toString();
String tableNameWithDb=dbName+"."+tableName;
int isTableInDb=oracleDdlService.isTableInDb(dbName,tableName);
if(isTableInDb>0){
try{
oracleDdlService.dropTable(tableNameWithDb);
System.out.println(LocalTime.now()+""+tableNameWithDb+"】已被删除!");
}catch (Exception e){
System.out.println(LocalTime.now()+""+tableNameWithDb+"】删除异常!");
}
}
else{
System.out.println(LocalTime.now()+""+tableNameWithDb+"】不存在!");
}
}
}
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.test.conrtroller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.test.domain.Beauty;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/test")
public class GetJsonReqController {
@CrossOrigin
@RequestMapping(value = "simple")
// json的结构和内部字段名称可以与POJO/DTO/javabean完全对应
public Map<String, String> getJsonBean(@RequestBody Beauty beauty) {
Map<String, String> result = null;
if (beauty != null) {
System.out.println("姓名:" + beauty.getName());
System.out.println("年龄:" + beauty.getAge());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("出生日期:" + sdf.format(beauty.getDate()));
System.out.println("年收入:" + beauty.getSalary());
result = new HashMap<>();
result.put("code", "1");
result.put("msg", "ok");
}
return result;
}
@CrossOrigin
@RequestMapping(value = "complex")
//json的结构较为复杂不直接与POJO/DTO/javabean对应
public Map<String, String> getJsonComplex(@RequestBody JSONObject param) {
Map<String, String> result = null;
if (param != null) {
JSONObject master = param.getJSONObject("master");
Beauty beauty = (Beauty) JSONObject.toJavaObject(master, Beauty.class);
System.out.println(beauty);
JSONArray mm = param.getJSONArray("MM");
for (int i = 0; i < mm.size(); i++) {
// 这里不能使用get(i)因为get(i)只会得到键值对
JSONObject json = mm.getJSONObject(i);
Beauty bt = (Beauty) JSONObject.toJavaObject(json, Beauty.class);
System.out.println(bt);
}
result = new HashMap<>();
result.put("code", "1");
result.put("msg", "ok");
}
return result;
}
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.test.service.OracleDdlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/test")
@DataSource(value = DataSourceType.SLAVE)
public class OracleDdlController {
@Autowired
private OracleDdlService oracleDdlService;
//查询表录数
@RequestMapping("getRecordCount")
public String getRecordCount() {
String tableName = "tc_user";
int result = oracleDdlService.getRecordCount(tableName);
return result + "";
}
//检查表是否存在
@RequestMapping("isTableInDb")
public String isTableInDb() {
String dbName = "ds7";
String tableName = "tc_user";
return (oracleDdlService.isTableInDb(dbName, tableName)>0?"实例ds7中存在表tc_user":"实例ds7中不存在表tc_user");
}
//复制表
@RequestMapping("copyTable")
public String copyTable() {
String originalTalble = "tc_user";
String newTable = "new_tc_user";
if (oracleDdlService.isTableInDb("ds7", originalTalble) > 0) {
try {
oracleDdlService.copyTable(newTable, originalTalble);
return "复制" + originalTalble + "成功!新表名:" + newTable;
} catch (Exception e) {
System.out.println(e);
return "复制" + originalTalble + "失败!";
}
} else {
return ""+originalTalble+"不存在";
}
}
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.test.conrtroller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class SendJsonController {
@RequestMapping("/test/sendjson")
public String ajaxSend(){
return ("test/sendJson");
}
}

View File

@ -0,0 +1,123 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.test.domain.SysCustomer;
import com.ruoyi.test.service.ISysCustomerService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 客户Controller
*
* @author box
* @date 2021-02-13
*/
@Controller
@RequestMapping("/test/customer")
public class SysCustomerController extends BaseController
{
private String prefix = "test/customer";
@Autowired
private ISysCustomerService sysCustomerService;
@RequiresPermissions("test:customer:view")
@GetMapping()
public String customer()
{
return prefix + "/customer";
}
/**
* 查询客户列表
*/
@RequiresPermissions("test:customer:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysCustomer sysCustomer)
{
startPage();
List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer);
return getDataTable(list);
}
/**
* 导出客户列表
*/
@RequiresPermissions("test:customer:export")
@Log(title = "客户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysCustomer sysCustomer)
{
List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer);
ExcelUtil<SysCustomer> util = new ExcelUtil<SysCustomer>(SysCustomer.class);
return util.exportExcel(list, "customer");
}
/**
* 新增客户
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存客户
*/
@RequiresPermissions("test:customer:add")
@Log(title = "客户", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysCustomer sysCustomer)
{
return toAjax(sysCustomerService.insertSysCustomer(sysCustomer));
}
/**
* 修改客户
*/
@GetMapping("/edit/{customerId}")
public String edit(@PathVariable("customerId") Long customerId, ModelMap mmap)
{
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(customerId);
mmap.put("sysCustomer", sysCustomer);
return prefix + "/edit";
}
/**
* 修改保存客户
*/
@RequiresPermissions("test:customer:edit")
@Log(title = "客户", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysCustomer sysCustomer)
{
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer));
}
/**
* 删除客户
*/
@RequiresPermissions("test:customer:remove")
@Log(title = "客户", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(sysCustomerService.deleteSysCustomerByIds(ids));
}
}

View File

@ -0,0 +1,123 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.test.domain.SysFileInfo;
import com.ruoyi.test.service.ISysFileInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 文件信息Controller
*
* @author box
* @date 2021-05-06
*/
@Controller
@RequestMapping("/test/fileinfo")
public class SysFileInfoController extends BaseController
{
private String prefix = "test/fileinfo";
@Autowired
private ISysFileInfoService sysFileInfoService;
@RequiresPermissions("test:fileinfo:view")
@GetMapping()
public String fileinfo()
{
return prefix + "/fileinfo";
}
/**
* 查询文件信息列表
*/
@RequiresPermissions("test:fileinfo:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysFileInfo sysFileInfo)
{
startPage();
List<SysFileInfo> list = sysFileInfoService.selectSysFileInfoList(sysFileInfo);
return getDataTable(list);
}
/**
* 导出文件信息列表
*/
@RequiresPermissions("test:fileinfo:export")
@Log(title = "文件信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysFileInfo sysFileInfo)
{
List<SysFileInfo> list = sysFileInfoService.selectSysFileInfoList(sysFileInfo);
ExcelUtil<SysFileInfo> util = new ExcelUtil<SysFileInfo>(SysFileInfo.class);
return util.exportExcel(list, "文件信息数据");
}
/**
* 新增文件信息
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存文件信息
*/
@RequiresPermissions("test:fileinfo:add")
@Log(title = "文件信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysFileInfo sysFileInfo)
{
return toAjax(sysFileInfoService.insertSysFileInfo(sysFileInfo));
}
/**
* 修改文件信息
*/
@GetMapping("/edit/{fileId}")
public String edit(@PathVariable("fileId") Long fileId, ModelMap mmap)
{
SysFileInfo sysFileInfo = sysFileInfoService.selectSysFileInfoById(fileId);
mmap.put("sysFileInfo", sysFileInfo);
return prefix + "/edit";
}
/**
* 修改保存文件信息
*/
@RequiresPermissions("test:fileinfo:edit")
@Log(title = "文件信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysFileInfo sysFileInfo)
{
return toAjax(sysFileInfoService.updateSysFileInfo(sysFileInfo));
}
/**
* 删除文件信息
*/
@RequiresPermissions("test:fileinfo:remove")
@Log(title = "文件信息", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(sysFileInfoService.deleteSysFileInfoByIds(ids));
}
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.test.domain.TcUser;
import com.ruoyi.test.service.TcUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/test")
public class TcUserController {
@Autowired
private TcUserService tcUserService;
//查询所有
// http://localhost/test/selectall
@RequestMapping("selectAll")
@ResponseBody
public String selectAll(){
List<TcUser> users=tcUserService.selectAll();
users.forEach(System.out::println);
return users.toString()+"";
}
//查询 by id
// http://localhost/test/selectById/1(此处1为要获取的id
@RequestMapping(value = "selectById/{id}", method = RequestMethod.GET)
public String selectById(@PathVariable int id) {
return tcUserService.selectById(id).toString();
}
//插入新用户
// http://localhost/test/insert?id=100&name=张三&password=20
@RequestMapping(value = "/insert", method = RequestMethod.GET)
public TcUser insert(TcUser tcUser) {
return tcUserService.insert(tcUser);
}
//通过用户id删除用户
// http://localhost/test/deleteById?id=1(此处1为要删除的id
@RequestMapping(value = "/deleteById", method = RequestMethod.GET)
public String delete(int id) {
int result = tcUserService.deleteById(id);
if (result >= 1) {
return "删除成功";
} else {
return "删除失败";
}
}
//更新 by id
// http://localhost/test/updateById?id=2&name=波波&password=12
@RequestMapping(value = "/updateById", method = RequestMethod.GET)
public String update(TcUser tcUser) {
int result = tcUserService.updateById(tcUser);
if (result >= 1) {
return "修改成功";
} else {
return "修改失败";
}
}
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.test.conrtroller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import java.time.LocalDateTime;
@Controller
public class TestIndexController {
@RequestMapping("/test")
public String index(ModelMap modelMap){
modelMap.put("date", LocalDateTime.now());
return ("test/index");
}
}

View File

@ -0,0 +1,34 @@
package com.ruoyi.test.conrtroller;
import com.ruoyi.test.service.TestVerifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class TestVerifyController {
@Autowired
private TestVerifyService testVerifyService;
@RequestMapping("/test/testVerify")
public String testVerify(){
return "/test/testVerify";
}
/**
* 校验用户名
*/
@PostMapping("/test/testVerifyName")
@ResponseBody
public int testVerifyName(String name)
{
return testVerifyService.isNameUnique(name);
}
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.test.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Beauty {
private String name;
private int age;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date date;
private double salary;
public Beauty() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
@Override
public String toString() {
return "Beauty [name=" + name + ", age=" + age + ", date=" + date + ", salary=" + salary + "]";
}
}

View File

@ -0,0 +1,113 @@
package com.ruoyi.test.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.util.List;
/**
* 客户对象 sys_customer
*
* @author box
* @date 2021-02-13
*/
public class SysCustomer extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 客户id */
private Long customerId;
/** 客户姓名 */
@Excel(name = "客户姓名")
private String customerName;
/** 手机号码 */
@Excel(name = "手机号码")
private String phonenumber;
/** 客户性别 */
@Excel(name = "客户性别")
private String sex;
/** 客户生日 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "客户生日", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/** 商品信息 */
private List<SysGoods> sysGoodsList;
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setCustomerName(String customerName)
{
this.customerName = customerName;
}
public String getCustomerName()
{
return customerName;
}
public void setPhonenumber(String phonenumber)
{
this.phonenumber = phonenumber;
}
public String getPhonenumber()
{
return phonenumber;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
{
return sex;
}
public void setBirthday(Date birthday)
{
this.birthday = birthday;
}
public Date getBirthday()
{
return birthday;
}
public List<SysGoods> getSysGoodsList()
{
return sysGoodsList;
}
public void setSysGoodsList(List<SysGoods> sysGoodsList)
{
this.sysGoodsList = sysGoodsList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("customerId", getCustomerId())
.append("customerName", getCustomerName())
.append("phonenumber", getPhonenumber())
.append("sex", getSex())
.append("birthday", getBirthday())
.append("remark", getRemark())
.append("sysGoodsList", getSysGoodsList())
.toString();
}
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.test.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 文件信息对象 sys_file_info
*
* @author box
* @date 2021-05-06
*/
public class SysFileInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 文件id */
private Long fileId;
/** 文件名称 */
@Excel(name = "文件名称")
private String fileName;
/** 文件路径 */
@Excel(name = "文件路径")
private String filePath;
public void setFileId(Long fileId)
{
this.fileId = fileId;
}
public Long getFileId()
{
return fileId;
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
public String getFileName()
{
return fileName;
}
public void setFilePath(String filePath)
{
this.filePath = filePath;
}
public String getFilePath()
{
return filePath;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fileId", getFileId())
.append("fileName", getFileName())
.append("filePath", getFilePath())
.toString();
}
}

View File

@ -0,0 +1,124 @@
package com.ruoyi.test.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* 商品对象 sys_goods
*
* @author box
* @date 2021-02-13
*/
public class SysGoods extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 商品id */
private Long goodsId;
/** 客户id */
@Excel(name = "客户id")
private Long customerId;
/** 商品名称 */
@Excel(name = "商品名称")
private String name;
/** 商品重量 */
@Excel(name = "商品重量")
private Integer weight;
/** 商品价格 */
@Excel(name = "商品价格")
private BigDecimal price;
/** 商品时间 */
@Excel(name = "商品时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date date;
/** 商品种类 */
@Excel(name = "商品种类")
private String type;
public void setGoodsId(Long goodsId)
{
this.goodsId = goodsId;
}
public Long getGoodsId()
{
return goodsId;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setWeight(Integer weight)
{
this.weight = weight;
}
public Integer getWeight()
{
return weight;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
public BigDecimal getPrice()
{
return price;
}
public void setDate(Date date)
{
this.date = date;
}
public Date getDate()
{
return date;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("goodsId", getGoodsId())
.append("customerId", getCustomerId())
.append("name", getName())
.append("weight", getWeight())
.append("price", getPrice())
.append("date", getDate())
.append("type", getType())
.toString();
}
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.test.domain;
public class TcUser {
private int id;
private String name;
private String password;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "TcUser{" +
"id=" + id +
", name='" + name + '\'' +
", age='" + password + '\'' +
'}';
}
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.test.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
@Mapper
@Component("OracleDdlMapper")
public interface OracleDdlMapper {
// alter table
int alterTableName(@Param("originalTableName") String originalTableName,
@Param("newTableName") String newTableName);
//truncate table
int truncateTable(@Param("tableName") String tableName);
//drop table
int dropTable(@Param("tableName") String tableName);
//copy table
void copyTable(@Param("newTableName") String newTableName,
@Param("originalTableName") String originalTableName);
//获取表记录数
int getRecordCount(@Param("tableName") String tableName);
//查询数据库中表是否存在
int isTableInDb(@Param("dataBaseName") String dataBaseName,
@Param("tableName") String tableName);
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.test.mapper;
import com.ruoyi.test.domain.SysCustomer;
import com.ruoyi.test.domain.SysGoods;
import java.util.List;
/**
* 客户Mapper接口
*
* @author box
* @date 2021-02-13
*/
public interface SysCustomerMapper
{
/**
* 查询客户
*
* @param customerId 客户ID
* @return 客户
*/
public SysCustomer selectSysCustomerById(Long customerId);
/**
* 查询客户列表
*
* @param sysCustomer 客户
* @return 客户集合
*/
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer);
/**
* 新增客户
*
* @param sysCustomer 客户
* @return 结果
*/
public int insertSysCustomer(SysCustomer sysCustomer);
/**
* 修改客户
*
* @param sysCustomer 客户
* @return 结果
*/
public int updateSysCustomer(SysCustomer sysCustomer);
/**
* 删除客户
*
* @param customerId 客户ID
* @return 结果
*/
public int deleteSysCustomerById(Long customerId);
/**
* 批量删除客户
*
* @param customerIds 需要删除的数据ID
* @return 结果
*/
public int deleteSysCustomerByIds(String[] customerIds);
/**
* 批量删除商品
*
* @param customerIds 需要删除的数据ID
* @return 结果
*/
public int deleteSysGoodsByCustomerIds(String[] customerIds);
/**
* 批量新增商品
*
* @param sysGoodsList 商品列表
* @return 结果
*/
public int batchSysGoods(List<SysGoods> sysGoodsList);
/**
* 通过客户ID删除商品信息
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteSysGoodsByCustomerId(Long customerId);
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.test.mapper;
import com.ruoyi.test.domain.SysFileInfo;
import java.util.List;
/**
* 文件信息Mapper接口
*
* @author box
* @date 2021-05-06
*/
public interface SysFileInfoMapper
{
/**
* 查询文件信息
*
* @param fileId 文件信息ID
* @return 文件信息
*/
public SysFileInfo selectSysFileInfoById(Long fileId);
/**
* 查询文件信息列表
*
* @param sysFileInfo 文件信息
* @return 文件信息集合
*/
public List<SysFileInfo> selectSysFileInfoList(SysFileInfo sysFileInfo);
/**
* 新增文件信息
*
* @param sysFileInfo 文件信息
* @return 结果
*/
public int insertSysFileInfo(SysFileInfo sysFileInfo);
/**
* 修改文件信息
*
* @param sysFileInfo 文件信息
* @return 结果
*/
public int updateSysFileInfo(SysFileInfo sysFileInfo);
/**
* 删除文件信息
*
* @param fileId 文件信息ID
* @return 结果
*/
public int deleteSysFileInfoById(Long fileId);
/**
* 批量删除文件信息
*
* @param fileIds 需要删除的数据ID
* @return 结果
*/
public int deleteSysFileInfoByIds(String[] fileIds);
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.test.mapper;
import com.ruoyi.test.domain.TcUser;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
@Mapper
@Component("TCUserMapper")
public interface TcUserMapper {
//查询所有
List<TcUser> selectAll();
//查询 by id
TcUser selectById(int id);
//增加
int insert(TcUser tcUser);
//删除 by id
int deleteById(int id);
//更新 by id
int updateById(TcUser tcUser);
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.test.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Mapper
@Component("TestVerifyMapper")
public interface TestVerifyMapper {
//检查姓名是否唯一
int isNameUnique(String name);
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.test.service;
import com.ruoyi.test.domain.SysCustomer;
import java.util.List;
/**
* 客户Service接口
*
* @author box
* @date 2021-02-13
*/
public interface ISysCustomerService
{
/**
* 查询客户
*
* @param customerId 客户ID
* @return 客户
*/
public SysCustomer selectSysCustomerById(Long customerId);
/**
* 查询客户列表
*
* @param sysCustomer 客户
* @return 客户集合
*/
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer);
/**
* 新增客户
*
* @param sysCustomer 客户
* @return 结果
*/
public int insertSysCustomer(SysCustomer sysCustomer);
/**
* 修改客户
*
* @param sysCustomer 客户
* @return 结果
*/
public int updateSysCustomer(SysCustomer sysCustomer);
/**
* 批量删除客户
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysCustomerByIds(String ids);
/**
* 删除客户信息
*
* @param customerId 客户ID
* @return 结果
*/
public int deleteSysCustomerById(Long customerId);
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.test.service;
import com.ruoyi.test.domain.SysFileInfo;
import java.util.List;
/**
* 文件信息Service接口
*
* @author box
* @date 2021-05-06
*/
public interface ISysFileInfoService
{
/**
* 查询文件信息
*
* @param fileId 文件信息ID
* @return 文件信息
*/
public SysFileInfo selectSysFileInfoById(Long fileId);
/**
* 查询文件信息列表
*
* @param sysFileInfo 文件信息
* @return 文件信息集合
*/
public List<SysFileInfo> selectSysFileInfoList(SysFileInfo sysFileInfo);
/**
* 新增文件信息
*
* @param sysFileInfo 文件信息
* @return 结果
*/
public int insertSysFileInfo(SysFileInfo sysFileInfo);
/**
* 修改文件信息
*
* @param sysFileInfo 文件信息
* @return 结果
*/
public int updateSysFileInfo(SysFileInfo sysFileInfo);
/**
* 批量删除文件信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFileInfoByIds(String ids);
/**
* 删除文件信息信息
*
* @param fileId 文件信息ID
* @return 结果
*/
public int deleteSysFileInfoById(Long fileId);
}

View File

@ -0,0 +1,22 @@
package com.ruoyi.test.service;
public interface OracleDdlService {
//修改表名
int alterTableName(String originalTableName, String newTableName);
// truncate指定数据库表的数据
int truncateTable(String tableName);
//drop 指定定数据库表
int dropTable(String tableName);
//根据传入的表明创建新的表并且将原表的数据插入到新的Occur表中
void copyTable(String newTableName,String originalTableName);
//统计某张表中的总数据条数
int getRecordCount(String tableName);
//从指定数据库中查询是否存在某张表
int isTableInDb(String dataBaseName, String tableName);
}

View File

@ -0,0 +1,22 @@
package com.ruoyi.test.service;
import com.ruoyi.test.domain.TcUser;
import java.util.List;
public interface TcUserService {
//查询所有用户
List<TcUser> selectAll();
//根据id查询用户信息
TcUser selectById(int id);
//新增用户
TcUser insert (TcUser tcUser);
// 根据id删除
int deleteById (int id);
//更新用户信息
int updateById(TcUser tcUser);
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.test.service;
import org.springframework.stereotype.Service;
@Service
public class TestService {
public String test(){
return "hello,box-test.test";
}
}

View File

@ -0,0 +1,9 @@
package com.ruoyi.test.service;
import org.springframework.stereotype.Service;
@Service
public interface TestVerifyService {
//检查姓名是否唯一
int isNameUnique(String name);
}

View File

@ -0,0 +1,45 @@
package com.ruoyi.test.service.impl;
import com.ruoyi.test.mapper.OracleDdlMapper;
import com.ruoyi.test.service.OracleDdlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
//@DataSource(value = DataSourceType.SLAVE)
public class OracleDdlServiceImpl implements OracleDdlService {
@Autowired
private OracleDdlMapper oracleDdlMapper;
//修改表名
public int alterTableName(String originalTableName, String newTableName)
{
return oracleDdlMapper.alterTableName(originalTableName,newTableName);
}
// truncate指定数据库表的数据
public int truncateTable(String tableName){
return oracleDdlMapper.truncateTable(tableName);
}
//drop 指定定数据库表
public int dropTable(String tableName){
return oracleDdlMapper.dropTable(tableName);
}
//根据传入的表明创建新的表并且将原表的数据插入到新的Occur表中
public void copyTable(String newTableName,String originalTableName){
return ;
}
//统计某张表中的总数据条数
public int getRecordCount(String tableName){
return oracleDdlMapper.getRecordCount(tableName);
}
//从指定数据库中查询是否存在某张表
public int isTableInDb(String dataBaseName, String tableName){
return oracleDdlMapper.isTableInDb(dataBaseName,tableName);
}
}

View File

@ -0,0 +1,132 @@
package com.ruoyi.test.service.impl;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.test.domain.SysCustomer;
import com.ruoyi.test.domain.SysGoods;
import com.ruoyi.test.mapper.SysCustomerMapper;
import com.ruoyi.test.service.ISysCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* 客户Service业务层处理
*
* @author box
* @date 2021-02-13
*/
@Service
public class SysCustomerServiceImpl implements ISysCustomerService
{
@Autowired
private SysCustomerMapper sysCustomerMapper;
/**
* 查询客户
*
* @param customerId 客户ID
* @return 客户
*/
@Override
public SysCustomer selectSysCustomerById(Long customerId)
{
return sysCustomerMapper.selectSysCustomerById(customerId);
}
/**
* 查询客户列表
*
* @param sysCustomer 客户
* @return 客户
*/
@Override
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer)
{
return sysCustomerMapper.selectSysCustomerList(sysCustomer);
}
/**
* 新增客户
*
* @param sysCustomer 客户
* @return 结果
*/
@Transactional
@Override
public int insertSysCustomer(SysCustomer sysCustomer)
{
int rows = sysCustomerMapper.insertSysCustomer(sysCustomer);
insertSysGoods(sysCustomer);
return rows;
}
/**
* 修改客户
*
* @param sysCustomer 客户
* @return 结果
*/
@Transactional
@Override
public int updateSysCustomer(SysCustomer sysCustomer)
{
sysCustomerMapper.deleteSysGoodsByCustomerId(sysCustomer.getCustomerId());
insertSysGoods(sysCustomer);
return sysCustomerMapper.updateSysCustomer(sysCustomer);
}
/**
* 删除客户对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Transactional
@Override
public int deleteSysCustomerByIds(String ids)
{
sysCustomerMapper.deleteSysGoodsByCustomerIds(Convert.toStrArray(ids));
return sysCustomerMapper.deleteSysCustomerByIds(Convert.toStrArray(ids));
}
/**
* 删除客户信息
*
* @param customerId 客户ID
* @return 结果
*/
@Override
public int deleteSysCustomerById(Long customerId)
{
sysCustomerMapper.deleteSysGoodsByCustomerId(customerId);
return sysCustomerMapper.deleteSysCustomerById(customerId);
}
/**
* 新增商品信息
*
* @param sysCustomer 客户对象
*/
public void insertSysGoods(SysCustomer sysCustomer)
{
List<SysGoods> sysGoodsList = sysCustomer.getSysGoodsList();
Long customerId = sysCustomer.getCustomerId();
if (StringUtils.isNotNull(sysGoodsList))
{
List<SysGoods> list = new ArrayList<SysGoods>();
for (SysGoods sysGoods : sysGoodsList)
{
sysGoods.setCustomerId(customerId);
list.add(sysGoods);
}
if (list.size() > 0)
{
sysCustomerMapper.batchSysGoods(list);
}
}
}
}

View File

@ -0,0 +1,95 @@
package com.ruoyi.test.service.impl;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.test.domain.SysFileInfo;
import com.ruoyi.test.mapper.SysFileInfoMapper;
import com.ruoyi.test.service.ISysFileInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 文件信息Service业务层处理
*
* @author box
* @date 2021-05-06
*/
@Service
public class SysFileInfoServiceImpl implements ISysFileInfoService
{
@Autowired
private SysFileInfoMapper sysFileInfoMapper;
/**
* 查询文件信息
*
* @param fileId 文件信息ID
* @return 文件信息
*/
@Override
public SysFileInfo selectSysFileInfoById(Long fileId)
{
return sysFileInfoMapper.selectSysFileInfoById(fileId);
}
/**
* 查询文件信息列表
*
* @param sysFileInfo 文件信息
* @return 文件信息
*/
@Override
public List<SysFileInfo> selectSysFileInfoList(SysFileInfo sysFileInfo)
{
return sysFileInfoMapper.selectSysFileInfoList(sysFileInfo);
}
/**
* 新增文件信息
*
* @param sysFileInfo 文件信息
* @return 结果
*/
@Override
public int insertSysFileInfo(SysFileInfo sysFileInfo)
{
return sysFileInfoMapper.insertSysFileInfo(sysFileInfo);
}
/**
* 修改文件信息
*
* @param sysFileInfo 文件信息
* @return 结果
*/
@Override
public int updateSysFileInfo(SysFileInfo sysFileInfo)
{
return sysFileInfoMapper.updateSysFileInfo(sysFileInfo);
}
/**
* 删除文件信息对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysFileInfoByIds(String ids)
{
return sysFileInfoMapper.deleteSysFileInfoByIds(Convert.toStrArray(ids));
}
/**
* 删除文件信息信息
*
* @param fileId 文件信息ID
* @return 结果
*/
@Override
public int deleteSysFileInfoById(Long fileId)
{
return sysFileInfoMapper.deleteSysFileInfoById(fileId);
}
}

View File

@ -0,0 +1,48 @@
package com.ruoyi.test.service.impl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.test.domain.TcUser;
import com.ruoyi.test.mapper.TcUserMapper;
import com.ruoyi.test.service.TcUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@DataSource(value = DataSourceType.SQLSVR)
public class TcUserServiceImpl implements TcUserService {
@Autowired
private TcUserMapper tcUserMapper;
//查询所有用户
@Override
public List<TcUser> selectAll() {
return tcUserMapper.selectAll();
}
//查询 by id
@Override
public TcUser selectById(int id) {
return tcUserMapper.selectById(id);
}
//新增
@Override
public TcUser insert(TcUser tcUser) {
int user=tcUserMapper.insert(tcUser);
return tcUser;
}
//删除by id
@Override
public int deleteById(int id) {
return tcUserMapper.deleteById(id);
}
//更新 by id
@Override
public int updateById(TcUser tcUser) {
return tcUserMapper.updateById(tcUser);
}
}

View File

@ -0,0 +1,19 @@
package com.ruoyi.test.service.impl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.test.mapper.TestVerifyMapper;
import com.ruoyi.test.service.TestVerifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@DataSource(value = DataSourceType.SQLSVR)
public class TestVerifyServiceImpl implements TestVerifyService {
@Autowired
private TestVerifyMapper testVerifyMapper;
@Override
public int isNameUnique(String name) {
return testVerifyMapper.isNameUnique(name);
}
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.test.mapper.OracleDdlMapper">
<update id="alterTableName">
alter table ${originalTableName} rename ${newTableName}
</update>
<update id="truncateTable">
truncate table ${tableName}
</update>
<update id="dropTable">
drop table ${tableName}
</update>
<update id="copyTable">
create table ${newTableName} as select * from ${originalTableName}
</update>
<select id="getRecordCount" resultType="int">
select count(1) from ${tableName}
</select>
<select id="isTableInDb" resultType="int">
SELECT COUNT(*) FROM ALL_TABLES WHERE OWNER = UPPER(#{dataBaseName}) AND TABLE_NAME = UPPER(#{tableName})
</select>
</mapper>

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.test.mapper.SysCustomerMapper">
<resultMap type="SysCustomer" id="SysCustomerResult">
<result property="customerId" column="customer_id" />
<result property="customerName" column="customer_name" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="birthday" column="birthday" />
<result property="remark" column="remark" />
</resultMap>
<resultMap id="SysCustomerSysGoodsResult" type="SysCustomer" extends="SysCustomerResult">
<collection property="sysGoodsList" notNullColumn="goods_id" javaType="java.util.List" resultMap="SysGoodsResult" />
</resultMap>
<resultMap type="SysGoods" id="SysGoodsResult">
<result property="goodsId" column="goods_id" />
<result property="customerId" column="customer_id" />
<result property="name" column="name" />
<result property="weight" column="weight" />
<result property="price" column="price" />
<result property="date" column="date" />
<result property="type" column="type" />
</resultMap>
<sql id="selectSysCustomerVo">
select customer_id, customer_name, phonenumber, sex, birthday, remark from sys_customer
</sql>
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
<where>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
</where>
</select>
<select id="selectSysCustomerById" parameterType="Long" resultMap="SysCustomerSysGoodsResult">
select a.customer_id, a.customer_name, a.phonenumber, a.sex, a.birthday, a.remark,
b.goods_id, b.customer_id, b.name, b.weight, b.price, b.date, b.type
from sys_customer a
left join sys_goods b on b.customer_id = a.customer_id
where a.customer_id = #{customerId}
</select>
<insert id="insertSysCustomer" parameterType="SysCustomer" useGeneratedKeys="true" keyProperty="customerId">
insert into sys_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerName != null">customer_name,</if>
<if test="phonenumber != null">phonenumber,</if>
<if test="sex != null">sex,</if>
<if test="birthday != null">birthday,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerName != null">#{customerName},</if>
<if test="phonenumber != null">#{phonenumber},</if>
<if test="sex != null">#{sex},</if>
<if test="birthday != null">#{birthday},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysCustomer" parameterType="SysCustomer">
update sys_customer
<trim prefix="SET" suffixOverrides=",">
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="phonenumber != null">phonenumber = #{phonenumber},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where customer_id = #{customerId}
</update>
<delete id="deleteSysCustomerById" parameterType="Long">
delete from sys_customer where customer_id = #{customerId}
</delete>
<delete id="deleteSysCustomerByIds" parameterType="String">
delete from sys_customer where customer_id in
<foreach item="customerId" collection="array" open="(" separator="," close=")">
#{customerId}
</foreach>
</delete>
<delete id="deleteSysGoodsByCustomerIds" parameterType="String">
delete from sys_goods where customer_id in
<foreach item="customerId" collection="array" open="(" separator="," close=")">
#{customerId}
</foreach>
</delete>
<delete id="deleteSysGoodsByCustomerId" parameterType="Long">
delete from sys_goods where customer_id = #{customerId}
</delete>
<insert id="batchSysGoods">
insert into sys_goods( goods_id, customer_id, name, weight, price, date, type) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.goodsId}, #{item.customerId}, #{item.name}, #{item.weight}, #{item.price}, #{item.date}, #{item.type})
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.test.mapper.SysFileInfoMapper">
<resultMap type="SysFileInfo" id="SysFileInfoResult">
<result property="fileId" column="file_id" />
<result property="fileName" column="file_name" />
<result property="filePath" column="file_path" />
</resultMap>
<sql id="selectSysFileInfoVo">
select file_id, file_name, file_path from sys_file_info
</sql>
<select id="selectSysFileInfoList" parameterType="SysFileInfo" resultMap="SysFileInfoResult">
<include refid="selectSysFileInfoVo"/>
<where>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if>
</where>
</select>
<select id="selectSysFileInfoById" parameterType="Long" resultMap="SysFileInfoResult">
<include refid="selectSysFileInfoVo"/>
where file_id = #{fileId}
</select>
<insert id="insertSysFileInfo" parameterType="SysFileInfo" useGeneratedKeys="true" keyProperty="fileId">
insert into sys_file_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fileName != null">file_name,</if>
<if test="filePath != null">file_path,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fileName != null">#{fileName},</if>
<if test="filePath != null">#{filePath},</if>
</trim>
</insert>
<update id="updateSysFileInfo" parameterType="SysFileInfo">
update sys_file_info
<trim prefix="SET" suffixOverrides=",">
<if test="fileName != null">file_name = #{fileName},</if>
<if test="filePath != null">file_path = #{filePath},</if>
</trim>
where file_id = #{fileId}
</update>
<delete id="deleteSysFileInfoById" parameterType="Long">
delete from sys_file_info where file_id = #{fileId}
</delete>
<delete id="deleteSysFileInfoByIds" parameterType="String">
delete from sys_file_info where file_id in
<foreach item="fileId" collection="array" open="(" separator="," close=")">
#{fileId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.test.mapper.TcUserMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.test.domain.TcUser">
<result column="id" jdbcType="INTEGER" property="id"/>
<result column="name" jdbcType="VARCHAR" property="password"/>
<result column="password" jdbcType="VARCHAR" property="password"/>
</resultMap>
<!--返回所有用户信息-->
<select id="selectAll" resultType="com.ruoyi.test.domain.TcUser">
select id, name, password
from tc_user
</select>
<!--查询用户信息 by id-->
<select id="selectById" resultType="com.ruoyi.test.domain.TcUser">
select id,name,password from tc_user where id = #{id}
</select>
<!--增加用户信息-->
<insert id="insert" parameterType="com.ruoyi.test.domain.TcUser" >
insert into tc_user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null and id !=''" >
id,
</if>
<if test="name != null and name !=''" >
name,
</if>
<if test="password != null and password != ''" >
password,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null and id != ''" >
#{id,jdbcType=INTEGER},
</if>
<if test="name != null and name !=''" >
#{name,jdbcType=VARCHAR},
</if>
<if test="password != null and password != ''" >
#{password,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<!--删除用户信息 by id-->
<delete id="deleteById" parameterType="int">
delete from tc_user where id=#{id}
</delete>
<!--根据id更改用户信息-->
<update id="updateById" parameterType="com.ruoyi.test.domain.TcUser">
update tc_user
<set >
<if test="name != null and name != ''" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="password != null and password != ''" >
password = #{password,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.test.mapper.TestVerifyMapper">
<!--查询用户数量 -->
<select id="isNameUnique" resultType="int">
select count(1) from tc_user where name = #{name}
</select>
</mapper>

View File

@ -0,0 +1,167 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增客户')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-customer-add">
<h4 class="form-header h4">客户信息</h4>
<div class="form-group">
<label class="col-sm-3 control-label">客户姓名:</label>
<div class="col-sm-8">
<input name="customerName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">手机号码:</label>
<div class="col-sm-8">
<input name="phonenumber" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户性别:</label>
<div class="col-sm-8">
<select name="sex" class="form-control m-b">
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户生日:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="birthday" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户描述:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control"></textarea>
</div>
</div>
<h4 class="form-header h4">商品信息</h4>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "test/customer"
$("#form-customer-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-customer-add').serialize());
}
}
$("input[name='birthday']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() {
var options = {
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [{
checkbox: true
},
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{
field: 'name',
align: 'center',
title: '商品名称',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].name' value='%s'>", index, value);
return html;
}
},
{
field: 'weight',
align: 'center',
title: '商品重量',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].weight' value='%s'>", index, value);
return html;
}
},
{
field: 'price',
align: 'center',
title: '商品价格',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].price' value='%s'>", index, value);
return html;
}
},
{
field: 'date',
align: 'center',
title: '商品时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].date' value='%s'>", index, value);
return html;
}
},
{
field: 'type',
align: 'center',
title: '商品种类',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].type' value='%s'>", index, value);
return html;
}
}]
};
$.table.init(options);
});
function addColumn() {
var count = $("#" + table.options.id).bootstrapTable('getData').length;
sub.editColumn();
$("#" + table.options.id).bootstrapTable('insertRow', {
index: count,
row: {
index: $.table.serialNumber(count),
name: "",
weight: "",
price: "",
date: "",
type: ""
}
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('客户列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>客户姓名:</label>
<input type="text" name="customerName"/>
</li>
<li>
<label>手机号码:</label>
<input type="text" name="phonenumber"/>
</li>
<li>
<label>客户性别:</label>
<select name="sex">
<option value="">所有</option>
<option value="-1">代码生成请选择字典属性</option>
</select>
</li>
<li>
<label>客户生日:</label>
<input type="text" class="time-input" placeholder="请选择客户生日" name="birthday"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="test:customer:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="test:customer:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="test:customer:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="test:customer:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('test:customer:edit')}]];
var removeFlag = [[${@permission.hasPermi('test:customer:remove')}]];
var prefix = ctx + "test/customer";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "客户",
columns: [{
checkbox: true
},
{
field: 'customerId',
title: '客户id',
visible: false
},
{
field: 'customerName',
title: '客户姓名'
},
{
field: 'phonenumber',
title: '手机号码'
},
{
field: 'sex',
title: '客户性别'
},
{
field: 'birthday',
title: '客户生日'
},
{
field: 'remark',
title: '客户描述'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.customerId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.customerId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,186 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改客户')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<!--<div class="ibox-content">
<form role="form" class="form-inline">
<div class="form-group">
<label for="exampleInputEmail2" class="sr-only">用户名</label>
<input type="email" placeholder="请输入用户名" id="exampleInputEmail2" class="form-control">
</div>
<div class="form-group">
<label for="exampleInputPassword2" class="sr-only">密码</label>
<input type="password" placeholder="请输入密码" id="exampleInputPassword2" class="form-control">
</div>
<div class="checkbox m-l m-r-xs">
<label>
<input type="checkbox"><i></i> 自动登录</label>
</div>
<button class="btn btn-white" type="submit">登录</button>
</form>
</div> -->
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-customer-edit" th:object="${sysCustomer}">
<h4 class="form-header h4">客户信息</h4>
<input name="customerId" th:field="*{customerId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">客户姓名:</label>
<div class="col-sm-8">
<input name="customerName" th:field="*{customerName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">手机号码:</label>
<div class="col-sm-8">
<input name="phonenumber" th:field="*{phonenumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户性别:</label>
<div class="col-sm-8">
<select name="sex" class="form-control m-b">
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户生日:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="birthday" th:value="${#dates.format(sysCustomer.birthday, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户描述:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
</div>
<h4 class="form-header h4">商品信息</h4>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "test/customer";
$("#form-customer-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-customer-edit').serialize());
}
}
$("input[name='birthday']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() {
var options = {
data: [[${sysCustomer.sysGoodsList}]],
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [{
checkbox: true
},
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{
field: 'name',
align: 'center',
title: '商品名称',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].name' value='%s'>", index, value);
return html;
}
},
{
field: 'weight',
align: 'center',
title: '商品重量',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].weight' value='%s'>", index, value);
return html;
}
},
{
field: 'price',
align: 'center',
title: '商品价格',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].price' value='%s'>", index, value);
return html;
}
},
{
field: 'date',
align: 'center',
title: '商品时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].date' value='%s'>", index, value);
return html;
}
},
{
field: 'type',
align: 'center',
title: '商品种类',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='sysGoodsList[%s].type' value='%s'>", index, value);
return html;
}
}]
};
$.table.init(options);
});
function addColumn() {
var count = $("#" + table.options.id).bootstrapTable('getData').length;
sub.editColumn();
$("#" + table.options.id).bootstrapTable('insertRow', {
index: count,
row: {
index: $.table.serialNumber(count),
name: "",
weight: "",
price: "",
date: "",
type: ""
}
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增文件信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-fileinfo-add">
<div class="form-group">
<label class="col-sm-3 control-label">文件名称:</label>
<div class="col-sm-8">
<input name="fileName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">文件路径:</label>
<div class="col-sm-8">
<input name="filePath" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "test/fileinfo"
$("#form-fileinfo-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-fileinfo-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改文件信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-fileinfo-edit" th:object="${sysFileInfo}">
<input name="fileId" th:field="*{fileId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">文件名称:</label>
<div class="col-sm-8">
<input name="fileName" th:field="*{fileName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">文件路径:</label>
<div class="col-sm-8">
<input name="filePath" th:field="*{filePath}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "test/fileinfo";
$("#form-fileinfo-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-fileinfo-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('文件信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>文件名称:</label>
<input type="text" name="fileName"/>
</li>
<li>
<label>文件路径:</label>
<input type="text" name="filePath"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="test:fileinfo:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="test:fileinfo:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="test:fileinfo:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="test:fileinfo:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('test:fileinfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('test:fileinfo:remove')}]];
var prefix = ctx + "test/fileinfo";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "文件信息",
columns: [{
checkbox: true
},
{
field: 'fileId',
title: '文件id',
visible: false
},
{
field: 'fileName',
title: '文件名称'
},
{
field: 'filePath',
title: '文件路径'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.fileId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.fileId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>BPS后台管理系统-测试首页</title>
</head>
<body>
<h1>BPS后台管理系统-测试首页</h1><br><br>
一、Mybaits配置DML测试-Oracle第二数据源
<li><a th:href="@{/test/selectAll}">查询所有用户</a></li>
<li><a th:href="@{/test/insert?id=1000&name=bo&password=12}">新增ID为1000的用户</a></li>
<li><a th:href="@{/test/selectById/1000}">根据ID查询用户,查询id=1000的用户</a></li>
<li><a th:href="@{/test/updateById?id=1000&name=Xia&password=20}">修改用户为1000的用户姓名为Xia</a></li>
<li><a th:href="@{/test/deleteById?id=1000}">删除ID为1000的用户</a></li>
<p></p>
二、Mybaits配置DDL测试-Oracle
<li><a th:href="@{/test/getRecordCount}">查询表中的记录数</a></li>
<li><a th:href="@{/test/isTableInDb}">查询tc_user是否存在</a></li>
<p />
<a th:href="@{/test/sendjson}">Ajax发送获取Json配置测试 </a>
<p />
二、输入后验证测试
<li><a th:href="@{/test/testVerify}">验证数据表中是否有记录</a></li>
<p />
三、当前系统时间<span th:text="${date}"></span>
</body>
</html>

View File

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>发送json</title>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript">
var ctx = [[@{/}]];
function send1() {
var beauty = JSON.stringify({ //将JSON对象转换为字符串
"name": "小王",
"age": 26,
"salary": 200000,
"date": "2019-08-05 08:04:13"
});
$.ajax({
type: 'POST',
url: ctx+"/test/simple",
data: beauty, //beauty是字符串
contentType: "application/json",
dataType: "json",
success: function(message) {
alert(JSON.stringify(message)); //将JSON对象转换为字符串
}
});
};
function send2() {
var beauty = JSON.stringify({
"MM": [{
"name": "张三",
"age": 27,
"salary": 20000,
"date": "2017-05-19 09:33:14"
}, {
"name": "李四",
"age": 30,
"salary": 30000,
"date": "2019-10-21 17:04:33"
}],
"master": {
"name": "小甜甜",
"age": 26,
"salary": 200000,
"date": "2019-08-05 08:04:13"
}
});
$.ajax({
type: "POST",
url: ctx+"/test/complex",
contentType: "application/json; charset=utf-8",
data: beauty,
dataType: "json",
success: function(message) {
alert("提交成功" + JSON.stringify(message));
},
error: function(message) {
alert("提交失败" + JSON.stringify(message));
}
});
};
function send3() {
//var jsonObj = {'t_head': "${t_head}", 't_detail': "${t_detail}"};
var jsonObj = {"t_head": "CSFR412_15175TOPGPAP", "t_detail": "CSFR4125175TOPGPAP"};
$.ajax(
{
type: 'POST',
url: ctx+"/anon/bps/frforcr/toptest",
dataType: "json",
data: JSON.stringify(jsonObj),
contentType : "application/json",
callback: "callback",
success: function (data)
{
alert(data.msg);
},
error: function ()
{
alert(data.msg);
}
}
);
}
</script>
<input type="button" name="btn1" id="s1" onclick="send1()" value="发送简单json" />
<br />
<hr />
<input type="button" name="btn2" id="s2" onclick="send2()" value="发送复杂json" />
<br />
<hr />
<input type="button" name="btn3" id="s3" onclick="send3()" value="发送json到FrForCr" />
</body>
</html>

View File

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('验证测试')" />
</head>
<body>
<div class="col-sm-8">
<div>
<form role="form" class="form-inline" id="form-user-add">
<div class="form-group">用户名:
<label for="name" class="sr-only">用户名</label>
<input id="name" name="name" placeholder="请输入用户名" class="form-control">
</div>
<button class="btn btn-white" type="submit" onclick="submitHandler()">登录</button>
</form>
</div>
</div>
<th:block th:include="include :: footer" />
<script>
var ctx = [[@{/}]];
$("#form-user-add").validate({
onkeyup: false,
rules:{
name:{
minlength: 1,
maxlength: 20,
remote: {
url: ctx+"/test/testVerifyName",
type: "post",
dataType: "json",
data: {
"name": function() {
return $.common.trim($("#name").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"name": {
remote: "用户已经存在"
}
},
focusCleanup: true
});
function submitHandler() {
var user=$.common.trim($("#name").val());
if ($.validate.form()) {
alert("用户【"+user+"】不存在!");
}
else{
alert( "用户【"+user+"】已存在!");
}
}
</script>
</body>
</html>

16
pom.xml
View File

@ -229,6 +229,20 @@
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- test模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>box-test</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- bps模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>box-bps</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -239,6 +253,8 @@
<module>ruoyi-quartz</module> <module>ruoyi-quartz</module>
<module>ruoyi-generator</module> <module>ruoyi-generator</module>
<module>ruoyi-common</module> <module>ruoyi-common</module>
<module>box-test</module>
<module>box-bps</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -61,6 +61,21 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<!-- Oracle驱动-->
<!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc6 -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
<!--SQLServer驱动-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre8</version>
</dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
@ -79,6 +94,18 @@
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>
<!-- test模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>box-test</artifactId>
</dependency>
<!-- bps模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>box-bps</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -2,20 +2,48 @@
spring: spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver #driverClassName: com.mysql.cj.jdbc.Driver
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://192.168.2.18:3306/bps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: password password: abc.123
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
enabled: false enabled: true
url: url: jdbc:oracle:thin:@192.168.2.91:1521/toptest
username: username: ds7
password: password: ds7
driverClassName: oracle.jdbc.driver.OracleDriver
#SQlServer数据源
sqlsvr:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:sqlserver://192.168.2.84:1433;SelectMethod=cursor;DatabaseName=ITDemo
username: sa
password: abc.123
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# Topprod_ds_report
topproddsreport:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:oracle:thin:@192.168.2.91:1521/topprod
username: ds_report
password: ds_report
driverClassName: oracle.jdbc.driver.OracleDriver
# Toptest_ds_report
toptestdsreport:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:oracle:thin:@192.168.2.91:1521/toptest
username: ds_report
password: ds_report
driverClassName: oracle.jdbc.driver.OracleDriver
# 初始连接数 # 初始连接数
initialSize: 5 initialSize: 5
# 最小连接池数量 # 最小连接池数量

View File

@ -9,7 +9,7 @@ ruoyi:
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath profile: C:/ruoyi/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
@ -19,7 +19,7 @@ server:
port: 80 port: 80
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /it_war
tomcat: tomcat:
# tomcat的URI编码 # tomcat的URI编码
uri-encoding: UTF-8 uri-encoding: UTF-8
@ -96,7 +96,7 @@ shiro:
# 首页地址 # 首页地址
indexUrl: /index indexUrl: /index
# 验证码开关 # 验证码开关
captchaEnabled: true captchaEnabled: false
# 验证码类型 math 数组计算 char 字符 # 验证码类型 math 数组计算 char 字符
captchaType: math captchaType: math
cookie: cookie:

View File

@ -15,5 +15,20 @@ public enum DataSourceType
/** /**
* 从库 * 从库
*/ */
SLAVE SLAVE,
/**
* SQLSERVER数据库
*/
SQLSVR,
/**
* TOPPROD_DS_REPORT数据库
*/
TOPPRODDSREPORT,
/**
* TOPTEST_DS_REPORT数据库
*/
TOPTESTDSREPORT
} }

View File

@ -49,6 +49,39 @@ public class DruidConfig
return druidProperties.dataSource(dataSource); return druidProperties.dataSource(dataSource);
} }
//add yangbo 新增SQLSERVER数据源 Begin
@Bean
@ConfigurationProperties("spring.datasource.druid.sqlsvr")
@ConditionalOnProperty(prefix = "spring.datasource.druid.sqlsvr", name = "enabled", havingValue = "true")
public DataSource sqlsvrDataSource(DruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
//add yangbo 新增SQLSERVER数据源 End
//add yangbo 新增topprod ds_report数据源 Begin
@Bean
@ConfigurationProperties("spring.datasource.druid.topproddsreport")
@ConditionalOnProperty(prefix = "spring.datasource.druid.topproddsreport", name = "enabled", havingValue = "true")
public DataSource topproddsreportDataSource(DruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
//add yangbo 新增topprod ds_report数据源 End
//add yangbo 新增toptest ds_report数据源 Begin
@Bean
@ConfigurationProperties("spring.datasource.druid.toptestdsreport")
@ConditionalOnProperty(prefix = "spring.datasource.druid.toptestdsreport", name = "enabled", havingValue = "true")
public DataSource toptestdsreportDataSource(DruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
//add yangbo 新增toptest ds_report数据源 End
@Bean(name = "dynamicDataSource") @Bean(name = "dynamicDataSource")
@Primary @Primary
public DynamicDataSource dataSource(DataSource masterDataSource) public DynamicDataSource dataSource(DataSource masterDataSource)
@ -56,6 +89,11 @@ public class DruidConfig
Map<Object, Object> targetDataSources = new HashMap<>(); Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
//add yangbo 新增SQLSERVERtopproddsreporttoptestdsreport数据源 --Begin
setDataSource(targetDataSources, DataSourceType.SQLSVR.name(), "sqlsvrDataSource");
setDataSource(targetDataSources, DataSourceType.TOPPRODDSREPORT.name(), "topproddsreportDataSource");
setDataSource(targetDataSources, DataSourceType.TOPTESTDSREPORT.name(), "toptestdsreportDataSource");
//add yangbo 新增SQLSERVERtopproddsreporttoptestdsreport数据源 End
return new DynamicDataSource(masterDataSource, targetDataSources); return new DynamicDataSource(masterDataSource, targetDataSources);
} }

View File

@ -274,6 +274,8 @@ public class ShiroConfig
filterChainDefinitionMap.put("/js/**", "anon"); filterChainDefinitionMap.put("/js/**", "anon");
filterChainDefinitionMap.put("/ruoyi/**", "anon"); filterChainDefinitionMap.put("/ruoyi/**", "anon");
filterChainDefinitionMap.put("/captcha/captchaImage**", "anon"); filterChainDefinitionMap.put("/captcha/captchaImage**", "anon");
filterChainDefinitionMap.put("/test/**", "anon"); //为防便测试配置test路径可以匿名访问
filterChainDefinitionMap.put("/anon/**", "anon"); //为防便测试配置anon路径可以匿名访问
// 退出 logout地址shiro去清除session // 退出 logout地址shiro去清除session
filterChainDefinitionMap.put("/logout", "logout"); filterChainDefinitionMap.put("/logout", "logout");
// 不需要拦截的访问 // 不需要拦截的访问