Commit cdcb3990 by ice

1

parent 2fac144f
Showing with 4822 additions and 0 deletions
File mode changed
package orthopedics;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
package orthopedics;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 14:25 2019/5/6 0006
*/
@Configuration
@MapperScan("orthopedics.dao")
public class MybatisScanConfiguration {
}
package orthopedics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class RedisConfig {
@Autowired
private RedisTemplate redisTemplate;
@Bean
public RedisTemplate redisTemplateInit() {
//设置序列化Key的实例化对象
redisTemplate.setKeySerializer(new StringRedisSerializer());
//设置序列化Value的实例化对象
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
return redisTemplate;
}
}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.controller.pda.TakeStockController;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Component
public class SyncInvItem {
private final static Logger logger = LoggerFactory.getLogger(SyncInvItem.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private TakeStockController takeStockController;
//每天晚上23点执行
// @Scheduled(cron = "0 0 23 * * ? ")
// @Transactional
// public void scheduler(){
// takeStockController.getPMPInvItem("20190904153120997a6088c4da5964015a88fa7a03651c2ff003h5Ol5W04Qp61");
// }
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
public static void main(String[] args) {
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取商品资料列表");
data.put("timestamp", getTimestamp());
System.err.println(new Date());
data.put("begintime","1995-12-23 00:00:00");
data.put("endTime","1996-12-23 00:00:00");
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
e.printStackTrace();
}
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
System.err.println(new String(bytes));
}
}
package orthopedics.common;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 下午5:00 17-10-25
* 采用静态内部类的方法创建SqlSessionFactory的单例,便于全局使用
*/
public class SqlSessionFactorySingleton {
private static final Logger logger = LoggerFactory.getLogger(SqlSessionFactorySingleton.class);
private SqlSessionFactorySingleton(){}
private static final class SingletonHolder {
private static final String Mybatis_Conf = "mybatis-config.xml";
private static SqlSessionFactory sqlSessionFactory;
static {
try(InputStream inputStream = Resources.getResourceAsStream(Mybatis_Conf)) {
sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
} catch (IOException e) {
logger.error("fail to init SqlSessionFactory", e);
}
}
}
public static final SqlSessionFactory getInstance() {
return SingletonHolder.sqlSessionFactory;
}
}
package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import orthopedics.controller.error.MyException;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
/**
* 统一异常处理类
*/
@ControllerAdvice
public class BaseExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result error(Exception e){
// e.printStackTrace();
return new Result(false, StatusCode.ERROR, e.getMessage());
}
@ExceptionHandler(value = MyException.class)
@ResponseBody
public Result myError(MyException ex){
return new Result(false, ex.getErrorEnum().getErrorCode(), ex.getErrorEnum().getErrorMsg());
}
}
package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.controller.v1.TransactionController;
import orthopedics.model.*;
import orthopedics.service.InvCountService;
import orthopedics.service.InventoryServer;
import orthopedics.service.TransactionServer;
import orthopedics.service.UserServer;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import orthopedics.vo.InvCountHeaderPage;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@RestController
@RequestMapping("bookcity/check")
public class CheckController {
@Autowired
private UserServer userServer;
@Autowired
private TransactionController transactionController;
@Autowired
private InvCountService invCountService;
@Autowired
private InventoryServer inventoryServer;
@Autowired
private TransactionServer transactionServer;
/*
*描述:盘点单审核
*参数:
*创建者:ice
**/
@RequestMapping(path = "/transaction/checkInvItem", method = RequestMethod.POST)
@Transactional
public Result checkInvItem(@RequestParam("access_token") String accessToken,
@RequestBody JSONObject requestJson) {
JSONObject data = requestJson.getJSONObject("data");
if(data == null){
return new Result(false,StatusCode.ERROR,"没有选中的数据!");
}
JSONArray interfaceLines = data.getJSONArray("interface_lines");
if(interfaceLines == null){
return new Result(false,StatusCode.ERROR,"没有选中的数据!");
}
checkAccessToken(accessToken);
for (int i = 0; i < interfaceLines.size(); i++) {
String interfaceId = interfaceLines.getString(i);
InvCountHeaderPage invCountHeaderPage = invCountService.findInvCountHeaderById(interfaceId);
if(invCountHeaderPage == null){
return new Result(false,StatusCode.ERROR,"选中的数据不存在,请刷新!");
}
if(invCountHeaderPage.getInvCountLineList().size() == 0){
return new Result(false,StatusCode.ERROR,"单号为:"+invCountHeaderPage.getCountNumber()+"盘点单没有行数据!");
}
//盘点单头的状态
if(!"new".equals(invCountHeaderPage.getHeaderStatus())){
return new Result(false,StatusCode.ERROR,"盘点单头状态需为新建!");
}
for(InvCountLine invCountLine:invCountHeaderPage.getInvCountLineList()){
if(invCountLine.getDifferentQuantity()!=null && invCountLine.getDifferentQuantity() == 0){
continue;
}
//封装数据
JSONObject jsonObject = getJson(invCountHeaderPage,invCountLine);
List<InvTransaction> invTransactionList = transactionServer.selectInvTrasactionByItemId(invCountLine.getInvId(), invCountLine.getSubinvId(), invCountLine.getLocatorId(), invCountLine.getItemId());
Integer sumItemIdQuantity = invTransactionList.stream().collect(Collectors.summingInt(InvTransaction::getTxQuantity));
if(sumItemIdQuantity != invCountLine.getAccountQuantity()){
return new Result(false,StatusCode.ERROR,"盘点单号为:"+invCountHeaderPage.getCountNumber()+"的账存数量与现有库存量不一致");
}
transactionController.invItemInOut(accessToken, jsonObject);
}
//修改状态
int count = invCountService.updateInvCountHeaderStatus("approval",interfaceId);
if(count == 0){
return new Result(false,StatusCode.ERROR,"单号为:"+invCountHeaderPage.getCountNumber()+"的状态修改失败!");
}
}
return new Result(true,StatusCode.OK,"审核成功");
}
//检查accessToken
private SysAccessToken checkAccessToken(String accessToken) {
return userServer.checkAccessToken(accessToken);
}
//封装json数据
private JSONObject getJson(InvCountHeaderPage invCountHeaderPage, InvCountLine invCountLine){
JSONObject jsonObject = new JSONObject();
Map<String,Object> map = getMap(invCountHeaderPage.getCountNumber(),invCountLine);
Inventory inventory = (Inventory) map.get("inventory");
InvSubinventory subinventory = (InvSubinventory) map.get("subinventory");
InvLocator invLocator = (InvLocator) map.get("invLocator");
InvItem invItem = (InvItem) map.get("invItem");
String txTypeCode = null;
int quantity = 0;
if(invCountLine.getDifferentQuantity() > 0){
txTypeCode = "PHYSICAL_INVENTORY_OVERAGE";//盘盈
quantity = invCountLine.getDifferentQuantity();
}
if(invCountLine.getDifferentQuantity() < 0 ){
txTypeCode = "PHYSICAL_INVENTORY_SHORTAGE";
quantity = -invCountLine.getDifferentQuantity();
}
JSONObject tempData = new JSONObject();
tempData.put("inv_code",inventory.getInvCode());
tempData.put("subinv_code",subinventory.getSubinvCode());
tempData.put("locator_code",invLocator.getLocatorCode());
tempData.put("item_code",invItem.getItemCode());
tempData.put("tx_type_code",txTypeCode);
tempData.put("tx_date",LocalDateTime.now());
tempData.put("tx_quantity",quantity);
tempData.put("tx_price",invItem.getPurchasePrice());
tempData.put("source_code","INVENTORY");//来源与库存
tempData.put("source_header_id",invCountHeaderPage.getId());
tempData.put("source_line_id",invCountLine.getId());
jsonObject.put("data",tempData);
return jsonObject;
}
//判断
private Map<String,Object> getMap(String countNumber,InvCountLine invCountLine){
Map<String,Object> map = new HashMap<>();
//库存
if(invCountLine.getInvId() == null || "".equals(invCountLine.getInvId())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的库存不能为空");
}
Inventory inventory = inventoryServer.selectInventoryById(invCountLine.getInvId());
if(inventory == null){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的库存信息不存在");
}
if(inventory.getInvCode() == null || "".equals(inventory.getInvCode())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的库存信息不完整");
}
map.put("inventory",inventory);
//库区
if(invCountLine.getSubinvId() == null || "".equals(invCountLine.getSubinvId())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的库区不能为空");
}
InvSubinventory subinventory = inventoryServer.selectSubInventoryBySubInvId(invCountLine.getSubinvId());
if(subinventory == null){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的库区信息不存在");
}
if(subinventory.getSubinvCode() == null || "".equals(subinventory.getSubinvCode())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的库区信息不完整");
}
map.put("subinventory",subinventory);
//货架
if(invCountLine.getLocatorId() == null || "".equals(invCountLine.getLocatorId())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的货架不能为空");
}
InvLocator invLocator = inventoryServer.selectInvLocatorById(invCountLine.getLocatorId());
if(invLocator == null){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的货架信息不存在");
}
if(invLocator.getLocatorCode() == null || "".equals(invLocator.getLocatorCode())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的货架信息不完整");
}
map.put("invLocator",invLocator);
//商品
if(invCountLine.getItemId() == null || "".equals(invCountLine.getItemId())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的商品信息不能为空");
}
InvItem invItem = inventoryServer.selectInvItemByItemId(invCountLine.getItemId());
if(invItem == null){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的商品信息不存在");
}
if(invItem.getItemCode() == null || "".equals(invItem.getItemCode())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的商品信息不完整");
}
if(invItem.getPurchasePrice() == null || "".equals(invItem.getPurchasePrice())){
throw ErrorEnum.Error.createException("盘点单行为:"+countNumber+"的商品信息不完整");
}
map.put("invItem",invItem);
return map;
}
}
package orthopedics.controller.bookcity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/common")
public class CommonController {
}
package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import orthopedics.dao.InvCategoryMapper;
import orthopedics.dao.InvCountHeaderMapper;
import orthopedics.dao.InvCountLineMapper;
import orthopedics.model.InvCountHeader;
import orthopedics.model.InvCountLine;
import orthopedics.model.SysAccessToken;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import orthopedics.util.StringUtil;
import orthopedics.util.UuidUtil;
import orthopedics.vo.InvCountHeaderPage;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/bookcity/invCountHeader")
public class InvCountHeaderController {
@Autowired
private UserServer userServer;
@Autowired
private PropertiesServer propertiesServer;
@Autowired
private InvCountHeaderMapper invCountHeaderMapper;
@Autowired
private InvCountLineMapper invCountLineMapper;
@Autowired
private CheckController checkController;
@PostMapping("/add")
@Transactional
public Result add(@RequestBody InvCountHeaderPage invCountHeaderPage, @RequestParam(value = "access_token",required = true)String token){
if(invCountHeaderPage==null){
return new Result(false, StatusCode.ERROR,"参数为空");
}
SysAccessToken sysAccessToken = userServer.checkToken(token);
String uuidString = UuidUtil.get32UUIDString();
//头数据封装
invCountHeaderPage.setId(uuidString);
invCountHeaderPage.setCreateBy(sysAccessToken.getUserName());
invCountHeaderPage.setCreateTime(LocalDateTime.now());
String count_number = propertiesServer.generateFlowingWater("COUNT_NUMBER");
if(StringUtil.isEmpty(count_number)){
return new Result(false, StatusCode.ERROR,"盘点单号获取失败");
}
if(StringUtil.isEmpty(invCountHeaderPage.getInvId())){
return new Result(false, StatusCode.ERROR,"库存id为空");
}
invCountHeaderPage.setCountNumber(count_number);
invCountHeaderPage.setCountDate(LocalDateTime.now());
invCountHeaderPage.setCounter(sysAccessToken.getUserName());
invCountHeaderPage.setHeaderStatus("new");
//行数据封装
List<InvCountLine> invCountLineList = invCountHeaderPage.getInvCountLineList();
if(invCountLineList==null||invCountLineList.size()<=0){
return new Result(false, StatusCode.ERROR,"没有行数据");
}
for (InvCountLine invCountLine:invCountLineList) {
invCountLine.setId(UuidUtil.get32UUIDString());
invCountLine.setInvCountHeaderId(uuidString);
invCountLine.setCreateBy(sysAccessToken.getUserName());
invCountLine.setCreateTime(LocalDateTime.now());
}
InvCountHeader invCountHeader=new InvCountHeader();
BeanUtils.copyProperties(invCountHeaderPage, invCountHeader);
invCountHeaderMapper.insert(invCountHeader);
invCountLineMapper.insertBatch(invCountLineList);
// List<String> interface_lines=new ArrayList<>();
// interface_lines.add(uuidString);
// JSONObject data=new JSONObject();
// data.put("interface_lines",interface_lines);
// JSONObject jsonObject=new JSONObject();
// jsonObject.put("data",data);
// Result result = checkController.checkInvItem(token, jsonObject);
return new Result(true,StatusCode.OK,"盘点单保存成功",count_number);
}
}
package orthopedics.controller.bookcity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import orthopedics.model.InvInventory;
import orthopedics.service.InvInventoryService;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
@RestController
@RequestMapping("/bookcity/InvInventory")
public class InvInventoryController {
@Autowired
private InvInventoryService invInventoryService;
@PostMapping("/save")
public Result save(@RequestBody InvInventory invInventory, @RequestParam(value = "access_token",required = true)String token ){
String save = invInventoryService.save(token, invInventory);
if(!save.equals("ok")){
return new Result(false, StatusCode.ERROR,save);
}
return new Result(true, StatusCode.OK, "保存成功");
}
}
package orthopedics.controller.bookcity;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.InvItem;
import orthopedics.model.InvItemChange;
import orthopedics.model.SysAccessToken;
import orthopedics.model.SysUser;
import orthopedics.service.InvItemChangeService;
import orthopedics.service.InvItemService;
import orthopedics.service.UserServer;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import orthopedics.util.UuidUtil;
import java.time.LocalDateTime;
/*商品价格变动模块*/
@RestController
@RequestMapping("/bookcity/invItemChange")
public class InvItemChangeController {
@Autowired
private InvItemChangeService invItemChangeService;
@Autowired
private UserServer userServer;
@Autowired
private InvItemService invItemService;
/*
*描述:记录商品历史变动价格
*参数:(商品价格表所有数据)InvItemChange invItemChange
*创建者:ice
**/
@PostMapping(value = "/add")
public Result add(@RequestBody InvItemChange invItemChange,
@RequestParam(value = "access_token",required = true)String token) {
//查询该商品最新一次版本的价格
InvItemChange LastInvItemChange = invItemChangeService.selectInvItemChange(invItemChange.getItemCode());
if (LastInvItemChange == null) {
//第一次价格变动时
invItemChange.setEditVersions("1");
} else {
//对比价格是否有变化
if (LastInvItemChange.getPurchasePrice().equals(invItemChange.getPurchasePrice())) {
//无则不做任何操作
return new Result(false,StatusCode.ERROR,ErrorEnum.DataHaveNotChange.getErrorMsg());
} else {
//先将版本号转化为数字+1,再转化成String
String editVersion = String.valueOf(Integer.parseInt(LastInvItemChange.getEditVersions()) + 1);
//有,则保存该商品变更信息,版本号+1
invItemChange.setEditVersions(editVersion);
}
}
//检查accesstoken的有效性
SysAccessToken sysAccessToken = userServer.checkAccessToken(token);
//查询用户
SysUser sysUser = userServer.getSysUserById(sysAccessToken.getUserId());
if(sysUser == null){
return new Result(false,StatusCode.ERROR,ErrorEnum.UserNotExist.getErrorMsg());
}
String updateBy = sysUser.getRealname();
//获取当前时间
LocalDateTime updateTime = LocalDateTime.now();
InvItem invItem = invItemService.findInvItemById(invItemChange.getId());
if(invItem == null){
return new Result(false,StatusCode.ERROR,ErrorEnum.NotExistModel.getErrorMsg());
}
BeanUtils.copyProperties(invItem,invItemChange);
String cip = "";
if(invItemChange.getCip() != null && "".equals(invItemChange.getCip())){
cip = invItemChange.getCip();
}
//重新设置id
invItemChange.setId(UuidUtil.get32UUIDString());
invItemChange.setUpdateBy(updateBy);
invItemChange.setUpdateTime(updateTime);
invItemChange.setCip(cip);
//保存信息
invItemChangeService.save(invItemChange);
return new Result(true,StatusCode.OK,"保存成功");
}
}
package orthopedics.controller.bookcity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.InvItem;
import orthopedics.model.InvItemRfid;
import orthopedics.service.InvItemRfidService;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import java.util.List;
/**
* 库存信息同步到ERS
*/
@RestController
@RequestMapping("/bookcity/InvItemRfid")
public class InvItemRfidController {
@Autowired
private InvItemRfidService invItemRfidService;
@PostMapping("/save")
public Result save(@RequestBody InvItemRfid invItemRfid,@RequestParam(value = "access_token",required = true)String token ){
String save= invItemRfidService.save(token, invItemRfid);
return new Result(true, StatusCode.OK,"已生成"+save+"条记录");
}
@PostMapping("/putaway")
public Result update(@RequestBody List<String> strings, @RequestParam(value = "access_token",required = true)String token ){
String putaway = invItemRfidService.putaway(token, strings);
return new Result(true, StatusCode.OK,putaway);
}
}
package orthopedics.controller.bookcity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.SysAccessToken;
import orthopedics.model.SysUser;
import orthopedics.service.PropertiesServer;
import orthopedics.service.SysAccessTokenService;
import orthopedics.service.UserServer;
import orthopedics.util.TimeUtil;
import orthopedics.util.UuidUtil;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequestMapping("/bookcity/login")
public class LoginController {
@Autowired
private SysAccessTokenService sysAccessTokenService;
@Autowired
private PropertiesServer propertiesServer;
@Autowired
private UserServer userServer;
@PostMapping("/saveAccessToken")
public SysAccessToken getValidAccessTokenByUser(@RequestParam("grantType") String grantType,
@RequestBody SysUser user) {
LocalDateTime now = TimeUtil.nowOfDateTime();
List<SysAccessToken> sysAccessTokenList = sysAccessTokenService.findSysAccessToken(user.getId(), now);
if (sysAccessTokenList != null && sysAccessTokenList.size() > 0) {
return sysAccessTokenList.get(0);
}
//从数据库中取出该user的id
SysUser sysUser = userServer.selectUserByUserName(user.getUsername());
//创建一条新的accessToke
SysAccessToken sysAccessToken = new SysAccessToken();
sysAccessToken.setCreateBy(user.getUsername());
sysAccessToken.setCreateTime(now);
sysAccessToken.setUpdateBy(user.getUsername());
sysAccessToken.setUpdateTime(now);
sysAccessToken.setUserId(sysUser.getId());
sysAccessToken.setUserName(user.getUsername());
sysAccessToken.setGrantType(grantType);
sysAccessToken.setAccessToken(UuidUtil.generate64Uuid());
String ACCESS_TOKEN_EXPIRE_TIME = propertiesServer.getProperty("ACCESS_TOKEN_EXPIRE_TIME", sysAccessToken.getUserId());
sysAccessToken.setExpirationDate(now.plusSeconds(Long.valueOf(ACCESS_TOKEN_EXPIRE_TIME)));
try {
sysAccessTokenService.insert(sysAccessToken);
} catch (Exception ex) {
//回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw ErrorEnum.AccessTokeOrExpireError.createException();
}
return sysAccessToken;
}
}
package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.OnlCgformField;
import orthopedics.model.OnlCgformHead;
import orthopedics.service.OnlCgformHeadService;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/bookcity/onlCgformHead")
public class OnlCgformHeadController {
@Autowired
private OnlCgformHeadService onlCgformHeadService;
/*
*描述:统一查询表单字段接口
*参数:table_id(表单的id),head_id(主表的id)
*创建者:ice
**/
@RequestMapping(value = "/findData",method = RequestMethod.POST)
public String findData(@RequestParam(value = "table_id",required = true)String table_id,
@RequestParam(value = "head_id",required = true)String head_id){
//查询到表单对应的数据库表
OnlCgformHead onlCgformHead = onlCgformHeadService.findOnlCgformHeadById(table_id);
if(onlCgformHead == null){
throw ErrorEnum.Error.createException("当前表单不存在");
}
//取出对应的主表
String tableName = onlCgformHead.getTableName();
Map<Object,Object> tableMap = onlCgformHeadService.selectTableById(tableName,head_id);
JSONObject jsonObject = new JSONObject();
jsonObject.put(onlCgformHead.getTableName(),tableMap);
//取出对应的附表
String subTableStr = onlCgformHead.getSubTableStr();
if(subTableStr == null || "".equals(subTableStr)){
//如果为空则不查询从表
}else{
//附表可能有多个,需进行切割
String[] str = subTableStr.split(",");
for(int i=0;i<str.length;i++){
//依次查询附表
OnlCgformHead cgformHead = onlCgformHeadService.findOnlCgformHeadByName(str[i]);
OnlCgformField onlCgformField = onlCgformHeadService.findByIdAndMain(cgformHead.getId(),onlCgformHead.getTableName());
List<Map<Object,Object>> list = onlCgformHeadService.findTable(cgformHead.getTableName(),onlCgformField.getDbFieldName(),head_id);
if(list.size() == 0 || list == null){
//如果附表无数据,为空
}else{
jsonObject.put(cgformHead.getTableName(),list);
}
}
}
return jsonObject.toJSONString();
}
}
package orthopedics.controller.bookcity;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import orthopedics.common.SqlMapper;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.SysSerial;
import orthopedics.service.SysSerialServer;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import java.util.UUID;
@RestController
@RequestMapping("/bookcity/sysSerial")
public class SysSerialController {
private final static Logger logger = LoggerFactory.getLogger(PurRequisitionController.class);
@Autowired
private SysSerialServer sysSerialServer;
@PostMapping("/add/{token}")
public Result addSysSerial(@RequestBody SysSerial sysSerial, @PathVariable String token){
if(sysSerial==null){
return new Result(false, StatusCode.ERROR,"请求参数不能为空");
}
try{
sysSerialServer.insert(sysSerial,token);
return new Result(true, StatusCode.OK,"保存成功");
}catch (Exception e){
return new Result(false, StatusCode.ERROR,e.getMessage());
}
}
}
package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import orthopedics.util.*;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@RestController
@RequestMapping("/test")
public class Test {
@RequestMapping("/demo")
public Result deom() throws Exception {
return new Result(true, StatusCode.OK,"dj",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
}
}
package orthopedics.controller.bookcity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.SysAccessToken;
import orthopedics.model.SysUser;
import orthopedics.model.WarDifferent;
import orthopedics.service.UserServer;
import orthopedics.service.WarDifferentService;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import orthopedics.vo.PurRequisitionPage;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/bookcity/warDifferent")
public class WarDifferentController {
private final static Logger logger = LoggerFactory.getLogger(WarDifferentController.class);
@Autowired
private WarDifferentService warDifferentService;
@Autowired
private UserServer userServer;
/**
*描述:差异处理单的批量审核
*参数:List<WarDifferent> warDifferentList,String accessToken
*创建者:ice
**/
@RequestMapping(path = "/editWarDiffStatus",method = RequestMethod.POST)
public Result editWarDiffStatus(@RequestBody List<WarDifferent> warDifferentList,
@RequestParam(value = "access_token",required = true)String accessToken){
//创建一个集合存储状态不匹配的差异编号
List<String> errorIds = new ArrayList<>();
//判断该差异处理单是否存在,再判断状态是否为新建,能否进行审核
for (WarDifferent warDifferent:warDifferentList){
WarDifferent warDifferent1 = warDifferentService.findWarDiffById(warDifferent.getId());
if(warDifferent1 == null){
return new Result(false,StatusCode.ERROR,"当前数据不存在,请刷新!");
}
if(!"new".equals(warDifferent.getStatus())){
errorIds.add(warDifferent.getDifferentNumber());
}
}
//如果有状态不匹配的,返回错误
if(errorIds.size() != 0){
throw ErrorEnum.NotAllowStatusERROR.createException(errorIds);
}else{
//检查accesstoken的有效性
SysAccessToken sysAccessToken = userServer.checkAccessToken(accessToken);
//查询用户
SysUser sysUser = userServer.getSysUserById(sysAccessToken.getUserId());
if(sysUser == null){
return new Result(false,StatusCode.ERROR,"当前用户不存在!");
}
String updateBy = sysUser.getRealname();
String excutorBy = updateBy;
//赋值状态为已审核
String status = "approval";
for(WarDifferent warDiff:warDifferentList){
//获取当前时间
LocalDateTime updateTime = LocalDateTime.now();
//修改差异处理单的状态、修改人、修改时间、审核人
this.warDifferentService.updateWarStatus(status,updateBy,updateTime,excutorBy,warDiff.getId());
}
return new Result(true,StatusCode.OK,"审核成功!");
}
}
/**
*描述:批量删除差异处理单,将状态修改为已废弃
*参数:List<WarDifferent> warDifferentList
*创建者:ice
*/
@RequestMapping(path = "/deleteWarDifferent",method = RequestMethod.POST)
public Result deleteWarDifferent(@RequestBody List<WarDifferent> warDifferentList){
for(WarDifferent war:warDifferentList){
WarDifferent warDifferent = warDifferentService.findWarDiffById(war.getId());
if(warDifferent == null){
return new Result(false,StatusCode.ERROR,"当前数据不存在,请刷新!");
}
//删除差异处理单,修改状态为已废弃
this.warDifferentService.deleteWarDifferent(war.getId());
}
return new Result(true,StatusCode.OK,"删除成功!");
}
}
package orthopedics.controller.bookcity;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import orthopedics.dao.WarTransferLineMapper;
import orthopedics.dao.WarTransferMapper;
import orthopedics.model.SysAccessToken;
import orthopedics.model.WarTransfer;
import orthopedics.model.WarTransferLine;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.Result;
import orthopedics.util.StatusCode;
import orthopedics.util.StringUtil;
import orthopedics.util.UuidUtil;
import orthopedics.vo.WarTransferPage;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequestMapping("/bookcity/warTransfer")
public class WarTransferController {
@Autowired
private UserServer userServer;
@Autowired
private PropertiesServer propertiesServer;
@Autowired
private WarTransferMapper warTransferMapper;
@Autowired
private WarTransferLineMapper warTransferLineMapper;
@PostMapping("/add")
public Result add(@RequestBody WarTransferPage warTransferPage, @RequestParam(value = "access_token",required = true)String token){
if(warTransferPage==null){
return new Result(false, StatusCode.ERROR,"参数为空");
}
SysAccessToken sysAccessToken = userServer.checkToken(token);
String uuidString = UuidUtil.get32UUIDString();
//头数据封装
warTransferPage.setId(uuidString);
warTransferPage.setCreateBy(sysAccessToken.getUserName());
warTransferPage.setCreateTime(LocalDateTime.now());
String count_number = propertiesServer.generateFlowingWater("WAR_TRANSFER_NUMBER");
if(StringUtil.isEmpty(count_number)){
return new Result(false, StatusCode.ERROR,"调拨单号获取失败");
}
if(StringUtil.isEmpty(warTransferPage.getOrderType())){
return new Result(false, StatusCode.ERROR,"缺少调拨类型");
}
warTransferPage.setOrderNumber(count_number);
warTransferPage.setDeliveryName(sysAccessToken.getUserId());
warTransferPage.setRequestorId(sysAccessToken.getUserId());
warTransferPage.setOrderStatus("completed");
//行数据封装
List<WarTransferLine> warTransferLineList = warTransferPage.getWarTransferLineList();
if(warTransferLineList==null||warTransferLineList.size()<=0){
return new Result(false, StatusCode.ERROR,"没有行数据");
}
for (int i=0;i<warTransferLineList.size();i++) {
WarTransferLine warTransferLine = warTransferLineList.get(i);
warTransferLine.setId(UuidUtil.get32UUIDString());
warTransferLine.setLineNumber(String.valueOf(i+1));
warTransferLine.setSourceHeaderId(uuidString);
warTransferLine.setCreateBy(sysAccessToken.getUserName());
warTransferLine.setCreateTime(LocalDateTime.now());
warTransferLine.setLineStatus("completed");
}
WarTransfer warTransfer=new WarTransfer();
BeanUtils.copyProperties(warTransferPage, warTransfer);
warTransferMapper.insert(warTransfer);
warTransferLineMapper.insertBatch(warTransferLineList);
return new Result(true,StatusCode.OK,"调拨单保存成功",count_number);
}
}
package orthopedics.controller.error;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 13:04 2019/3/11 0011
*/
public class MyException extends RuntimeException {
private ErrorEnum errorEnum;
public MyException(ErrorEnum errorEnum) {
this.errorEnum = errorEnum;
}
public ErrorEnum getErrorEnum() {
return errorEnum;
}
}
package orthopedics.controller.operation;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 11:59 2019/3/20 0020
* 领用单处理状态枚举
* 领用单状态 -> 触发的动作 -> 触发动作后的状态
*/
public enum CollectStatusEnum {
ENTER_CANCEL("ENTERED", "CANCEL", "CANCELED"),
ENTERED_SUBMIT("ENTERED", "SUBMIT", "SUBMITTED"),
SUBMITTED_APPROVE("SUBMITTED", "APPROVE", "APPROVED"),
SUBMITTED_REJECT("SUBMITTED", "REJECT", "REJECTED"),
REJECTED_CANCEL("REJECTED", "CANCEL", "CANCELED"),
REJECTED_SUBMIT("REJECTED", "SUBMIT", "SUBMITTED"),
APPROVED_COLLECT("APPROVED", "COLLECT", "COLLECTED_WAITTING_CONFIRMED"),
COLLECT_WATTING_CONFIRMED_CONFIRM("COLLECTED_WAITTING_CONFIRMED", "CONFIRM", "COLLECTED"),
COLLECTED_RETURN("COLLECTED", "RETURN", "RETURNED_WATTING_CONFIRMED"),
RETURNED_WATTING_CONFIRMED_CONFIRM("RETURNED_WATTING_CONFIRMED", "CONFIRM", "RETURNED"),
RETURNED_CONSUME("RETURNED", "CONSUME", "CONSUMED"),
NONE(null, null, null);
private String process;
private String status;
private String processResult;
private CollectStatusEnum(String status, String process, String processResult) {
this.process = process;
this.status = status;
this.processResult = processResult;
}
public String getProcess() {
return process;
}
public String getStatus() {
return status;
}
public String getProcessResult() {
return processResult;
}
public static CollectStatusEnum getCollectStatus(String status, String process) {
for (CollectStatusEnum c : CollectStatusEnum.values()) {
if (status.equals(c.status) && process.equals(c.process)) {
return c;
}
}
return NONE;
}
}
package orthopedics.controller.operation;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 18:09 2019/4/16 0016
*/
public enum OperationSubInvTypeEnum {
COLLECT_STORAGE("COLLECT", "STORAGE"),
RETURN_COLLECTING("RETURN", "COLLECTING");
private String operation;
private String subInvType;
OperationSubInvTypeEnum(String operation, String subInvType) {
this.operation = operation;
this.subInvType = subInvType;
}
public static boolean isExist(String operation, String subInvType) {
for (OperationSubInvTypeEnum o : OperationSubInvTypeEnum.values()) {
if (operation.equals(o.operation) && subInvType.equals(o.subInvType)) {
return true;
}
}
return false;
}
}
package orthopedics.controller.operation;
/**
* @author: cen,zhihong
* @mail: cen,zhihong@a-bianli.com
* @date: Create in 11:59 2019/7/18 0020
* 领用单处理状态枚举
* 领用单状态 -> 触发的动作 -> 触发动作后的状态
*/
public enum PurOrderHeaderStatusEnum {
// ENTERED_CANCEL("ENTERED", "CANCEL", "CANCELED"),
// ENTERED_SUBMIT("ENTERED", "SUBMIT", "SUBMITTED"),
// SUBMITTED_APPROVE("SUBMITTED", "APPROVE", "APPROVED"),
// SUBMITTED_REJECT("SUBMITTED", "REJECT", "REJECTED"),
// REJECTED_CANCEL("REJECTED", "CANCEL", "CANCELED"),
// REJECTED_SUBMIT("REJECTED", "SUBMIT", "SUBMITTED"),
// APPROVED_CLOSE("APPROVED", "CLOSE", "CLOSED"),
// REQUIRE_REAPPROVE_SUBMIT("REQUIRE_REAPPROVE", "SUBMIT", "SUBMITTED"),
// REQUIRE_REAPPROVE_CANCEL("REQUIRE_REAPPROVE", "CANCEL", "CANCELED"),
ENTERED_CANCEL("new", "CANCEL", "deprecated"),
ENTERED_SUBMIT("new", "SUBMIT", "pending"),
SUBMITTED_APPROVE("pending", "APPROVE", "approval"),
SUBMITTED_REJECT("pending", "REJECT", "new"),
REJECTED_CANCEL("approval", "APPROVE", "complete"),
REJECTED_SUBMIT("approval", "REJECT", "pending"),
APPROVED_CLOSE("complete", "CLOSE", "CLOSED"),
REQUIRE_REAPPROVE_SUBMIT("REQUIRE_REAPPROVE", "SUBMIT", "SUBMITTED"),
REQUIRE_REAPPROVE_CANCEL("REQUIRE_REAPPROVE", "CANCEL", "CANCELED"),
NONE(null, null, null);
private String process;
private String status;
private String processResult;
private PurOrderHeaderStatusEnum(String status, String process, String processResult) {
this.process = process;
this.status = status;
this.processResult = processResult;
}
public String getProcess() {
return process;
}
public String getStatus() {
return status;
}
public String getProcessResult() {
return processResult;
}
public static PurOrderHeaderStatusEnum getPurOrderHeaderStatus(String status, String process) {
for (PurOrderHeaderStatusEnum c : PurOrderHeaderStatusEnum.values()) {
if (status.equals(c.status) && process.equals(c.process)) {
return c;
}
}
return NONE;
}
}
package orthopedics.controller.operation;
/**
* @author: cen,zhihong
* @mail: cen,zhihong@a-bianli.com
* @date: Create in 11:59 2019/7/18 0020
* 领用单处理状态枚举
* 领用单状态 -> 触发的动作 -> 触发动作后的状态
*/
public enum PurOrderLineStatusEnum {
ENTERED_CANCEL("ENTERED", "CANCEL", "CANCELED"),
REJECTED_CANCEL("REJECTED", "CANCEL", "CANCELED"),
REQUIRE_REAPPROVE_CANCEL("REQUIRE_REAPPROVE", "CANCEL", "CANCELED"),
NONE(null, null, null);
private String process;
private String status;
private String processResult;
private PurOrderLineStatusEnum(String status, String process, String processResult) {
this.process = process;
this.status = status;
this.processResult = processResult;
}
public String getProcess() {
return process;
}
public String getStatus() {
return status;
}
public String getProcessResult() {
return processResult;
}
public static PurOrderLineStatusEnum getPurOrderLineStatus(String status, String process) {
for (PurOrderLineStatusEnum c : PurOrderLineStatusEnum.values()) {
if (status.equals(c.status) && process.equals(c.process)) {
return c;
}
}
return NONE;
}
}
package orthopedics.controller.operation;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 15:12 2019/7/31 0031
*/
public enum SaleOrderProcessEnum {
ENTERED_CANCEL("ENTERED", "CANCEL", "CANCELED"),
ENTERED_SUBMIT("ENTERED", "SUBMIT", "SUBMITTED"),
SUBMITTED_APPROVE("SUBMITTED", "APPROVE", "APPROVED"),
SUBMITTED_REJECT("SUBMITTED", "REJECT", "REJECTED"),
REJECTED_CANCEL("REJECTED", "CANCEL", "CANCELED"),
APPROVED_CLOSE("APPROVED", "CLOSE", "CLOSED"),
SHIPPED_CLOSE("SHIPPED", "CLOSE", "CLOSED"),
NONE(null, null, null);
private String process;
private String status;
private String processResult;
private SaleOrderProcessEnum(String status, String process, String processResult) {
this.process = process;
this.status = status;
this.processResult = processResult;
}
public String getStatus() {
return status;
}
public String getProcessResult() {
return processResult;
}
public static SaleOrderProcessEnum getSaleOrderProcessStatus(String status, String process) {
for (SaleOrderProcessEnum c : SaleOrderProcessEnum.values()) {
if (status.equals(c.status) && process.equals(c.process)) {
return c;
}
}
return NONE;
}
}
package orthopedics.controller.v1;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.model.City;
import orthopedics.dao.CityMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import orthopedics.service.CityServer;
import orthopedics.util.TimeUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 15:17 2019/2/13 0013
* 主要用于验证框架的功能,与业务无关
*/
@RestController("CityController-v1")
@RequestMapping("/v1")
public class CityController {
private final static Logger logger = LoggerFactory.getLogger(CityController.class);
private int count = 0;
@Autowired
private CityMapper cityMapper;
@Autowired
private CityServer cityServer;
private String name;
/**
*
* @param state
* @return
*/
//如 /city?state=GuangDong
@RequestMapping(path = "/city", method = RequestMethod.GET)
@Transactional
public City getCity(@RequestParam(value = "state", defaultValue = "")String state) {
List<City> cityList = cityMapper.findByState(state);
cityMapper.insertIntoCity2(new City(190293, "ddsffsds", "sd","ds","ds"));
cityMapper.insertIntoCity2(new City(1902093, "ds", "sd","ds","ds"));
throw ErrorEnum.NotAllowToBeEmptyError.createException();
//return cityList.isEmpty() ? null : cityList.get(0);
}
@RequestMapping(path = "/city", method = RequestMethod.POST)
public String testdd(@RequestBody JSONObject json){
City city = new City();
city.setId(9);
String date = json.getString("date");
city.setCreateTime(TimeUtil.fromDateToLocalDateTime(date));
cityMapper.insertIntoCity(city);
return json.toJSONString();
}
//如 /city/GuangDong
@RequestMapping(path = "/city/{state}", method = RequestMethod.GET)
@Transactional
public City getCity1(@PathVariable("state") String state) {
List<City> cityList = cityMapper.findByState(state);
logger.info("测试");
getCity(state);
return cityList.isEmpty() ? null : cityList.get(0);
}
@RequestMapping("/withErrorCode")
public Map<String, Object> withErrorCode(@RequestParam(value = "state", defaultValue = "")String state) {
Map<String, Object> result = new HashMap<>();
List<City> cityList = cityMapper.findByState(state);
String errorCode;
if (cityList.isEmpty()) {
errorCode = "1";
result.put("ErrorStr", "not return value");
}else {
errorCode = "0";
}
result.put("ErrorCode", errorCode);
result.put("city", cityList);
return result;
}
@RequestMapping(path = "/insertCity", method = RequestMethod.POST)
//事务
@Transactional
public Map<String, String> insertCity(@RequestBody City city) {
String errorCode = "0";
System.out.println("测试事务:" + (count++));
try {
cityMapper.insertIntoCity(city);
City city1 = new City(1, "东坡 ", "fd ", " dfs", " dfds");
cityMapper.insertIntoCity2(city1);
} catch (Exception e) {
//回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
System.out.println("异常发生");
}
Map<String, String> response = new HashMap<>();
response.put("ErrorCode", errorCode);
return response;
}
@RequestMapping(path = "/test/addadd", method = RequestMethod.GET)
public Map<String, Integer> test() {
Map<String, Integer> response = new HashMap<>();
response.put("ErrorCode", cityServer.getCount());
return response;
}
}
This diff could not be displayed because it is too large.
package orthopedics.controller.v2;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.dao.CityMapper;
import orthopedics.model.City;
import orthopedics.util.TimeUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 15:17 2019/2/13 0013
* 主要用于验证框架的功能,与业务无关
*/
@RestController("CityController-v2")
@RequestMapping("/v2")
public class CityController {
private final static Logger logger = LoggerFactory.getLogger(CityController.class);
private int count = 0;
@Autowired
private CityMapper cityMapper;
private String name;
//如 /city?state=GuangDong
@RequestMapping(path = "/city", method = RequestMethod.GET)
@Transactional
public City getCity(@RequestParam(value = "state", defaultValue = "")String state) {
List<City> cityList = cityMapper.findByState(state);
cityMapper.insertIntoCity2(new City(190293, "ddsffsds", "sd","ds","ds"));
cityMapper.insertIntoCity2(new City(1902093, "ds", "sd","ds","ds"));
throw ErrorEnum.NotAllowToBeEmptyError.createException();
//return cityList.isEmpty() ? null : cityList.get(0);
}
@RequestMapping(path = "/city", method = RequestMethod.POST)
public String testdd(@RequestBody JSONObject json){
City city = new City();
city.setId(9);
String date = json.getString("date");
city.setCreateTime(TimeUtil.fromDateToLocalDateTime(date));
cityMapper.insertIntoCity(city);
return json.toJSONString();
}
//如 /city/GuangDong
@RequestMapping(path = "/city/{state}", method = RequestMethod.GET)
@Transactional
public City getCity1(@PathVariable("state") String state) {
List<City> cityList = cityMapper.findByState(state);
logger.info("测试");
getCity(state);
return cityList.isEmpty() ? null : cityList.get(0);
}
@RequestMapping("/withErrorCode")
public Map<String, Object> withErrorCode(@RequestParam(value = "state", defaultValue = "")String state) {
Map<String, Object> result = new HashMap<>();
List<City> cityList = cityMapper.findByState(state);
String errorCode;
if (cityList.isEmpty()) {
errorCode = "1";
result.put("ErrorStr", "not return value");
}else {
errorCode = "0";
}
result.put("ErrorCode", errorCode);
result.put("city", cityList);
return result;
}
@RequestMapping(path = "/insertCity", method = RequestMethod.POST)
//事务
@Transactional
public Map<String, String> insertCity(@RequestBody City city) {
String errorCode = "0";
System.out.println("测试事务:" + (count++));
try {
cityMapper.insertIntoCity(city);
City city1 = new City(1, "东坡 ", "fd ", " dfs", " dfds");
cityMapper.insertIntoCity2(city1);
} catch (Exception e) {
//回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
System.out.println("异常发生");
}
Map<String, String> response = new HashMap<>();
response.put("ErrorCode", errorCode);
return response;
}
@RequestMapping(path = "/test/addadd", method = RequestMethod.GET)
public Map<String, String> test() {
Map<String, String> response = new HashMap<>();
response.put("ErrorCode", "90");
return response;
}
}
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.ArCustomerTransaction;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author
*/
public interface ArCustomerTransactionMapper{
@Select("SELECT * FROM ar_customer_transaction")
@Results(id = "arcustomertransaction", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "customerId", column = "customer_id"),
@Result(property = "customerSiteId", column = "customer_site_id"),
@Result(property = "arTransactionType", column = "ar_transaction_type"),
@Result(property = "transactionDate", column = "transaction_date"),
@Result(property = "transactionAmount", column = "transaction_amount"),
@Result(property = "dedicatedType", column = "dedicated_type"),
@Result(property = "dedicatedHeaderId", column = "dedicated_header_id"),
@Result(property = "dedicatedLineId", column = "dedicated_line_id"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
@Result(property = "sourceType", column = "source_type"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceHeaderNumber", column = "source_header_number"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "sourceLineNumber", column = "source_line_number"),
})
public List<ArCustomerTransaction> select();
@Insert("<script>" +
"INSERT INTO ar_customer_transaction(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,customer_id,customer_site_id,ar_transaction_type,transaction_date,transaction_amount,dedicated_type,dedicated_header_id,dedicated_line_id,start_date,end_date,source_type,source_header_id,source_header_number,source_line_id,source_line_number) VALUES" +
"<foreach collection='arcustomertransactions' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.sysOrgCode},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.orgId},#{item.customerId},#{item.customerSiteId},#{item.arTransactionType},#{item.transactionDate},#{item.transactionAmount},#{item.dedicatedType},#{item.dedicatedHeaderId},#{item.dedicatedLineId},#{item.startDate},#{item.endDate},#{item.sourceType},#{item.sourceHeaderId},#{item.sourceHeaderNumber},#{item.sourceLineId},#{item.sourceLineNumber})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("arcustomertransactions")List<ArCustomerTransaction> ArCustomerTransactionList);
@Insert(
"INSERT INTO ar_customer_transaction(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,customer_id,customer_site_id,ar_transaction_type,transaction_date,transaction_amount,dedicated_type,dedicated_header_id,dedicated_line_id,start_date,end_date,source_type,source_header_id,source_header_number,source_line_id,source_line_number) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{sysOrgCode},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{orgId},#{customerId},#{customerSiteId},#{arTransactionType},#{transactionDate},#{transactionAmount},#{dedicatedType},#{dedicatedHeaderId},#{dedicatedLineId},#{startDate},#{endDate},#{sourceType},#{sourceHeaderId},#{sourceHeaderNumber},#{sourceLineId},#{sourceLineNumber})"
)
Integer insert(ArCustomerTransaction ArCustomerTransaction);
}
\ No newline at end of file
package orthopedics.dao;
import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.ArCustomerTransactionV;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author
*/
public interface ArCustomerTransactionVMapper{
@Select("<script>"
+ "SELECT * FROM ar_customer_transaction_v WHERE 1=1 "
+ "AND org_code = #{orgCode} "
+ "AND customer_code = #{customerCode} "
+ "<if test='customerSiteCode != null and customerSiteCode != \"\"'>"
+ "AND customer_site_code = #{customerSiteCode} "
+ "</if>"
+ "AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date))"
+ "</script>")
@Results(id = "arcustomertransactionv", value ={
@Result(property = "customerSiteCode", column = "customer_site_code"),
@Result(property = "customerSiteName", column = "customer_site_name"),
@Result(property = "orgCode", column = "org_code"),
@Result(property = "orgName", column = "org_name"),
@Result(property = "customerCode", column = "customer_code"),
@Result(property = "customerName", column = "customer_name"),
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "customerId", column = "customer_id"),
@Result(property = "customerSiteId", column = "customer_site_id"),
@Result(property = "transactionTypeCode", column = "transaction_type_code"),
@Result(property = "transactionTypeName", column = "transaction_type_name"),
@Result(property = "transactionDate", column = "transaction_date"),
@Result(property = "transactionAmount", column = "transaction_amount"),
@Result(property = "dedicatedType", column = "dedicated_type"),
@Result(property = "dedicatedHeaderId", column = "dedicated_header_id"),
@Result(property = "dedicatedLineId", column = "dedicated_line_id"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
@Result(property = "sourceTypeCode", column = "source_type_code"),
@Result(property = "sourceTypeName", column = "source_type_name"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceHeaderNumber", column = "source_header_number"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "sourceLineNumber", column = "source_line_number"),
})
public List<ArCustomerTransactionV> selectByOrdAndCustomerCode(@Param("orgCode")String orgCode,
@Param("customerCode")String customerCode, @Param("customerSiteCode")String customerSiteCode,
@Param("now")LocalDateTime now);
@Insert("<script>" +
"INSERT INTO ar_customer_transaction_v(customer_site_code,customer_site_name,org_code,org_name,customer_code,customer_name,id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,customer_id,customer_site_id,transaction_type_code,transaction_type_name,transaction_date,transaction_amount,dedicated_type,dedicated_header_id,dedicated_line_id,start_date,end_date,source_type_code,source_type_name,source_header_id,source_header_number,source_line_id,source_line_number) VALUES" +
"<foreach collection='arcustomertransactionvs' item='item' index='index' separator=','>" +
"(#{item.customerSiteCode},#{item.customerSiteName},#{item.orgCode},#{item.orgName},#{item.customerCode},#{item.customerName},#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.sysOrgCode},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.orgId},#{item.customerId},#{item.customerSiteId},#{item.transactionTypeCode},#{item.transactionTypeName},#{item.transactionDate},#{item.transactionAmount},#{item.dedicatedType},#{item.dedicatedHeaderId},#{item.dedicatedLineId},#{item.startDate},#{item.endDate},#{item.sourceTypeCode},#{item.sourceTypeName},#{item.sourceHeaderId},#{item.sourceHeaderNumber},#{item.sourceLineId},#{item.sourceLineNumber})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("arcustomertransactionvs")List<ArCustomerTransactionV> ArCustomerTransactionVList);
@Insert(
"INSERT INTO ar_customer_transaction_v(customer_site_code,customer_site_name,org_code,org_name,customer_code,customer_name,id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,customer_id,customer_site_id,transaction_type_code,transaction_type_name,transaction_date,transaction_amount,dedicated_type,dedicated_header_id,dedicated_line_id,start_date,end_date,source_type_code,source_type_name,source_header_id,source_header_number,source_line_id,source_line_number) VALUES" +
"(#{customerSiteCode},#{customerSiteName},#{orgCode},#{orgName},#{customerCode},#{customerName},#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{sysOrgCode},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{orgId},#{customerId},#{customerSiteId},#{transactionTypeCode},#{transactionTypeName},#{transactionDate},#{transactionAmount},#{dedicatedType},#{dedicatedHeaderId},#{dedicatedLineId},#{startDate},#{endDate},#{sourceTypeCode},#{sourceTypeName},#{sourceHeaderId},#{sourceHeaderNumber},#{sourceLineId},#{sourceLineNumber})"
)
Integer insert(ArCustomerTransactionV ArCustomerTransactionV);
}
\ No newline at end of file
package orthopedics.dao;
import orthopedics.model.City;
import org.apache.ibatis.annotations.*;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 14:12 2019/2/13 0013
*/
@Mapper
public interface CityMapper {
@Select("SELECT * FROM city WHERE state = #{state}")
//如果命名相同,可以省略不写
@Results(id = "city", value = {
//@Result(property = "id", column = "id", javaType = long.class),
//@Result(property = "name", column = "name"),
// @Result(property = "state", column = "state"),
//@Result(property = "country", column = "country")
@Result(property = "zoneNum", column = "zone_num"),
@Result(property = "createTime", column = "create_time")
})
List<City> findByState(@Param("state") String state);
@Select("SELECT c.create_time FROM city c WHERE state = #{state}")
@Results(value = {
@Result(property = "createTime", column = "create_time", javaType = java.time.LocalDateTime.class)
})
Map<String, LocalDateTime> findByState1(@Param("state") String state);
@Select("SELECT * FROM city WHERE state = #{state}")
@ResultMap("city")
List<City> selectByState(@Param("state")String state);
@ResultMap("city")
@Select("SELECT * FROM city WHERE state = #{state}")
List<City> reuseResultMapTest(@Param("state")String state);
@Insert("INSERT INTO city(name,state,country,zone_num, create_time) VALUES(#{name}, #{state}, #{country}, #{zoneNum}, #{createTime})")
void insertIntoCity(City city);
@Insert("INSERT INTO city(id,name,state,country,zone_num) VALUES(#{id}, #{name}, #{state}, #{country}, #{zoneNum})")
void insertIntoCity2(City city);
@Select("select * from city where id = #{id}")
City selectById(@Param("id")long id);
@Update("UPDATE city set name=#{name} where id=#{id}")
void update(@Param("name")String name, @Param("id")Long id);
@Delete("DELETE FROM city where id=#{id}")
void delete(Long id);
@Insert("<script>" +
"INSERT INTO city(name,state,country,zone_num) values" +
"<foreach collection='list' item='item' index='index' separator=','>" +
"(#{item.name}, #{item.state},#{item.country},#{item.zoneNum})" +
"</foreach>" +
"</script>")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
Integer insertBatch(@Param("list") List<City> cityList);
}
package orthopedics.dao;
import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.CstItemCost;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author
*/
public interface CstItemCostMapper{
@Select("SELECT * FROM cst_item_cost WHERE inv_id = #{invId} AND item_id = #{itemId} "
+ "AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date))")
@Results(id = "cstitemcost", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "costTypeId", column = "cost_type_id"),
@Result(property = "itemCost", column = "item_cost"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
@Result(property = "originTxId", column = "origin_tx_id"),
@Result(property = "lastTxId", column = "last_tx_id"),
})
public List<CstItemCost> selectInvIdAndItemId(@Param("invId")String invId, @Param("itemId")String itemId, @Param("now")LocalDateTime now);
@Insert("<script>" +
"INSERT INTO cst_item_cost(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_id,cost_type_id,item_cost,start_date,end_date,origin_tx_id,last_tx_id) VALUES" +
"<foreach collection='cstitemcosts' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.sysOrgCode},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.itemId},#{item.costTypeId},#{item.itemCost},#{item.startDate},#{item.endDate},#{item.originTxId},#{item.lastTxId})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("cstitemcosts")List<CstItemCost> CstItemCostList);
@Insert(
"INSERT INTO cst_item_cost(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_id,cost_type_id,item_cost,start_date,end_date,origin_tx_id,last_tx_id) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{sysOrgCode},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{itemId},#{costTypeId},#{itemCost},#{startDate},#{endDate},#{originTxId},#{lastTxId})"
)
Integer insert(CstItemCost CstItemCost);
}
\ No newline at end of file
package orthopedics.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* @author: su.yongpeng
* @mail: su.yongpeng@tuoxi-tech.com
* @date: Create in 16:57 2019/8/3 0003
* 用于调用存储过程或者函数
*/
@Mapper
public interface FunctionMapper {
@Select("select fun_get_can_ship_number(#{orderLineId})")
public Integer getCanShipNumber(@Param("orderLineId")String orderLineId);
}
package orthopedics.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import orthopedics.model.HardwareDevice;
import javax.annotation.security.PermitAll;
import java.util.List;
import java.util.Map;
/**
* @author
*/
public interface HardwareDeviceMapper{
@Select("SELECT * FROM hw_device WHERE inv_id = #{invId} AND device_code = #{deviceCode} AND status = 'A'")
List<HardwareDevice> selectByDeviceCode(@Param("invId")String invId, @Param("deviceCode")String deviceCode);
@Select("SELECT " +
" iv.inv_code AS invCode, " +
" hd.device_code AS deviceCode, " +
" hg.group_code AS groupCode " +
"FROM " +
" inv_inventory iv, " +
" hw_device hd, " +
" hw_device_group hg " +
"WHERE " +
" 1 = 1 AND " +
" iv.inv_code = #{invCode} " +
" AND hd.inv_id = iv.id " +
" AND hd.device_group_id = hg.id " +
"limit 1")
Map<String, String> selectDeviceGroup(@Param("invCode")String invCode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.HpPartySiteV;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
/**
* @author cen.zhihong
*/
public interface HpPartySiteVMapper {
@Select("SELECT * FROM hp_party_site_v")
@Results(id = "hppartysitev", value ={
@Result(property = "id", column = "id"),
@Result(property = "partyId", column = "party_id"),
@Result(property = "partySiteCode", column = "party_site_code"),
@Result(property = "partySiteName", column = "party_site_name"),
@Result(property = "partySiteDesc", column = "party_site_desc"),
@Result(property = "partySiteType", column = "party_site_type"),
@Result(property = "partySiteShortName", column = "party_site_short_name"),
})
public List<HpPartySiteV> select();
@Select("SELECT * FROM hp_party_site_v WHERE id = #{id}")
@ResultMap("hppartysitev")
List<HpPartySiteV> selectById(@Param("id")String id);
@Select("SELECT * FROM hp_party_site_v WHERE party_site_code = #{partySiteCode}")
@ResultMap("hppartysitev")
List<HpPartySiteV> selectByPartySiteCode(@Param("partySiteCode")String partySiteCode);
@Insert("<script>" +
"INSERT INTO hp_party_site_v(id,party_id,party_site_code,party_site_name,party_site_desc,party_site_type,party_site_short_name) VALUES" +
"<foreach collection='hppartysitevs' item='item' index='index' separator=','>" +
"(#{item.id},#{item.partyId},#{item.partySiteCode},#{item.partySiteName},#{item.partySiteDesc},#{item.partySiteType},#{item.partySiteShortName})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("hppartysitevs")List<HpPartySiteV> hpPartySiteVList);
@Insert(
"INSERT INTO hp_party_site_v(id,party_id,party_site_code,party_site_name,party_site_desc,party_site_type,party_site_short_name) VALUES" +
"(#{id},#{partyId},#{partySiteCode},#{partySiteName},#{partySiteDesc},#{partySiteType},#{partySiteShortName})"
)
Integer insert(HpPartySiteV HpPartySiteV);
}
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.HpPartyV;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author cen.zhihong
*/
public interface HpPartyVMapper {
@Select("SELECT * FROM hp_party_v")
@Results(id = "hppartyv", value ={
@Result(property = "id", column = "id"),
@Result(property = "partyType", column = "party_type"),
@Result(property = "partyCode", column = "party_code"),
@Result(property = "partyName", column = "party_name"),
@Result(property = "partyDesc", column = "party_desc"),
@Result(property = "partyShortName", column = "party_short_name"),
@Result(property = "taxRegistrationCode", column = "tax_registration_code"),
@Result(property = "status", column = "status"),
})
public List<HpPartyV> select();
@Select("SELECT * FROM hp_party_v WHERE id = #{id}")
@ResultMap("hppartyv")
List<HpPartyV> selectById(@Param("id")String id);
@Select("SELECT * FROM hp_party_v WHERE party_code = #{party_code}")
@ResultMap("hppartyv")
List<HpPartyV> selectByCode(@Param("party_code")String party_code);
@Insert("<script>" +
"INSERT INTO hp_party_v(id,party_type,party_code,party_name,party_desc,party_short_name,tax_registration_code,status) VALUES" +
"<foreach collection='hppartyvs' item='item' index='index' separator=','>" +
"(#{item.id},#{item.partyType},#{item.partyCode},#{item.partyName},#{item.partyDesc},#{item.partyShortName},#{item.taxRegistrationCode},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("hppartyvs")List<HpPartyV> hpPartyVList);
@Insert(
"INSERT INTO hp_party_v(id,party_type,party_code,party_name,party_desc,party_short_name,tax_registration_code,status) VALUES" +
"(#{id},#{partyType},#{partyCode},#{partyName},#{partyDesc},#{partyShortName},#{taxRegistrationCode},#{status})"
)
Integer insert(HpPartyV HpPartyV);
}
package orthopedics.dao;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;
import orthopedics.model.HrOrganization;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* @author
*/
public interface HrOrganizationMapper{
@Select("SELECT * FROM hr_organization WHERE org_code = #{orgCode} AND status = 'A'")
@Results(id = "hrorganization", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "orgCode", column = "org_code"),
@Result(property = "orgName", column = "org_name"),
@Result(property = "orgDesc", column = "org_desc"),
@Result(property = "parentOrgId", column = "parent_org_id"),
@Result(property = "status", column = "status"),
@Result(property = "orgType", column = "org_type"),
@Result(property = "locationId", column = "location_id"),
})
public List<HrOrganization> selectByOrgCode(@Param("orgCode")String orgCode);
@Select("SELECT * FROM hr_organization WHERE id = #{orgId} AND status = 'A'")
@ResultMap("hrorganization")
List<HrOrganization> selectByOrgId(@Param("orgId")String orgId);
@Select("SELECT * FROM hr_organization WHERE parent_org_id = #{orgId} AND status = 'A'")
@ResultMap("hrorganization")
List<HrOrganization> selectChildByOrgId(@Param("orgId")String orgId);
@Select("SELECT u.avatar as headshot, p.id as person_id,po.org_id as org_id, p.full_name, " +
"o.org_name, po.start_date, po.end_date,o.org_code " +
"FROM sys_user u " +
"LEFT JOIN hr_person p " +
"ON u.person_id = p.id " +
"LEFT JOIN hr_person_org po " +
"ON p.id = po.person_id " +
"LEFT JOIN hr_organization o " +
"ON po.org_id = o.id " +
"WHERE u.id = #{userId} " +
"AND u.status = 1 " +
"AND p.status = 'A' " +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) " +
"AND o.status = 'A' order by o.org_code ")
@Results(value = {
@Result(property = "fullName", column = "full_name"),
@Result(property = "orgName", column = "org_name"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
@Result(property = "orgCode", column = "org_code"),
@Result(property = "personId", column = "person_id"),
@Result(property = "orgId", column = "org_id")
})
List<Map<String, Object>> selectPersonOrganizationInfoByUserId(@Param("userId")String userId, @Param("now")LocalDateTime now);
@Select("SELECT 1 " +
"FROM sys_user u " +
"LEFT JOIN hr_person p " +
"ON u.person_id = p.id " +
"LEFT JOIN hr_person_org po " +
"ON p.id = po.person_id " +
"LEFT JOIN hr_organization o " +
"ON po.org_id = o.id " +
"WHERE u.id = #{userId} AND o.org_code = #{orgCode}" +
"AND u.status = 1 " +
"AND p.status = 'A' " +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) " +
"AND o.status = 'A'")
Integer isExist(@Param("userId")String userId, @Param("orgCode")String orgCode, @Param("now")LocalDateTime now);
//查询组织id对应的组织code
@Select("select org_code from hr_organization where id = #{id}")
String selectOrgCode(@Param("id") String id);
//查询组织id对应的组织code
@Select("select * from hr_organization where id = #{id}")
List<HrOrganization> selectById(@Param("id") String id);
//查询组织code是否存在
@Select("select count(id) from hr_organization where org_code=#{orgCode}")
int selectIfExistOrgCode(@Param("orgCode") String orgCode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.HrPerson;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author
*/
public interface HrPersonMapper{
@Select("SELECT p.* FROM sys_user u " +
"LEFT JOIN hr_person p " +
"ON u.person_id = p.id " +
"WHERE u.id = #{userId} AND u.status = 1 AND p.status = 'A'")
@Results(id = "hrperson", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "lastName", column = "last_name"),
@Result(property = "firstName", column = "first_name"),
@Result(property = "fullName", column = "full_name"),
@Result(property = "gender", column = "gender"),
@Result(property = "locationId", column = "location_id"),
@Result(property = "status", column = "status"),
})
public List<HrPerson> selectByUserId(@Param("userId")String userId);
@Select("SELECT p.* FROM sys_user u " +
"LEFT JOIN hr_person p " +
"ON u.person_id = p.id " +
"WHERE u.username = #{username} AND u.status = 1 AND p.status = 'A'")
@ResultMap("hrperson")
List<HrPerson> selectByUsername(@Param("username")String userId);
//根据id查询
@Select("select * from hr_person where id = #{id}")
@ResultMap("hrperson")
List<HrPerson> selectById(@Param("id") String id);
//根据fullname查询
@Select("select * from hr_person where full_name = #{name}")
@ResultMap("hrperson")
List<HrPerson> selectByFullName(@Param("name")String name);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.HrPersonOrg;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author ice
*/
public interface HrPersonOrgMapper{
@Select("SELECT * FROM hr_person_org")
@Results(id = "hrpersonorg", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "personId", column = "person_id"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
})
public List<HrPersonOrg> select();
@Insert("<script>" +
"INSERT INTO hr_person_org(id,create_by,create_time,update_by,update_time,person_id,org_id,start_date,end_date) VALUES" +
"<foreach collection='hrpersonorgs' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.personId},#{item.orgId},#{item.startDate},#{item.endDate})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("hrpersonorgs") List<HrPersonOrg> HrPersonOrgList);
@Insert(
"INSERT INTO hr_person_org(id,create_by,create_time,update_by,update_time,person_id,org_id,start_date,end_date) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{personId},#{orgId},#{startDate},#{endDate})"
)
Integer insert(HrPersonOrg HrPersonOrg);
@Select("select * from hr_person_org where person_id = #{id}")
@ResultMap("hrpersonorg")
List<HrPersonOrg> selectByPersonId(@Param("id") String id);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvCategory;
/**
* @author
*/
public interface InvCategoryMapper{
@Select("SELECT * FROM inv_category WHERE id = #{id} AND status = 'A'")
@Results(id = "invcategory", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "categorySet", column = "category_set"),
@Result(property = "categoryCode", column = "category_code"),
@Result(property = "categoryName", column = "category_name"),
@Result(property = "categoryDesc", column = "category_desc"),
@Result(property = "parentCategoryId", column = "parent_category_id"),
@Result(property = "status", column = "status"),
})
public List<InvCategory> selectById(@Param("id")String id);
@Select("SELECT * FROM inv_category WHERE category_set = #{categorySet} AND category_code = #{categoryCode} AND status = 'A'")
@ResultMap("invcategory")
public List<InvCategory> selectByCategorySetAndCode(@Param("categorySet")String categorySet, @Param("categoryCode")String categoryCode);
@Select("SELECT * FROM inv_category WHERE category_code = #{categoryCode} AND status = 'A'")
@ResultMap("invcategory")
public List<InvCategory> findByCategoryCode(@Param("categoryCode")String categoryCode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvCountHeader;
import org.apache.ibatis.annotations.Param;
/**
* @author ice
*/
public interface InvCountHeaderMapper{
@Select("SELECT * FROM inv_count_header")
@Results(id = "invcountheader", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "countNumber", column = "count_number"),
@Result(property = "countDate", column = "count_date"),
@Result(property = "counter", column = "counter"),
@Result(property = "reviewer", column = "reviewer"),
@Result(property = "headerRemark", column = "header_remark"),
@Result(property = "headerStatus", column = "header_status"),
@Result(property = "sourceType", column = "source_type"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceHeaderNumber", column = "source_header_number"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "sourceLineNumber", column = "source_line_number"),
@Result(property = "printId", column = "print_id"),
})
public List<InvCountHeader> select();
@Insert("<script>" +
"INSERT INTO inv_count_header(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,count_number,count_date,counter,reviewer,header_remark,header_status,source_type,source_header_id,source_header_number,source_line_id,source_line_number,print_id) VALUES" +
"<foreach collection='invcountheaders' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.sysOrgCode},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.countNumber},#{item.countDate},#{item.counter},#{item.reviewer},#{item.headerRemark},#{item.headerStatus},#{item.sourceType},#{item.sourceHeaderId},#{item.sourceHeaderNumber},#{item.sourceLineId},#{item.sourceLineNumber},#{item.printId})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invcountheaders") List<InvCountHeader> InvCountHeaderList);
@Insert(
"INSERT INTO inv_count_header(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,count_number,count_date,counter,reviewer,header_remark,header_status,source_type,source_header_id,source_header_number,source_line_id,source_line_number,print_id) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{sysOrgCode},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{countNumber},#{countDate},#{counter},#{reviewer},#{headerRemark},#{headerStatus},#{sourceType},#{sourceHeaderId},#{sourceHeaderNumber},#{sourceLineId},#{sourceLineNumber},#{printId})"
)
Integer insert(InvCountHeader InvCountHeader);
//根据id查询
@Select("select * from inv_count_header where id = #{id}")
@ResultMap("invcountheader")
InvCountHeader selectInvCountHeaderById(@Param("id") String id);
//修改状态
@Update("update inv_count_header set header_status = #{status} where id = #{id}")
int updateInvCountHeaderStatus(@Param("status") String status, @Param("id") String id);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvCountLine;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author ice
*/
public interface InvCountLineMapper{
@Select("SELECT * FROM inv_count_line")
@Results(id = "invcountline", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "invCountHeaderId", column = "inv_count_header_id"),
@Result(property = "lineNumber", column = "line_number"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "accountQuantity", column = "account_quantity"),
@Result(property = "actualQuantity", column = "actual_quantity"),
@Result(property = "differentQuantity", column = "different_quantity"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "lineRemark", column = "line_remark"),
@Result(property = "lineStatus", column = "line_status"),
@Result(property = "sourceType", column = "source_type"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceHeaderNumber", column = "source_header_number"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "sourceLineNumber", column = "source_line_number"),
})
public List<InvCountLine> select();
@Insert("<script>" +
"INSERT INTO inv_count_line(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,inv_count_header_id,line_number,subinv_id,locator_id,item_id,item_name,item_desc,account_quantity,actual_quantity,different_quantity,unit_code,line_remark,line_status,source_type,source_header_id,source_header_number,source_line_id,source_line_number) VALUES" +
"<foreach collection='invcountlines' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.sysOrgCode},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.invCountHeaderId},#{item.lineNumber},#{item.subinvId},#{item.locatorId},#{item.itemId},#{item.itemName},#{item.itemDesc},#{item.accountQuantity},#{item.actualQuantity},#{item.differentQuantity},#{item.unitCode},#{item.lineRemark},#{item.lineStatus},#{item.sourceType},#{item.sourceHeaderId},#{item.sourceHeaderNumber},#{item.sourceLineId},#{item.sourceLineNumber})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invcountlines") List<InvCountLine> InvCountLineList);
@Insert(
"INSERT INTO inv_count_line(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,inv_count_header_id,line_number,subinv_id,locator_id,item_id,item_name,item_desc,account_quantity,actual_quantity,different_quantity,unit_code,line_remark,line_status,source_type,source_header_id,source_header_number,source_line_id,source_line_number) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{sysOrgCode},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{invCountHeaderId},#{lineNumber},#{subinvId},#{locatorId},#{itemId},#{itemName},#{itemDesc},#{accountQuantity},#{actualQuantity},#{differentQuantity},#{unitCode},#{lineRemark},#{lineStatus},#{sourceType},#{sourceHeaderId},#{sourceHeaderNumber},#{sourceLineId},#{sourceLineNumber})"
)
Integer insert(InvCountLine InvCountLine);
//根据id查询
@Select("select * from inv_count_line where inv_count_header_id = #{id}")
@ResultMap("invcountline")
List<InvCountLine> selectByInvCountHeaderId(@Param("id") String id);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvInventory;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.InvItem;
/**
* @author author
*/
public interface InvInventoryMapper{
@Select("SELECT * FROM inv_inventory")
@Results(id = "invinventory", value ={
@Result(property = "id", column = "id"),
@Result(property = "create_by", column = "create_by"),
@Result(property = "create_time", column = "create_time"),
@Result(property = "update_by", column = "update_by"),
@Result(property = "update_time", column = "update_time"),
@Result(property = "attribute_category", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "org_id", column = "org_id"),
@Result(property = "inv_code", column = "inv_code"),
@Result(property = "inv_name", column = "inv_name"),
@Result(property = "inv_desc", column = "inv_desc"),
@Result(property = "master_admin", column = "master_admin"),
@Result(property = "status", column = "status"),
@Result(property = "location_id", column = "location_id"),
@Result(property = "sortid", column = "sortid"),
@Result(property = "serial_control", column = "serial_control"),
@Result(property = "max_inv_qty", column = "max_inv_qty"),
@Result(property = "lot_control", column = "lot_control"),
@Result(property = "min_inv_qty", column = "min_inv_qty"),
})
public List<InvInventory> select();
@Insert("<script>" +
"INSERT INTO inv_inventory(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,inv_code,inv_name,inv_desc,master_admin,status,location_id,sortid,serial_control,max_inv_qty,lot_control,min_inv_qty) VALUES" +
"<foreach collection='invinventorys' item='item' index='index' separator=','>" +
"(#{item.id},#{item.create_by},#{item.create_time},#{item.update_by},#{item.update_time},#{item.attribute_category},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.org_id},#{item.inv_code},#{item.inv_name},#{item.inv_desc},#{item.master_admin},#{item.status},#{item.location_id},#{item.sortid},#{item.serial_control},#{item.max_inv_qty},#{item.lot_control},#{item.min_inv_qty})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invinventorys") List<InvInventory> InvInventoryList);
@Insert(
"INSERT INTO inv_inventory(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,inv_code,inv_name,inv_desc,master_admin,status,location_id,sortid,serial_control,max_inv_qty,lot_control,min_inv_qty) VALUES" +
"(#{id},#{create_by},#{create_time},#{update_by},#{update_time},#{attribute_category},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{org_id},#{inv_code},#{inv_name},#{inv_desc},#{master_admin},#{status},#{location_id},#{sortid},#{serial_control},#{max_inv_qty},#{lot_control},#{min_inv_qty})"
)
Integer insert(InvInventory InvInventory);
@Select("SELECT * FROM inv_inventory WHERE id = #{id} and status = 'A'")
@ResultMap("invinventory")
InvInventory selectById(@Param("id") String id);
@Select("SELECT * FROM inv_inventory WHERE inv_code = #{InvCode} and status = 'A'")
@ResultMap("invinventory")
InvInventory selectByInvCode(@Param("InvCode") String InvCode);
@Select("SELECT * FROM inv_inventory WHERE org_id = #{orgId} and status = 'A'")
@ResultMap("invinventory")
List<InvInventory> selectByOrgId(@Param("orgId") String orgId);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemAttribute;
/**
* @author author
*/
public interface InvItemAttributeMapper{
@Select("SELECT * FROM inv_item_attribute")
@Results(id = "invitemattribute", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "series", column = "series"),
@Result(property = "author", column = "author"),
@Result(property = "translator", column = "translator"),
@Result(property = "prndate", column = "prndate"),
@Result(property = "edition", column = "edition"),
@Result(property = "nprint", column = "nprint"),
@Result(property = "binding", column = "binding"),
@Result(property = "lenCm", column = "len_cm"),
@Result(property = "widCm", column = "wid_cm"),
@Result(property = "thkCm", column = "thk_cm"),
@Result(property = "wtG", column = "wt_g"),
@Result(property = "pages", column = "pages"),
@Result(property = "words", column = "words"),
@Result(property = "keywds", column = "keywds"),
@Result(property = "reader", column = "reader"),
@Result(property = "directory", column = "directory"),
@Result(property = "summary", column = "summary"),
@Result(property = "brief", column = "brief"),
@Result(property = "award", column = "award"),
@Result(property = "bcontent", column = "bcontent"),
@Result(property = "bksize", column = "bksize"),
})
public List<InvItemAttribute> select();
@Insert("<script>" +
"INSERT INTO inv_item_attribute(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,item_id,item_code,series,author,translator,prndate,edition,nprint,binding,len_cm,wid_cm,thk_cm,wt_g,pages,words,keywds,reader,directory,summary,brief,award,bcontent,bksize) VALUES" +
"<foreach collection='invitemattributes' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.sysOrgCode},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.itemId},#{item.itemCode},#{item.series},#{item.author},#{item.translator},#{item.prndate},#{item.edition},#{item.nprint},#{item.binding},#{item.lenCm},#{item.widCm},#{item.thkCm},#{item.wtG},#{item.pages},#{item.words},#{item.keywds},#{item.reader},#{item.directory},#{item.summary},#{item.brief},#{item.award},#{item.bcontent},#{item.bksize})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitemattributes") List<InvItemAttribute> InvItemAttributeList);
@Insert(
"INSERT INTO inv_item_attribute(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,item_id,item_code,series,author,translator,prndate,edition,nprint,binding,len_cm,wid_cm,thk_cm,wt_g,pages,words,keywds,reader,directory,summary,brief,award,bcontent,bksize) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{sysOrgCode},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{itemId},#{itemCode},#{series},#{author},#{translator},#{prndate},#{edition},#{nprint},#{binding},#{lenCm},#{widCm},#{thkCm},#{wtG},#{pages},#{words},#{keywds},#{reader},#{directory},#{summary},#{brief},#{award},#{bcontent},#{bksize})"
)
Integer insert(InvItemAttribute InvItemAttribute);
@Delete("DELETE FROM inv_item_attribute WHERE item_code = #{itemCode}")
int deleteByItemCode( @Param("itemCode") String itemCode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemBalanceSummaryV;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author author
*/
public interface InvItemBalanceSummaryVMapper{
@Select("SELECT * FROM inv_item_balance_summary_v")
@Results(id = "invitembalancesummaryv", value ={
@Result(property = "inv_id", column = "inv_id"),
@Result(property = "subinv_id", column = "subinv_id"),
@Result(property = "locator_id", column = "locator_id"),
@Result(property = "item_id", column = "item_id"),
@Result(property = "balance", column = "balance"),
@Result(property = "inv_code", column = "inv_code"),
@Result(property = "inv_name", column = "inv_name"),
@Result(property = "subinv_code", column = "subinv_code"),
@Result(property = "subinv_name", column = "subinv_name"),
@Result(property = "locator_code", column = "locator_code"),
@Result(property = "locator_name", column = "locator_name"),
@Result(property = "item_code", column = "item_code"),
@Result(property = "scancode", column = "scancode"),
@Result(property = "purchase_price", column = "purchase_price"),
@Result(property = "item_name", column = "item_name"),
@Result(property = "item_desc", column = "item_desc"),
@Result(property = "max_inv_qty", column = "max_inv_qty"),
@Result(property = "min_inv_qty", column = "min_inv_qty"),
@Result(property = "specification", column = "specification"),
@Result(property = "unit_code", column = "unit_code"),
@Result(property = "unit_name", column = "unit_name"),
})
public List<InvItemBalanceSummaryV> select();
@Insert("<script>" +
"INSERT INTO inv_item_balance_summary_v(inv_id,subinv_id,locator_id,item_id,balance,inv_code,inv_name,subinv_code,subinv_name,locator_code,locator_name,item_code,scancode,purchase_price,item_name,item_desc,max_inv_qty,min_inv_qty,specification,unit_code,unit_name) VALUES" +
"<foreach collection='invitembalancesummaryvs' item='item' index='index' separator=','>" +
"(#{item.inv_id},#{item.subinv_id},#{item.locator_id},#{item.item_id},#{item.balance},#{item.inv_code},#{item.inv_name},#{item.subinv_code},#{item.subinv_name},#{item.locator_code},#{item.locator_name},#{item.item_code},#{item.scancode},#{item.purchase_price},#{item.item_name},#{item.item_desc},#{item.max_inv_qty},#{item.min_inv_qty},#{item.specification},#{item.unit_code},#{item.unit_name})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitembalancesummaryvs")List<InvItemBalanceSummaryV> InvItemBalanceSummaryVList);
@Insert(
"INSERT INTO inv_item_balance_summary_v(inv_id,subinv_id,locator_id,item_id,balance,inv_code,inv_name,subinv_code,subinv_name,locator_code,locator_name,item_code,scancode,purchase_price,item_name,item_desc,max_inv_qty,min_inv_qty,specification,unit_code,unit_name) VALUES" +
"(#{inv_id},#{subinv_id},#{locator_id},#{item_id},#{balance},#{inv_code},#{inv_name},#{subinv_code},#{subinv_name},#{locator_code},#{locator_name},#{item_code},#{scancode},#{purchase_price},#{item_name},#{item_desc},#{max_inv_qty},#{min_inv_qty},#{specification},#{unit_code},#{unit_name})"
)
Integer insert(InvItemBalanceSummaryV InvItemBalanceSummaryV);
@Select("SELECT * FROM inv_item_balance_summary_v WHERE scancode = #{scancode} and inv_code = #{inv_code}")
@ResultMap("invitembalancesummaryv")
List<InvItemBalanceSummaryV> selectByScancodeAndItemCode(@Param("scancode") String scancode,@Param("inv_code") String inv_code);
@Select("SELECT * FROM inv_item_balance_summary_v WHERE scancode = #{scancode}")
@ResultMap("invitembalancesummaryv")
List<InvItemBalanceSummaryV> selectByScancode(@Param("scancode") String scancode);
@Select("SELECT * FROM inv_item_balance_summary_v WHERE item_name = #{item_name}")
@ResultMap("invitembalancesummaryv")
List<InvItemBalanceSummaryV> selectByItemName(@Param("item_name") String item_name);
@Select("SELECT * FROM inv_item_balance_summary_v WHERE inv_code = #{invCode} and subinv_code = #{subinvCode} and locator_code = #{locatorCode}")
@ResultMap("invitembalancesummaryv")
List<InvItemBalanceSummaryV> selectByInvCodeAndSubinvCodeAndLocatorCode(@Param("invCode") String invCode,@Param("subinvCode") String subinvCode,@Param("locatorCode") String locatorCode);
@Select("SELECT * FROM inv_item_balance_summary_v WHERE item_id = #{item_id}")
@ResultMap("invitembalancesummaryv")
List<InvItemBalanceSummaryV> selectByItemId(@Param("item_id") String item_id);
}
\ No newline at end of file
package orthopedics.dao;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvItemCategory;
/**
* @author
*/
public interface InvItemCategoryMapper{
@Select("SELECT c.* FROM inv_item_category c " +
"LEFT JOIN inv_inventory y " +
"ON c.inv_id = y.master_inv_id " +
"LEFT JOIN inv_item i " +
"ON c.item_id = i.id " +
"WHERE y.id=#{invId} AND i.item_code = #{itemCode} " +
"AND ((#{now} > c.start_date AND c.end_date IS NULL) OR (#{now} BETWEEN c.start_date AND c.end_date))")
//@Select("SELECT * FROM inv_item_category c " +
// "WHERE c.inv_id=#{invId} AND c.item_id = #{itemId} " +
// "AND ((#{now} > c.start_date AND c.end_date IS NULL) OR (#{now} BETWEEN c.start_date AND c.end_date))")
@Results(id = "invitemcategory", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "categoryId", column = "category_id"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
})
public List<InvItemCategory> selectInvItemCategory(@Param("invId")String invId, @Param("itemCode")String itemCode, @Param("now")LocalDateTime now);
@Select("SELECT c.* FROM inv_item_category c " +
"LEFT JOIN inv_inventory y " +
"ON c.inv_id = y.org_id " +
"LEFT JOIN inv_item i " +
"ON c.item_id = i.id " +
"LEFT JOIN inv_category ic " +
"ON c.category_id = ic.id " +
"WHERE y.id=#{invId} AND i.item_code = #{itemCode} AND ic.category_set = 'INVENTORY' " +
"AND ((#{now} > c.start_date AND c.end_date IS NULL) OR (#{now} BETWEEN c.start_date AND c.end_date))")
@ResultMap("invitemcategory")
public List<InvItemCategory> selectInvItemInventoryCategory(@Param("invId")String invId, @Param("itemCode")String itemCode, @Param("now")LocalDateTime now);
@Select("<script>"
+ "SELECT i.id as 'inv_item_id', iv.id as 'inv_id' "
+ "FROM inv_item_category i ,inv_inventory iv "
+ "WHERE 1=1 "
+ " AND i.id in"
+ "<foreach collection='ids' item='id' index='index' open='(' close=')' separator=','>"
+ " #{id}"
+ "</foreach>"
+ " AND iv.master_inv_id = i.inv_id "
+ "AND iv.master_inv_id != iv.id"
+ "</script>")
List<Map<String, String>> selectInvChildId(@Param("ids")List<String> ids);
@Insert(
"INSERT INTO inv_item_category(id,create_by,create_time,update_by,update_time"
+ "inv_id,item_code,item_name,specification,item_desc,primary_unit,lot_control,serial_control,status,"
+ "reg_number,general_name,manufacturer_id,default_vendor_id,purchase_price,min_inv_qty,max_inv_qty,image_url) "
+ "SELECT REPLACE(uuid(), '-', ''),inv.create_by,inv.create_time,inv.update_by,inv.update_time,"
+ "#{invId},inv.item_code,"
+ "inv.item_name,inv.specification,inv.item_desc,inv.primary_unit,inv.lot_control,inv.serial_control,"
+ "inv.status,inv.reg_number,inv.general_name,inv.manufacturer_id,inv.default_vendor_id,"
+ "inv.purchase_price,inv.min_inv_qty,inv.max_inv_qty,inv.image_url "
+ "FROM"
+ "inv_item inv" +
"WHERE id = #{id} ")
int insertChildInventoryIntoBatch(@Param("ids")String id, @Param("invId")String invId);
@Select("select * from inv_item_category where inv_id=#{invId}")
@ResultMap("invitemcategory")
public List<InvItemCategory> selectInvItemInventoryCategoryG(@Param("invId")String invId);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import orthopedics.model.InvItemChange;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author ice
*/
public interface InvItemChangeMapper{
@Select("SELECT * FROM inv_item_change")
@Results(id = "invitemchange", value ={
@Result(property = "id", column = "id"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "pystype", column = "pystype"),
@Result(property = "media", column = "media"),
@Result(property = "isbn", column = "isbn"),
@Result(property = "plucode", column = "plucode"),
@Result(property = "scancode", column = "scancode"),
@Result(property = "extcode", column = "extcode"),
@Result(property = "purchasePrice", column = "purchase_price"),
@Result(property = "generalName", column = "general_name"),
@Result(property = "cip", column = "cip"),
@Result(property = "manufacturerId", column = "manufacturer_id"),
@Result(property = "specification", column = "specification"),
@Result(property = "primaryUnit", column = "primary_unit"),
@Result(property = "imageUrl", column = "image_url"),
@Result(property = "credate", column = "credate"),
@Result(property = "creatby", column = "creatby"),
@Result(property = "moddate", column = "moddate"),
@Result(property = "modby", column = "modby"),
@Result(property = "packQty", column = "pack_qty"),
@Result(property = "packUnit", column = "pack_unit"),
@Result(property = "tax", column = "tax"),
@Result(property = "isset", column = "isset"),
@Result(property = "proType", column = "pro_type"),
@Result(property = "isBorrow", column = "is_borrow"),
@Result(property = "RFID", column = "RFID"),
@Result(property = "defaultVendorId", column = "default_vendor_id"),
@Result(property = "lotControl", column = "lot_control"),
@Result(property = "serialControl", column = "serial_control"),
@Result(property = "minInvQty", column = "min_inv_qty"),
@Result(property = "maxInvQty", column = "max_inv_qty"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "status", column = "status"),
@Result(property = "editVersions", column = "edit_versions"),
})
public List<InvItemChange> select();
@Insert("<script>" +
"INSERT INTO inv_item_change(id,inv_id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,primary_unit,image_url,credate,creatby,moddate,modby,pack_qty,pack_unit,tax,isset,pro_type,is_borrow,RFID,default_vendor_id,lot_control,serial_control,min_inv_qty,max_inv_qty,org_id,create_by,create_time,update_by,update_time,status,edit_versions) VALUES" +
"<foreach collection='invitemchanges' item='item' index='index' separator=','>" +
"(#{item.id},#{item.invId},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.itemCode},#{item.itemName},#{item.itemDesc},#{item.pystype},#{item.media},#{item.isbn},#{item.plucode},#{item.scancode},#{item.extcode},#{item.purchasePrice},#{item.generalName},#{item.cip},#{item.manufacturerId},#{item.specification},#{item.primaryUnit},#{item.imageUrl},#{item.credate},#{item.creatby},#{item.moddate},#{item.modby},#{item.packQty},#{item.packUnit},#{item.tax},#{item.isset},#{item.proType},#{item.isBorrow},#{item.RFID},#{item.defaultVendorId},#{item.lotControl},#{item.serialControl},#{item.minInvQty},#{item.maxInvQty},#{item.orgId},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.status},#{item.editVersions})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitemchanges")List<InvItemChange> InvItemChangeList);
@Insert(
"INSERT INTO inv_item_change(id,inv_id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,primary_unit,image_url,credate,creatby,moddate,modby,pack_qty,pack_unit,tax,isset,pro_type,is_borrow,RFID,default_vendor_id,lot_control,serial_control,min_inv_qty,max_inv_qty,org_id,create_by,create_time,update_by,update_time,status,edit_versions) VALUES" +
"(#{id},#{invId},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{itemCode},#{itemName},#{itemDesc},#{pystype},#{media},#{isbn},#{plucode},#{scancode},#{extcode},#{purchasePrice},#{generalName},#{cip},#{manufacturerId},#{specification},#{primaryUnit},#{imageUrl},#{credate},#{creatby},#{moddate},#{modby},#{packQty},#{packUnit},#{tax},#{isset},#{proType},#{isBorrow},#{RFID},#{defaultVendorId},#{lotControl},#{serialControl},#{minInvQty},#{maxInvQty},#{orgId},#{createBy},#{createTime},#{updateBy},#{updateTime},#{status},#{editVersions})"
)
Integer insert(InvItemChange InvItemChange);
@Select("select purchase_price,edit_versions from inv_item_change where item_code = #{itemCode} order by edit_versions desc LIMIT 1")
@ResultMap("invitemchange")
InvItemChange selectInvItemChange(@Param("itemCode") String itemCode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemLocatorItemCategoryV;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author cen.zhihong
*/
public interface InvItemLocatorItemCategoryVMapper{
@Select("SELECT * FROM inv_item_locator_item_category_v")
@Results(id = "invitemlocatoritemcategoryv", value ={
@Result(property = "invId", column = "inv_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "categoryId", column = "category_id"),
@Result(property = "categoryCode", column = "category_code"),
})
public List<InvItemLocatorItemCategoryV> select();
@Select("SELECT * FROM inv_item_locator_item_category_v WHERE item_id = #{itemId}")
@ResultMap("invitemlocatoritemcategoryv")
public List<InvItemLocatorItemCategoryV> selectByItemId(@Param("itemId")String itemId);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvItemLot;
/**
* @author
*/
public interface InvItemLotMapper{
@Select("<script>" +
"SELECT * FROM inv_item_lot where 1=1 " +
"AND lot_number= #{lotNumber} " +
"AND inv_id=#{invId} " +
"<if test = 'subInvId != null and subInvId != \"\"'>" +
"AND subinv_id = #{subInvId} " +
"</if>" +
"<if test = 'locatorId != null and locatorId != \"\"'>" +
"AND locator_id = #{locatorId} " +
"</if>" +
"AND item_id=#{itemId} " +
" AND status = 'A'" +
"</script>")
@Results(id = "invitemlot", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "lotNumber", column = "lot_number"),
@Result(property = "lotQuantity", column = "lot_quantity"),
@Result(property = "originTxLotId", column = "origin_tx_lot_id"),
@Result(property = "status", column = "status"),
@Result(property = "parentLotId", column = "parent_lot_id"),
@Result(property = "productionDate", column = "production_date"),
@Result(property = "expirationDate", column = "expiration_date"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "ownerId", column = "owner_id"),
@Result(property = "lastTxId", column = "last_tx_id"),
@Result(property = "cosignmentStartDate", column = "cosignment_start_date"),
@Result(property = "cosignmentEndDate", column = "cosignment_end_date"),
@Result(property = "ownerType", column = "owner_type"),
@Result(property = "cosignmentStarDate", column = "cosignment_star_date"),
@Result(property = "supplierLotNumber", column = "supplier_lot_number"),
@Result(property = "productionBatchNumber", column = "production_batch_number"),
@Result(property = "manufactureItemCode", column = "manufacture_item_code"),
@Result(property = "supplierSerialNumber", column = "supplier_serial_number"),
@Result(property = "productionSerialNumber", column = "production_serial_number"),
})
public List<InvItemLot> selectByLotNumber(@Param("invId") String invId, @Param("subInvId")String subInvId, @Param("locatorId")String locatorId,
@Param("itemId")String itemId,@Param("lotNumber")String lotNumber);
@Update("<script>" +
"<foreach collection='invItemLots' item = 'invItemLot' index='index' separator=';'>" +
"UPDATE inv_item_lot SET update_by = #{invItemLot.updateBy},update_time=#{invItemLot.updateTime}," +
"status='I'," +
"last_tx_id = #{invItemLot.lastTxId} " +
"WHERE id = #{invItemLot.id}" +
"</foreach>" +
"</script>")
Integer updateOldInvItemLot(@Param("invItemLots")List<InvItemLot> invItemLotList);
// @Insert("<script>" +
// "INSERT INTO inv_item_lot(id,create_by,create_time,update_by,update_time,inv_id,item_id," +
// "lot_number,lot_quantity,origin_tx_lot_id,status,parent_lot_id," +
// "production_date,expiration_date,subinv_id,locator_id," +
// "owner_id,last_tx_id,cosignment_start_date,cosignment_end_date,owner_type) VALUES " +
// "<foreach collection='invItemLots' item='invItemLot' index='index' separator=','>" +
// "(REPLACE(UUID(), '-', ''), #{invItemLot.createBy},#{invItemLot.createTime},#{invItemLot.updateBy},#{invItemLot.updateTime}," +
// "#{invItemLot.invId},#{invItemLot.itemId},#{invItemLot.lotNumber},#{invItemLot.lotQuantity},#{invItemLot.originTxLotId}," +
// "'A',#{invItemLot.parentLotId},#{invItemLot.productionDate},#{invItemLot.expirationDate},#{invItemLot.subinvId},#{invItemLot.locatorId}," +
// "#{invItemLot.ownerId},#{invItemLot.lastTxId},#{invItemLot.cosignmentStartDate},#{invItemLot.cosignmentEndDate},#{invItemLot.ownerType})" +
// "</foreach>" +
// "</script>")
// Integer insertInvItemLot(@Param("invItemLots")List<InvItemLot> invItemLotList);
@Insert("<script>" +
"INSERT INTO inv_item_lot(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_id,lot_number,lot_quantity,origin_tx_lot_id,status,parent_lot_id,production_date,expiration_date,subinv_id,locator_id,owner_id,last_tx_id,cosignment_start_date,cosignment_end_date,owner_type,cosignment_star_date,supplier_lot_number,production_batch_number,manufacture_item_code,supplier_serial_number,production_serial_number) VALUES" +
"<foreach collection='invitemlots' item='item' index='index' separator=','>" +
"((REPLACE(UUID(), '-', ''),#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.itemId},#{item.lotNumber},#{item.lotQuantity},#{item.originTxLotId},'A',#{item.parentLotId},#{item.productionDate},#{item.expirationDate},#{item.subinvId},#{item.locatorId},#{item.ownerId},#{item.lastTxId},#{item.cosignmentStartDate},#{item.cosignmentEndDate},#{item.ownerType},#{item.cosignmentStarDate},#{item.supplierLotNumber},#{item.productionBatchNumber},#{item.manufactureItemCode},#{item.supplierSerialNumber},#{item.productionSerialNumber})" +
"</foreach>" +
"</script>")
Integer insertInvItemLot(@Param("invitemlots")List<InvItemLot> InvItemLotList);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemLotV;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author cen.zhihong
*/
public interface InvItemLotVMapper{
@Select("SELECT * FROM inv_item_lot_v")
@Results(id = "invitemlotv", value ={
@Result(property = "invId", column = "inv_id"),
@Result(property = "invCode", column = "inv_code"),
@Result(property = "invName", column = "inv_name"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "subinvCode", column = "subinv_code"),
@Result(property = "subinvName", column = "subinv_name"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "locatorCode", column = "locator_code"),
@Result(property = "locatorName", column = "locator_name"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "specification", column = "specification"),
@Result(property = "lotNumber", column = "lot_number"),
@Result(property = "lotQuantity", column = "lot_quantity"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "unitName", column = "unit_name"),
@Result(property = "supplierLotNumber", column = "supplier_lot_number"),
@Result(property = "supplierSerialNumber", column = "supplier_serial_number"),
@Result(property = "manufactureItemCode", column = "manufacture_item_code"),
@Result(property = "productionBatchNumber", column = "production_batch_number"),
@Result(property = "productionSerialNumber", column = "production_serial_number"),
@Result(property = "productionDate", column = "production_date"),
@Result(property = "expirationDate", column = "expiration_date"),
@Result(property = "ownerType", column = "owner_type"),
@Result(property = "ownerTypeName", column = "owner_type_name"),
@Result(property = "ownerId", column = "owner_id"),
@Result(property = "ownerCode", column = "owner_code"),
@Result(property = "ownerName", column = "owner_name"),
@Result(property = "cosignmentStartDate", column = "cosignment_start_date"),
@Result(property = "cosignmentEndDate", column = "cosignment_end_date"),
@Result(property = "statusCode", column = "status_code"),
@Result(property = "statusName", column = "status_name"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
})
public List<InvItemLotV> select();
@Select("<script>" +
"SELECT ilv.* FROM inv_item_lot_v ilv " +
"<if test = 'categorySet != null and categorySet != \"\" and categoryCode != null and categoryCode != \"\"'>" +
"JOIN inv_item_category iic ON (ilv.item_id = iic.item_id AND ilv.inv_id = iic.inv_id) " +
"JOIN inv_category ic ON ic.id = iic.category_id " +
"</if>" +
"WHERE " +
"ilv.inv_id = #{invId} AND ilv.item_id = #{itemId} And ilv.lot_number = #{lotNumber} " +
"<if test = 'categorySet != null and categorySet != \"\" and categoryCode != null and categoryCode != \"\"'>" +
"AND ic.category_set = #{categorySet} AND ic.category_code LIKE #{categoryCode} " +
"</if>" +
"<if test = 'status != null and status != \"\"'>" +
"AND status_code = #{status} " +
"</if>" +
"</script>")
@ResultMap("invitemlotv")
public List<InvItemLotV> selectByInvIdAndItemIdAndLotNumberAndStatusWithCategory
(@Param("invId")String invId,@Param("itemId")String itemId,
@Param("categorySet")String categorySet,@Param("categoryCode")String categoryCode,
@Param("lotNumber")String lotNumber,@Param("status")String status);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvItem;
import org.apache.ibatis.annotations.Param;
/**
* @author ice
*/
public interface InvItemMapper{
@Select("SELECT * FROM inv_item")
@Results(id = "invitem", value ={
@Result(property = "id", column = "id"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "pystype", column = "pystype"),
@Result(property = "media", column = "media"),
@Result(property = "isbn", column = "isbn"),
@Result(property = "plucode", column = "plucode"),
@Result(property = "scancode", column = "scancode"),
@Result(property = "extcode", column = "extcode"),
@Result(property = "purchasePrice", column = "purchase_price"),
@Result(property = "generalName", column = "general_name"),
@Result(property = "cip", column = "cip"),
@Result(property = "manufacturerId", column = "manufacturer_id"),
@Result(property = "specification", column = "specification"),
@Result(property = "imageUrl", column = "image_url"),
@Result(property = "packQty", column = "pack_qty"),
@Result(property = "packUnit", column = "pack_unit"),
@Result(property = "tax", column = "tax"),
@Result(property = "isset", column = "isset"),
@Result(property = "status", column = "status"),
@Result(property = "defaultVendorId", column = "default_vendor_id"),
@Result(property = "primaryUnit", column = "primary_unit"),
@Result(property = "lotControl", column = "lot_control"),
@Result(property = "serialControl", column = "serial_control"),
@Result(property = "minInvQty", column = "min_inv_qty"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "proType", column = "pro_type"),
@Result(property = "isBorrow", column = "is_borrow"),
@Result(property = "rfid", column = "rfid"),
@Result(property = "language", column = "language"),
@Result(property = "marketingStatus", column = "marketing_status"),
})
public List<InvItem> select();
@Select("SELECT * FROM inv_item WHERE inv_id = #{invId} AND item_code = #{itemCode} AND status != 'DISABLE'")
@ResultMap("invitem")
List<InvItem> selectByItemCode(@Param("invId") String invId, @Param("itemCode") String itemCode);
@Select("SELECT * FROM inv_item WHERE item_code = #{itemCode} AND status != 'DISABLE'")
@ResultMap("invitem")
List<InvItem> selectByItemCodeG(@Param("itemCode") String itemCode);
@Select("SELECT * FROM inv_item WHERE id = #{itemId}")
@ResultMap("invitem")
InvItem selectByItemId(@Param("itemId") String itemId);
@Insert("<script>" +
"INSERT INTO inv_item(id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,image_url,pack_qty,pack_unit,tax,isset,status,default_vendor_id,primary_unit,lot_control,serial_control,min_inv_qty,org_id,create_by,create_time,update_by,update_time,pro_type,is_borrow,rfid,language,marketing_status) VALUES" +
"<foreach collection='invitems' item='item' index='index' separator=','>" +
"(#{item.id},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.itemCode},#{item.itemName},#{item.itemDesc},#{item.pystype},#{item.media},#{item.isbn},#{item.plucode},#{item.scancode},#{item.extcode},#{item.purchasePrice},#{item.generalName},#{item.cip},#{item.manufacturerId},#{item.specification},#{item.imageUrl},#{item.packQty},#{item.packUnit},#{item.tax},#{item.isset},#{item.status},#{item.defaultVendorId},#{item.primaryUnit},#{item.lotControl},#{item.serialControl},#{item.minInvQty},#{item.orgId},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.proType},#{item.isBorrow},#{item.rfid},#{item.language},#{item.marketingStatus})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitems")List<InvItem> InvItemList);
@Insert(
"INSERT INTO inv_item(id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,image_url,pack_qty,pack_unit,tax,isset,status,default_vendor_id,primary_unit,lot_control,serial_control,min_inv_qty,org_id,create_by,create_time,update_by,update_time,pro_type,is_borrow,rfid,language,marketing_status) VALUES" +
"(#{id},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{itemCode},#{itemName},#{itemDesc},#{pystype},#{media},#{isbn},#{plucode},#{scancode},#{extcode},#{purchasePrice},#{generalName},#{cip},#{manufacturerId},#{specification},#{imageUrl},#{packQty},#{packUnit},#{tax},#{isset},#{status},#{defaultVendorId},#{primaryUnit},#{lotControl},#{serialControl},#{minInvQty},#{orgId},#{createBy},#{createTime},#{updateBy},#{updateTime},#{proType},#{isBorrow},#{rfid},#{language},#{marketingStatus})"
)
Integer insert(InvItem InvItem);
//查询出该商品类型中最新的一条商品代码
@Select("select item_code from inv_item where item_code like '${number}%' and pro_type = #{number} and LENGTH(item_code) = 13 ORDER BY item_code desc limit 1")
@Results(id = "itemCode",value = {
@Result(property = "itemCode", column = "item_code")
})
String selectTheNewItemCode(@Param("number")String number);
//查询出扫描码为690开头的最新的一条数据
@Select("select scancode from inv_item where scancode like concat('690','%') and LENGTH(scancode) = 13 order by scancode desc limit 1")
@Results(id = "scancode",value = {
@Result(property = "scancode", column = "scancode")
})
String selectTheNewScancode();
//根据id查询商品信息
@Select("select * from inv_item where id = #{id}")
@ResultMap("invitem")
InvItem selectInvItemById(@Param("id")String id);
@Select("SELECT * FROM inv_item WHERE item_code = #{itemCode} AND status != 'DISABLE'")
@ResultMap("invitem")
List<InvItem> selectByItemCodeOne( @Param("itemCode") String itemCode);
@Select("SELECT * FROM inv_item WHERE scancode = #{scancode} AND status != 'DISABLE'")
@ResultMap("invitem")
List<InvItem> selectByScancode( @Param("scancode") String scancode);
@Select("SELECT * FROM inv_item WHERE plucode = #{plucode}")
@ResultMap("invitem")
List<InvItem> selectByPlucode( @Param("plucode") String plucode);
@Delete("DELETE FROM inv_item WHERE plucode = #{plucode}")
int deleteByPlucode( @Param("plucode") String plucode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvItemOnhand;
/**
* @author
*/
public interface InvItemOnhandMapper{
@Select("SELECT * FROM inv_item_onhand WHERE inv_id = #{invId} AND subinv_id = #{subInvId} AND (locator_id is null or locator_id = #{locatorId}) " +
" AND item_id = #{itemId} AND status = 'A' order by tx_date")
@Results(id = "invitemonhand", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "itemQuantity", column = "item_quantity"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "originTxId", column = "origin_tx_id"),
@Result(property = "lastTxId", column = "last_tx_id"),
@Result(property = "ownerType", column = "owner_type"),
@Result(property = "ownerId", column = "owner_id"),
@Result(property = "cosignmentStartDate", column = "cosignment_start_date"),
@Result(property = "cosignmentEndDate", column = "cosignment_end_date"),
@Result(property = "status", column = "status"),
@Result(property = "txDate", column = "tx_date"),
})
public List<InvItemOnhand> selectAll(@Param("invId")String invId, @Param("subInvId")String subInvId,
@Param("locatorId")String locatorId, @Param("itemId")String itemId);
@Insert("<script>" +
"INSERT INTO inv_item_onhand(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,subinv_id,locator_id,item_id,item_quantity,unit_code,origin_tx_id,last_tx_id,owner_type,owner_id,cosignment_start_date,cosignment_end_date,status,tx_date) VALUES" +
"<foreach collection='invitemonhands' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.subinvId},#{item.locatorId},#{item.itemId},#{item.itemQuantity},#{item.unitCode},#{item.originTxId},#{item.lastTxId},#{item.ownerType},#{item.ownerId},#{item.cosignmentStartDate},#{item.cosignmentEndDate},'A',#{item.txDate})" +
"</foreach>" +
"</script>")
Integer insert(@Param("invitemonhands")List<InvItemOnhand> InvItemOnhandList);
@Insert(
"INSERT INTO inv_item_onhand(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,subinv_id,locator_id,item_id,item_quantity,unit_code,origin_tx_id,last_tx_id,owner_type,owner_id,cosignment_start_date,cosignment_end_date,status,tx_date) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{subinvId},#{locatorId},#{itemId},#{itemQuantity},#{unitCode},#{originTxId},#{lastTxId},#{ownerType},#{ownerId},#{cosignmentStartDate},#{cosignmentEndDate},'A',#{txDate})"
)
Integer insertInvItemOnhand(InvItemOnhand InvItemOnhand);
@Update("<script>" +
"<foreach collection='invitemonhands' item='item' index='index' separator=';'>" +
"UPDATE inv_item_onhand SET status = 'I' , last_tx_id = #{item.lastTxId} WHERE id = #{item.id} " +
"</foreach>" +
"</script>"
)
Integer disableInvItemOnHand(@Param("invitemonhands")List<InvItemOnhand> InvItemOnhandList);
@Update("UPDATE inv_item_onhand SET status = 'I' , last_tx_id = #{invitemonhands.lastTxId} WHERE id = #{invitemonhands.id} ")
Integer updateByStatusAndLastTxId(@Param("invitemonhands")InvItemOnhand InvItemOnhandList);
@Select("select * from inv_item_onhand where item_id = #{itemId}")
@ResultMap("invitemonhand")
public List<InvItemOnhand> getOneByItemId(@Param("itemId")String itemId);
@Update("UPDATE inv_item_onhand SET id = #{id},create_by = #{createBy},create_time = #{createTime},update_by = #{updateBy},update_time = #{updateTime},attribute_category = #{attributeCategory},attribute1 = #{attribute1},attribute2 = #{attribute2},attribute3 = #{attribute3},attribute4 = #{attribute4},attribute5 = #{attribute5},attribute6 = #{attribute6},attribute7 = #{attribute7},attribute8 = #{attribute8},attribute9 = #{attribute9},attribute10 = #{attribute10},"+
"inv_id = #{invId},subinv_id = #{subinvId},locator_id = #{locatorId},item_quantity = #{itemQuantity},unit_code = #{unitCode},origin_tx_id = #{originTxId},last_tx_id = #{lastTxId},owner_type = #{ownerType},owner_id = #{ownerId},cosignment_start_date = #{cosignmentStartDate},cosignment_end_date = #{cosignmentEndDate},status = #{status},tx_date = #{txDate} where item_id = #{itemId}")
public Integer updateOneByItemId(InvItemOnhand InvItemOnhand);
@Update("update inv_item_onhand set subinv_id = #{subinvId},locator_id = #{locatorId} where origin_tx_id = #{id}")
Integer updateInvItemOnhandAtSure(@Param("subinvId")String subinvId,@Param("locatorId")String locatorId,@Param("id")String id);
@Update("update inv_item_onhand set item_quantity = (item_quantity + #{quantity}) where last_tx_id = #{id}")
Integer updateInvItemOnHandByLastTxId(@Param("quantity")Integer quantity,@Param("id")String id);
@Update("update inv_item_onhand set item_quantity = (item_quantity + #{quantity}) where origin_tx_id = #{id}")
Integer updateInvItemOnHandByOriginTxId(@Param("quantity")Integer quantity,@Param("id")String id);
}
\ No newline at end of file
package orthopedics.dao;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvItemPackage;
/**
* @author
*/
public interface InvItemPackageMapper{
@Select("<script>" +
"SELECT * FROM inv_item_package p " +
"LEFT JOIN inv_item i " +
"ON p.item_id = i.id " +
"WHERE p.serial_id = #{serialId} " +
"AND i.item_code = #{itemCode} " +
"<if test='invId != null'>" +
"AND p.inv_id = #{invId} " +
"</if>" +
"AND ((#{now} > p.start_date AND p.end_date IS NULL) OR (#{now} BETWEEN p.start_date AND p.end_date))" +
"</script>" )
@Results(id = "invitempackage", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "sequence", column = "sequence"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "serialId", column = "serial_id"),
@Result(property = "parentPackageId", column = "parent_package_id"),
@Result(property = "quantity", column = "quantity"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
})
public List<InvItemPackage> selectBySerialNumber(@Param("serialId")String serialId, @Param("itemCode")String itemCode,
@Param("invId")String invId, @Param("now")LocalDateTime now);
@Select("<script>" +
"SELECT x.serial_id as 'child_serial_id', y.serial_id as 'parent_serial_id' FROM inv_item_package x " +
"INNER JOIN inv_item_package y " +
"ON x.parent_package_id = y.id " +
"WHERE 1=1 " +
"<choose> " +
"<when test='serialIds != null and serialIds.size() != 0' >" +
"AND x.serial_id IN " +
"<foreach collection='serialIds' item='item' index='index' open='(' separator=',' close=')'>" +
"#{item}" +
"</foreach> " +
"</when>" +
"<otherwise>" +
"AND false" +
"</otherwise>" +
"</choose>" +
" AND x.parent_package_id is not null " +
" AND ((#{now} > x.start_date AND x.end_date IS NULL) OR (#{now} BETWEEN x.start_date AND x.end_date))" +
"</script>")
public List<Map<String, String>> selectIdWhichHasParent(@Param("serialIds")List<String> serialIds, @Param("now")LocalDateTime now);
@Select("<script>"+
"SELECT * FROM inv_item_package WHERE parent_package_id = #{parentPackageId} " +
"<if test = 'invId != null'>" +
"AND inv_id = #{invId} " +
"</if>" +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) " +
"order by id LIMIT #{startIndex}, #{limit}" +
"</script>")
@ResultMap("invitempackage")
public List<InvItemPackage> selectChildPackage(@Param("parentPackageId")String parentPackageId, @Param("invId")String invId,
@Param("startIndex")int startIndex, @Param("limit")int limit, @Param("now")LocalDateTime now );
@Select("<script>"+
"SELECT * FROM inv_item_package WHERE parent_package_id = #{parentPackageId} " +
"<if test = 'invId != null'>" +
"AND inv_id = #{invId} " +
"</if>" +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) " +
"</script>")
@ResultMap("invitempackage")
public List<InvItemPackage> selectAllChildPackage(@Param("parentPackageId")String parentPackageId, @Param("invId")String invId,
@Param("now")LocalDateTime now );
@Select("SELECT count(id) FROM inv_item_package WHERE parent_package_id = #{parentPackageId} " +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) ")
public Integer selectChildPackageCount(@Param("parentPackageId")String parentPackageId,
@Param("now")LocalDateTime now );
@Insert("<script>" +
"INSERT INTO inv_item_package(id,create_by,create_time,update_by,update_time," +
"attribute_category,attribute1,attribute2,attribute3,attribute4," +
"attribute5,attribute6,attribute7,attribute8,attribute9,attribute10," +
"inv_id,sequence,item_id,serial_id,parent_package_id,quantity,unit_code,start_date,end_date) VALUES" +
"<foreach collection='invitempackages' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime}," +
"#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3}," +
"#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8}," +
"#{item.attribute9},#{item.attribute10},#{item.invId},#{item.sequence},#{item.itemId},#{item.serialId}," +
"#{item.parentPackageId},#{item.quantity},#{item.unitCode},#{item.startDate},#{item.endDate})" +
"</foreach>" +
"</script>")
Integer insertList(@Param("invitempackages")List<InvItemPackage> InvItemPackageList);
@Insert(
"INSERT INTO inv_item_package(id,create_by,create_time,update_by,update_time,attribute_category," +
"attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8," +
"attribute9,attribute10,inv_id,sequence,item_id,serial_id,parent_package_id,quantity,unit_code," +
"start_date,end_date) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1}," +
"#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8}," +
"#{attribute9},#{attribute10},#{invId},#{sequence},#{itemId},#{serialId},#{parentPackageId}," +
"#{quantity},#{unitCode},#{startDate},#{endDate})"
)
Integer insert(InvItemPackage InvItemPackage);
@Insert("<script>" +
"<foreach collection='packageList' item='item' index='index' separator=';'>" +
"INSERT INTO inv_item_package(id,create_by,create_time,update_by,update_time," +
"inv_id,sequence,item_id,serial_id,parent_package_id,quantity,unit_code," +
"start_date, end_date) " +
"SELECT #{item.id},#{item.create_by},#{item.create_time},#{item.update_by},#{item.update_time}," +
"#{item.inv_id}," +
"sequence,item_id,serial_id," +
"parent_package_id,quantity,unit_code,start_date,end_date " +
"FROM inv_item_package " +
"WHERE (parent_package_id = #{packageId}) " +
"</foreach>" +
"</script>")
Integer insertIntoSelectByPackageId(@Param("packageId")String packageId,
@Param("packageList")List<InvItemPackage> invItemPackageList);
@Update("<script>" +
"<foreach collection='packageIds' item='packageId' index='index' separator=';'>" +
"UPDATE inv_item_package SET end_date = #{now} " +
"WHERE (id = #{packageId}) " +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) " +
"</foreach>" +
"</script>")
Integer uploadEndDate(@Param("packageIds")List<String> packageIds, @Param("now")LocalDateTime now);
@Update("<script>" +
"<foreach collection='packageIds' item='packageId' index='index' separator=';'>" +
"UPDATE inv_item_package SET end_date = #{now} " +
"WHERE (id = #{packageId} or parent_package_id = #{packageId}) " +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) " +
"</foreach>" +
"</script>")
Integer uploadAllEndDate(@Param("packageIds")List<String> packageIds, @Param("now")LocalDateTime now);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemPmp;
/**
* @author author
*/
public interface InvItemPmpMapper{
@Select("SELECT * FROM inv_item_pmp")
@Results(id = "invitempmp", value ={
@Result(property = "id", column = "id"),
@Result(property = "plucode", column = "plucode"),
@Result(property = "pystype", column = "pystype"),
@Result(property = "isbn", column = "isbn"),
@Result(property = "scancode", column = "scancode"),
@Result(property = "title", column = "title"),
@Result(property = "jp", column = "jp"),
@Result(property = "price", column = "price"),
@Result(property = "clscode", column = "clscode"),
@Result(property = "clsname", column = "clsname"),
@Result(property = "publisher", column = "publisher"),
@Result(property = "pubname", column = "pubname"),
@Result(property = "pubdate", column = "pubdate"),
@Result(property = "dptcode", column = "dptcode"),
@Result(property = "dptname", column = "dptname"),
@Result(property = "series", column = "series"),
@Result(property = "author", column = "author"),
@Result(property = "reader", column = "reader"),
@Result(property = "fstdate", column = "fstdate"),
@Result(property = "fstdisc", column = "fstdisc"),
@Result(property = "lstdisc", column = "lstdisc"),
@Result(property = "maxdisc", column = "maxdisc"),
@Result(property = "mindisc", column = "mindisc"),
@Result(property = "vendor", column = "vendor"),
@Result(property = "transtitle", column = "transtitle"),
@Result(property = "inctax", column = "inctax"),
@Result(property = "originprice", column = "originprice"),
@Result(property = "currency", column = "currency"),
@Result(property = "status", column = "status"),
})
public List<InvItemPmp> select();
@Insert("<script>" +
"INSERT INTO inv_item_pmp(id,plucode,pystype,isbn,scancode,title,jp,price,clscode,clsname,publisher,pubname,pubdate,dptcode,dptname,series,author,reader,fstdate,fstdisc,lstdisc,maxdisc,mindisc,vendor,transtitle,inctax,originprice,currency,status) VALUES" +
"<foreach collection='invitempmps' item='item' index='index' separator=','>" +
"(#{item.id},#{item.plucode},#{item.pystype},#{item.isbn},#{item.scancode},#{item.title},#{item.jp},#{item.price},#{item.clscode},#{item.clsname},#{item.publisher},#{item.pubname},#{item.pubdate},#{item.dptcode},#{item.dptname},#{item.series},#{item.author},#{item.reader},#{item.fstdate},#{item.fstdisc},#{item.lstdisc},#{item.maxdisc},#{item.mindisc},#{item.vendor},#{item.transtitle},#{item.inctax},#{item.originprice},#{item.currency},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitempmps") List<InvItemPmp> InvItemPmpList);
@Insert(
"INSERT INTO inv_item_pmp(id,plucode,pystype,isbn,scancode,title,jp,price,clscode,clsname,publisher,pubname,pubdate,dptcode,dptname,series,author,reader,fstdate,fstdisc,lstdisc,maxdisc,mindisc,vendor,transtitle,inctax,originprice,currency,status) VALUES" +
"(#{id},#{plucode},#{pystype},#{isbn},#{scancode},#{title},#{jp},#{price},#{clscode},#{clsname},#{publisher},#{pubname},#{pubdate},#{dptcode},#{dptname},#{series},#{author},#{reader},#{fstdate},#{fstdisc},#{lstdisc},#{maxdisc},#{mindisc},#{vendor},#{transtitle},#{inctax},#{originprice},#{currency},#{status})"
)
Integer insert(InvItemPmp InvItemPmp);
@Delete("DELETE FROM inv_item_pmp WHERE plucode = #{plucode}")
int deleteByPlucode( @Param("plucode") String plucode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import orthopedics.model.InvItemRfid;
/**
* @author author
*/
public interface InvItemRfidMapper{
@Select("SELECT * FROM inv_item_rfid")
@Results(id = "invitemrfid", value ={
@Result(property = "id", column = "id"),
@Result(property = "create_by", column = "create_by"),
@Result(property = "create_time", column = "create_time"),
@Result(property = "update_by", column = "update_by"),
@Result(property = "update_time", column = "update_time"),
@Result(property = "sys_org_code", column = "sys_org_code"),
@Result(property = "attribute_category", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "item_id", column = "item_id"),
@Result(property = "item_code", column = "item_code"),
@Result(property = "item_name", column = "item_name"),
@Result(property = "is_borrow", column = "is_borrow"),
@Result(property = "amount", column = "amount"),
@Result(property = "item_desc", column = "item_desc"),
@Result(property = "rfid", column = "rfid"),
@Result(property = "staust", column = "staust"),
})
public List<InvItemRfid> select();
@Insert("<script>" +
"INSERT INTO inv_item_rfid(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,item_id,item_code,item_name,is_borrow,amount,item_desc,rfid,staust) VALUES" +
"<foreach collection='invitemrfids' item='item' index='index' separator=','>" +
"(#{item.id},#{item.create_by},#{item.create_time},#{item.update_by},#{item.update_time},#{item.sys_org_code},#{item.attribute_category},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.item_id},#{item.item_code},#{item.item_name},#{item.is_borrow},#{item.amount},#{item.item_desc},#{item.rfid},#{item.staust})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitemrfids") List<InvItemRfid> InvItemRfidList);
@Insert(
"INSERT INTO inv_item_rfid(id,create_by,create_time,update_by,update_time,sys_org_code,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,item_id,item_code,item_name,is_borrow,amount,item_desc,rfid,staust) VALUES" +
"(#{id},#{create_by},#{create_time},#{update_by},#{update_time},#{sys_org_code},#{attribute_category},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{item_id},#{item_code},#{item_name},#{is_borrow},#{amount},#{item_desc},#{rfid},#{staust})"
)
Integer insert(InvItemRfid InvItemRfid);
@Select("SELECT * FROM inv_item_rfid WHERE rfid = #{rfid}")
@ResultMap("invitemrfid")
public List<InvItemRfid> selectByRfid(@Param("rfid")String rfid);
@Update("UPDATE inv_item_rfid SET staust = #{staust} WHERE id = #{id}")
public void updateById(@Param("id") String id,@Param("staust") String staust);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvItem;
import orthopedics.model.InvItemSerial;
/**
* @author
*/
public interface InvItemSerialMapper{
@Select("<script>"
+ "SELECT * FROM inv_item_serial WHERE 1=1 " +
"AND serial_number = #{serialNumber} " +
"AND inv_id=#{invId} " +
"<if test = 'subInvId != null and subInvId != \"\"'>" +
"AND subinv_id = #{subInvId} " +
"</if>" +
"<if test = 'locatorId != null and locatorId != \"\"'>" +
"AND locator_id = #{locatorId} " +
"</if>" +
"AND item_id=#{itemId} " +
" AND status = 'A'"
+ "</script>")
@Results(id = "invitemserial", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "serialNumber", column = "serial_number"),
@Result(property = "lotNumber", column = "lot_number"),
@Result(property = "productionDate", column = "production_date"),
@Result(property = "expirationDate", column = "expiration_date"),
@Result(property = "originTxSerialId", column = "origin_tx_serial_id"),
@Result(property = "status", column = "status"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "ownerId", column = "owner_id"),
@Result(property = "cosignmentStartDate", column = "cosignment_start_date"),
@Result(property = "cosignmentEndDate", column = "cosignment_end_date"),
@Result(property = "lastTxSerialId", column = "last_tx_serial_id"),
@Result(property = "ownerType", column = "owner_type"),
@Result(property = "supplierLotNumber", column = "supplier_lot_number"),
@Result(property = "productionBatchNumber", column = "production_batch_number"),
@Result(property = "manufactureItemCode", column = "manufacture_item_code"),
@Result(property = "supplierSerialNumber", column = "supplier_serial_number"),
@Result(property = "productionSerialNumber", column = "production_serial_number"),
})
List<InvItemSerial> selectBySerialNumber(@Param("invId") String invId, @Param("subInvId")String subInvId, @Param("locatorId")String locatorId,
@Param("itemId")String itemId, @Param("serialNumber")String serialNumber);
@Select("<script>" +
"SELECT * FROM inv_item_serial " +
"WHERE serial_number IN " +
"<foreach collection='serialNumber' item='item' index='index' open='(' separator=',' close=')'>" +
"#{item}" +
"</foreach>" +
" AND status = 'A'" +
"</script>")
@ResultMap("invitemserial")
List<InvItemSerial> selectBySerialNumberList(@Param("serialNumber")List<String> serialNumber);
// @Insert("<script>" +
// "INSERT INTO inv_item_serial(id,create_by,create_time,update_by,update_time,inv_id," +
// "subinv_id,locator_id,item_id," +
// "serial_number,lot_number,production_date,expiration_date,origin_tx_serial_id,status," +
// "owner_id,cosignment_start_date,cosignment_end_date,last_tx_serial_id,owner_type) VALUES " +
// "<foreach collection='invItemSerials' item='invItemSerial' index='index' separator=','>" +
// "(#{invItemSerial.id}, #{invItemSerial.createBy},#{invItemSerial.createTime}," +
// "#{invItemSerial.updateBy},#{invItemSerial.updateTime},#{invItemSerial.invId}," +
// "#{invItemSerial.subinvId},#{invItemSerial.locatorId},#{invItemSerial.itemId}," +
// "#{invItemSerial.serialNumber},#{invItemSerial.lotNumber},#{invItemSerial.productionDate}," +
// "#{invItemSerial.expirationDate},#{invItemSerial.originTxSerialId},'A'," +
// "#{invItemSerial.ownerId},#{invItemSerial.cosignmentStartDate},#{invItemSerial.cosignmentEndDate},#{invItemSerial.lastTxSerialId},#{invItemSerial.ownerType})" +
// "</foreach>" +
// "</script>")
// Integer insertNewItemSerial(@Param("invItemSerials")List<InvItemSerial> invItemSerialList);
@Insert("<script>" +
"INSERT INTO inv_item_serial(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_id,serial_number,lot_number,production_date,expiration_date,origin_tx_serial_id,status,subinv_id,locator_id,owner_id,cosignment_start_date,cosignment_end_date,last_tx_serial_id,owner_type,supplier_lot_number,production_batch_number,manufacture_item_code,supplier_serial_number,production_serial_number) VALUES" +
"<foreach collection='invitemserials' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.itemId},#{item.serialNumber},#{item.lotNumber},#{item.productionDate},#{item.expirationDate},#{item.originTxSerialId},'A',#{item.subinvId},#{item.locatorId},#{item.ownerId},#{item.cosignmentStartDate},#{item.cosignmentEndDate},#{item.lastTxSerialId},#{item.ownerType},#{item.supplierLotNumber},#{item.productionBatchNumber},#{item.manufactureItemCode},#{item.supplierSerialNumber},#{item.productionSerialNumber})" +
"</foreach>" +
"</script>")
Integer insertNewItemSerial(@Param("invitemserials")List<InvItemSerial> InvItemSerialList);
@Update("<script>" +
"<foreach collection='invItemSerials' item = 'invItemSerial' index='index' separator=';'>" +
"UPDATE inv_item_serial SET update_by = #{invItemSerial.updateBy}, " +
"update_time = #{invItemSerial.updateTime}, status = 'I',last_tx_serial_id=#{invItemSerial.lastTxSerialId} " +
"WHERE id = #{invItemSerial.id}" +
"</foreach>" +
"</script>")
Integer updateOldItemSerial(@Param("invItemSerials")List<InvItemSerial> invItemSerialList);
@Select("<script>" +
"SELECT * FROM inv_item_serial WHERE serial_number = #{serialNumber} " +
"AND item_id = #{itemId} " +
"AND inv_id=#{invId} " +
"AND status = 'A'" +
"</script>")
@ResultMap("invitemserial")
InvItemSerial selectBySerialNumberAndItemId(@Param("invId")String invId, @Param("itemId")String itemId, @Param("serialNumber")String serialNumber);
@Select(
"SELECT * FROM inv_item_serial s " +
"LEFT JOIN inv_item i " +
"ON s.item_id = i.id " +
"WHERE s.serial_number = #{serialNumber} " +
"AND i.item_code = #{itemCode} " +
"AND s.status = 'A'"
)
@ResultMap("invitemserial")
InvItemSerial selectBySerialNumberAndItemCode(@Param("itemCode")String itemCode, @Param("serialNumber")String serialNumber);
@Select("SELECT * FROM inv_item_serial WHERE id = #{id} AND status = 'A'")
@ResultMap("invitemserial")
InvItemSerial selectById(@Param("id")String id);
@Select("<script>" +
"SELECT * FROM inv_item_serial WHERE " +
"<choose> " +
"<when test='ids != null and ids.size() != 0' >" +
"id IN " +
"<foreach collection='ids' item='item' index='index' open='(' separator=',' close=')'>" +
"#{item}" +
"</foreach>" +
"</when>" +
"<otherwise>" +
"false" +
"</otherwise>" +
"</choose>" +
" AND status = 'A'" +
"</script>")
@ResultMap("invitemserial")
List<InvItemSerial> selectByIds(@Param("ids")Set<String> ids);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemSerialV;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author
*/
public interface InvItemSerialVMapper{
@Select("SELECT * FROM inv_item_serial_v")
@Results(id = "invitemserialv", value ={
@Result(property = "id", column = "id"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "invCode", column = "inv_code"),
@Result(property = "invName", column = "inv_name"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "subinvCode", column = "subinv_code"),
@Result(property = "subinvName", column = "subinv_name"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "locatorCode", column = "locator_code"),
@Result(property = "locatorName", column = "locator_name"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "specification", column = "specification"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "unitName", column = "unit_name"),
@Result(property = "lotNumber", column = "lot_number"),
@Result(property = "supplierLotNumber", column = "supplier_lot_number"),
@Result(property = "supplierSerialNumber", column = "supplier_serial_number"),
@Result(property = "manufactureItemCode", column = "manufacture_item_code"),
@Result(property = "productionBatchNumber", column = "production_batch_number"),
@Result(property = "productionSerialNumber", column = "production_serial_number"),
@Result(property = "serialNumber", column = "serial_number"),
@Result(property = "productionDate", column = "production_date"),
@Result(property = "expirationDate", column = "expiration_date"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "ownerTypeCode", column = "owner_type_code"),
@Result(property = "ownerTypeName", column = "owner_type_name"),
@Result(property = "cosignmentStartDate", column = "cosignment_start_date"),
@Result(property = "cosignmentEndDate", column = "cosignment_end_date"),
@Result(property = "statusCode", column = "status_code"),
@Result(property = "statusName", column = "status_name"),
@Result(property = "ownerCode", column = "owner_code"),
@Result(property = "ownerName", column = "owner_name"),
})
public List<InvItemSerialV> select();
@Insert("<script>" +
"INSERT INTO inv_item_serial_v(id,inv_id,inv_code,inv_name,subinv_id,subinv_code,subinv_name,locator_id,locator_code,locator_name,item_id,item_code,item_name,item_desc,specification,unit_code,unit_name,lot_number,supplier_lot_number,supplier_serial_number,manufacture_item_code,production_batch_number,production_serial_number,serial_number,production_date,expiration_date,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,owner_type_code,owner_type_name,cosignment_start_date,cosignment_end_date,status_code,status_name,owner_code,owner_name) VALUES" +
"<foreach collection='invitemserialvs' item='item' index='index' separator=','>" +
"(#{item.id},#{item.invId},#{item.invCode},#{item.invName},#{item.subinvId},#{item.subinvCode},#{item.subinvName},#{item.locatorId},#{item.locatorCode},#{item.locatorName},#{item.itemId},#{item.itemCode},#{item.itemName},#{item.itemDesc},#{item.specification},#{item.unitCode},#{item.unitName},#{item.lotNumber},#{item.supplierLotNumber},#{item.supplierSerialNumber},#{item.manufactureItemCode},#{item.productionBatchNumber},#{item.productionSerialNumber},#{item.serialNumber},#{item.productionDate},#{item.expirationDate},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.ownerTypeCode},#{item.ownerTypeName},#{item.cosignmentStartDate},#{item.cosignmentEndDate},#{item.statusCode},#{item.statusName},#{item.ownerCode},#{item.ownerName})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitemserialvs")List<InvItemSerialV> InvItemSerialVList);
@Insert(
"INSERT INTO inv_item_serial_v(id,inv_id,inv_code,inv_name,subinv_id,subinv_code,subinv_name,locator_id,locator_code,locator_name,item_id,item_code,item_name,item_desc,specification,unit_code,unit_name,lot_number,supplier_lot_number,supplier_serial_number,manufacture_item_code,production_batch_number,production_serial_number,serial_number,production_date,expiration_date,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,owner_type_code,owner_type_name,cosignment_start_date,cosignment_end_date,status_code,status_name,owner_code,owner_name) VALUES" +
"(#{id},#{invId},#{invCode},#{invName},#{subinvId},#{subinvCode},#{subinvName},#{locatorId},#{locatorCode},#{locatorName},#{itemId},#{itemCode},#{itemName},#{itemDesc},#{specification},#{unitCode},#{unitName},#{lotNumber},#{supplierLotNumber},#{supplierSerialNumber},#{manufactureItemCode},#{productionBatchNumber},#{productionSerialNumber},#{serialNumber},#{productionDate},#{expirationDate},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{ownerTypeCode},#{ownerTypeName},#{cosignmentStartDate},#{cosignmentEndDate},#{statusCode},#{statusName},#{ownerCode},#{ownerName})"
)
Integer insert(InvItemSerialV InvItemSerialV);
@Select("<script>"
+ "SELECT it.*, ic.category_code,ic.category_name "
+ "FROM inv_item_category iic,inv_category ic,inv_item_serial_v it "
+ "WHERE "
+ "1 = 1 "
+ " AND it.item_id = iic.item_id "
+ " AND it.inv_id = iic.inv_id "
+ " AND ic.id = iic.category_id "
+ " AND it.inv_code = #{invCode} "
+ "<if test='categorySet != null and categorySet != \"\"'>"
+ " AND ic.category_set = #{categorySet}"
+ "</if>"
+ "<if test='status != null and status != \"\"'>"
+ " AND it.status_code = #{status}"
+ "</if>"
+ "<if test='categoryCode != null and categoryCode != \"\"'>"
+ " AND ic.category_code like concat('%',#{categoryCode},'%')"
+ "</if>"
+ "<if test='itemCode != null and itemCode != \"\"'>"
+ " AND it.item_code like concat('%',#{itemCode},'%')"
+ "</if>"
+ "<if test='serialNumbers != null and serialNumbers.size > 0'>"
+ " AND it.serial_number IN "
+ "<foreach collection='serialNumbers' item='serialNumber' index='index' open='(' close=')' separator=','>"
+ "#{serialNumber}"
+ "</foreach>"
+ "</if>"
+ "</script>")
public List<Map<String, Object>> selectCategoryByInvAndCategory(@Param("invCode")String invCode, @Param("categorySet")String category,
@Param("categoryCode")String categoryCode, @Param("itemCode")String itemCode, @Param("serialNumbers")List<String> serialNumbers,
@Param("status")String status);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemSku;
/**
* @author author
*/
public interface InvItemSkuMapper{
@Select("SELECT * FROM inv_item_sku")
@Results(id = "invitemsku", value ={
@Result(property = "id", column = "id"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "external", column = "external"),
@Result(property = "itemSku", column = "item_sku"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "remark", column = "remark"),
@Result(property = "status", column = "status"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
})
public List<InvItemSku> select();
@Insert("<script>" +
"INSERT INTO inv_item_sku(id,sys_org_code,org_id,external,item_sku,item_code,item_name,item_desc,remark,status,create_by,create_time,update_by,update_time) VALUES" +
"<foreach collection='invitemskus' item='item' index='index' separator=','>" +
"(#{item.id},#{item.sysOrgCode},#{item.orgId},#{item.external},#{item.itemSku},#{item.itemCode},#{item.itemName},#{item.itemDesc},#{item.remark},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitemskus") List<InvItemSku> InvItemSkuList);
@Insert(
"INSERT INTO inv_item_sku(id,sys_org_code,org_id,external,item_sku,item_code,item_name,item_desc,remark,status,create_by,create_time,update_by,update_time) VALUES" +
"(#{id},#{sysOrgCode},#{orgId},#{external},#{itemSku},#{itemCode},#{itemName},#{itemDesc},#{remark},#{status},#{createBy},#{createTime},#{updateBy},#{updateTime})"
)
Integer insert(InvItemSku InvItemSku);
@Delete("DELETE FROM inv_item_sku WHERE item_code = #{itemCode}")
int deleteByItemCode( @Param("itemCode") String itemCode);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemTxDefaultV;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author cen.zhihong
*/
public interface InvItemTxDefaultVMapper{
@Select("SELECT * FROM inv_item_tx_default_v")
@Results(id = "invitemtxdefaultv", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "txTypeId", column = "tx_type_id"),
@Result(property = "txTypeCode", column = "tx_type_code"),
@Result(property = "txTypeName", column = "tx_type_name"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "invCode", column = "inv_code"),
@Result(property = "invName", column = "inv_name"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "subinvCode", column = "subinv_code"),
@Result(property = "subinvName", column = "subinv_name"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "locatorCode", column = "locator_code"),
@Result(property = "locatorName", column = "locator_name"),
@Result(property = "enforceFlag", column = "enforce_flag"),
@Result(property = "priority", column = "priority"),
@Result(property = "statusCode", column = "status_code"),
@Result(property = "statusName", column = "status_name"),
@Result(property = "categoryId", column = "category_id"),
@Result(property = "categoryCode", column = "category_code"),
@Result(property = "categoryName", column = "category_name"),
@Result(property = "categoryDesc", column = "category_desc"),
})
public List<InvItemTxDefaultV> select();
@Select("SELECT * FROM inv_item_tx_default_v WHERE item_id = #{itemId} AND tx_type_id = #{txTypeId}")
@ResultMap("invitemtxdefaultv")
public List<InvItemTxDefaultV> selectByItemIdAndTxTypeId(@Param("itemId")String itemId, @Param("txTypeId")String txTypeId);
@Select("SELECT * FROM inv_item_tx_default_v WHERE category_id = #{categoryId} AND tx_type_id = #{txTypeId}")
@ResultMap("invitemtxdefaultv")
public List<InvItemTxDefaultV> selectByCategoryIdAndTxTypeId(@Param("categoryId")String categoryId, @Param("txTypeId")String txTypeId);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvItemV;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author
*/
public interface InvItemVMapper{
@Select("SELECT * FROM inv_item_v WHERE inv_id = #{invId} "
+ "<if test='itemCode != null and itemCode != \"\"'>"
+ "AND item_code = #{itemCode} "
+ "</if>"
+ "AND status = 'A' "
+ "<if test='startIndex != null and limit != null> "
+ " ORDER BY id LIMIT #{startIndex}, #{limit}"
+ "</if>")
@Results(id = "invitemv", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "invCode", column = "inv_code"),
@Result(property = "invName", column = "inv_name"),
@Result(property = "invStatus", column = "inv_status"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "specification", column = "specification"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "unitName", column = "unit_name"),
@Result(property = "lotControl", column = "lot_control"),
@Result(property = "serialControl", column = "serial_control"),
@Result(property = "regNumber", column = "reg_number"),
@Result(property = "generalName", column = "general_name"),
@Result(property = "manufacturerId", column = "manufacturer_id"),
@Result(property = "defaultVendorId", column = "default_vendor_id"),
@Result(property = "purchasePrice", column = "purchase_price"),
@Result(property = "minInvQty", column = "min_inv_qty"),
@Result(property = "maxInvQty", column = "max_inv_qty"),
@Result(property = "imageUrl", column = "image_url"),
@Result(property = "itemStatus", column = "item_status"),
@Result(property = "statusName", column = "status_name"),
})
List<InvItemV> selectByItemCode(@Param("invId") String invId, @Param("itemCode") String itemCode,
@Param("startIndex")Integer startIndex, @Param("limit")Integer limit);
@Insert("<script>" +
"INSERT INTO inv_item_v(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,inv_code,inv_name,inv_status,item_code,item_name,specification,item_desc,unit_code,unit_name,lot_control,serial_control,reg_number,general_name,manufacturer_id,default_vendor_id,purchase_price,min_inv_qty,max_inv_qty,image_url,item_status,status_name) VALUES" +
"<foreach collection='invitemvs' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.invCode},#{item.invName},#{item.invStatus},#{item.itemCode},#{item.itemName},#{item.specification},#{item.itemDesc},#{item.unitCode},#{item.unitName},#{item.lotControl},#{item.serialControl},#{item.regNumber},#{item.generalName},#{item.manufacturerId},#{item.defaultVendorId},#{item.purchasePrice},#{item.minInvQty},#{item.maxInvQty},#{item.imageUrl},#{item.itemStatus},#{item.statusName})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("invitemvs")List<InvItemV> InvItemVList);
@Insert(
"INSERT INTO inv_item_v(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,inv_code,inv_name,inv_status,item_code,item_name,specification,item_desc,unit_code,unit_name,lot_control,serial_control,reg_number,general_name,manufacturer_id,default_vendor_id,purchase_price,min_inv_qty,max_inv_qty,image_url,item_status,status_name) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{invCode},#{invName},#{invStatus},#{itemCode},#{itemName},#{specification},#{itemDesc},#{unitCode},#{unitName},#{lotControl},#{serialControl},#{regNumber},#{generalName},#{manufacturerId},#{defaultVendorId},#{purchasePrice},#{minInvQty},#{maxInvQty},#{imageUrl},#{itemStatus},#{statusName})"
)
Integer insert(InvItemV InvItemV);
@Select("<script>"
+ "SELECT it.*, ic.category_code,ic.category_name "
+ "FROM inv_item_category iic,inv_category ic,inv_item_v it "
+ "WHERE "
+ "1 = 1 "
+ " AND it.id = iic.item_id "
+ " AND it.inv_id = iic.inv_id "
+ " AND ic.id = iic.category_id "
+ " AND it.inv_code = #{invCode} "
+ "<if test='categorySet != null and categorySet != \"\"'>"
+ " AND ic.category_set = #{categorySet}"
+ "</if>"
+ "<if test='categoryCode != null and categoryCode != \"\"'>"
+ " AND ic.category_code like concat('%',#{categoryCode}, '%') "
+ "</if>"
+ "<if test='itemCode != null and itemCode != \"\"'>"
+ " AND it.item_code like concat('%', #{itemCode}, '%')"
+ "</if>"
+ "<if test='itemName != null and itemName != \"\"'>"
+ " AND it.item_name like concat('%', #{itemName}, '%')"
+ "</if>"
+ "<if test='startIndex != null and limit != null'>"
+ " ORDER BY it.id LIMIT #{startIndex}, #{limit} "
+ "</if>"
+ "</script>")
public List<Map<String, Object>> selectCategoryByInvAndCategory(@Param("invCode")String invCode, @Param("categorySet")String category,
@Param("categoryCode")String categoryCode, @Param("itemCode")String itemCode, @Param("itemName")String itemName,
@Param("startIndex") Integer startIndex, @Param("limit") Integer limit);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvLocator;
/**
* @author
*/
public interface InvLocatorMapper{
@Select("SELECT * FROM inv_locator WHERE id = #{id}")
@Results(id = "invlocator", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "locatorCode", column = "locator_code"),
@Result(property = "locatorName", column = "locator_name"),
@Result(property = "locatorDesc", column = "locator_desc"),
@Result(property = "status", column = "status"),
})
public List<InvLocator> selectById(@Param("id")String id);
@Select("SELECT * FROM inv_locator WHERE inv_id=#{invId} AND subinv_id=#{subInvId} AND locator_code=#{locatorCode} AND status='A'")
@ResultMap("invlocator")
List<InvLocator> selectByLocatorCode(@Param("invId")String invId, @Param("subInvId")String subInvId, @Param("locatorCode")String locatorCode);
@Select("SELECT * FROM inv_locator WHERE subinv_id=#{subInvId} AND status='A'")
@ResultMap("invlocator")
List<InvLocator> selectBySubinvId( @Param("subInvId")String subInvId);
@Select("SELECT * FROM inv_locator")
@ResultMap("invlocator")
public List<InvLocator> select();
@Select("select * from inv_locator where locator_code = #{locatorCode}")
@ResultMap("invlocator")
List<InvLocator> selectLocatorByCode(@Param("locatorCode")String locatorCode);
}
\ No newline at end of file
package orthopedics.dao;
import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvMiscTransactionIf;
/**
* @author
*/
public interface InvMiscTransactionIfMapper{
@Select("SELECT * FROM inv_misc_transaction_if WHERE id = #{id}")
@Results(id = "invmisctransactionif", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invCode", column = "inv_code"),
@Result(property = "subinvCode", column = "subinv_code"),
@Result(property = "locatorCode", column = "locator_code"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "lotNumber", column = "lot_number"),
@Result(property = "serialNumber", column = "serial_number"),
@Result(property = "txTypeCode", column = "tx_type_code"),
@Result(property = "txDate", column = "tx_date"),
@Result(property = "txPrice", column = "tx_price"),
@Result(property = "sourceCode", column = "source_code"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "transactionReference", column = "transaction_reference"),
@Result(property = "productionDate", column = "production_date"),
@Result(property = "expirationDate", column = "expiration_date"),
@Result(property = "errorCode", column = "error_code"),
@Result(property = "errorMsg", column = "error_msg"),
@Result(property = "ownerId", column = "owner_id"),
@Result(property = "cosignmentStartDate", column = "cosignment_start_date"),
@Result(property = "cosignmentEndDate", column = "cosignment_end_date"),
@Result(property = "ownerType", column = "owner_type"),
@Result(property = "supplierLotNumber", column = "supplier_lot_number"),
@Result(property = "productionBatchNumber", column = "production_batch_number"),
@Result(property = "manufactureItemCode", column = "manufacture_item_code"),
@Result(property = "supplierSerialNumber", column = "supplier_serial_number"),
@Result(property = "productionSerialNumber", column = "production_serial_number"),
})
public List<InvMiscTransactionIf> selectById(@Param("id")String id);
@Update("UPDATE inv_misc_transaction_if SET error_code = #{errCode} AND error_msg = #{errMsg} WHERE id = #{id}")
int updateErr(@Param("id")String id, @Param("errCode")String errCode, @Param("errMsg")String errMsg);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvSubinventory;
/**
* @author
*/
public interface InvSubinventoryMapper{
@Select("SELECT * FROM inv_subinventory WHERE id = #{id}")
@Results(id = "invsubinventory", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "subinvType", column = "subinv_type"),
@Result(property = "subinvCode", column = "subinv_code"),
@Result(property = "subinvName", column = "subinv_name"),
@Result(property = "subinvDesc", column = "subinv_desc"),
@Result(property = "locatorControl", column = "locator_control"),
@Result(property = "status", column = "status"),
})
public List<InvSubinventory> selectById(@Param("id")String id);
@Select("SELECT * FROM inv_subinventory WHERE inv_id = #{invId} AND subinv_code = #{subInvCode} AND status = 'A'")
@ResultMap("invsubinventory")
public List<InvSubinventory> selectSubInvIdByCode(@Param("invId")String invId, @Param("subInvCode")String subInvCode);
@Select("SELECT * FROM inv_subinventory WHERE inv_id = #{invId} AND status = 'A'")
@ResultMap("invsubinventory")
public List<InvSubinventory> selectByInvId(@Param("invId")String invId);
@Select("SELECT * FROM inv_subinventory")
@ResultMap("invsubinventory")
public List<InvSubinventory> select();
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.InvTransactionAction;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
/**
* @author
*/
public interface InvTransactionActionMapper{
@Select("SELECT * FROM inv_transaction_action WHERE id=#{id}")
@Results(id = "invtransactionaction", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "txActionCode", column = "tx_action_code"),
@Result(property = "txActionName", column = "tx_action_name"),
@Result(property = "status", column = "status"),
})
public List<InvTransactionAction> selectById(@Param("id") String id);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvTransaction;
/**
* @author
*/
public interface InvTransactionMapper{
@Select({"<script>",
"SELECT * FROM inv_transaction WHERE " +
"item_id=#{itemId} AND inv_id=#{invId} AND subinv_id = #{subInvId} " +
"<if test = 'locatorId != null'>and locator_id = #{locatorId}</if>",
"</script>"})
@Results(id = "invtransaction", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "txTypeId", column = "tx_type_id"),
@Result(property = "txSourceTypeId", column = "tx_source_type_id"),
@Result(property = "txActionId", column = "tx_action_id"),
@Result(property = "txDate", column = "tx_date"),
@Result(property = "txQuantity", column = "tx_quantity"),
@Result(property = "txUnit", column = "tx_unit"),
@Result(property = "txPrice", column = "tx_price"),
@Result(property = "lotControl", column = "lot_control"),
@Result(property = "serialControl", column = "serial_control"),
@Result(property = "sourceCode", column = "source_code"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "transactionReference", column = "transaction_reference"),
@Result(property = "summaryFlag", column = "summary_flag"),
@Result(property = "ownerId", column = "owner_id"),
@Result(property = "ownerType", column = "owner_type"),
@Result(property = "cosignmentStartDate", column = "cosignment_start_date"),
@Result(property = "cosignmentEndDate", column = "cosignment_end_date"),
})
public List<InvTransaction> selectByItemId(@Param("invId") String invId, @Param("subInvId")String subInvId, @Param("locatorId")String locatorId,
@Param("itemId")String itemId);
@Insert("INSERT INTO inv_transaction(id, create_by,create_time,update_by,update_time,inv_id,subinv_id," +
"locator_id,item_id,tx_type_id,tx_source_type_id," +
"tx_action_id,tx_date,tx_quantity,tx_unit,tx_price,lot_control,serial_control,source_code,source_header_id," +
"source_line_id,transaction_reference,summary_flag,owner_id,owner_type,cosignment_start_date,cosignment_end_date) VALUES " +
"(#{id}, #{createBy}, #{createTime},#{updateBy},#{updateTime},#{invId}," +
"#{subinvId},#{locatorId},#{itemId},#{txTypeId},#{txSourceTypeId}," +
"#{txActionId},#{txDate},#{txQuantity},#{txUnit},#{txPrice},#{lotControl}," +
"#{serialControl},#{sourceCode},#{sourceHeaderId},#{sourceLineId},#{transactionReference},#{summaryFlag},"
+ "#{ownerId},#{ownerType},#{cosignmentStartDate},#{cosignmentEndDate})")
public Integer insertIntoTransaction(InvTransaction invTransaction);
//查询该接收单该行一共入库过多少数量
@Select("select sum(tx_quantity) sum from inv_transaction where source_header_id = #{sourceHeaderId} and source_line_id = #{sourceLineId} GROUP BY source_header_id,source_line_id")
Integer selectQuantity(@Param("sourceHeaderId")String sourceHeaderId,@Param("sourceLineId")String sourceLineId);
//调拨确认时修改跨库为跨库直接调拨
@Update("UPDATE inv_transaction SET tx_action_id = '2c9f8d286bf8b3de016bfa1012a7008t' WHERE source_header_id = #{headerId} AND source_line_id = #{lineId}")
Integer updateInvTransaction(@Param("headerId")String headerId,@Param("lineId")String lineId);
//调拨确认时增加调入库区货架
@Update("UPDATE inv_transaction SET subinv_id=#{subinvId},locator_id=#{locatorId} WHERE source_header_id = #{headerId} AND source_line_id = #{lineId} and inv_id=#{invId} and tx_quantity > 0")
Integer updateInvTranAtSure(@Param("subinvId")String subinvId,@Param("locatorId")String locatorId,@Param("headerId")String headerId,@Param("lineId")String lineId,@Param("invId")String invId);
//查询调拨的调入库存事务处理
@Select({"<script>" +
"select * from inv_transaction WHERE source_header_id = #{headerId} AND source_line_id = #{lineId} and inv_id=#{invId} and subinv_id= #{subinvId} and source_code ='INVENTORY'" +
"<if test = 'locatorId != null '>and locator_id = #{locatorId}</if>" +
"</script>"})
@ResultMap("invtransaction")
List<InvTransaction> findInvTranAtSure(@Param("headerId")String headerId,@Param("lineId")String lineId,@Param("invId")String invId,@Param("subinvId")String subinvId,@Param("locatorId")String locatorId);
//二次数量不一致时需修改
@Update({"<script>" +
"update inv_transaction SET tx_quantity = #{quantity} where source_header_id = #{headerId} AND source_line_id = #{lineId} and inv_id=#{invId} and subinv_id= #{subinvId} and source_code ='INVENTORY'" +
"<if test = 'locatorId != null '>and locator_id = #{locatorId}</if>" +
"</script>"})
Integer updateInvTranQuantity(@Param("quantity")String quantity,@Param("headerId")String headerId,@Param("lineId")String lineId,@Param("invId")String invId,@Param("subinvId")String subinvId,@Param("locatorId")String locatorId);
//查询库存调拨的出库信息
@Select("select * from inv_transaction where source_header_id = #{headerId} AND source_line_id = #{lineId} and tx_quantity < 0 and source_code ='INVENTORY'")
@ResultMap("invtransaction")
List<InvTransaction> findOutInvTran(@Param("headerId")String headerId,@Param("lineId")String lineId);
//查询库存调拨的出库信息
@Select("select * from inv_transaction where source_header_id = #{headerId} AND source_line_id = #{lineId} and tx_quantity > 0 and source_code ='INVENTORY'")
@ResultMap("invtransaction")
List<InvTransaction> findInInvTran(@Param("headerId")String headerId,@Param("lineId")String lineId);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;
import orthopedics.model.InvTransactionType;
/**
* @author
*/
public interface InvTransactionTypeMapper{
@Select("SELECT * FROM inv_transaction_type WHERE tx_type_code=#{txTypeCode} AND status = 'A'")
@Results(id = "invtransactiontype", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "txSourceTypeId", column = "tx_source_type_id"),
@Result(property = "txActionId", column = "tx_action_id"),
@Result(property = "txTypeCode", column = "tx_type_code"),
@Result(property = "txTypeName", column = "tx_type_name"),
@Result(property = "status", column = "status"),
})
List<InvTransactionType> selectByCode(@Param("txTypeCode")String txTypeCode);
@Select("SELECT * FROM inv_transaction_type WHERE id=#{txTypeId} AND status = 'A'")
@ResultMap("invtransactiontype")
List<InvTransactionType> selectById(@Param("txTypeId")String txTypeId);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvTransferTransactionIf;
/**
* @author
*/
public interface InvTransferTransactionIfMapper{
@Select("SELECT * FROM inv_transfer_transaction_if WHERE id = #{id}")
@Results(id = "invtransfertransactionif", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "sourceInvCode", column = "source_inv_code"),
@Result(property = "sourceSubinvCode", column = "source_subinv_code"),
@Result(property = "sourceLocatorCode", column = "source_locator_code"),
@Result(property = "destinationInvCode", column = "destination_inv_code"),
@Result(property = "destinationSubinvCode", column = "destination_subinv_code"),
@Result(property = "destinationLocatorCode", column = "destination_locator_code"),
@Result(property = "itemCode", column = "item_code"),
@Result(property = "lotNumber", column = "lot_number"),
@Result(property = "serialNumber", column = "serial_number"),
@Result(property = "txTypeCode", column = "tx_type_code"),
@Result(property = "txPrice", column = "tx_price"),
@Result(property = "sourceCode", column = "source_code"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "transactionReference", column = "transaction_reference"),
@Result(property = "errorMsg", column = "error_msg"),
@Result(property = "errorCode", column = "error_code"),
@Result(property = "txDate", column = "tx_date"),
})
public List<InvTransferTransactionIf> selectById(@Param("id")String id);
@Update("UPDATE inv_transfer_transaction_if SET error_code = #{errCode} AND error_msg = #{errMsg} WHERE id = #{id}")
int updateErr(@Param("id")String id, @Param("errCode")String errCode, @Param("errMsg")String errMsg);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvTxLot;
/**
* @author
*/
public interface InvTxLotMapper{
@Select("SELECT * FROM inv_tx_lot")
@Results(id = "invtxlot", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "txId", column = "tx_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "lotNumber", column = "lot_number"),
@Result(property = "lotQuantity", column = "lot_quantity"),
@Result(property = "summaryFlag", column = "summary_flag"),
})
public List<InvTxLot> select();
@Insert("<script>" +
"INSERT INTO inv_tx_lot(id,create_by,create_time,update_by,update_time,inv_id," +
"tx_id,item_id,lot_number,lot_quantity,summary_flag) VALUES" +
"<foreach collection='txLots' item='txLot' index='index' separator=','>" +
"(#{txLot.id},#{txLot.createBy},#{txLot.createTime},#{txLot.updateBy},#{txLot.updateTime}," +
"#{txLot.invId},#{txLot.txId},#{txLot.itemId},#{txLot.lotNumber},#{txLot.lotQuantity},'N')" +
"</foreach>" +
"</script>")
Integer InsertTxLot(@Param("txLots")List<InvTxLot> txLots);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvTxSerial;
/**
* @author
*/
public interface InvTxSerialMapper{
@Select("SELECT * FROM inv_tx_serial")
@Results(id = "invtxserial", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "txId", column = "tx_id"),
@Result(property = "itemId", column = "item_id"),
@Result(property = "serialNumber", column = "serial_number"),
@Result(property = "summaryFlag", column = "summary_flag"),
})
public List<InvTxSerial> select();
@Insert("<script> " +
"INSERT INTO inv_tx_serial(id,create_by,create_time,update_by,update_time,inv_id," +
"tx_id,item_id,serial_number,summary_flag) VALUES " +
"<foreach collection='txSerials' item='txSerial' index='index' separator=','> " +
"(#{txSerial.id}, #{txSerial.createBy},#{txSerial.createTime},#{txSerial.updateBy}," +
"#{txSerial.updateTime},#{txSerial.invId},#{txSerial.txId},#{txSerial.itemId}," +
"#{txSerial.serialNumber},#{txSerial.summaryFlag}) " +
"</foreach>" +
"</script>")
Integer insertTxSerials(@Param("txSerials")List<InvTxSerial> invTxSerialList);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InvUnit;
import org.apache.ibatis.annotations.Param;
/**
* @author
*/
public interface InvUnitMapper{
@Select("SELECT * FROM inv_unit WHERE unit_code = #{unitCode} AND status = 'A'")
@Results(id = "invunit", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "unitName", column = "unit_name"),
@Result(property = "unitDesc", column = "unit_desc"),
@Result(property = "unitClass", column = "unit_class"),
@Result(property = "status", column = "status"),
})
public List<InvUnit> selectByCode(@Param("unitCode")String unitCode);
@Select("select count(id) from inv_unit where unit_code = #{unitCode}")
int selectUnitCode(@Param("unitCode")String unitCode);
@Select("select * from inv_unit where unit_name = #{unitName}")
@ResultMap("invunit")
public InvUnit selectUnitName(@Param("unitName")String unitName);
}
\ No newline at end of file
package orthopedics.dao;
import org.apache.ibatis.annotations.*;
import orthopedics.model.InventoryAccess;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* @author
*/
public interface InventoryAccessMapper{
@Select("SELECT * FROM inv_access WHERE user_id = #{userId} AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date)) ")
@Results(id = "inventoryaccess", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "userId", column = "user_id"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "txAllowed", column = "tx_allowed"),
@Result(property = "entryAllowed", column = "entry_allowed"),
@Result(property = "startDate", column = "start_date"),
@Result(property = "endDate", column = "end_date"),
})
List<InventoryAccess> selectValidInvAccessByUserId(@Param("userId")String userId, @Param("now") LocalDateTime now);
@Select("SELECT * FROM inv_access " +
"WHERE user_id = #{userId} AND inv_id = #{invId} AND entry_allowed = 'Y' " +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date))" )
@ResultMap("inventoryaccess")
List<InventoryAccess> allowEntry(@Param("userId")String userId, @Param("invId")String invId, @Param("now")LocalDateTime now);
@Select("SELECT * FROM inv_access " +
"WHERE user_id = #{userId} AND inv_id = #{invId} AND tx_allowed = 'Y' " +
"AND ((#{now} > start_date AND end_date IS NULL) OR (#{now} BETWEEN start_date AND end_date))" )
@ResultMap("inventoryaccess")
List<InventoryAccess> allowTx(@Param("userId")String userId, @Param("invId")String invId,@Param("now")LocalDateTime now);
}
\ No newline at end of file
package orthopedics.dao;
import org.apache.ibatis.annotations.*;
import orthopedics.model.Inventory;
import java.util.List;
import java.util.Map;
/**
* @author
*/
public interface InventoryMapper{
@Select("SELECT * FROM inv_inventory WHERE id = #{id} AND status='A'")
@Results(id = "inventory", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "invCode", column = "inv_code"),
@Result(property = "invName", column = "inv_name"),
@Result(property = "invDesc", column = "inv_desc"),
@Result(property = "masterInvId", column = "master_inv_id"),
@Result(property = "masterAdmin", column = "master_admin"),
@Result(property = "status", column = "status"),
@Result(property = "defaultConsumeSubinv", column = "default_consume_subinv"),
@Result(property = "defaultWaitingCheckSubinv", column = "default_waiting_check_subinv"),
@Result(property = "defaultStorageSubinv", column = "default_storage_subinv"),
})
public List<Inventory> selectById(@Param("id")String id);
@Select("SELECT * FROM inv_inventory WHERE inv_code = #{invCode} AND status = 'A'")
@ResultMap("inventory")
List<Inventory> selectIdByInvCode(@Param("invCode")String invCode);
@Select("SELECT " +
" iv.id AS invId, " +
" iv.inv_code AS invCode, " +
" iv.inv_name AS invName, " +
" hp.full_pinyin as province, " +
" hc.full_pinyin as city " +
"FROM " +
" inv_inventory iv, " +
" hz_location hl, " +
" hz_province_v hp, " +
" hz_city_v hc " +
"WHERE " +
" iv.inv_code = #{invCode} " +
" AND iv.location_id = hl.id " +
" AND hl.province_code = hp.province_code " +
" AND hl.city_code = hc.city_code")
Map<String, String> selectLocation(@Param("invCode")String invCode);
//根据组织进行查询
@Select("select * from inv_inventory where org_id = #{orgId}")
@ResultMap("inventory")
List<Inventory> selectByOrgId(@Param("orgId")String orgId);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import orthopedics.model.OnlCgformField;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author ice
*/
public interface OnlCgformFieldMapper{
@Select("SELECT * FROM onl_cgform_field")
@Results(id = "onlcgformfield", value ={
@Result(property = "id", column = "id"),
@Result(property = "cgformHeadId", column = "cgform_head_id"),
@Result(property = "dbFieldName", column = "db_field_name"),
@Result(property = "dbFieldTxt", column = "db_field_txt"),
@Result(property = "dbFieldNameOld", column = "db_field_name_old"),
@Result(property = "dbIsKey", column = "db_is_key"),
@Result(property = "dbIsNull", column = "db_is_null"),
@Result(property = "dbType", column = "db_type"),
@Result(property = "dbLength", column = "db_length"),
@Result(property = "dbPointLength", column = "db_point_length"),
@Result(property = "dbDefaultVal", column = "db_default_val"),
@Result(property = "dictField", column = "dict_field"),
@Result(property = "dictTable", column = "dict_table"),
@Result(property = "dictText", column = "dict_text"),
@Result(property = "fieldShowType", column = "field_show_type"),
@Result(property = "fieldHref", column = "field_href"),
@Result(property = "fieldLength", column = "field_length"),
@Result(property = "fieldValidType", column = "field_valid_type"),
@Result(property = "fieldMustInput", column = "field_must_input"),
@Result(property = "fieldExtendJson", column = "field_extend_json"),
@Result(property = "fieldValueRuleCode", column = "field_value_rule_code"),
@Result(property = "isQuery", column = "is_query"),
@Result(property = "isShowForm", column = "is_show_form"),
@Result(property = "isShowList", column = "is_show_list"),
@Result(property = "queryMode", column = "query_mode"),
@Result(property = "mainTable", column = "main_table"),
@Result(property = "mainField", column = "main_field"),
@Result(property = "orderNum", column = "order_num"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "dictFilter", column = "dict_filter"),
@Result(property = "dictLink", column = "dict_link"),
@Result(property = "dictSql", column = "dict_sql"),
})
public List<OnlCgformField> select();
@Insert("<script>" +
"INSERT INTO onl_cgform_field(id,cgform_head_id,db_field_name,db_field_txt,db_field_name_old,db_is_key,db_is_null,db_type,db_length,db_point_length,db_default_val,dict_field,dict_table,dict_text,field_show_type,field_href,field_length,field_valid_type,field_must_input,field_extend_json,field_value_rule_code,is_query,is_show_form,is_show_list,query_mode,main_table,main_field,order_num,update_by,update_time,create_time,create_by,dict_filter,dict_link,dict_sql) VALUES" +
"<foreach collection='onlcgformfields' item='item' index='index' separator=','>" +
"(#{item.id},#{item.cgformHeadId},#{item.dbFieldName},#{item.dbFieldTxt},#{item.dbFieldNameOld},#{item.dbIsKey},#{item.dbIsNull},#{item.dbType},#{item.dbLength},#{item.dbPointLength},#{item.dbDefaultVal},#{item.dictField},#{item.dictTable},#{item.dictText},#{item.fieldShowType},#{item.fieldHref},#{item.fieldLength},#{item.fieldValidType},#{item.fieldMustInput},#{item.fieldExtendJson},#{item.fieldValueRuleCode},#{item.isQuery},#{item.isShowForm},#{item.isShowList},#{item.queryMode},#{item.mainTable},#{item.mainField},#{item.orderNum},#{item.updateBy},#{item.updateTime},#{item.createTime},#{item.createBy},#{item.dictFilter},#{item.dictLink},#{item.dictSql})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("onlcgformfields") List<OnlCgformField> OnlCgformFieldList);
@Insert(
"INSERT INTO onl_cgform_field(id,cgform_head_id,db_field_name,db_field_txt,db_field_name_old,db_is_key,db_is_null,db_type,db_length,db_point_length,db_default_val,dict_field,dict_table,dict_text,field_show_type,field_href,field_length,field_valid_type,field_must_input,field_extend_json,field_value_rule_code,is_query,is_show_form,is_show_list,query_mode,main_table,main_field,order_num,update_by,update_time,create_time,create_by,dict_filter,dict_link,dict_sql) VALUES" +
"(#{id},#{cgformHeadId},#{dbFieldName},#{dbFieldTxt},#{dbFieldNameOld},#{dbIsKey},#{dbIsNull},#{dbType},#{dbLength},#{dbPointLength},#{dbDefaultVal},#{dictField},#{dictTable},#{dictText},#{fieldShowType},#{fieldHref},#{fieldLength},#{fieldValidType},#{fieldMustInput},#{fieldExtendJson},#{fieldValueRuleCode},#{isQuery},#{isShowForm},#{isShowList},#{queryMode},#{mainTable},#{mainField},#{orderNum},#{updateBy},#{updateTime},#{createTime},#{createBy},#{dictFilter},#{dictLink},#{dictSql})"
)
Integer insert(OnlCgformField OnlCgformField);
//查询主表与附表的关联字段
@Select("select * from onl_cgform_field where cgform_head_id = #{id} and main_table = #{mainTableName} and main_field = 'id'")
@ResultMap("onlcgformfield")
List<OnlCgformField> selectByIdAndMain(@Param("id") String id, @Param("mainTableName") String mainTableName);
}
\ No newline at end of file
This diff could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment