19 changed files with 1049 additions and 108 deletions
@ -0,0 +1,122 @@ |
|||
package com.zdxt.code.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.controller.BaseController; |
|||
import com.zdxt.common.util.TableDataInfo; |
|||
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 com.zdxt.code.domain.EnforcementInspectionProgram; |
|||
import com.zdxt.code.service.IEnforcementInspectionProgramService; |
|||
|
|||
/** |
|||
* 执法检查计划Controller |
|||
* |
|||
* @author chenrui |
|||
* @date 2024-03-12 |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/code/enforcementInspectionProgram") |
|||
public class EnforcementInspectionProgramController extends BaseController |
|||
{ |
|||
private String prefix = "code/enforcementInspectionProgram"; |
|||
|
|||
@Autowired |
|||
private IEnforcementInspectionProgramService enforcementInspectionProgramService; |
|||
|
|||
@RequiresPermissions("code:enforcementInspectionProgram:view") |
|||
@GetMapping() |
|||
public String enforcementInspectionProgram() |
|||
{ |
|||
return prefix + "/enforcementInspectionProgram"; |
|||
} |
|||
|
|||
/** |
|||
* 查询执法检查计划列表 |
|||
*/ |
|||
@RequiresPermissions("code:enforcementInspectionProgram:list") |
|||
@PostMapping("/list") |
|||
@ResponseBody |
|||
public TableDataInfo list(EnforcementInspectionProgram enforcementInspectionProgram) |
|||
{ |
|||
startPage(); |
|||
List<EnforcementInspectionProgram> list = enforcementInspectionProgramService.selectEnforcementInspectionProgramList(enforcementInspectionProgram); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 查询执法检查计划列表 |
|||
*/ |
|||
@RequiresPermissions("code:enforcementInspectionProgram:queryList") |
|||
@GetMapping("/queryList") |
|||
@ResponseBody |
|||
public ZDResponse queryList(EnforcementInspectionProgram enforcementInspectionProgram) |
|||
{ |
|||
startPage(); |
|||
List<EnforcementInspectionProgram> list = enforcementInspectionProgramService.selectEnforcementInspectionProgramList(enforcementInspectionProgram); |
|||
return ZDResponse.success("查询成功",list); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增执法检查计划 |
|||
*/ |
|||
@GetMapping("/add") |
|||
public String add() |
|||
{ |
|||
return prefix + "/add"; |
|||
} |
|||
|
|||
/** |
|||
* 新增保存执法检查计划 |
|||
*/ |
|||
@RequiresPermissions("code:enforcementInspectionProgram:add") |
|||
@PostMapping("/add") |
|||
@ResponseBody |
|||
public ZDResponse addSave(@RequestBody EnforcementInspectionProgram enforcementInspectionProgram) |
|||
{ |
|||
return enforcementInspectionProgramService.insertEnforcementInspectionProgram(enforcementInspectionProgram) > 0 ? |
|||
ZDResponse.success("保存成功"):ZDResponse.error("保存失败"); |
|||
} |
|||
|
|||
/** |
|||
* 修改执法检查计划 |
|||
*/ |
|||
@GetMapping("/edit/{id}") |
|||
public String edit(@PathVariable("id") String id, ModelMap mmap) |
|||
{ |
|||
EnforcementInspectionProgram enforcementInspectionProgram = enforcementInspectionProgramService.selectEnforcementInspectionProgramById(id); |
|||
mmap.put("enforcementInspectionProgram", enforcementInspectionProgram); |
|||
return prefix + "/edit"; |
|||
} |
|||
|
|||
/** |
|||
* 修改保存执法检查计划 |
|||
*/ |
|||
@RequiresPermissions("code:enforcementInspectionProgram:edit") |
|||
@PostMapping("/edit") |
|||
@ResponseBody |
|||
public ZDResponse editSave(EnforcementInspectionProgram enforcementInspectionProgram) |
|||
{ |
|||
return enforcementInspectionProgramService. |
|||
updateEnforcementInspectionProgram(enforcementInspectionProgram) > 0 ? |
|||
ZDResponse.success("修改成功") : ZDResponse.error("修改失败"); |
|||
} |
|||
|
|||
/** |
|||
* 删除执法检查计划 |
|||
*/ |
|||
@RequiresPermissions("code:enforcementInspectionProgram:remove") |
|||
@PostMapping( "/remove") |
|||
@ResponseBody |
|||
public ZDResponse remove(String ids) |
|||
{ |
|||
return enforcementInspectionProgramService.deleteEnforcementInspectionProgramByIds(ids) > 0 ? |
|||
ZDResponse.success("删除成功") : ZDResponse.error("删除失败"); |
|||
} |
|||
} |
|||
@ -0,0 +1,212 @@ |
|||
package com.zdxt.code.domain; |
|||
|
|||
import com.zdxt.common.BaseDomain; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 执法检查计划对象 enforcement_inspection_program |
|||
* |
|||
* @author chenrui |
|||
* @date 2024-03-12 |
|||
*/ |
|||
public class EnforcementInspectionProgram extends BaseDomain |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 主键ID */ |
|||
private String id; |
|||
|
|||
/** 计划年度 */ |
|||
private String planYear; |
|||
|
|||
/** 计划名称 */ |
|||
private String planName; |
|||
|
|||
/** 执法部门 */ |
|||
private String enforcementDepartment; |
|||
|
|||
/** 执法部门ID */ |
|||
private String enforcementDepartmentId; |
|||
|
|||
/** 执法时间 */ |
|||
private Date enforcementTime; |
|||
|
|||
/** 执法区域 */ |
|||
private String enforcementArea; |
|||
|
|||
/** 是否删除 0 否 1是 */ |
|||
private Integer isDelete; |
|||
|
|||
/** |
|||
* 上传文件列表 |
|||
*/ |
|||
private List<FileObject> fileList; |
|||
|
|||
/** |
|||
* 执法计划 |
|||
*/ |
|||
private FileObject fileObject; |
|||
|
|||
/** |
|||
* 关键字搜索 |
|||
*/ |
|||
private String searchText; |
|||
|
|||
/** |
|||
* 日期搜索 |
|||
*/ |
|||
private String dateSearch; |
|||
|
|||
/** |
|||
* 文件对象 |
|||
*/ |
|||
public static class FileObject{ |
|||
private String fileName; |
|||
private String fileUrl; |
|||
|
|||
public String getFileName() { |
|||
return fileName; |
|||
} |
|||
|
|||
public void setFileName(String fileName) { |
|||
this.fileName = fileName; |
|||
} |
|||
|
|||
public String getFileUrl() { |
|||
return fileUrl; |
|||
} |
|||
|
|||
public void setFileUrl(String fileUrl) { |
|||
this.fileUrl = fileUrl; |
|||
} |
|||
} |
|||
|
|||
public void setFileList(List<FileObject> fileList) { |
|||
this.fileList = fileList; |
|||
} |
|||
|
|||
public FileObject getFileObject() { |
|||
return fileObject; |
|||
} |
|||
|
|||
public void setFileObject(FileObject fileObject) { |
|||
this.fileObject = fileObject; |
|||
} |
|||
|
|||
public void setId(String id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setPlanYear(String planYear) |
|||
{ |
|||
this.planYear = planYear; |
|||
} |
|||
|
|||
public String getPlanYear() |
|||
{ |
|||
return planYear; |
|||
} |
|||
public void setPlanName(String planName) |
|||
{ |
|||
this.planName = planName; |
|||
} |
|||
|
|||
public String getPlanName() |
|||
{ |
|||
return planName; |
|||
} |
|||
public void setEnforcementDepartment(String enforcementDepartment) |
|||
{ |
|||
this.enforcementDepartment = enforcementDepartment; |
|||
} |
|||
|
|||
public String getEnforcementDepartment() |
|||
{ |
|||
return enforcementDepartment; |
|||
} |
|||
public void setEnforcementDepartmentId(String enforcementDepartmentId) |
|||
{ |
|||
this.enforcementDepartmentId = enforcementDepartmentId; |
|||
} |
|||
|
|||
public String getEnforcementDepartmentId() |
|||
{ |
|||
return enforcementDepartmentId; |
|||
} |
|||
public void setEnforcementTime(Date enforcementTime) |
|||
{ |
|||
this.enforcementTime = enforcementTime; |
|||
} |
|||
|
|||
public Date getEnforcementTime() |
|||
{ |
|||
return enforcementTime; |
|||
} |
|||
public void setEnforcementArea(String enforcementArea) |
|||
{ |
|||
this.enforcementArea = enforcementArea; |
|||
} |
|||
|
|||
public String getEnforcementArea() |
|||
{ |
|||
return enforcementArea; |
|||
} |
|||
|
|||
public Integer getIsDelete() { |
|||
return isDelete; |
|||
} |
|||
|
|||
public void setIsDelete(Integer isDelete) { |
|||
this.isDelete = isDelete; |
|||
} |
|||
|
|||
public static long getSerialVersionUID() { |
|||
return serialVersionUID; |
|||
} |
|||
|
|||
public List<FileObject> getFileList() { |
|||
return fileList; |
|||
} |
|||
|
|||
public String getSearchText() { |
|||
return searchText; |
|||
} |
|||
|
|||
public void setSearchText(String searchText) { |
|||
this.searchText = searchText; |
|||
} |
|||
|
|||
public String getDateSearch() { |
|||
return dateSearch; |
|||
} |
|||
|
|||
public void setDateSearch(String dateSearch) { |
|||
this.dateSearch = dateSearch; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("planYear", getPlanYear()) |
|||
.append("planName", getPlanName()) |
|||
.append("enforcementDepartment", getEnforcementDepartment()) |
|||
.append("enforcementDepartmentId", getEnforcementDepartmentId()) |
|||
.append("enforcementTime", getEnforcementTime()) |
|||
.append("enforcementArea", getEnforcementArea()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("createBy", getCreateBy()) |
|||
.append("userId", getUserId()) |
|||
.append("deptId", getDeptId()) |
|||
.append("isDelete", getIsDelete()) |
|||
.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,61 @@ |
|||
package com.zdxt.code.mapper; |
|||
|
|||
import com.zdxt.code.domain.EnforcementInspectionProgram; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 执法检查计划Mapper接口 |
|||
* |
|||
* @author chenrui |
|||
* @date 2024-03-12 |
|||
*/ |
|||
public interface EnforcementInspectionProgramMapper |
|||
{ |
|||
/** |
|||
* 查询执法检查计划 |
|||
* |
|||
* @param id 执法检查计划ID |
|||
* @return 执法检查计划 |
|||
*/ |
|||
public EnforcementInspectionProgram selectEnforcementInspectionProgramById(String id); |
|||
|
|||
/** |
|||
* 查询执法检查计划列表 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 执法检查计划集合 |
|||
*/ |
|||
public List<EnforcementInspectionProgram> selectEnforcementInspectionProgramList(EnforcementInspectionProgram enforcementInspectionProgram); |
|||
|
|||
/** |
|||
* 新增执法检查计划 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertEnforcementInspectionProgram(EnforcementInspectionProgram enforcementInspectionProgram); |
|||
|
|||
/** |
|||
* 修改执法检查计划 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateEnforcementInspectionProgram(EnforcementInspectionProgram enforcementInspectionProgram); |
|||
|
|||
/** |
|||
* 删除执法检查计划 |
|||
* |
|||
* @param id 执法检查计划ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteEnforcementInspectionProgramById(String id); |
|||
|
|||
/** |
|||
* 批量删除执法检查计划 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteEnforcementInspectionProgramByIds(String[] ids); |
|||
} |
|||
@ -0,0 +1,61 @@ |
|||
package com.zdxt.code.service; |
|||
|
|||
import com.zdxt.code.domain.EnforcementInspectionProgram; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 执法检查计划Service接口 |
|||
* |
|||
* @author chenrui |
|||
* @date 2024-03-12 |
|||
*/ |
|||
public interface IEnforcementInspectionProgramService |
|||
{ |
|||
/** |
|||
* 查询执法检查计划 |
|||
* |
|||
* @param id 执法检查计划ID |
|||
* @return 执法检查计划 |
|||
*/ |
|||
public EnforcementInspectionProgram selectEnforcementInspectionProgramById(String id); |
|||
|
|||
/** |
|||
* 查询执法检查计划列表 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 执法检查计划集合 |
|||
*/ |
|||
public List<EnforcementInspectionProgram> selectEnforcementInspectionProgramList(EnforcementInspectionProgram enforcementInspectionProgram); |
|||
|
|||
/** |
|||
* 新增执法检查计划 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertEnforcementInspectionProgram(EnforcementInspectionProgram enforcementInspectionProgram); |
|||
|
|||
/** |
|||
* 修改执法检查计划 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateEnforcementInspectionProgram(EnforcementInspectionProgram enforcementInspectionProgram); |
|||
|
|||
/** |
|||
* 批量删除执法检查计划 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteEnforcementInspectionProgramByIds(String ids); |
|||
|
|||
/** |
|||
* 删除执法检查计划信息 |
|||
* |
|||
* @param id 执法检查计划ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteEnforcementInspectionProgramById(String id); |
|||
} |
|||
@ -0,0 +1,146 @@ |
|||
package com.zdxt.code.service.impl; |
|||
|
|||
import java.util.List; |
|||
|
|||
import cn.hutool.core.convert.Convert; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import com.zdxt.auth.dto.UserBean; |
|||
import com.zdxt.auth.feign.UserApi; |
|||
import com.zdxt.auth.feign.ZdxtFileCommonApi; |
|||
import com.zdxt.common.util.DateUtils; |
|||
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import com.zdxt.code.mapper.EnforcementInspectionProgramMapper; |
|||
import com.zdxt.code.domain.EnforcementInspectionProgram; |
|||
import com.zdxt.code.service.IEnforcementInspectionProgramService; |
|||
|
|||
/** |
|||
* 执法检查计划Service业务层处理 |
|||
* |
|||
* @author chenrui |
|||
* @date 2024-03-12 |
|||
*/ |
|||
@Service |
|||
public class EnforcementInspectionProgramServiceImpl implements IEnforcementInspectionProgramService |
|||
{ |
|||
@Autowired |
|||
private EnforcementInspectionProgramMapper enforcementInspectionProgramMapper; |
|||
|
|||
@Autowired |
|||
private ZdxtFileCommonApi zdxtFileCommonApi; |
|||
|
|||
@Autowired |
|||
private UserApi userApi; |
|||
|
|||
|
|||
/** |
|||
* 查询执法检查计划 |
|||
* |
|||
* @param id 执法检查计划ID |
|||
* @return 执法检查计划 |
|||
*/ |
|||
@Override |
|||
public EnforcementInspectionProgram selectEnforcementInspectionProgramById(String id) |
|||
{ |
|||
return enforcementInspectionProgramMapper.selectEnforcementInspectionProgramById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询执法检查计划列表 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 执法检查计划 |
|||
*/ |
|||
@Override |
|||
public List<EnforcementInspectionProgram> selectEnforcementInspectionProgramList(EnforcementInspectionProgram enforcementInspectionProgram) |
|||
{ |
|||
List<EnforcementInspectionProgram> enforcementInspectionPrograms = |
|||
enforcementInspectionProgramMapper.selectEnforcementInspectionProgramList(enforcementInspectionProgram); |
|||
enforcementInspectionPrograms.forEach(res ->{ |
|||
List<ZdxtFileCommon> zdxtFileCommons = zdxtFileCommonApi.selectZdxtFileById(res.getId()); |
|||
if(zdxtFileCommons != null && zdxtFileCommons.size() > 0){ |
|||
EnforcementInspectionProgram.FileObject fileObject = new EnforcementInspectionProgram.FileObject(); |
|||
fileObject.setFileName(zdxtFileCommons.get(0).getFileName()); |
|||
fileObject.setFileUrl(zdxtFileCommons.get(0).getUploadPath()); |
|||
res.setFileObject(fileObject); |
|||
} |
|||
}); |
|||
return enforcementInspectionPrograms; |
|||
} |
|||
|
|||
/** |
|||
* 新增执法检查计划 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertEnforcementInspectionProgram(EnforcementInspectionProgram enforcementInspectionProgram) |
|||
{ |
|||
enforcementInspectionProgram.setCreateTime(DateUtils.getNowDate()); |
|||
|
|||
UserBean user = userApi.getCurrentUser(); |
|||
enforcementInspectionProgram.setCreateTime(DateUtils.getNowDate()); |
|||
enforcementInspectionProgram.setId(IdUtil.simpleUUID()); |
|||
enforcementInspectionProgram.setUserId(user.getUserId()); |
|||
enforcementInspectionProgram.setDeptId(user.getDeptId()); |
|||
enforcementInspectionProgram.setCreateBy(user.getUserName()); |
|||
|
|||
int i = enforcementInspectionProgramMapper.insertEnforcementInspectionProgram(enforcementInspectionProgram); |
|||
if(i > 0 && enforcementInspectionProgram.getFileList().size() > 0){ |
|||
enforcementInspectionProgram.getFileList().forEach(res ->{ |
|||
ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon(); |
|||
zdxtFileCommon.setBusinessId(enforcementInspectionProgram.getId()); |
|||
zdxtFileCommon.setGuid(IdUtil.simpleUUID()); |
|||
int dotIndex = res.getFileName().lastIndexOf("."); |
|||
String extension = res.getFileName().substring(dotIndex -1); |
|||
//文件后缀
|
|||
zdxtFileCommon.setFileSuffix(extension); |
|||
zdxtFileCommon.setUploadPath(res.getFileUrl()); |
|||
zdxtFileCommon.setFileName(res.getFileName()); |
|||
zdxtFileCommon.setUploadPersonId(user.getUserId().toString()); |
|||
zdxtFileCommon.setUploadPersonName(user.getUserName()); |
|||
zdxtFileCommonApi.addZdxtFileCommon(zdxtFileCommon); |
|||
}); |
|||
} |
|||
return i; |
|||
} |
|||
|
|||
/** |
|||
* 修改执法检查计划 |
|||
* |
|||
* @param enforcementInspectionProgram 执法检查计划 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateEnforcementInspectionProgram(EnforcementInspectionProgram enforcementInspectionProgram) |
|||
{ |
|||
enforcementInspectionProgram.setUpdateTime(DateUtils.getNowDate()); |
|||
return enforcementInspectionProgramMapper.updateEnforcementInspectionProgram(enforcementInspectionProgram); |
|||
} |
|||
|
|||
/** |
|||
* 删除执法检查计划对象 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteEnforcementInspectionProgramByIds(String ids) |
|||
{ |
|||
return enforcementInspectionProgramMapper.deleteEnforcementInspectionProgramByIds(Convert.toStrArray(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 删除执法检查计划信息 |
|||
* |
|||
* @param id 执法检查计划ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteEnforcementInspectionProgramById(String id) |
|||
{ |
|||
return enforcementInspectionProgramMapper.deleteEnforcementInspectionProgramById(id); |
|||
} |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
package com.zdxt.code.utils; |
|||
|
|||
import org.springframework.util.DigestUtils; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* 密码工具类 |
|||
* 加盐加密 / 加盐解密 |
|||
*/ |
|||
public class PasswordTools { |
|||
|
|||
/** |
|||
*加盐加密 |
|||
* @param password |
|||
* @return 加密后的密码 |
|||
*/ |
|||
public static String encrypt(String password){ |
|||
//生成盐值,使用随机字符串UUID,UUID为32位的
|
|||
String salt = UUID.randomUUID().toString().replace("-",""); |
|||
//(盐值+密码)进行MD5加密,DigestUtils.md5DigestAsHex参数为字节数组,生成一个十六进制32位的字符串
|
|||
String finalPassword = DigestUtils.md5DigestAsHex((salt+password).getBytes(StandardCharsets.UTF_8)); |
|||
//将盐值和加密的密码组合返回,最终存储到数据库中的密码
|
|||
String dbPassword = salt + "$" + finalPassword; |
|||
return dbPassword; |
|||
} |
|||
|
|||
/** |
|||
* 校验密码 |
|||
* @param password |
|||
* @param dbPassword |
|||
* @return |
|||
*/ |
|||
public static boolean decrypt(String password,String dbPassword){ |
|||
if(StringUtils.hasLength(password) && StringUtils.hasLength(dbPassword) |
|||
&& dbPassword.length()==65 && dbPassword.contains("$")){ |
|||
String[] arr = dbPassword.split("\\$"); |
|||
String salt = arr[0]; |
|||
//根据获取的盐值生成校验的密码
|
|||
String checkPassword = salt + "$" + DigestUtils.md5DigestAsHex((salt+password).getBytes(StandardCharsets.UTF_8)); |
|||
//用校验密码与数据库保存的密码进行校验
|
|||
if(checkPassword.equals(dbPassword)){ |
|||
return true; |
|||
} |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
public static void main(String[] args) { |
|||
String dbPassword = encrypt("88879ayqwt"); |
|||
System.out.println(decrypt("88879ayqwt",dbPassword)); //true
|
|||
System.out.println(decrypt("45678",dbPassword)); //false
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,115 @@ |
|||
<?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.zdxt.code.mapper.EnforcementInspectionProgramMapper"> |
|||
|
|||
<resultMap type="EnforcementInspectionProgram" id="EnforcementInspectionProgramResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="planYear" column="plan_year" /> |
|||
<result property="planName" column="plan_name" /> |
|||
<result property="enforcementDepartment" column="enforcement_department" /> |
|||
<result property="enforcementDepartmentId" column="enforcement_department_id" /> |
|||
<result property="enforcementTime" column="enforcement_time" /> |
|||
<result property="enforcementArea" column="enforcement_area" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="createBy" column="create_by" /> |
|||
<result property="userId" column="user_id" /> |
|||
<result property="deptId" column="dept_id" /> |
|||
<result property="isDelete" column="is_delete" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectEnforcementInspectionProgramVo"> |
|||
select id, plan_year, plan_name, enforcement_department, enforcement_department_id, enforcement_time, enforcement_area, create_time, create_by, user_id, dept_id, is_delete from enforcement_inspection_program |
|||
</sql> |
|||
|
|||
<select id="selectEnforcementInspectionProgramList" parameterType="EnforcementInspectionProgram" resultMap="EnforcementInspectionProgramResult"> |
|||
<include refid="selectEnforcementInspectionProgramVo"/> |
|||
<where> |
|||
<if test="planYear != null and planYear != ''"> and plan_year = #{planYear}</if> |
|||
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if> |
|||
<if test="enforcementDepartment != null and enforcementDepartment != ''"> and enforcement_department = #{enforcementDepartment}</if> |
|||
<if test="enforcementDepartmentId != null and enforcementDepartmentId != ''"> and enforcement_department_id = #{enforcementDepartmentId}</if> |
|||
<if test="enforcementTime != null "> and enforcement_time = #{enforcementTime}</if> |
|||
<if test="enforcementArea != null and enforcementArea != ''"> and enforcement_area = #{enforcementArea}</if> |
|||
<if test="userId != null and userId != ''"> and user_id = #{userId}</if> |
|||
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if> |
|||
<if test="isDelete != null "> and is_delete = #{isDelete}</if> |
|||
<if test="searchText != null and searchText != ''"> |
|||
and (plan_name like concat('%', #{searchText}, '%') |
|||
or enforcement_department like concat('%', #{searchText}, '%') |
|||
or enforcement_area like concat('%', #{searchText}, '%')) |
|||
</if> |
|||
<if test="dateSearch != null and dateSearch != ''"> |
|||
and DATE_FORMAT(create_time, '%Y-%m') = #{dateSearch} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectEnforcementInspectionProgramById" parameterType="String" resultMap="EnforcementInspectionProgramResult"> |
|||
<include refid="selectEnforcementInspectionProgramVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertEnforcementInspectionProgram" parameterType="EnforcementInspectionProgram"> |
|||
insert into enforcement_inspection_program |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="id != null and id != ''">id,</if> |
|||
<if test="planYear != null and planYear != ''">plan_year,</if> |
|||
<if test="planName != null and planName != ''">plan_name,</if> |
|||
<if test="enforcementDepartment != null and enforcementDepartment != ''">enforcement_department,</if> |
|||
<if test="enforcementDepartmentId != null and enforcementDepartmentId != ''">enforcement_department_id,</if> |
|||
<if test="enforcementTime != null ">enforcement_time,</if> |
|||
<if test="enforcementArea != null and enforcementArea != ''">enforcement_area,</if> |
|||
<if test="createTime != null ">create_time,</if> |
|||
<if test="createBy != null and createBy != ''">create_by,</if> |
|||
<if test="userId != null and userId != ''">user_id,</if> |
|||
<if test="deptId != null and deptId != ''">dept_id,</if> |
|||
<if test="isDelete != null ">is_delete,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="id != null and id != ''">#{id},</if> |
|||
<if test="planYear != null and planYear != ''">#{planYear},</if> |
|||
<if test="planName != null and planName != ''">#{planName},</if> |
|||
<if test="enforcementDepartment != null and enforcementDepartment != ''">#{enforcementDepartment},</if> |
|||
<if test="enforcementDepartmentId != null and enforcementDepartmentId != ''">#{enforcementDepartmentId},</if> |
|||
<if test="enforcementTime != null ">#{enforcementTime},</if> |
|||
<if test="enforcementArea != null and enforcementArea != ''">#{enforcementArea},</if> |
|||
<if test="createTime != null ">#{createTime},</if> |
|||
<if test="createBy != null and createBy != ''">#{createBy},</if> |
|||
<if test="userId != null and userId != ''">#{userId},</if> |
|||
<if test="deptId != null and deptId != ''">#{deptId},</if> |
|||
<if test="isDelete != null ">#{isDelete},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateEnforcementInspectionProgram" parameterType="EnforcementInspectionProgram"> |
|||
update enforcement_inspection_program |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="planYear != null and planYear != ''">plan_year = #{planYear},</if> |
|||
<if test="planName != null and planName != ''">plan_name = #{planName},</if> |
|||
<if test="enforcementDepartment != null and enforcementDepartment != ''">enforcement_department = #{enforcementDepartment},</if> |
|||
<if test="enforcementDepartmentId != null and enforcementDepartmentId != ''">enforcement_department_id = #{enforcementDepartmentId},</if> |
|||
<if test="enforcementTime != null ">enforcement_time = #{enforcementTime},</if> |
|||
<if test="enforcementArea != null and enforcementArea != ''">enforcement_area = #{enforcementArea},</if> |
|||
<if test="createTime != null ">create_time = #{createTime},</if> |
|||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if> |
|||
<if test="userId != null and userId != ''">user_id = #{userId},</if> |
|||
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if> |
|||
<if test="isDelete != null ">is_delete = #{isDelete},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteEnforcementInspectionProgramById" parameterType="String"> |
|||
delete from enforcement_inspection_program where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteEnforcementInspectionProgramByIds" parameterType="String"> |
|||
delete from enforcement_inspection_program where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue