freesql自定义sql和参数查询

    public CommonResult Get(string model)
        {
            CommonResult commonResult = new CommonResult();
            SqlParameter[] sqlParameters = new SqlParameter[]
            {
            new SqlParameter("@FModel", $"%{model}%")
            };
            string sql = @" 
            Select t1.FNumber as FMaterialNumber,t1.FName as FMaterialName,
            t6.FName as FAuxPropName,t1.FModel as FMaterialMode,u1.FQty
            From  ICInventory u1 
            left join t_ICItem t1 on u1.FItemID = t1.FItemID
            left join t_AuxItem t6 on u1.FAuxPropID=t6.FItemID
            left join t_MeasureUnit t7 on t1.FSecUnitID=t7.FItemID Where u1.FQty <> 0 
            AND  t1.FModel like @FModel";
            List stockDatas = FreeSqlHelper.Fsql.
                Select().
                WithSql(sql, new { FModel = $"%{model}%" }).ToList();
            commonResult.data = stockDatas;
            return commonResult;
        }

你可能感兴趣的:(sql,sql,数据库,java)